/prometheus-testing-skills:bdd-cucumber-jsfrom prometheus-testing-skills
Author, run, and maintain BDD integration tests using cucumber-js 13 with Gherkin, playwright-bdd for browser-driven scenarios, and tsx for TypeScript. Use when writing behavior tests, E2E tests, integration tests, feature files, or step definitions in any Node/TypeScript project.
Ships in prometheus-testing-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
author-only <contract-reference> <scenario-IDs> consumes only adopted IDs
and writes features, real assertions, steps and configuration under governing
authoring policy. Read the author-only procedure.
Do not execute/import generated test code, run dry-run/build/lint/typecheck,
install dependencies or modify protected scenarios in this mode.execute <contract-reference> <scenario-IDs> is a separate request. Read
value-scenario-verify from the installed testing skills and require the
complete agreed value-phase production plus current boundary authority before
using any runner/build command below. A task/hour/commit/reviewer request is
not that boundary; process exit zero is not an assertion observation.Under VLBV (the pack's single method; boundaries in
kbd-process-orchestrator/references/boundaries.md), define acceptance/scenarios
before generation, and author executable features/steps only after the complete
agreed production implementation, with no runs until the boundary packet (B4).
A different cadence exists only as a signed per-phase KBD-METHOD deviation. Missing/unknown scenario adoption
blocks; available tools or example commands are not execution permission. Reuse
existing owner-reviewed calibration rather than requesting the same approval.
Record contract/scenario/assertion/oracle source and excluded false positive;
report authored-only artifacts as NOT_EXERCISED until real authorized execution.
Author and run cucumber-js BDD tests in any TypeScript project. This
skill is project-agnostic — nothing here assumes Next.js, Nuxt, Astro, or
any specific application framework. Pair it with bdd-lifecycle-loop for
the create → run → triage → maintain workflow, and with bdd-video-proof
for certification bundles.
@cucumber/cucumber 13.0.0 (weekly ~2.2M npm)playwright-bdd 9.2.0 — canonical cucumber-js ↔ Playwright bridgetsx — recommended TypeScript loader (per cucumber-js docs)Direct @cucumber/cucumber + playwright-core in hooks is legacy in 2026.
playwright-bdd converts .feature files into native Playwright tests, so
you get the Playwright runner (workers, retries, trace viewer, video, HTML
report) for free.
tests/
├── features/ ← Gherkin .feature files
│ ├── api/ ← @api scenarios (HTTP only, no browser)
│ ├── ui/ ← @ui scenarios (Playwright browser)
│ └── system/ ← Full system integration
├── steps/ ← TypeScript step definitions
│ ├── api.steps.ts
│ ├── ui.steps.ts
│ └── common.steps.ts
├── support/
│ ├── world.ts ← Extended BddWorld or CustomWorld
│ └── hooks.ts ← Before/After lifecycle
└── reports/
├── videos/ ← Playwright videos (WebM)
├── screenshots/ ← On-failure snapshots
└── cucumber.json ← Machine-readable report
Project root config:
cucumber.yml (or cucumber.js) — profiles: default, api, uiplaywright.config.ts (when using playwright-bdd)tsconfig.cucumber.json — TypeScript compile settings for tests| Style | When to pick | Runner |
|---|---|---|
| HTTP-only (@api) | Testing REST/GraphQL/CLI. No browser needed. | cucumber-js directly, using Playwright's request API or fetch |
| Playwright-driven (@ui) | Any browser rendering, forms, navigation, visual proof | playwright-bdd — scenarios compile to Playwright tests |
Do NOT drive Playwright manually from cucumber-js Before/After hooks if
playwright-bdd fits — you'll lose Playwright's runner benefits (parallel
workers, trace viewer, video, HTML report).
tests/features/{layer}/{name}.feature:
@ui
Feature: User signs in with valid credentials
As a registered user
I need to sign in
So that I can access my dashboard
Background:
Given the auth server is reachable
Scenario: Happy path
Given a registered user "[email protected]" with password "hunter2"
When they sign in with those credentials
Then they land on the dashboard
And the header greets them by name
Rules:
Background for shared preconditionsScenario Outline for data variations@SCN-AUTH-001) and @api, @ui or @system, plus optional @smoke, @slow. Nondeterministic behavior is declared in the contract's stochastic block, never tagged @flakydata-testid selectors when using @uiimport { Given, When, Then } from '@cucumber/cucumber';
import { expect } from '@playwright/test';
import type { CustomWorld } from '../support/world';
Given(
'a registered user {string} with password {string}',
async function (this: CustomWorld, email: string, password: string) {
this.testUser = await this.factories.user({ email, password });
}
);
When(
'they sign in with those credentials',
async function (this: CustomWorld) {
await this.page.goto(`${this.baseUrl}/sign-in`);
await this.page.getByTestId('email-input').fill(this.testUser.email);
await this.page.getByTestId('password-input').fill(this.testUser.password);
await this.page.getByTestId('submit-button').click();
}
);
Then('they land on the dashboard', async function (this: CustomWorld) {
await expect(this.page).toHaveURL(/\/dashboard/);
});
Patterns:
this: CustomWorld on step functionsasync function — NOT arrow functions (cucumber binds this){string}, {int}) over regexexpect from @playwright/test for browser assertionscommon.steps.tstests/support/world.ts:
import { setWorldConstructor, World, IWorldOptions } from '@cucumber/cucumber';
import type { APIRequestContext, Browser, BrowserContext, Page } from '@playwright/test';
export interface CustomWorldFields {
baseUrl: string;
apiContext?: APIRequestContext;
browser?: Browser;
context?: BrowserContext;
page?: Page;
testData: Record<string, unknown>;
}
export class CustomWorld extends World implements CustomWorldFields {
baseUrl = process.env.BASE_URL ?? 'http://localhost:3000';
testData: Record<string, unknown> = {};
apiContext?: APIRequestContext;
browser?: Browser;
context?: BrowserContext;
page?: Page;
constructor(options: IWorldOptions) {
super(options);
}
}
setWorldConstructor(CustomWorld);
cucumber.yml:
default:
requireModule:
- tsx/esm
import:
- tests/support/*.ts
- tests/steps/*.ts
format:
- progress-bar
- html:tests/reports/cucumber.html
- json:tests/reports/cucumber.json
paths:
- tests/features/**/*.feature
api:
inherits: default
tags: '@api and not @slow'
ui:
inherits: default
tags: '@ui'
package.json scripts:
{
"scripts": {
"test:bdd": "cucumber-js",
"test:bdd:api": "cucumber-js -p api",
"test:bdd:ui": "cucumber-js -p ui",
"test:bdd:tag": "cucumber-js --tags"
}
}
# All scenarios
npx cucumber-js
# By profile
npx cucumber-js -p api
npx cucumber-js -p ui
# By tag
npx cucumber-js --tags "@smoke"
# Dry-run loads support code and skips steps: it is not author-only and is no assertion evidence
npx cucumber-js --dry-run
# No retry flags: a nondeterministic scenario runs its declared stochastic samples
# once (see bdd-lifecycle-loop "stochastic profile"); a FAIL is never rerun to green.
For browser-driven scenarios, switch to playwright-bdd — feature files
compile to Playwright tests and inherit the Playwright runner:
// playwright.config.ts
import { defineConfig } from '@playwright/test';
import { defineBddConfig, cucumberReporter } from 'playwright-bdd';
const testDir = defineBddConfig({
features: 'tests/features/ui/**/*.feature',
steps: 'tests/steps/**/*.ts',
});
export default defineConfig({
testDir,
reporter: [
['html'],
cucumberReporter('json', { outputFile: 'tests/reports/cucumber.json' }),
],
use: {
baseURL: 'http://localhost:3000',
video: 'retain-on-failure',
trace: 'retain-on-failure',
},
});
Run: npx playwright test
Playwright records WebM (VP8) natively via video: 'retain-on-failure'
or video: 'on'. To convert to MP4 for certification bundles (see
bdd-video-proof):
ffmpeg -i input.webm -c copy output.mp4 # lossless stream copy
cucumber 0.23docs/future-work/02-bdd-testing-evolution/BDD-005-testid-drift-detection.mddocs/future-work/02-bdd-testing-evolution/BDD-006-immutable-tests-rule.mddocs/future-work/02-bdd-testing-evolution/BDD-007-candidate-test-drafts.mdreferences/author-only.md (opens in a new tab)references/examples/README.md (opens in a new tab)references/examples/api-http-only/sign-in.feature (opens in a new tab)references/examples/api-http-only/sign-in.steps.ts (opens in a new tab)references/examples/ui-playwright/sign-in.feature (opens in a new tab)references/examples/ui-playwright/sign-in.steps.ts (opens in a new tab)scripts/smoke-test.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub prometheus-ags/prometheus-skill-system --plugin prometheus-testing-skills9 skills in this plugin
/bdd-cucumber-rsAuthor, run, and maintain BDD integration tests in Rust using the cucumber 0.23 crate with async World, tokio + reqwest for HTTP scenarios, and thirtyfour for browser-driven scenarios. Use when writing behavior tests, integration tests, feature files, or step definitions for any Rust crate or workspace.
/bdd-lifecycle-loopCodifies the VLBV define → author → execute (once, at the value-phase boundary) → triage → maintain workflow for BDD suites. Includes outside-in scenario authoring, the stochastic profile for nondeterministic claims (no retry-until-green), an immutable-tests guard, and a visual-baseline refresh workflow with paper trail. Use when standing up a BDD suite, growing one past 100 scenarios, or when nondeterminism starts eroding trust in results.
/bdd-testing2 plugins in one repository ship this exact skill · first indexed Nov 27, 2026