Skip to main content

Crate ferridriver_test_macros

Crate ferridriver_test_macros 

Source
Expand description

Proc macros for the ferridriver test framework.

Provides #[ferritest] to register async browser test functions. The annotated function takes a single TestContext; built-in fixtures (page, browser, context, …) resolve lazily through it.

use ferridriver_test::prelude::*;

#[ferritest]
async fn basic_navigation(ctx: TestContext) {
    let page = ctx.page().await?;
    page.goto("https://example.com", None).await?;
    expect(&page).to_have_title("Example").await?;
}

#[ferritest(retries = 2, timeout = "30s", tag = "smoke")]
async fn flaky_test(ctx: TestContext) {
    let page = ctx.page().await?;
    let context = ctx.browser_context().await?;
    // ...
}

Attribute Macros§

after_all
Runs once after all tests in the containing module (suite).
after_each
Runs after each test in the containing module (suite), even on failure.
before_all
Runs once before all tests in the containing module (suite).
before_each
Runs before each test in the containing module (suite).
ferritest
#[ferritest] attribute macro.
ferritest_each
#[ferritest_each(data = [("a", 1), ("b", 2)])] — parameterized test macro.
ferritest_suite
#[ferritest_suite(mode = "serial")] — set the execution mode of every #[ferritest] in the annotated module. A serial suite is dispatched as one batch to a single worker, runs in source order, and skips the rest on first failure. The default (no attribute) is parallel.
fixture
#[fixture] — register a custom, dependency-injected, scoped fixture.