stably 4.12.2 → 4.12.4
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/dist/index.mjs +1 -1
- package/dist/node_modules/playwright/lib/cli/daemon/daemon.js +43 -0
- package/dist/node_modules/playwright/lib/index.js +32 -1
- package/dist/node_modules/playwright/lib/mcp/browser/browserServerBackend.js +27 -0
- package/dist/node_modules/playwright/lib/mcp/browser/config.js.rej +11 -0
- package/dist/node_modules/playwright/lib/mcp/browser/context.js +52 -0
- package/dist/node_modules/playwright/lib/mcp/browser/sessionLog.js +50 -0
- package/dist/node_modules/playwright/lib/mcp/test/browserBackend.js +6 -1
- package/dist/{playwright-cli.js → stably-browser.js} +22 -14
- package/dist/stably-plugin-cli/skills/browser-interaction-guide/SKILL.md +30 -30
- package/dist/stably-plugin-cli/skills/bulk-test-handling/SKILL.md +1 -1
- package/dist/stably-plugin-cli/skills/debugging-test-failures/SKILL.md +11 -11
- package/dist/stably-plugin-cli/skills/playwright-best-practices/SKILL.md +6 -6
- package/dist/stably-plugin-cli/skills/playwright-config-auth/SKILL.md +8 -8
- package/dist/stably-plugin-cli/skills/{playwright-cli → stably-browser}/SKILL.md +156 -156
- package/dist/stably-plugin-cli/skills/{playwright-cli → stably-browser}/references/request-mocking.md +11 -11
- package/dist/stably-plugin-cli/skills/{playwright-cli → stably-browser}/references/running-code.md +28 -28
- package/dist/stably-plugin-cli/skills/{playwright-cli → stably-browser}/references/session-management.md +40 -40
- package/dist/stably-plugin-cli/skills/{playwright-cli → stably-browser}/references/storage-state.md +41 -41
- package/dist/stably-plugin-cli/skills/{playwright-cli → stably-browser}/references/test-generation.md +10 -10
- package/dist/stably-plugin-cli/skills/{playwright-cli → stably-browser}/references/tracing.md +23 -23
- package/dist/stably-plugin-cli/skills/{playwright-cli → stably-browser}/references/video-recording.md +8 -8
- package/dist/stably-plugin-cli/skills/test-creation-workflow/SKILL.md +15 -15
- package/package.json +2 -2
|
@@ -6,23 +6,23 @@ Intercept, mock, modify, and block network requests.
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
# Mock with custom status
|
|
9
|
-
|
|
9
|
+
stably-browser route "**/*.jpg" --status=404
|
|
10
10
|
|
|
11
11
|
# Mock with JSON body
|
|
12
|
-
|
|
12
|
+
stably-browser route "**/api/users" --body='[{"id":1,"name":"Alice"}]' --content-type=application/json
|
|
13
13
|
|
|
14
14
|
# Mock with custom headers
|
|
15
|
-
|
|
15
|
+
stably-browser route "**/api/data" --body='{"ok":true}' --header="X-Custom: value"
|
|
16
16
|
|
|
17
17
|
# Remove headers from requests
|
|
18
|
-
|
|
18
|
+
stably-browser route "**/*" --remove-header=cookie,authorization
|
|
19
19
|
|
|
20
20
|
# List active routes
|
|
21
|
-
|
|
21
|
+
stably-browser route-list
|
|
22
22
|
|
|
23
23
|
# Remove a route or all routes
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
stably-browser unroute "**/*.jpg"
|
|
25
|
+
stably-browser unroute
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## URL Patterns
|
|
@@ -41,7 +41,7 @@ For conditional responses, request body inspection, response modification, or de
|
|
|
41
41
|
### Conditional Response Based on Request
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
|
|
44
|
+
stably-browser run-code "async page => {
|
|
45
45
|
await page.route('**/api/login', route => {
|
|
46
46
|
const body = route.request().postDataJSON();
|
|
47
47
|
if (body.username === 'admin') {
|
|
@@ -56,7 +56,7 @@ playwright-cli run-code "async page => {
|
|
|
56
56
|
### Modify Real Response
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
|
-
|
|
59
|
+
stably-browser run-code "async page => {
|
|
60
60
|
await page.route('**/api/user', async route => {
|
|
61
61
|
const response = await route.fetch();
|
|
62
62
|
const json = await response.json();
|
|
@@ -69,7 +69,7 @@ playwright-cli run-code "async page => {
|
|
|
69
69
|
### Simulate Network Failures
|
|
70
70
|
|
|
71
71
|
```bash
|
|
72
|
-
|
|
72
|
+
stably-browser run-code "async page => {
|
|
73
73
|
await page.route('**/api/offline', route => route.abort('internetdisconnected'));
|
|
74
74
|
}"
|
|
75
75
|
# Options: connectionrefused, timedout, connectionreset, internetdisconnected
|
|
@@ -78,7 +78,7 @@ playwright-cli run-code "async page => {
|
|
|
78
78
|
### Delayed Response
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
|
|
81
|
+
stably-browser run-code "async page => {
|
|
82
82
|
await page.route('**/api/slow', async route => {
|
|
83
83
|
await new Promise(r => setTimeout(r, 3000));
|
|
84
84
|
route.fulfill({ body: JSON.stringify({ data: 'loaded' }) });
|
package/dist/stably-plugin-cli/skills/{playwright-cli → stably-browser}/references/running-code.md
RENAMED
|
@@ -5,7 +5,7 @@ Use `run-code` to execute arbitrary Playwright code for advanced scenarios not c
|
|
|
5
5
|
## Syntax
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
stably-browser run-code "async page => {
|
|
9
9
|
// Your Playwright code here
|
|
10
10
|
// Access page.context() for browser context operations
|
|
11
11
|
}"
|
|
@@ -15,19 +15,19 @@ playwright-cli run-code "async page => {
|
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
17
|
# Grant geolocation permission and set location
|
|
18
|
-
|
|
18
|
+
stably-browser run-code "async page => {
|
|
19
19
|
await page.context().grantPermissions(['geolocation']);
|
|
20
20
|
await page.context().setGeolocation({ latitude: 37.7749, longitude: -122.4194 });
|
|
21
21
|
}"
|
|
22
22
|
|
|
23
23
|
# Set location to London
|
|
24
|
-
|
|
24
|
+
stably-browser run-code "async page => {
|
|
25
25
|
await page.context().grantPermissions(['geolocation']);
|
|
26
26
|
await page.context().setGeolocation({ latitude: 51.5074, longitude: -0.1278 });
|
|
27
27
|
}"
|
|
28
28
|
|
|
29
29
|
# Clear geolocation override
|
|
30
|
-
|
|
30
|
+
stably-browser run-code "async page => {
|
|
31
31
|
await page.context().clearPermissions();
|
|
32
32
|
}"
|
|
33
33
|
```
|
|
@@ -36,7 +36,7 @@ playwright-cli run-code "async page => {
|
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
38
|
# Grant multiple permissions
|
|
39
|
-
|
|
39
|
+
stably-browser run-code "async page => {
|
|
40
40
|
await page.context().grantPermissions([
|
|
41
41
|
'geolocation',
|
|
42
42
|
'notifications',
|
|
@@ -46,7 +46,7 @@ playwright-cli run-code "async page => {
|
|
|
46
46
|
}"
|
|
47
47
|
|
|
48
48
|
# Grant permissions for specific origin
|
|
49
|
-
|
|
49
|
+
stably-browser run-code "async page => {
|
|
50
50
|
await page.context().grantPermissions(['clipboard-read'], {
|
|
51
51
|
origin: 'https://example.com'
|
|
52
52
|
});
|
|
@@ -57,22 +57,22 @@ playwright-cli run-code "async page => {
|
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
59
|
# Emulate dark color scheme
|
|
60
|
-
|
|
60
|
+
stably-browser run-code "async page => {
|
|
61
61
|
await page.emulateMedia({ colorScheme: 'dark' });
|
|
62
62
|
}"
|
|
63
63
|
|
|
64
64
|
# Emulate light color scheme
|
|
65
|
-
|
|
65
|
+
stably-browser run-code "async page => {
|
|
66
66
|
await page.emulateMedia({ colorScheme: 'light' });
|
|
67
67
|
}"
|
|
68
68
|
|
|
69
69
|
# Emulate reduced motion
|
|
70
|
-
|
|
70
|
+
stably-browser run-code "async page => {
|
|
71
71
|
await page.emulateMedia({ reducedMotion: 'reduce' });
|
|
72
72
|
}"
|
|
73
73
|
|
|
74
74
|
# Emulate print media
|
|
75
|
-
|
|
75
|
+
stably-browser run-code "async page => {
|
|
76
76
|
await page.emulateMedia({ media: 'print' });
|
|
77
77
|
}"
|
|
78
78
|
```
|
|
@@ -81,22 +81,22 @@ playwright-cli run-code "async page => {
|
|
|
81
81
|
|
|
82
82
|
```bash
|
|
83
83
|
# Wait for network idle
|
|
84
|
-
|
|
84
|
+
stably-browser run-code "async page => {
|
|
85
85
|
await page.waitForLoadState('networkidle');
|
|
86
86
|
}"
|
|
87
87
|
|
|
88
88
|
# Wait for specific element
|
|
89
|
-
|
|
89
|
+
stably-browser run-code "async page => {
|
|
90
90
|
await page.waitForSelector('.loading', { state: 'hidden' });
|
|
91
91
|
}"
|
|
92
92
|
|
|
93
93
|
# Wait for function to return true
|
|
94
|
-
|
|
94
|
+
stably-browser run-code "async page => {
|
|
95
95
|
await page.waitForFunction(() => window.appReady === true);
|
|
96
96
|
}"
|
|
97
97
|
|
|
98
98
|
# Wait with timeout
|
|
99
|
-
|
|
99
|
+
stably-browser run-code "async page => {
|
|
100
100
|
await page.waitForSelector('.result', { timeout: 10000 });
|
|
101
101
|
}"
|
|
102
102
|
```
|
|
@@ -105,13 +105,13 @@ playwright-cli run-code "async page => {
|
|
|
105
105
|
|
|
106
106
|
```bash
|
|
107
107
|
# Work with iframe
|
|
108
|
-
|
|
108
|
+
stably-browser run-code "async page => {
|
|
109
109
|
const frame = page.locator('iframe#my-iframe').contentFrame();
|
|
110
110
|
await frame.locator('button').click();
|
|
111
111
|
}"
|
|
112
112
|
|
|
113
113
|
# Get all frames
|
|
114
|
-
|
|
114
|
+
stably-browser run-code "async page => {
|
|
115
115
|
const frames = page.frames();
|
|
116
116
|
return frames.map(f => f.url());
|
|
117
117
|
}"
|
|
@@ -121,7 +121,7 @@ playwright-cli run-code "async page => {
|
|
|
121
121
|
|
|
122
122
|
```bash
|
|
123
123
|
# Handle file download
|
|
124
|
-
|
|
124
|
+
stably-browser run-code "async page => {
|
|
125
125
|
const [download] = await Promise.all([
|
|
126
126
|
page.waitForEvent('download'),
|
|
127
127
|
page.click('a.download-link')
|
|
@@ -135,13 +135,13 @@ playwright-cli run-code "async page => {
|
|
|
135
135
|
|
|
136
136
|
```bash
|
|
137
137
|
# Read clipboard (requires permission)
|
|
138
|
-
|
|
138
|
+
stably-browser run-code "async page => {
|
|
139
139
|
await page.context().grantPermissions(['clipboard-read']);
|
|
140
140
|
return await page.evaluate(() => navigator.clipboard.readText());
|
|
141
141
|
}"
|
|
142
142
|
|
|
143
143
|
# Write to clipboard
|
|
144
|
-
|
|
144
|
+
stably-browser run-code "async page => {
|
|
145
145
|
await page.evaluate(text => navigator.clipboard.writeText(text), 'Hello clipboard!');
|
|
146
146
|
}"
|
|
147
147
|
```
|
|
@@ -150,22 +150,22 @@ playwright-cli run-code "async page => {
|
|
|
150
150
|
|
|
151
151
|
```bash
|
|
152
152
|
# Get page title
|
|
153
|
-
|
|
153
|
+
stably-browser run-code "async page => {
|
|
154
154
|
return await page.title();
|
|
155
155
|
}"
|
|
156
156
|
|
|
157
157
|
# Get current URL
|
|
158
|
-
|
|
158
|
+
stably-browser run-code "async page => {
|
|
159
159
|
return page.url();
|
|
160
160
|
}"
|
|
161
161
|
|
|
162
162
|
# Get page content
|
|
163
|
-
|
|
163
|
+
stably-browser run-code "async page => {
|
|
164
164
|
return await page.content();
|
|
165
165
|
}"
|
|
166
166
|
|
|
167
167
|
# Get viewport size
|
|
168
|
-
|
|
168
|
+
stably-browser run-code "async page => {
|
|
169
169
|
return page.viewportSize();
|
|
170
170
|
}"
|
|
171
171
|
```
|
|
@@ -174,7 +174,7 @@ playwright-cli run-code "async page => {
|
|
|
174
174
|
|
|
175
175
|
```bash
|
|
176
176
|
# Execute JavaScript and return result
|
|
177
|
-
|
|
177
|
+
stably-browser run-code "async page => {
|
|
178
178
|
return await page.evaluate(() => {
|
|
179
179
|
return {
|
|
180
180
|
userAgent: navigator.userAgent,
|
|
@@ -185,7 +185,7 @@ playwright-cli run-code "async page => {
|
|
|
185
185
|
}"
|
|
186
186
|
|
|
187
187
|
# Pass arguments to evaluate
|
|
188
|
-
|
|
188
|
+
stably-browser run-code "async page => {
|
|
189
189
|
const multiplier = 5;
|
|
190
190
|
return await page.evaluate(m => document.querySelectorAll('li').length * m, multiplier);
|
|
191
191
|
}"
|
|
@@ -195,7 +195,7 @@ playwright-cli run-code "async page => {
|
|
|
195
195
|
|
|
196
196
|
```bash
|
|
197
197
|
# Try-catch in run-code
|
|
198
|
-
|
|
198
|
+
stably-browser run-code "async page => {
|
|
199
199
|
try {
|
|
200
200
|
await page.click('.maybe-missing', { timeout: 1000 });
|
|
201
201
|
return 'clicked';
|
|
@@ -209,7 +209,7 @@ playwright-cli run-code "async page => {
|
|
|
209
209
|
|
|
210
210
|
```bash
|
|
211
211
|
# Login and save state
|
|
212
|
-
|
|
212
|
+
stably-browser run-code "async page => {
|
|
213
213
|
await page.goto('https://example.com/login');
|
|
214
214
|
await page.fill('input[name=email]', 'user@example.com');
|
|
215
215
|
await page.fill('input[name=password]', 'secret');
|
|
@@ -220,7 +220,7 @@ playwright-cli run-code "async page => {
|
|
|
220
220
|
}"
|
|
221
221
|
|
|
222
222
|
# Scrape data from multiple pages
|
|
223
|
-
|
|
223
|
+
stably-browser run-code "async page => {
|
|
224
224
|
const results = [];
|
|
225
225
|
for (let i = 1; i <= 3; i++) {
|
|
226
226
|
await page.goto(\`https://example.com/page/\${i}\`);
|
|
@@ -8,14 +8,14 @@ Use `-s` flag to isolate browser contexts:
|
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
# Browser 1: Authentication flow
|
|
11
|
-
|
|
11
|
+
stably-browser -s=auth open https://app.example.com/login
|
|
12
12
|
|
|
13
13
|
# Browser 2: Public browsing (separate cookies, storage)
|
|
14
|
-
|
|
14
|
+
stably-browser -s=public open https://example.com
|
|
15
15
|
|
|
16
16
|
# Commands are isolated by browser session
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
stably-browser -s=auth fill e1 "user@example.com"
|
|
18
|
+
stably-browser -s=public snapshot
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## Browser Session Isolation Properties
|
|
@@ -32,21 +32,21 @@ Each browser session has independent:
|
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
34
|
# List all browser sessions
|
|
35
|
-
|
|
35
|
+
stably-browser list
|
|
36
36
|
|
|
37
37
|
# Stop a browser session (close the browser)
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
stably-browser close # stop the default browser
|
|
39
|
+
stably-browser -s=mysession close # stop a named browser
|
|
40
40
|
|
|
41
41
|
# Stop all browser sessions
|
|
42
|
-
|
|
42
|
+
stably-browser close-all
|
|
43
43
|
|
|
44
44
|
# Forcefully kill all daemon processes (for stale/zombie processes)
|
|
45
|
-
|
|
45
|
+
stably-browser kill-all
|
|
46
46
|
|
|
47
47
|
# Delete browser session user data (profile directory)
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
stably-browser delete-data # delete default browser data
|
|
49
|
+
stably-browser -s=mysession delete-data # delete named browser data
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
## Environment Variable
|
|
@@ -55,7 +55,7 @@ Set a default browser session name via environment variable:
|
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
57
|
export PLAYWRIGHT_CLI_SESSION="mysession"
|
|
58
|
-
|
|
58
|
+
stably-browser open example.com # Uses "mysession" automatically
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
## Common Patterns
|
|
@@ -67,30 +67,30 @@ playwright-cli open example.com # Uses "mysession" automatically
|
|
|
67
67
|
# Scrape multiple sites concurrently
|
|
68
68
|
|
|
69
69
|
# Start all browsers
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
stably-browser -s=site1 open https://site1.com &
|
|
71
|
+
stably-browser -s=site2 open https://site2.com &
|
|
72
|
+
stably-browser -s=site3 open https://site3.com &
|
|
73
73
|
wait
|
|
74
74
|
|
|
75
75
|
# Take snapshots from each
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
stably-browser -s=site1 snapshot
|
|
77
|
+
stably-browser -s=site2 snapshot
|
|
78
|
+
stably-browser -s=site3 snapshot
|
|
79
79
|
|
|
80
80
|
# Cleanup
|
|
81
|
-
|
|
81
|
+
stably-browser close-all
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
### A/B Testing Sessions
|
|
85
85
|
|
|
86
86
|
```bash
|
|
87
87
|
# Test different user experiences
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
stably-browser -s=variant-a open "https://app.com?variant=a"
|
|
89
|
+
stably-browser -s=variant-b open "https://app.com?variant=b"
|
|
90
90
|
|
|
91
91
|
# Compare
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
stably-browser -s=variant-a screenshot
|
|
93
|
+
stably-browser -s=variant-b screenshot
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
### Persistent Profile
|
|
@@ -99,10 +99,10 @@ By default, browser profile is kept in memory only. Use `--persistent` flag on `
|
|
|
99
99
|
|
|
100
100
|
```bash
|
|
101
101
|
# Use persistent profile (auto-generated location)
|
|
102
|
-
|
|
102
|
+
stably-browser open https://example.com --persistent
|
|
103
103
|
|
|
104
104
|
# Use persistent profile with custom directory
|
|
105
|
-
|
|
105
|
+
stably-browser open https://example.com --profile=/path/to/profile
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
## Default Browser Session
|
|
@@ -111,9 +111,9 @@ When `-s` is omitted, commands use the default browser session:
|
|
|
111
111
|
|
|
112
112
|
```bash
|
|
113
113
|
# These use the same default browser session
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
stably-browser open https://example.com
|
|
115
|
+
stably-browser snapshot
|
|
116
|
+
stably-browser close # Stops default browser
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
## Browser Session Configuration
|
|
@@ -122,16 +122,16 @@ Configure a browser session with specific settings when opening:
|
|
|
122
122
|
|
|
123
123
|
```bash
|
|
124
124
|
# Open with config file
|
|
125
|
-
|
|
125
|
+
stably-browser open https://example.com --config=.playwright/my-cli.json
|
|
126
126
|
|
|
127
127
|
# Open with specific browser
|
|
128
|
-
|
|
128
|
+
stably-browser open https://example.com --browser=firefox
|
|
129
129
|
|
|
130
130
|
# Open in headed mode
|
|
131
|
-
|
|
131
|
+
stably-browser open https://example.com --headed
|
|
132
132
|
|
|
133
133
|
# Open with persistent profile
|
|
134
|
-
|
|
134
|
+
stably-browser open https://example.com --persistent
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
## Best Practices
|
|
@@ -140,30 +140,30 @@ playwright-cli open https://example.com --persistent
|
|
|
140
140
|
|
|
141
141
|
```bash
|
|
142
142
|
# GOOD: Clear purpose
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
stably-browser -s=github-auth open https://github.com
|
|
144
|
+
stably-browser -s=docs-scrape open https://docs.example.com
|
|
145
145
|
|
|
146
146
|
# AVOID: Generic names
|
|
147
|
-
|
|
147
|
+
stably-browser -s=s1 open https://github.com
|
|
148
148
|
```
|
|
149
149
|
|
|
150
150
|
### 2. Always Clean Up
|
|
151
151
|
|
|
152
152
|
```bash
|
|
153
153
|
# Stop browsers when done
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
stably-browser -s=auth close
|
|
155
|
+
stably-browser -s=scrape close
|
|
156
156
|
|
|
157
157
|
# Or stop all at once
|
|
158
|
-
|
|
158
|
+
stably-browser close-all
|
|
159
159
|
|
|
160
160
|
# If browsers become unresponsive or zombie processes remain
|
|
161
|
-
|
|
161
|
+
stably-browser kill-all
|
|
162
162
|
```
|
|
163
163
|
|
|
164
164
|
### 3. Delete Stale Browser Data
|
|
165
165
|
|
|
166
166
|
```bash
|
|
167
167
|
# Remove old browser data to free disk space
|
|
168
|
-
|
|
168
|
+
stably-browser -s=oldsession delete-data
|
|
169
169
|
```
|