stably 4.12.3 → 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} +8 -8
- 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
|
@@ -54,7 +54,7 @@ Check if the target project's `testMatch` pattern will cover your new test file:
|
|
|
54
54
|
2. If your new file won't match (e.g., `testMatch: ['**/seed.spec.ts']` won't match `my-test.spec.ts`):
|
|
55
55
|
- Either update `testMatch` to include the new file (e.g., `['**/seed.spec.ts', '**/my-test.spec.ts']`)
|
|
56
56
|
- Or use a broader pattern (e.g., `tests/isolated/*.spec.ts` and place files there)
|
|
57
|
-
3. After editing config: clear cache and verify with `
|
|
57
|
+
3. After editing config: clear cache and verify with `stably-browser run-test`
|
|
58
58
|
|
|
59
59
|
### Adding an Isolated Project (REQUIRED for No-Auth Tests)
|
|
60
60
|
|
|
@@ -81,10 +81,10 @@ Common patterns: `**/seed.spec.ts`, `**/setup.spec.ts`, or `tests/isolated/*.spe
|
|
|
81
81
|
|
|
82
82
|
1. Clear Playwright cache: `rm -rf /tmp/playwright-transform-cache-* 2>/dev/null || true`
|
|
83
83
|
2. Restart MCP servers to pick up the config change
|
|
84
|
-
3. **Verify your test runs under the correct project** with `
|
|
84
|
+
3. **Verify your test runs under the correct project** with `stably-browser run-test <file> --project=<project>`
|
|
85
85
|
4. If your test runs under a project with auth dependencies (e.g., `all`), do NOT proceed - fix the project matching first
|
|
86
86
|
5. **If test runs under multiple projects**, add `testIgnore` to the unintended projects to exclude your test file
|
|
87
|
-
6. Use the new project: `
|
|
87
|
+
6. Use the new project: `stably-browser run-test <file> --project=isolated`
|
|
88
88
|
|
|
89
89
|
### If Setup Takes Too Long or Runs Auth Unexpectedly
|
|
90
90
|
|
|
@@ -110,7 +110,7 @@ When the repository uses authentication via project dependencies (a common patte
|
|
|
110
110
|
|
|
111
111
|
### The Solution
|
|
112
112
|
|
|
113
|
-
1. **Specify a project with auth dependencies**: When running `
|
|
113
|
+
1. **Specify a project with auth dependencies**: When running `stably-browser run-test`, explicitly specify a project that has `dependencies: ["auth"]` (e.g., `--project=chromium`, `--project=mobile-safari`)
|
|
114
114
|
|
|
115
115
|
2. **Check for auth skip conditions**: If auth tests are being skipped, inspect auth test file (e.g., `*.auth.ts`) and related setup files for skip conditions. Look for environment variables or configuration that forces re-authentication.
|
|
116
116
|
|
|
@@ -121,7 +121,7 @@ When the repository uses authentication via project dependencies (a common patte
|
|
|
121
121
|
1. Read `playwright.config.ts` and identify projects with `dependencies: ["auth"]` (e.g., `chromium`, `mobile-safari`)
|
|
122
122
|
2. Check auth test files for skip conditions or environment variables
|
|
123
123
|
3. Create test file using repository's normal auth pattern (via storageState from fixtures)
|
|
124
|
-
4. Run `
|
|
124
|
+
4. Run `stably-browser run-test <file> --project=chromium`
|
|
125
125
|
5. Auth project runs automatically as dependency -> creates auth files -> test runs authenticated
|
|
126
126
|
|
|
127
127
|
### What NOT to Do
|
|
@@ -135,7 +135,7 @@ When the repository uses authentication via project dependencies (a common patte
|
|
|
135
135
|
If config has auth project dependencies (e.g., `chromium` with `dependencies: ["auth"]`), you MUST specify that project when running tests.
|
|
136
136
|
|
|
137
137
|
```bash
|
|
138
|
-
|
|
138
|
+
stably-browser run-test tests/my-test.spec.ts --project=chromium
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
**Do NOT omit the `--project` flag** - auth will not run without specifying a project that has auth dependencies.
|
|
@@ -170,7 +170,7 @@ schedules:
|
|
|
170
170
|
|
|
171
171
|
## Test Execution Project Selection (CRITICAL)
|
|
172
172
|
|
|
173
|
-
This section covers how to select the right project when running tests with `
|
|
173
|
+
This section covers how to select the right project when running tests with `stably-browser run-test`.
|
|
174
174
|
|
|
175
175
|
### Rule 1: Add an Isolated Project for Independent Tests
|
|
176
176
|
|
|
@@ -179,7 +179,7 @@ When running tests that DON'T need auth or other project dependencies (e.g., tes
|
|
|
179
179
|
1. Add an isolated project to `playwright.config.ts` with NO dependencies (see "Adding an Isolated Project" above)
|
|
180
180
|
2. Use that project:
|
|
181
181
|
```
|
|
182
|
-
|
|
182
|
+
stably-browser run-test tests/my-test.spec.ts --project=isolated
|
|
183
183
|
```
|
|
184
184
|
|
|
185
185
|
**Why**: Playwright runs tests under ALL matching projects, not just one. If your test matches a project with `dependencies: ['setup-xyz']`, auth/setup flows will run unexpectedly.
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: stably-browser
|
|
3
3
|
description: Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.
|
|
4
|
-
allowed-tools: Bash(
|
|
4
|
+
allowed-tools: Bash(stably-browser:*)
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Browser Automation with
|
|
7
|
+
# Browser Automation with stably-browser
|
|
8
8
|
|
|
9
9
|
## Quick start
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
# open new browser
|
|
13
|
-
|
|
13
|
+
stably-browser open
|
|
14
14
|
# navigate to a page
|
|
15
|
-
|
|
15
|
+
stably-browser goto https://playwright.dev
|
|
16
16
|
# interact with the page using refs from the snapshot
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
stably-browser click e15
|
|
18
|
+
stably-browser type "page.click"
|
|
19
|
+
stably-browser press Enter
|
|
20
20
|
# take a screenshot (rarely used, as snapshot is more common)
|
|
21
|
-
|
|
21
|
+
stably-browser screenshot
|
|
22
22
|
# close the browser
|
|
23
|
-
|
|
23
|
+
stably-browser close
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## Commands
|
|
@@ -28,155 +28,155 @@ playwright-cli close
|
|
|
28
28
|
### Core
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
|
|
31
|
+
stably-browser open
|
|
32
32
|
# open and navigate right away
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
33
|
+
stably-browser open https://example.com/
|
|
34
|
+
stably-browser goto https://playwright.dev
|
|
35
|
+
stably-browser type "search query"
|
|
36
|
+
stably-browser click e3
|
|
37
|
+
stably-browser dblclick e7
|
|
38
|
+
stably-browser fill e5 "user@example.com"
|
|
39
|
+
stably-browser drag e2 e8
|
|
40
|
+
stably-browser hover e4
|
|
41
|
+
stably-browser select e9 "option-value"
|
|
42
|
+
stably-browser upload ./document.pdf
|
|
43
|
+
stably-browser check e12
|
|
44
|
+
stably-browser uncheck e12
|
|
45
|
+
stably-browser snapshot
|
|
46
|
+
stably-browser snapshot --filename=after-click.yaml
|
|
47
|
+
stably-browser eval "document.title"
|
|
48
|
+
stably-browser eval "el => el.textContent" e5
|
|
49
|
+
stably-browser dialog-accept
|
|
50
|
+
stably-browser dialog-accept "confirmation text"
|
|
51
|
+
stably-browser dialog-dismiss
|
|
52
|
+
stably-browser resize 1920 1080
|
|
53
|
+
stably-browser close
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
### Navigation
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
stably-browser go-back
|
|
60
|
+
stably-browser go-forward
|
|
61
|
+
stably-browser reload
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
### Keyboard
|
|
65
65
|
|
|
66
66
|
```bash
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
stably-browser press Enter
|
|
68
|
+
stably-browser press ArrowDown
|
|
69
|
+
stably-browser keydown Shift
|
|
70
|
+
stably-browser keyup Shift
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
### Mouse
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
stably-browser mousemove 150 300
|
|
77
|
+
stably-browser mousedown
|
|
78
|
+
stably-browser mousedown right
|
|
79
|
+
stably-browser mouseup
|
|
80
|
+
stably-browser mouseup right
|
|
81
|
+
stably-browser mousewheel 0 100
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
### Save as
|
|
85
85
|
|
|
86
86
|
```bash
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
stably-browser screenshot
|
|
88
|
+
stably-browser screenshot e5
|
|
89
|
+
stably-browser screenshot --filename=page.png
|
|
90
|
+
stably-browser pdf --filename=page.pdf
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
### Tabs
|
|
94
94
|
|
|
95
95
|
```bash
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
stably-browser tab-list
|
|
97
|
+
stably-browser tab-new
|
|
98
|
+
stably-browser tab-new https://example.com/page
|
|
99
|
+
stably-browser tab-close
|
|
100
|
+
stably-browser tab-close 2
|
|
101
|
+
stably-browser tab-select 0
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
### Storage
|
|
105
105
|
|
|
106
106
|
```bash
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
stably-browser state-save
|
|
108
|
+
stably-browser state-save auth.json
|
|
109
|
+
stably-browser state-load auth.json
|
|
110
110
|
|
|
111
111
|
# Cookies
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
stably-browser cookie-list
|
|
113
|
+
stably-browser cookie-list --domain=example.com
|
|
114
|
+
stably-browser cookie-get session_id
|
|
115
|
+
stably-browser cookie-set session_id abc123
|
|
116
|
+
stably-browser cookie-set session_id abc123 --domain=example.com --httpOnly --secure
|
|
117
|
+
stably-browser cookie-delete session_id
|
|
118
|
+
stably-browser cookie-clear
|
|
119
119
|
|
|
120
120
|
# LocalStorage
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
stably-browser localstorage-list
|
|
122
|
+
stably-browser localstorage-get theme
|
|
123
|
+
stably-browser localstorage-set theme dark
|
|
124
|
+
stably-browser localstorage-delete theme
|
|
125
|
+
stably-browser localstorage-clear
|
|
126
126
|
|
|
127
127
|
# SessionStorage
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
stably-browser sessionstorage-list
|
|
129
|
+
stably-browser sessionstorage-get step
|
|
130
|
+
stably-browser sessionstorage-set step 3
|
|
131
|
+
stably-browser sessionstorage-delete step
|
|
132
|
+
stably-browser sessionstorage-clear
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
### Network
|
|
136
136
|
|
|
137
137
|
```bash
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
138
|
+
stably-browser route "**/*.jpg" --status=404
|
|
139
|
+
stably-browser route "https://api.example.com/**" --body='{"mock": true}'
|
|
140
|
+
stably-browser route-list
|
|
141
|
+
stably-browser unroute "**/*.jpg"
|
|
142
|
+
stably-browser unroute
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
### DevTools
|
|
146
146
|
|
|
147
147
|
```bash
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
148
|
+
stably-browser console
|
|
149
|
+
stably-browser console warning
|
|
150
|
+
stably-browser network
|
|
151
|
+
stably-browser run-code "async page => await page.context().grantPermissions(['geolocation'])"
|
|
152
|
+
stably-browser tracing-start
|
|
153
|
+
stably-browser tracing-stop
|
|
154
|
+
stably-browser video-start
|
|
155
|
+
stably-browser video-stop video.webm
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
## Open parameters
|
|
159
159
|
```bash
|
|
160
160
|
# Use specific browser when creating session
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
stably-browser open --browser=chrome
|
|
162
|
+
stably-browser open --browser=firefox
|
|
163
|
+
stably-browser open --browser=webkit
|
|
164
|
+
stably-browser open --browser=msedge
|
|
165
165
|
# Connect to browser via extension
|
|
166
|
-
|
|
166
|
+
stably-browser open --extension
|
|
167
167
|
|
|
168
168
|
# Use persistent profile (by default profile is in-memory)
|
|
169
|
-
|
|
169
|
+
stably-browser open --persistent
|
|
170
170
|
# Use persistent profile with custom directory
|
|
171
|
-
|
|
171
|
+
stably-browser open --profile=/path/to/profile
|
|
172
172
|
|
|
173
173
|
# Start with config file
|
|
174
|
-
|
|
174
|
+
stably-browser open --config=my-config.json
|
|
175
175
|
|
|
176
176
|
# Close the browser
|
|
177
|
-
|
|
177
|
+
stably-browser close
|
|
178
178
|
# Delete user data for the default session
|
|
179
|
-
|
|
179
|
+
stably-browser delete-data
|
|
180
180
|
```
|
|
181
181
|
|
|
182
182
|
## Snapshots
|
|
@@ -184,15 +184,15 @@ playwright-cli delete-data
|
|
|
184
184
|
Every command that changes page state (`open`, `goto`, `click`, `fill`, `run-test`, etc.) returns a snapshot with the current page refs. **Use refs from the most recent command output immediately — never reuse refs from a previous command's snapshot.**
|
|
185
185
|
|
|
186
186
|
```bash
|
|
187
|
-
>
|
|
187
|
+
> stably-browser goto https://example.com
|
|
188
188
|
### Page
|
|
189
189
|
- Page URL: https://example.com/
|
|
190
190
|
- Page Title: Example Domain
|
|
191
191
|
### Snapshot
|
|
192
|
-
[Snapshot](.
|
|
192
|
+
[Snapshot](.stably-browser/page-2026-02-14T19-22-42-679Z.yml)
|
|
193
193
|
```
|
|
194
194
|
|
|
195
|
-
**Avoid redundant snapshots.** After `
|
|
195
|
+
**Avoid redundant snapshots.** After `stably-browser open <url>` or `stably-browser goto <url>`, the snapshot is already returned in the command output — Read that snapshot file directly instead of calling `stably-browser snapshot` again. Only use `stably-browser snapshot` when you need to re-inspect the page without performing any action.
|
|
196
196
|
|
|
197
197
|
If `--filename` is not provided, a new snapshot file is created with a timestamp. Default to automatic file naming, use `--filename=` when artifact is a part of the workflow result.
|
|
198
198
|
|
|
@@ -200,27 +200,27 @@ If `--filename` is not provided, a new snapshot file is created with a timestamp
|
|
|
200
200
|
|
|
201
201
|
Complex pages (e.g., Bing, large dashboards) can produce snapshot `.yml` files that are too large for the Read tool. When a snapshot is large, the Read tool may truncate it to a persisted output path outside the workspace (e.g., `/root/.claude/...`). Do NOT try to Read or Grep that external path — it will be blocked by the workspace sandbox.
|
|
202
202
|
|
|
203
|
-
Instead, **Grep the original `.yml` file** in the `.
|
|
203
|
+
Instead, **Grep the original `.yml` file** in the `.stably-browser/` directory to search for specific elements (e.g., `Grep` for `button`, `combobox`, or a text label).
|
|
204
204
|
|
|
205
205
|
## Running Tests
|
|
206
206
|
|
|
207
|
-
Use `
|
|
207
|
+
Use `stably-browser run-test` to execute Playwright tests connected to the managed browser via CDP. If no browser session is open, one is started automatically.
|
|
208
208
|
|
|
209
209
|
```bash
|
|
210
210
|
# Run a specific test file (auto-starts browser if needed)
|
|
211
|
-
|
|
211
|
+
stably-browser run-test tests/login.spec.ts
|
|
212
212
|
|
|
213
213
|
# Run tests matching a filter
|
|
214
|
-
|
|
214
|
+
stably-browser run-test "login"
|
|
215
215
|
|
|
216
216
|
# Run with a specific project (use = syntax)
|
|
217
|
-
|
|
217
|
+
stably-browser run-test --project=chromium tests/login.spec.ts
|
|
218
218
|
|
|
219
219
|
# Run with a visible browser window
|
|
220
|
-
|
|
220
|
+
stably-browser run-test --headed tests/login.spec.ts
|
|
221
221
|
|
|
222
222
|
# Show help
|
|
223
|
-
|
|
223
|
+
stably-browser run-test --help
|
|
224
224
|
```
|
|
225
225
|
|
|
226
226
|
### How run-test Works
|
|
@@ -237,35 +237,35 @@ playwright-cli run-test --help
|
|
|
237
237
|
|
|
238
238
|
This applies when you are running separate test files to check they pass — not when intentionally using `run-test` as a setup/seed mechanism (see "Use run-test as a Setup/Seed Mechanism" above).
|
|
239
239
|
|
|
240
|
-
**IMPORTANT: `
|
|
240
|
+
**IMPORTANT: `stably-browser close` must be its own separate Bash call.** Do NOT chain it with other commands (e.g., `stably-browser close; stably-browser run-test ...`). The browser is only fully terminated after the Bash command finishes, so chaining means the next command runs on the old browser with stale state.
|
|
241
241
|
|
|
242
242
|
```bash
|
|
243
243
|
# CORRECT: Each command is a separate Bash call
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
244
|
+
stably-browser run-test tests/login.spec.ts
|
|
245
|
+
stably-browser close
|
|
246
|
+
stably-browser run-test tests/checkout.spec.ts
|
|
247
|
+
stably-browser close
|
|
248
|
+
stably-browser run-test tests/settings.spec.ts
|
|
249
249
|
```
|
|
250
250
|
|
|
251
251
|
```bash
|
|
252
252
|
# WRONG: Chaining close with run-test in one command
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
stably-browser close; stably-browser run-test tests/checkout.spec.ts # ← run-test hits old browser
|
|
254
|
+
stably-browser close && stably-browser run-test tests/settings.spec.ts # ← same problem
|
|
255
255
|
```
|
|
256
256
|
|
|
257
257
|
```bash
|
|
258
258
|
# WRONG: Running independent tests without resetting — causes cascading failures
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
stably-browser run-test tests/login.spec.ts
|
|
260
|
+
stably-browser run-test tests/checkout.spec.ts # ← may fail: browser still has login state from test 1
|
|
261
|
+
stably-browser run-test tests/settings.spec.ts # ← may fail: stale cookies/auth from previous tests
|
|
262
262
|
```
|
|
263
263
|
|
|
264
|
-
**Why this matters:** The browser is a cloud VM that persists across commands. `
|
|
264
|
+
**Why this matters:** The browser is a cloud VM that persists across commands. `stably-browser close` terminates it, but only after the Bash call returns. If you chain `close; run-test`, the test runs on the old browser before it's terminated. Running `close` as its own Bash call ensures the old browser is fully gone before the next test starts with a fresh one.
|
|
265
265
|
|
|
266
266
|
### Key Differences from `npx playwright test`
|
|
267
267
|
|
|
268
|
-
| Feature | `
|
|
268
|
+
| Feature | `stably-browser run-test` | `npx playwright test` |
|
|
269
269
|
|---------|--------------------------|----------------------|
|
|
270
270
|
| Browser | Auto-starts and connects to managed browser via CDP | Launches its own browser |
|
|
271
271
|
| State after run | Browser and pages preserved | Browser closed |
|
|
@@ -284,7 +284,7 @@ Your environment may enforce a single-session browser policy. When active:
|
|
|
284
284
|
- Always use the default session — do not use `-s=<name>`.
|
|
285
285
|
- Close the current browser before opening a new one.
|
|
286
286
|
- If the user asks to "open a new browser", close the existing one first.
|
|
287
|
-
- Do not use `
|
|
287
|
+
- Do not use `stably-browser list` — there is at most one session.
|
|
288
288
|
|
|
289
289
|
When multi-session is allowed, you may use named sessions as documented below.
|
|
290
290
|
|
|
@@ -292,72 +292,72 @@ When multi-session is allowed, you may use named sessions as documented below.
|
|
|
292
292
|
|
|
293
293
|
```bash
|
|
294
294
|
# create new browser session named "mysession" with persistent profile
|
|
295
|
-
|
|
295
|
+
stably-browser -s=mysession open example.com --persistent
|
|
296
296
|
# same with manually specified profile directory (use when requested explicitly)
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
stably-browser -s=mysession open example.com --profile=/path/to/profile
|
|
298
|
+
stably-browser -s=mysession click e6
|
|
299
|
+
stably-browser -s=mysession close # stop a named browser
|
|
300
|
+
stably-browser -s=mysession delete-data # delete user data for persistent session
|
|
301
301
|
|
|
302
|
-
|
|
302
|
+
stably-browser list
|
|
303
303
|
# Close all browsers
|
|
304
|
-
|
|
304
|
+
stably-browser close-all
|
|
305
305
|
# Forcefully kill all browser processes
|
|
306
|
-
|
|
306
|
+
stably-browser kill-all
|
|
307
307
|
```
|
|
308
308
|
|
|
309
309
|
## Local installation
|
|
310
310
|
|
|
311
|
-
In some cases user might want to install
|
|
311
|
+
In some cases user might want to install stably-browser locally. If running globally available `stably-browser` binary fails, use `npx stably-browser` to run the commands. For example:
|
|
312
312
|
|
|
313
313
|
```bash
|
|
314
|
-
npx
|
|
315
|
-
npx
|
|
314
|
+
npx stably-browser open https://example.com
|
|
315
|
+
npx stably-browser click e1
|
|
316
316
|
```
|
|
317
317
|
|
|
318
318
|
## Example: Form submission
|
|
319
319
|
|
|
320
320
|
```bash
|
|
321
|
-
|
|
321
|
+
stably-browser open https://example.com/form
|
|
322
322
|
# Read the snapshot file from open's output — no need for a separate snapshot command
|
|
323
323
|
# Use refs (e1, e2, e3) from that snapshot immediately
|
|
324
324
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
325
|
+
stably-browser fill e1 "user@example.com"
|
|
326
|
+
stably-browser fill e2 "password123"
|
|
327
|
+
stably-browser click e3
|
|
328
328
|
# click returns a new snapshot — read it to verify the form was submitted
|
|
329
|
-
|
|
329
|
+
stably-browser close
|
|
330
330
|
```
|
|
331
331
|
|
|
332
332
|
## Example: Multi-tab workflow
|
|
333
333
|
|
|
334
334
|
```bash
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
335
|
+
stably-browser open https://example.com
|
|
336
|
+
stably-browser tab-new https://example.com/other
|
|
337
|
+
stably-browser tab-list
|
|
338
|
+
stably-browser tab-select 0
|
|
339
|
+
stably-browser snapshot
|
|
340
|
+
stably-browser close
|
|
341
341
|
```
|
|
342
342
|
|
|
343
343
|
## Example: Debugging with DevTools
|
|
344
344
|
|
|
345
345
|
```bash
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
346
|
+
stably-browser open https://example.com
|
|
347
|
+
stably-browser click e4
|
|
348
|
+
stably-browser fill e7 "test"
|
|
349
|
+
stably-browser console
|
|
350
|
+
stably-browser network
|
|
351
|
+
stably-browser close
|
|
352
352
|
```
|
|
353
353
|
|
|
354
354
|
```bash
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
355
|
+
stably-browser open https://example.com
|
|
356
|
+
stably-browser tracing-start
|
|
357
|
+
stably-browser click e4
|
|
358
|
+
stably-browser fill e7 "test"
|
|
359
|
+
stably-browser tracing-stop
|
|
360
|
+
stably-browser close
|
|
361
361
|
```
|
|
362
362
|
|
|
363
363
|
## Specific tasks
|
|
@@ -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' }) });
|