
Summary
Key points of this document
- Where are the design challenges?
- How to define boundaries
- Details that work in implementation
Overview
While E2E tests offer great value, increasing them too much can make them slow and unstable. The key is to prioritize protecting operations that would halt business. E2E tests are not meant to cover every screen, but rather an investment to reliably protect even a few critical paths that would stop business if they fail.
Where are the design challenges?
Even with Playwright, trying to meticulously test every screen makes maintenance impossible. If minor UI changes break more tests, the reliability of E2E decreases.
E2E depends on the browser, network, DB, and authentication. Execution times also tend to be long. Tests run for each PR should be limited to high-value ones that complete quickly.
Playwright can reproduce browser operations, but trying to cover all screens results in a fragile and slow set of tests. The key is to select the actual paths that would halt business and run them reliably, even if few.
How to define boundaries
First, select the critical paths that would cause problems if business stops. Prioritize flows such as being able to log in, register main data, search, approve, and reject unauthorized operations.
In design, create tests based on business scenarios, not screen units. Treat paths spanning multiple screens, such as login, search, registration, approval, and file output, as a single critical path.
Details that work in implementation
In tests, use APIs and databases to create prerequisite data, and make screen operations follow steps close to the user's. Use roles and labels for selectors instead of visual classes. Isolate data for each test to withstand parallel execution.
In implementation, prepare test users, seed data, API-based setup, data-testid, and waiting conditions. Avoid selectors dependent on UI appearance, and use locators that preserve the meaning of the operation for easier maintenance.
- Create independent data for each test to ensure they don't depend on execution order.
- Don't rely solely on network idle; use on-screen completion states or API results as waiting conditions.
- On failure, save trace, video, and screenshot to enable root cause analysis on CI.
Observe how failures occur
In CI, run a few critical paths during PRs, and execute broader regression tests overnight or manually. On failure, save screenshots, videos, and traces to quickly pinpoint the cause.
In verification, we observe stability in CI. We check if it works as expected not only locally, but also in slow environments, with parallel execution, on first login, and with different permissions. Flaky tests are not ignored as they reduce confidence in production quality.
Discarded options and trade-offs
While checking fine-grained branches with E2E increases confidence, it also increases execution time and instability. It's easier to maintain if input validation and calculation logic are moved to Vitest, and E2E focuses on verifying integrated flows.
E2E tests are slower than unit tests and have broader failure causes. That's why you should limit their number and focus on paths with high business impact. Fine-grained branches can be offloaded to component tests or API tests for better balance.
Decision criteria to leave on site
Playwright is not a tool for fully automated screen verification, but for protecting the flows necessary for business continuity. By carefully selecting the first few tests, you can gain significant peace of mind with fewer tests.
Playwright is not a tool for competing on coverage. When used to protect critical business flows that must not be stopped, even a small number of tests can yield significant results.


