Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: prefer extending existing tests in AGENTS.md (#43325)

Pavel Feldman2c6885b34e37
diff --git a/AGENTS.md b/AGENTS.md
index 71643e822c..875ce42c33 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -55,7 +55,7 @@ npm run flint
Runs all lint checks in parallel: eslint, tsc, doclint, check-deps, generate_channels, generate_types, lint-tests, test-types, lint-packages, code-snippet linting.
-**Always run `flint` before committing.** Do not use `tsc --noEmit` or individual lint commands separately.
+**Run `flint` only before you upload a PR, and only after `npm run build`.** Do not run it before each commit. Do not use `tsc --noEmit` or individual lint commands separately.
## Test Commands
@@ -90,8 +90,9 @@ npm run ctest-mcp snapshot # By file name part
### Test Scope
-Keep tests minimal.
+Keep tests minimal. Be mindful of the number of tests you add.
+- **Extend before you add**: before you write a new test, look for an existing test that covers the same feature or code path. If one exists, add the new edge case or assertion to it. Create a new test only when no existing test is a good fit, or when the new scenario needs a different setup.
- **New features**: cover the mainstream scenario and the important edge cases only. Do not create matrices of tests for every scenario, option, or aspect.
- **Regressions**: generalize the provided regression cases into meaningful tests, and stop there. Do not add more tests around them.
@@ -113,7 +114,7 @@ Non-exported classes have no naming convention; they are internal implementation
## Commit Convention
-Before committing, run `npm run flint` and fix errors.
+Before you upload a PR, run `npm run build`, then `npm run flint`, and fix errors.
Semantic commit messages: `label(scope): description`