Playwright May 2026
Creating a "feature" in typically refers to using Behavior-Driven Development (BDD) to write tests in plain English . This is most commonly achieved by integrating Playwright with Cucumber or the playwright-bdd library. 1. Create the Feature File
You must map each "plain English" step to executable code in a file (e.g., login.steps.ts ). Import keywords: Given , When , Then from your BDD library. playwright
💡 : Use the Playwright VS Code extension to run and debug these scenarios directly from your editor. Creating a "feature" in typically refers to using
: Use Playwright methods like page.goto() , page.fill() , and expect() . typescript Create the Feature File You must map each
: Tools like bddgen can convert .feature files into standard Playwright .spec.ts files automatically.
import { Given, When, Then } from '@cucumber/cucumber'; import { expect } from '@playwright/test'; Given('I navigate to the login page', async ({ page }) => { await page.goto('https://example.com'); }); Use code with caution. Copied to clipboard 3. Configuration & Execution To bridge your feature files with Playwright's test runner: : Use Cucumber or playwright-bdd.
Feature: User Login Scenario: Successful login with valid credentials Given I navigate to the login page When I enter valid credentials Then I should be redirected to the dashboard Use code with caution. Copied to clipboard 2. Define the Step Logic