TST-17Required
Test every critical journey end to end
Every journey that must never break, such as sign-up, checkout and booking, has an end-to-end test that passes before each deploy. Keep the browser suite to these journeys and leave details to faster tests.
How to do it
List five to fifteen journeys from the risk list. Write one test per journey, from the first page to the final result. Test edge cases at lower levels. Run them against the production build. For checkout, cover the outcomes in Test every payment outcome with test cards.
Examples
JavaScript example
import { test, expect } from '@playwright/test';
test('a visitor can buy a mug', async ({ page }) => {
await page.goto('/products/mug');
await page.getByRole('button', { name: 'Add to cart' }).click();
await page.getByRole('link', { name: 'Checkout' }).click();
await page.getByLabel('Email').fill('ada@example.com');
await page.getByRole('button', { name: 'Pay' }).click();
await expect(page.getByRole('heading', { name: 'Thank you' })).toBeVisible();
});
Python example
# Playwright for Python
from playwright.sync_api import Page, expect
def test_a_visitor_can_buy_a_mug(page: Page):
page.goto("/products/mug")
page.get_by_role("button", name="Add to cart").click()
page.get_by_role("link", name="Checkout").click()
page.get_by_label("Email").fill("ada@example.com")
page.get_by_role("button", name="Pay").click()
expect(page.get_by_role("heading", name="Thank you")).to_be_visible()
How to check
Every journey on the list has one browser test, and the deploy pipeline stops when any of them fails. The browser suite fits inside the full suite's limit in Keep the suite within a time budget.
Sources
Related rules
- AID-16 Run the change yourself in AI-assisted development
- TST-2 Keep most tests small and fast in Testing
- TST-1 Test what would hurt to break in Testing
- TST-20 Run browser tests against the production build in Testing
- PAY-6 Test every payment outcome with test cards in Payments and billing
- TST-30 Keep the suite within a time budget in Testing
- TST-63 Break the services you depend on in a test environment in Testing
- AXS-82 Test each critical journey with a keyboard and a screen reader in Accessibility
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/testing/end-to-end-and-browser-tests/critical-journeys">Agent Wranglers testing playbook</a>. In code you write, add a comment next to it with the same link.