pub struct TestWindow { /* private fields */ }Implementations§
Source§impl TestWindow
impl TestWindow
pub fn id(&self) -> WindowId
pub fn snapshot(&self) -> Result<WindowSnapshot>
pub fn snapshot_now(&self) -> Result<WindowSnapshot>
pub fn run_until_idle(&self) -> Result<()>
pub fn pump_frames(&self, frames: usize) -> Result<()>
pub fn advance_time(&self, delta: f64) -> Result<()>
pub fn dispatch_event_now(&self, event: Event) -> Result<()>
pub fn capture_screenshot(&self) -> Result<Screenshot>
pub fn capture_screenshot_now(&self) -> Result<Screenshot>
pub fn capture_artifacts(&self) -> Result<ArtifactBundle>
pub fn capture_debug_frame( &self, request: DebugCaptureRequest, ) -> Result<DebugCaptureArtifact>
pub fn performance_snapshot(&self) -> Result<WindowPerformanceSnapshot>
pub fn locator(&self, selector: Selector) -> Locator
pub fn root(&self) -> Locator
pub fn focused(&self) -> Locator
Sourcepub fn get_by_role(&self, role: SemanticsRole) -> Locator
pub fn get_by_role(&self, role: SemanticsRole) -> Locator
Examples found in repository?
examples/basic.rs (line 27)
14fn main() -> Result<()> {
15 let app = TestApp::new(|| {
16 let state = Rc::new(RefCell::new(AppState::default()));
17 Application::new().window(
18 WindowBuilder::new()
19 .title("SUI Testing Example")
20 .root(ExampleRoot::new(state)),
21 )
22 })?;
23
24 let window = app.main_window()?;
25
26 window
27 .get_by_role(SemanticsRole::TextInput)
28 .with_name("Name")
29 .fill("Ada")?;
30 window
31 .get_by_role(SemanticsRole::Button)
32 .with_name("Save")
33 .click()?;
34 window.get_by_text("Saved").expect().to_be_visible()?;
35
36 println!("Example passed: filled the name field and observed the Saved status.");
37 Ok(())
38}Sourcepub fn get_by_text(&self, text: impl Into<String>) -> Locator
pub fn get_by_text(&self, text: impl Into<String>) -> Locator
Examples found in repository?
examples/basic.rs (line 34)
14fn main() -> Result<()> {
15 let app = TestApp::new(|| {
16 let state = Rc::new(RefCell::new(AppState::default()));
17 Application::new().window(
18 WindowBuilder::new()
19 .title("SUI Testing Example")
20 .root(ExampleRoot::new(state)),
21 )
22 })?;
23
24 let window = app.main_window()?;
25
26 window
27 .get_by_role(SemanticsRole::TextInput)
28 .with_name("Name")
29 .fill("Ada")?;
30 window
31 .get_by_role(SemanticsRole::Button)
32 .with_name("Save")
33 .click()?;
34 window.get_by_text("Saved").expect().to_be_visible()?;
35
36 println!("Example passed: filled the name field and observed the Saved status.");
37 Ok(())
38}pub fn get_by_description(&self, text: impl Into<String>) -> Locator
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TestWindow
impl !Send for TestWindow
impl !Sync for TestWindow
impl !UnwindSafe for TestWindow
impl Freeze for TestWindow
impl Unpin for TestWindow
impl UnsafeUnpin for TestWindow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more