Skip to content

Latest commit

 

History

History
74 lines (63 loc) · 1.92 KB

README.md

File metadata and controls

74 lines (63 loc) · 1.92 KB

Cypress + Cucumber

cypress-cucumber-demo-qa

Visual Studio Code Extension

  • Add Only
  • Cucumber (Gherkin) Full Support
  • Cypress Helper

Command

Open Cypress IDE

npx cypress open 

Run test and record

npx cypress run --record --key <record-keys>

Run spesific tag

npx cypress -e TAGS='@case=CaseId'

Run spesific spec

npx cypress run --spec <spec-file-path> --browser chrome

Create New Test Project

For new test project

Installing Cypress

Install Cypress in the test project root

npm install cypress --save-dev

Installing Cucumber

Install the @badeball/cypress-cucumber-preprocessor using the command

npm install -D @badeball/cypress-cucumber-preprocessor

and install one more dependencies ‘@bahmutov/cypress-esbuild-preprocessor’ using the commands

npm install -D @bahmutov/cypress-esbuild-preprocessor

Then create cypress.config.js for cucumber preprocessor

const { defineConfig } = require("cypress");
const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
const addCucumberPreprocessorPlugin =
    require("@badeball/cypress-cucumber-preprocessor").addCucumberPreprocessorPlugin;
const createEsbuildPlugin =
    require("@badeball/cypress-cucumber-preprocessor/esbuild").createEsbuildPlugin;

module.exports = defineConfig({
    e2e: {
        async setupNodeEvents(on, config) {
            const bundler = createBundler({
                plugins: [createEsbuildPlugin(config)],
            });

            on("file:preprocessor", bundler);
            await addCucumberPreprocessorPlugin(on, config);

            return config;
        },
        specPattern: [
            "cypress/e2e/features/*.feature",
            "cypress/e2e/features/*/*.feature"],
    }
});