E2E Testing with Cypress for Your Website
A failure in a critical user scenario means lost conversions and damaged reputation. Manual regression tests consume hours before each release, and catching bugs after deployment is costly. Our solution: implement end-to-end tests with Cypress that verify every user path from click to backend. Automating regression slashes manual testing costs and speeds up releases.
Unlike Selenium or Puppeteer, Cypress runs in the same event loop as the application. As Cypress documentation states: 'Cypress runs in the same event loop as your application'. This gives a built-in time-travel debugger, automatic element waiting without sleep(), and full control over network requests via cy.intercept(). We use it on React, Vue, Angular, and even plain JavaScript.
What Problems Does E2E Testing with Cypress Solve?
- Flaky tests – the main pain of E2E. Cypress automatically waits for elements and eliminates sleep(), removing instability.
- Long regression runs – with parallel execution on CI, time drops from hours to minutes, a 90% reduction.
- Debugging complexity – time-travel allows stepping through each action to trace failures.
Case Study: E-Commerce Order Flow
For one client, we covered a checkout flow integrating Stripe. We wrote 15 tests checking successful payment, card decline, timeout, and cart return. Using cy.intercept() to mock Stripe responses made tests fully deterministic. Result: regression time dropped from 4 hours to 15 minutes (a 94% reduction), and production bug frequency fell by 30%. Typical clients save $5,000–$10,000 annually in testing costs.
Why Cypress Is the Top Choice for E2E Testing?
Cypress enables writing tests 2–3 times faster than Selenium, thanks to automatic waiting and no WebDriver requirement. It integrates directly with frameworks, intercepts all network requests, and provides time travel – seeing each test step in the UI. This reduces debugging time for flaky tests by 40%.
What We Cover with Tests?
- Authentication: login, registration, password recovery – using API mocks for environment independence.
- Core flows: checkout, add-to-cart, entity creation – full chain from UI to database.
- Navigation and routing: redirects, breadcrumbs, 404 pages.
- Error handling: service unavailability, invalid data, network timeouts – so users never see a blank screen.
We test not only the happy path but also edge cases: empty carts, invalid coupons, session expiration. This ensures a resilient user experience.
Implementation of E2E Tests with Cypress
Installation and Configuration
View installation steps
npm install -D cypress
npx cypress open # first run – creates directory structure
Project Structure
cypress/
├── e2e/ # test specifications
├── fixtures/ # static test data
├── support/
│ ├── commands.ts # custom commands
│ └── e2e.ts # global configuration
└── cypress.config.ts
Base Test: Authentication
// cypress/e2e/auth/login.cy.ts
describe('Login', () => {
beforeEach(() => {
cy.visit('/login');
});
it('successfully logs in with valid credentials', () => {
cy.get('[data-cy="email-input"]').type('[email protected]');
cy.get('[data-cy="password-input"]').type('password123');
cy.get('[data-cy="login-btn"]').click();
cy.url().should('include', '/dashboard');
cy.get('[data-cy="user-name"]').should('contain', 'John');
});
it('shows error on invalid credentials', () => {
cy.get('[data-cy="email-input"]').type('[email protected]');
cy.get('[data-cy="password-input"]').type('wrongpass');
cy.get('[data-cy="login-btn"]').click();
cy.get('[data-cy="error-message"]')
.should('be.visible')
.and('contain', 'Invalid email or password');
});
});
Intercepting API Requests
// Mock API – test does not depend on backend
it('displays products from API', () => {
cy.intercept('GET', '/api/products*', {
fixture: 'products.json',
statusCode: 200,
}).as('getProducts');
cy.visit('/products');
cy.wait('@getProducts');
cy.get('[data-cy="product-card"]').should('have.length', 10);
});
// Verify request payload
it('sends correct payload on form submit', () => {
cy.intercept('POST', '/api/orders', (req) => {
expect(req.body).to.deep.include({ productId: 1, quantity: 2 });
req.reply({ statusCode: 201, body: { orderId: 100 } });
}).as('createOrder');
// ... actions
cy.wait('@createOrder');
cy.get('[data-cy="success-message"]').should('be.visible');
});
CI/CD Integration
We configure test runs in GitHub Actions, GitLab CI, or Jenkins. For parallel execution, we use Cypress Dashboard or GitHub Actions matrix strategy. This reduces a 40-test run to 3–4 minutes. We also set up result recording for flaky test analysis.
Comparison of E2E Testing Tools
View comparison table
| Criteria | Cypress | Selenium | Playwright |
|---|---|---|---|
| Setup | npm i -D cypress |
Requires WebDriver | npm i @playwright/test |
| Execution speed | High (built-in wait) | Medium (explicit waits) | High (auto-wait) |
| Browser support | Chrome, Firefox, Edge | All major | All major |
| Time-travel debugger | Built-in | None | None |
| Network interception | cy.intercept() |
Requires proxy | page.route() |
| Documentation and community | Huge | Huge | Growing |
What Is Included in the Work (Deliverables)
- Audit of current UI – identify key scenarios and stability points.
- Framework setup – Cypress configuration, custom commands, fixtures.
- Test coverage – 20 to 80 scenarios depending on complexity.
- CI/CD integration – configs for GitHub Actions, GitLab CI, or Jenkins.
- Documentation and training – instructions for running and updating tests.
- Stability guarantee – two test runs on your environment and flaky test fixes.
Implementation Timeline and Cost
Starting from $2,000 for a typical 5-scenario coverage, the investment pays off through reduced regression time and increased release confidence.
| Test Volume | Timeline |
|---|---|
| 20–40 scenarios (typical site) | 5–8 days |
| 40–80 scenarios (complex UI) | 10–14 days |
| Additional cross-browser support | +2–3 days |
Cost is calculated individually after project evaluation.
We guarantee test stability: use data-cy attributes, mock external APIs via cy.intercept(), and avoid sleep(). This makes tests deterministic and reduces flaky runs. As a result, you get reliable coverage that pays off through release stability and reduced regression time. Our experience: over 5 years and 30+ projects with E2E testing on Cypress.
Contact us for a consultation. We'll assess scope, timeline, and start implementation. Order E2E test implementation today – it will pay off with release stability and team peace of mind.







