Expand description
ยง๐ป๐ kittest: UI Testing Library for Rust Powered by AccessKit
kittest is a GUI testing library for Rust, inspired by Testing Library. It leverages AccessKit to provide a framework-agnostic solution for testing user interfaces, with a focus on accessibility.
This library is designed to be flexible and works with any GUI framework that supports AccessKit. Creating new kittest integrations is simple and straightforward. To get started, check out our basic integration example.
ยงAvailable Integrations
- egui_kittest: Official integration for egui.
If you create a new integration, please open a PR to add it to this list!
ยงExample usage with egui_kittest
โ
use egui::accesskit::Toggled;
use egui_kittest::{Harness, kittest::Queryable};
fn main() {
let mut checked = false;
let app = |ui: &mut egui::Ui| {
ui.checkbox(&mut checked, "Check me!");
};
let mut harness = Harness::new_ui(app);
let checkbox = harness.get_by_label("Check me!");
assert_eq!(checkbox.toggled(), Some(Toggled::False));
checkbox.click();
harness.run();
let checkbox = harness.get_by_label("Check me!");
assert_eq!(checkbox.toggled(), Some(Toggled::True));
}
Also see the querying example.
Structsยง
- Access
KitNode - Re-export of the
accesskit_consumer::Node
with a more convenient name. - By
- A filter for nodes. The filters are combined with a logical AND.
- State
- The kittest state. This is a wrapper around
accesskit_consumer::Tree
. You could also useaccesskit_consumer::Tree
directly.
Traitsยง
- NodeT
- A kittest node.
- Queryable
- Provides convenience methods for querying nodes in the tree, inspired by https://testing-library.com/.
Functionsยง
- by
- Create an empty filter.
Convenience function for
By::new
. - debug_
fmt_ node - A helper function to nicely format AccessKit nodes.