pub struct TestContext { /* private fields */ }Expand description
Context object passed to every #[ferritest] test function.
Provides typed access to all built-in fixtures (page, browser, context, test_info)
and raw access to the underlying FixturePool for custom fixtures.
Implementations§
Source§impl TestContext
impl TestContext
Sourcepub fn new(pool: FixturePool) -> Self
pub fn new(pool: FixturePool) -> Self
Create a new TestContext wrapping a FixturePool.
Sourcepub async fn page(&self) -> Result<Arc<Page>, TestFailure>
pub async fn page(&self) -> Result<Arc<Page>, TestFailure>
Get the Page fixture (test-scoped, fresh per test).
Sourcepub async fn browser(&self) -> Result<Arc<Browser>, TestFailure>
pub async fn browser(&self) -> Result<Arc<Browser>, TestFailure>
Get the Browser fixture (worker-scoped, shared across tests in a worker).
Sourcepub async fn browser_context(&self) -> Result<Arc<ContextRef>, TestFailure>
pub async fn browser_context(&self) -> Result<Arc<ContextRef>, TestFailure>
Get the BrowserContext fixture (test-scoped).
Sourcepub async fn test_info(&self) -> Result<Arc<TestInfo>, TestFailure>
pub async fn test_info(&self) -> Result<Arc<TestInfo>, TestFailure>
Get the TestInfo fixture (test-scoped runtime context).
Sourcepub fn pool(&self) -> &FixturePool
pub fn pool(&self) -> &FixturePool
Access the underlying FixturePool directly (for custom fixtures).
Trait Implementations§
Source§impl Clone for TestContext
impl Clone for TestContext
Source§fn clone(&self) -> TestContext
fn clone(&self) -> TestContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TestContext
impl !RefUnwindSafe for TestContext
impl Send for TestContext
impl Sync for TestContext
impl Unpin for TestContext
impl UnsafeUnpin for TestContext
impl !UnwindSafe for TestContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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