ferridriver-bdd-macros 0.2.0

Proc macros for the ferridriver BDD/Cucumber framework
Documentation

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).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);
}