E-commerce Test Automation with Cypress
LocalAbout E-commerce Test Automation with Cypress
E-commerce Test Automation with Cypress is a TypeScript end-to-end test project for a mock e-commerce app. It uses Cypress and the Page Object Model to test successful orders and declined-payment flows.
Key features
- 01Automate successful order flow
- 02Test declined-payment flow
- 03Use TypeScript with Cypress
- 04Organize tests with Page Object Model
- 05Run tests in GUI or headless mode
Use cases
- 01Check checkout for successful purchases
- 02Verify behavior when payments are declined
- 03Run e-commerce tests locally or in CI
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEE-commerce Test Automation with Cypress
This project contains end-to-end tests for a mock e-commerce application using Cypress with TypeScript and the Page Object Model pattern.
Overview
The tests automate two main flows:
- Successful order flow - a user who can complete a purchase successfully
- Failed order flow - a user whose payments are always declined
Project Structure
cypress/
├── e2e/ # Test files
│ ├── successful-order-flow.cy.ts
│ └── failed-order-flow.cy.ts
├── fixtures/ # Test data
│ ├── users.json
│ ├── products.json
│ └── payment.json
├── pages/ # Page Objects
│ ├── LoginPage.ts
│ ├── ProductsPage.ts
│ ├── CartPage.ts
│ └── CheckoutPage.ts
└── support/ # Support files
├── commands.ts
└── e2e.ts
Setup
- Clone the repository
- Install dependencies:
npm install - Set up environment variables:
- Create a
cypress.env.jsonfile (already included but should not be committed to version control in a real project) - Or use a
.envfile with the necessary credentials
- Create a
Running the Tests
Run all tests:
npm test
Run tests in headless mode:
npm run test:headless
Run specific test flow:
npm run test:success # Successful order flow
npm run test:failure # Failed order flow
Open Cypress GUI:
npm run cypress:open
Environment Variables
The following environment variables are used:
CYPRESS_USERNAME: Username for successful loginCYPRESS_PASSWORD: Password for both usersCYPRESS_FAILURE_USERNAME: Username for the user with failed payments
These can be set in:
cypress.env.jsonfile (for local development).envfile- CI/CD pipeline environment variables
Test Application
The tests are designed for the mock e-commerce application located at:
https://v0-imagine-deals.vercel.app
Notes
- This is a demo project for testing purposes only
- The application simulates payment scenarios:
- Any total ending in .99 will simulate a declined payment
- Any total ending in .88 will simulate a network error
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.