Expand description
Proc macros for the ferridriver BDD/Cucumber framework.
Provides step definition macros that register async handler functions
via inventory for automatic collection at runtime.
ⓘ
use ferridriver_bdd::prelude::*;
#[given("I navigate to {string}")]
async fn navigate(world: &mut BrowserWorld, url: String) {
world.page().goto(&url, None).await.map_err(|e| step_err!("{e}"))?;
}
#[when("I click {string}")]
async fn click(world: &mut BrowserWorld, selector: String) {
world.page().locator(&selector, None).click(None).await.map_err(|e| step_err!("{e}"))?;
}
#[then("the page title should be {string}")]
async fn check_title(world: &mut BrowserWorld, expected: String) {
let title = world.page().title().await.map_err(|e| step_err!("{e}"))?;
assert_eq!(title, expected);
}Attribute Macros§
- after
- Register an After hook.
- before
- Register a Before hook.
- given
- Register a Given step definition.
- param_
type - Register a custom parameter type for Cucumber expressions.
- step
- Register a keyword-agnostic step definition (matches Given/When/Then).
- then
- Register a Then step definition.
- when
- Register a When step definition.