Cucumber-Playwright Framework
raw JSON → 0.1.0-beta.53 verified Sat May 09 auth: no javascript
A BDD test automation framework combining Cucumber for behavior-driven development and Playwright for cross-browser web automation. Current version 0.1.0-beta.53, pre-release with frequent updates. Offers pre-built step definitions for common actions (navigation, authentication, element interactions) and generates HTML reports. Differentiates from other BDD frameworks by tightly integrating Playwright's modern API with Cucumber's Gherkin syntax, supporting multiple protocols and auto-waiting. Requires Node >= 16 and peer dependencies @cucumber/cucumber ^9.0.0, @playwright/test 1.40.0, playwright 1.40.0, and reporting tools.
Common errors
error Cannot find module '@cucumber/cucumber' ↓
cause Peer dependency @cucumber/cucumber not installed.
fix
Run: npm install @cucumber/cucumber@^9.0.0
error TypeError: cucumberPlaywrightFramework.stepOpenLandingPageOfAppUsingConfig is not a function ↓
cause Using default import instead of named import.
fix
Use named import: import { stepOpenLandingPageOfAppUsingConfig } from 'cucumber-playwright-framework'
error Error: Playwright Test runner is not installed. Please install @playwright/test@1.40.0 ↓
cause Missing or mismatched version of @playwright/test.
fix
Run: npm install @playwright/test@1.40.0
error Step undefined: Given the user is on the "home" page of the "app" app ↓
cause Step regex does not match; missing parentheses around 'open|opens'.
fix
Use: Given the user (open|opens) the "home" page of the "app" app
Warnings
deprecated Peer dependency '@cucumber/cucumber@^9.0.0' may become incompatible with newer Cucumber versions. ↓
fix Pin @cucumber/cucumber to ^9.x or check for framework updates.
breaking The step 'Given the <actorName> (open|opens) the "<pageName>" page of the "<appName>" app with the "<appURL>" URL' uses regex; incorrect syntax breaks match. ↓
fix Use exactly '(open|opens)' with parentheses; do not use alternatives without parentheses.
gotcha TypeScript types are shipped but may require 'esModuleInterop' or 'moduleResolution' set to 'node' in tsconfig. ↓
fix Set 'esModuleInterop': true and 'moduleResolution': 'node' (or 'node16') in tsconfig.json.
breaking Playwright version is pinned to 1.40.0; mismatched versions cause runtime errors. ↓
fix Ensure both 'playwright' and '@playwright/test' are exactly 1.40.0 in package.json.
gotcha HTML report generation requires 'cucumber-html-reporter' and a configuration file; missing config causes no report output. ↓
fix Create a cucumber-html-reporter config file or use the default report path.
Install
npm install cucumber-playwright-framework yarn add cucumber-playwright-framework pnpm add cucumber-playwright-framework Imports
- stepOpenLandingPageOfAppUsingConfig wrong
const stepOpenLandingPageOfAppUsingConfig = require('cucumber-playwright-framework').stepOpenLandingPageOfAppUsingConfigcorrectimport { stepOpenLandingPageOfAppUsingConfig } from 'cucumber-playwright-framework' - ScenarioWorld wrong
import { ScenarioWorld } from 'cucumber-playwright-framework'correctimport type { ScenarioWorld } from 'cucumber-playwright-framework' - default export wrong
const cpw = require('cucumber-playwright-framework')correctimport cucumberPlaywrightFramework from 'cucumber-playwright-framework'
Quickstart
npx create-bdd-test-framework e2e-test
cd e2e-test
npm run test
npm run test:report