@willbooster/agent-skills 1.15.2 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -17
- package/dist/cli.js +3 -3
- package/package.json +3 -2
- package/skills/check-pr-ci/SKILL.md +12 -0
- package/skills/complete-pr/SKILL.md +32 -0
- package/skills/fetch-issue/SKILL.md +9 -0
- package/skills/fetch-pr/SKILL.md +9 -0
- package/skills/fix-bug/SKILL.md +21 -0
- package/skills/manage-pr-review-threads/SKILL.md +35 -0
- package/skills/open-pr/SKILL.md +39 -0
- package/skills/plan-issue-claude/SKILL.md +10 -0
- package/skills/plan-issue-codex/SKILL.md +10 -0
- package/skills/plan-issue-gemini/SKILL.md +10 -0
- package/skills/playwright-cli/SKILL.md +331 -0
- package/skills/playwright-cli/references/element-attributes.md +23 -0
- package/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/skills/playwright-cli/references/request-mocking.md +87 -0
- package/skills/playwright-cli/references/running-code.md +231 -0
- package/skills/playwright-cli/references/session-management.md +170 -0
- package/skills/playwright-cli/references/storage-state.md +275 -0
- package/skills/playwright-cli/references/test-generation.md +88 -0
- package/skills/playwright-cli/references/tracing.md +142 -0
- package/skills/playwright-cli/references/video-recording.md +146 -0
- package/skills/refactor-structure/SKILL.md +12 -0
- package/skills/review-all/SKILL.md +13 -0
- package/skills/review-claude/SKILL.md +10 -0
- package/skills/review-codex/SKILL.md +10 -0
- package/skills/review-fix-all/SKILL.md +17 -0
- package/skills/review-fix-claude/SKILL.md +15 -0
- package/skills/review-fix-codex/SKILL.md +15 -0
- package/skills/review-fix-gemini/SKILL.md +15 -0
- package/skills/review-gemini/SKILL.md +10 -0
- package/skills/screenshot-claude/SKILL.md +13 -0
- package/skills/screenshot-codex/SKILL.md +13 -0
- package/skills/screenshot-gemini/SKILL.md +13 -0
- package/skills/simplify-pr-claude/SKILL.md +10 -0
- package/skills/simplify-pr-codex/SKILL.md +10 -0
- package/skills/simplify-pr-gemini/SKILL.md +10 -0
- package/skills/update-pr/SKILL.md +60 -0
- package/skills/wbfy/SKILL.md +17 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Request Mocking
|
|
2
|
+
|
|
3
|
+
Intercept, mock, modify, and block network requests.
|
|
4
|
+
|
|
5
|
+
## CLI Route Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Mock with custom status
|
|
9
|
+
bunx @playwright/cli@latest route "**/*.jpg" --status=404
|
|
10
|
+
|
|
11
|
+
# Mock with JSON body
|
|
12
|
+
bunx @playwright/cli@latest route "**/api/users" --body='[{"id":1,"name":"Alice"}]' --content-type=application/json
|
|
13
|
+
|
|
14
|
+
# Mock with custom headers
|
|
15
|
+
bunx @playwright/cli@latest route "**/api/data" --body='{"ok":true}' --header="X-Custom: value"
|
|
16
|
+
|
|
17
|
+
# Remove headers from requests
|
|
18
|
+
bunx @playwright/cli@latest route "**/*" --remove-header=cookie,authorization
|
|
19
|
+
|
|
20
|
+
# List active routes
|
|
21
|
+
bunx @playwright/cli@latest route-list
|
|
22
|
+
|
|
23
|
+
# Remove a route or all routes
|
|
24
|
+
bunx @playwright/cli@latest unroute "**/*.jpg"
|
|
25
|
+
bunx @playwright/cli@latest unroute
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## URL Patterns
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
**/api/users - Exact path match
|
|
32
|
+
**/api/*/details - Wildcard in path
|
|
33
|
+
**/*.{png,jpg,jpeg} - Match file extensions
|
|
34
|
+
**/search?q=* - Match query parameters
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Advanced Mocking with run-code
|
|
38
|
+
|
|
39
|
+
For conditional responses, request body inspection, response modification, or delays:
|
|
40
|
+
|
|
41
|
+
### Conditional Response Based on Request
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
45
|
+
await page.route('**/api/login', route => {
|
|
46
|
+
const body = route.request().postDataJSON();
|
|
47
|
+
if (body.username === 'admin') {
|
|
48
|
+
route.fulfill({ body: JSON.stringify({ token: 'mock-token' }) });
|
|
49
|
+
} else {
|
|
50
|
+
route.fulfill({ status: 401, body: JSON.stringify({ error: 'Invalid' }) });
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Modify Real Response
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
60
|
+
await page.route('**/api/user', async route => {
|
|
61
|
+
const response = await route.fetch();
|
|
62
|
+
const json = await response.json();
|
|
63
|
+
json.isPremium = true;
|
|
64
|
+
await route.fulfill({ response, json });
|
|
65
|
+
});
|
|
66
|
+
}"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Simulate Network Failures
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
73
|
+
await page.route('**/api/offline', route => route.abort('internetdisconnected'));
|
|
74
|
+
}"
|
|
75
|
+
# Options: connectionrefused, timedout, connectionreset, internetdisconnected
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Delayed Response
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
82
|
+
await page.route('**/api/slow', async route => {
|
|
83
|
+
await new Promise(r => setTimeout(r, 3000));
|
|
84
|
+
route.fulfill({ body: JSON.stringify({ data: 'loaded' }) });
|
|
85
|
+
});
|
|
86
|
+
}"
|
|
87
|
+
```
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Running Custom Playwright Code
|
|
2
|
+
|
|
3
|
+
Use `run-code` to execute arbitrary Playwright code for advanced scenarios not covered by CLI commands.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
9
|
+
// Your Playwright code here
|
|
10
|
+
// Access page.context() for browser context operations
|
|
11
|
+
}"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Geolocation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Grant geolocation permission and set location
|
|
18
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
19
|
+
await page.context().grantPermissions(['geolocation']);
|
|
20
|
+
await page.context().setGeolocation({ latitude: 37.7749, longitude: -122.4194 });
|
|
21
|
+
}"
|
|
22
|
+
|
|
23
|
+
# Set location to London
|
|
24
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
25
|
+
await page.context().grantPermissions(['geolocation']);
|
|
26
|
+
await page.context().setGeolocation({ latitude: 51.5074, longitude: -0.1278 });
|
|
27
|
+
}"
|
|
28
|
+
|
|
29
|
+
# Clear geolocation override
|
|
30
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
31
|
+
await page.context().clearPermissions();
|
|
32
|
+
}"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Permissions
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Grant multiple permissions
|
|
39
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
40
|
+
await page.context().grantPermissions([
|
|
41
|
+
'geolocation',
|
|
42
|
+
'notifications',
|
|
43
|
+
'camera',
|
|
44
|
+
'microphone'
|
|
45
|
+
]);
|
|
46
|
+
}"
|
|
47
|
+
|
|
48
|
+
# Grant permissions for specific origin
|
|
49
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
50
|
+
await page.context().grantPermissions(['clipboard-read'], {
|
|
51
|
+
origin: 'https://example.com'
|
|
52
|
+
});
|
|
53
|
+
}"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Media Emulation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Emulate dark color scheme
|
|
60
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
61
|
+
await page.emulateMedia({ colorScheme: 'dark' });
|
|
62
|
+
}"
|
|
63
|
+
|
|
64
|
+
# Emulate light color scheme
|
|
65
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
66
|
+
await page.emulateMedia({ colorScheme: 'light' });
|
|
67
|
+
}"
|
|
68
|
+
|
|
69
|
+
# Emulate reduced motion
|
|
70
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
71
|
+
await page.emulateMedia({ reducedMotion: 'reduce' });
|
|
72
|
+
}"
|
|
73
|
+
|
|
74
|
+
# Emulate print media
|
|
75
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
76
|
+
await page.emulateMedia({ media: 'print' });
|
|
77
|
+
}"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Wait Strategies
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Wait for network idle
|
|
84
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
85
|
+
await page.waitForLoadState('networkidle');
|
|
86
|
+
}"
|
|
87
|
+
|
|
88
|
+
# Wait for specific element
|
|
89
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
90
|
+
await page.locator('.loading').waitFor({ state: 'hidden' });
|
|
91
|
+
}"
|
|
92
|
+
|
|
93
|
+
# Wait for function to return true
|
|
94
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
95
|
+
await page.waitForFunction(() => window.appReady === true);
|
|
96
|
+
}"
|
|
97
|
+
|
|
98
|
+
# Wait with timeout
|
|
99
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
100
|
+
await page.locator('.result').waitFor({ timeout: 10000 });
|
|
101
|
+
}"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Frames and Iframes
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Work with iframe
|
|
108
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
109
|
+
const frame = page.locator('iframe#my-iframe').contentFrame();
|
|
110
|
+
await frame.locator('button').click();
|
|
111
|
+
}"
|
|
112
|
+
|
|
113
|
+
# Get all frames
|
|
114
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
115
|
+
const frames = page.frames();
|
|
116
|
+
return frames.map(f => f.url());
|
|
117
|
+
}"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## File Downloads
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Handle file download
|
|
124
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
125
|
+
const downloadPromise = page.waitForEvent('download');
|
|
126
|
+
await page.getByRole('link', { name: 'Download' }).click();
|
|
127
|
+
const download = await downloadPromise;
|
|
128
|
+
await download.saveAs('./downloaded-file.pdf');
|
|
129
|
+
return download.suggestedFilename();
|
|
130
|
+
}"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Clipboard
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Read clipboard (requires permission)
|
|
137
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
138
|
+
await page.context().grantPermissions(['clipboard-read']);
|
|
139
|
+
return await page.evaluate(() => navigator.clipboard.readText());
|
|
140
|
+
}"
|
|
141
|
+
|
|
142
|
+
# Write to clipboard
|
|
143
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
144
|
+
await page.evaluate(text => navigator.clipboard.writeText(text), 'Hello clipboard!');
|
|
145
|
+
}"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Page Information
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Get page title
|
|
152
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
153
|
+
return await page.title();
|
|
154
|
+
}"
|
|
155
|
+
|
|
156
|
+
# Get current URL
|
|
157
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
158
|
+
return page.url();
|
|
159
|
+
}"
|
|
160
|
+
|
|
161
|
+
# Get page content
|
|
162
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
163
|
+
return await page.content();
|
|
164
|
+
}"
|
|
165
|
+
|
|
166
|
+
# Get viewport size
|
|
167
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
168
|
+
return page.viewportSize();
|
|
169
|
+
}"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## JavaScript Execution
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# Execute JavaScript and return result
|
|
176
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
177
|
+
return await page.evaluate(() => {
|
|
178
|
+
return {
|
|
179
|
+
userAgent: navigator.userAgent,
|
|
180
|
+
language: navigator.language,
|
|
181
|
+
cookiesEnabled: navigator.cookieEnabled
|
|
182
|
+
};
|
|
183
|
+
});
|
|
184
|
+
}"
|
|
185
|
+
|
|
186
|
+
# Pass arguments to evaluate
|
|
187
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
188
|
+
const multiplier = 5;
|
|
189
|
+
return await page.evaluate(m => document.querySelectorAll('li').length * m, multiplier);
|
|
190
|
+
}"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Error Handling
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Try-catch in run-code
|
|
197
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
198
|
+
try {
|
|
199
|
+
await page.getByRole('button', { name: 'Submit' }).click({ timeout: 1000 });
|
|
200
|
+
return 'clicked';
|
|
201
|
+
} catch (e) {
|
|
202
|
+
return 'element not found';
|
|
203
|
+
}
|
|
204
|
+
}"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Complex Workflows
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Login and save state
|
|
211
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
212
|
+
await page.goto('https://example.com/login');
|
|
213
|
+
await page.getByRole('textbox', { name: 'Email' }).fill('user@example.com');
|
|
214
|
+
await page.getByRole('textbox', { name: 'Password' }).fill('secret');
|
|
215
|
+
await page.getByRole('button', { name: 'Sign in' }).click();
|
|
216
|
+
await page.waitForURL('**/dashboard');
|
|
217
|
+
await page.context().storageState({ path: 'auth.json' });
|
|
218
|
+
return 'Login successful';
|
|
219
|
+
}"
|
|
220
|
+
|
|
221
|
+
# Scrape data from multiple pages
|
|
222
|
+
bunx @playwright/cli@latest run-code "async page => {
|
|
223
|
+
const results = [];
|
|
224
|
+
for (let i = 1; i <= 3; i++) {
|
|
225
|
+
await page.goto(\`https://example.com/page/\${i}\`);
|
|
226
|
+
const items = await page.locator('.item').allTextContents();
|
|
227
|
+
results.push(...items);
|
|
228
|
+
}
|
|
229
|
+
return results;
|
|
230
|
+
}"
|
|
231
|
+
```
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Browser Session Management
|
|
2
|
+
|
|
3
|
+
Run multiple isolated browser sessions concurrently with state persistence.
|
|
4
|
+
|
|
5
|
+
## Named Browser Sessions
|
|
6
|
+
|
|
7
|
+
Use `-s` flag to isolate browser contexts:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Browser 1: Authentication flow
|
|
11
|
+
bunx @playwright/cli@latest -s=auth open https://app.example.com/login
|
|
12
|
+
|
|
13
|
+
# Browser 2: Public browsing (separate cookies, storage)
|
|
14
|
+
bunx @playwright/cli@latest -s=public open https://example.com
|
|
15
|
+
|
|
16
|
+
# Commands are isolated by browser session
|
|
17
|
+
bunx @playwright/cli@latest -s=auth fill e1 "user@example.com"
|
|
18
|
+
bunx @playwright/cli@latest -s=public snapshot
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Browser Session Isolation Properties
|
|
22
|
+
|
|
23
|
+
Each browser session has independent:
|
|
24
|
+
|
|
25
|
+
- Cookies
|
|
26
|
+
- LocalStorage / SessionStorage
|
|
27
|
+
- IndexedDB
|
|
28
|
+
- Cache
|
|
29
|
+
- Browsing history
|
|
30
|
+
- Open tabs
|
|
31
|
+
|
|
32
|
+
## Browser Session Commands
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# List all browser sessions
|
|
36
|
+
bunx @playwright/cli@latest list
|
|
37
|
+
|
|
38
|
+
# Stop a browser session (close the browser)
|
|
39
|
+
bunx @playwright/cli@latest close # stop the default browser
|
|
40
|
+
bunx @playwright/cli@latest -s=mysession close # stop a named browser
|
|
41
|
+
|
|
42
|
+
# Stop all browser sessions
|
|
43
|
+
bunx @playwright/cli@latest close-all
|
|
44
|
+
|
|
45
|
+
# Forcefully kill all daemon processes (for stale/zombie processes)
|
|
46
|
+
bunx @playwright/cli@latest kill-all
|
|
47
|
+
|
|
48
|
+
# Delete browser session user data (profile directory)
|
|
49
|
+
bunx @playwright/cli@latest delete-data # delete default browser data
|
|
50
|
+
bunx @playwright/cli@latest -s=mysession delete-data # delete named browser data
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Environment Variable
|
|
54
|
+
|
|
55
|
+
Set a default browser session name via environment variable:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
export PLAYWRIGHT_CLI_SESSION="mysession"
|
|
59
|
+
bunx @playwright/cli@latest open example.com # Uses "mysession" automatically
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Common Patterns
|
|
63
|
+
|
|
64
|
+
### Concurrent Scraping
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
#!/bin/bash
|
|
68
|
+
# Scrape multiple sites concurrently
|
|
69
|
+
|
|
70
|
+
# Start all browsers
|
|
71
|
+
bunx @playwright/cli@latest -s=site1 open https://site1.com &
|
|
72
|
+
bunx @playwright/cli@latest -s=site2 open https://site2.com &
|
|
73
|
+
bunx @playwright/cli@latest -s=site3 open https://site3.com &
|
|
74
|
+
wait
|
|
75
|
+
|
|
76
|
+
# Take snapshots from each
|
|
77
|
+
bunx @playwright/cli@latest -s=site1 snapshot
|
|
78
|
+
bunx @playwright/cli@latest -s=site2 snapshot
|
|
79
|
+
bunx @playwright/cli@latest -s=site3 snapshot
|
|
80
|
+
|
|
81
|
+
# Cleanup
|
|
82
|
+
bunx @playwright/cli@latest close-all
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### A/B Testing Sessions
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Test different user experiences
|
|
89
|
+
bunx @playwright/cli@latest -s=variant-a open "https://app.com?variant=a"
|
|
90
|
+
bunx @playwright/cli@latest -s=variant-b open "https://app.com?variant=b"
|
|
91
|
+
|
|
92
|
+
# Compare
|
|
93
|
+
bunx @playwright/cli@latest -s=variant-a screenshot
|
|
94
|
+
bunx @playwright/cli@latest -s=variant-b screenshot
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Persistent Profile
|
|
98
|
+
|
|
99
|
+
By default, browser profile is kept in memory only. Use `--persistent` flag on `open` to persist the browser profile to disk:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Use persistent profile (auto-generated location)
|
|
103
|
+
bunx @playwright/cli@latest open https://example.com --persistent
|
|
104
|
+
|
|
105
|
+
# Use persistent profile with custom directory
|
|
106
|
+
bunx @playwright/cli@latest open https://example.com --profile=/path/to/profile
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Default Browser Session
|
|
110
|
+
|
|
111
|
+
When `-s` is omitted, commands use the default browser session:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# These use the same default browser session
|
|
115
|
+
bunx @playwright/cli@latest open https://example.com
|
|
116
|
+
bunx @playwright/cli@latest snapshot
|
|
117
|
+
bunx @playwright/cli@latest close # Stops default browser
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Browser Session Configuration
|
|
121
|
+
|
|
122
|
+
Configure a browser session with specific settings when opening:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Open with config file
|
|
126
|
+
bunx @playwright/cli@latest open https://example.com --config=.playwright/my-cli.json
|
|
127
|
+
|
|
128
|
+
# Open with specific browser
|
|
129
|
+
bunx @playwright/cli@latest open https://example.com --browser=firefox
|
|
130
|
+
|
|
131
|
+
# Open in headed mode
|
|
132
|
+
bunx @playwright/cli@latest open https://example.com --headed
|
|
133
|
+
|
|
134
|
+
# Open with persistent profile
|
|
135
|
+
bunx @playwright/cli@latest open https://example.com --persistent
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Best Practices
|
|
139
|
+
|
|
140
|
+
### 1. Name Browser Sessions Semantically
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# GOOD: Clear purpose
|
|
144
|
+
bunx @playwright/cli@latest -s=github-auth open https://github.com
|
|
145
|
+
bunx @playwright/cli@latest -s=docs-scrape open https://docs.example.com
|
|
146
|
+
|
|
147
|
+
# AVOID: Generic names
|
|
148
|
+
bunx @playwright/cli@latest -s=s1 open https://github.com
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 2. Always Clean Up
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Stop browsers when done
|
|
155
|
+
bunx @playwright/cli@latest -s=auth close
|
|
156
|
+
bunx @playwright/cli@latest -s=scrape close
|
|
157
|
+
|
|
158
|
+
# Or stop all at once
|
|
159
|
+
bunx @playwright/cli@latest close-all
|
|
160
|
+
|
|
161
|
+
# If browsers become unresponsive or zombie processes remain
|
|
162
|
+
bunx @playwright/cli@latest kill-all
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 3. Delete Stale Browser Data
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# Remove old browser data to free disk space
|
|
169
|
+
bunx @playwright/cli@latest -s=oldsession delete-data
|
|
170
|
+
```
|