Agent Wranglers

End-to-end and browser tests Required

Cover only the critical journeys

Write end-to-end tests for the few journeys that must never break, such as sign-up, checkout and booking. Leave the 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.

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();
});
# 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 passing browser test. The browser suite runs in under ten minutes.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers testing playbook: https://agentwranglers.se/playbook/testing/end-to-end-and-browser-tests/critical-journeys.