See badeball/cypress-cucumber-preprocessor for a public, community-maintained edition and installation instructions.
Configure specPattern
with "**/*.feature"
, using EG. cypress.config.ts
.
import { defineConfig } from "cypress";
export default defineConfig({
e2e: {
specPattern: "**/*.feature"
}
});
Configure your preferred bundler to process features files, with examples for
Read more about configuration options at docs/configuration.md.
Write Gherkin documents 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/e2e/duckduckgo.feature
Feature: duckduckgo.com
Scenario: visting the frontpage
When I visit duckduckgo.com
Then I should see a search bar
// cypress/e2e/duckduckgo.ts
import { When, Then } from "@klaveness/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"
);
});