How to understand a Playwright end-to-end tests codebase
End-to-end tests describe what users actually do, step by step, in a real browser. They are one of the quickest ways to learn the important flows of an unfamiliar product, as long as you understand the fixtures and setup that run before each test.
How to tell it's Playwright end-to-end tests
playwright.config.tsand@playwright/testindevDependencies- An
e2e/ortests/folder withtest(...)calls usingpage - Fixtures defined with
test.extendand auth state files
Where things usually live
- playwright.config.ts
- Base URL, browsers (projects), retries, the
webServerthat starts the app. - e2e/*.spec.ts
- Test files, usually one per flow.
- e2e/fixtures.ts
- Custom fixtures such as a logged-in page or seeded data.
- e2e/pages/
- Page objects wrapping selectors and actions.
- e2e/auth.setup.ts
- Logs in once and saves
storageStatefor other tests.
Conventions, not rules. Real projects rename and move things, so confirm against the repository.
Where to start reading
- The config, especially
webServerandprojects - Setup projects and fixtures
- The spec for the flow you care about
How a request moves through the code
- Playwright starts the app with
webServerif configured. - Setup projects run first, often signing in and saving storage state.
- Each test gets fixtures, opens pages and performs user actions.
- Assertions such as
expect(locator).toBeVisible()retry until they pass or time out.
Questions to ask about the repository
- Which user flows are covered end to end?
- How do tests log in, and with which test accounts?
- Which flows are missing coverage?
What trips people up
- Tests depend on fixture setup that runs elsewhere; reading a spec alone can miss the starting state.
- Selectors tied to CSS classes break often; role- and test-ID-based locators are more stable.