# Cucumber Cypress

> Cucumber Cypress is an Agent Skill for testing & quality published in the majiayu000/claude-skill-registry repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Cucumber BDD with Cypress policies. Use when writing Gherkin scenarios with Cypress step definitions. Do NOT use for Playwright-based BDD -- use cucumber-playwright instead. Do NOT use for non-BDD Cypress tests.

- Skill name: `cucumber-cypress`
- Category: [Testing & Quality](https://www.openparable.com/skill/testing-quality/1)
- Source: https://github.com/majiayu000/claude-skill-registry/blob/HEAD/skills/testing/cucumber-cypress/SKILL.md
- Repository: majiayu000/claude-skill-registry (498 GitHub stars when collected)

## SKILL.md

# Cucumber + Cypress Policies

Use `@badeball/cypress-cucumber-preprocessor` for Cypress + Cucumber.

## Project Structure

```
cypress/
├── e2e/
│   ├── features/*.feature
│   └── step_definitions/*.steps.ts
├── support/
cypress.config.ts
```

## Gherkin Best Practices

### Use Scenario Outline for Multiple Cases

```gherkin
Scenario Outline: Login validation
  Given I am on the login page
  When I enter "<email>" as email
  And I enter "<password>" as password
  Then I should see "<message>"

  Examples:
    | email            | password | message             |
    | user@example.com | valid    | Welcome             |
    | user@example.com | wrong    | Invalid credentials |
```

### Keep Steps Reusable

Write steps that can be shared across features.

## Step Definition Policies

### Use data-testid Selectors

```typescript
// GOOD
cy.get('[data-testid="email-input"]').type(email)

// BAD: Brittle CSS selectors
cy.get('.input-field-xyz').type(email)
```

### Import from Correct Package

```typescript
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'
```

### Hooks for Setup/Cleanup

```typescript
import { Before, After } from '@badeball/cypress-cucumber-preprocessor'

Before(() => {
  cy.clearCookies()
  cy.clearLocalStorage()
})
```

### Tagged Hooks for Specific Scenarios

```typescript
Before({ tags: '@login' }, () => {
  cy.fixture('users').as('users')
})
```

## Commands

```bash
npx cypress run
npx cypress run --spec "cypress/e2e/features/login.feature"
npx cypress open  # Interactive
```

## Configuration

For setup details, use context7 to query `@badeball/cypress-cucumber-preprocessor` documentation.

---

Source: https://www.openparable.com/skill/testing-quality/cucumber-cypress (OpenParable). Cite the canonical URL above.
