pub struct LocatorExpect<'a> { /* private fields */ }Expand description
Auto-waiting assertion builder created by Locator::expect.
Each assertion method polls the condition repeatedly until it passes or
the timeout expires. Use .not() to negate the next assertion.
Implementations§
Source§impl<'a> LocatorExpect<'a>
impl<'a> LocatorExpect<'a>
Sourcepub fn timeout_ms(self, ms: u64) -> Self
pub fn timeout_ms(self, ms: u64) -> Self
Override the maximum wait time in milliseconds (default: 5000).
Sourcepub fn poll_ms(self, ms: u64) -> Self
pub fn poll_ms(self, ms: u64) -> Self
Override the polling interval in milliseconds (default: 200).
Sourcepub fn not(self) -> Self
pub fn not(self) -> Self
Negate the next assertion (e.g. .not().to_be_visible() waits until hidden).
Sourcepub async fn to_be_visible(self) -> Result<(), TestError>
pub async fn to_be_visible(self) -> Result<(), TestError>
Wait until the element is visible.
§Errors
Returns TestError::Timeout if the condition is not met in time.
Wait until the element is hidden (not visible).
§Errors
Returns TestError::Timeout if the condition is not met in time.
Sourcepub async fn to_be_enabled(self) -> Result<(), TestError>
pub async fn to_be_enabled(self) -> Result<(), TestError>
Wait until the element is enabled.
§Errors
Returns TestError::Timeout if the condition is not met in time.
Sourcepub async fn to_be_disabled(self) -> Result<(), TestError>
pub async fn to_be_disabled(self) -> Result<(), TestError>
Wait until the element is disabled.
§Errors
Returns TestError::Timeout if the condition is not met in time.
Sourcepub async fn to_be_focused(self) -> Result<(), TestError>
pub async fn to_be_focused(self) -> Result<(), TestError>
Wait until the element has keyboard focus.
§Errors
Returns TestError::Timeout if the condition is not met in time.
Sourcepub async fn to_have_text(self, expected: &str) -> Result<(), TestError>
pub async fn to_have_text(self, expected: &str) -> Result<(), TestError>
Wait until the element’s text content equals expected.
§Errors
Returns TestError::Timeout if the condition is not met in time.
Sourcepub async fn to_contain_text(self, expected: &str) -> Result<(), TestError>
pub async fn to_contain_text(self, expected: &str) -> Result<(), TestError>
Wait until the element’s text content contains expected as a substring.
§Errors
Returns TestError::Timeout if the condition is not met in time.
Sourcepub async fn to_have_value(self, expected: &str) -> Result<(), TestError>
pub async fn to_have_value(self, expected: &str) -> Result<(), TestError>
Wait until the element’s input value equals expected.
§Errors
Returns TestError::Timeout if the condition is not met in time.
Sourcepub async fn to_have_attribute(
self,
attr_name: &str,
value: &str,
) -> Result<(), TestError>
pub async fn to_have_attribute( self, attr_name: &str, value: &str, ) -> Result<(), TestError>
Wait until the element has the given attribute with the given value.
§Errors
Returns TestError::Timeout if the condition is not met in time.
Sourcepub async fn to_have_count(self, expected: usize) -> Result<(), TestError>
pub async fn to_have_count(self, expected: usize) -> Result<(), TestError>
Wait until the number of matching elements equals expected.
§Errors
Returns TestError::Timeout if the condition is not met in time.
Sourcepub async fn to_be_checked(self) -> Result<(), TestError>
pub async fn to_be_checked(self) -> Result<(), TestError>
Wait until the element is checked (checkbox/radio).
§Errors
Returns TestError::Timeout if the condition is not met in time.
Sourcepub async fn to_be_unchecked(self) -> Result<(), TestError>
pub async fn to_be_unchecked(self) -> Result<(), TestError>
Wait until the element is unchecked.
§Errors
Returns TestError::Timeout if the condition is not met in time.
Sourcepub async fn to_be_attached(self) -> Result<(), TestError>
pub async fn to_be_attached(self) -> Result<(), TestError>
Wait until the element exists in the DOM.
§Errors
Returns TestError::Timeout if the condition is not met in time.
Sourcepub async fn to_be_detached(self) -> Result<(), TestError>
pub async fn to_be_detached(self) -> Result<(), TestError>
Wait until the element is removed from the DOM.
§Errors
Returns TestError::Timeout if the condition is not met in time.