End-to-End Testing

End-to-end (E2E) tests simulate what real users do. They open a browser, click buttons, fill forms, and verify that the right things appear on screen. These tests exercise your entire system — frontend, backend, database, and everything in between.

What E2E Tests Do

An E2E test automates a user journey:

  1. Open the browser to your application
  2. Interact with the page (click, type, scroll)
  3. Wait for responses and page updates
  4. Verify the expected content appears

When an E2E test passes, you have high confidence that feature actually works for users. When it fails, something in the entire stack is broken.

Modern E2E Tools

Several tools automate browser testing:

Playwright (recommended) is modern, fast, and supports multiple browsers. It's developed by Microsoft and has excellent documentation.

Cypress is popular in the JavaScript ecosystem. It runs tests in the browser itself, providing great debugging tools.

Selenium is the oldest option, supporting many languages and browsers. It's more complex to set up but very flexible.

A Playwright Example

Here's an E2E test for user registration:

test('user can create account and see dashboard', async ({ page }) => {
    // Navigate to signup page
    await page.goto('/signup');
    
    // Fill out the registration form
    await page.fill('[name="email"]', 'newuser@example.com');
    await page.fill('[name="password"]', 'secure123');
    await page.fill('[name="confirmPassword"]', 'secure123');
    
    // Submit the form
    await page.click('button[type="submit"]');
    
    // Verify redirect to dashboard
    await expect(page).toHaveURL('/dashboard');
    
    // Verify welcome message appears
    await expect(page.locator('h1')).toContainText('Welcome');
});

This test verifies the complete registration flow works — form submission, backend processing, database creation, authentication, and redirect.

When to Use E2E Tests

E2E tests are powerful but slow and sometimes flaky. Use them strategically:

Critical user flows. Registration, login, checkout, core features — the paths that absolutely must work.

Smoke tests before deployment. Run a small E2E suite to verify the application starts and basic functionality works.

Not for every edge case. Testing that a form shows an error for 47 different invalid inputs is better done with unit tests.

The Testing Pyramid

A healthy test suite has many fast unit tests, fewer integration tests, and a small number of E2E tests. E2E tests give the highest confidence but cost the most to run and maintain. Use them for critical paths, and let faster tests cover the details.

See More

Further Reading

Last updated December 26, 2025

You need to be signed in to leave a comment and join the discussion