pub struct BrowserTests<Context = (), TestError = Dynamic>{ /* private fields */ }Expand description
A collection of browser tests for crate::BrowserTestRunner.
This type erases each concrete test into the boxed trait object used by the runner while keeping call sites concise.
§Examples
#[async_trait]
impl BrowserTest for OpensHomePage {
fn name(&self) -> Cow<'_, str> { "opens home page".into() }
async fn run(&self, _driver: &WebDriver, _context: &()) -> Result<(), Report> { Ok(()) }
}
struct SearchWorks;
#[async_trait]
impl BrowserTest for SearchWorks {
fn name(&self) -> Cow<'_, str> { "search works".into() }
async fn run(&self, _driver: &WebDriver, _context: &()) -> Result<(), Report> { Ok(()) }
}
let tests = BrowserTests::new()
.with(OpensHomePage)
.with(SearchWorks);Implementations§
Source§impl<Context, TestError> BrowserTests<Context, TestError>
impl<Context, TestError> BrowserTests<Context, TestError>
Sourcepub fn with<T>(self, test: T) -> Selfwhere
T: BrowserTest<Context, TestError> + 'static,
pub fn with<T>(self, test: T) -> Selfwhere
T: BrowserTest<Context, TestError> + 'static,
Adds a test and returns the collection for chaining.
Sourcepub fn push<T>(&mut self, test: T) -> &mut Selfwhere
T: BrowserTest<Context, TestError> + 'static,
pub fn push<T>(&mut self, test: T) -> &mut Selfwhere
T: BrowserTest<Context, TestError> + 'static,
Adds a test to the collection.
Trait Implementations§
Source§impl<Context, TestError> Debug for BrowserTests<Context, TestError>
impl<Context, TestError> Debug for BrowserTests<Context, TestError>
Auto Trait Implementations§
impl<Context, TestError> Freeze for BrowserTests<Context, TestError>
impl<Context = (), TestError = Dynamic> !RefUnwindSafe for BrowserTests<Context, TestError>
impl<Context, TestError> Send for BrowserTests<Context, TestError>
impl<Context, TestError> Sync for BrowserTests<Context, TestError>
impl<Context, TestError> Unpin for BrowserTests<Context, TestError>
impl<Context, TestError> UnsafeUnpin for BrowserTests<Context, TestError>
impl<Context = (), TestError = Dynamic> !UnwindSafe for BrowserTests<Context, TestError>
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