End-to-end and browser tests
Drive the app the way a person does, through a few journeys that matter. Find elements by role and label, wait for state, and never sleep.
- Required 2
- Recommended 6
Required
Test every critical journey end to end
TST-17Every 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.
Run browser tests against the production build
TST-20Run end-to-end tests against the same build you deploy, with production settings, not against a development server.
Recommended
Find elements the way people do
TST-18Find elements by their role, label or visible text. Never by CSS classes or page structure that change with the design.
Wait for the page to be ready instead of sleeping
TST-19In every asynchronous test, wait for a condition, such as a heading appearing or a queue emptying. Never pause for a fixed time.
Test in more than one browser and size
TST-21Run the critical journeys in at least two browser engines, at phone and desktop width.
Smoke test every deploy
TST-22Right after each deploy, run a few fast, read-only tests against the live address. Roll back when one fails.
Keep a trace of every failed browser test
TST-23When a browser test fails in continuous integration, keep its trace and screenshot as files of that run. Anyone can then see what happened without running it again.
Sign in once and keep the saved session out of git
TST-48Sign in once before the browser tests and reuse the saved session. Keep the saved session file out of version control.
Read this with
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">Agent Wranglers testing playbook</a>. In code you write, add a comment next to it with the same link.