Repository navigation
Writing Playwright BDD Scenarios
This guide is for anyone who wants to describe a user journey as a test scenario. No coding experience is required.
Gherkin is a plain-text format that reads like a recipe. Each scenario lives in a .feature file under e2e/features/. playwright-bdd converts those files into Playwright tests at run time. You write what should happen; developers implement how.
For background, see the free BDD Overview for Business Analysts and Product Owners course.
Gherkin is sensitive to spacing and keyword casing. Use Feature, Scenario, Given, When, Then, And, and But exactly as shown.
- Open Issues and select New issue.
- Choose the User provided automated test-case template.
- Fill in the form with the journey, steps, and expected result.
The team converts the issue into a feature file. If a step is not implemented yet, the run fails with an undefined step. That is the signal for a developer to add it to e2e/playwright/steps/.
Every file starts with a Feature line. The description sits one indent level below it.
Feature: Reporting unit details
A user looking up a reporting unit sees its client, district, and status.A scenario is a series of steps. Use the exact wording from the Playwright BDD Step Reference. Wrap variable values in double quotes.
Feature: Screen loading
Scenario: Screen loads
Given I visit "/"
Then I can read "Waste Plus"Steps sit one indent level below Scenario, and the scenario sits one level below Feature.
Tag a scenario above its Scenario keyword when it needs a signed-in user. The Playwright setup project performs the real CSS login before any journey runs, then the scenario reuses that session. Do not write login steps into the feature.
@loginAsBCeID
Scenario: Search as a business user
Given I visit "/search"
Then I can read "Search"| Tag | Session |
|---|---|
@loginAsIDIR |
IDIR user, signed in through Entra with TOTP |
@loginAsBCeID |
Business BCeID user |
@chromeOnly |
Chromium-only check, including Lighthouse audits |
Authenticated scenarios start on /search. Add Given I visit "/some/path" as the first step when you need another page.
From the repository root:
cd e2e
npm ci
npx playwright install chromium
PW_FEATURES=features/screen-load.feature npx bddgen && npx playwright testOmit PW_FEATURES to run the full suite. Credentials for the setup project live in the package's git-ignored .env or CI secrets; the Playwright Developer Guide lists the variable names.
- Browse the Playwright BDD Step Reference for the full step vocabulary.
- Check the Playwright Developer Guide for project layout and CI behavior.
- See the Writing Playwright BDD Test Scenarios KB summary for a short companion overview.
This wiki documents NR Waste Plus for users and developers. Verify security and deployment guidance against the current application configuration before applying it elsewhere.
- Report an issue or ask a question in the GitHub repository.
- Follow the Contributing Guidelines to propose an update.
- Read the Code of Conduct.
Collection indexes support human browsing and machine retrieval. Keep both current when adding or moving wiki pages.
NR Waste Plus Wiki | GitHub Repository