Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Latest commit

 

History

History
50 lines (38 loc) · 1.34 KB

File metadata and controls

50 lines (38 loc) · 1.34 KB

Installation

$ npm install @badeball/cypress-cucumber-preprocessor

Configuration

Configure testFiles with "**/*.feature", using EG. cypress.json.

{
  "testFiles": "**/*.feature"
}

Configure your preferred bundler to process features files, with examples for

Write a test

Write Gherkin documents anywhere in your configured integration folder (defaults to cypress/integration) and add a file for type definitions with a corresponding name (read more about how step definitions are resolved in docs/step-definitions.md). Reading docs/cucumber-basics.md is highly recommended.

# cypress/integration/duckduckgo.feature
Feature: duckduckgo.com
  Scenario: visting the frontpage
    When I visit duckduckgo.com
    Then I should see a search bar
// cypress/integration/duckduckgo.ts
import { When, Then } from "@badeball/cypress-cucumber-preprocessor";

When("I visit duckduckgo.com", () => {
  cy.visit("https://www.duckduckgo.com");
});

Then("I should see a search bar", () => {
  cy.get("input").should(
    "have.attr",
    "placeholder",
    "Search the web without being tracked"
  );
});