Skip to content

Commit 31572b6

Browse files
authored
chore: devtools experiment (#39204)
1 parent 34042a2 commit 31572b6

File tree

31 files changed

+1439
-19
lines changed

31 files changed

+1439
-19
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: playwright-api
3+
description: Explains how to add playwright API methods.
4+
---
5+
6+
# API
7+
8+
## Adding and modifying APIs
9+
- 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.
10+
- Define (or update) API in `docs/api/class-xxx.md`. For the new methods, params and options use the version from package.json (without -next).
11+
- Watch will kick in and re-generate types for the API
12+
- Implement the new API in `packages/playwright/src/client/xxx.ts`
13+
- Define (or update) channel for the API in `packages/protocol/src/protocol.yml` as needed
14+
- Watch will kick in and re-generate types for protocol channels
15+
- Implement dispatcher handler in `packages/playwright/src/server/dispatchers/xxxDispatcher.ts` as needed
16+
- Handler should just route the call into the corresponding method in `packages/playwright-core/src/server/xxx.ts`
17+
- Place new tests in `tests/page/xxx.spec.ts` or create new test file if needed
18+
19+
# Build
20+
- Assume watch is running and everything is up to date.
21+
22+
# Test
23+
- If your tests are only using page, prefer to place them in `tests/page/xxx.spec.ts` and use page fixture. If you need to use browser context, place them in `tests/library/xxx.spec.ts`.
24+
- Run npm test as `npm run ctest <file>`
25+
26+
# Lint
27+
- In the end lint via `npm run flint`.

.claude/skills/playwright-mcp-dev/SKILL.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ description: Explains how to add and debug playwright MCP tools and CLI commands
3030
in `packages/playwright/src/skill/references/`
3131
- Place new tests in `tests/mcp/cli-<category>.spec.ts`
3232

33+
## Adding CLI options or Config options
34+
When you need to add something to config.
35+
36+
- `packages/playwright/src/mcp/program.ts`
37+
- add CLI option and doc
38+
- `packages/playwright/src/mcp/config.d.ts`
39+
- add and document the option
40+
- `packages/playwright/src/mcp/config.ts`
41+
- modify FullConfig if needed
42+
- and CLIOptions if needed
43+
- add it to configFromEnv
44+
3345
## Building
3446
- Assume watch is running at all times, run lint to see type errors
3547

package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/devtools/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

packages/devtools/index.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!--
2+
Copyright (c) Microsoft Corporation.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<!DOCTYPE html>
17+
<html lang="en" translate="no">
18+
<head>
19+
<meta charset="UTF-8">
20+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
21+
<title>Playwright Remote Control</title>
22+
</head>
23+
<body>
24+
<div id="root"></div>
25+
<script type="module" src="/src/index.tsx"></script>
26+
</body>
27+
</html>

packages/devtools/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "@playwright/devtools",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module"
6+
}

0 commit comments

Comments
 (0)