BDD with Cucumber and Playwright
Write Daily List checks as plain-language scenarios that Nina can read, then connect each line to a Playwright step. Learn two ways to join them and what each costs.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: a recipe card in the customer's words. The card says "a soft cake, not too sweet". The baker turns the words into steps. The customer can still read the card and say whether it is the cake they meant.
Nina, the product owner, knows what Daily List should do. She does not read TypeScript. Tom, the tester, writes the browser steps. They need one text both of them can share.
What it is: Playwright is a free program, made by Microsoft, that drives real browsers from test code. is a way of agreeing behaviour with plain examples. Those examples are written in Gherkin, a small format whose lines start with Given, When and Then. They live in a . Cucumber is a tool that reads the file and runs a step definition, the code for one line. A declarative step says what the user wants, not every click. A scenario outline is one scenario run once per row of examples. Keep Gherkin examples distinct from the browser-driving code. A documented integration such as playwright-bdd can generate Playwright Test cases; using Gherkin does not itself replace the runner or its fixtures. The sentences are the agreement. Playwright is still what clicks.
Why it matters: Nina can read "Lily adds a task called Buy milk" and correct it before Tom writes the wrong test. If only Tom ever reads the file, the extra layer is cost without that gain.
A card that lists every spoonful breaks when the kitchen moves one spoon. Steps that list every click break the same way.
Kept simple: a team can do BDD without Cucumber. The tool only runs the sentences.
(SYNTHETIC / TRAINING ONLY: Daily List and every person named here are invented.)
PLAIN WORDS · 4 in this section
- typescript
- JavaScript with added labels for the kinds of data
- playwright
- a free Microsoft tool that drives a browser for tests
- gherkin
- a plain way of writing examples; also a pickled cucumber
- declarative
- saying what should be true, not the steps
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB Writing checks in the customer's plain words so non-coders can read them, and attaching code to each line.
- Write the scenario
- Attach the steps
- Run it
- Read and agree
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| The recipe card in the customer's words | The feature file in plain language |
| The baker's steps for each line | The step definitions |
| The baker who reads the card and bakes | Cucumber, which matches lines to code |
| The customer saying yes, that is it | Nina reading and agreeing the scenario |
WHERE THIS PICTURE STOPS
- A recipe card is loose. A scenario must be exact enough to run.
- A baker uses judgement. Cucumber matches words exactly, so one changed word leaves a step undefined.
- A card is read once. A feature file must be kept in step with the code for as long as the app lives.
HOOK
Words first, code behind.
REMEMBER IT THIS WAY
A story beat: one picture-line that carries the order or the cause.
Words first, code behind: Nina agrees the sentence, Tom attaches the code. One changed word leaves a step undefined.
| In the trick | What it stands for |
|---|---|
| words | the feature file in plain language |
| code | the step definitions |
A scenario must be exact enough to run, so loose wishes do not fit.
TELL A FRIEND
It is like a recipe card in the customer's words, with a baker who turns each line into steps.
OFTEN MIXED UP WITH Page objects in Playwright. Page objects keep clicks and locators in one place. In a behaviour-driven development suite they sit behind the step definitions.
Sources & standards — 8 sources
- Market practice
Gherkin reference (Cucumber documentation) ↗ — Cucumber · Gherkin uses the keywords Feature, Scenario, Given, When, Then, And and But, and a tool runs each step in order (search excerpt, page not opened)
Publisher page opened on 5 November 2026. Earlier search-only notes are superseded for the claims stated here. Wording is paraphrased; source-figure reuse is not assumed.
- Market practice
Playwright behaviour-driven development: setup, Gherkin and end-to-end testing guide (TestDino) ↗ — TestDino · Two routes: Cucumber.js with Playwright inside step definitions, or a package that turns feature files into native Playwright tests so the Playwright runner stays in control (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Best practices (Playwright documentation) ↗ — Microsoft (Playwright) · Test what the user sees, keep tests isolated, prefer role and text locators, use web-first assertions that retry, use TypeScript and ESLint to catch errors early, and run tsc --noEmit in the pipeline (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. A second search on 2026-10-20 returned this page for its title and matched the described content; the page was still not opened (search excerpt, page not opened).
- Market practice
Auto-waiting (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
- Market practice
cucumber-js-world ↗ — raw.githubusercontent.com · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
- Market practice
bdd-config ↗ — raw.githubusercontent.com · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
- Market practice
bdd-first-test ↗ — raw.githubusercontent.com · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
- Market practice
bdd-installation ↗ — raw.githubusercontent.com · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
PRACTISE AND KEEP
Sources for this topic — 9 sources
- Market practice
Gherkin reference (Cucumber documentation) ↗ — Cucumber · Gherkin uses the keywords Feature, Scenario, Given, When, Then, And and But, and a tool runs each step in order (search excerpt, page not opened)
Publisher page opened on 5 November 2026. Earlier search-only notes are superseded for the claims stated here. Wording is paraphrased; source-figure reuse is not assumed.
- Market practice
Playwright behaviour-driven development: setup, Gherkin and end-to-end testing guide (TestDino) ↗ — TestDino · Two routes: Cucumber.js with Playwright inside step definitions, or a package that turns feature files into native Playwright tests so the Playwright runner stays in control (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Best practices (Playwright documentation) ↗ — Microsoft (Playwright) · Test what the user sees, keep tests isolated, prefer role and text locators, use web-first assertions that retry, use TypeScript and ESLint to catch errors early, and run tsc --noEmit in the pipeline (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. A second search on 2026-10-20 returned this page for its title and matched the described content; the page was still not opened (search excerpt, page not opened).
- Market practice
Auto-waiting (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
- Market practice
cucumber-js-world ↗ — raw.githubusercontent.com · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
- Market practice
bdd-config ↗ — raw.githubusercontent.com · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
- Market practice
bdd-first-test ↗ — raw.githubusercontent.com · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
- Market practice
bdd-installation ↗ — raw.githubusercontent.com · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
- Implementation-specific
bdd-quickstart ↗ — raw.githubusercontent.com · playwright-bdd quickstart (community package, not made by the Playwright team): feature files generate native Playwright tests; examples inspected, not executed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.