A proof of concept to showca the implementation of Cypress as a test framework with Cucumber BDD and Mochawesome reporter integration to test the checkout flow for the "Test Automation - Big Cartel E-commerce Test Store".
- Overview
- Test Scenarios
- Pre requisites
- Setup
- Running tests
- Viewing test results
- CI/CD Pipeline
- Additional notes
- Gotcha's
- Unresolved issues - Work in progress
This repository demonstrates:
- Cypress Testing Framework: Utilises Cypress Studio for test recording - follow this guide to record test steps with Cypress Studio.
- Cucumber BDD: Implemented Behaviour-Driven Development for structured, readable test scenarios.
- Mochawesome Reporter: Generates detailed test result reports.
- Local Execution: Run tests locally with multiple browser options.
- CI/CD Integration: Executes tests in a Docker container via GitHub Actions, triggered on push/pull requests to the main branch and daily scheduled runs.
This project includes Cypress feature tests covering the following e-commerce checkout journeys:
- Contact page: Submit a contact enquiry ➝ triggers recaptcha.
- Search for an item in the store.
- View a product from search results.
- Select colour and age options from dropdowns.
- Increase item quantity.
- Proceed to the cart.
- Verify cart details, including:
- Correct items.
- Selected options.
- Quantities.
- Item prices and cart totals.
Ensure the following are installed:
- Clone or Download:
- Clone this repository:
git clone https://github.com/badj/cypress-cucumber-poc.git - Alternatively, download the ZIP file and extract it.
- Clone this repository:
- Navigate to Project Directory:
cd cypress-cucumber-poc - Install Dependencies:
npm install
- With the Cypress Test Runner:
- For an interactive GUI to select and run specific tests.
npx cypress open
- Headless Mode:
- Run tests without opening a browser window (Default Electron Browser)
npx cypress run
- Headed Mode - No exit - Alternative Browsers: (Electron/Chrome/Firefox/Edge/Webkit)
- Run tests with the browser open, and the browser remains open when the run completed
npx cypress run --headed --browser electron --no-exit
npx cypress run --headed --browser chrome --no-exit
npx cypress run --headed --browser firefox --no-exit
npx cypress run --headed --browser edge --no-exit
npx cypress run --headed --browser webkit --no-exit
- Headless Mode - Alternative Browsers: (Electron/Chrome/Firefox/Edge/Webkit)
- Run tests with no browser window opening
npx cypress run --browser electron
npx cypress run --browser chrome
npx cypress run --browser firefox
npx cypress run --browser edge
npx cypress run --browser webkit
- Headed Mode - Alternative Browsers: (Electron/Chrome/Firefox/Edge/Webkit)
- Run tests with the browser open and closing the browser when the run completed
npx cypress run --headed
npx cypress run --headed --browser chrome
npx cypress run --headed --browser firefox
npx cypress run --headed --browser edge
npx cypress run --headed --browser webkit
After the test run completes:
- HTML Report: Generated at cypress/reports/html/ as
cypress-cucumber-poc-results.html- To open the report automatically after a headless run:
npx cypress run --reporter-options autoOpen=true
- To always open the report after a run - set autoOpen to true in the Reporter Option in cypress.config.js:
reporterOptions: { autoOpen: true }
- Video Recordings: Available at cypress/reports/html/videos/ and cypress/videos/
- Screenshots: Saved at cypress/reports/screenshots/ for test steps configured to capture screenshots.
- Tests are executed in a Docker container using GitHub Actions.
- Triggers on push/pull requests to the main branch and for daily scheduled runs. See the workflow configuration in .github/workflows/main.yml.
- Ensure all prerequisites are met before running tests.
- For issues or contributions, refer to the GitHub repository.
1. Installing Cypress dependencies using npm install failing due to an unsupported Node.js version
Your current Node.js version is older than the recommended LTS version. Cypress requires a more recent version of Node.js. As of Cypress 14.0.0, the minimum supported Node.js version is typically Node.js 18 or higher.
To resolve the issue:
- Update Node.js using nvm (Node Version Manager) - Install Node.js 18 (LTS) or a newer version like 20
nvm install 18- Switch to the new version
nvm use 18- Set it as the default version
nvm alias default 18- Verify the Node.js version - Ensure it’s at least v16 or higher.
node -v- Verify npm version:
npm -vAdditional steps if the steps above do not resolve it:
- Clear npm Cache and Reinstall Dependencies → The error may be caused by a corrupted npm cache or incomplete dependency installation
This ensures a clean slate for dependency installation, avoiding issues from cached or corrupted files.
npm cache clean --force- Remove the node_modules directory and package-lock.json → Navigate to the project directory
Change to the cypress-cucumber-poc project directory (example for macOS)*:
cd [path to your repo]/cypress-cucumber-poc- Remove the node_modules directory and package-lock.json file:
rm -rf node_modules package-lock.json- Reinstall dependencies:
npm install1. Firefox runner fails to capture video recording
- Status: Investigating
- Affected Browsers: Firefox
- Severity: Low
- Impact: Video from the test run is not embedded in the test results report due to failed video capture during the Firefox test run.
- Additional Details:
- Test run succeeds, but is unable to generate/process the video recording(s).
- Following error printed in console at the end of the test run, during video recording processing:
Warning: We failed capturing this video.
This error will not affect or change the exit code.
Error: Insufficient frames captured to create video.
at ChildProcess.<anonymous> (<embedded>:1012:16262)
at ChildProcess.emit (node:events:518:28)
at ChildProcess._handle.onexit (node:internal/child_process:293:12)