This project demonstrates automated testing using Cypress with BDD (Behavior Driven Development) using Cucumber. It includes comprehensive configurations for generating detailed test reports using Mochawesome and Cucumber JSON formatter.
- Project Structure
- Prerequisites
- Installation
- Configuration
- Running Tests
- Generating Reports
- Directory Overview
- Troubleshooting
This project demonstrates automated testing using Cypress with BDD (Behavior Driven Development) using Cucumber. It includes configurations for generating detailed test reports using Mochawesome and Cucumber JSON formatter.
CypressAutomation/ ├── cypress/ │ ├── cucumberReports/ │ ├── downloads/ │ ├── e2e/ │ ├── fixtures/ │ ├── integration/ │ ├── support/ │ └── cucumber-html-report.js ├── node_modules/ ├── cypress.config.js ├── package-lock.json ├── package.json └── README.md
- Node.js (v14 or later)
- npm or yarn
- Clone the Repository:
git clone https://github.com/your-username/CypressAutomation.git cd CypressAutomation
npm install npx cypress run npx cypress open
wget https://github.com/cucumber/cucumber-json-formatter/releases/download/1.0.0/cucumber-json-formatter-darwin-amd64 mv cucumber-json-formatter-darwin-amd64 cucumber-json-formatter sudo mv cucumber-json-formatter /usr/local/bin/ sudo chmod +x /usr/local/bin/cucumber-json-formatter
cucumber-json-formatter --help
const report = require('multiple-cucumber-html-reporter');
report.generate({ jsonDir: 'cypress/cucumberReports', reportPath: 'cypress/reports/cucumber-html-report', metadata: { browser: { name: 'chrome', version: '91' }, device: 'Local test machine', platform: { name: 'macOS', version: 'Big Sur' } }, customData: { title: 'Run info', data: [ { label: 'Project', value: 'Cypress Automation' }, { label: 'Release', value: '1.2.3' }, { label: 'Cycle', value: 'B11221.34321' }, { label: 'Execution Start Time', value: 'Sep 17th 2023, 02:31 PM EST' }, { label: 'Execution End Time', value: 'Sep 17th 2023, 02:56 PM EST' } ] } });
node cypress/cucumber-html-report.js
-
Fixtures (cypress/fixtures/): Store static data for tests, typically in JSON format. Example: example.json Integration Tests (cypress/integration/examples/BDD/):
-
Contains feature files (.feature) and step definitions (.js). Example: ecommerce.feature, eComStepDef.js Page Objects (cypress/integration/examples/BDD/pageObjects/):
-
Encapsulate page-specific logic and elements. Example: HomePage.js, ProductPage.js Support (cypress/support/):
-
Custom commands and configuration. Example: commands.js, e2e.js Reports:
-
Generated test reports are stored in the cypress/reports/ directory.
Common Errors:
Ensure all paths in configuration files are correct. Verify that all necessary dependencies are installed. MacOS Security Warnings:
If you get a security warning, open System Preferences > Security & Privacy > General and allow the application to run. If you encounter any issues, please refer to the Cypress documentation or the specific package documentation for further guidance.
If you want to contribute to this project, feel free to fork the repository and submit a pull request.
This project is licensed under the MIT License.