playwright-e2e-mcp 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +40 -8
  2. package/dist/cli/ci.js +3 -0
  3. package/dist/cli/ci.js.map +1 -1
  4. package/dist/cli/guard.d.ts +11 -0
  5. package/dist/cli/guard.js +80 -0
  6. package/dist/cli/guard.js.map +1 -0
  7. package/dist/cli/upload.d.ts +14 -0
  8. package/dist/cli/upload.js +81 -0
  9. package/dist/cli/upload.js.map +1 -0
  10. package/dist/http.d.ts +1 -1
  11. package/dist/http.js +1 -1
  12. package/dist/index.js +22 -0
  13. package/dist/index.js.map +1 -1
  14. package/dist/server.d.ts +2 -2
  15. package/dist/server.js +44 -6
  16. package/dist/server.js.map +1 -1
  17. package/dist/tools/analyze-history.d.ts +15 -0
  18. package/dist/tools/analyze-history.js +44 -9
  19. package/dist/tools/analyze-history.js.map +1 -1
  20. package/dist/tools/check-test-change.d.ts +44 -0
  21. package/dist/tools/check-test-change.js +132 -0
  22. package/dist/tools/check-test-change.js.map +1 -0
  23. package/dist/tools/get-run-status.js +8 -2
  24. package/dist/tools/get-run-status.js.map +1 -1
  25. package/dist/tools/probe-script.js +93 -1
  26. package/dist/tools/probe-script.js.map +1 -1
  27. package/dist/tools/quarantine.d.ts +61 -0
  28. package/dist/tools/quarantine.js +133 -0
  29. package/dist/tools/quarantine.js.map +1 -0
  30. package/dist/tools/run-test.d.ts +10 -1
  31. package/dist/tools/run-test.js +36 -5
  32. package/dist/tools/run-test.js.map +1 -1
  33. package/dist/tools/save-login.d.ts +142 -0
  34. package/dist/tools/save-login.js +264 -0
  35. package/dist/tools/save-login.js.map +1 -0
  36. package/dist/tools/shared.d.ts +24 -1
  37. package/dist/tools/shared.js +1 -1
  38. package/dist/tools/shared.js.map +1 -1
  39. package/dist/tools/structured.d.ts +8 -1
  40. package/dist/tools/structured.js +8 -1
  41. package/dist/tools/structured.js.map +1 -1
  42. package/dist/utils/pro-client.d.ts +29 -0
  43. package/dist/utils/pro-client.js +114 -0
  44. package/dist/utils/pro-client.js.map +1 -0
  45. package/dist/utils/quarantine.d.ts +64 -0
  46. package/dist/utils/quarantine.js +106 -0
  47. package/dist/utils/quarantine.js.map +1 -0
  48. package/dist/utils/test-change-guard.d.ts +69 -0
  49. package/dist/utils/test-change-guard.js +391 -0
  50. package/dist/utils/test-change-guard.js.map +1 -0
  51. package/dist/utils/totp.d.ts +26 -0
  52. package/dist/utils/totp.js +84 -0
  53. package/dist/utils/totp.js.map +1 -0
  54. package/package.json +1 -1
  55. package/skill/playwright-e2e-mcp/SKILL.md +41 -7
  56. package/skill/playwright-e2e-mcp/references/setup.md +7 -1
  57. package/skill/playwright-e2e-mcp/references/tools.md +41 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: playwright-e2e-mcp
3
- description: Runs, debugs and fixes Playwright end-to-end tests through the playwright-e2e-mcp server, using structured run results grouped by root cause, trace-based failure diagnostics, verified locators, self-healing fixes that re-run and revert if still red, per-test flaky verdicts that separate parallelism, test-order and timing bugs, signed-in page inspection with network mocks and HAR replay, aria snapshots, tests written by walking the flow on the live page, CI report diagnosis, WCAG accessibility audits, Web Vitals performance audits and local run history with the commit that broke each test, plus a guide to writing tests that stay green. Use when the user asks to run Playwright tests, fix a failing or broken e2e test, find out why a CI run failed, find out why a test is flaky or which tests are unstable or slow, repair a selector that no longer matches, write or review a Playwright test, check a page for accessibility, performance or visual regressions.
3
+ description: Runs, debugs and fixes Playwright end-to-end tests through the playwright-e2e-mcp server: run results grouped by root cause, trace-based failure diagnostics, verified locators, self-healing fixes that re-run and revert if still red, a heal guard that blocks fixes which pass by checking less, per-test flaky verdicts (parallelism, test order, timing), an owned, expiring flaky-test quarantine, saved logins with 2FA codes, signed-in page inspection with network mocks, tests written by walking the flow, CI report diagnosis, accessibility and Web Vitals audits and run history with the commit that broke each test. Use when the user asks to run Playwright tests, fix a failing or broken e2e test, find out why CI failed, find flaky, unstable or slow tests, repair a selector, write or review a Playwright test, log in for tests, or check a page for accessibility, performance or visual regressions.
4
4
  ---
5
5
 
6
6
  # Playwright E2E with playwright-e2e-mcp
@@ -13,7 +13,7 @@ and concrete next steps. It can also propose and apply a verified fix for a brok
13
13
  locator, inspect pages behind a login, run long suites in the background and keep
14
14
  a local history of every run.
15
15
 
16
- This skill is written for playwright-e2e-mcp 0.6.1 and works with 0.2.0 or
16
+ This skill is written for playwright-e2e-mcp 0.7.0 and works with 0.2.0 or
17
17
  newer. If `suggest-fix`, `get-run-status` or `analyze-history` is missing, the
18
18
  server is older than 0.2.0: use the steps that do not need those tools and tell
19
19
  the user to update it. `diagnose-flaky`'s per-test table and `isolate` option
@@ -21,7 +21,8 @@ arrived in 0.3.0; `audit-accessibility`, `diagnose-flaky`'s `order` option and
21
21
  root-cause grouping in `run-test` arrived in 0.4.0; `audit-performance`,
22
22
  `load-report`, network mocks (`routes`), `har`, `browser`, `inspect-page`'s
23
23
  `view: "aria"`, `generate-e2e-test`'s `steps`, the `slow`, `trend` and `commits`
24
- history views and strict-mode fixes in `suggest-fix` arrived in 0.5.0.
24
+ history views and strict-mode fixes in `suggest-fix` arrived in 0.5.0;
25
+ `save-login`, `check-test-change` and `quarantine` arrived in 0.7.0.
25
26
 
26
27
  ## Before you start
27
28
 
@@ -29,8 +30,8 @@ history views and strict-mode fixes in `suggest-fix` arrived in 0.5.0.
29
30
  `get-run-status`, `get-failure`, `load-report`, `suggest-fix`, `inspect-page`,
30
31
  `validate-selector`, `list-tests`, `generate-e2e-test`,
31
32
  `compare-visual-state`, `audit-accessibility`, `audit-performance`,
32
- `diagnose-flaky` and
33
- `analyze-history` (your client
33
+ `diagnose-flaky`, `analyze-history`, `audit-tests`, `bisect-failure`,
34
+ `save-login`, `check-test-change` and `quarantine` (your client
34
35
  may prefix them, e.g. `mcp__playwright-e2e__run-test`).
35
36
  2. If they are all missing, stop and tell the user the MCP server is not
36
37
  connected. Point them to `references/setup.md` for the one-line install for
@@ -39,7 +40,7 @@ history views and strict-mode fixes in `suggest-fix` arrived in 0.5.0.
39
40
  `references/writing-tests.md`. Do not fall back to shelling out to `npx playwright test` unless
40
41
  the user asks. If only some are missing, the server may run a smaller tool
41
42
  profile (`--tools=core` exposes `run-test`, `get-run-status`, `get-failure`,
42
- `suggest-fix`, `diagnose-flaky` and `list-tests`); work with what is there and
43
+ `suggest-fix`, `diagnose-flaky`, `check-test-change` and `list-tests`); work with what is there and
43
44
  mention the profile when a task needs a page tool.
44
45
  3. Every tool except `get-run-status` takes an optional `projectRoot`. Leave it
45
46
  out unless the user works in a sub-project; the server defaults to `PW_MCP_PROJECT_ROOT` or its working
@@ -88,6 +89,10 @@ Follow these steps in order. Do not edit code before step 3.
88
89
  - Failed network request (4xx/5xx/no response) right before the failure: the
89
90
  backend is the likely cause; report it.
90
91
  4. **Fix** the spec or the app code, the smallest change that addresses the cause.
92
+ Then call `check-test-change` (0.7.0+; no arguments checks the uncommitted
93
+ changes). If it says **BLOCK**, the fix made the test pass by checking less
94
+ (a deleted assertion, a skip, `.only`): undo that part and fix the cause. Treat
95
+ **WARN** findings as things to justify to the user, not to wave through.
91
96
  5. **Re-run only what failed:** `run-test` with `{ "lastFailed": true }`. Repeat
92
97
  from step 2 until green.
93
98
 
@@ -136,6 +141,26 @@ fresh browser, so a signed-in page shows the login screen unless you pass state:
136
141
  (it must be installed; `audit-performance` stays Chromium-only).
137
142
  - `viewport`: `{ "width": 390, "height": 844 }` for mobile layouts.
138
143
 
144
+ When there is no saved session yet, or it expired, call `save-login` (0.7.0+)
145
+ instead of typing credentials into `actions` every time:
146
+
147
+ ```json
148
+ { "url": "http://localhost:3000/login",
149
+ "actions": [
150
+ { "type": "fill", "locator": "getByLabel('Email')", "value": "qa@example.com" },
151
+ { "type": "fill", "locator": "getByLabel('Password')", "value": "{{env:E2E_PASSWORD}}" },
152
+ { "type": "fill", "locator": "getByLabel('Code')", "value": "{{totp}}" },
153
+ { "type": "click", "locator": "getByRole('button', { name: 'Sign in' })" }],
154
+ "verify": { "url": "/account", "visible": "getByRole('button', { name: 'Sign out' })", "notUrl": "/login" },
155
+ "totpSecretEnv": "E2E_TOTP_SECRET" }
156
+ ```
157
+
158
+ It saves `playwright/.auth/user.json` and reuses it while `verify` passes. Never
159
+ put a password in a tool argument or in chat: ask the user to set it as an
160
+ environment variable for the server (`E2E_*`, `TEST_*`, `LOGIN_*`, or a name
161
+ listed in `PW_MCP_LOGIN_ENV`) and refer to it as `{{env:NAME}}`. `{{totp}}`
162
+ types the current authenticator code from the secret in `totpSecretEnv`.
163
+
139
164
  When a response says the page landed on a login screen, retry with
140
165
  `storageState`. `suggest-fix` takes `storageState` and `headers` too when you heal
141
166
  against a live `url`.
@@ -183,6 +208,14 @@ one verdict **per test** (passes, failures, duration spread, first error):
183
208
  tests that flaked; `fix: true` applies the mechanical rewrites and re-runs them.
184
209
  - **NOT REPRODUCING**: passed every run. Report that the failure was one-off.
185
210
 
211
+ If a FLAKY test cannot be fixed right away and is blocking other work, offer
212
+ `quarantine` (0.7.0+) with `action: "add"`, the test (`index` of the last run's
213
+ failure, or `"file › title"`), an `owner` and a `reason` (an issue link is best).
214
+ It keeps running and being reported, but stops failing the run until the entry
215
+ expires (default 14 days). Ask the user before adding one; never quarantine a
216
+ CONSISTENTLY FAILING test, which is a real failure. `quarantine` with no
217
+ arguments lists the entries and the expired ones.
218
+
186
219
  When a test is FLAKY and the suite runs in parallel, call `diagnose-flaky` again
187
220
  with `isolate: true`. It repeats the tests fully parallel, then repeats the
188
221
  failing ones with one worker, and reads each one:
@@ -244,7 +277,7 @@ with the commit it tested. `analyze-history` views:
244
277
  `selector` for one region) returns the accessibility snapshot and a
245
278
  `toMatchAriaSnapshot` assertion to paste into a spec.
246
279
  - **Set up CI:** when the user wants the same diagnosis on every pull request,
247
- point them to the GitHub Action (`uses: xsignon-secure/E2E@v0.6.1`) or the
280
+ point them to the GitHub Action (`uses: xsignon-secure/E2E@v0.7.0`) or the
248
281
  `npx -y playwright-e2e-mcp ci` command in `references/setup.md`. It writes the
249
282
  run, flaky verdicts and fix diffs to the job summary and one PR comment.
250
283
  - **Accessibility:** `audit-accessibility` with `url` runs axe-core against
@@ -284,6 +317,7 @@ When you finish, tell the user, in this order:
284
317
 
285
318
  - Do not raise timeouts, add retries, add `waitForTimeout`, or delete or
286
319
  `test.skip` a test to make a run green, unless the user explicitly asks.
320
+ `check-test-change` catches these; run it after every test edit.
287
321
  - Do not accept a new visual baseline without the user's confirmation.
288
322
  - Do not pass `allowExpectationUpdate: true` to `suggest-fix` unless the user
289
323
  confirms the new text is intended; a changed expected value can be a real bug.
@@ -82,6 +82,8 @@ Set these in the server's `env` block. None of them are secrets except
82
82
  | `PW_MCP_BLOCK_PRIVATE_URLS` | off for stdio | `1` makes the URL tools refuse loopback, private-network and cloud-metadata addresses |
83
83
  | `PW_MCP_STORAGE_STATE` | none | Default Playwright storageState JSON (inside the project) for the page tools, so signed-in pages open logged in |
84
84
  | `PW_MCP_SHUFFLE_SEEDS` | random | Seeds for `diagnose-flaky`'s `order` pass (comma separated), to replay reported orders |
85
+ | `PW_MCP_LOGIN_ENV` | — | Extra variables `save-login` may type through `{{env:NAME}}`, comma separated (default: only `E2E_*`, `TEST_*`, `PW_*`, `PLAYWRIGHT_*`, `LOGIN_*`) |
86
+ | `PW_MCP_PRO_KEY` / `PW_MCP_PRO_URL` | — | Optional paid Pro: CI runs uploaded with `upload` show up in `analyze-history` (`source: both`). Unset = no network calls |
85
87
  | `PW_MCP_HISTORY` | on | `0` stops recording runs to `<project>/.playwright-e2e-mcp/history.jsonl` (this turns off `analyze-history`) |
86
88
  | `LOG_LEVEL` | `info` | `debug`, `info`, `warn`, `error` or `silent` |
87
89
  | `PW_MCP_HTTP_TOKEN` | none | HTTP bridge only: bearer token that unlocks all tools |
@@ -112,7 +114,7 @@ Exit code 0 means passed, 1 tests failed, 2 the run itself failed. On GitHub
112
114
  Actions it also writes to the job summary. As an Action:
113
115
 
114
116
  ```yaml
115
- - uses: xsignon-secure/E2E@v0.6.1
117
+ - uses: xsignon-secure/E2E@v0.7.0
116
118
  with:
117
119
  flaky-runs: 3
118
120
  suggest: 2
@@ -120,3 +122,7 @@ Actions it also writes to the job summary. As an Action:
120
122
 
121
123
  It keeps one PR comment up to date when the run fails (needs
122
124
  `pull-requests: write`).
125
+
126
+ From 0.7.0, `npx -y playwright-e2e-mcp guard --base origin/main` (or the
127
+ Action's `guard: true` input) fails the job when a changed test was made to
128
+ pass by checking less, and `ci` honours `playwright-quarantine.json`.
@@ -278,3 +278,44 @@ mechanically. Files rank by findings weighted by their flaky rate in the history
278
278
  Runs in a temporary git worktree with the current `node_modules` linked in;
279
279
  untestable commits are skipped. `status` is `found`, `ambiguous`, `max-steps`,
280
280
  `not-failing` (passes at bad) or `good-fails`.
281
+
282
+ ## save-login (0.7.0+)
283
+
284
+ | Argument | Type | Notes |
285
+ | --- | --- | --- |
286
+ | `url` | string | Login page (required) |
287
+ | `actions` | array | Login steps as in `inspect-page`; fill values may use `{{env:NAME}}` and `{{totp}}` |
288
+ | `verify` | object | `url` (page to check, e.g. `/account`), `visible` (locator only a signed-in user sees), `notUrl` (bad if the URL contains it, e.g. `/login`) |
289
+ | `name` / `path` | string | Saved to `playwright/.auth/<name>.json` (default `user`) or `path` |
290
+ | `totpSecretEnv` | string | Variable holding the authenticator secret (base32 or `otpauth://`) |
291
+ | `reuse` | boolean | Keep a saved session that still passes `verify` (default true) |
292
+
293
+ `status` is `saved`, `valid` (reused, nothing typed) or `failed` (no file written).
294
+ Only `E2E_*`, `TEST_*`, `PW_*`, `PLAYWRIGHT_*`, `LOGIN_*` and names in
295
+ `PW_MCP_LOGIN_ENV` can be read through `{{env:…}}`.
296
+
297
+ ## check-test-change (0.7.0+)
298
+
299
+ | Argument | Type | Notes |
300
+ | --- | --- | --- |
301
+ | `base` | string | Git ref (default `HEAD`: the uncommitted changes; `origin/main` for the branch) |
302
+ | `files` | string[] | Only these files |
303
+ | `file` + `after` | string | Check a proposed full file content before writing it |
304
+
305
+ `status` is `OK`, `WARN` or `BLOCK`; `ok` is false only on BLOCK. BLOCK: fewer
306
+ assertions in a test, a removed or skipped test, `.only`, a deleted spec. WARN:
307
+ `expect.soft`, a weaker matcher, `waitForTimeout`, `force: true`, a swallowed
308
+ error, a raised timeout, retries or screenshot tolerance.
309
+
310
+ ## quarantine (0.7.0+)
311
+
312
+ | Argument | Type | Notes |
313
+ | --- | --- | --- |
314
+ | `action` | string | `list` (default), `add`, `remove` |
315
+ | `test` | string | `'file › title'`; or `file` + `title`; or `index` (last run's failure) |
316
+ | `owner` / `reason` | string | Required for `add` |
317
+ | `days` | number | 1–90, default 14 |
318
+
319
+ Stored in `playwright-quarantine.json` (commit it). A quarantined, unexpired
320
+ failure is listed under 🧊 and does not fail `run-test` or `ci`; `run.quarantined`
321
+ counts them. Expired entries block again.