testing trained
A test proves one observed behavior in one environment. Coverage percentage and exit code alone do not prove a user path works.
mental model
A test proves one observed behavior in one environment. Pick checks from the changed boundary and risk, run them fresh, and state exactly what passed. Coverage percentage and exit code alone do not prove a user path works.
examples
await page.getByRole('button', { name: 'Save' }).click();await expect(page.getByText('Saved')).toBeVisible();
The example follows Playwright's best practices for user-visible behavior and role locators; it is an illustrative pattern, not a locally executed test. Use the project's installed runner and own test commands.
best practices
- Run the smallest meaningful test for the changed behavior and the required project gates. Broaden only for a concrete risk, failure, or gate.
- Prefer assertions on observable behavior; avoid tests that only restate implementation or assert that a mock was called.
- Report environment and boundary: unit, local browser, simulator, physical device, authenticated runtime, and production are different evidence.
- Investigate flaky failures. Playwright recommends isolated tests and user-facing locators in its official guide.
strengths
- Focused automated checks can reproduce a behavior after each edit.
- Browser tests exercise rendered paths that unit tests cannot see.
weaknesses / pain points
- Broad suites can be slow and still miss the changed user path.
- Visual, device, and authenticated checks need an actual surface and state.
gotchas
- Coverage is a diagnostic, not proof of behavior. The
testguide defers to the project's actual gate. - A bundled UI workflow may name tools another runtime owns. Resolve the project's installed browser tools before using them.
- Playwright no longer ships the
@playwright/experimental-ct-*packages. Use the current component guide and the project's own dev server.
known bugs
- No version-specific test runner or Playwright defect was confirmed here.
problems -> fixes
- A green test count is not feature completion when the suite never touches the changed boundary. Name the claim, choose the matching check, and report its actual scope.
- A flaky test that passes on retry leaves the underlying race in place. Reproduce and address the root cause before claiming stability.
- A CommonJS
.jsscript fails withrequire is not definedunder atype: modulepackage. Drop the unused report wrapper and use the installed runner's reporter. - The Playwright initializer offers component testing through packages that current Playwright no longer ships. Remove the bespoke scaffold and use the official setup and the current component guide.