Skip to content

Commit 8b80c85

Browse files
authored
chore(cli): split open/goto skills (#39164)
1 parent 0f542ec commit 8b80c85

File tree

3 files changed

+29
-17
lines changed

3 files changed

+29
-17
lines changed

packages/playwright/src/mcp/terminal/program.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -573,19 +573,19 @@ async function install(args: MinimistArgs) {
573573
// Create .playwright folder to mark workspace root
574574
const playwrightDir = path.join(cwd, '.playwright');
575575
await fs.promises.mkdir(playwrightDir, { recursive: true });
576-
console.log(`Workspace initialized at ${cwd}`);
576+
console.log(`Workspace initialized at \`${cwd}\`.`);
577577

578578
if (args.skills) {
579579
const skillSourceDir = path.join(__dirname, '../../skill');
580580
const skillDestDir = path.join(cwd, '.claude', 'skills', 'playwright-cli');
581581

582582
if (!fs.existsSync(skillSourceDir)) {
583-
console.error('Skills source directory not found:', skillSourceDir);
583+
console.error('Skills source directory not found:', skillSourceDir);
584584
process.exit(1);
585585
}
586586

587587
await fs.promises.cp(skillSourceDir, skillDestDir, { recursive: true });
588-
console.log(`Skills installed to ${path.relative(cwd, skillDestDir)}`);
588+
console.log(`Skills installed to \`${path.relative(cwd, skillDestDir)}\`.`);
589589
}
590590

591591
if (!args.config)
@@ -622,7 +622,7 @@ async function createDefaultConfig(channel: string) {
622622
},
623623
};
624624
await fs.promises.writeFile(defaultConfigFile(), JSON.stringify(config, null, 2));
625-
console.log(`Created default config for ${channel} at ${path.relative(process.cwd(), defaultConfigFile())}.`);
625+
console.log(`Created default config for ${channel} at ${path.relative(process.cwd(), defaultConfigFile())}.`);
626626
}
627627

628628
async function findOrInstallDefaultBrowser() {
@@ -632,7 +632,7 @@ async function findOrInstallDefaultBrowser() {
632632
const executable = registry.findExecutable(channel);
633633
if (!executable?.executablePath())
634634
continue;
635-
console.log(`Found ${channel}, will use it as the default browser.`);
635+
console.log(`Found ${channel}, will use it as the default browser.`);
636636
return channel;
637637
}
638638
const chromiumExecutable = registry.findExecutable('chromium');

packages/playwright/src/skill/SKILL.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,29 @@ allowed-tools: Bash(playwright-cli:*)
99
## Quick start
1010

1111
```bash
12-
playwright-cli open https://playwright.dev
12+
# open new browser
13+
playwright-cli open
14+
# navigate to a page
15+
playwright-cli goto https://playwright.dev
16+
# interact with the page using refs from the snapshot
1317
playwright-cli click e15
1418
playwright-cli type "page.click"
1519
playwright-cli press Enter
20+
# take a screenshot
21+
playwright-cli screenshot
22+
# close the browser
23+
playwright-cli close
1624
```
1725

18-
## Core workflow
19-
20-
1. Navigate: `playwright-cli open https://example.com`
21-
2. Interact using refs from the snapshot
22-
3. Re-snapshot after significant changes
23-
2426
## Commands
2527

2628
### Core
2729

2830
```bash
31+
playwright-cli open
32+
# open and navigate right away
2933
playwright-cli open https://example.com/
30-
playwright-cli close
34+
playwright-cli goto https://playwright.dev
3135
playwright-cli type "search query"
3236
playwright-cli click e3
3337
playwright-cli dblclick e7
@@ -46,6 +50,7 @@ playwright-cli dialog-accept
4650
playwright-cli dialog-accept "confirmation text"
4751
playwright-cli dialog-dismiss
4852
playwright-cli resize 1920 1080
53+
playwright-cli close
4954
```
5055
5156
### Navigation
@@ -153,8 +158,8 @@ playwright-cli video-stop video.webm
153158
### Install
154159
155160
```bash
161+
playwright-cli install --skills
156162
playwright-cli install-browser
157-
playwright-cli install-skills
158163
```
159164
160165
### Configuration
@@ -184,10 +189,13 @@ playwright-cli delete-data
184189
### Browser Sessions
185190
186191
```bash
187-
playwright-cli -s=mysession open example.com
192+
# create new browser session named "mysession" with persistent profile
193+
playwright-cli -s=mysession open example.com --persistent
194+
# same with manually specified profile directory (use when requested explicitly)
195+
playwright-cli -s=mysession open example.com --profile=/path/to/profile
188196
playwright-cli -s=mysession click e6
189197
playwright-cli -s=mysession close # stop a named browser
190-
playwright-cli -s=mysession delete-data # delete user data for named browser
198+
playwright-cli -s=mysession delete-data # delete user data for persistent session
191199

192200
playwright-cli list
193201
# Close all browsers
@@ -206,6 +214,7 @@ playwright-cli fill e1 "[email protected]"
206214
playwright-cli fill e2 "password123"
207215
playwright-cli click e3
208216
playwright-cli snapshot
217+
playwright-cli close
209218
```
210219
211220
## Example: Multi-tab workflow
@@ -216,6 +225,7 @@ playwright-cli tab-new https://example.com/other
216225
playwright-cli tab-list
217226
playwright-cli tab-select 0
218227
playwright-cli snapshot
228+
playwright-cli close
219229
```
220230
221231
## Example: Debugging with DevTools
@@ -226,6 +236,7 @@ playwright-cli click e4
226236
playwright-cli fill e7 "test"
227237
playwright-cli console
228238
playwright-cli network
239+
playwright-cli close
229240
```
230241
231242
```bash
@@ -234,6 +245,7 @@ playwright-cli tracing-start
234245
playwright-cli click e4
235246
playwright-cli fill e7 "test"
236247
playwright-cli tracing-stop
248+
playwright-cli close
237249
```
238250
239251
## Specific tasks

tests/mcp/cli-misc.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ test('install workspace', async ({ cli }, testInfo) => {
4343

4444
test('install workspace w/skills', async ({ cli }, testInfo) => {
4545
const { output } = await cli('install', '--skills');
46-
expect(output).toContain(`Skills installed to .claude${path.sep}skills${path.sep}playwright-cli`);
46+
expect(output).toContain(`Skills installed to \`.claude${path.sep}skills${path.sep}playwright-cli\`.`);
4747

4848
const skillFile = testInfo.outputPath('.claude', 'skills', 'playwright-cli', 'SKILL.md');
4949
expect(fs.existsSync(skillFile)).toBe(true);

0 commit comments

Comments
 (0)