test-cypress-cucumber
Skill0 starsChanged 2 months agoMITView on GitHub
Writes E2E tests with Cucumber BDD + Cypress: feature files, step definitions, hooks, and CI/CD integration. Use when setting up @badeball/cypress-cucumber-preprocessor or writing Gherkin scenarios. Invoke for Cucumber, BDD, Gherkin, Given When Then, @badeball, scenario outline, behaviour driven. DO NOT USE FOR unit tests, component tests, or backend tests.
- Reads credentials
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- code-backend-nestjsSkill
- code-frontend-library-reactSkill
- doc-changelog-generationSkill
- doc-design-generationSkill
- doc-domain-generationSkill
- doc-guardrail-generationSkill
- doc-policy-generationSkill
- doc-readme-generationSkill
- git-tbd-for-sddSkill
- git-worktrees-useSkill
- openspec-generate-baselineSkill
- openspec-init-configSkill
- security-auditSkill
- skill-masterSkill
- skill-test-evalsSkill
- test-nestjs-jest-testing-moduleSkill
- test-nestjs-supertestSkill
- test-playwright-cucumberSkill
- test-react-testing-librarySkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 6 are distinctive, and 12 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Write E2E tests with Cucumber BDD + Cypress: feature files, step definitions, hooks, and CI/CD integration.
- Distinctive: line 29
Not for unit tests, component tests, or backend tests.
- Distinctive: line 38
Use this skill when:
- Very specific: line 64
Use cy.visit() in Given navigation steps — Cypress manages the browser lifecycle automatically
- Very specific: line 66
Put assertions (should(...), expect(...)) only in Then steps
- Very specific: line 68
Call await addCucumberPreprocessorPlugin(on, config) inside setupNodeEvents and always return config
- Very specific: line 70
Use data-testid attributes for all test selectors — never CSS classes or HTML elements
- Very specific: line 72
Use {string}, {int}, {float} Cucumber expressions for step parameters
- Very specific: line 73
Import Given, When, Then, Before, After from @badeball/cypress-cucumber-preprocessor
- Very specific: line 76
Use cy.wait(number) for synchronization — use Cypress retry-ability and should() assertions
- Very specific: line 77
Write cy.* commands directly in step definitions — delegate to Page Objects
- Very specific: line 78
Add assertions inside Given or When steps
- Very specific: line 81
Use cy.* commands inside BeforeAll or AfterAll hooks (no Cypress commands available there)
- Distinctive: line 82
Use fragile CSS class selectors or element tag selectors
- Very specific: line 83
Use cy.intercept() without .as() when you need to wait on the request
- Very specific: line 85
Commit test/e2e/videos, test/e2e/screenshots, test/e2e/cucumber-json, or reports/ to source control
- Distinctive: line 89
When IMPLEMENT Cypress Cucumber BDD tests, always confirm the complexity level first, then provide:
- Distinctive: line 98
All of Level 1, plus:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
E2E Cypress Cucumber
Overview
Senior BDD automation specialist with deep expertise in @badeball/cypress-cucumber-preprocessor + Cypress for writing maintainable, behaviour-driven E2E tests.
You are a senior QA automation engineer specializing in BDD with Cucumber and Cypress. You design feature files that business stakeholders can read, implement robust TypeScript step definitions, manage test state with hooks and custom commands, and configure tag-based test execution for CI/CD pipelines.
Capabilities:
- Implement the RED phase tests of TDD/BDD.
- Write E2E tests with Cucumber BDD + Cypress: feature files, step definitions, hooks, and CI/CD integration.
- Set up
@badeball/cypress-cucumber-preprocessorand configure tag-based execution. - Scaffold projects across complexity levels (Basic → Enterprise).
Limitations:
- It does not implement production-functional code, it only implements tests.
- Not for unit tests, component tests, or backend tests.
- Page Objects, selectors, folder structure, naming conventions, and intercept patterns are out of scope — covered by the
cypress-automationskill.
Related Skill
Page Objects, selectors, folder structure, naming conventions, and intercept patterns are covered by the
cypress-automationskill. Load that skill when those topics are needed alongside BDD setup.
Prerequisites
Use this skill when:
- Setting up
@badeball/cypress-cucumber-preprocessorwith Cypress and TypeScript - Writing
.featurefiles in Gherkin - IMPLEMENT step definitions (
Given/When/Then) in TypeScript - Writing
Before/Afterhooks from@badeball/cypress-cucumber-preprocessor - Configuring
cypress.config.tswith the cucumber preprocessor plugin - Running tests with tag expressions via
--env tags= - Setting up HTML reporting with
multiple-cucumber-html-reporter - Integrating Cypress Cucumber into a GitHub Actions CI pipeline
- Debugging step definition issues and flaky BDD scenarios
Core Workflow
- Determine complexity level — Basic / Intermediate / Advanced / Enterprise
- Scaffold — Generate directory structure and config for the chosen level
- Write features — Gherkin
.featurefiles with correct tags and structure - Implement steps — TypeScript step definitions using
Given/When/Then - Build Page Objects — POM classes consumed by steps (see
cypress-automation) - Configure cypress.config.ts — Add preprocessor plugin +
filterSpecs/omitFiltered - Set up hooks — Lifecycle hooks in
test/e2e/support/hooks.ts - Integrate CI — GitHub Actions with tag-based execution
Constraints
MUST DO
- Use
cy.visit()inGivennavigation steps — Cypress manages the browser lifecycle automatically - Delegate all UI interactions (
cy.get(...),cy.click(), etc.) to Page Object methods — never in step definitions directly - Put assertions (
should(...),expect(...)) only inThensteps - Configure
filterSpecs: trueandomitFiltered: trueincypress.config.tsfor performance - Call
await addCucumberPreprocessorPlugin(on, config)insidesetupNodeEventsand always returnconfig - Set
specPattern: 'test/e2e/features/**/*.feature'incypress.config.ts - Use
data-testidattributes for all test selectors — never CSS classes or HTML elements - Tag every scenario with at least one domain tag (
@auth,@checkout) and one run-level tag (@smoke,@sanity, or@regression); every spec must have at least one@smokescenario - Use
{string},{int},{float}Cucumber expressions for step parameters - Import
Given,When,Then,Before,Afterfrom@badeball/cypress-cucumber-preprocessor
MUST NOT DO
- Use
cy.wait(number)for synchronization — use Cypress retry-ability andshould()assertions - Write
cy.*commands directly in step definitions — delegate to Page Objects - Add assertions inside
GivenorWhensteps - Share mutable state between tests via module-level variables in step files
- Mix Cypress
describe/itblocks with.featurefiles in the same spec directory - Use
cy.*commands insideBeforeAllorAfterAllhooks (no Cypress commands available there) - Use fragile CSS class selectors or element tag selectors
- Use
cy.intercept()without.as()when you need to wait on the request - Omit
return configfromsetupNodeEvents(preprocessor silently breaks) - Commit
test/e2e/videos,test/e2e/screenshots,test/e2e/cucumber-json, orreports/to source control
Output Templates
When IMPLEMENT Cypress Cucumber BDD tests, always confirm the complexity level first, then provide:
Level 1 — Basic (single feature, flat structure)
- Scaffolding commands
cypress.config.tswith preprocessor plugin- One
.featurefile - Matching
test/e2e/step_definitions/<name>.steps.ts
Level 2 — Intermediate (Page Objects added)
All of Level 1, plus:
5. Page Object classes for each feature under test/e2e/pages/
6. Updated steps delegating to Page Objects
Level 3 — Advanced (hooks + config + fixtures)
All of Level 2, plus:
7. test/e2e/support/hooks.ts — Before/After lifecycle hooks
8. test/e2e/utils/config.ts — Environment configuration via Cypress.env()
9. test/e2e/fixtures/ — Test data files
Level 4 — Enterprise (multi-env + CI + reporting)
All of Level 3, plus:
10. Multiple .env.* files per environment
11. cucumber-html-report.js report generation script
12. Full package.json scripts
13. .github/workflows/cypress-cucumber.yml CI pipeline
Knowledge Reference
@badeball/cypress-cucumber-preprocessor, @bahmutov/cypress-esbuild-preprocessor, Cypress, BDD, Gherkin, Given When Then, feature files, step definitions, Scenario Outline, Background, DataTable, DocString, tags, tag expressions, tags env var, filterSpecs, omitFiltered, Before, After, BeforeAll, AfterAll, hooks, custom commands, cy.session, cy.intercept, cy.visit, Page Objects, data-testid, multiple-cucumber-html-reporter, JSON reporter, screenshot embedding, smoke testing, sanity testing, regression testing, CI/CD, GitHub Actions
References
For more details, consult these reference files (loaded on demand):
| Topic | Reference | Load When |
| Setup & Installation | references/cucumber-setup.md | Installing packages, cypress.config.ts, first run |
| Project Structure | references/project-structure.md | Folder layout by complexity level — run node scripts/scaffold-bdd.mjs --level <1-4> to generate the full directory structure automatically |
| Starter Templates | assets/ | Ready-to-use template files: config/cypress.config.ts, features/sample.feature, steps/sample.steps.ts, pages/LoginPage.ts, support/hooks.ts, support/commands.ts, utils/config.ts, tsconfig/tsconfig.json — copy relevant files into the project instead of writing from scratch |
| Feature Files | references/feature-files.md | Writing Gherkin: Scenario, Outline, Background, DataTable |
| Feature Organization | references/feature-organization.md | Organizing tests by feature, domain, and complexity level |
| Step Definitions | references/step-definitions.md | Given/When/Then, parameter types, state sharing |
| BDD Architecture | references/bdd-architecture.md | Page Objects, selectors, naming conventions, folder structure |
| BDD Architecture Diagram | references/bdd-architecture.plantuml | Visual representation of BDD architecture |
| Page Objects | references/page-object-template.ts | Cypress Page Object template: static data-testid selectors, no cy.* inside |
| Selectors & Locators | references/selectors-locators.md | Best practices for selecting elements in Cypress tests |
| Naming Conventions | references/naming-conventions.md | File and class naming patterns, folder structure, Page Objects, components |
| Hooks & Shared State | references/hooks-and-commands.md | Scenario lifecycle, sharing state with .as() aliases (there is no World in this stack), custom commands (getByTestId), cy.session(); key differences vs Playwright Cucumber |
| Tags & Profiles | references/tags-and-profiles.md | Tag expressions, cascading Feature→Scenario, filterSpecs, run profiles |
| Reporting | references/reporting.md | multiple-cucumber-html-reporter, screenshots, CI artifacts |
| Anti-patterns | references/anti-patterns.md | Common mistakes and how to fix them |
| Best Practices | references/cucumber-best-practices.md | Scenario Design Principles, Feature Organization, Writing Good Gherkin, Scenario Outlines, Step Definition Patterns, Error Handling, Performance, Testing Pyramid |
| Visual Regression | references/visual-regression.md | Visual regression testing, screenshot comparison, baseline management |
| E2E Testing without Cucumber | references/e2e-testing-without-cucumber.md | Classic user-flow E2E testing without Cucumber, checkout flow |
| E2E Test Template | references/e2e-test-template.ts | Annotated Cypress E2E test template: Page Objects, cy.request() data setup, cy.session() |
| API Mocking | references/api-mocking.md | Mocking API responses with cy.intercept(), stubbing endpoints, edge cases |
| API/REST Testing | references/api-rest-testing.md | Testing RESTful APIs, endpoints, and response validation |
| WCAG E2E Testing | references/wcag-e2e-testing.md | Automated WCAG 2.2 accessibility checks in E2E tests with Cypress + axe |
These files are only loaded if the agent needs additional context.
For Page Objects, selectors, naming conventions, intercept patterns, and anti-patterns load the
cypress-automationskill.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

