End-to-End Testing: What It Is, Examples and E2E Tools
End-to-end testing (E2E testing) runs a complete user journey through the real app stack (UI, APIs, services, database and third-party integrations) the way a user would, to confirm the pieces work together. Example: sign up, verify the email, create a project. E2E tests sit at the top of the test pyramid: few, slow, high value.
This guide is for developers, SDETs and QA automation engineers: what E2E tests should cover, a real Playwright test, the main tools and fixes for flaky runs. For the process around it, start with the QA testing guide.
What is end-to-end testing?
An end-to-end test drives the product from the outside, through the same doors a user uses: a browser, a mobile app or a public API. Nothing inside the system is mocked, and at most you stub outside services you do not control. The test passes only if every layer it touches does its job.
Typical journeys worth an E2E test:
- SaaS onboarding: sign up, open the link in the verification email, create the first project.
- Checkout: search, add to cart, pay with a sandbox card, get the order email.
- Team invite: an admin invites a teammate, who accepts and sees only the pages for that role.
- Billing: upgrade a plan, see the new limits, find the invoice in the account.
What E2E tests catch that unit and integration tests miss
A unit test proves that one function works. An integration test proves that two parts talk to each other. An E2E test proves that the shipped product works as one system, with real config, real network hops and a real browser.
That is where these bugs hide:
- A missing environment variable or a wrong redirect URL after a deploy.
- A cookie or CORS setting that blocks login in one browser.
- A front end and an API that pass their own tests but disagree on a field name.
- A queue or webhook that never fires, so the email or invoice never arrives.
The flip side: a failed E2E test tells you that a journey broke, not where. That is why E2E tests sit on top of lower-level tests instead of replacing them.
Where E2E fits in the test pyramid
The test pyramid is a model for how many tests to write at each level. Many fast unit tests form the base, fewer integration tests sit in the middle and a few E2E tests sit at the top. Ham Vocke's The Practical Test Pyramid sums it up in two rules: write tests with different granularity, and the more high-level you get, the fewer tests you should have.

| Level | What it checks | Time per test | Share of tests | A failure tells you |
|---|---|---|---|---|
| Unit | One function or class, alone. | Milliseconds. | About 70%. | The exact line. |
| Integration | Two or more parts, such as an API and its database. | Milliseconds to seconds. | About 20%. | Which contract broke. |
| End-to-end | A full user journey on a deployed app. | 5 to 60 seconds. | About 10%. | That a journey broke. |
The 70/20/10 split comes from Google's testing blog, which calls it a good first guess. Your test strategy sets the real mix: an API product leans on integration tests, while a checkout-heavy store needs a few more journeys.
Two shapes go wrong. The ice cream cone puts most checks in slow E2E and manual tests, and the hourglass skips the integration layer. Both end in slow, flaky pipelines.
One habit keeps the pyramid healthy. When an E2E test finds a bug, add a lower-level test that would have caught it, so the E2E suite stays a safety net and not the only net.
End-to-end testing vs integration testing vs system testing
The three overlap, so people mix them up. Here is how they differ in practice.
| Integration testing | System testing | End-to-end testing | |
|---|---|---|---|
| Scope | Two or more parts, such as a service and its database. | The whole product against its spec. | One user journey through every layer and outside service. |
| Environment | Local or CI, with some neighbors stubbed. | A full test build. | A deployed, production-like setup. |
| Speed | Fast. | Slow, often a full cycle per release. | Slow, seconds to minutes per test. |
| Who writes it | Developers. | QA engineers. | SDETs, QA automation engineers and developers. |
| Example | The orders API saves an order row. | Each requirement in the release spec passes. | A shopper pays and gets the order email. |
System testing asks "does the product meet its spec?" End-to-end testing asks "can a user finish this journey?" Acceptance is a third question: in UAT, business users decide whether the release does its job.
Horizontal vs vertical E2E testing
Teams use two words for two directions. Horizontal E2E testing follows a journey across several apps, such as an order that moves from the store to the warehouse system, the shipping provider and the customer's inbox. Vertical E2E testing goes down through the layers of one app: UI, API, service and database, with a check at each layer.

Most web teams write vertical journeys and check side effects through the API, as the example below does. Horizontal tests need every connected system in a test state at once, so keep them for the few flows that cross company systems and run them nightly.
When to write an E2E test (and when not to)
Write an E2E test only for journeys that would get someone paged if they broke in production, like the four examples near the top. Sign-in (including SSO and password reset) and the core create or save action belong on that short list too.
Three questions make a good filter, and a journey needs three yeses to join the E2E suite:
- Does it earn money or keep trust?
- Does it cross at least two services or a third-party boundary?
- Is it impossible to prove at a lower level?
| Test it end to end | Leave it to a lower level |
|---|---|
| Sign-in through the SSO redirect. | Password rules, in unit tests. |
| Checkout with a sandbox card. | Tax rules for every region, in data-driven unit tests. |
| Creating the first project. | Every form validation message, in component tests. |
| Upgrading a plan and seeing the new limits. | API error codes for bad input, in API tests. |
| One role blocked from admin pages. | The full permission matrix, in API tests. |
Some checks do not belong in a functional script at all. Whether the deploy is alive is a job for smoke tests, and layout shifts are caught by visual regression testing, which compares screenshots.
Speed, security and accessibility are non-functional requirements with their own tools. Whether a flow is easy to use is a question for usability testing, and whether real customers like it is what beta testing is for.
How to write an end-to-end test in 6 steps (Playwright example)
The example below automates the journey from the top: a new user signs up, verifies the email and creates a project. It uses Playwright Test in TypeScript, checked against the Playwright docs, but the same six steps work in any tool.
1. Pick one journey and write it down
Write the journey as steps a person could follow, each with an expected result. Name who the user is, where they start and the end state they care about.
For this test, a new user signs up with a work email and sees "Check your inbox". The link in the email opens onboarding. Creating a project called "Q4 launch" shows its project page, and the API lists it.

Each checkpoint becomes an assertion. If you cannot say what the user sees at a step, the test cannot check it either.
2. Control the test data and state
Shared test accounts are a common reason tests pass alone and fail together. Give every run its own data: a unique email per test, built from the worker number and a timestamp.
Never send real email from a test. Point staging at an email catcher such as Mailpit and read the message through its API. This helper waits up to 30 seconds for the verification link:
// tests/e2e/helpers/mail.ts
import { expect, type APIRequestContext } from '@playwright/test';
export async function getVerificationLink(request: APIRequestContext, to: string) {
const api = process.env.MAILPIT_URL;
let link = '';
await expect.poll(async () => {
const search = await request.get(`${api}/api/v1/search`, { params: { query: `to:"${to}"` } });
const { messages } = await search.json();
if (!messages?.length) return '';
const message = await (await request.get(`${api}/api/v1/message/${messages[0].ID}`)).json();
link = message.Text.match(/\S+\/verify\S+/)?.[0] ?? '';
return link;
}, { message: 'Verification email never arrived', timeout: 30_000 }).not.toBe('');
return link;
}For journeys that start logged in, sign in once in a setup project and save the browser state with storageState. Every test then starts signed in. Add the playwright/.auth folder to .gitignore, because it holds session cookies.
3. Use stable locators
Find elements the way a user does: by role and accessible name, or by form label. getByRole and getByLabel survive CSS refactors, and they fail when a button loses its accessible name, which is a bug worth catching.
When an element has no good name, add a data-testid attribute and use getByTestId. Avoid CSS classes, nth-child chains and XPath. If the codebase already uses data-cy or data-test, set testIdAttribute in the config instead of renaming.
4. Assert what the user sees, then one side effect
End each step with an assertion about the screen: a heading, a URL or a value. Web-first assertions such as toBeVisible and toHaveURL retry for up to 5 seconds by default, so the test never needs a fixed sleep.
Then check one side effect through the API with page.request, which sends the user's session cookies. That one extra check turns a UI test into a vertical E2E test.
5. Clean up after every run
Delete what the test created, even when it fails. A Playwright fixture does this well: code before use() runs as setup, and code after it runs as teardown. Here the teardown calls a test-support endpoint that exists only on staging and preview builds.
The complete test:
// tests/e2e/signup.spec.ts
import { test as base, expect } from '@playwright/test';
import { getVerificationLink } from './helpers/mail';
const test = base.extend<{ email: string }>({
email: async ({ request }, use, testInfo) => {
const email = `e2e-${testInfo.workerIndex}-${Date.now()}@example.test`;
await use(email);
await request.delete(`/api/test-support/users/${encodeURIComponent(email)}`, {
headers: { Authorization: `Bearer ${process.env.E2E_ADMIN_TOKEN}` },
});
},
});
test('new user signs up, verifies email and creates a project', async ({ page, request, email }) => {
await test.step('sign up', async () => {
await page.goto('/signup');
await page.getByLabel('Work email').fill(email);
await page.getByLabel('Password', { exact: true }).fill(process.env.E2E_PASSWORD!);
await page.getByRole('button', { name: 'Create account' }).click();
await expect(page.getByRole('heading', { name: 'Check your inbox' })).toBeVisible();
});
await test.step('verify the email', async () => {
await page.goto(await getVerificationLink(request, email));
await expect(page).toHaveURL(/\/onboarding/);
});
await test.step('create the first project', async () => {
await page.getByRole('button', { name: 'New project' }).click();
await page.getByLabel('Project name').fill('Q4 launch');
await page.getByRole('button', { name: 'Create project' }).click();
await expect(page.getByTestId('project-title')).toHaveText('Q4 launch');
const res = await page.request.get('/api/projects');
expect(await res.json()).toContainEqual(expect.objectContaining({ name: 'Q4 launch' }));
});
});test.step labels each checkpoint in the report and the trace, so a failure names the step that broke. No line waits a fixed time, and no other test can touch this user.
6. Run it in CI on every pull request
E2E test automation pays off only when it runs on every change. Point the suite at a preview deploy of the pull request or at staging, retry only in CI, record a trace on the first retry, and keep screenshots and video for failed runs:
// playwright.config.ts
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests/e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
reporter: 'html',
use: {
baseURL: process.env.BASE_URL,
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
{ name: 'webkit', use: { ...devices['Desktop Safari'] } },
],
});The GitHub Actions job runs the suite and uploads the HTML report, which holds the traces, screenshots and videos:
# .github/workflows/e2e.yml
name: E2E
on: pull_request
jobs:
e2e:
runs-on: ubuntu-latest
env:
BASE_URL: ${{ vars.E2E_BASE_URL }}
MAILPIT_URL: ${{ vars.MAILPIT_URL }}
E2E_PASSWORD: ${{ secrets.E2E_PASSWORD }}
E2E_ADMIN_TOKEN: ${{ secrets.E2E_ADMIN_TOKEN }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: lts/*
- run: npm ci
- run: npx playwright install --with-deps
- run: npx playwright test
- uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 14If the suite gets slow, run only Chromium on pull requests (--project=chromium) and all three browsers nightly, or split the run across machines with --shard=1/3. Add a line to your pull request template that asks which journeys a change touches, so reviewers know which E2E results matter.
The same step in Cypress and Selenium
The ideas carry over to other tools. In Cypress, select elements by data-cy attributes and let assertions retry:
cy.visit('/signup');
cy.get('[data-cy="email"]').type(email);
cy.get('[data-cy="create-account"]').click();
cy.contains('h1', 'Check your inbox').should('be.visible');Selenium WebDriver has no auto-waiting assertions, so add explicit waits (Python shown):
driver.get(f"{base_url}/signup")
driver.find_element(By.CSS_SELECTOR, '[data-testid="email"]').send_keys(email)
driver.find_element(By.CSS_SELECTOR, '[data-testid="create-account"]').click()
WebDriverWait(driver, 10).until(
EC.text_to_be_present_in_element((By.TAG_NAME, "h1"), "Check your inbox"))To grab screenshots from Selenium runs, see the Selenium screenshot guide.
Tired of plain screenshots? Try ScreenSnap Pro.
Beautiful backgrounds, pro annotations, GIF recording, and instant cloud sharing, all in one app. Pay $34 once, own it forever.
See pricing and featuresE2E testing tools compared
Five tools cover most browser E2E work. Four are test frameworks, and Puppeteer is a browser automation library that you pair with a test runner.
| Tool | Type | Languages | Browsers | Best at |
|---|---|---|---|---|
| Playwright | Test runner and automation library. | TypeScript, JavaScript, Python, Java, .NET. | Chromium, Firefox, WebKit. | Auto-waiting, trace viewer and parallel runs built in. |
| Cypress | Test runner that runs inside the browser. | JavaScript, TypeScript. | Chrome-family, Firefox, WebKit (experimental). | An interactive runner with time-travel debugging. It drives one browser at a time. |
| Selenium WebDriver | W3C WebDriver library, plus Selenium Grid. | Java, Python, C#, Ruby, JavaScript. | Chrome, Edge, Firefox, Safari. | The widest reach in languages and browsers. You add the runner and the waits. |
| WebdriverIO | Test framework for Node.js. | JavaScript, TypeScript. | Major browsers through WebDriver and WebDriver BiDi, plus mobile apps through Appium. | Web and mobile tests in one runner, with Mocha, Jasmine or Cucumber. |
| Puppeteer | Browser automation library, not a test runner. | JavaScript, TypeScript. | Chrome, Firefox. | Fast scripts, PDFs and screenshots. Pair it with Jest or Mocha for tests. |
How to pick one:
- Playwright: the default for new TypeScript or JavaScript suites. It runs WebKit, the engine behind Safari, on Linux CI.
- Cypress: front-end teams who want the interactive runner and never need two browsers in one test.
- Selenium: Java, C# and Python shops, real Safari, or an existing Selenium Grid.
- WebdriverIO: web and mobile tests in one runner.
- Puppeteer: Chrome scripts, PDFs and screenshot jobs rather than full suites.
For the deeper trade-offs, read Puppeteer vs Playwright. The Puppeteer screenshot guide covers its capture code.
Flaky E2E tests: causes and fixes
A flaky test passes and fails on the same code. Playwright marks a test as flaky when it fails first and passes on a retry, so the report tells you which tests to fix.
| Cause | What you see | Fix |
|---|---|---|
| Timing | A click lands before the page is ready. | Use auto-waiting actions and web-first assertions. Wait for a named response, never a fixed sleep. |
| Shared state | The test passes alone and fails in the full suite. | Give each test its own browser context and data, with no reliance on test order. |
| Unstable selectors | Tests break after a CSS refactor. | Use roles, labels and test IDs. |
| Test data collisions | Two workers edit the same record. | Create unique data per test and per worker. |
| Third-party calls | Payments, maps or analytics time out or hit rate limits. | Mock them with page.route, and keep one sandbox-backed journey per integration. |
| Animations | Clicks land on moving elements. | Set reducedMotion: 'reduce', or turn off animations in test builds. |
| Time and time zones | The test fails at midnight, at month end or only in CI. | Fix the clock with page.clock, and set timezoneId and locale. |
| Slow environment | Random timeouts right after a deploy. | Run a health check first, and report infra failures apart from test failures. |
Retries are a diagnostic, not a cure. Two retries in CI keep one bad network moment from blocking a merge, but every test the report marks as flaky needs a ticket and an owner. To stop flakes from hiding, run the main branch with --fail-on-flaky-tests.
To reproduce a flake on your machine, run the test many times in parallel:
npx playwright test tests/e2e/signup.spec.ts --repeat-each=20 --workers=4If it fails only with several workers, look for shared state. If it also fails alone, look at timing. A quarantine tag is fine for a week: move the test out of the merge gate, then fix it or delete it.

Debugging E2E failures with evidence
A red CI run is only useful if someone can see why it failed. Collect three kinds of evidence by default: a trace, a screenshot and a video.
Traces, screenshots and videos from CI
The Playwright trace viewer replays a run one action at a time. It shows DOM snapshots before and after each action, plus the network log, console messages, the source line and the error. Open a trace with npx playwright show-trace path/to/trace.zip, or drop the file into trace.playwright.dev, which loads it in your browser without uploading it.
The config above keeps a trace from the first retry, a screenshot of every failure and a video of every failed run. The Playwright test options list every mode, and without retries you should switch the trace to 'retain-on-failure'. For screenshot calls inside a test, see the Playwright screenshot guide.
Treat traces and saved auth state as secrets, since both can hold cookies and tokens. Keep CI artifacts private and set a short retention period, such as 14 days. To add your own evidence to the report, such as an API response or the email body, call testInfo.attach.
Evidence for manual runs and bug reports
Not every E2E run is automated. Testers walk the critical journeys by hand before big releases, and a developer often has to reproduce a CI failure on a laptop before filing it.
For those runs, record the journey with narration: say each step and the expected result out loud, then trim the clip to the failure. Take a screenshot of the failing step, number the steps, and add an arrow and an "Expected · Actual" callout. Cover tokens, emails and customer data with a solid box, because blur and pixelate can be reversed.
File it with the bug report template and attach the files themselves. A share link is fine as a heads-up in chat, but it is not the record.

ScreenSnap Pro covers that manual side on Mac and Windows. It records the screen with your microphone for narration, trims the clip in the built-in video editor and exports an MP4 or GIF. For stills, numbered counters, arrows, callouts and a filled rectangle mark up the failing step, and OCR copies the exact error text.
No capture app on a test machine? The free image annotation tool adds arrows, text and solid boxes in the browser.
E2E test case template (copy and paste)
Use this format for each journey in the suite, whether a script or a person runs it. It adds the fields E2E needs to the standard test case template: environment, test data, side effects, cleanup and evidence.
## E2E-[ID] · [Journey: the outcome the user gets]
Priority and risk: [P1 · what breaks for users or revenue if this fails]
Automation: [spec file and test name · or Manual]
Environment and build: [preview or staging URL · build or commit SHA]
Browsers: [Chromium, Firefox, WebKit]
### Preconditions
- [Feature flags, seeded accounts, sandboxes for payments and email]
### Test data
- [Unique per run, such as e2e-[worker]-[timestamp]@example.test]
- [Sandbox card or account from the provider's test mode]
### Steps and expected results
1. [User action] → Expected: [what the user sees]
2. [User action] → Expected: [what the user sees]
3. [User action] → Expected: [what the user sees, plus the side effect in the API, email or database]
### Cleanup
- [What gets deleted, by which call, even when the test fails]
### Evidence on failure
- Automated: [trace, screenshot and video from CI]
- Manual: [annotated screenshot of the failing step, narrated recording]
- Attach the files to the bug report. No share links as the record.
Owner: [name] · Last reviewed: [date]E2E testing checklist
Run through this list before you add a journey to the suite, and again when the suite starts to flake.
Scope
- Each E2E test covers a critical journey with a named owner.
- Edge cases, validation rules and anything a lower-level test can prove stay out of the E2E suite.
Data and state
- Every test creates its own unique data, cleans it up and never depends on another test's order.
- Logged-in tests reuse a saved storage state, and the auth folder is in .gitignore.
- Third-party services are mocked, except one sandbox-backed journey per integration.
Locators and assertions
- Locators use roles, labels or test IDs, never CSS classes or XPath.
- There are no fixed waits, only web-first assertions and waits for named responses.
- Each step ends with an assertion on what the user sees.
CI and evidence
- The suite runs on every pull request against a preview or staging deploy.
- Retries are on in CI only, and every flaky result gets a ticket.
- Traces, screenshots and videos upload as artifacts on failure.
- Manual runs end with an annotated screenshot or a narrated recording in the bug report.
Frequently Asked Questions
Start with one journey this sprint
Pick the journey that would hurt most if it broke, write it down as steps, and automate it with the six steps above. Add the next journey only after the first one runs green for a week without a retry.
If your team files E2E failures with screenshots and screen recordings, ScreenSnap Pro keeps capture, markup and recording in one app. It is a one-time $34 purchase: 1 license, 2 seats (2 computers, Mac or Windows). See pricing.
Morgan
Indie DeveloperIndie developer, founder of ScreenSnap Pro. A decade of shipping consumer Mac apps and developer tools. Read full bio
@m_0_r_g_a_n_

