This project automates a critical user flow for the Automation Exercise website using Cypress. The automation script covers a specific user journey for a clothing store, adaptable to both Desktop and Mobile viewports. It demonstrates:
- 🧩 Modularity
- 🔄 Reusability
- ✨ Clarity
Optionally, the project incorporates Accessibility and Performance testing.
- 🛠️ Node.js (v14 or later)
- 📦 npm (Node Package Manager)
- ✅ Cypress (installed via npm)
Optional tools:
- 🌐 Lighthouse CLI (for accessibility and performance testing)
-
Clone the repository:
git clone git@github.com:Hilas/applydigitial.git
-
Navigate to the project directory:
cd applydigital -
Install dependencies:
npm install
Run the entire testing process, including generating Lighthouse reports and executing Cypress tests, using:
npm run full:testThis script performs:
- ✅ Executes Lighthouse for accessibility (
./accessibility-report.html). - ✅ Executes Lighthouse for performance (
./performance-report.html). - ✅ Runs Cypress tests in headless mode.
- ✅ Prints links to the generated reports in the console.
- Open Cypress Test Runner:
npm run cypress:open
- Run Cypress tests in headless mode:
npm run cypress:run
- Generate Lighthouse Accessibility Report:
npm run lighthouse:accessibility
- Generate Lighthouse Performance Report:
npm run lighthouse:performance
- The website is accessible.
- Required dependencies are installed.
- Navigate to the website.
- Go to the Products section.
- Choose the third product from the list.
- Enter a random quantity (1-20).
- Add the product to the cart.
- Proceed to checkout.
- Register a new user using Faker-generated data.
- Confirm the order.
- Log out.
- Product is added to the cart with the correct quantity.
- Validates the total price in the cart.
- Checkout completes successfully.
- Optional steps execute as expected.
| Folder/File | Description |
|---|---|
cypress/ |
Contains test files, fixtures, and utilities. |
cypress/e2e/ |
Holds the main test scripts. |
cypress/support/features |
Gherkin feature files describing scenarios. |
cypress/support/pages |
Implements the Page Object Model (POM). |
cypress/support/step_definitions |
Maps Gherkin steps to Cypress commands. |
package.json |
Manages project dependencies and scripts. |
- Cypress: 🧪 Framework for end-to-end testing.
- Faker.js: 🎲 Generates random data for test inputs.
- Lighthouse: 🌐 Measures accessibility and performance.
- Mochawesome: 📊 Generates detailed test reports.
After running npm run full:test, the console will display links to the generated reports:
- 📊 Accessibility Report:
./accessibility-report.html - 📈 Performance Report:
./performance-report.html - 🧪 Mochawesome Report:
./cypress/reports/index.html
Test results are available in the mochawesome-report folder:
open mochawesome-report/index.htmlIn Windows:
start mochawesome-report/index.html- Run:
npm run lighthouse:accessibility
- Open:
On Windows:
open ./accessibility-report.html
start ./accessibility-report.html
- Run:
npm run lighthouse:performance
- Open:
On Windows:
open ./performance-report.html
start ./performance-report.html