{"name": "playwright", "version": "0.1.0", "hash": "sha256:1eab4406672875a4125577cbcf2561c09932131e0b56e71ddb075ade217f7beb", "files": {"ABSORB_REPORT.md": "# Absorb report: playwright\n\n- **Source:** https://github.com/microsoft/playwright at `a804c1935620`\n- **Licence:** Apache-2.0\n- **Project names searched for:** playwright, playwright-internal\n\n## What was absorbed\n\n| Piece | Kind | Class | Project names | Project paths |\n|---|---|---|---|---|\n| api-review | skill | mixed | playwright ×49 | docs/src, docs/src/test-api, docs/src/test-reporter-api, packages/playwright/types/test.d.ts, packages/playwright/types/testReporter.d.ts, packages/playwright-core/types/types.d.ts, packages/playwright/src/program.ts, packages/playwright-core/src/tools/cli-daemon/commands.ts, packages/playwright-core/src/tools/mcp/program.ts, packages/playwright-core/src/tools/mcp/config.d.ts, packages/playwright-core/src/tools/skills/playwright-cli, docs/src/release-notes-js.md |\n| playwright-audit-deps | skill | mixed | playwright ×7 | tests/installation/bundle-licenses.spec.ts, tests/installation/bundle-size.spec.ts, packages |\n| playwright-bisect-chromium | skill | mixed | playwright ×10 | utils/bisect-chromium.mjs, packages/playwright-core/browsers.json, tests/page/page-goto.spec.ts |\n| playwright-dev | skill | mixed | playwright ×145 | docs/src/api/params.md, packages/playwright-core/types/types.d.ts, packages/playwright/types/test.d.ts, packages/protocol/spec, packages/playwright-core/src/client/channels.d.ts, packages/playwright-core/src/server/channels.d.ts, packages/protocol/src/validator.ts, packages/isomorphic/protocolMetainfo.ts, packages/playwright-core/src/server/frames.ts, packages/playwright-core/src/server/chromium/crPage.ts, packages/playwright-core/src/server/firefox/ffPage.ts, packages/playwright-core/src/server/webkit/wkPage.ts |\n| playwright-devops | skill | mixed | playwright ×6 |  |\n| playwright-release-notes | skill | mixed | playwright ×31 | docs/src/release-notes-js.md, docs/src, utils/print_versions.js, docs/src/api, docs/src/api/params.md |\n| playwright-test-results | skill | mixed | playwright ×12 | utils/test-results-db/cli.ts, tests/config/parquetReporter.ts |\n\n## Needs review before sharing\n\nThese pieces mention the project by name or lean on its files. Move those facts into configuration, or keep the piece out of a shared starter.\n\n- **api-review** (skill): names playwright; paths docs/src, docs/src/test-api, docs/src/test-reporter-api, packages/playwright/types/test.d.ts, packages/playwright/types/testReporter.d.ts, packages/playwright-core/types/types.d.ts, packages/playwright/src/program.ts, packages/playwright-core/src/tools/cli-daemon/commands.ts, packages/playwright-core/src/tools/mcp/program.ts, packages/playwright-core/src/tools/mcp/config.d.ts, packages/playwright-core/src/tools/skills/playwright-cli, docs/src/release-notes-js.md\n- **playwright-audit-deps** (skill): names playwright; paths tests/installation/bundle-licenses.spec.ts, tests/installation/bundle-size.spec.ts, packages\n- **playwright-bisect-chromium** (skill): names playwright; paths utils/bisect-chromium.mjs, packages/playwright-core/browsers.json, tests/page/page-goto.spec.ts\n- **playwright-dev** (skill): names playwright; paths docs/src/api/params.md, packages/playwright-core/types/types.d.ts, packages/playwright/types/test.d.ts, packages/protocol/spec, packages/playwright-core/src/client/channels.d.ts, packages/playwright-core/src/server/channels.d.ts, packages/protocol/src/validator.ts, packages/isomorphic/protocolMetainfo.ts, packages/playwright-core/src/server/frames.ts, packages/playwright-core/src/server/chromium/crPage.ts, packages/playwright-core/src/server/firefox/ffPage.ts, packages/playwright-core/src/server/webkit/wkPage.ts\n- **playwright-devops** (skill): names playwright\n- **playwright-release-notes** (skill): names playwright; paths docs/src/release-notes-js.md, docs/src, utils/print_versions.js, docs/src/api, docs/src/api/params.md\n- **playwright-test-results** (skill): names playwright; paths utils/test-results-db/cli.ts, tests/config/parquetReporter.ts\n\n## Not absorbed\n\n- instruction files (AGENTS.md): they describe the project, so they stay with it. Pass --with-instructions to absorb them for review\n\n## Self-test\n\nNo case could be generated.\n\n## Warnings\n\n- skipped skill playwright-cherry-pick: SKILL.md lacks name/description frontmatter\n", "ATTRIBUTION.md": "# Attribution: playwright\n\nThis harness was absorbed from https://github.com/microsoft/playwright at commit `a804c193562095b0da20e5d4679fa87e4c8e5563` on 2026-11-27 with `baudrier absorb`.\n\n- **Licence:** Apache-2.0. Licence and notice files kept unchanged in this folder: `LICENSE`, `NOTICE`.\n- **Credit:** every file listed below is the work of the source repository's authors. Files were copied unchanged, except that hook commands name their folder as `${HARNESS_HOOKS}` and slash commands were wrapped as skills.\n\n## Absorbed files\n\n- `skills/api-review/SKILL.md` (skill)\n- `skills/api-review/template.html` (skill)\n- `skills/playwright-audit-deps/SKILL.md` (skill)\n- `skills/playwright-audit-deps/audit-deps.mjs` (skill)\n- `skills/playwright-bisect-chromium/SKILL.md` (skill)\n- `skills/playwright-dev/SKILL.md` (skill)\n- `skills/playwright-dev/api.md` (skill)\n- `skills/playwright-dev/bisect-published-versions.md` (skill)\n- `skills/playwright-dev/dashboard.md` (skill)\n- `skills/playwright-dev/library.md` (skill)\n- `skills/playwright-dev/tools.md` (skill)\n- `skills/playwright-dev/trace_system_guide.md` (skill)\n- `skills/playwright-dev/vendor.md` (skill)\n- `skills/playwright-dev/webkit-safari-version.md` (skill)\n- `skills/playwright-dev/webview.md` (skill)\n- `skills/playwright-devops/SKILL.md` (skill)\n- `skills/playwright-devops/commit-failures.md` (skill)\n- `skills/playwright-devops/fetch-commit-logs.sh` (skill)\n- `skills/playwright-release-notes/SKILL.md` (skill)\n- `skills/playwright-test-results/SKILL.md` (skill)\n", "LICENSE": "                                 Apache License\r\n                           Version 2.0, January 2004\r\n                        http://www.apache.org/licenses/\r\n\r\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r\n\r\n   1. Definitions.\r\n\r\n      \"License\" shall mean the terms and conditions for use, reproduction,\r\n      and distribution as defined by Sections 1 through 9 of this document.\r\n\r\n      \"Licensor\" shall mean the copyright owner or entity authorized by\r\n      the copyright owner that is granting the License.\r\n\r\n      \"Legal Entity\" shall mean the union of the acting entity and all\r\n      other entities that control, are controlled by, or are under common\r\n      control with that entity. For the purposes of this definition,\r\n      \"control\" means (i) the power, direct or indirect, to cause the\r\n      direction or management of such entity, whether by contract or\r\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\r\n      outstanding shares, or (iii) beneficial ownership of such entity.\r\n\r\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\r\n      exercising permissions granted by this License.\r\n\r\n      \"Source\" form shall mean the preferred form for making modifications,\r\n      including but not limited to software source code, documentation\r\n      source, and configuration files.\r\n\r\n      \"Object\" form shall mean any form resulting from mechanical\r\n      transformation or translation of a Source form, including but\r\n      not limited to compiled object code, generated documentation,\r\n      and conversions to other media types.\r\n\r\n      \"Work\" shall mean the work of authorship, whether in Source or\r\n      Object form, made available under the License, as indicated by a\r\n      copyright notice that is included in or attached to the work\r\n      (an example is provided in the Appendix below).\r\n\r\n      \"Derivative Works\" shall mean any work, whether in Source or Object\r\n      form, that is based on (or derived from) the Work and for which the\r\n      editorial revisions, annotations, elaborations, or other modifications\r\n      represent, as a whole, an original work of authorship. For the purposes\r\n      of this License, Derivative Works shall not include works that remain\r\n      separable from, or merely link (or bind by name) to the interfaces of,\r\n      the Work and Derivative Works thereof.\r\n\r\n      \"Contribution\" shall mean any work of authorship, including\r\n      the original version of the Work and any modifications or additions\r\n      to that Work or Derivative Works thereof, that is intentionally\r\n      submitted to Licensor for inclusion in the Work by the copyright owner\r\n      or by an individual or Legal Entity authorized to submit on behalf of\r\n      the copyright owner. For the purposes of this definition, \"submitted\"\r\n      means any form of electronic, verbal, or written communication sent\r\n      to the Licensor or its representatives, including but not limited to\r\n      communication on electronic mailing lists, source code control systems,\r\n      and issue tracking systems that are managed by, or on behalf of, the\r\n      Licensor for the purpose of discussing and improving the Work, but\r\n      excluding communication that is conspicuously marked or otherwise\r\n      designated in writing by the copyright owner as \"Not a Contribution.\"\r\n\r\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\r\n      on behalf of whom a Contribution has been received by Licensor and\r\n      subsequently incorporated within the Work.\r\n\r\n   2. Grant of Copyright License. Subject to the terms and conditions of\r\n      this License, each Contributor hereby grants to You a perpetual,\r\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r\n      copyright license to reproduce, prepare Derivative Works of,\r\n      publicly display, publicly perform, sublicense, and distribute the\r\n      Work and such Derivative Works in Source or Object form.\r\n\r\n   3. Grant of Patent License. Subject to the terms and conditions of\r\n      this License, each Contributor hereby grants to You a perpetual,\r\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r\n      (except as stated in this section) patent license to make, have made,\r\n      use, offer to sell, sell, import, and otherwise transfer the Work,\r\n      where such license applies only to those patent claims licensable\r\n      by such Contributor that are necessarily infringed by their\r\n      Contribution(s) alone or by combination of their Contribution(s)\r\n      with the Work to which such Contribution(s) was submitted. If You\r\n      institute patent litigation against any entity (including a\r\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\r\n      or a Contribution incorporated within the Work constitutes direct\r\n      or contributory patent infringement, then any patent licenses\r\n      granted to You under this License for that Work shall terminate\r\n      as of the date such litigation is filed.\r\n\r\n   4. Redistribution. You may reproduce and distribute copies of the\r\n      Work or Derivative Works thereof in any medium, with or without\r\n      modifications, and in Source or Object form, provided that You\r\n      meet the following conditions:\r\n\r\n      (a) You must give any other recipients of the Work or\r\n          Derivative Works a copy of this License; and\r\n\r\n      (b) You must cause any modified files to carry prominent notices\r\n          stating that You changed the files; and\r\n\r\n      (c) You must retain, in the Source form of any Derivative Works\r\n          that You distribute, all copyright, patent, trademark, and\r\n          attribution notices from the Source form of the Work,\r\n          excluding those notices that do not pertain to any part of\r\n          the Derivative Works; and\r\n\r\n      (d) If the Work includes a \"NOTICE\" text file as part of its\r\n          distribution, then any Derivative Works that You distribute must\r\n          include a readable copy of the attribution notices contained\r\n          within such NOTICE file, excluding those notices that do not\r\n          pertain to any part of the Derivative Works, in at least one\r\n          of the following places: within a NOTICE text file distributed\r\n          as part of the Derivative Works; within the Source form or\r\n          documentation, if provided along with the Derivative Works; or,\r\n          within a display generated by the Derivative Works, if and\r\n          wherever such third-party notices normally appear. The contents\r\n          of the NOTICE file are for informational purposes only and\r\n          do not modify the License. You may add Your own attribution\r\n          notices within Derivative Works that You distribute, alongside\r\n          or as an addendum to the NOTICE text from the Work, provided\r\n          that such additional attribution notices cannot be construed\r\n          as modifying the License.\r\n\r\n      You may add Your own copyright statement to Your modifications and\r\n      may provide additional or different license terms and conditions\r\n      for use, reproduction, or distribution of Your modifications, or\r\n      for any such Derivative Works as a whole, provided Your use,\r\n      reproduction, and distribution of the Work otherwise complies with\r\n      the conditions stated in this License.\r\n\r\n   5. Submission of Contributions. Unless You explicitly state otherwise,\r\n      any Contribution intentionally submitted for inclusion in the Work\r\n      by You to the Licensor shall be under the terms and conditions of\r\n      this License, without any additional terms or conditions.\r\n      Notwithstanding the above, nothing herein shall supersede or modify\r\n      the terms of any separate license agreement you may have executed\r\n      with Licensor regarding such Contributions.\r\n\r\n   6. Trademarks. This License does not grant permission to use the trade\r\n      names, trademarks, service marks, or product names of the Licensor,\r\n      except as required for reasonable and customary use in describing the\r\n      origin of the Work and reproducing the content of the NOTICE file.\r\n\r\n   7. Disclaimer of Warranty. Unless required by applicable law or\r\n      agreed to in writing, Licensor provides the Work (and each\r\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\r\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r\n      implied, including, without limitation, any warranties or conditions\r\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r\n      PARTICULAR PURPOSE. You are solely responsible for determining the\r\n      appropriateness of using or redistributing the Work and assume any\r\n      risks associated with Your exercise of permissions under this License.\r\n\r\n   8. Limitation of Liability. In no event and under no legal theory,\r\n      whether in tort (including negligence), contract, or otherwise,\r\n      unless required by applicable law (such as deliberate and grossly\r\n      negligent acts) or agreed to in writing, shall any Contributor be\r\n      liable to You for damages, including any direct, indirect, special,\r\n      incidental, or consequential damages of any character arising as a\r\n      result of this License or out of the use or inability to use the\r\n      Work (including but not limited to damages for loss of goodwill,\r\n      work stoppage, computer failure or malfunction, or any and all\r\n      other commercial damages or losses), even if such Contributor\r\n      has been advised of the possibility of such damages.\r\n\r\n   9. Accepting Warranty or Additional Liability. While redistributing\r\n      the Work or Derivative Works thereof, You may choose to offer,\r\n      and charge a fee for, acceptance of support, warranty, indemnity,\r\n      or other liability obligations and/or rights consistent with this\r\n      License. However, in accepting such obligations, You may act only\r\n      on Your own behalf and on Your sole responsibility, not on behalf\r\n      of any other Contributor, and only if You agree to indemnify,\r\n      defend, and hold each Contributor harmless for any liability\r\n      incurred by, or claims asserted against, such Contributor by reason\r\n      of your accepting any such warranty or additional liability.\r\n\r\n   END OF TERMS AND CONDITIONS\r\n\r\n   APPENDIX: How to apply the Apache License to your work.\r\n\r\n      To apply the Apache License to your work, attach the following\r\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\r\n      replaced with your own identifying information. (Don't include\r\n      the brackets!)  The text should be enclosed in the appropriate\r\n      comment syntax for the file format. We also recommend that a\r\n      file or class name and description of purpose be included on the\r\n      same \"printed page\" as the copyright notice for easier\r\n      identification within third-party archives.\r\n\r\n   Portions Copyright (c) Microsoft Corporation.\r\n   Portions Copyright 2017 Google Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n", "NOTICE": "Playwright\nCopyright (c) Microsoft Corporation\n\nThis software contains code derived from the Puppeteer project (https://github.com/puppeteer/puppeteer),\navailable under the Apache 2.0 license (https://github.com/puppeteer/puppeteer/blob/master/LICENSE).\n", "harness.yaml": "$schema: https://harnessprotocol.io/schema/v1/harness.schema.json\nversion: '1'\nkind: profile\nmetadata:\n  name: playwright\n  description: 'The Playwright repository''s agent skills: API review, release notes, Chromium bisects and test results.'\n  version: 0.1.0\n  license: Apache-2.0\nskills:\n- name: api-review\n  source: ./skills/api-review\n- name: playwright-audit-deps\n  source: ./skills/playwright-audit-deps\n- name: playwright-bisect-chromium\n  source: ./skills/playwright-bisect-chromium\n- name: playwright-dev\n  source: ./skills/playwright-dev\n- name: playwright-devops\n  source: ./skills/playwright-devops\n- name: playwright-release-notes\n  source: ./skills/playwright-release-notes\n- name: playwright-test-results\n  source: ./skills/playwright-test-results\nx-origin:\n  repository: https://github.com/microsoft/playwright\n  commit: a804c193562095b0da20e5d4679fa87e4c8e5563\n  license: Apache-2.0\n  license_basis: detected\n  license_files:\n  - LICENSE\n  - NOTICE\n  absorbed_at: '2026-11-27'\n", "skills/api-review/SKILL.md": "---\nname: api-review\ndescription: Produce the \"Playwright 1.xx API Review\" artifact for a range of commits - the public API additions and the breaking or behavior changes that affect existing users since the last API review or since the last release, ordered by impact, each with links, before/after snippets and a documentation check. Covers microsoft/playwright (Node.js) and the Python, Java and .NET ports. Use when asked for an API review, to review API changes, or to check what changed in the public API since a release or since the last review.\nuser_invocable: true\n---\n\n# API review\n\n`/api-review [python|java|dotnet] [range]`\n\nWithout a language, review microsoft/playwright (the Node.js package, the test runner, MCP and the CLI).\nWith a language, review that port: see \"Language ports\" at the end, which changes the range, the\nsources and the composition; everything else applies as written.\n\nProduce one artifact (an HTML page published with the Artifact tool) that a maintainer reads before a\nrelease. It lists the changes in the range that **change the public API or affect existing users**,\nordered by impact, and checks that each one is documented. The reviewer types feedback into the page\nand copies a GitHub issue draft from it.\n\nThe review is not a changelog. A change is in because a user has to learn a new API, or because an\nexisting test suite may start behaving differently. A fix that makes Playwright more correct in a\ncorner case is not in, even though some user somewhere will notice it.\n\nWork in the current checkout only. Do not commit anything.\n\n## 1. Choose the range\n\nIn order of preference:\n\n1. **Explicit range** from the argument, for example `v1.64.0..main` or `abc1234..main`.\n2. **Since the last API review.** List the user's artifacts (`Artifact` tool, `action: \"list\"`) and\n   take the newest one titled `Playwright 1.xx API Review`. Read it; the `.meta` line records\n   `Range: <base>..main (<n> commits, head <sha>)`. The new range is `<sha>..main`. Use this when the\n   user says \"since the last review\" or when a review for the current version already exists.\n3. **Since the last release.** `git fetch --tags`, then the newest `v1.xx.0` tag\n   (`git tag --sort=-creatordate | grep -v beta | head`). The range is `v1.xx.0..main`.\n   Point releases cherry-pick from main: list `git log --oneline v1.xx.0..v1.xx.y` and exclude those\n   PR numbers, since they are already released. Say so in the `.meta` line.\n\nRead the version under review from `package.json` (`1.65.0-next` means `1.65`).\n\n## 2. Collect candidates\n\nRun these and keep a list of candidate commits with their PR numbers. Run independent commands in parallel.\n\n- `git log --oneline --no-merges <range>`, dropping `chore(deps`, browser rolls, `devops(`, and\n  `test(` commits. Everything else is a candidate until it is ruled out.\n- `grep -rn -B3 \"since: v1.xx\" docs/src/` for new API entries.\n- `git diff --stat <range> -- docs/src` and then the content diff of `docs/src/test-api`,\n  `docs/src/test-reporter-api`, the changed guides (`docs/src/*-js.md`, `docs/src/*.md`) and the\n  changed `docs/src/api/class-*.md`. Filter out type-rendering noise (lines that start with\n  `- type:` or `` - `name` ``) to find real text changes.\n- Public types: `git diff <range> -- packages/playwright/types/test.d.ts\n  packages/playwright/types/testReporter.d.ts packages/playwright-core/types/types.d.ts`, keeping\n  only non-comment added or removed lines.\n- CLI and MCP options: diff of `packages/playwright/src/program.ts`,\n  `packages/playwright-core/src/tools/cli-daemon/commands.ts`,\n  `packages/playwright-core/src/tools/mcp/program.ts` and `packages/playwright-core/src/tools/mcp/config.d.ts`.\n- Environment variables: grep the range diff for added `process.env.PLAYWRIGHT_` and `PW_` names.\n- Reverts: a `Revert \"...\"` commit of a change that shipped in the last release is a breaking change\n  against that release. Check with `git merge-base --is-ancestor <original sha> v1.xx.0`.\n\nFor each candidate, get the PR body and linked issues in one loop:\n`gh pr view <n> --repo microsoft/playwright --json title,body,closingIssuesReferences`. Squashed\ncommit messages have no bodies; the PR body is where the rationale and the issue links are. Then\n`git show --stat <sha> -- docs` tells which docs the PR touched.\n\n## 3. Decide what is in\n\nTwo questions decide it. Does the change add, remove or rename something in the public API? Does it\nchange what existing user tests do, broadly enough that a maintainer would list it under \"Breaking\nChanges\" in the release notes? One yes is enough. Two noes and the change is out, however visible.\n\n**Include:**\n\n- New public API: classes, methods, options, events, test and config options, fixtures, reporters\n  and reporter options, CLI flags and commands, documented environment variables, MCP tools, tool\n  parameters, MCP config and flags, `playwright-cli` commands and options.\n- Breaking changes: functionality removed or renamed, defaults changed, a documented behavior changed\n  so that existing user tests can fail or pass differently. Reverts of behavior that shipped in the\n  last release count, even when the revert restores older behavior.\n- Behavior changes that are not bug fixes: a stricter check, a new exit code, a new wait, a changed\n  output location or format that other tools read.\n- A bug fix only when it clears the impact bar: a common pattern in existing tests changes outcome,\n  for example a passing action now waits and times out, a throwing action now succeeds, or a CI run\n  exits with a different code. Corrections in corner cases do not clear the bar, even when they\n  change observable behavior: cookie matching rules for subdomains, which credentials answer which\n  auth challenge, encoding details, internal browser implementation swaps with an escape hatch.\n\n**Exclude**, and list in \"Examined and not included\" with the reason:\n\n- Bug fixes that restore documented or intended behavior, including regression fixes and fixes that\n  align one browser with the others, and bug fixes that do not clear the impact bar above.\n- Changes added and removed within the same range.\n- Protocol or `LocalUtils` additions that only language ports use; note which port must act.\n- Internal removals that were never in the previous release's public types or docs. Check with\n  `git show v1.xx.0:packages/playwright/types/testReporter.d.ts | grep <name>`.\n- Docs-only commits, refactors, test infrastructure. Mention a docs-only commit only when it changes\n  `since:` markers for other languages.\n\nWhen unsure, ask: would a typical existing test suite notice, and would a user need to change code\nor config? If yes to either, include it as \"Behavior\". If the honest answer is \"only a test that\ndepends on this exact edge case\", exclude it and name it in \"Examined and not included\". Security\nhardening with no API surface is excluded. Prefer a shorter review with every item worth a decision\nover a complete one.\n\n## 3a. Order by impact\n\nItems are ordered by impact, most impactful first, in the summary table and on the page. No grouping\nby area. Use these tiers, then order within a tier by how many users hit it: library and test runner\nbefore MCP and CLI, changes that happen without opting in before opt-in features.\n\n1. Breaking changes users meet at runtime with no compiler or lint hint: removed or renamed API,\n   changed defaults, actionability or locator semantics that change which elements match or whether\n   an action proceeds.\n2. Behavior shipped in the last release that is reverted or changed again, and behavior changes that\n   change a CI exit code or a report's contents.\n3. Other behavior changes that can flip a test from failing to passing or the reverse.\n4. New API most users will adopt: test runner options, library methods and options.\n5. New options and flags with a narrow audience: CLI flags, MCP config, environment variables.\n\nA bug fix that clears the impact bar sits in tier 2 or 3, never above a breaking change.\n\n## 4. Check the documentation\n\nFor each included item, find the pages on `https://playwright.dev/docs/next/`:\n\n| Source | URL |\n|---|---|\n| `docs/src/<page>-js.md`, `docs/src/<page>.md` | `/docs/next/<page>` |\n| `docs/src/api/class-<x>.md` | `/docs/next/api/class-<x>#<class>-<method>` (kebab-case, options as `#<class>-<method>-option-<name>`) |\n| `docs/src/test-api/class-<x>.md`, `docs/src/test-reporter-api/class-<x>.md` | `/docs/next/api/class-<x>` |\n| `packages/playwright-core/src/tools/skills/playwright-cli/` | `https://playwright.dev/agent-cli/introduction`, the CLI skill reference |\n| MCP flags, tools and config | README in `microsoft/playwright-mcp`, regenerated at release by `update-readme.js`; fetch it with `gh api repos/microsoft/playwright-mcp/contents/README.md --jq .content \\| base64 -d` and `config.d.ts` doc comments |\n\nGrep the docs for the new name. Heading anchors come from `## method:` and `### option:` lines and from\nguide headings (`### Report only failures` is `#report-only-failures`).\n\nAlso check `docs/src/release-notes-js.md`: if there is no `## Version 1.xx` section yet, say so in the\nnote at the top and mark every Breaking and Behavior item as needing a release-notes line.\n\nDocs status vocabulary, one badge per item:\n\n| Badge | Class | Meaning |\n|---|---|---|\n| OK | `b-ok` | Reference and guide cover the change |\n| Partial | `b-partial` | Covered in one place, missing in another that users will read |\n| Needs notes | `b-partial` | Docs are fine, the release notes must flag it (breaking) |\n| README stale | `b-partial` | Documented in `config.d.ts` or tool schema, README regenerates at release |\n| None | `b-partial` | Nothing documented and nothing needed |\n| Internal | `b-partial` | Deliberately undocumented escape hatch |\n| Missing | `b-missing` | Users will look for it and not find it |\n\nThe \"Docs status\" sentence becomes the `- [ ] Docs:` task in the issue draft for every badge except\nOK and None, so write it as an instruction: what to add and on which page.\n\n## 5. Write the page\n\nCopy `template.html` from this skill's directory into the scratchpad as `api-review-1.xx.html` and fill\nit. Keep the CSS, the class names and the script unchanged: the issue-draft generator reads\n`header .num`, `h3`, the `Links` and `Docs status` fields and the feedback textarea of each\n`section.card`.\n\n- Replace every `{{PLACEHOLDER}}`. Delete the sample card, sample rows and sample excluded entry.\n- Order items by impact (step 3a). Number them `c1`, `c2`, ... in that order; the summary table has\n  the same order and links to them, and the numbers must match. The `Area` column in the table\n  (Library, Test runner, MCP, CLI) replaces grouping.\n- Keep the MCP README note under the \"Changes\" heading only when the review has MCP or CLI items.\n- Kind badges: `New API`, `New option` (`b-new`); `Breaking`, `Breaking vs 1.xx` (`b-breaking`);\n  `Behavior` (`b-behavior`). An item can carry two.\n- Description: two to five sentences in plain language. Name the escape hatch if there is one. Note\n  when the PR title and the shipped name differ.\n- Links: PR, linked issues, the original and revert PRs for relands and reverts, earlier attempts\n  when the PR lists them. Issues in other repos (`playwright-mcp`, `playwright-cli`, `playwright-java`)\n  are linked with the repo name.\n- Before and after: real test, config or CLI snippets, three to eight lines each. Omit \"Before\" when\n  there was no way to do it before; keep \"After\". For a behavior change, show the same code with the\n  old and new outcome as a comment.\n- Only state what you verified. Check which browsers a change touched with `git show --stat` before\n  naming them. Do not quote a version number you did not look up.\n- Escape `<`, `>` and `&` as `&lt;`, `&gt;` and `&amp;` in every snippet, title and description.\n  Snippets often contain HTML such as `<button>` or `<dialog>`; unescaped, the browser renders it as\n  real elements inside the page. After writing the file, check with\n  `grep -n '<pre><code>' <file> | grep -v '&lt;'` and read the `<pre>` blocks for raw tags.\n\nPut the one-line summary of the whole review in the top `.note`: release notes state, which items\nneed a breaking callout.\n\n## 6. Publish and report\n\nPublish with the Artifact tool (first publish: `icon: \"review\"`, a one-sentence `description`).\nA later review for the same version is a new artifact; do not overwrite the previous one, the\nreviewer's feedback lives in their browser against that page.\n\nIn the reply, give the link, the range, how many items, and the two or three items that need a\ndecision (breaking changes, reverts of shipped behavior, missing docs). Do not repeat the page.\n\n## Language ports: Python, Java and .NET\n\nA port review covers two streams: the port's own repository, and the core changes that reach the\nport through its driver. The port repositories are not checked out; read them with `gh`.\n\n| Port | Repository | Package docs | Release notes | Driver pin |\n|---|---|---|---|---|\n| Python | `microsoft/playwright-python` | `https://playwright.dev/python/docs/` | `docs/src/release-notes-python.md` | `DRIVER_VERSION` (a microsoft/playwright commit) |\n| Java | `microsoft/playwright-java` | `https://playwright.dev/java/docs/` | `docs/src/release-notes-java.md` | search the repo for the driver version file |\n| .NET | `microsoft/playwright-dotnet` | `https://playwright.dev/dotnet/docs/` | `docs/src/release-notes-csharp.md` | search the repo for the driver version file |\n\n**Range.** Tags are `v1.xx.y` in every port. \"Since the last release\" is `v1.xx.0...main` in the\nport repository; exclude the commits of `v1.xx.0...v1.xx.y` point releases. \"Since the last review\"\nreads the head from the previous port review artifact, as for core. The driver stream is the core\nrange from the driver commit the port shipped with to the driver commit at the port's head; the roll\nPRs (`chore: roll Playwright to ...`) name both commits. State both ranges in the `.meta` line.\n\n```bash\ngh api repos/microsoft/playwright-python/tags --jq '.[0:6][].name'\ngh api \"repos/microsoft/playwright-python/compare/v1.xx.0...main\" --paginate \\\n  --jq '.commits[] | .sha[0:9] + \" \" + (.commit.message | split(\"\\n\")[0])'\ngh pr view <n> --repo microsoft/playwright-python --json title,body,closingIssuesReferences\ngh api -H \"Accept: application/vnd.github.raw\" \"repos/microsoft/playwright-python/contents/<path>?ref=<tag or main>\"\n```\n\n**Port stream.** Candidates are the port's own PRs: fixes to the generated API (`fix(assertions): ...`),\npackaging and distribution (wheels, sdist, Maven artifacts, NuGet packages, bundled Node.js),\nsupported runtimes (`requires-python` and classifiers in `pyproject.toml`, Java versions in `pom.xml`,\ntarget frameworks in the `.csproj`), dependencies, client rewrites and error messages. Compare the\nbuild files and the README between the two tags with the raw contents API. A client rewrite is in even\nwhen the public API is unchanged: say what private module paths and observable behaviors changed,\nsince users import private modules. Roll PRs are not items themselves, but their bodies say whether\n\"API comparison\" produced changes and list the upstream commits; read them.\n\n**Driver stream.** Take the library items from the core review of the same version when one exists\n(link its artifact) and keep only those that apply to the port: entries whose docs carry `* langs: js`\nare out, entries with no `langs` line or with the port's language are in. The test runner, UI mode,\nthe HTML report, MCP and `playwright-cli` do not ship with the ports; leave them out and say so in the\nexcluded list. Verify that the port's generated API has the new member before listing it as new API:\ngrep the port's generated source, for example `playwright/sync_api/_generated.py` for Python, because\na roll can lag the docs. Write the snippets in the port's language and link the port's docs pages.\nWhen no core review exists for the version, run steps 2 to 4 on the core range of the driver stream\nfirst.\n\n**Docs for a port.** The reference is shared with core and rendered per language, so an API entry is\ndocumented when the core docs have it without a `* langs:` line that excludes the language. Entries\nmarked `* langs: python` (or `java`, `csharp`) are language-specific signatures; a docs-only PR that\nadds them is excluded but worth one line in \"Examined and not included\". Port-specific guides are\n`docs/src/intro-<lang>.md`, `docs/src/library-<lang>.md` and `docs/src/test-runners-<lang>.md`; the\nport README covers installation and browser versions.\n\n**Composition.** Title the page `Playwright <Language> 1.xx API Review`. The `Area` column takes\n`Client`, `Packaging`, `Library` and `Docs` instead of the core areas. Core library items get a shorter\ndescription with a link to the core review item, the port-language snippet and the port docs link.\nOrder by impact as in step 3a; a client rewrite that changes private module paths or error behavior\nis tier 1 or 2 depending on whether code must change.\n", "skills/api-review/template.html": "<title>Playwright {{VERSION}} API Review</title>\n<meta name=\"claude:viewport-fit-sides\" content=\"cover\">\n<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap\">\n<style>\n/* Layout: one reading column, summary table first, then one card per change, grouped by area. */\n:root {\n  --bg: #f7f8f6;\n  --surface: #ffffff;\n  --fg: #1c2420;\n  --muted: #5c6a63;\n  --line: #d9e0db;\n  --accent: #1f8a3b;\n  --accent-soft: #e4f3e8;\n  --code-bg: #eef2ef;\n  --ok: #1f8a3b; --ok-bg: #e4f3e8;\n  --warn: #9a6400; --warn-bg: #fbf0d6;\n  --bad: #b3261e; --bad-bg: #fbe3e1;\n  --new: #1d5fa8; --new-bg: #e2ecf8;\n  --font-body: \"IBM Plex Sans\", system-ui, -apple-system, \"Segoe UI\", sans-serif;\n  --font-mono: \"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, monospace;\n}\n@media (prefers-color-scheme: dark) {\n  :root:not([data-theme=\"light\"]) {\n    --bg: #141917; --surface: #1c2320; --fg: #e6ebe7; --muted: #9aa8a0; --line: #2f3a34;\n    --accent: #5cc46f; --accent-soft: #1f3326; --code-bg: #232c27;\n    --ok: #5cc46f; --ok-bg: #1f3326; --warn: #e5b45a; --warn-bg: #3a2f14; --bad: #f08a82; --bad-bg: #3d1f1c;\n    --new: #7fb2ee; --new-bg: #1b2b40;\n    color-scheme: dark;\n  }\n}\n:root[data-theme=\"dark\"] {\n  --bg: #141917; --surface: #1c2320; --fg: #e6ebe7; --muted: #9aa8a0; --line: #2f3a34;\n  --accent: #5cc46f; --accent-soft: #1f3326; --code-bg: #232c27;\n  --ok: #5cc46f; --ok-bg: #1f3326; --warn: #e5b45a; --warn-bg: #3a2f14; --bad: #f08a82; --bad-bg: #3d1f1c;\n  --new: #7fb2ee; --new-bg: #1b2b40;\n  color-scheme: dark;\n}\nbody { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 15px; line-height: 1.55;\n  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 32px 64px; }\nmain { max-width: 900px; margin: 0 auto; }\nh1 { font-size: 2rem; font-weight: 600; line-height: 1.15; margin: 0 0 6px; text-wrap: balance; }\nh2 { font-size: 1.35rem; font-weight: 600; margin: 48px 0 16px; padding-bottom: 8px; border-bottom: 2px solid var(--line); text-wrap: balance; }\nh3 { font-size: 1.08rem; font-weight: 600; margin: 0; line-height: 1.3; text-wrap: balance; }\np { margin: 0 0 10px; }\na { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }\na:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }\n.lede { color: var(--muted); margin-bottom: 20px; }\n.meta { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 0.9rem; color: var(--muted); margin-bottom: 28px; }\n.meta code { font-size: 0.85rem; }\ncode { font-family: var(--font-mono); font-size: 0.88em; background: var(--code-bg); padding: 1px 5px; border-radius: 3px; }\npre { font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.5; background: var(--code-bg); padding: 12px 14px; border-radius: 6px; overflow-x: auto; margin: 0; }\npre code { background: none; padding: 0; font-size: inherit; }\n.note { border-left: 3px solid var(--warn); background: var(--warn-bg); padding: 10px 14px; border-radius: 0 6px 6px 0; margin: 0 0 24px; }\n.note.ok { border-color: var(--ok); background: var(--ok-bg); }\n\n/* summary table */\n.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }\ntable { border-collapse: collapse; width: 100%; font-size: 0.9rem; }\nth, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }\nth { font-weight: 600; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }\ntr:last-child td { border-bottom: 0; }\ntd.num { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }\ntbody tr.group td { background: var(--code-bg); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 6px 12px; }\n\n/* badges */\n.badge { display: inline-block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.5; }\n.b-new { color: var(--new); background: var(--new-bg); }\n.b-breaking { color: var(--bad); background: var(--bad-bg); }\n.b-behavior { color: var(--warn); background: var(--warn-bg); }\n.b-ok { color: var(--ok); background: var(--ok-bg); }\n.b-partial { color: var(--warn); background: var(--warn-bg); }\n.b-missing { color: var(--bad); background: var(--bad-bg); }\n\n/* change cards */\n.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; margin: 0 0 18px; }\n.card header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin-bottom: 10px; }\n.card header .num { font-family: var(--font-mono); color: var(--muted); font-size: 0.9rem; }\n.card header .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }\n.field { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 16px; margin-top: 12px; }\n.field > dt { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }\n.field > dd { margin: 0; min-width: 0; }\n.field ul { margin: 0; padding-left: 18px; }\n.field li { margin-bottom: 3px; }\n.ba { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 12px; }\n.ba > div { min-width: 0; }\n.ba .lbl { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }\n.docs-status { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }\n.docs-status p { margin: 0; }\n.excluded li { margin-bottom: 8px; }\n.excluded span.why { color: var(--muted); }\n\n/* feedback and issue draft */\n.feedback { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }\n.feedback label, .draft .lbl { display: block; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }\ntextarea { width: 100%; box-sizing: border-box; font-family: var(--font-body); font-size: 0.92rem; line-height: 1.5; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; resize: vertical; }\ntextarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }\n#draft-preview { font-family: var(--font-mono); font-size: 0.8rem; background: var(--code-bg); }\n.draft { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; }\n.draft-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 14px; }\nbutton { font: inherit; font-weight: 600; color: #fff; background: var(--accent); border: 0; border-radius: 6px; padding: 8px 16px; cursor: pointer; }\nbutton:hover { filter: brightness(1.08); }\nbutton:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }\n.check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; color: var(--muted); }\n#copy-status { font-size: 0.9rem; color: var(--muted); }\n@media (max-width: 560px) {\n  .field { grid-template-columns: 1fr; gap: 2px; }\n  .field > dt { margin-top: 10px; }\n  .card header .badges { margin-left: 0; }\n  body { font-size: 14.5px; }\n}\n@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }\n</style>\n\n<!--\n  Template for the api-review skill. Replace every {{PLACEHOLDER}}, the sample summary rows,\n  the sample card and the sample excluded entry. Keep the structure, class names and the script:\n  the issue-draft generator reads header .num, h3, the \"Links\" and \"Docs status\" fields and the textarea.\n-->\n<main>\n<h1>Playwright {{VERSION}} API Review</h1>\n<p class=\"lede\">Public API additions, breaking changes and notable behavior changes on <code>main</code> since {{BASE_DESCRIPTION}}, with the state of their documentation on playwright.dev/docs/next.</p>\n<div class=\"meta\">\n  <span>Range: <code>{{RANGE}}</code> ({{COMMITS}} commits, head <code>{{HEAD}}</code>)</span>\n  <span>Snapshot: {{DATE}}</span>\n  <span>{{EXCLUDED_NOTE}}</span>\n</div>\n\n<div class=\"note\">\n  <strong>{{RELEASE_NOTES_STATE}}</strong> {{RELEASE_NOTES_ADVICE}} Type feedback into any item and use the button at the end to copy a GitHub issue draft.\n</div>\n\n<h2 id=\"summary\">Summary</h2>\n<div class=\"tablewrap\">\n<table>\n  <thead><tr><th>#</th><th>Change</th><th>Area</th><th>Kind</th><th>Docs</th></tr></thead>\n  <tbody>\n    <!-- one row per item, ordered by impact, most impactful first (SKILL.md step 3a).\n         Area: Library, Test runner, MCP, CLI.\n         kind badge classes: b-breaking (Breaking, Breaking vs 1.xx), b-behavior (Behavior), b-new (New API, New option);\n         docs badge classes: b-ok (OK), b-partial (Partial, Needs notes, README stale, None, Internal), b-missing (Missing) -->\n    <tr><td class=\"num\">1</td><td><a href=\"#c1\">{{ITEM_TITLE}}</a></td><td>{{AREA}}</td><td><span class=\"badge b-breaking\">Breaking</span></td><td><span class=\"badge b-partial\">Needs notes</span></td></tr>\n  </tbody>\n</table>\n</div>\n\n<h2 id=\"changes\">Changes</h2>\n<p class=\"lede\">Ordered by impact, most impactful first. The MCP README on github.com/microsoft/playwright-mcp is generated by <code>update-readme.js</code> at release time; entries marked \"README stale\" are documented in <code>config.d.ts</code> or tool schemas and should appear after regeneration. Verify at release.</p>\n\n<section class=\"card\" id=\"c1\">\n  <header><span class=\"num\">1</span><h3>{{ITEM_TITLE}}</h3><span class=\"badges\"><span class=\"badge b-breaking\">Breaking</span></span></header>\n  <p>{{WHAT_CHANGES: two to five sentences. What is new or different, who is affected, any escape hatch or opt-out, anything surprising such as a PR title that does not match the shipped name.}}</p>\n  <dl class=\"field\">\n    <dt>Links</dt><dd><a href=\"https://github.com/microsoft/playwright/pull/{{PR}}\">PR #{{PR}}</a> · <a href=\"https://github.com/microsoft/playwright/issues/{{ISSUE}}\">Issue #{{ISSUE}}</a></dd>\n  </dl>\n  <div class=\"ba\">\n    <div><div class=\"lbl\">Before</div><pre><code>{{BEFORE_SNIPPET: test code, config or CLI; omit this div when there is no \"before\"}}</code></pre></div>\n    <div><div class=\"lbl\">After</div><pre><code>{{AFTER_SNIPPET}}</code></pre></div>\n  </div>\n  <dl class=\"field\">\n    <dt>Docs</dt><dd><ul>\n      <li><a href=\"https://playwright.dev/docs/next/{{PAGE}}#{{ANCHOR}}\">{{page: Section}}</a></li>\n    </ul></dd>\n    <dt>Docs status</dt><dd class=\"docs-status\"><span class=\"badge b-partial\">Needs notes</span><p>{{DOCS_VERDICT: one or two sentences. For anything other than OK, say exactly what is missing and where it should go; this sentence becomes the \"- [ ] Docs:\" task in the issue draft.}}</p></dd>\n  </dl>\n  <div class=\"feedback\"><label for=\"fb-c1\">Review feedback</label><textarea id=\"fb-c1\" rows=\"3\" placeholder=\"Decision, requested doc change, or follow-up for this item\"></textarea></div>\n</section>\n\n<h2 id=\"excluded\">Examined and not included</h2>\n<p class=\"lede\">Commits that looked like API or behavior changes but do not qualify under the review criteria, with the reason.</p>\n<ul class=\"excluded\">\n  <li><a href=\"https://github.com/microsoft/playwright/pull/{{PR}}\">#{{PR}}</a> {{short title}}. <span class=\"why\">{{reason: bug fix restoring intended behavior / regression fix / internal protocol for language ports / docs only / added and removed within the range}}</span></li>\n</ul>\n\n<h2 id=\"issue-draft\">Issue draft</h2>\n<p class=\"lede\">Copies a markdown draft titled \"API review items\": each item's title and links, your feedback verbatim, and a task for items whose docs are missing or incomplete. Feedback is kept in this browser only.</p>\n<div class=\"draft\">\n  <div class=\"draft-controls\">\n    <button type=\"button\" id=\"copy-draft\">Copy issue draft</button>\n    <label class=\"check\"><input type=\"checkbox\" id=\"include-all\"> Include items without feedback</label>\n    <span id=\"copy-status\" role=\"status\" aria-live=\"polite\"></span>\n  </div>\n  <label for=\"draft-preview\" class=\"lbl\">Preview (select and copy by hand if the clipboard is blocked)</label>\n  <textarea id=\"draft-preview\" rows=\"14\" readonly spellcheck=\"false\"></textarea>\n</div>\n</main>\n<script>\n(function () {\n  var KEY = 'pw-api-review-{{VERSION}}-feedback';\n  var saved = {};\n  try { saved = JSON.parse(localStorage.getItem(KEY) || '{}') || {}; } catch (e) { saved = {}; }\n  var cards = Array.prototype.slice.call(document.querySelectorAll('section.card'));\n  cards.forEach(function (card) {\n    var ta = card.querySelector('textarea');\n    if (saved[card.id]) ta.value = saved[card.id];\n    ta.addEventListener('input', function () {\n      saved[card.id] = ta.value;\n      try { localStorage.setItem(KEY, JSON.stringify(saved)); } catch (e) {}\n      render();\n    });\n  });\n  var includeAll = document.getElementById('include-all');\n  var preview = document.getElementById('draft-preview');\n  var status = document.getElementById('copy-status');\n\n  function fieldDd(card, name) {\n    var dts = card.querySelectorAll('dl.field dt');\n    for (var i = 0; i < dts.length; i++)\n      if (dts[i].textContent.trim() === name) return dts[i].nextElementSibling;\n    return null;\n  }\n  function build() {\n    var withFeedback = cards.filter(function (c) { return c.querySelector('textarea').value.trim(); });\n    var picked = includeAll.checked || !withFeedback.length ? cards : withFeedback;\n    var lines = ['# API review items', '',\n      'Playwright {{VERSION}} API review, range `{{RANGE}}` (head `{{HEAD}}`), snapshot {{DATE}}.', ''];\n    picked.forEach(function (card) {\n      var num = card.querySelector('header .num').textContent.trim();\n      var title = card.querySelector('h3').textContent.trim();\n      var linksDd = fieldDd(card, 'Links');\n      var links = linksDd ? Array.prototype.map.call(linksDd.querySelectorAll('a'), function (a) {\n        return '[' + a.textContent.trim() + '](' + a.href + ')'; }).join(', ') : '';\n      var docsDd = fieldDd(card, 'Docs status');\n      var badge = docsDd && docsDd.querySelector('.badge') ? docsDd.querySelector('.badge').textContent.trim() : '';\n      var docsText = docsDd && docsDd.querySelector('p') ? docsDd.querySelector('p').textContent.trim() : '';\n      var feedback = card.querySelector('textarea').value.trim();\n      lines.push('## ' + num + '. ' + title);\n      if (links) lines.push(links);\n      lines.push('');\n      if (feedback) lines.push(feedback, '');\n      if (badge && badge !== 'OK' && badge !== 'None' && docsText) lines.push('- [ ] Docs: ' + docsText, '');\n    });\n    return { text: lines.join('\\n'), count: picked.length, all: picked === cards && !includeAll.checked && !withFeedback.length };\n  }\n  function render() { preview.value = build().text; }\n  includeAll.addEventListener('change', render);\n  document.getElementById('copy-draft').addEventListener('click', function () {\n    var r = build();\n    preview.value = r.text;\n    var note = r.all ? ' (no feedback entered yet, so all items are included)' : '';\n    function fallback() {\n      preview.focus(); preview.select();\n      status.textContent = 'Clipboard blocked. The draft is selected below, press Ctrl/Cmd+C.';\n    }\n    if (navigator.clipboard && navigator.clipboard.writeText) {\n      navigator.clipboard.writeText(r.text).then(function () {\n        status.textContent = 'Copied ' + r.count + ' item' + (r.count === 1 ? '' : 's') + ' to the clipboard' + note + '.';\n      }, fallback);\n    } else fallback();\n  });\n  render();\n})();\n</script>\n", "skills/playwright-audit-deps/SKILL.md": "---\nname: playwright-audit-deps\ndescription: Roll the runtime dependencies that npm audit flags with a moderate or higher advisory to safe versions that are at least 8 days old, and commit them with a table of every package the lock file change touched (old and new version, publish date, weekly downloads). Use when asked to fix audit findings, bump vulnerable or outdated runtime dependencies, or update package-lock.json for an advisory.\nuser_invocable: true\n---\n\n# Roll runtime dependencies flagged by npm audit\n\n`/playwright-audit-deps [issue url]`\n\nA runtime dependency is a package whose code ends up in a published Playwright package: it is\ninlined into a bundle (listed in a `packages/*/lib/**/*.js.txt` sidecar) or named in the\n`dependencies` of a `packages/*/package.json`. Advisories on dev-only packages, such as eslint\nplugins or chromium-bidi, are reported as skipped and left alone.\n\nA version is eligible when it is outside every advisory range, was published at least 8 days\nago, and is accepted by every runtime dependent in `package-lock.json`. The newest eligible\nversion wins. Packages that `npm install` pulls in beyond that age are pinned back the same way.\n\nThe lint `npm run check-dependency-age` (part of `npm run lint` and `npm run flint`, so CI\nruns it on every PR) fails when any version in `package-lock.json` is less than 7 days old.\nThe 8-day default here keeps a one-day margin above that limit.\n\n## Steps\n\n1. Start from a clean checkout of `main` with `npm run build` done, so the bundle sidecars\n   exist. Create the branch: `fix-<issue number>` when an issue is given, else `bump-runtime-deps`.\n\n2. Plan: `node .claude/skills/playwright-audit-deps/audit-deps.mjs`. It prints, per runtime\n   advisory, the version it would roll to, or why it cannot (no fixed version, fixed version too\n   new, a runtime dependent rejects it, or a major bump of a package pinned in `package.json`).\n\n3. Apply: `node .claude/skills/playwright-audit-deps/audit-deps.mjs --apply --report=<scratchpad>/deps-report.md`.\n   Pass `--allow-major` only when the user asked for a major bump; otherwise leave those\n   packages in the \"Not rolled\" list and tell the user. Options: `--max-age-days=N` (default 8),\n   `--severity=low|moderate|high|critical` (default moderate), `--base=<ref>` for the report diff.\n\n4. Verify: `npm run build`, then `npm run itest tests/installation/bundle-licenses.spec.ts tests/installation/bundle-size.spec.ts`\n   and `npm run check-dependency-age`. A new dependency without a `repository` field, a bigger\n   bundle, or a version younger than 7 days fails here. Fix the cause or drop that roll, then\n   rerun the report.\n\n5. Commit `package.json` and `package-lock.json` as one commit:\n\n   ```\n   chore(deps): bump runtime deps\n\n   <the markdown table and the \"Not rolled\" list from the report>\n\n   Fixes: <issue url, when given>\n   ```\n\n6. Report the table and the not-rolled packages to the user. **Never push.** When told to open\n   the PR, use the same title and a body of one bullet naming the packages rolled for an\n   advisory, the table, and the `Fixes` line.\n\n## Notes\n\n- `npm audit` lists a package that only depends on a vulnerable one (chromium-bidi via zod)\n  as its own finding; the script follows the actual advisory, so such entries are not acted on.\n- A root-pinned package is bumped with `npm install <name>@<version> --save-exact`. Any other\n  package is rewritten in place in `package-lock.json` and reconciled with `npm install`. The\n  script fails if `npm ls` reports a problem afterwards.\n- Run the apply step once from the clean base; a second run labels the already rolled packages\n  as plain dependencies in the \"Reason\" column, because the audit no longer flags them.\n", "skills/playwright-audit-deps/audit-deps.mjs": "#!/usr/bin/env node\n// Finds runtime dependencies that `npm audit` flags with a moderate or higher\n// advisory, picks for each the newest safe version that was published at least\n// --max-age-days ago and that every dependent in package-lock.json accepts, and\n// (with --apply) rolls the lock file to it. Prints a markdown report of every\n// package the lock file change touched, with publish date and weekly downloads.\n//\n//   node .claude/skills/playwright-audit-deps/audit-deps.mjs            # plan only\n//   node .claude/skills/playwright-audit-deps/audit-deps.mjs --apply    # change package.json / package-lock.json\n//\n// Options:\n//   --max-age-days=N   only pick versions published at least N days ago (default 8)\n//   --base=REF         git ref to diff package-lock.json against for the report (default HEAD)\n//   --allow-major      also roll root-pinned packages across a major version\n//   --report=FILE      also write the markdown report to FILE\n//   --severity=LEVEL   lowest severity to act on: low, moderate, high, critical (default moderate)\n//   --urgent-severity=LEVEL  advisories of this severity or above do not wait for --max-age-days:\n//                      when no version that is old enough fixes them, the oldest fixed version is picked\n//   --all              also act on packages that are not in a runtime bundle; needs no build\n\nimport { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { createRequire } from 'node:module';\n\nconst root = process.cwd();\nconst semver = createRequire(path.join(root, 'package.json'))('semver');\n\nconst args = Object.fromEntries(process.argv.slice(2).map(a => {\n  const m = a.match(/^--([^=]+)(?:=(.*))?$/);\n  return m ? [m[1], m[2] ?? true] : [a, true];\n}));\nconst apply = !!args.apply;\nconst maxAgeDays = Number(args['max-age-days'] ?? 8);\nconst baseRef = args.base ?? 'HEAD';\nconst allowMajor = !!args['allow-major'];\nconst severities = ['low', 'moderate', 'high', 'critical'];\nconst minSeverity = severities.indexOf(args.severity ?? 'moderate');\nconst urgentSeverity = args['urgent-severity'] ? severities.indexOf(args['urgent-severity']) : severities.length;\nconst all = !!args.all;\nconst cutoff = new Date(Date.now() - maxAgeDays * 24 * 3600 * 1000);\n\nconst lockPath = path.join(root, 'package-lock.json');\nconst lock = () => JSON.parse(fs.readFileSync(lockPath, 'utf8'));\n\n// ---------- helpers ----------\n\nfunction npm(argv) {\n  try {\n    return execFileSync('npm', argv, { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: 64 << 20 });\n  } catch (e) {\n    if (e.stdout)\n      return e.stdout;\n    throw e;\n  }\n}\n\nconst viewCache = new Map();\nfunction view(spec) {\n  if (!viewCache.has(spec))\n    viewCache.set(spec, JSON.parse(npm(['view', spec, '--json'])));\n  return viewCache.get(spec);\n}\n\nfunction publishTime(name, version) {\n  return new Date(view(name).time[version]);\n}\n\nconst downloadsCache = new Map();\nasync function downloads(name, version) {\n  if (!downloadsCache.has(name)) {\n    try {\n      const res = await fetch(`https://api.npmjs.org/versions/${encodeURIComponent(name)}/last-week`);\n      downloadsCache.set(name, (await res.json()).downloads ?? {});\n    } catch {\n      downloadsCache.set(name, {});\n    }\n  }\n  return downloadsCache.get(name)[version];\n}\n\nfunction nameOf(nodePath) {\n  return nodePath.slice(nodePath.lastIndexOf('node_modules/') + 'node_modules/'.length);\n}\n\nfunction fmtDate(d) {\n  return d.toISOString().slice(0, 10);\n}\n\n// ---------- what is runtime ----------\n\nfunction bundleInlinedPaths() {\n  const lines = [];\n  const walk = dir => {\n    for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n      const p = path.join(dir, entry.name);\n      if (entry.isDirectory())\n        walk(p);\n      else if (entry.name.endsWith('.js.txt'))\n        lines.push(...fs.readFileSync(p, 'utf8').split('\\n').map(l => l.trim().replace(/^[\\d.]+ KB\\s+/, '')).filter(l => l.startsWith('node_modules/')));\n    }\n  };\n  for (const pkg of fs.readdirSync(path.join(root, 'packages'))) {\n    const lib = path.join(root, 'packages', pkg, 'lib');\n    if (fs.existsSync(lib))\n      walk(lib);\n  }\n  if (!lines.length)\n    throw new Error('No bundle reports under packages/*/lib. Run `npm run build` first.');\n  return lines;\n}\n\nfunction workspaceRuntimeDeps() {\n  const names = new Set();\n  for (const pkg of fs.readdirSync(path.join(root, 'packages'))) {\n    const file = path.join(root, 'packages', pkg, 'package.json');\n    if (fs.existsSync(file))\n      for (const name of Object.keys(JSON.parse(fs.readFileSync(file, 'utf8')).dependencies ?? {}))\n        names.add(name);\n  }\n  return names;\n}\n\n// ---------- lock file constraints ----------\n\nfunction resolveDep(packages, fromPath, name) {\n  let base = fromPath;\n  for (;;) {\n    const candidate = base ? `${base}/node_modules/${name}` : `node_modules/${name}`;\n    if (packages[candidate])\n      return candidate;\n    if (!base)\n      return null;\n    const idx = base.lastIndexOf('/node_modules/');\n    base = idx === -1 ? '' : base.slice(0, idx);\n  }\n}\n\nfunction constraints(lockJson) {\n  const map = new Map(); // nodePath -> [{ from, range }]\n  for (const [from, entry] of Object.entries(lockJson.packages)) {\n    if (entry.link)\n      continue;\n    const deps = { ...entry.dependencies, ...entry.optionalDependencies, ...entry.peerDependencies, ...(from === '' ? entry.devDependencies : {}) };\n    for (const [name, range] of Object.entries(deps)) {\n      const target = resolveDep(lockJson.packages, from, name);\n      if (!target)\n        continue;\n      if (!map.has(target))\n        map.set(target, []);\n      map.get(target).push({ from, range });\n    }\n  }\n  return map;\n}\n\n// ---------- version choice ----------\n\n// A dependent that is not runtime does not block a roll: npm nests the old\n// version under it, and that nested copy never reaches a bundle. A runtime\n// dependent that rejects the new version would get such a nested copy too,\n// and that one would be bundled, so it blocks.\nfunction chooseVersion({ name, current, nodePath, badRanges, urgentRanges = [], cons, isRuntime }) {\n  const time = view(name).time;\n  const rootPinned = cons.some(c => c.from === '');\n  const others = cons.filter(c => c.from !== '' && (c.from.startsWith('packages/') || isRuntime(c.from)));\n  const allowPrerelease = !!semver.prerelease(current);\n  const newer = Object.keys(time)\n      .filter(v => semver.valid(v) && (allowPrerelease || !semver.prerelease(v)))\n      .filter(v => semver.gt(v, current));\n  const outside = ranges => v => !ranges.some(r => semver.satisfies(v, r, { includePrerelease: true }));\n  const isOldEnough = v => new Date(time[v]) <= cutoff;\n  const isAccepted = v => others.every(c => semver.satisfies(v, c.range, { includePrerelease: true }));\n  const candidates = newer.filter(outside(badRanges));\n  const oldEnough = candidates.filter(isOldEnough);\n  const accepted = oldEnough.filter(isAccepted);\n  let pick = accepted.sort(semver.rcompare)[0];\n  if (!pick && urgentRanges.length) {\n    // An urgent advisory does not wait. A version that is old enough is still\n    // preferred, even when it leaves the less severe advisories open.\n    const fixed = newer.filter(outside(urgentRanges)).filter(isAccepted);\n    pick = fixed.filter(isOldEnough).sort(semver.rcompare)[0] ?? fixed.sort(semver.compare)[0];\n  }\n  if (!pick) {\n    if (!candidates.length)\n      return { reason: 'no fixed version published' };\n    if (!oldEnough.length) {\n      const soonest = candidates.sort((a, b) => new Date(time[a]) - new Date(time[b]))[0];\n      return { reason: `fixed versions are newer than ${maxAgeDays} days (${soonest} on ${fmtDate(new Date(time[soonest]))})` };\n    }\n    const blockers = others.filter(c => !oldEnough.some(v => semver.satisfies(v, c.range, { includePrerelease: true })));\n    return { reason: `blocked by ${blockers.map(c => `${c.from || 'package.json'} (${c.range})`).join(', ')}` };\n  }\n  const major = semver.major(pick) !== semver.major(current);\n  if (rootPinned && major && !allowMajor)\n    return { reason: `needs a major bump to ${pick} in package.json (rerun with --allow-major)`, version: pick };\n  return { version: pick, rootPinned, major, nodePath, urgent: !isOldEnough(pick) };\n}\n\n// ---------- lock file edits ----------\n\nfunction setLockVersion(nodePath, name, version) {\n  const json = lock();\n  const entry = json.packages[nodePath];\n  const meta = view(`${name}@${version}`);\n  const next = { version, resolved: meta.dist.tarball, integrity: meta.dist.integrity };\n  for (const key of ['dev', 'optional', 'devOptional', 'peer', 'inBundle'])\n    if (entry[key] !== undefined)\n      next[key] = entry[key];\n  if (meta.license)\n    next.license = typeof meta.license === 'string' ? meta.license : meta.license.type;\n  for (const key of ['dependencies', 'optionalDependencies', 'peerDependencies', 'peerDependenciesMeta', 'bin', 'engines', 'os', 'cpu', 'funding', 'deprecated'])\n    if (meta[key] !== undefined)\n      next[key] = meta[key];\n  if (meta.scripts && ['preinstall', 'install', 'postinstall'].some(s => meta.scripts[s]))\n    next.hasInstallScript = true;\n  json.packages[nodePath] = next;\n  fs.writeFileSync(lockPath, JSON.stringify(json, null, 2) + '\\n');\n}\n\nfunction lockDiff(baseJson, headJson) {\n  const changes = [];\n  const paths = new Set([...Object.keys(baseJson.packages), ...Object.keys(headJson.packages)]);\n  for (const p of paths) {\n    if (!p.includes('node_modules/'))\n      continue;\n    const before = baseJson.packages[p]?.version;\n    const after = headJson.packages[p]?.version;\n    if (before !== after)\n      changes.push({ nodePath: p, name: nameOf(p), before, after });\n  }\n  return changes.sort((a, b) => a.nodePath.localeCompare(b.nodePath));\n}\n\n// Packages that `npm install` pulled in past the cutoff are rolled back to the\n// newest version that is old enough and that every dependent accepts.\nfunction checkInstalled(names) {\n  const ls = JSON.parse(npm(['ls', '--json', ...names]));\n  if (ls.problems?.length)\n    throw new Error(`npm ls reports problems after the roll:\\n${ls.problems.join('\\n')}`);\n}\n\nfunction pinDownNewcomers(baseJson, planned) {\n  const json = lock();\n  const cons = constraints(json);\n  let changed = false;\n  for (const { nodePath, name, before, after } of lockDiff(baseJson, json)) {\n    if (!after || !semver.valid(after) || publishTime(name, after) <= cutoff || planned.has(`${name}@${after}`))\n      continue;\n    const choice = chooseVersion({ name, current: before && semver.valid(before) ? before : '0.0.0', nodePath, badRanges: [], cons: (cons.get(nodePath) ?? []).filter(c => c.from !== ''), isRuntime: () => true });\n    if (!choice.version || choice.version === after)\n      continue;\n    console.log(`  ${name}@${after} is newer than ${maxAgeDays} days, pinning ${nodePath} to ${choice.version}`);\n    setLockVersion(nodePath, name, choice.version);\n    changed = true;\n  }\n  return changed;\n}\n\n// ---------- main ----------\n\nasync function main() {\n  const audit = JSON.parse(npm(['audit', '--json']));\n  let isRuntime = () => true;\n  if (!all) {\n    const inlined = bundleInlinedPaths();\n    const workspaceDeps = workspaceRuntimeDeps();\n    isRuntime = nodePath => inlined.some(l => l.startsWith(nodePath + '/')) || (nodePath.split('node_modules/').length === 2 && workspaceDeps.has(nameOf(nodePath)));\n  }\n\n  const lockJson = lock();\n  const cons = constraints(lockJson);\n  const plan = [];\n  const skipped = [];\n  for (const [name, vuln] of Object.entries(audit.vulnerabilities ?? {})) {\n    const advisories = vuln.via.filter(v => typeof v === 'object' && v.name === name);\n    if (!advisories.length)\n      continue; // only affected through a dependency; that dependency has its own entry\n    if (severities.indexOf(vuln.severity) < minSeverity) {\n      skipped.push(`${name} (${vuln.severity})`);\n      continue;\n    }\n    for (const nodePath of vuln.nodes) {\n      if (!isRuntime(nodePath)) {\n        skipped.push(`${nodePath} (not in a runtime bundle)`);\n        continue;\n      }\n      const current = lockJson.packages[nodePath].version;\n      const urgentRanges = advisories.filter(a => severities.indexOf(a.severity) >= urgentSeverity).map(a => a.range);\n      const choice = chooseVersion({ name, current, nodePath, badRanges: advisories.map(a => a.range), urgentRanges, cons: cons.get(nodePath) ?? [], isRuntime });\n      plan.push({ name, nodePath, current, severity: vuln.severity, advisories: advisories.map(a => a.url.replace('https://github.com/advisories/', '')), ...choice });\n    }\n  }\n\n  console.log(`\\n## ${all ? 'Advisories' : 'Runtime advisories'} (${args.severity ?? 'moderate'} and above), versions published on or before ${fmtDate(cutoff)}\\n`);\n  for (const p of plan) {\n    const action = p.version && !p.reason ? `roll to ${p.version}${p.major ? ' (major)' : ''}${p.urgent ? ' (urgent, newer than the age limit)' : ''}` : `not rolled: ${p.reason}`;\n    console.log(`- ${p.nodePath} ${p.current} [${p.severity}, ${p.advisories.join(' ')}]: ${action}`);\n  }\n  if (!plan.length)\n    console.log('- none');\n  if (skipped.length)\n    console.log(`\\nSkipped: ${skipped.join(', ')}`);\n\n  const actionable = plan.filter(p => p.version && !p.reason);\n  if (!apply) {\n    if (actionable.length)\n      console.log('\\nRerun with --apply to change package.json / package-lock.json.');\n    return;\n  }\n\n  const baseJson = JSON.parse(execFileSync('git', ['show', `${baseRef}:package-lock.json`], { cwd: root, encoding: 'utf8', maxBuffer: 64 << 20 }));\n  console.log('');\n  for (const p of actionable) {\n    console.log(`Rolling ${p.nodePath} ${p.current} -> ${p.version}`);\n    if (p.rootPinned)\n      npm(['install', `${p.name}@${p.version}`, '--save-exact', '--no-audit', '--no-fund']);\n    else\n      setLockVersion(p.nodePath, p.name, p.version);\n  }\n  const planned = new Set(actionable.map(p => `${p.name}@${p.version}`));\n  for (let round = 0; round < 5; round++) {\n    npm(['install', '--no-audit', '--no-fund']);\n    if (!pinDownNewcomers(baseJson, planned))\n      break;\n  }\n  checkInstalled(actionable.map(p => p.name));\n\n  const final = lock();\n  const changes = lockDiff(baseJson, final);\n  const byPath = new Map(plan.map(p => [p.nodePath, p]));\n  // One row per (package, old, new); nested copies of the same roll are counted.\n  const grouped = new Map();\n  for (const c of changes) {\n    const key = `${c.name} ${c.before} ${c.after}`;\n    if (!grouped.has(key))\n      grouped.set(key, { ...c, nested: 0 });\n    const g = grouped.get(key);\n    const isNested = c.nodePath.split('node_modules/').length > 2;\n    if (isNested)\n      g.nested++;\n    else\n      g.nodePath = c.nodePath;\n    if (byPath.get(c.nodePath))\n      g.plan = byPath.get(c.nodePath);\n  }\n  const rows = [];\n  for (const c of [...grouped.values()].sort((a, b) => a.name.localeCompare(b.name))) {\n    const why = c.plan ? `${c.plan.severity}: ${c.plan.advisories.join(', ')}` : 'dependency';\n    const dl = c.after ? await downloads(c.name, c.after) : undefined;\n    const date = c.after && semver.valid(c.after) ? fmtDate(publishTime(c.name, c.after)) : '';\n    const where = c.nested ? ` (${c.nested} nested cop${c.nested === 1 ? 'y' : 'ies'})` : '';\n    rows.push(`| ${c.name}${where} | ${c.before ?? '-'} | ${c.after ?? '-'} | ${date} | ${dl?.toLocaleString('en-US') ?? ''} | ${why} |`);\n  }\n  const notRolled = plan.filter(p => p.reason).map(p => `- ${p.name} ${p.current} (${p.severity}, ${p.advisories.join(', ')}): ${p.reason}`);\n  const report = [\n    `| Package | Old | New | Published | Downloads, last 7 days | Reason |`,\n    `|---|---|---|---|---|---|`,\n    ...rows,\n    ...(notRolled.length ? ['', 'Not rolled:', ...notRolled] : []),\n  ].join('\\n');\n  console.log('\\n' + report + '\\n');\n  if (args.report)\n    fs.writeFileSync(args.report, report + '\\n');\n}\n\nmain().catch(e => {\n  console.error(e.message);\n  process.exit(1);\n});\n", "skills/playwright-bisect-chromium/SKILL.md": "---\nname: playwright-bisect-chromium\ndescription: Bisect a Chromium regression down to the upstream commit with the prebuilt per-commit Chrome for Testing builds - no Chromium checkout and no build. Use when a test or a repro passes on an older Chromium and fails on a newer one, for example on a Chromium roll PR or a tip-of-tree roll PR.\nuser_invocable: true\n---\n\n# Bisecting Chromium\n\nPlaywright's Chromium is Chrome for Testing (CfT), downloaded from Google. There is no patch and no\nsource tree to bisect here. Google publishes a CfT build for almost every trunk commit position in\nthe `chrome-for-testing-per-commit-public` bucket, and\n[`utils/bisect-chromium.mjs`](../../../utils/bisect-chromium.mjs) does a binary search over those\nbuilds between a known-good and a known-bad revision. It runs a check command against each build,\nwith `CRPATH` set to the executable of the build. Each step downloads one build of about 130 MB. A\nwhole roll is about 8000 positions, that is about 13 steps, so a bisect takes minutes.\n\n## Find the two revisions\n\nThe script takes a revision as a Chrome version (`159.0.8154.6`) or as a trunk commit position\n(`1739869`, the number in `https://crrev.com/1739869`). It resolves a version to the position that\nthe release branch of the version was cut from.\n\n- **Roll PR** (`feat(chromium): roll to <version>`, branch `roll-chromium/<version>`): the\n  description has the line `Version: <old> → <new>`. `<old>` is `--good`, `<new>` is `--bad`. A\n  tip-of-tree roll PR (`feat(chromium-tip-of-tree): roll to <version> - DO NOT MERGE`) has the same\n  line.\n- **A roll that merged**: `git log -p -- packages/playwright-core/browsers.json` shows each change of\n  the `browserVersion` of `chromium`.\n- **Anything else with a version**: a `Chrome/154.0.8037.0` user agent, `browser.version()`, a bug\n  report. Pass the version as it is.\n\nNot every position has a build. In bisect mode the script moves `--good` and `--bad` to the nearest\nposition that has a build, and prints a warning. Single-revision mode needs an exact position; to\nsee which positions near `1689400` have a build, open\n`https://storage.googleapis.com/chrome-for-testing-per-commit-public/?delimiter=/&prefix=linux64/r&marker=linux64/r1689400`.\n\n## Run it\n\nRun from the root of the Playwright checkout, after `npm run build`. Always pass a check that runs\nonly the failing test. The default check, a full `npm run ctest`, is too slow for a bisect.\n\n```bash\nnode utils/bisect-chromium.mjs --good 158.0.8127.18 --bad 159.0.8154.6 \\\n  --check 'npm run ctest -- tests/page/page-goto.spec.ts:42 --workers=1 --repeat-each=3'\n```\n\n- `--check` decides if a build is good: exit code 0 means good. The script runs it in the current\n  directory with `CRPATH` set to the executable of the build and with `PLAYWRIGHT_HTML_OPEN=never`.\n  Anything that reads `CRPATH` works: a Playwright test of this repo, or a script that launches\n  `process.env.CRPATH`. When the failure is flaky, add `--repeat-each`, so that one pass by chance\n  does not send the bisect the wrong way.\n- The default build is `chrome-headless-shell`, which is what Playwright runs in headless mode. Pass\n  `--headed` to the script to get the full Chrome build: for tests that you run with `--headed`, and\n  for `channel: 'chromium'` (the full Chrome in the new headless mode).\n- The script checks both ends before it starts. \"Supposedly good revision is BAD\" means that the\n  regression is older than your range: pass an older `--good`. \"Supposedly bad revision is GOOD\"\n  means that the check does not reproduce the failure: wrong headed or headless build, wrong test\n  filter, a flaky test, or a regression on the release branch (see the limits below).\n- Builds are cached in `<tmpdir>/chromium-r<position>-<headless|headed>/` and used again, so a second\n  run with a different check is fast. Do not delete them during a bisect.\n- Single-revision mode, `node utils/bisect-chromium.mjs 1739117 --check '...'`, checks one build and\n  prints the full output of the check. Use it to confirm an end of the range by hand.\n- There are builds for `linux64`, `mac-arm64` and `win64` only, and the script takes the builds of the\n  machine that it runs on. A failure that occurs on one platform only needs a bisect on that\n  platform.\n\n## Read the result\n\n```\n=== RESULT ===\nLast good build:  r1739116\nFirst bad build:  r1739117\nCommits: https://crrev.com/1739116 .. https://crrev.com/1739117\n```\n\nTwo adjacent builds usually differ by one commit. When the positions between them have no build, the\nrange has a few commits. `https://crrev.com/<position>` opens the commit. For a range, take the two\nhashes and read `https://chromium.googlesource.com/chromium/src/+log/<good-hash>..<bad-hash>`.\n\nReport the commit that caused the regression: what it changed and why that breaks the test, with\nthe exact revisions and the check that you used. Then decide where the fix belongs:\n\n- Playwright relied on behavior that Chromium changed on purpose: fix Playwright, in the roll PR or\n  before it.\n- Chromium has a bug: it goes to https://crbug.com/new with the commit and a repro that needs no\n  Playwright. Only a person can file there, see \"Browser bugs\" in [AGENTS.md](../../../AGENTS.md).\n\n## Limits\n\n- Per-commit builds are trunk builds. A beta build is the trunk at the position of the version, plus\n  the commits that were cherry-picked to its release branch after that. When a failure reproduces on\n  the build of the roll, but not on the trunk build at the same position, the cause is on the release\n  branch: read `https://chromium.googlesource.com/chromium/src/+log/refs/branch-heads/<branch>`,\n  where `<branch>` is the third number of the version (`8154` for `159.0.8154.6`).\n- Two versions of the same release branch (`159.0.8154.6` and `159.0.8154.13`) have the same position.\n  The script stops with an error, because there are no per-commit builds between them. Read\n  `https://chromium.googlesource.com/chromium/src/+log/<old-version>..<new-version>` instead.\n", "skills/playwright-dev/SKILL.md": "---\nname: playwright-dev\ndescription: Explains how to develop Playwright - add APIs, MCP tools, CLI commands, and vendor dependencies.\n---\n\n# Playwright Development Guide\n\nSee [AGENTS.md](../../../AGENTS.md) for monorepo structure, build/test/lint commands, and coding conventions.\n\n## Detailed Guides\n\n- [Library Architecture](library.md) — client/server/dispatcher structure, protocol layer, DEPS rules\n- [Adding and Modifying APIs](api.md) — define API docs, implement client/server, add tests\n- [MCP Tools and CLI Commands](tools.md) — add MCP tools, CLI commands, config options\n- [Vendor Dependencies & Bundling](vendor.md) — utilsBundle, coreBundle, babelBundle; adding vendored npm packages; DEPS.list; `check_deps`\n- [Updating WebKit Safari Version](webkit-safari-version.md) — update the Safari version string in the WebKit user-agent\n- [WebView (iOS Safari) Backend](webview.md) — `webkit/webview/` against stock Mobile Safari; provisional-target pause/resume; what's upstream vs Playwright patches; local + CI test setup\n- [Bisecting Across Published Versions](bisect-published-versions.md) — reproduce regressions side-by-side from npm and diff `node_modules/playwright/lib/` between versions\n- [Dashboard](dashboard.md) - the UI powering the \"playwright cli show\" command, and how to work on it\n", "skills/playwright-dev/api.md": "# Adding and Modifying APIs\n\n- Before performing the implementation, go over the steps to understand and plan the work ahead. It is important to follow the steps in order, as some of them are prerequisites for others.\n\n## Step 1: Define API in Documentation\n\nDefine (or update) API in `docs/src/api/class-xxx.md`. For the new methods, params and options use the version from package.json (without `-next`).\n\n### Documentation Format\n\n**Method definition:**\n```markdown\n## async method: Page.methodName\n* since: v1.XX\n- returns: <[null]|[Response]>\n\nDescription of the method.\n\n### param: Page.methodName.paramName\n* since: v1.XX\n- `paramName` <[string]>\n\nDescription of the parameter.\n\n### option: Page.methodName.optionName\n* since: v1.XX\n- `optionName` <[string]>\n\nDescription of the option.\n```\n\n**Key syntax rules:**\n- `* since: v1.XX` — always take the version from package.json (without -next)\n- `* langs: js, python` — language filter (optional)\n- `* langs: alias-java: navigate` — language-specific method name\n- `* deprecated: v1.XX` — deprecation marker\n- `<[TypeName]>` — type annotation: `<[string]>`, `<[int]>`, `<[float]>`, `<[boolean]>`\n- `<[null]|[Response]>` — union type\n- `<[Array]<[Locator]>>` — array type\n- `<[Object]>` with indented `- \\`field\\` <[type]>` — object type\n- `### param:` — required parameter\n- `### option:` — optional parameter\n- `= %%-placeholder-name-%%` — reuse shared param definition from `docs/src/api/params.md`\n\n**Property definition:**\n```markdown\n## property: Page.propName\n* since: v1.XX\n- type: <[string]>\n\nDescription.\n```\n\n**Event definition:**\n```markdown\n## event: Page.eventName\n* since: v1.XX\n- argument: <[Dialog]>\n\nDescription.\n```\n\nKeep methods, events and property definitions sorted alphabetically within the file.\n\nWatch will kick in and auto-generate:\n- `packages/playwright-core/types/types.d.ts` — public API types\n- `packages/playwright/types/test.d.ts` — test API types\n\n## Step 2: Implement Client API\n\nImplement the new API in `packages/playwright-core/src/client/xxx.ts`.\n\n### Client Implementation Pattern\n\nClient classes extend `ChannelOwner<XxxChannel>` and call through `this._channel`:\n\n```typescript\n// Direct channel call (most common)\nasync methodName(param: string, options: channels.FrameMethodNameOptions = {}): Promise<void> {\n  await this._channel.methodName({ param, ...options, timeout: this._timeout(options) });\n}\n\n// Channel call with response wrapping\nasync goto(url: string, options: channels.FrameGotoOptions = {}): Promise<network.Response | null> {\n  return network.Response.fromNullable(\n    (await this._channel.goto({ url, ...options, timeout: this._timeout(options) })).response\n  );\n}\n```\n\n**Key patterns:**\n- Parameters are assembled into a single object for the channel call\n- Timeout is processed through `this._timeout(options)` or `this._navigationTimeout(options)`\n- Return values from channel are unwrapped/converted: `Response.fromNullable()`, `ElementHandle.from()`, etc.\n- Locator methods delegate to Frame: `return await this._frame.click(this._selector, { strict: true, ...options })`\n- Page methods often delegate to `this._mainFrame`\n\n## Step 3: Define Protocol Channel\n\nDefine (or update) channel for the API in the matching `packages/protocol/spec/*.yml` file (e.g. `page.yml`) as needed.\n\n### Protocol YAML Format\n\nMethods are defined under `commands:` in the interface section:\n\n```yaml\nPage:\n  type: interface\n  extends: EventTarget\n\n  commands:\n    methodName:\n      title: Short description for tracing\n      parameters:\n        url: string                    # required string\n        timeout: float                 # required float\n        referer: string?               # optional string (? suffix)\n        waitUntil: LifecycleEvent?     # optional reference to another type\n        button:                        # optional enum\n          type: enum?\n          literals:\n          - left\n          - right\n          - middle\n        modifiers:                     # optional array of enums\n          type: array?\n          items:\n            type: enum\n            literals:\n            - Alt\n            - Control\n            - Meta\n            - Shift\n        position: Point?               # optional reference type\n        viewportSize:                  # required inline object\n          type: object\n          properties:\n            width: int\n            height: int\n      returns:\n        response: Response?            # optional return value\n      flags:\n        slowMo: true\n        snapshot: true\n        pausesBeforeAction: true\n```\n\n**Type primitives:** `string`, `int`, `float`, `boolean`, `binary`, `json`\n**Optional:** append `?` to any type: `string?`, `int?`, `object?`\n**Arrays:** `type: array` with `items:` (or `type: array?` for optional)\n**Enums:** `type: enum` with `literals:` list\n**References:** use type name directly: `Response`, `Frame`, `Point`\n**Flags:** `slowMo`, `snapshot`, `pausesBeforeAction`, `pausesBeforeInput`\n\nWatch will kick in and auto-generate:\n- `packages/playwright-core/src/client/channels.d.ts`, `packages/playwright-core/src/server/channels.d.ts` — channel TypeScript interfaces\n- `packages/protocol/src/validator.ts` — runtime validators\n- `packages/isomorphic/protocolMetainfo.ts` — method metadata\n\n## Step 4: Implement Dispatcher\n\nImplement dispatcher handler in `packages/playwright-core/src/server/dispatchers/xxxDispatcher.ts` as needed.\n\n### Dispatcher Pattern\n\nDispatchers receive validated params and route to server objects:\n\n```typescript\n// Simple pass-through (most common)\nasync methodName(params: channels.PageMethodNameParams, progress: Progress): Promise<void> {\n  await this._page.methodName(progress, params.value);\n}\n\n// With response wrapping\nasync goto(params: channels.FrameGotoParams, progress: Progress): Promise<channels.FrameGotoResult> {\n  return { response: ResponseDispatcher.fromNullable(this._browserContextDispatcher,\n    await this._frame.goto(progress, params.url, params)) };\n}\n\n// With dispatcher extraction (when params contain dispatcher references)\nasync expectScreenshot(params: channels.PageExpectScreenshotParams, progress: Progress): Promise<channels.PageExpectScreenshotResult> {\n  const mask = (params.mask || []).map(({ frame, selector }) => ({\n    frame: (frame as FrameDispatcher)._object,\n    selector,\n  }));\n  return await this._page.expectScreenshot(progress, { ...params, mask });\n}\n\n// With array result wrapping\nasync querySelectorAll(params: channels.FrameQuerySelectorAllParams, progress: Progress): Promise<channels.FrameQuerySelectorAllResult> {\n  const elements = await progress.race(this._frame.querySelectorAll(params.selector));\n  return { elements: elements.map(e => ElementHandleDispatcher.from(this, e)) };\n}\n```\n\n**Key patterns:**\n- Method signature: `async method(params: channels.XxxMethodParams, progress: Progress): Promise<channels.XxxMethodResult>`\n- Extract params: `params.url`, `params.selector`, etc.\n- Convert dispatcher refs to server objects: `(params.frame as FrameDispatcher)._object`\n- Wrap server objects as dispatchers in results: `ResponseDispatcher.fromNullable()`, `ElementHandleDispatcher.from()`\n- All methods receive `Progress` for timeout/cancellation\n\n## Step 5: Implement Server Logic\n\nHandler should route the call into the corresponding method in `packages/playwright-core/src/server/xxx.ts`.\n\nServer methods implement the actual browser interaction:\n\n```typescript\n// In packages/playwright-core/src/server/frames.ts\nasync goto(progress: Progress, url: string, options: types.GotoOptions = {}): Promise<network.Response | null> {\n  // ... validation, URL construction ...\n  // Delegates to browser-specific implementation:\n  const result = await this._page.delegate.navigateFrame(this, url, referer);\n  // ... wait for lifecycle events ...\n  return response;\n}\n```\n\nBrowser-specific implementations live in:\n- `packages/playwright-core/src/server/chromium/crPage.ts` — Chromium (uses CDP: `this._client.send('Page.navigate', { ... })`)\n- `packages/playwright-core/src/server/firefox/ffPage.ts` — Firefox\n- `packages/playwright-core/src/server/webkit/wkPage.ts` — WebKit\n\n## Step 6: Write Tests\n\n### Test Location\n- Page-only tests: `tests/page/xxx.spec.ts` — use `page` fixture\n- Context tests: `tests/library/xxx.spec.ts` — use `context` fixture\n\n### Test Patterns\n\n**Page test:**\n```typescript\nimport { test as it, expect } from './pageTest';\n\nit('should do something @smoke', async ({ page, server }) => {\n  await page.goto(server.EMPTY_PAGE);\n  // ... assertions ...\n  expect(page.url()).toBe(server.EMPTY_PAGE);\n});\n\nit('should handle options', async ({ page, server, browserName, isAndroid }) => {\n  it.skip(isAndroid, 'Not supported on Android');\n  it.info().annotations.push({ type: 'issue', description: 'https://github.com/user/repo/issues/123' });\n  // ...\n});\n```\n\n**Library/context test:**\n```typescript\nimport { contextTest as it, expect } from '../config/browserTest';\n\nit('should work with context', async ({ context, server }) => {\n  const page = await context.newPage();\n  await page.goto(server.EMPTY_PAGE);\n  // ...\n});\n```\n\n### Available Fixtures\n- `page` — isolated page instance\n- `context` — browser context (library tests)\n- `server` — HTTP test server (`server.EMPTY_PAGE`, `server.PREFIX`, `server.CROSS_PROCESS_PREFIX`)\n- `httpsServer` — HTTPS test server\n- `asset(name)` — path to test asset file\n- `browserName` — `'chromium' | 'firefox' | 'webkit'`\n- `channel` — browser channel string\n- `isAndroid`, `isBidi`, `isElectron` — platform booleans\n- `isWindows`, `isMac`, `isLinux` — OS booleans\n- `mode` — test mode (`'default'`, `'service'`, etc.)\n\n### Running Tests\n```bash\nnpm run ctest tests/page/xxx.spec.ts          # Chromium only\nnpm run test tests/page/xxx.spec.ts           # All browsers\nnpm run ctest -- --grep \"should do something\" # Filter by name\n```\n\n## Architecture Overview\n\n```\ndocs/src/api/class-xxx.md          (API documentation — source of truth for public types)\n  → auto-generates → types.d.ts, test.d.ts\n\npackages/protocol/spec/*.yml       (RPC protocol definition)\n  → auto-generates → channels.d.ts, validator.ts, protocolMetainfo.ts\n\nClient call chain:\n  user code → Page.method() → Frame.method() → this._channel.method(params)\n    → Proxy validates & sends → Connection.sendMessageToServer()\n    → [wire] →\n  DispatcherConnection.dispatch() → XxxDispatcher.method(params, progress)\n    → ServerObject.method(progress, ...) → BrowserDelegate (CDP/Firefox/WebKit)\n```\n", "skills/playwright-dev/bisect-published-versions.md": "# Bisecting a Regression Across Published Playwright Versions\n\nWhen a user reports a regression between two published Playwright versions (e.g. \"works in 1.58, broken in 1.59.1\"), reproduce both side by side from npm — do **not** try to bisect against the monorepo source. Reading the compiled JS in `node_modules/playwright/lib/**` is faster and avoids build/branch confusion.\n\n## Setup (two side-by-side installs)\n\nUse `~/tmp/<version-tag>/` (NOT `/tmp/`) — the user's shell sessions live in `~/tmp`.\n\n```bash\nmkdir -p ~/tmp/<good>/tests ~/tmp/<bad>/tests\n\n# Skip `npm init playwright@latest` — it's interactive and the scaffold\n# pulls in 3 projects (chromium/firefox/webkit) which produces 6 test runs\n# from a single spec and is confusing. Do this instead:\n( cd ~/tmp/<good> && npm init -y && npm install @playwright/test@<good-ver> && npx playwright install chromium)\n( cd ~/tmp/<bad>  && npm init -y && npm install @playwright/test@<bad-ver> && npx playwright install chromium )\n```\n\nWrite a **minimal** `playwright.config.ts` with a single chromium project — the default scaffold's 3-project config will run the same spec 6 times and obscure output:\n\n```ts\nimport { defineConfig, devices } from '@playwright/test';\nexport default defineConfig({\n  testDir: './tests',\n  projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],\n});\n```\n\nDrop the repro spec (and any helper files) into both folders identically. Run:\n\n```bash\n( cd ~/tmp/<good> && npx playwright test )\n( cd ~/tmp/<bad>  && npx playwright test )\n```\n\nConfirm the difference is real before investigating.\n\n## Investigating the diff in node_modules\n\nThe compiled JS in `node_modules/playwright-core/lib/` and `node_modules/playwright/lib/` is the source of truth for what shipped.\n\nIn recent versions of Playwright these are bundled, so you can't compare\non per-file basis. You can extract files from bundles via grep though and compare.\n\nOnce you've found a candidate function, diff it across the two versions. Patches are usually 1–3 lines.\n\n## Verifying the hypothesis\n\nEdit the compiled JS in `~/tmp/<bad>/node_modules/playwright/lib/...` directly and re-run the test. No build step is needed — Node loads the JS as-is. Revert when done (or just delete the folder).\n\nFor stack-trace bugs in particular, a `console.log(new Error().stack)` inserted at the capture site (e.g. inside `expect.js`'s `captureRawStack`) instantly shows whether the issue is microtask-boundary related vs. a stack-filter regression vs. something else.\n\n## Reporting\n\nWhen the root cause is confirmed:\n\n1. Quote the offending lines from `node_modules/.../lib/...` of the **bad** version, with file path.\n2. Show the equivalent code from the **good** version for contrast.\n3. Explain *why* the change breaks the user's case (don't just point at the diff).\n4. Propose and verify a minimal fix by patching the bad install in place.\n\nPost the writeup as a comment on the original issue with `gh issue comment <number> --repo microsoft/playwright --body \"$(cat <<'EOF' ... EOF)\"`.\n\n## Pitfalls\n\n- **Don't run `npm init playwright@latest`** — it's interactive and `--quiet` does not skip the prompts. `npm init -y` + `npm install @playwright/test@<ver>` is faster and deterministic.\n- **Don't use the scaffold's default config** — the 3 browser projects multiply test runs by 3 and confuse the output. One chromium project is enough for 99% of repros.\n- **Don't `cd` between commands in a single Bash call without `&&`** — the shell cwd resets between tool invocations.\n- **`/tmp/` is not `~/tmp/`** — pick one and stay consistent. The user's interactive shells default to `~/tmp/`, so prefer that.\n- **Don't `rm -rf` an existing `~/tmp/<ver>/`** without checking — it may be the user's prior work. Edit in place instead.\n- **Don't try to map the bug to monorepo source first.** The shipped JS is what the user is running; source may have already been refactored or fixed on `main`. Investigate `node_modules/` first, then map the fix back to source only when proposing the upstream patch.\n", "skills/playwright-dev/dashboard.md": "# Developing Dashboard\n\n`packages/dashboard` contains the sourcecode behind `playwright cli show`,\na dashboard that allow supervising agents while they use playwright cli.\n\nImportant code paths:\n\n- `packages/dashboard` has the UI\n- `dashboardController.ts` has the backend\n- `show` section in `cli-client/program.ts`\n\nYou can use Playwright CLI to look at the dashboard:\n\n```bash\n# start the dashboard server in the background\nnpx playwright cli show --port=0\n\n# open it with Playwright CLI\nnpx playwright cli open --session=dashboard localhost:PORT\nnpx playwright cli snapshot\n\n# take screenshots to look at UI stuff\nnpx playwright cli screenshot\n\n# take videos to showcase you work!\nnpx playwright cli video-start video.webm\n\n# chapters are not everything - look at video-recording.md to learn about overlays, much more powerful! embrace creativity.\nnpx playwright cli video-chapter \"Chapter Title\" --description=\"Details\" --duration=2000\nnpx playwright cli video-stop\n\n# afterwards, use ffmpeg to turn the video into mp4 for sharing.\n```\n\nFull CLI reference: `packages/playwright-core/src/tools/skills/playwright-cli/SKILL.md`. In this repo, invoke as `npx playwright cli` instead of `playwright-cli`.\n", "skills/playwright-dev/library.md": "# Playwright Library Architecture: Client, Server, and Dispatchers\n\nPlaywright uses a client-server architecture connected by a protocol layer. The client provides the public API, the server performs actual browser automation, and dispatchers bridge the two over an RPC channel.\n\n## Package Layout\n\n```\npackages/protocol/\n  spec/*.yml                — RPC protocol definition (source of truth)\n  src/                      — validators (generated + primitives)\n\npackages/isomorphic/        — shared code used by both client and server\n  protocolMetainfo.ts       — generated method metadata (flags, titles)\n\npackages/playwright-core/src/\n  client/                   — public API objects (ChannelOwner subclasses)\n    channels.d.ts           — generated client channel interfaces\n  server/                   — browser automation implementation (SdkObject subclasses)\n    channels.d.ts           — generated server channel interfaces\n  server/dispatchers/       — protocol bridge (Dispatcher subclasses)\n```\n\n## Dependency Rules (DEPS.list)\n\nEach directory has a `DEPS.list` constraining its imports. These are enforced by `npm run flint`.\n\nEntries can be relative paths, alias paths (`@isomorphic/**`, `@utils/**`), or `node_modules/<pkg>` to allow a specific npm package import. The `\"strict\"` marker disables inheritance from parent folders. Section headers like `[filename.ts]` scope rules to a single file.\n\n**client/** can import from:\n- `@protocol/**` — validators and channel types\n- `@isomorphic/**` — shared utilities\n\n**server/** can import from:\n- `@protocol/**`, `@utils/**`, `@isomorphic/**`\n- `./` (own directory), `./har/`, `./recorder/`, `./registry/`\n- Only `playwright.ts` can import browser engines (`./chromium/`, `./firefox/`, `./webkit/`, `./bidi/`, `./android/`, `./electron/`)\n\n**server/dispatchers/** can import from:\n- `@protocol/**`, `@utils/**`, `@isomorphic/**`\n- `../**` — all server modules\n\n**Key rule:** Client code NEVER imports server code. Server code NEVER imports client code. They communicate only through the protocol.\n\n**Vendored npm packages** (anything under `node_modules/`) go through `src/utilsBundle.ts` — a single bundled file that re-exports the vendored symbols. Adding a new dep or changing a DEPS.list entry for vendored code: see [vendor.md](vendor.md).\n\n## Protocol Layer\n\n### packages/protocol/spec/*.yml\n\nThese files define all RPC interfaces, commands (methods), events, and types, one file per domain (`page.yml`, `frame.yml`, ...). Example:\n\n```yaml\nPage:\n  type: interface\n  extends: EventTarget\n  initializer:\n    mainFrame: Frame\n    viewportSize: { type: object?, properties: { width: int, height: int } }\n  commands:\n    goto:\n      parameters:\n        url: string\n        timeout: float\n        waitUntil: LifecycleEvent?\n      returns:\n        response: Response?\n  events:\n    close: {}\n    navigated:\n      url: string\n      name: string\n```\n\n### Code Generation\n\nRunning `node utils/generate_channels.js` (or via watch) produces:\n- `packages/playwright-core/src/client/channels.d.ts` and `packages/playwright-core/src/server/channels.d.ts` (plus shared `packages/protocol/src/structs.d.ts`) — TypeScript types: `PageChannel`, `PageGotoParams`, `PageGotoResult`, `PageInitializer`, event types\n- `packages/protocol/src/validator.ts` — runtime validators: `scheme.PageGotoParams = tObject({...})`\n- `packages/isomorphic/protocolMetainfo.ts` — method flags (slowMo, snapshot, etc.)\n\n### Wire Format\n\n```\nClient → Server (RPC call):   { id, guid, method, params, metadata? }\nServer → Client (response):   { id, result } or { id, error, log? }\nServer → Client (event):      { guid, method, params }\nServer → Client (lifecycle):  { guid, method: '__create__'|'__adopt__'|'__dispose__', params }\n```\n\nObject references are serialized as `{ guid: \"object-guid\" }` and resolved by validators.\n\n## Client Layer\n\n### ChannelOwner — Base Class\n\nEvery client-side API object (Page, Frame, Browser, etc.) extends `ChannelOwner<T>`:\n\n```\npackages/playwright-core/src/client/channelOwner.ts\n```\n\nKey properties:\n- `_connection: Connection` — the RPC connection\n- `_channel: T` — Proxy that intercepts method calls and sends RPC messages\n- `_guid: string` — unique identifier matching the server-side object\n- `_type: string` — type name (e.g., 'Page', 'Frame')\n- `_parent: ChannelOwner` — parent in the object tree\n- `_objects: Map<string, ChannelOwner>` — child objects\n- `_initializer` — initial state received from server on creation\n\nHow `_channel` works: It's a Proxy. When you call `this._channel.goto(params)`:\n1. Proxy intercepts the `goto` property access\n2. Finds the validator for `PageGotoParams`\n3. Returns an async function that validates params, wraps in `_wrapApiCall`, and calls `_connection.sendMessageToServer()`\n\nEvent subscription optimization: `_eventToSubscriptionMapping` maps JS event names to protocol subscription events. When the first listener is added, calls `updateSubscription(event, true)` on the channel. When last listener is removed, calls `updateSubscription(event, false)`. This way the server only sends events that have listeners.\n\n### Connection\n\n```\npackages/playwright-core/src/client/connection.ts\n```\n\nManages the client-server transport:\n- `_objects: Map<string, ChannelOwner>` — all live remote objects by GUID\n- `_callbacks: Map<number, {resolve, reject}>` — pending RPC calls by message ID\n- `sendMessageToServer(object, method, params, apiZone)` — sends RPC call, returns promise\n- `dispatch(message)` — handles incoming messages:\n  - Response (has `id`): resolves/rejects the matching callback\n  - `__create__`: instantiates ChannelOwner subclass via factory switch\n  - `__adopt__`: reparents a child object\n  - `__dispose__`: disposes object and all children\n  - Event (has `method`): emits on the object's `_channel`\n\n### Representative Client Classes\n\n| Class | File | Key delegation |\n|-------|------|----------------|\n| `Playwright` | `playwright.ts` | Root object; owns `chromium`, `firefox`, `webkit` BrowserTypes |\n| `BrowserType` | `browserType.ts` | `launch()` → `_channel.launch()` |\n| `Browser` | `browser.ts` | `newContext()` → `_channel.newContext()` |\n| `BrowserContext` | `browserContext.ts` | Owns pages, routes, tracing, cookies |\n| `Page` | `page.ts` | Delegates most calls to `_mainFrame`; owns keyboard/mouse/touchscreen |\n| `Frame` | `frame.ts` | `goto()`, `click()`, `evaluate()` → `_channel.*` |\n| `Locator` | `locator.ts` | Delegates to `Frame` methods with selector + `strict: true` |\n| `ElementHandle` | `elementHandle.ts` | DOM element reference |\n\n## Server Layer\n\n### SdkObject — Base Class\n\nEvery server-side domain object extends `SdkObject`:\n\n```\npackages/playwright-core/src/server/instrumentation.ts\n```\n\nKey properties:\n- `guid: string` — unique identifier (shared with client-side ChannelOwner)\n- `attribution: Attribution` — ownership chain: `{ playwright, browserType?, browser?, context?, page?, frame? }`\n- `instrumentation: Instrumentation` — hooks for tracing, debugging, test runner integration\n\nAttribution is inherited from parent on construction. Instrumentation hooks include:\n`onBeforeCall`, `onAfterCall`, `onBeforeInputAction`, `onCallLog`, `onPageOpen/Close`, `onBrowserOpen/Close`, `onDialog`, `onDownload`.\n\n### Key Server Classes\n\n| Class | File | Purpose |\n|-------|------|---------|\n| `Playwright` | `playwright.ts` | Root entry point; creates BrowserTypes |\n| `BrowserType` | `browserType.ts` | Launches browser processes |\n| `Browser` | `browser.ts` | Abstract base; owns BrowserContexts |\n| `BrowserContext` | `browserContext.ts` | Isolation boundary; owns pages, cookies, routes |\n| `Page` | `page.ts` | Owns FrameManager, workers; delegates to `PageDelegate` |\n| `FrameManager` | `frames.ts` | Manages frame hierarchy |\n| `Frame` | `frames.ts` | Navigation, DOM queries, JavaScript evaluation |\n| `ElementHandle` | `dom.ts` | DOM element operations |\n| `ProgressController` | `progress.ts` | Wraps async operations with timeout/cancellation/logging |\n\n### PageDelegate Pattern\n\n`Page` delegates browser-specific operations to a `PageDelegate` interface:\n\n```typescript\ninterface PageDelegate {\n  navigateFrame(frame, url, referer): Promise<GotoResult>;\n  takeScreenshot(progress, format, ...): Promise<Buffer>;\n  adoptElementHandle(handle, to): Promise<ElementHandle>;\n  // ... more browser-specific operations\n}\n```\n\nImplementations:\n- `packages/playwright-core/src/server/chromium/crPage.ts` — uses CDP\n- `packages/playwright-core/src/server/firefox/ffPage.ts`\n- `packages/playwright-core/src/server/webkit/wkPage.ts`\n\n### Browser Engine Directories\n\n| Directory | Protocol | Key files |\n|-----------|----------|-----------|\n| `chromium/` | Chrome DevTools Protocol (CDP) | `crBrowser.ts`, `crPage.ts`, `crConnection.ts` |\n| `firefox/` | Firefox internal protocol | `ffBrowser.ts`, `ffPage.ts`, `ffConnection.ts` |\n| `webkit/` | WebKit internal protocol | `wkBrowser.ts`, `wkPage.ts`, `wkConnection.ts` |\n| `bidi/` | WebDriver BiDi | `bidiChromium.ts`, `bidiFirefox.ts` |\n| `android/` | ADB | `android.ts` |\n| `electron/` | Electron/CDP | `electron.ts` |\n\n## Dispatcher Layer\n\nDispathers do not implement things, they translate protocol to the server code calls.\n\n### Dispatcher — Base Class\n\n```\npackages/playwright-core/src/server/dispatchers/dispatcher.ts\n```\n\nDispatchers bridge server objects to the protocol. Each wraps an `SdkObject` and exposes methods matching the protocol channel.\n\n```typescript\nclass Dispatcher<Type extends SdkObject, ChannelType, ParentScopeType extends DispatcherScope>\n```\n\nKey properties:\n- `connection: DispatcherConnection` — the server-side connection\n- `_object: Type` — the wrapped server object\n- `_guid: string` — same GUID as the server object\n- `_type: string` — type name matching protocol\n- `_parent: ParentScopeType` — parent dispatcher\n- `_dispatchers: Map<string, DispatcherScope>` — child dispatchers\n\nKey methods:\n- `_dispatchEvent(method, params)` — sends event to client via `connection.sendEvent()`\n- `_runCommand(callMetadata, method, params)` — wraps method call in `ProgressController`, calls `this[method](params, progress)`\n- `_dispose()` — recursively disposes self and children, sends `__dispose__` to client\n- `adopt(child)` — reparents child dispatcher, sends `__adopt__` to client\n- `addObjectListener(event, handler)` — listens on wrapped server object, auto-cleaned on dispose\n\n### Dispatcher Creation Pattern\n\nDispatchers use a static factory to ensure one-dispatcher-per-object:\n\n```typescript\nstatic from(parentScope, object): XxxDispatcher {\n  return parentScope.connection.existingDispatcher<XxxDispatcher>(object) || new XxxDispatcher(parentScope, object);\n}\n```\n\nThe constructor sends `__create__` to the client with the initializer data.\n\n### DispatcherConnection\n\nServer-side counterpart to client's `Connection`:\n- `_dispatcherByGuid` — all dispatchers by GUID\n- `_dispatcherByObject` — maps server objects to their dispatchers (ensures 1:1)\n- `dispatch(message)` — validates params, creates `CallMetadata`, calls instrumentation hooks, runs dispatcher method, validates result, sends response\n- `sendCreate/sendAdopt/sendDispose/sendEvent` — lifecycle messages to client\n- GC: buckets with limits (JSHandle/ElementHandle: 100k, others: 10k); oldest 10% disposed when exceeded\n\n### Dispatcher Hierarchy\n\n```\nRootDispatcher\n└── PlaywrightDispatcher\n    ├── BrowserTypeDispatcher (per engine)\n    │   └── BrowserDispatcher\n    │       └── BrowserContextDispatcher\n    │           ├── PageDispatcher\n    │           │   ├── FrameDispatcher (main + child frames)\n    │           │   ├── WorkerDispatcher\n    │           │   └── ...\n    │           ├── TracingDispatcher\n    │           └── APIRequestContextDispatcher\n    ├── AndroidDispatcher\n    ├── ElectronDispatcher\n    └── LocalUtilsDispatcher\n```\n\n### Key Dispatcher Files\n\n| File | Dispatches for |\n|------|---------------|\n| `playwrightDispatcher.ts` | Playwright, BrowserType registration |\n| `browserTypeDispatcher.ts` | BrowserType (launch, connect) |\n| `browserDispatcher.ts` | Browser |\n| `browserContextDispatcher.ts` | BrowserContext |\n| `pageDispatcher.ts` | Page, Worker, BindingCall |\n| `frameDispatcher.ts` | Frame |\n| `networkDispatchers.ts` | Request, Response, Route, WebSocket, APIRequestContext |\n| `elementHandlerDispatcher.ts` | ElementHandle |\n| `jsHandleDispatcher.ts` | JSHandle |\n| `dialogDispatcher.ts` | Dialog |\n| `tracingDispatcher.ts` | Tracing |\n| `artifactDispatcher.ts` | Artifact |\n\n## End-to-End Flow Example\n\n`await page.goto('https://example.com')`:\n\n```\nCLIENT:\n  Page.goto()\n    → _wrapApiCall() captures stack trace, creates ApiZone\n      → _channel.goto({ url, timeout })\n        → Proxy validates PageGotoParams\n        → connection.sendMessageToServer(page, 'goto', params)\n          → sends { id: 1, guid: 'page@abc', method: 'goto', params: {...} }\n          → waits on callback promise\n\nSERVER:\n  DispatcherConnection.dispatch(message)\n    → validates PageGotoParams (wire → objects)\n    → creates CallMetadata\n    → instrumentation.onBeforeCall()\n    → PageDispatcher._runCommand('goto', params)\n      → ProgressController.run(progress => this.goto(params, progress))\n        → PageDispatcher.goto():  this._object.mainFrame().goto(progress, url, params)\n          → Frame.goto() → PageDelegate.navigateFrame() → CDP/protocol call\n    → validates PageGotoResult (objects → wire)\n    → instrumentation.onAfterCall()\n    → sends { id: 1, result: { response: { guid: 'response@xyz' } } }\n\nCLIENT:\n  connection.dispatch(response)\n    → validates PageGotoResult (wire → objects)\n    → resolves callback promise\n    → _wrapApiCall completes, returns Response object\n```\n\n## Object Lifecycle\n\n1. **Creation**: Server creates SdkObject → dispatcher constructor sends `__create__` → client `Connection.dispatch()` instantiates `ChannelOwner` subclass\n2. **Adoption**: `dispatcher.adopt(child)` sends `__adopt__` → client reparents the `ChannelOwner`\n3. **Disposal**: `dispatcher._dispose()` recursively disposes children → sends `__dispose__` → client removes `ChannelOwner` from maps\n4. **GC**: Server-side `maybeDisposeStaleDispatchers()` evicts oldest dispatchers per bucket when limits exceeded\n\n## Testing: tests/library vs tests/page\n\nTests live in two directories under `tests/`, each with distinct scope and fixtures.\n\n### tests/library — API and Feature Tests\n\nTests the **Playwright public API surface**, browser lifecycle, and feature-level behavior. Uses `browserTest` fixtures which provide direct access to `browser`, `browserType`, `context`, and `contextFactory`.\n\n```typescript\nimport { browserTest as test, expect } from '../config/browserTest';\n\ntest('should create new page', async ({ browser }) => {\n  const page = await browser.newPage();\n  expect(browser.contexts().length).toBe(1);\n  await page.close();\n});\n```\n\n**What belongs here:**\n- Browser and BrowserType API (`launch`, `connect`, `version`, `newContext`)\n- BrowserContext API (cookies, storage state, permissions, proxy, CSP, geolocation, network interception at context level)\n- Browser-specific features (`chromium/` for CDP, tracing, extensions, JS/CSS coverage, OOPIF; `firefox/` for launcher specifics)\n- Protocol and channel tests\n- Inspector, codegen, and recorder features (`inspector/`)\n- Event system tests (`events/`)\n- Unit tests for internal utilities (`unit/`)\n\n**Key fixtures** (from `browserTest`): `browser`, `browserType`, `context`, `contextFactory`, `launchPersistent`, `createUserDataDir`, `startRemoteServer`, `pageWithHar`.\n\n### tests/page — Page Interaction Tests\n\nTests **user-facing page interactions**: clicking, typing, navigation, locators, assertions, and DOM operations. Uses `pageTest` fixtures which provide a ready-to-use `page` plus test servers.\n\n```typescript\nimport { test as it, expect } from './pageTest';\n\nit('should click button', async ({ page, server }) => {\n  await page.goto(server.PREFIX + '/input/button.html');\n  await page.locator('button').click();\n  expect(await page.evaluate(() => window['result'])).toBe('Clicked');\n});\n```\n\n**What belongs here:**\n- Locator API (click, fill, type, select, query, filtering, convenience methods)\n- ElementHandle interactions (click, screenshot, selection, bounding box)\n- Expect/assertion matchers (boolean, text, value, accessibility)\n- Page navigation (`goto`, `waitForNavigation`, `waitForURL`)\n- Frame evaluation and hierarchy\n- Request/response interception at page level\n- JSHandle operations\n- Screenshot and visual comparison tests\n\n**Key fixtures** (from `pageTest`/`serverFixtures`): `page`, `server`, `httpsServer`, `proxyServer`, `asset`.\n\n### Decision Rule\n\n| Question | → Directory |\n|----------|-------------|\n| Does it test browser/context lifecycle or launch options? | `tests/library` |\n| Does it test a browser-specific protocol feature (CDP, etc.)? | `tests/library` |\n| Does it test user interaction with page content (click, type, assert)? | `tests/page` |\n| Does it test locators, selectors, or DOM queries? | `tests/page` |\n| Does the test need direct `browser` or `browserType` access? | `tests/library` |\n| Does the test just need a `page` and a test server? | `tests/page` |\n\n### Running Tests\n\n- `npm run ctest <file>` — runs on Chromium only (fast, use during development)\n- `npm run test <file>` — runs on all browsers (Chromium, Firefox, WebKit)\n\nExamples:\n```bash\nnpm run ctest tests/library/browsercontext-cookies.spec.ts\nnpm run ctest tests/page/locator-click.spec.ts\nnpm run test tests/library/browsercontext-cookies.spec.ts\n```\n\n### Configuration\n\nBoth directories share a single config at `tests/library/playwright.config.ts`. It creates separate projects (`{browserName}-library` and `{browserName}-page`) pointing to their respective `testDir`.\n", "skills/playwright-dev/tools.md": "# MCP Tools and CLI Commands\n\n## Adding MCP Tools\n\n### Step 1: Create the Tool File\n\nCreate `packages/playwright-core/src/tools/backend/<your-tool>.ts`.\n\nImport zod and use `defineTool` or `defineTabTool`:\n\n```typescript\nimport * as z from 'zod';\nimport { defineTool, defineTabTool } from './tool';\n```\n\n**Choose `defineTabTool` vs `defineTool`:**\n- `defineTabTool` — most tools use this. Receives a `Tab` object, auto-handles modal state (dialogs/file choosers).\n- `defineTool` — receives the full `Context`. Use when you need `context.currentBrowserContext()` (the current tab's browser context) without a specific tab, or need custom tab management.\n\n**Tool definition pattern:**\n\n```typescript\nconst myTool = defineTabTool({\n  capability: 'core',  // ToolCapability — see step 2\n\n  // Optional: only available in skill mode (not exposed via MCP)\n  // skillOnly: true,\n\n  // Optional: this tool clears a modal state ('dialog' | 'fileChooser')\n  // clearsModalState: 'dialog',\n\n  schema: {\n    name: 'browser_my_tool',       // MCP tool name (browser_ prefix)\n    title: 'My Tool',              // Human-readable title\n    description: 'Does something', // Description shown to LLM\n    inputSchema: z.object({\n      ref: z.string().describe('Element reference from snapshot'),\n      value: z.string().optional().describe('Optional value'),\n    }),\n    type: 'action',  // 'input' | 'assertion' | 'action' | 'readOnly'\n  },\n\n  handle: async (tab, params, response) => {\n    // Implementation using tab.page (Playwright Page object)\n    await tab.page.click(`[ref=\"${params.ref}\"]`);\n\n    // Add generated Playwright code\n    response.addCode(`await page.click('[ref=\"${params.ref}\"]');`);\n\n    // Include page snapshot in response (for navigation/state changes)\n    response.setIncludeSnapshot();\n\n    // Or add text result\n    response.addTextResult('Done');\n  },\n});\n\nexport default [myTool];\n```\n\n**Schema type values:**\n- `'action'` — state-changing operations (navigate, click, fill)\n- `'input'` — user input (typing, keyboard)\n- `'readOnly'` — queries that don't modify state (list cookies, get snapshot)\n- `'assertion'` — testing/verification tools\n\n**Response API:**\n- `response.addTextResult(text)` — add text to result section\n- `response.addError(error)` — add error message\n- `response.addCode(code)` — add generated Playwright code snippet\n- `response.setIncludeSnapshot()` — include ARIA snapshot in response\n- `response.setIncludeFullSnapshot(filename?)` — force full snapshot\n- `response.addResult(title, data, fileTemplate)` — add file result\n- `response.registerImageResult(data, 'png'|'jpeg')` — add image\n\n**Context tool example** (for browser-context-level operations):\n\n```typescript\nconst myContextTool = defineTool({\n  capability: 'storage',\n  schema: { /* ... */ type: 'readOnly' },\n\n  handle: async (context, params, response) => {\n    const browserContext = await context.currentBrowserContext();\n    const cookies = await browserContext.cookies();\n    response.addTextResult(cookies.map(c => `${c.name}=${c.value}`).join('\\n'));\n  },\n});\n```\n\n### Step 2: Add ToolCapability (if needed)\n\nIf your tool doesn't fit an existing capability, add a new one to `packages/playwright-core/src/tools/mcp/config.d.ts`:\n\n```typescript\nexport type ToolCapability =\n  'config' |\n  'core' |           // Always enabled\n  'core-navigation' | // Always enabled\n  'core-tabs' |      // Always enabled\n  'core-input' |     // Always enabled\n  'core-install' |   // Always enabled\n  'network' |\n  'pdf' |\n  'storage' |\n  'testing' |\n  'vision' |\n  'devtools';        // Add yours here\n```\n\n**Capability filtering rules:**\n- Tools with `core*` capabilities are always enabled\n- Other capabilities must be enabled via `--caps` or config `capabilities` array\n- `skillOnly: true` tools are only available in skill mode, never via MCP\n\n### Step 3: Register the Tool\n\nIn `packages/playwright-core/src/tools/backend/tools.ts`:\n\n```typescript\nimport myTool from './myTool';\n\nexport const browserTools: Tool<any>[] = [\n  // ... existing tools ...\n  ...myTool,\n];\n```\n\n### Step 4: Write Tests\n\nCreate `tests/mcp/<category>.spec.ts`. Use the fixtures from `./fixtures`:\n\n```typescript\nimport { test, expect } from './fixtures';\n\ntest('browser_my_tool', async ({ client, server }) => {\n  // Setup: navigate to a page first\n  await client.callTool({\n    name: 'browser_navigate',\n    arguments: { url: server.PREFIX },\n  });\n\n  // Call your tool\n  expect(await client.callTool({\n    name: 'browser_my_tool',\n    arguments: { ref: 'e1' },\n  })).toHaveResponse({\n    code: `await page.click('[ref=\"e1\"]');`,\n    snapshot: expect.stringContaining('some content'),\n  });\n});\n\ntest('browser_my_tool error case', async ({ client }) => {\n  expect(await client.callTool({\n    name: 'browser_my_tool',\n    arguments: { ref: 'invalid' },\n  })).toHaveResponse({\n    error: expect.stringContaining('Error:'),\n    isError: true,\n  });\n});\n```\n\n**Test fixtures:**\n- `client` — MCP client, call tools via `client.callTool({ name, arguments })`\n- `startClient(options?)` — client factory, for custom config/args/roots\n- `server` — HTTP test server (`server.PREFIX`, `server.HELLO_WORLD`, `server.setContent(path, html, contentType)`)\n- `httpsServer` — HTTPS test server\n\n**Custom matchers:**\n- `toHaveResponse({ code?, snapshot?, page?, error?, isError?, result?, events?, modalState? })` — matches parsed response sections\n- `toHaveTextResponse(text)` — matches raw text with normalization\n\n**Parsed response sections:**\n- `code` — generated Playwright code (without ```js fences)\n- `snapshot` — ARIA page snapshot (with ```yaml fences)\n- `page` — page info (URL, title)\n- `error` — error message\n- `result` — text result\n- `events` — console messages, downloads\n- `modalState` — active dialog/file chooser info\n- `tabs` — tab listing\n- `isError` — boolean\n\n### Testing MCP Tools\n- Run tests: `npm run ctest-mcp <category>`\n- Do not run `test --debug`\n\n---\n\n## Adding CLI Commands\n\nCLI commands are thin wrappers over MCP tools. They live in the daemon and map CLI args to MCP tool calls.\n\n### Step 1: Implement the MCP Tool\n\nImplement the corresponding MCP tool first (see section above). CLI commands call MCP tools via `toolName`/`toolParams`.\n\n### Step 2: Add the Command Declaration\n\nIn `packages/playwright-core/src/tools/cli-daemon/commands.ts`, use `declareCommand()`:\n\n```typescript\nimport * as z from 'zod';\nimport { declareCommand } from './command';\n\nconst myCommand = declareCommand({\n  name: 'my-command',           // CLI command name (kebab-case)\n  description: 'Does something', // Shown in help\n  category: 'core',             // Category for help grouping\n\n  // Positional arguments (ordered, parsed from CLI positional args)\n  args: z.object({\n    url: z.string().describe('The URL to navigate to'),\n    ref: z.string().optional().describe('Optional element reference'),\n  }),\n\n  // Named options (parsed from --flag or --flag=value)\n  options: z.object({\n    submit: z.boolean().optional().describe('Whether to submit'),\n    filename: z.string().optional().describe('Output filename'),\n  }),\n\n  // MCP tool name — string or function for dynamic routing\n  toolName: 'browser_my_tool',\n  // OR dynamic:\n  // toolName: ({ submit }) => submit ? 'browser_submit' : 'browser_type',\n\n  // Map CLI args/options to MCP tool params\n  toolParams: ({ url, ref, submit, filename }) => ({\n    url,\n    ref,\n    submit,\n    filename,\n  }),\n});\n```\n\nThen add to the `commandsArray` at the bottom of the file, in the correct category section:\n\n```typescript\nconst commandsArray: AnyCommandSchema[] = [\n  // core category\n  open,\n  close,\n  // ... existing commands ...\n  myCommand,   // <-- add here in the right category\n  // ...\n];\n```\n\n**Categories** (defined in `packages/playwright-core/src/tools/cli-daemon/command.ts`):\n\n```typescript\ntype Category = 'core' | 'navigation' | 'keyboard' | 'mouse' | 'export' |\n                'storage' | 'tabs' | 'network' | 'devtools' | 'browsers' |\n                'config' | 'install';\n```\n\nTo add a new category:\n1. Add it to `Category` type in `packages/playwright-core/src/tools/cli-daemon/command.ts`\n2. Add it to the `categories` array in `packages/playwright-core/src/tools/cli-daemon/helpGenerator.ts`:\n   ```typescript\n   const categories: { name: Category, title: string }[] = [\n     // ... existing ...\n     { name: 'mycat', title: 'My Category' },\n   ];\n   ```\n\n**Special tool patterns:**\n- `toolName: ''` — command handled specially by daemon (e.g., `close`, `list`, `install`)\n- Use `numberArg` for numeric CLI args: `x: numberArg.describe('X coordinate')`\n- Param renaming: `toolParams: ({ w: width, h: height }) => ({ width, height })`\n- Dynamic toolName: `toolName: ({ clear }) => clear ? 'browser_clear' : 'browser_list'`\n\n### Step 3: Update SKILL File\n\nUpdate `packages/playwright-core/src/tools/skills/playwright-cli/SKILL.md` with the new command documentation.\nAdd reference docs in `packages/playwright-core/src/tools/skills/playwright-cli/references/` if the feature is complex.\n\nRun `npm run playwright-cli -- --help` to verify the help output includes your new command.\n\n### Step 4: Write CLI Tests\n\nCreate `tests/mcp/cli-<category>.spec.ts`. Use fixtures from `./cli-fixtures`:\n\n```typescript\nimport { test, expect } from './cli-fixtures';\n\ntest('my-command', async ({ cli, server }) => {\n  // Open a page first\n  await cli('open', server.PREFIX);\n\n  // Run your command\n  const { output, snapshot } = await cli('my-command', 'arg1', '--option=value');\n  expect(output).toContain('expected text');\n  expect(snapshot).toContain('expected snapshot content');\n});\n```\n\n**CLI test fixtures:**\n- `cli(...args)` — run CLI command, returns `{ output, error, exitCode, snapshot, attachments }`\n  - `output` — stdout text\n  - `snapshot` — extracted ARIA snapshot (if present)\n  - `attachments` — file attachments `{ name, data }[]`\n  - `error` — stderr text\n  - `exitCode` — process exit code\n\n### Testing CLI Commands\n- Run tests: `npm run ctest-mcp cli-<category>`\n- Do not run `test --debug`\n\n---\n\n### Embedding the CLI Client\n\nThe `playwright-core/lib/tools/cli-client/program` entry point exports `parseArgs(argv)`\nand `program(options?)`. An embedder can parse once, inspect `args._[0]`, then call\n`program({ args, embedderVersion })`. `parseArgs` uses the CLI's boolean options and normalizes\n`-s` to `session` and `-g` to `global`. Without `args`, `program` parses\n`process.argv.slice(2)` as usual. `program` can mutate `args`, so inspect it before the call.\n\n## Adding Config Options\n\nWhen you need to add a new config option, update these files in order:\n\n### 1. Type definition: `packages/playwright-core/src/tools/mcp/config.d.ts`\n\nAdd the option to the `Config` type with JSDoc:\n\n```typescript\nexport type Config = {\n  // ... existing ...\n\n  /**\n   * Description of the new option.\n   */\n  myOption?: string;\n};\n```\n\n### 2. CLI options type: `packages/playwright-core/src/tools/mcp/config.ts`\n\nAdd to `CLIOptions` type:\n\n```typescript\nexport type CLIOptions = {\n  // ... existing ...\n  myOption?: string;\n};\n```\n\nIf the option needs to be in `FullConfig` (with required/resolved values), update `FullConfig` and `defaultConfig`:\n\n```typescript\nexport type FullConfig = Config & {\n  // ... existing ...\n  myOption: string;  // required in resolved config\n};\n\nexport const defaultConfig: FullConfig = {\n  // ... existing ...\n  myOption: 'default-value',\n};\n```\n\n### 3. Config from CLI: `configFromCLIOptions()` in `config.ts`\n\nMap CLI option to config:\n\n```typescript\nconst config: Config = {\n  // ... existing ...\n  myOption: cliOptions.myOption,\n};\n```\n\n### 4. Config from env: `configFromEnv()` in `config.ts`\n\nAdd environment variable mapping:\n\n```typescript\noptions.myOption = envToString(process.env.PLAYWRIGHT_MCP_MY_OPTION);\n// For booleans: envToBoolean(process.env.PLAYWRIGHT_MCP_MY_OPTION)\n// For numbers: numberParser(process.env.PLAYWRIGHT_MCP_MY_OPTION)\n// For comma lists: commaSeparatedList(process.env.PLAYWRIGHT_MCP_MY_OPTION)\n// For semicolon lists: semicolonSeparatedList(process.env.PLAYWRIGHT_MCP_MY_OPTION)\n```\n\n### 5. MCP server CLI: `packages/playwright-core/src/tools/mcp/program.ts`\n\nAdd CLI flag:\n\n```typescript\ncommand\n  .option('--my-option <value>', 'description of option')\n```\n\n### 6. Merge config (if nested)\n\nIf the option is nested, update `mergeConfig()` in `config.ts` to deep-merge it.\n\n**Config resolution order:** `defaultConfig` → config file → env vars → CLI args (last wins).\n\n---\n\n## SKILL File\n\nThe skill file is located at `packages/playwright-core/src/tools/skills/playwright-cli/SKILL.md`. It contains documentation for all available CLI commands and MCP tools. Update it whenever you add new commands or tools.\n\nReference docs live in `packages/playwright-core/src/tools/skills/playwright-cli/references/`:\n- `request-mocking.md` — network mocking patterns\n- `running-code.md` — code execution\n- `session-management.md` — session handling\n- `storage-state.md` — state persistence\n- `test-generation.md` — test creation\n- `tracing.md` — trace recording\n- `video-recording.md` — video capture\n\nRun `npm run playwright-cli -- --help` to see the latest available commands and use them to update the skill file.\n\n---\n\n## Architecture Reference\n\n### Directory Structure\n\n```\npackages/playwright-core/src/tools/\n├── backend/                  # All MCP tool implementations\n│   ├── tool.ts               # Tool/TabTool types, defineTool(), defineTabTool()\n│   ├── tools.ts              # Tool registry (browserTools array, filteredTools)\n│   ├── browserBackend.ts     # Browser backend\n│   ├── context.ts            # Browser context management\n│   ├── tab.ts                # Tab management\n│   ├── response.ts           # Response class, parseResponse()\n│   ├── common.ts             # close, resize\n│   ├── navigate.ts           # navigate, goBack, goForward, reload\n│   ├── snapshot.ts           # page snapshot\n│   ├── form.ts               # click, type, fill, select, check\n│   ├── keyboard.ts           # press, keydown, keyup\n│   ├── mouse.ts              # mouse move, click, wheel\n│   ├── tabs.ts               # tab management\n│   ├── cookies.ts            # cookie CRUD\n│   ├── webstorage.ts         # localStorage, sessionStorage\n│   ├── storage.ts            # storage state save/load\n│   ├── network.ts            # network requests listing\n│   ├── route.ts              # request mocking/routing\n│   ├── console.ts            # console messages\n│   ├── evaluate.ts           # JS evaluation\n│   ├── screenshot.ts         # screenshots\n│   ├── pdf.ts                # PDF generation\n│   ├── files.ts              # file upload\n│   ├── dialogs.ts            # dialog handling\n│   ├── verify.ts             # assertions\n│   ├── wait.ts               # wait operations\n│   ├── tracing.ts            # trace recording\n│   ├── video.ts              # video recording\n│   ├── runCode.ts            # run Playwright code\n│   ├── devtools.ts           # DevTools integration\n│   ├── config.ts             # config tool\n│   └── utils.ts              # shared utilities\n├── mcp/                      # MCP server\n│   ├── config.d.ts           # Config type, ToolCapability type\n│   ├── config.ts             # Config resolution, CLIOptions, FullConfig\n│   ├── program.ts            # MCP server CLI setup\n│   ├── index.ts              # MCP server entry\n│   ├── browserFactory.ts     # Browser factory\n│   ├── extensionContextFactory.ts\n│   ├── watchdog.ts           # Watchdog\n│   └── log.ts                # Logging\n├── cli-client/               # CLI client\n│   ├── program.ts            # CLI client entry (argument parsing)\n│   ├── session.ts            # Session management\n│   └── registry.ts           # Session registry\n├── cli-daemon/               # CLI daemon\n│   ├── command.ts            # Category type, CommandSchema, declareCommand(), parseCommand()\n│   ├── commands.ts           # All CLI command declarations\n│   ├── helpGenerator.ts      # Help text generation (generateHelp, generateHelpJSON)\n│   ├── daemon.ts             # Daemon server\n│   └── program.ts            # Daemon program entry\n├── dashboard/                # Dashboard UI\n│   ├── dashboardApp.ts       # Dashboard app\n│   └── dashboardController.ts\n├── utils/\n│   ├── socketConnection.ts   # Socket connection utilities\n│   └── mcp/                  # MCP SDK utilities\n│       ├── server.ts         # MCP server wrapper\n│       ├── tool.ts           # ToolSchema type, toMcpTool()\n│       └── http.ts           # HTTP utilities\n├── index.ts                  # Public exports\n└── skills/\n    └── playwright-cli/\n        ├── SKILL.md          # Skill documentation\n        └── references/       # Reference docs\n\ntests/mcp/\n├── fixtures.ts               # MCP test fixtures (client, startClient, server)\n├── cli-fixtures.ts           # CLI test fixtures (cli helper)\n├── <category>.spec.ts        # MCP tool tests\n└── cli-<category>.spec.ts    # CLI command tests\n```\n\n### Execution Flow\n\n```\nMCP Server mode:\n  LLM → MCP protocol → Server.callTool(name, args)\n    → zod validates input → Tool.handle(context|tab, params, response)\n    → response.serialize() → MCP protocol → LLM\n\nCLI mode:\n  User → `playwright-cli my-command arg1 --opt=val`\n    → Client parses with minimist → sends to Daemon via socket\n    → parseCommand() maps CLI args to MCP tool params via zod\n    → backend.callTool(toolName, toolParams)\n    → Response formatted → printed to stdout\n```\n", "skills/playwright-dev/trace_system_guide.md": "# Playwright Trace System - Comprehensive Guide\n\n## 1. Overview\n\nThe Playwright trace system is a comprehensive recording and visualization framework that captures:\n- **Actions** (API calls, user interactions)\n- **Network traffic** (HAR format)\n- **Snapshots** (DOM snapshots at key moments)\n- **Screencast frames** (video of page rendering)\n- **Console messages** and events\n- **Errors** and logs\n- **Resources** (images, stylesheets, scripts, etc.)\n\n---\n\n## 2. File Structure\n\n### packages/isomorphic/trace/ - Trace Type Definitions\n\n**Key Files:**\n- **trace.ts** - Current trace event and snapshot types; re-exports the latest version\n- **versions/** - One file per trace format version, plus legacy formats kept for modernization\n- **versions/har.ts** - HTTP Archive format (network traffic)\n\n**File List:**\n```\nisomorphic/trace/\n├── trace.ts                - Current trace event + snapshot types (re-export)\n└── versions/\n    ├── traceV*.ts          - Per-version trace event types\n    └── har.ts              - HAR format types\n```\n\n---\n\n## 3. Trace Event Types (trace.ts)\n\n### 3.1 Core Event Types\n\n**VERSION: 8** (Current format version)\n\n#### ContextCreatedTraceEvent\n```typescript\ntype ContextCreatedTraceEvent = {\n  version: number,\n  type: 'context-options',\n  origin: 'testRunner' | 'library',\n  browserName: string,\n  channel?: string,\n  platform: string,\n  playwrightVersion?: string,\n  wallTime: number,  // Milliseconds since epoch\n  monotonicTime: number,  // Internal monotonic clock\n  title?: string,\n  options: BrowserContextEventOptions,\n  sdkLanguage?: Language,\n  testIdAttributeName?: string,\n  contextId?: string,\n  testTimeout?: number,\n};\n```\n\n#### BeforeActionTraceEvent\nEmitted when an action starts:\n```typescript\ntype BeforeActionTraceEvent = {\n  type: 'before',\n  callId: string,           // Unique action identifier\n  startTime: number,        // Monotonic time when action started\n  title?: string,           // User-facing action name\n  class: string,            // API class (e.g., 'Page', 'Frame')\n  method: string,           // API method (e.g., 'click', 'goto')\n  params: Record<string, any>,  // Method parameters\n  stepId?: string,          // Test step identifier\n  beforeSnapshot?: string,  // \"before@<callId>\"\n  stack?: StackFrame[],     // Call stack\n  pageId?: string,          // Associated page ID\n  parentId?: string,        // Parent action (for nested actions)\n  group?: string,           // Action group (e.g., 'wait', 'click')\n};\n```\n\n#### InputActionTraceEvent\nFor input/pointer interactions:\n```typescript\ntype InputActionTraceEvent = {\n  type: 'input',\n  callId: string,\n  inputSnapshot?: string,   // \"input@<callId>\"\n  point?: Point,            // Mouse/pointer coordinates\n};\n```\n\n#### AfterActionTraceEvent\nEmitted when an action completes:\n```typescript\ntype AfterActionTraceEvent = {\n  type: 'after',\n  callId: string,\n  endTime: number,          // Monotonic time when action ended\n  afterSnapshot?: string,   // \"after@<callId>\"\n  error?: SerializedError,  // Error if action failed\n  attachments?: AfterActionTraceEventAttachment[],  // Files, screenshots\n  annotations?: AfterActionTraceEventAnnotation[],  // Custom annotations\n  result?: any,             // Return value\n  point?: Point,            // Final pointer position\n};\n```\n\n#### ActionTraceEvent (Composite)\nCombines before, after, and input events:\n```typescript\ntype ActionTraceEvent = {\n  type: 'action',\n} & Omit<BeforeActionTraceEvent, 'type'>\n  & Omit<AfterActionTraceEvent, 'type'>\n  & Omit<InputActionTraceEvent, 'type'>;\n```\n\n#### Other Event Types\n\n**ScreencastFrameTraceEvent** - Video frame data\n```typescript\ntype ScreencastFrameTraceEvent = {\n  type: 'screencast-frame',\n  pageId: string,\n  sha1: string,             // Resource SHA1\n  width: number,            // Frame width\n  height: number,           // Frame height\n  timestamp: number,        // Frame timestamp\n  frameSwapWallTime?: number,\n};\n```\n\n**EventTraceEvent** - Browser events (dialog, navigation, etc.)\n```typescript\ntype EventTraceEvent = {\n  type: 'event',\n  time: number,\n  class: string,            // Event source class\n  method: string,           // Event method\n  params: any,              // Event parameters\n  pageId?: string,\n};\n```\n\n**ConsoleMessageTraceEvent** - Console output\n```typescript\ntype ConsoleMessageTraceEvent = {\n  type: 'console',\n  time: number,\n  pageId?: string,\n  messageType: string,      // 'log', 'error', 'warn', etc.\n  text: string,\n  args?: { preview: string, value: any }[],\n  location: { url: string, lineNumber: number, columnNumber: number },\n};\n```\n\n**LogTraceEvent** - Action logs\n```typescript\ntype LogTraceEvent = {\n  type: 'log',\n  callId: string,\n  time: number,\n  message: string,\n};\n```\n\n**ResourceSnapshotTraceEvent** - Network request\n```typescript\ntype ResourceSnapshotTraceEvent = {\n  type: 'resource-snapshot',\n  snapshot: ResourceSnapshot,  // HAR Entry\n};\n```\n\n**FrameSnapshotTraceEvent** - DOM snapshot\n```typescript\ntype FrameSnapshotTraceEvent = {\n  type: 'frame-snapshot',\n  snapshot: FrameSnapshot,\n};\n```\n\n**StdioTraceEvent** - Process output (stdout/stderr)\n```typescript\ntype StdioTraceEvent = {\n  type: 'stdout' | 'stderr',\n  timestamp: number,\n  text?: string,\n  base64?: string,  // Binary output\n};\n```\n\n**ErrorTraceEvent** - Unhandled errors\n```typescript\ntype ErrorTraceEvent = {\n  type: 'error',\n  message: string,\n  stack?: StackFrame[],\n};\n```\n\n---\n\n## 4. HAR Format (versions/har.ts)\n\nFollows HTTP Archive 1.2 specification. Key structure for network traffic:\n\n```typescript\ntype HARFile = {\n  log: Log,\n};\n\ntype Log = {\n  version: string,\n  creator: Creator,\n  browser?: Browser,\n  pages?: Page[],\n  entries: Entry[],  // Network requests\n};\n\ntype Entry = {\n  pageref?: string,\n  startedDateTime: string,\n  time: number,  // Total time (ms)\n  request: Request,\n  response: Response,\n  cache: Cache,\n  timings: Timings,\n  serverIPAddress?: string,\n  connection?: string,\n  // Custom Playwright fields:\n  _frameref?: string,\n  _monotonicTime?: number,\n  _serverPort?: number,\n  _securityDetails?: SecurityDetails,\n  _wasAborted?: boolean,\n  _wasFulfilled?: boolean,\n  _wasContinued?: boolean,\n  _apiRequest?: boolean,  // True for fetch/axios requests\n};\n```\n\n---\n\n## 5. Snapshot Format (trace.ts)\n\n### FrameSnapshot\n```typescript\ntype FrameSnapshot = {\n  snapshotName?: string,\n  callId: string,           // Associated action\n  pageId: string,\n  frameId: string,\n  frameUrl: string,\n  timestamp: number,\n  wallTime?: number,\n  collectionTime: number,   // Time to capture\n  doctype?: string,\n  html: NodeSnapshot,       // Encoded DOM tree\n  resourceOverrides: ResourceOverride[],  // Inlined resources\n  viewport: { width: number, height: number },\n  isMainFrame: boolean,\n};\n```\n\n### NodeSnapshot\nCompact encoding of DOM tree:\n```typescript\ntype NodeSnapshot =\n  TextNodeSnapshot |                    // string\n  SubtreeReferenceSnapshot |            // [ [snapshotIndex, nodeIndex] ]\n  NodeNameAttributesChildNodesSnapshot; // [ name, attributes?, ...children ]\n```\n\n### ResourceOverride\nEmbeds resource data in snapshot:\n```typescript\ntype ResourceOverride = {\n  url: string,\n  sha1?: string,  // External resource SHA1\n  ref?: number    // Snapshot index reference\n};\n```\n\n---\n\n## 6. Trace Storage Format\n\n### File Structure\nWhen a trace is recorded, it creates this structure in the traces directory:\n\n```\ntraces-dir/\n├── <traceName>.trace        # Main events (JSONL format)\n├── <traceName>.network      # Network events (JSONL format)\n├── <traceName>-chunk1.trace # Additional chunks (if multiple)\n├── <traceName>.stacks       # Stack trace metadata (optional)\n└── resources/\n    ├── <sha1>               # Resource files (images, etc.)\n    └── <sha1>\n```\n\n### File Formats\n- **`.trace` and `.network`**: JSONL (JSON Lines) - one event per line\n- **`.zip`**: Optional archive containing all above files\n- **`resources/`**: Binary blobs indexed by SHA1 hash\n\n### Live Trace Format\nFor live tracing (test runner):\n```\ntraces-dir/\n├── <testName>.json     # Synthesized trace metadata\n├── <testName>/\n    ├── events.jsonl\n    ├── network.jsonl\n    └── resources/\n```\n\n---\n\n## 7. Trace Recording (tracing.ts)\n\nLocated: `packages/playwright-core/src/server/trace/recorder/tracing.ts`\n\n### Tracing Class Architecture\n\n```typescript\nexport class Tracing extends SdkObject implements \n  InstrumentationListener,\n  SnapshotterDelegate,\n  HarTracerDelegate {\n  \n  // Recording state\n  private _state: RecordingState;\n  \n  // Components\n  private _snapshotter?: Snapshotter;      // Captures DOM snapshots\n  private _harTracer: HarTracer;           // Records network requests\n  private _screencastListeners: ...        // Video recording\n  \n  // Methods\n  start(options: TracerOptions);\n  startChunk(progress, options);\n  stopChunk(progress, params);\n  stop(progress);\n}\n```\n\n### What Gets Recorded\n\n**1. Before Action (`onBeforeCall`)**\n- Action metadata: class, method, parameters\n- Stack trace\n- \"before\" DOM snapshot\n- Associated page/frame IDs\n\n**2. Input Actions (`onBeforeInputAction`)**\n- Pointer coordinates\n- Input type\n- Snapshot of input\n\n**3. Action Logs (`onCallLog`)**\n- API log messages\n- User-facing messages\n\n**4. After Action (`onAfterCall`)**\n- Execution time\n- Return value\n- Error information (if failed)\n- \"after\" DOM snapshot\n- Attachments (screenshots, files)\n- Annotations (custom data)\n\n**5. Network Traffic (`onEntryFinished`)**\n- HTTP request/response details\n- Headers, cookies, body\n- Timing information\n- Security details\n\n**6. Snapshots (`onFrameSnapshot`, `onSnapshotterBlob`)**\n- Full DOM tree with inlined resources\n- Viewport size\n- Resource references\n\n**7. Console Messages (`onConsoleMessage`)**\n- Message type (log, error, warn)\n- Text content\n- Arguments\n- Source location\n\n**8. Events** \n- Dialogs\n- Page errors\n- Navigation events\n- Downloads\n\n**9. Screencast Frames**\n- Video frames (if screenshots enabled)\n- Frame dimensions\n- Timestamps\n\n**10. Stdio/Errors**\n- stdout/stderr output\n- Unhandled errors\n- Process events\n\n### Recording State\n```typescript\ntype RecordingState = {\n  options: TracerOptions,\n  traceName: string,\n  networkFile: string,\n  traceFile: string,\n  tracesDir: string,\n  resourcesDir: string,\n  chunkOrdinal: number,\n  networkSha1s: Set<string>,\n  traceSha1s: Set<string>,\n  recording: boolean,\n  callIds: Set<string>,\n  groupStack: string[],  // For nested groups\n};\n```\n\n---\n\n## 8. Trace Loading (traceLoader.ts)\n\nLocated: `packages/isomorphic/trace/traceLoader.ts`\n\n### TraceLoaderBackend Interface\n```typescript\ninterface TraceLoaderBackend {\n  entryNames(): Promise<string[]>;           // List files in trace\n  hasEntry(entryName: string): Promise<boolean>;\n  readText(entryName: string): Promise<string | undefined>;  // For JSONL\n  readBlob(entryName: string): Promise<Blob | undefined>;    // For resources\n  isLive(): boolean;  // Is this a live/developing trace?\n}\n```\n\n### Built-in Backends\n\n**ZipTraceLoaderBackend** (traceParser.ts)\n- Loads `.trace.zip` files\n- Uses ZipFile utility to read entries\n- Converts file paths to file:// URLs\n\n### Load Process\n```typescript\nasync load(backend: TraceLoaderBackend, unzipProgress) {\n  1. Find .trace files (ordinals: \"0\", \"1\", etc.)\n  2. For each ordinal:\n     a. Read ordinal.trace (events)\n     b. Read ordinal.network (network events)\n     c. Parse with TraceModernizer\n     d. Read ordinal.stacks (if exists)\n     e. Sort actions by startTime\n  3. Terminate incomplete actions\n  4. Finalize snapshot storage\n  5. Build resource content-type map\n  6. Push ContextEntry to contextEntries[]\n}\n```\n\n### Output: ContextEntry[]\n```typescript\ntype ContextEntry = {\n  origin: 'testRunner' | 'library',\n  startTime: number,      // Min action startTime\n  endTime: number,        // Max action endTime\n  browserName: string,\n  wallTime: number,\n  sdkLanguage?: Language,\n  testIdAttributeName?: string,\n  title?: string,\n  options: BrowserContextEventOptions,\n  pages: PageEntry[],      // Screencast data\n  resources: ResourceSnapshot[],  // HAR entries\n  actions: ActionEntry[],   // Merged before/after events\n  events: EventTraceEvent[],\n  stdio: StdioTraceEvent[],\n  errors: ErrorTraceEvent[],\n  hasSource: boolean,\n  contextId: string,\n  testTimeout?: number,\n};\n```\n\n---\n\n## 9. Trace Model (traceModel.ts)\n\nLocated: `packages/isomorphic/trace/traceModel.ts`\n\n### TraceModel Class\nHigh-level data model for trace viewer:\n\n```typescript\nclass TraceModel {\n  // Metadata\n  startTime: number;\n  endTime: number;\n  browserName: string;\n  channel?: string;\n  platform?: string;\n  playwrightVersion?: string;\n  wallTime?: number;\n  title?: string;\n  options: BrowserContextEventOptions;\n  sdkLanguage: Language;\n  testIdAttributeName?: string;\n  traceUri: string;  // URL to trace\n  testTimeout?: number;\n\n  // Data arrays\n  pages: PageEntry[];          // Page screencast data\n  actions: ActionTraceEventInContext[];  // All recorded actions\n  attachments: Attachment[];   // Screenshots, files\n  visibleAttachments: Attachment[];  // Non-private attachments\n  events: (EventTraceEvent | ConsoleMessageTraceEvent)[];\n  stdio: StdioTraceEvent[];\n  errors: ErrorTraceEvent[];\n  resources: ResourceEntry[];  // Network resources\n  sources: Map<string, SourceModel>;  // Source code\n  errorDescriptors: ErrorDescription[];  // Parsed errors\n  \n  // Counters\n  actionCounters: Map<string, number>;  // Actions per group\n  hasSource: boolean;         // Has source code available\n  hasStepData: boolean;       // Has test runner data\n  \n  // Methods\n  createRelativeUrl(path: string): string;\n  failedAction(): ActionTraceEventInContext;\n  filteredActions(actionsFilter: ActionGroup[]): ActionTraceEventInContext[];\n}\n```\n\n### ActionTraceEventInContext\n```typescript\ntype ActionTraceEventInContext = ActionEntry & {\n  context: ContextEntry,\n  group?: ActionGroup,  // Added by TraceModel\n  log: { time: number, message: string }[],\n};\n```\n\n---\n\n## 10. Trace Modernizer (traceModernizer.ts)\n\nLocated: `packages/isomorphic/trace/traceModernizer.ts`\n\n### Version Support\n- **Latest:** Version 8\n- **Supported:** Versions 3-8\n- Upgrades older traces to current format\n\n### TraceModernizer Class\n```typescript\nclass TraceModernizer {\n  constructor(contextEntry: ContextEntry, snapshotStorage: SnapshotStorage);\n  \n  appendTrace(trace: string);  // Parse JSONL trace lines\n  actions(): ActionEntry[];    // Get parsed actions\n  \n  private _modernize(event: any);  // Upgrade event to latest version\n  private _innerAppendEvent(event: TraceEvent);  // Process event\n}\n```\n\n### How It Works\n1. Parses JSONL (one JSON object per line)\n2. Detects trace version from first `context-options` event\n3. Applies version-specific upgrades using `_modernize_N_to_N+1()` functions\n4. Consolidates before/after events into unified actions\n5. Builds dependency graph for nested actions\n6. Stores snapshots in SnapshotStorage\n\n---\n\n## 11. Trace Viewer\n\nLocated: `packages/trace-viewer/src/`\n\n### Structure\n```\ntrace-viewer/src/\n├── index.tsx              # Entry point\n├── sw-main.ts             # Service worker\n└── ui/\n    ├── workbench.tsx      # Main UI component\n    ├── actionList.tsx     # Action timeline\n    ├── callTab.tsx        # Action details\n    ├── snapshotTab.tsx    # DOM snapshot viewer\n    ├── networkTab.tsx     # Network waterfall\n    ├── consoleTab.tsx     # Console messages\n    ├── timeline.tsx       # Time-based view\n    ├── filmStrip.tsx      # Video frames\n    ├── logTab.tsx         # Action logs\n    ├── attachmentsTab.tsx # Files, screenshots\n    ├── playbackControl.tsx # Video playback\n    └── [other tabs...]\n```\n\n### Data Flow\n1. **Service Worker (`sw-main.ts`)** - Intercepts trace URL fetch\n2. **Workbench Loader** - Loads trace via TraceLoader\n3. **TraceModel** - Parses and indexes loaded data\n4. **UI Components** - Display actions, snapshots, network, etc.\n5. **Playback Control** - Synchronizes timeline with snapshots\n\n### Key Data Models\n- **TraceModel** - Loaded and parsed trace data\n- **ActionTraceEventInContext** - Single action with context\n- **Attachment** - File or screenshot data\n- **SourceModel** - Source code + errors\n\n---\n\n## 12. CLI Commands\n\nLocated: `packages/playwright-core/src/cli/program.ts`\n\n### show-trace Command\n```bash\nplaywright show-trace [trace] [options]\n\nOptions:\n  -b, --browser <browserType>   Browser to use (chromium, firefox, webkit)\n  -h, --host <host>            Host to serve on\n  -p, --port <port>            Port to serve on (0 = any free port)\n  --stdin                       Accept trace URLs over stdin\n  \nExamples:\n  $ show-trace\n  $ show-trace https://example.com/trace.zip\n  $ show-trace /path/to/trace.zip\n  $ show-trace /path/to/trace/dir\n```\n\n### Implementation (program.ts: 327-355)\n```typescript\nprogram\n  .command('show-trace [trace]')\n  .option('-b, --browser <browserType>', ..., 'chromium')\n  .option('-h, --host <host>', 'Host to serve trace on')\n  .option('-p, --port <port>', 'Port to serve trace on')\n  .option('--stdin', 'Accept trace URLs over stdin')\n  .description('show trace viewer')\n  .action(function(trace, options) {\n    const openOptions: TraceViewerServerOptions = {\n      host: options.host,\n      port: +options.port,\n      isServer: !!options.stdin,\n    };\n    \n    if (options.port !== undefined || options.host !== undefined)\n      runTraceInBrowser(trace, openOptions);  // Opens in browser tab\n    else\n      runTraceViewerApp(trace, options.browser, openOptions);  // Opens in app window\n  });\n```\n\n### Trace Viewer Server (traceViewer.ts)\n```typescript\nstartTraceViewerServer(options?: TraceViewerServerOptions): Promise<HttpServer>\n  // Routes:\n  // GET /trace/file?path=<filePath>        → Serve trace file\n  // GET /trace/file?path=<path>.json       → Synthesize trace metadata\n  // GET /trace/file?path=<traceDir>/...    → Serve trace.dir contents\n  // GET /trace/<other>                     → Serve viewer assets\n\nrunTraceViewerApp(traceUrl, browserName, options)\n  // Opens trace viewer in persistent browser context\n\nrunTraceInBrowser(traceUrl, options)\n  // Opens trace viewer in browser tab (tab.open)\n```\n\n---\n\n## 13. Data Available Per Action\n\n### Per-Action Data Structure\n```typescript\nActionTraceEventInContext {\n  // Identifiers\n  callId: string;           // Unique action ID\n  pageId?: string;          // Associated page\n  parentId?: string;        // Parent action (nested)\n  stepId?: string;          // Test step ID\n  group?: ActionGroup;      // Action category\n  \n  // Timing\n  startTime: number;        // Monotonic time (milliseconds)\n  endTime: number;          // When action completed\n  \n  // API Information\n  class: string;            // Class name (Page, Frame, etc.)\n  method: string;           // Method name (click, goto, etc.)\n  params: Record<string, any>;  // Input parameters\n  result?: any;             // Return value\n  \n  // Code Location\n  stack?: StackFrame[];     // Call stack with file/line/column\n  title?: string;           // User-facing name\n  \n  // Snapshots\n  beforeSnapshot?: string;  // \"before@<callId>\" reference\n  inputSnapshot?: string;   // \"input@<callId>\" reference\n  afterSnapshot?: string;   // \"after@<callId>\" reference\n  \n  // Errors\n  error?: SerializedError;  // Error message and stack\n  \n  // Logging\n  log: { time: number, message: string }[];  // Action logs\n  \n  // Attachments\n  attachments?: AfterActionTraceEventAttachment[];\n  // { name, contentType, path?, sha1?, base64? }\n  \n  // Annotations\n  annotations?: AfterActionTraceEventAnnotation[];\n  // { type, description? }\n  \n  // Interaction Details\n  point?: Point;            // Pointer coordinates {x, y}\n  \n  // Reference\n  context: ContextEntry;    // Associated browser context\n}\n```\n\n### Snapshot Data\nEach snapshot can be accessed via `TraceLoader.storage()`:\n```typescript\nFrameSnapshot {\n  callId: string,              // Associated action\n  pageId: string,\n  frameId: string,\n  frameUrl: string,\n  html: NodeSnapshot,          // Encoded DOM tree\n  resourceOverrides: [         // Embedded resources\n    { url, sha1?, ref? }\n  ],\n  viewport: { width, height },\n  isMainFrame: boolean,\n  collectionTime: number,      // ms to capture\n  timestamp: number,           // Monotonic time\n  wallTime?: number,\n}\n```\n\n### Network Data (HAR Entry)\n```typescript\nEntry {\n  request: {\n    method: string,        // GET, POST, etc.\n    url: string,\n    httpVersion: string,\n    headers: Header[],\n    cookies: Cookie[],\n    queryString: { name, value }[],\n    postData?: {\n      mimeType: string,\n      params: Param[],\n      text: string,\n      _sha1?: string,      // Reference to resources/\n    },\n  },\n  response: {\n    status: number,        // 200, 404, etc.\n    statusText: string,\n    headers: Header[],\n    cookies: Cookie[],\n    content: {\n      size: number,\n      mimeType: string,\n      text?: string,\n      _sha1?: string,      // Reference to resources/\n      compression?: number,\n    },\n    redirectURL: string,\n  },\n  timings: {               // All in milliseconds\n    blocked?: number,\n    dns?: number,\n    connect?: number,\n    send: number,\n    wait: number,          // Time to first byte\n    receive: number,\n    ssl?: number,\n  },\n  time: number,            // Total time\n  _monotonicTime?: number, // Monotonic timestamp\n  _wasFulfilled?: boolean,\n  _wasAborted?: boolean,\n  _apiRequest?: boolean,   // fetch/axios\n}\n```\n\n---\n\n## 14. Quick Reference: Accessing Trace Data\n\n### In Trace Viewer\n```typescript\n// Load trace\nconst traceLoader = new TraceLoader();\nconst backend = new ZipTraceLoaderBackend('trace.zip');\nawait traceLoader.load(backend, (done, total) => {});\n\n// Access context\nconst contextEntries = traceLoader.contextEntries;\n\n// Get trace model\nconst traceModel = new TraceModel(traceUri, contextEntries);\n\n// Iterate actions\nfor (const action of traceModel.actions) {\n  console.log(action.method);        // e.g., \"click\"\n  console.log(action.params);        // parameters\n  console.log(action.result);        // return value\n  console.log(action.error);         // error if failed\n  console.log(action.log);           // log messages\n}\n\n// Get snapshots\nconst snapshotStorage = traceLoader.storage();\nconst snapshot = snapshotStorage.snapshotByName('before@<callId>');\n\n// Get resource\nconst blob = await traceLoader.resourceForSha1(sha1);\n```\n\n### In Test Runner\n```typescript\n// Access via trace via browser context\nconst trace = await context.tracing.stop({ path: 'trace.zip' });\n\n// Use server-side Tracing class\nconst tracing = new Tracing(context, tracesDir);\ntracing.start({ snapshots: true, screenshots: true });\n// ... run test ...\nawait tracing.stopChunk(progress, { mode: 'archive' });\nawait tracing.stop(progress);\n```\n\n---\n\n## 15. Version Information\n\n### Trace Format Versions\n- **Version 3**: Early format (~1.35)\n- **Version 4**: Updates (~1.36)\n- **Version 5**: Improvements (~1.37)\n- **Version 6**: Major changes (~10/2023, ~1.40)\n- **Version 7**: Further updates (~05/2024, ~1.45)\n- **Version 8**: Current format (latest)\n\n### Compatibility\n- Trace viewer automatically upgrades traces\n- Newer viewer can read older traces\n- Older viewer cannot read newer traces (TraceVersionError)\n\n---\n\n## 16. Key Design Patterns\n\n### 1. Call ID Correlation\nEvery action uses a unique `callId` to correlate:\n- Before event\n- Input events\n- Log messages\n- After event\n- Snapshots (before@callId, input@callId, after@callId)\n- Attachments\n- Network requests (indirect via timing)\n\n### 2. Lazy Loading\n- Snapshots stored by SHA1\n- Resources fetched on demand\n- JSONL format allows streaming\n\n### 3. Snapshot References\n- Instead of storing full DOM repeatedly\n- Later snapshots reference earlier ones: `[[snapshotIndex, nodeIndex]]`\n- Resources inlined via `resourceOverrides`\n\n### 4. Dual Time Bases\n- **wallTime**: Milliseconds since epoch (for display)\n- **monotonicTime**: Internal monotonic clock (for correlation)\n\n### 5. Chunked Recording\n- Tests can have multiple chunks\n- Each chunk has separate `.trace` file\n- Network resources preserved across chunks\n\n### 6. Grouping\n- Actions can be grouped with `group()` / `groupEnd()`\n- Used for test steps, fixtures\n- Group tracking in `RecordingState.groupStack`\n\n---\n\n## 17. File Reference Guide\n\n| File | Size | Purpose |\n|------|------|---------|\n| `isomorphic/trace/trace.ts` | Trace event and snapshot types |\n| `isomorphic/trace/versions/har.ts` | Network HAR types |\n| `playwright-core/.../tracing.ts` | 700+ lines | Recording engine |\n| `playwright-core/.../traceParser.ts` | 62 lines | ZIP backend |\n| `playwright-core/.../traceViewer.ts` | 288 lines | Viewer server |\n| `isomorphic/trace/traceLoader.ts` | 158 lines | Load traces |\n| `isomorphic/trace/traceModel.ts` | 300+ lines | Data model |\n| `isomorphic/trace/traceModernizer.ts` | 500+ lines | Version upgrades |\n| `trace-viewer/src/index.tsx` | 48 lines | Viewer entry |\n| `trace-viewer/src/ui/workbench.tsx` | Main UI | Display |\n\n", "skills/playwright-dev/vendor.md": "# Vendor Dependencies & Bundling\n\nPlaywright ships a small number of node_modules inlined into a handful of\npre-built \"bundle\" files under `lib/`. Everything else is either a source\nfile compiled per-file, or loaded at runtime from one of the bundles. This\ndoc covers how the bundling works, how to add or move a vendored package,\nand how the dependency checker enforces the contract.\n\n## The Bundles\n\n### playwright-core\n\n| Output | Entry | Purpose |\n|---|---|---|\n| `lib/utilsBundle.js` | `src/utilsBundle.ts` | Vendored npm packages (`debug`, `mime`, `ws`, `yauzl`, `yazl`, `@modelcontextprotocol/sdk`, `graceful-fs`, …). The single home for third-party runtime code in playwright-core. |\n| `lib/coreBundle.js` | `src/coreBundle.ts` | Re-exports of playwright-core's own modules (`client`, `iso`, `utils`, `cli`, `server`, `registry`, …) as namespaces. Inlines almost all playwright-core source except `utilsBundle`. |\n| `lib/server/electron/loader.js` | `src/server/electron/loader.ts` | Tiny Electron preload shim. |\n\nThe `dynamicImportToRequirePlugin` in `utils/build/build.js` rewrites\nvendored npm imports at **bundle time**. For example, a playwright-core\nsource file containing\n\n```ts\nimport debug from 'debug';\n```\n\ngets rewritten to\n\n```js\nconst debug = require('./utilsBundle').debug;\n```\n\nbefore the bundler sees it — so the vendored package never gets inlined\ninto `coreBundle.js`. The mapping from npm package name to utilsBundle\nexport key lives in `utils/build/utilsBundleMapping.js`.\n\n### playwright\n\n| Output | Entry | Purpose |\n|---|---|---|\n| `lib/transform/babelBundle.js` | `src/transform/babelBundle.ts` | Wraps `@babel/core`, `@babel/traverse`, plugins. Shared by every consumer that needs babel. |\n| `lib/transform/esmLoader.js` | `src/transform/esmLoader.ts` | Node ESM loader registered via `node:module.register()`. Output sits next to `babelBundle.js` so its `./babelBundle` sibling require resolves correctly. |\n| `lib/common/index.js` | `src/common/index.ts` | Barrel of `common/*` + `transform/*` (compilationCache, test, configLoader, fixtures, globals, …). State-holding singletons (currentTestInfo, memoryCache, …) live here. |\n| `lib/runner/index.js` | `src/runner/index.ts` | Barrel of `runner/*` + `reporters/*` + `plugins/*`. |\n| `lib/matchers/expect.js` | `src/matchers/expect.ts` | Jest-style matchers with `expect` inlined. |\n| `lib/worker/workerProcessEntry.js` | `src/worker/workerProcessEntry.ts` | Entry point spawned per test worker. |\n| `lib/loader/loaderProcessEntry.js` | `src/loader/loaderProcessEntry.ts` | Entry point for the test file loader sub-process. |\n| `lib/runner/uiModeReporter.js` | `src/runner/uiModeReporter.ts` | Loaded by `require.resolve` from testServer; passed to child workers as a file path. |\n\nThe `common` and `runner` bundles externalize `../transform/babelBundle`\n(among other things) so babel code is not duplicated across them. The\n`src/transform/transform.ts` module uses `libPath('transform', 'babelBundle')`\n(absolute path via `package.ts` root) to load the babel bundle at runtime,\nso it works regardless of which bundle has inlined it.\n\n### Per-file emits (no bundle)\n\nFiles outside the bundled entries are compiled 1:1 by esbuild and land\nunder `lib/` mirroring their source layout. The per-file step in\n`utils/build/build.js` lists the specific directories for the\n`playwright` package (`cli/`, `agents/`, `mcp/`, root `*.ts`, and a few\ntargeted files like `runner/uiModeReporter.ts`). Other packages\n(`playwright-test`, `html-reporter`, `trace-viewer`, …) are compiled by\nthe generic per-package loop.\n\n## Bundle Sidecars\n\nEvery bundled output has two sidecar files next to it:\n\n- **`<bundle>.js.txt`** — human-readable report listing inlined files\n  (sorted by path, with per-file KB sizes), externals, and total bytes.\n  Written by `utils/build/bundle_report.js`.\n- **`<bundle>.js.LICENSE`** — third-party license texts for every npm\n  package whose source got inlined. Populated from `license-checker`,\n  memoized once per build invocation. Consumed by the top-level\n  `ThirdPartyNotices.txt` files, which just point readers at the\n  per-bundle sidecars.\n\nBoth sidecars are included in the published npm package (controlled by\n`packages/*/.npmignore`).\n\n## Adding a Vendored NPM Dependency\n\nThree pieces need to line up when adding a new npm package that you want\ninlined into `utilsBundle` (i.e., loaded through `require('./utilsBundle').<key>`):\n\n1. **Install the package.** Add it to the root `package.json`\n   `devDependencies`. The monorepo root is where esbuild resolves modules\n   from; the workspace root's `node_modules/<pkg>` is what gets inlined\n   into `utilsBundle.js`.\n\n2. **Export it from `src/utilsBundle.ts`.** Pick one of:\n   ```ts\n   import fooLibrary from 'foo';\n   export const foo = fooLibrary;             // default\n\n   import * as fooLibrary from 'foo';\n   export const foo = fooLibrary;             // namespace\n\n   export { namedSymbol } from 'foo';         // named\n   ```\n   Type-only exports (`export type { X } from 'foo'`) are valid and\n   don't affect runtime.\n\n3. **Add a mapping entry to `utils/build/utilsBundleMapping.js`**:\n   ```js\n   'foo': { default: 'foo' },\n   // or:\n   'foo': { namespace: 'foo' },\n   // or:\n   'foo': { named: { namedSymbol: 'fooNamedSymbol' } },\n   ```\n   - `default` — matches `import foo from 'foo'` and rewrites to\n     `require('./utilsBundle').foo`.\n   - `namespace` — matches `import * as foo from 'foo'`.\n   - `named` — matches `import { namedSymbol } from 'foo'` and rewrites\n     to `const { fooNamedSymbol: namedSymbol } = require('./utilsBundle')`.\n   - Multiple forms can coexist in one entry (see `yauzl`).\n   - The map key is the exact npm specifier as written in source\n     (including subpaths like `'@babel/core'` or `'colors/safe'`).\n\n4. **Update DEPS.list.** The file or its enclosing folder's `DEPS.list`\n   must authorize `node_modules/<pkg>` — otherwise `npm run flint`'s\n   `check_deps` step complains about the disallowed external dependency.\n   If the DEPS.list authorizes it, the package.json-dependencies check\n   also gets skipped for that file.\n\n5. **Run `npm run flint`.** It runs `check_deps`, `tsc`, `eslint`, and\n   `doc` in parallel. A missing mapping typically surfaces as `node_modules/`\n   references leaking into `coreBundle.js` — the build fails hard via\n   `assertCoreBundleHasNoNodeModules()`.\n\n## In-tree Third-Party Helpers\n\nSome vendored code isn't a published npm package but lives in-tree at\n`packages/utils/third_party/` (e.g.\n`extractZip.ts`, `lockfile.ts`). These are TypeScript files, not\nnode_modules. They're exposed to callers via two different routes:\n\n- **Through `coreBundle.utils`.** Re-exported from\n  `packages/utils/index.ts` via `export * from './third_party/extractZip'`\n  etc. Callers import via the `@utils/*` path alias:\n  ```ts\n  import { extractZip } from '@utils/third_party/extractZip';\n  ```\n  The alias is rewritten at bundle time to\n  `require('playwright-core/lib/coreBundle').utils.extractZip`.\n- **Transitive npm deps via utilsBundle.** When a third_party TS file\n  imports an npm package (e.g., `lockfile.ts` imports `graceful-fs`,\n  `retry`, `signal-exit`), those are still rewritten through\n  `utilsBundle` — so the mapping in `utilsBundleMapping.js` must list\n  them too.\n\n## DEPS.list\n\nEvery directory under `packages/*/src/` has a `DEPS.list` constraining\nits imports. Three kinds of entries:\n\n| Syntax | Meaning |\n|---|---|\n| `./somefile.ts`, `@isomorphic/**` | Relative or alias source import allowed |\n| `node_modules/<pkg>` | npm package import allowed (exact specifier match) |\n| `\"strict\"` | No other DEPS inherited; only what's listed is allowed |\n\nSection headers `[filename.ts]` scope rules to a single file. The\ntop-level `[*]` (or no header) applies to everything in the folder plus\nsubfolders that don't have their own DEPS.list.\n\nA DEPS.list entry of `node_modules/<pkg>` now shortcuts both layers of\nthe check: the \"disallowed external dependency\" error AND the\n\"dependencies not declared in package.json\" report. The per-file\nallowlist is the contract — no need to also list the dep in\n`packages/<pkg>/package.json` if only one file uses it and it's\nauthorized there.\n\n### check_deps.js\n\n`utils/check_deps.js` walks the TypeScript program, visits every\n`import` in `src/**`, and for each npm specifier:\n\n1. Skips if the source file's DEPS.list authorizes `node_modules/<specifier>`.\n2. Otherwise records the top-level package name along with the file\n   path that imported it.\n3. Subtracts `peerDependencies`, `VENDORED_PACKAGES` (from\n   `utilsBundleMapping.js`), and any package that resolves without\n   `node_modules/` (a core module or a local file).\n4. Subtracts packages listed in `packages/<pkg>/package.json`\n   `dependencies`.\n5. Anything left is reported with the specific file(s) that import it.\n\nThe missing-dep error now includes file paths:\n```\nDependencies are not declared in package.json:\n  expect\n    src/matchers/expect.ts\n  @babel/core\n    src/transform/babelBundle.ts\n```\n\n## Bundle-Level Externalization (onResolve plugins)\n\nTwo onResolve plugins in `utils/build/build.js` normalize relative\nimports to the sibling bundle at consumer output level:\n\n- **`externalizeUtilsBundlePlugin`** — matches any relative specifier\n  ending in `/utilsBundle` or `/utilsBundle.js` (at any depth: `./utilsBundle`,\n  `../utilsBundle`, `../../utilsBundle`) and marks it external with the\n  single spelling `./utilsBundle`. This only applies to the coreBundle\n  build because coreBundle inlines source files from all over\n  `playwright-core/src/` (different depths) and needs a single consistent\n  external specifier that resolves correctly at runtime from\n  `lib/coreBundle.js`.\n- The **babelBundle** case is handled differently — instead of a plugin,\n  consumers' source/output depths are aligned:\n  - `esmLoader` bundle output is placed at `lib/transform/esmLoader.js`\n    (same folder as `babelBundle.js`), so `./babelBundle` from\n    `transform.ts` resolves correctly.\n  - `common` and `runner` bundles declare `'../transform/babelBundle'`\n    as a static external; their outputs are at `lib/common/index.js` and\n    `lib/runner/index.js`, both at depth 1, so the source-relative\n    specifier resolves naturally.\n  - `transform.ts`'s own `require('./babelBundle')` was replaced with\n    `require(libPath('transform', 'babelBundle'))` — an absolute path\n    computed at runtime via `package.ts`, which works from any bundle.\n\n## Quick Reference\n\n- To add a new vendored npm dep: root `package.json` → `utilsBundle.ts`\n  export → `utilsBundleMapping.js` entry → DEPS.list → `npm run flint`.\n- To add a new in-tree third-party helper: drop the `.ts` file under\n  `packages/utils/third_party/`, re-export from `packages/utils/index.ts`,\n  and use `@utils/third_party/<name>` at call sites.\n- To add a new bundle entry: add an `EsbuildStep` in\n  `utils/build/build.js`, pick output location so relative externals\n  line up with runtime layout, and list externals for every sibling\n  bundle the entry should not inline.\n- To expose a bundle file as a package subpath: add it to the\n  `exports` field in `packages/<pkg>/package.json`.\n- To check what's inside a bundle: read the `.js.txt` sidecar next to\n  the output.\n", "skills/playwright-dev/webkit-safari-version.md": "# Updating WebKit Safari Version\n\nThe Safari version string used in the WebKit user-agent is declared in one place:\n\n**[packages/playwright-core/src/server/webkit/wkBrowser.ts](../../../packages/playwright-core/src/server/webkit/wkBrowser.ts)** — `BROWSER_VERSION` constant (line ~35).\n\n```ts\nconst BROWSER_VERSION = '26.4';\nconst DEFAULT_USER_AGENT = `Mozilla/5.0 ... Version/${BROWSER_VERSION} Safari/605.1.15`;\n```\n\n## Steps to update\n\n1. **Find the latest stable Safari version** — search `site:developer.apple.com \"Safari X.Y Release Notes\"` or check the [Safari Release Notes](https://developer.apple.com/documentation/safari-release-notes) index. The highest numbered entry that is not a Technology Preview is the current stable release.\n\n2. **Update `BROWSER_VERSION`** in `wkBrowser.ts`.\n\n3. **Run lint** to update any generated files that embed the version:\n\n   ```bash\n   npm run flint\n   ```\n", "skills/playwright-dev/webview.md": "# WebView (iOS Safari) Backend Reference\n\nNotes for developing the **stock-Mobile-Safari** backend in\n[packages/playwright-core/src/server/webkit/webview/](../../../packages/playwright-core/src/server/webkit/webview/).\nThe regular WebKit backend one level up (`webkit/`) runs against a\nPlaywright-patched WebKit build; the `webview/` folder targets unmodified\nSafari on real iOS/iPadOS or the iOS Simulator over the standard Web Inspector\nProtocol.\n\n## What is and isn't available\n\nStock Mobile Safari only exposes the upstream Web Inspector Protocol. Anything\nPlaywright added to its forked WebKit is not available here.\n\n**Available** — methods/events in `Source/JavaScriptCore/inspector/protocol/*.json`\non `upstream/main` of a `microsoft/playwright-webkit` checkout:\n\n```bash\ngit -C ~/playwright-webkit show upstream/main:Source/JavaScriptCore/inspector/protocol/<Domain>.json\n```\n\n**Not available** — anything added by the Playwright commits on top of upstream\nWebKit. [bootstrap.diff](../../../browser_patches/webkit/patches/bootstrap.diff) is a copy\nof them as one patch; the commits themselves are:\n\n```bash\ngit -C ~/playwright-webkit log --first-parent --oneline upstream/main..main\n```\n\nQuick provenance check for a symbol — in `~/playwright-webkit`:\n\n```bash\ngit log -S \"<symbol>\" upstream/main -- <path>\n```\n\nIf there is no hit on `upstream/main`, it's a Playwright\npatch. Some traps where the upstream name overlaps with a Playwright-only\nhelper of similar intent:\n\n- `Target.setPauseOnStart` / `Target.resume` (**upstream**, gates loading of\n  provisional process-swap targets) vs `PageInspectorController::pauseOnStart`\n  / `resumeIfPausedInNewWindow` (**Playwright patch**, for `window.open`\n  popups). They sound the same; they aren't.\n- `Playwright.*` domain (cookies, navigate, all global controls) — entirely\n  Playwright. Use stock equivalents on the page session (e.g. `Page.getCookies`).\n- `Network.continueWithAuth`, intercepted-response body access via Network —\n  Playwright extensions.\n\n## Architecture\n\nThis backend deliberately mirrors the regular WebKit backend one level up\n(`wkConnection.ts` / `wkPage.ts` / `wkProvisionalPage.ts`). When in doubt,\nread the WK equivalent — the WV class should look almost the same. The\n`outerSession` is the WV analogue of WK's page-proxy session.\n\n```\nWebSocketTransport (ws://localhost:9222/devtools/page/<n>, via ios_webkit_debug_proxy)\n  → WVConnection            — dumb transport; owns only outerSession\n      → WVConnection.outerSession (sessionId \"\")  — Target.sendMessageToTarget bridge\n          → WVPage          — owns per-target WVSessions, routes\n                              Target.dispatchMessageFromTarget, manages swaps\n              → _session (current) + WVProvisionalPage (during a swap)\n              → WVExecutionContext, WVWorkers, RawKeyboard/Mouse/Touchscreen\n                (all hold a session reference, all have setSession() for swap)\n```\n\n`WVConnection` is intentionally minimal: it pumps the transport into\n`outerSession` and back. `WVPage` creates the per-target `WVSession`s\n(`_createSession`), routes `Target.dispatchMessageFromTarget` by `targetId` to\neither `_session` or `_provisionalPage._session`, and handles\n`Target.targetCreated/targetDestroyed/didCommitProvisionalTarget` — exactly\nlike `WKPage`. `WVPage` is constructed with the outer session (not a target\nsession); `_session` starts undefined and is bound on the first\n`Target.targetCreated` via `_setSession`. `WVBrowser._attachTab` awaits\n`page.waitForInitialized()` (resolves after the first target is reported as\nnew) instead of waiting on the connection.\n\n## Process swap / provisional targets\n\nCross-origin navigation in an existing tab can make Mobile Safari spawn a new\nprocess. The protocol sequence is:\n\n```\nTarget.targetCreated  targetInfo:{ isProvisional:true, isPaused:true }\n... events on the provisional target during the navigation ...\nTarget.didCommitProvisionalTarget  oldTargetId, newTargetId\nTarget.targetDestroyed  oldTargetId\n```\n\nHandling mirrors WK — `WVProvisionalPage` ≈ `WKProvisionalPage`, swapped in by\n`WVPage._onDidCommitProvisionalTarget`. The one essential trick:\n`Target.setPauseOnStart` (sent in `WVBrowser._attachTab`) makes provisional\ntargets arrive `isPaused`, so `WVPage` can set up interception / bootstrap\nbefore resuming them with `Target.resume`; otherwise the new process races\nahead and `page.route(...)` never fires.\n\nNot to be confused with the **popup-pause** path (`window.open`), which is a\nPlaywright patch (`PageInspectorController::pauseOnStart`) with no stock-Safari\nequivalent.\n\n## Test infrastructure\n\n```\ntests/webview/\n  playwright.config.ts        — single project \"webkit-webview-page\", runs tests/page/\n  webviewTest.ts              — fixture: discovers tab via ios_webkit_debug_proxy /json,\n                                resets Mobile Safari between tests\n  expectations/\n    webkit-webview-page.txt   — `<test path> › <name> [fail|flaky|timeout|skip]`\n  expectationUtil.ts          — loader + skip-decision logic\n```\n\n`[fail]` entries cause `it.skip()` to fire before the test body runs — so a\nformerly-failing test that now passes won't be flagged automatically, you have\nto remove the line and re-run. The marker also has prefix-match semantics for\n`it.step` children.\n\n### Running locally\n\n```bash\n./utils/run_webview_tests.sh           # ensures ios_webkit_debug_proxy is up on 9222\nnpm run wvtest -- -g \"<test title>\"    # single test\nnpm run wvtest -- tests/page/foo.spec.ts\nDEBUG=pw:protocol npm run wvtest -- -g \"<title>\" > /tmp/log 2>&1\n```\n\nThe simulator needs to be booted with one Mobile Safari tab. The script's only\njob is keeping a single\n`ios_webkit_debug_proxy -F -d -s unix:<socket> -c null:9221,:9222-9322` alive;\neverything else is done by the fixture.\n\n### Common local pitfalls\n\n- **Multiple `ios_webkit_debug_proxy` processes** — every protocol event is\n  delivered through each instance, so debug logs show events duplicated and\n  some tests flake. `pgrep -lf ios_webkit_debug_proxy` and clean up.\n- **Chrome bound to `127.0.0.1:9222`** — Chrome's `--remote-debugging-port=9222`\n  shadows iwdp's `*:9222` listener for traffic addressed to `localhost`.\n  Kill the Chrome instance (`lsof -nP -iTCP -sTCP:LISTEN | grep 9222`).\n- **Stale launchd socket** — `lsof -aUc launchd_sim` should show\n  `com.apple.webinspectord_sim.socket` for the currently booted simulator. If\n  iwdp was started against an older `launchd_sim` socket path it will silently\n  serve nothing.\n\n## CI\n\n[.github/workflows/tests_webview_simulator.yml](../../../.github/workflows/tests_webview_simulator.yml)\nruns the same suite on `macos-15` (booted iOS Simulator +\n`brew install ios-webkit-debug-proxy`). Triggers: `workflow_dispatch`, and\n`pull_request` only when paths under `tests/webview/**`, the `webview/` source\nfolder, or the workflow file itself change.\n", "skills/playwright-devops/SKILL.md": "---\nname: playwright-devops\ndescription: DevOps workflows for Playwright - CI failure analysis, workflow debugging, and release operations.\nuser_invocable: true\n---\n\n# Playwright DevOps\n\n## Guides\n\n- [CI Commit Failure Report](commit-failures.md) — analyze GitHub Actions failures for the last commit on main\n- [fetch-commit-logs.sh](fetch-commit-logs.sh) — script to download failed job logs into `~/tmp/commit-<sha>/`\n", "skills/playwright-devops/commit-failures.md": "# CI Health Report\n\nGenerate a CI health report for the last commit on the `main` branch of `microsoft/playwright`.\nThis is an overall tree health report — not a commit regression analysis. The goal is to show\nthe full picture of what's failing, grouping by root cause. If any failures appear to be\nregressions introduced by this specific commit, call that out, but most failures will be\npre-existing flakes, infrastructure issues, or platform-specific problems.\n\n## Phase 1 — Fetch logs\n\nRun the fetch script to download all failed job logs into a local folder:\n\n```\nbash .claude/skills/playwright-devops/fetch-commit-logs.sh [<sha>]\n```\n\n- If no SHA is provided, it fetches the last commit on `main`.\n- Creates `~/tmp/commit-<short-sha>/` with:\n  - `summary.json` — commit info, failed workflows, and failed job metadata\n  - `<workflow-name>/<job-name>.log` — failed log output for each failed job\n\n**Note:** The script fetches failed jobs from both failed AND in-progress workflows.\nWorkflows may still be running while some of their jobs have already failed — these\nmust be included in the report. If any workflows are still in progress, note this in\nthe report summary.\n\n## Phase 2 — Analyze\n\n1. **Read `summary.json`** to get the commit message and the list of failed workflows/jobs.\n\n2. **Read each `.log` file** and extract failing test names and error messages.\n\n3. **Compile the report leading with a summary**, then detailed tables:\n\n   ```markdown\n   # CI Health Report — <short-sha>\n\n   Commit: `<commit message>`\n\n   ## Summary\n\n   Brief overview: N workflows, N failed jobs, N total test failures.\n   Note if any workflows are still in progress.\n\n   ### Possible regressions (may be related to this commit)\n   - **N failures** in `test/file.spec.ts` across <browsers/platforms> — <brief description>\n\n   ### Pre-existing / flaky\n   - **N failures** in `test/file.spec.ts` — <brief description> (timeouts, infrastructure, platform-specific)\n\n   ### Infrastructure issues\n   - <description of non-test failures>\n\n   ---\n\n   ## Detailed Failures\n\n   ### Workflow: <name> (run <id>)\n\n   #### <job name> (job <id>) -- N failures\n   | Test | Error |\n   |------|-------|\n   | `path/to/test.spec.ts:line` -- test title | error message |\n   ```\n\n   The summary should appear first so readers immediately see what matters. Group related failures\n   (e.g. same test failing across browsers) into single summary bullet points rather than listing each individually.\n\n4. **Save the report** to `ci-failures-<short-sha>.md` in the repo root.\n", "skills/playwright-devops/fetch-commit-logs.sh": "#!/bin/bash\nset -euo pipefail\n\n# Usage: fetch-commit-logs.sh [<sha>]\n# Fetches CI failure logs for a commit into ~/tmp/commit-<short-sha>/\n\nREPO=\"microsoft/playwright\"\nREF=\"${1:-main}\"\n\n# Resolve commit\nCOMMIT_JSON=$(gh api \"repos/$REPO/commits/$REF\" --jq '{sha: .sha, message: .commit.message}')\nSHA=$(echo \"$COMMIT_JSON\" | jq -r '.sha')\nSHORT_SHA=\"${SHA:0:7}\"\nMESSAGE=$(echo \"$COMMIT_JSON\" | jq -r '.message' | head -1)\n\nOUTDIR=\"$HOME/tmp/commit-$SHORT_SHA\"\nmkdir -p \"$OUTDIR\"\n\necho \"Commit: $SHORT_SHA — $MESSAGE\"\necho \"Output: $OUTDIR\"\n\n# Get all workflow runs for this commit\nRUNS_JSON=$(gh api \"repos/$REPO/actions/runs?head_sha=$SHA&per_page=50\" \\\n  --jq '[.workflow_runs[] | {id, name, conclusion, workflow_id}]')\n\n# Filter to failed workflows\nFAILED_RUNS=$(echo \"$RUNS_JSON\" | jq -c '[.[] | select(.conclusion == \"failure\" or .conclusion == null)]')\nFAILED_COUNT=$(echo \"$FAILED_RUNS\" | jq 'length')\n\nif [ \"$FAILED_COUNT\" -eq 0 ]; then\n  echo \"No failed workflows.\"\n  echo '{\"sha\":\"'\"$SHA\"'\",\"short_sha\":\"'\"$SHORT_SHA\"'\",\"message\":\"'\"$MESSAGE\"'\",\"workflows\":[]}' | jq . > \"$OUTDIR/summary.json\"\n  echo \"$OUTDIR\"\n  exit 0\nfi\n\necho \"Found $FAILED_COUNT failed workflow(s). Fetching failed jobs...\"\n\n# Build summary and collect jobs to fetch\nSUMMARY='{\"sha\":\"'\"$SHA\"'\",\"short_sha\":\"'\"$SHORT_SHA\"'\",\"message\":'\"$(echo \"$MESSAGE\" | jq -Rs .)\"',\"workflows\":[]}'\n\nsanitize() {\n  echo \"$1\" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9._-]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//'\n}\n\nPIDS=()\n\nfor i in $(seq 0 $((FAILED_COUNT - 1))); do\n  RUN=$(echo \"$FAILED_RUNS\" | jq -c \".[$i]\")\n  RUN_ID=$(echo \"$RUN\" | jq -r '.id')\n  RUN_NAME=$(echo \"$RUN\" | jq -r '.name')\n  WORKFLOW_DIR=$(sanitize \"$RUN_NAME\")\n\n  # Get failed jobs for this run\n  JOBS_JSON=$(gh run view \"$RUN_ID\" --json jobs \\\n    --jq '[.jobs[] | select(.conclusion == \"failure\") | {name: .name, id: .databaseId}]')\n  JOB_COUNT=$(echo \"$JOBS_JSON\" | jq 'length')\n\n  if [ \"$JOB_COUNT\" -eq 0 ]; then\n    continue\n  fi\n\n  mkdir -p \"$OUTDIR/$WORKFLOW_DIR\"\n\n  # Add to summary\n  WORKFLOW_ENTRY=$(jq -n \\\n    --arg name \"$RUN_NAME\" \\\n    --argjson id \"$RUN_ID\" \\\n    --argjson jobs \"$JOBS_JSON\" \\\n    '{name: $name, id: $id, failed_jobs: $jobs}')\n  SUMMARY=$(echo \"$SUMMARY\" | jq --argjson w \"$WORKFLOW_ENTRY\" '.workflows += [$w]')\n\n  # Fetch logs in parallel\n  for j in $(seq 0 $((JOB_COUNT - 1))); do\n    JOB=$(echo \"$JOBS_JSON\" | jq -c \".[$j]\")\n    JOB_ID=$(echo \"$JOB\" | jq -r '.id')\n    JOB_NAME=$(echo \"$JOB\" | jq -r '.name')\n    JOB_FILE=$(sanitize \"$JOB_NAME\")\n    LOG_PATH=\"$OUTDIR/$WORKFLOW_DIR/$JOB_FILE.log\"\n\n    (\n      echo \"# $JOB_NAME\" > \"$LOG_PATH\"\n      echo \"\" >> \"$LOG_PATH\"\n      gh run view --job \"$JOB_ID\" --log-failed 2>&1 | sed 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' | sed $'s/^[^\\t]*\\t[^\\t]*\\t\\xef\\xbb\\xbf\\{0,1\\}[0-9T:.Z-]* //' >> \"$LOG_PATH\" || true\n      # If only header (e.g. workflow still in progress), fetch via jobs API\n      if [ \"$(wc -l < \"$LOG_PATH\")\" -le 3 ]; then\n        echo \"# $JOB_NAME\" > \"$LOG_PATH\"\n        echo \"\" >> \"$LOG_PATH\"\n        gh api \"repos/$REPO/actions/jobs/$JOB_ID/logs\" 2>&1 | sed 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' | sed $'s/\\xef\\xbb\\xbf//g' | sed 's/^[0-9T:.Z-]* //' >> \"$LOG_PATH\" || true\n      fi\n      echo \"  Fetched: $WORKFLOW_DIR/$JOB_FILE.log\"\n    ) &\n    PIDS+=($!)\n  done\ndone\n\n# Wait for all parallel fetches\nfor pid in \"${PIDS[@]}\"; do\n  wait \"$pid\" 2>/dev/null || true\ndone\n\n# Write summary\necho \"$SUMMARY\" | jq . > \"$OUTDIR/summary.json\"\n\necho \"\"\necho \"Done. Logs saved to: $OUTDIR\"\necho \"$OUTDIR\"\n", "skills/playwright-release-notes/SKILL.md": "---\nname: playwright-release-notes\ndescription: Write the release notes for a Playwright release - the Node.js notes in docs/src/release-notes-js.md together with the Python, Java and .NET translations, and the GitHub markdown for each language's release. Use when asked to write, translate or publish release notes.\n---\n\n# Release notes\n\nIn this skill, `1.xx` is the release (for example `1.64`).\n\nEvery release has a `## Version 1.xx` section in four files in `docs/src/`:\n\n| Language | Notes | Docs base URL | GitHub release in |\n|---|---|---|---|\n| Node.js | `release-notes-js.md` | `https://playwright.dev/docs/` | `microsoft/playwright` |\n| Python | `release-notes-python.md` | `https://playwright.dev/python/docs/` | `microsoft/playwright-python` |\n| Java | `release-notes-java.md` | `https://playwright.dev/java/docs/` | `microsoft/playwright-java` |\n| .NET | `release-notes-csharp.md` | `https://playwright.dev/dotnet/docs/` | `microsoft/playwright-dotnet` |\n\nWrite the Node.js notes and the three translations in the same PR, so every language has its notes when it starts its release. The language repos then add only their own significant changes, and each one writes its GitHub release from its section (step 3).\n\n## 1. Node.js notes\n\nIn `docs/src/release-notes-js.md`, add a `## Version 1.xx` section above the previous version, and use previous versions as a guide:\n\n- Highlights come first, each with an emoji heading and a short sample. Ask teammates for help with them.\n- Then `### New APIs` with `####` groups, `### Breaking Changes ⚠️`, `### Announcements` and `### Browser Versions`. Print the browser versions with `node utils/print_versions.js`.\n- Refer to APIs with docs link macros: `` [`method: Page.frameLocator`] ``, `` [`property: Page.webmcp`] ``, `` [`event: Page.dialogClosed`] ``, `` [`option: Tracing.start.ariaSnapshots`] ``, `[Locator]`. Each language's docs show them with that language's names.\n- Link other docs pages with relative paths: `[test locks](./test-parallel.md#test-locks)`.\n\n## 2. Python, Java and .NET translations\n\nIn each of `release-notes-python.md`, `release-notes-java.md` and `release-notes-csharp.md`, add a `## Version 1.xx` section above the previous version. Translate it from the Node.js section. Compare the `Version 1.63` sections of the files to see what past translations dropped and changed.\n\nFor every language:\n\n- Keep the structure: highlights with emoji headings, `### New APIs` with `####` groups, `### Breaking Changes ⚠️`, `### Announcements` and `### Browser Versions`.\n- Remove what the language does not have:\n  - the test runner: `@playwright/test`, `test.*`, config, fixtures, projects, reporters and `npx playwright test` options\n  - UI mode, the HTML report, component testing and the VS Code extension\n  - TypeScript-only features (generics, JSX, `tsconfig`) and `devices` descriptors\n  - every API whose `langs` excludes the language (`python`, `java`, `csharp`). Check `langs` in `docs/src/api/`; options shared between methods are defined in `docs/src/api/params.md`.\n- Use the language's API where it differs from Node.js:\n  - A language-specific option has its own `langs`. For example, `recordVideoFps` is `langs: csharp, java, python`, while Node.js has `recordVideo.fps`.\n  - `alias-<lang>` renames a member, e.g. `alias-java: isVisible` for `LocatorAssertions.toBeVisible`.\n  - The generated APIs in sibling checkouts confirm the names: `../playwright-python/playwright/sync_api/_generated.py`, `../playwright-java/playwright/src/main/java/com/microsoft/playwright/` and `../playwright-dotnet/src/Playwright/API/Generated/`.\n- When a Node.js sample shows a library feature through `playwright.config.ts`, show the API call instead. For example, the 1.64 video config became calls to `Screencast.start` and `Screencast.showActions`.\n- Keep API links as docs link macros, and link the language's own option where it differs (`` [`option: Browser.newContext.recordVideoFps`] ``). In plain text, use the language's names.\n- A relative link must point to a page that exists in the language: `*-js.md` pages are Node.js only. `npm run doc` reports broken links for each language.\n- Do not add changes that only a language port made. The language repo adds those to its notes.\n\nRewrite code samples in each language's style. The `infra` workflow checks the syntax of `python`, `java` and `csharp` snippets.\n\n### Python\n\n- Use the sync API: `page.get_by_role(\"button\").click()`. Use snake_case names and Python values (`True`, `False`, `None`).\n- Options become keyword arguments: `page.get_by_role(\"button\", name=\"Save\")`. Objects and arrays become dicts and lists: `size={\"width\": 1920, \"height\": 1080}`.\n- Aria roles and other string values stay strings: `\"button\"`, `\"ai\"`.\n- Events: `page.on(\"dialogclosed\", handler)`. Assertions: `expect(locator).to_have_text([...])`. Print with `print(...)`.\n- Use the `alias-python` names: `route.continue_()`, `locator.or_()`, `page.expect_request()`.\n- Commands: write `playwright install`, not `npx playwright install`.\n\n### Java\n\n| Node.js | Java |\n|---|---|\n| `await page.goto('...')` | `page.navigate(\"...\");`: no `await`, double quotes, semicolons, typed locals (`Locator dialog = ...`) |\n| `page.getByRole('button', { name: 'Save' })` | `page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(\"Save\"))` |\n| options object `{ path: 'video.webm', fps: 60 }` | options builder `new Screencast.StartOptions().setPath(Paths.get(\"video.webm\")).setFps(60)` |\n| object literal `{ name: 'session-id', value: '42', url }` | value class `new Cookie(\"session-id\", \"42\").setUrl(url)` |\n| `['a', 'b']`, `{ a: 2 }` | `Arrays.asList(\"a\", \"b\")`, `Map.of(\"a\", 2)`; `new String[] {\"a\", \"b\"}` for assertion arguments |\n| property `page.webmcp`, `context.tracing` | getter `page.webmcp()`, `context.tracing()` |\n| event `page.on('dialogclosed', handler)` | `page.onDialogClosed(handler)` |\n| `expect(locator).toHaveText(...)` | `assertThat(locator).hasText(...)`. Likewise `toBeX` → `isX`, `toHaveX` → `hasX`, `toContainX` → `containsX`, `toMatchX` → `matchesX` |\n| `route.continue()` and other members with `alias-java` | the alias, e.g. `route.resume()` |\n| `npx playwright install --no-remove` | `mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args=\"install --no-remove\"` |\n| \"array\", `undefined`, `'ai'` in prose | \"list\", `null`, `\"ai\"` |\n\n### .NET\n\n| Node.js | .NET |\n|---|---|\n| `await page.goto('...')` | `await page.GotoAsync(\"...\");`: PascalCase members, `Async` suffix on async methods, `var` locals, double quotes, semicolons |\n| `page.getByRole('button', { name: 'Save' })` | `page.GetByRole(AriaRole.Button, new() { Name = \"Save\" })` |\n| options object `{ path: 'video.webm', fps: 60 }` | options initializer `new() { Path = \"video.webm\", Fps = 60 }` |\n| nested object `size: { width: 1920, height: 1080 }` | `Size = new() { Width = 1920, Height = 1080 }` |\n| object literal `{ name: 'session-id', value: '42', url }` | `new Cookie { Name = \"session-id\", Value = \"42\", Url = url }` |\n| `['a', 'b']`, free-form object `{ a: 2 }` | `new[] { \"a\", \"b\" }`, anonymous object `new { a = 2 }` |\n| string-literal union value `'ai'`, `'button'` | enum member `AriaSnapshotMode.Ai`, `AriaRole.Button` |\n| property `page.webmcp`, `context.tracing` | property `page.Webmcp`, `context.Tracing` |\n| event `page.on('dialogclosed', handler)` | `page.DialogClosed += (_, dialog) => { ... };` |\n| `expect(locator).toHaveText(...)` | `await Expect(locator).ToHaveTextAsync(...);` |\n| `console.log(x)` | `Console.WriteLine(x);` |\n| members with `alias-csharp` | the alias, e.g. `page.request` → `page.APIRequest` |\n| union-typed option, e.g. `httpCredentials` as a list | one property per type, e.g. `HttpCredentialsList` |\n| `npx playwright install --no-remove` | `pwsh bin/Debug/netX/playwright.ps1 install --no-remove` |\n| option names in prose (`fontSize`), `undefined` | `FontSize`, `null` |\n\nOpen one PR for all four files, titled `docs: release notes for v1.xx`. After it merges, cherry-pick it to `release-1.xx` with the `playwright-cherry-pick` skill.\n\n## 3. GitHub release markdown\n\nEach repo publishes the GitHub release for its language, with markdown converted from its `## Version 1.xx` section on `release-1.xx`. Convert the notes yourself:\n\n- Leave out the `## Version 1.xx` heading. Move every other heading up one level (`###` becomes `##`, `####` becomes `###`).\n- Replace each link macro with a full link: the language's docs base URL from the table at the top, plus the path below. Use the language's name as the link text:\n\n  | Macro | Path after the docs base URL | Node.js | Python | Java | .NET |\n  |---|---|---|---|---|---|\n  | `[Locator]` | `api/class-locator` | `Locator` | `Locator` | `Locator` | `Locator` |\n  | `` [`method: Page.frameLocator`] `` | `api/class-page#page-frame-locator` | `page.frameLocator()` | `page.frame_locator()` | `page.frameLocator()` | `Page.FrameLocator()` |\n  | `` [`method: Page.ariaSnapshot`] `` | `api/class-page#page-aria-snapshot` | `page.ariaSnapshot()` | `page.aria_snapshot()` | `page.ariaSnapshot()` | `Page.AriaSnapshotAsync()` |\n  | `` [`method: Locator.first`] `` | `api/class-locator#locator-first` | `locator.first()` | `locator.first` | `locator.first()` | `Locator.First` |\n  | `` [`property: Page.webmcp`] `` | `api/class-page#page-webmcp` | `page.webmcp` | `page.webmcp` | `page.webmcp()` | `Page.Webmcp` |\n  | `` [`event: BrowserContext.dialogClosed`] `` | `api/class-browsercontext#browser-context-event-dialog-closed` | `browserContext.on('dialogclosed')` | `browser_context.on(\"dialogclosed\")` | `browserContext.onDialogClosed()` | `BrowserContext.DialogClosed` |\n  | `` [`method: LocatorAssertions.toBeVisible`] `` | `api/class-locatorassertions#locator-assertions-to-be-visible` | `expect(locator).toBeVisible()` | `expect(locator).to_be_visible()` | `assertThat(locator).isVisible()` | `Expect(Locator).ToBeVisibleAsync()` |\n  | `` [`option: Page.content.includeShadow`] `` | `api/class-page#page-content-option-include-shadow` | `` `includeShadow` `` | `` `include_shadow` `` | `` `includeShadow` `` | `` `IncludeShadow` `` |\n\n- An image `![alt](./images/foo.png)` becomes `![alt](https://github.com/microsoft/playwright/blob/main/docs/src/images/foo.png?raw=true)` in every language.\n\nThe page is `class-` and the class name in lower case. The anchor is the class and member names in kebab-case, so `APIRequestContext.addCookies` becomes `api-request-context-add-cookies`. Options add `-option-<name>`, and events add `-event-<name>`. Anchors use the names from `docs/src/api/` even where a language renames the member, so Java's `isVisible()` links to `#locator-assertions-to-be-visible`.\n\nThe link text follows the language:\n\n- **Node.js:** the class in lower camel case (`page`, `apiRequestContext`, `testConfig`). Methods get `()`, properties none, events become `on('<event in lower case>')`, and assertions start with `expect(locator).`, `expect(page).` or `expect(response).`.\n- **Python:** the class and member in snake_case (`browser_context`, `api_request_context`). Methods get `()`. A member is a property, without `()`, if `_generated.py` declares it with `@property`. Events become `on(\"<event in lower case>\")`, and assertions start with `expect(locator).`.\n- **Java:** the class in lower camel case and the `alias-java` member name. Methods and properties get `()`, events become `on<Event>()`, and assertions start with `assertThat(locator).`.\n- **.NET:** the class without the interface `I` (`Page`, `APIRequestContext`) and the member exactly as the generated `I<Class>.cs` declares it. Async methods take the `Async` suffix and `()`, sync methods get `()`, and properties and events get no parentheses. Assertions start with `Expect(Locator).`.\n\nCheck that every link resolves. playwright.dev already documents the release once the Node.js docs roll has landed. It serves minified HTML, so an anchor may appear without quotes (`id=page-webmcp>`):\n\n```bash\ngrep -oE 'https://playwright\\.dev/[^) ]+' <notes-file> | sort -u | while read -r url; do\n  page=${url%%#*}\n  html=$(curl -sfL \"$page\") || { echo \"MISSING PAGE   $url\"; continue; }\n  if [[ \"$url\" == *\"#\"* ]]; then\n    anchor=${url#*#}\n    grep -qE \"id=\\\"?${anchor}[\\\" >]\" <<<\"$html\" || echo \"MISSING ANCHOR $url\"\n  fi\ndone\n```\n\nThen scan for anything that wasn't converted, and for stray spaces inside link text (`[Page. DialogClosed]`, `` [`HttpCredentialsList `] ``). The first command applies to every language; then run the one for the language. They should print nothing:\n\n```bash\n# every language\ngrep -nE '\\[`(method|property|event|option|param): |\\]\\(\\./|\\[[A-Z][A-Za-z]*\\]([^(]|$)|\\[[A-Za-z_]+\\. |\\[`[^`]+ `\\]' <notes-file>\n# Python: camelCase names in link text\ngrep -nE '\\[[a-z_]+\\.[a-z_]*[A-Z]|\\[`[a-z]+[A-Z]' <notes-file>\n# Java: JS-style events, assertions and properties\ngrep -nE \"\\.on\\('|\\b(toBe|toHave|toContain|toMatch)[A-Z]|\\bawait\\b|\\barray\\b|\\bundefined\\b|\\[[a-z][A-Za-z]*\\.[a-z][A-Za-z]*\\]\\(\" <notes-file>\n# .NET: lower-case classes or members, JS-style events\ngrep -nE \"\\.on\\('|\\bundefined\\b|\\[[a-z][A-Za-z]*\\.|\\[[A-Z][A-Za-z]*\\.[a-z]|\\[Expect\\([a-z]\" <notes-file>\n```\n\nIf the conversion shows a problem in the notes themselves, such as an API the language does not have or a sample in the wrong style, fix the notes too (step 2). Otherwise the problem stays on playwright.dev.\n", "skills/playwright-test-results/SKILL.md": "---\nname: playwright-test-results\ndescription: Query Playwright CI test results from the aggregated DuckDB database. Answers questions about flaky tests, failure rates, slow tests, and per-run/SHA/PR results without hunting through GitHub artifacts.\nuser_invocable: true\n---\n\n# Playwright Test Results (DuckDB)\n\nA single DuckDB file holds recent Playwright CI test results, so you can answer\nquestions about failures, flakiness, and slow tests with plain SQL. It is\nrefreshed every few hours.\n\n## Get the database\n\nDownload the latest snapshot and top it up with the newest runs:\n\n```bash\nnpm ci                       # first time only, from the repo root\nGITHUB_TOKEN=$(gh auth token) node utils/test-results-db/cli.ts update --lookback-days 3\n```\n\n`update` downloads the snapshot first when there is no local database, then\ningests only the artifacts the snapshot lacks. Never delete the database to\nrebuild it: every artifact costs one GitHub API request, the budget is shared\nby every workflow in the repository, and a rebuild of a few days exhausts it.\nTo only refresh the snapshot without ingesting, run `download`.\n\nQuery it through the bundled `@duckdb/node-api` binding — no separate DuckDB\ninstall needed, it ships in `node_modules` after `npm ci`:\n\n```bash\nnode --input-type=module -e '\nimport { DuckDBInstance } from \"@duckdb/node-api\";\nconst conn = await (await DuckDBInstance.create(\"utils/test-results-db/test-results.duckdb\")).connect();\nconsole.table((await conn.runAndReadAll(process.argv[1])).getRowObjectsJson());\n' \"SELECT count(*) FROM test_results\"\n```\n\nInteger columns come back as strings (JSON-safe), so do ranking and filtering\nin SQL, not in JS.\n\n## Schema\n\nSingle table `test_results`, one row per test result (**one row per retry**).\nThe columns are inferred from the parquet the reporter emits\n(`tests/config/parquetReporter.ts`), plus two trailing columns this CLI adds:\n\n| Column | Meaning |\n| --- | --- |\n| `run_id`, `run_attempt` | GitHub Actions run identity |\n| `run_started_at` | when the run started |\n| `workflow_name` | e.g. `tests 1` / `tests 2` / `tests others` / `tests chromium roll` / `MCP` |\n| `event` | `push` / `pull_request` |\n| `head_sha`, `head_branch`, `pr_number` | what was tested |\n| `bot_name` | e.g. `chromium-ubuntu-22.04-node20`, `webkit-macos-15-large` — the CI bot. **OS and arch are encoded here**; there is no separate os column. |\n| `project_name` | CI project = browser + suite, e.g. `chromium-page`, `webkit-library`, `playwright-test` |\n| `test_title` | title path within the file, joined by ` › ` (`describe › test`) |\n| `file`, `line`, `column_number` | source location (file is relative to repo root) |\n| `expected_status` | `passed` / `skipped` / ... |\n| `status` | actual result: `passed` / `failed` / `timedOut` / `skipped` / `interrupted` |\n| `retry` | 0 = first attempt |\n| `result_started_at` | when this attempt started |\n| `duration_ms` | result duration |\n| `error_message` | all errors joined, ANSI-stripped (NULL when none) |\n| `tags` | **list** of strings, e.g. `['@slow', '@flaky']` (use list functions / `list_contains`) |\n| `annotations` | list of `{type, description}` structs, e.g. `[{'type': 'skip', 'description': 'flaky on CI'}]` (empty list when none) |\n| `artifact_id` | the GitHub artifact this row came from (dedupe key) |\n| `ingested_at` | debug only — when this row was imported |\n\nNotes:\n- **A test is identified by `(project_name, file, test_title)`** — group on that\n  tuple. (Playwright's `test_id` hash is deliberately not stored; those three\n  columns are its pre-image.)\n- **Flakiness is derived**, not stored. The signal that matters most is\n  **cross-run**: a test whose *final* verdict (after retries) flips between\n  runs — green in some, red in others. A separate **within-run** flake is a\n  test a retry rescued inside a single run (`failed`→`passed`).\n- **Real failures vs intentional ones:** filter `expected_status = 'passed'`.\n  Tests marked `test.fail()` record `status='failed'` *with*\n  `expected_status='failed'` and would otherwise dominate any \"most failing\" list.\n- The db is size-capped by **run count**: the oldest whole runs are evicted over\n  time, so it holds a recent window, not full history.\n\n## Example queries\n\nGroup tests by `(project_name, file, test_title)` and (for failure/flakiness)\nscope to `expected_status = 'passed'` so intentional `test.fail()` tests don't\nskew the results.\n\n**Flaky across runs** — the test's final verdict flips between runs (this is\nwhat makes a red CI run ambiguous). `least(failed_runs, passed_runs)` ranks\ngenuinely bimodal tests above both always-broken and one-off failures:\n\n```sql\nWITH per_run AS (\n  SELECT project_name, file, test_title, run_id, run_attempt,\n         arg_max(status, retry) AS final_status,\n         any_value(expected_status) AS expected\n  FROM test_results\n  GROUP BY project_name, file, test_title, run_id, run_attempt)\nSELECT project_name, test_title,\n       count(*) AS runs,\n       count(*) FILTER (WHERE final_status IN ('failed','timedOut')) AS failed_runs,\n       count(*) FILTER (WHERE final_status = 'passed') AS passed_runs,\n       round(100.0 * count(*) FILTER (WHERE final_status IN ('failed','timedOut'))\n             / count(*), 1) AS fail_pct\nFROM per_run\nWHERE expected = 'passed'\nGROUP BY project_name, test_title\nHAVING failed_runs > 0 AND passed_runs > 0 AND runs >= 10\nORDER BY least(failed_runs, passed_runs) DESC, failed_runs DESC\nLIMIT 20;\n```\n\n**Filter by tag** (`tags` is a list, not a string):\n\n```sql\nSELECT project_name, test_title, count(*) AS runs\nFROM test_results\nWHERE list_contains(tags, '@slow')\nGROUP BY project_name, test_title\nORDER BY runs DESC\nLIMIT 20;\n```\n\n## Generate a linked emoji run history\n\nFor a compact result that drops straight into a GitHub comment, render each\nfinal run verdict as a linked square. Edit the four test identity fields, then\nrun:\n\n```bash\nnode --input-type=module <<'EOF'\nimport { DuckDBInstance } from \"@duckdb/node-api\";\n\nconst repository = \"microsoft/playwright\";\nconst test = {\n  projectName: \"firefox-library\",\n  file: \"library/proxy.spec.ts\",\n  testTitle: \"should exclude patterns\",\n  botName: \"firefox-macos-15-large\",\n};\n\nconst conn = await (await DuckDBInstance.create(\n  \"utils/test-results-db/test-results.duckdb\"\n)).connect();\nconst result = await conn.runAndReadAll(`\n  WITH per_run AS (\n    SELECT run_id, run_attempt,\n           any_value(run_started_at) AS run_started_at,\n           arg_max(status, retry) AS final_status,\n           arg_max(expected_status, retry) AS expected_status,\n           list(status ORDER BY retry) AS attempt_statuses\n    FROM test_results\n    WHERE project_name = $projectName\n      AND file = $file\n      AND test_title = $testTitle\n      AND bot_name = $botName\n    GROUP BY run_id, run_attempt\n  )\n  SELECT run_id, run_attempt, final_status, attempt_statuses\n  FROM per_run\n  WHERE expected_status = 'passed'\n    AND final_status IN ('passed', 'failed', 'timedOut')\n  ORDER BY run_started_at, run_id, run_attempt\n`, test);\n\nconst markdown = result.getRowObjectsJson().map(row => {\n  const rescued = row.final_status === \"passed\" &&\n    row.attempt_statuses.some(status => status === \"failed\" || status === \"timedOut\");\n  const emoji = rescued ? \"🟧\" : row.final_status === \"passed\" ? \"🟩\" : \"🟥\";\n  const url = `https://github.com/${repository}/actions/runs/${row.run_id}/attempts/${row.run_attempt}`;\n  return `[${emoji}](${url})`;\n}).join(\"\");\n\nconsole.log(markdown);\nEOF\n```\n\nThe output is Markdown:\n\n```markdown\n[🟩](https://github.com/microsoft/playwright/actions/runs/123/attempts/1)[🟧](https://github.com/microsoft/playwright/actions/runs/456/attempts/1)[🟥](https://github.com/microsoft/playwright/actions/runs/789/attempts/1)\n```\n\nEach square is one workflow run attempt, oldest first. Green means passed,\norange means a retry rescued an earlier failure, and red means failed or timed\nout. `arg_max(status, retry)` picks the final verdict after retries, while\ngrouping by `(run_id, run_attempt)` keeps retries from turning into extra\nsquares. The `/attempts/<n>` URL links to the exact rerun that produced the\nresult.\n\n## Fetching the full detail\n\nThe db stores per-result summaries. For the full step tree / attachments / stdio,\nfetch the original blob report for that run, if the run uploaded one. A row\nidentifies it by `run_id` + `bot_name`: the run's blob artifact is named\n`blob-report-<bot_name>`.\n\n```bash\n# List the run's blob artifacts and find the one for this bot_name:\ngh api /repos/microsoft/playwright/actions/runs/<run_id>/artifacts \\\n  --jq '.artifacts[] | select(.name | startswith(\"blob-report\")) | {id, name}'\n\n# Download it (name == \"blob-report-<bot_name>\"):\ngh api /repos/microsoft/playwright/actions/artifacts/<artifact_id>/zip > blob.zip\n```\n\nBlob and parquet artifacts have a 7-day retention, so this works only for recent\nruns; the db itself retains summaries longer (until run-count eviction).\n"}}
