pub struct BrowserTestRunner { /* private fields */ }Expand description
Runs crate::BrowserTest implementations through Chrome for Testing.
Implementations§
Source§impl BrowserTestRunner
impl BrowserTestRunner
Sourcepub fn with_channel(self, channel: Channel) -> Self
pub fn with_channel(self, channel: Channel) -> Self
Select the Chrome release channel.
Sourcepub fn with_visibility(
self,
visibility: impl Into<BrowserTestVisibility>,
) -> Self
pub fn with_visibility( self, visibility: impl Into<BrowserTestVisibility>, ) -> Self
Configure Chrome visibility.
Sourcepub fn with_pause(self, pause: impl Into<PauseConfig>) -> Self
pub fn with_pause(self, pause: impl Into<PauseConfig>) -> Self
Sourcepub fn with_hint(self, hint: impl Display) -> Self
pub fn with_hint(self, hint: impl Display) -> Self
Set extra context shown when a manual pause prompt is enabled.
Sourcepub fn with_chrome_capabilities(
self,
setup: impl Fn(&mut ChromeCapabilities) -> WebDriverResult<()> + Send + Sync + 'static,
) -> Self
pub fn with_chrome_capabilities( self, setup: impl Fn(&mut ChromeCapabilities) -> WebDriverResult<()> + Send + Sync + 'static, ) -> Self
Add custom Chrome capability setup applied to every WebDriver session.
The runner applies its own visible/headless configuration first, then applies custom setup functions in the order they were added. The setup function must be thread-safe because parallel browser tests can create multiple sessions at the same time.
Sourcepub fn with_timeouts(self, timeouts: BrowserTimeouts) -> Self
pub fn with_timeouts(self, timeouts: BrowserTimeouts) -> Self
Set timeouts applied to every session before running tests.
Individual crate::BrowserTest implementations can override this by returning Some from
crate::BrowserTest::timeouts.
Sourcepub fn with_webdriver_timeouts(self, timeouts: BrowserTimeouts) -> Self
👎Deprecated since 0.1.0: use with_timeouts instead
pub fn with_webdriver_timeouts(self, timeouts: BrowserTimeouts) -> Self
use with_timeouts instead
Deprecated name for Self::with_timeouts.
Use Self::with_timeouts in new code.
Sourcepub const fn with_element_query_wait(self, wait: ElementQueryWaitConfig) -> Self
pub const fn with_element_query_wait(self, wait: ElementQueryWaitConfig) -> Self
Set the element query wait applied to every session before running tests.
Individual crate::BrowserTest implementations can override this by returning Some from
crate::BrowserTest::element_query_wait.
Sourcepub fn with_test_parallelism(
self,
parallelism: impl Into<BrowserTestParallelism>,
) -> Self
pub fn with_test_parallelism( self, parallelism: impl Into<BrowserTestParallelism>, ) -> Self
Configure how browser tests are scheduled.
Sourcepub fn with_failure_policy(
self,
failure_policy: impl Into<BrowserTestFailurePolicy>,
) -> Self
pub fn with_failure_policy( self, failure_policy: impl Into<BrowserTestFailurePolicy>, ) -> Self
Configure how browser test failures affect the rest of the run.
Sourcepub fn with_driver_output(self, config: impl Into<DriverOutputConfig>) -> Self
pub fn with_driver_output(self, config: impl Into<DriverOutputConfig>) -> Self
Capture recent browser-driver output for failure diagnostics.
This stores capture configuration and creates a fresh capture buffer for each
Self::run call.
Sourcepub fn with_browser_driver_output(
self,
config: impl Into<DriverOutputConfig>,
) -> Self
👎Deprecated since 0.1.0: use with_driver_output instead
pub fn with_browser_driver_output( self, config: impl Into<DriverOutputConfig>, ) -> Self
use with_driver_output instead
Deprecated name for Self::with_driver_output.
Use Self::with_driver_output in new code.
Sourcepub async fn run<Context, TestError>(
&self,
context: &Context,
tests: BrowserTests<Context, TestError>,
) -> Result<(), Report<BrowserTestError>>
pub async fn run<Context, TestError>( &self, context: &Context, tests: BrowserTests<Context, TestError>, ) -> Result<(), Report<BrowserTestError>>
Run every test with a fresh WebDriver session.
The shared chromedriver process is always terminated, even when a test returns an error or
panics. Test panics are converted into BrowserTestError::Panic reports instead of being
resumed.
Tests run sequentially and stop on the first failure by default. Use
Self::with_test_parallelism to run multiple fresh WebDriver sessions at once. Use
Self::with_failure_policy to execute every test and return all failures as child reports
on one aggregate report.
Non-empty runs require a multithreaded Tokio runtime because Chromedriver::run
requires one. Use #[tokio::test(flavor = "multi_thread")] for browser tests.
§Parameters
context: Given to each test.
§Errors
Returns an error if chromedriver cannot be started or terminated, if a session cannot be created, or if any test fails.
Trait Implementations§
Source§impl Clone for BrowserTestRunner
impl Clone for BrowserTestRunner
Source§fn clone(&self) -> BrowserTestRunner
fn clone(&self) -> BrowserTestRunner
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more