@agent-smith/feat-frontend 0.0.1 → 0.0.2

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.
Files changed (30) hide show
  1. package/dist/actions/playwright-cli-playbook.js +74 -0
  2. package/dist/actions/playwright-cli.js +8 -6
  3. package/dist/agents/browser-agent.yml +3 -10
  4. package/dist/agents/frontend-assistant.yml +3 -3
  5. package/dist/agents/frontend-light.yml +0 -2
  6. package/dist/agents/frontend-team.yml +5 -4
  7. package/dist/agents/frontend.yml +0 -2
  8. package/dist/fragments/agents-manager-ts.md +1 -3
  9. package/dist/skills/playwright-cli/SKILL.md +5 -196
  10. package/dist/skills/playwright-cli-full/SKILL.md +403 -0
  11. package/dist/skills/playwright-cli-full/references/element-attributes.md +23 -0
  12. package/dist/skills/playwright-cli-full/references/playwright-tests.md +39 -0
  13. package/dist/skills/playwright-cli-full/references/request-mocking.md +87 -0
  14. package/dist/skills/playwright-cli-full/references/running-code.md +241 -0
  15. package/dist/skills/playwright-cli-full/references/session-management.md +225 -0
  16. package/dist/skills/playwright-cli-full/references/storage-state.md +275 -0
  17. package/dist/skills/playwright-cli-full/references/test-generation.md +433 -0
  18. package/dist/skills/playwright-cli-full/references/tracing.md +139 -0
  19. package/dist/skills/playwright-cli-full/references/video-recording.md +143 -0
  20. package/dist/skills/playwright-cli-mini/SKILL.md +164 -0
  21. package/dist/skills/playwright-cli-mini/references/element-attributes.md +23 -0
  22. package/dist/skills/playwright-cli-mini/references/playwright-tests.md +39 -0
  23. package/dist/skills/playwright-cli-mini/references/request-mocking.md +87 -0
  24. package/dist/skills/playwright-cli-mini/references/running-code.md +241 -0
  25. package/dist/skills/playwright-cli-mini/references/session-management.md +225 -0
  26. package/dist/skills/playwright-cli-mini/references/storage-state.md +275 -0
  27. package/dist/skills/playwright-cli-mini/references/test-generation.md +433 -0
  28. package/dist/skills/playwright-cli-mini/references/tracing.md +139 -0
  29. package/dist/skills/playwright-cli-mini/references/video-recording.md +143 -0
  30. package/package.json +1 -1
@@ -0,0 +1,403 @@
1
+ ---
2
+ name: playwright-cli
3
+ description: Automate browser interactions, test web pages and work with Playwright tests.
4
+ ---
5
+
6
+ # Browser Automation with playwright-cli
7
+
8
+ ## Quick start
9
+
10
+ ```bash
11
+ # open new browser
12
+ playwright-cli open
13
+ # open new browser in headed mode
14
+ playwright-cli open --headed
15
+ # navigate to a page
16
+ playwright-cli goto https://playwright.dev
17
+ # interact with the page using refs from the snapshot
18
+ playwright-cli click e15
19
+ playwright-cli type "page.click"
20
+ playwright-cli press Enter
21
+ # take a screenshot (rarely used, as snapshot is more common)
22
+ playwright-cli screenshot
23
+ # close the browser
24
+ playwright-cli close
25
+ ```
26
+
27
+ ## Commands
28
+
29
+ ### Core
30
+
31
+ ```bash
32
+ playwright-cli open
33
+ # open and navigate right away
34
+ playwright-cli open https://example.com/
35
+ playwright-cli goto https://playwright.dev
36
+ playwright-cli type "search query"
37
+ playwright-cli click e3
38
+ playwright-cli dblclick e7
39
+ # --submit presses Enter after filling the element
40
+ playwright-cli fill e5 "user@example.com" --submit
41
+ playwright-cli drag e2 e8
42
+ # drop files or data onto an element (from outside the page)
43
+ playwright-cli drop e4 --path=./image.png
44
+ playwright-cli drop e4 --data="text/plain=hello world"
45
+ playwright-cli hover e4
46
+ playwright-cli select e9 "option-value"
47
+ playwright-cli upload ./document.pdf
48
+ playwright-cli check e12
49
+ playwright-cli uncheck e12
50
+ playwright-cli snapshot
51
+ # search the snapshot for text or a regexp, returns matching nodes with surrounding context
52
+ playwright-cli find "Sign in"
53
+ playwright-cli find --regex "Sign (in|up)"
54
+ # wrap the regexp in slashes to add flags, e.g. /i for case-insensitive
55
+ playwright-cli find --regex "/sign (in|up)/i"
56
+ playwright-cli eval "document.title"
57
+ playwright-cli eval "el => el.textContent" e5
58
+ # get element id, class, or any attribute not visible in the snapshot
59
+ playwright-cli eval "el => el.id" e5
60
+ playwright-cli eval "el => el.getAttribute('data-testid')" e5
61
+ playwright-cli dialog-accept
62
+ playwright-cli dialog-accept "confirmation text"
63
+ playwright-cli dialog-dismiss
64
+ playwright-cli resize 1920 1080
65
+ playwright-cli close
66
+ ```
67
+
68
+ ### Navigation
69
+
70
+ ```bash
71
+ playwright-cli go-back
72
+ playwright-cli go-forward
73
+ playwright-cli reload
74
+ ```
75
+
76
+ ### Keyboard
77
+
78
+ ```bash
79
+ playwright-cli press Enter
80
+ playwright-cli press ArrowDown
81
+ playwright-cli keydown Shift
82
+ playwright-cli keyup Shift
83
+ ```
84
+
85
+ ### Mouse
86
+
87
+ ```bash
88
+ playwright-cli mousemove 150 300
89
+ playwright-cli mousedown
90
+ playwright-cli mousedown right
91
+ playwright-cli mouseup
92
+ playwright-cli mouseup right
93
+ playwright-cli mousewheel 0 100
94
+ ```
95
+
96
+ ### Save as
97
+
98
+ ```bash
99
+ playwright-cli screenshot
100
+ playwright-cli screenshot e5
101
+ playwright-cli screenshot --filename=/workspace/page.png
102
+ playwright-cli screenshot --hires
103
+ playwright-cli pdf --filename=/workspace/page.pdf
104
+ ```
105
+
106
+ ### Tabs
107
+
108
+ ```bash
109
+ playwright-cli tab-list
110
+ playwright-cli tab-new
111
+ playwright-cli tab-new https://example.com/page
112
+ playwright-cli tab-close
113
+ playwright-cli tab-close 2
114
+ playwright-cli tab-select 0
115
+ ```
116
+
117
+ ### Storage
118
+
119
+ ```bash
120
+ playwright-cli state-save
121
+ playwright-cli state-save auth.json
122
+ playwright-cli state-load auth.json
123
+
124
+ # Cookies
125
+ playwright-cli cookie-list
126
+ playwright-cli cookie-list --domain=example.com
127
+ playwright-cli cookie-get session_id
128
+ playwright-cli cookie-set session_id abc123
129
+ playwright-cli cookie-set session_id abc123 --domain=example.com --httpOnly --secure
130
+ playwright-cli cookie-delete session_id
131
+ playwright-cli cookie-clear
132
+
133
+ # LocalStorage
134
+ playwright-cli localstorage-list
135
+ playwright-cli localstorage-get theme
136
+ playwright-cli localstorage-set theme dark
137
+ playwright-cli localstorage-delete theme
138
+ playwright-cli localstorage-clear
139
+
140
+ # SessionStorage
141
+ playwright-cli sessionstorage-list
142
+ playwright-cli sessionstorage-get step
143
+ playwright-cli sessionstorage-set step 3
144
+ playwright-cli sessionstorage-delete step
145
+ playwright-cli sessionstorage-clear
146
+ ```
147
+
148
+ ### Network
149
+
150
+ ```bash
151
+ playwright-cli route "**/*.jpg" --status=404
152
+ playwright-cli route "https://api.example.com/**" --body='{"mock": true}'
153
+ playwright-cli route-list
154
+ playwright-cli unroute "**/*.jpg"
155
+ playwright-cli unroute
156
+ ```
157
+
158
+ ### DevTools
159
+
160
+ ```bash
161
+ playwright-cli console
162
+ playwright-cli console warning
163
+ playwright-cli requests
164
+ playwright-cli request 5
165
+ playwright-cli run-code "async page => await page.context().grantPermissions(['geolocation'])"
166
+ playwright-cli run-code --filename=/workspace/script.js
167
+ playwright-cli tracing-start
168
+ playwright-cli tracing-stop
169
+
170
+ # record user actions in the browser, print them as Playwright code on stop
171
+ playwright-cli recording-start
172
+ playwright-cli recording-stop
173
+
174
+ playwright-cli video-start video.webm
175
+ playwright-cli video-chapter "Chapter Title" --description="Details" --duration=2000
176
+ playwright-cli video-stop
177
+
178
+ # annotate each subsequent action (click, type, ...) with a callout naming the action and highlighting the target
179
+ playwright-cli video-show-actions --duration=600 --position=top-right
180
+ playwright-cli video-hide-actions
181
+
182
+ # launch the dashboard for UI review / design feedback — user annotates the page, you receive the annotated screenshot, snapshot, and notes
183
+ playwright-cli show --annotate
184
+
185
+ # generate a Playwright locator for an element from its ref or selector
186
+ playwright-cli generate-locator e5 --raw
187
+
188
+ # show a persistent highlight overlay for an element, optionally with a custom style
189
+ playwright-cli highlight e5
190
+ playwright-cli highlight e5 --style="outline: 3px dashed red"
191
+ # hide a single element highlight, or all page highlights when no target is given
192
+ playwright-cli highlight e5 --hide
193
+ playwright-cli highlight --hide
194
+ ```
195
+
196
+ ## Raw output
197
+
198
+ The global `--raw` option strips page status, generated code, and snapshot sections from the output, returning only the result value. Use it to pipe command output into other tools. Commands that don't produce output return nothing.
199
+
200
+ ```bash
201
+ playwright-cli --raw eval "JSON.stringify(performance.timing)" | jq '.loadEventEnd - .navigationStart'
202
+ playwright-cli --raw eval "JSON.stringify([...document.querySelectorAll('a')].map(a => a.href))" > links.json
203
+ playwright-cli --raw snapshot > before.yml
204
+ playwright-cli click e5
205
+ playwright-cli --raw snapshot > after.yml
206
+ diff before.yml after.yml
207
+ TOKEN=$(playwright-cli --raw cookie-get session_id)
208
+ playwright-cli --raw localstorage-get theme
209
+ ```
210
+
211
+ For structured output wrapping every reply as JSON, pass --json
212
+ ```bash
213
+ playwright-cli list --json
214
+ ```
215
+
216
+ ## Open parameters
217
+ ```bash
218
+ # Use specific browser when creating session
219
+ playwright-cli open --browser=chrome
220
+ playwright-cli open --browser=firefox
221
+ playwright-cli open --browser=webkit
222
+ playwright-cli open --browser=msedge
223
+
224
+ # Emulate a generic mobile device (Pixel 10 for Chromium, iPhone 17 for WebKit).
225
+ # Prefer this when a mobile layout is acceptable: mobile pages are usually
226
+ # lighter, so snapshots are smaller and cheaper.
227
+ playwright-cli open --mobile
228
+ playwright-cli open --device="iPhone 15"
229
+
230
+ # Open in headed mode
231
+ playwright-cli open --headed
232
+
233
+ # Use persistent profile (by default profile is in-memory)
234
+ playwright-cli open --persistent
235
+ # Use persistent profile with custom directory
236
+ playwright-cli open --profile=/path/to/profile
237
+
238
+ # Connect to browser via Playwright Extension
239
+ playwright-cli attach --extension=chrome
240
+
241
+ # Connect to a running Chrome or Edge by channel name
242
+ playwright-cli attach --cdp=chrome
243
+ playwright-cli attach --cdp=msedge
244
+
245
+ # Connect to a running browser via CDP endpoint
246
+ playwright-cli attach --cdp=http://localhost:9222
247
+
248
+ # Start with config file
249
+ playwright-cli open --config=my-config.json
250
+
251
+ # Close the browser
252
+ playwright-cli close
253
+ # Detach from an attached browser (leaves the external browser running)
254
+ playwright-cli -s=msedge detach
255
+ # Delete user data for the default session
256
+ playwright-cli delete-data
257
+ ```
258
+
259
+ ## Snapshots
260
+
261
+ After each command, playwright-cli provides a snapshot of the current browser state.
262
+
263
+ ```bash
264
+ > playwright-cli goto https://example.com
265
+ ### Page
266
+ - Page URL: https://example.com/
267
+ - Page Title: Example Domain
268
+ ### Snapshot
269
+ [Snapshot](.playwright-cli/page-2026-02-14T19-22-42-679Z.yml)
270
+ ```
271
+
272
+ You can also take a snapshot on demand using `playwright-cli snapshot` command. All the options below can be combined as needed.
273
+
274
+ ```bash
275
+ # default - save to a file with timestamp-based name
276
+ playwright-cli snapshot
277
+
278
+ # save to file, use when snapshot is a part of the workflow result
279
+ playwright-cli snapshot --filename=/workspace/after-click.yaml
280
+
281
+ # snapshot an element instead of the whole page
282
+ playwright-cli snapshot "#main"
283
+
284
+ # limit snapshot depth for efficiency, take a partial snapshot afterwards
285
+ playwright-cli snapshot --depth=4
286
+ playwright-cli snapshot e34
287
+
288
+ # include each element's bounding box as [box=x,y,width,height]
289
+ playwright-cli snapshot --boxes
290
+
291
+ # search a large snapshot instead of capturing it all — returns matching nodes
292
+ # with 3 lines of context around each match (like grep -C)
293
+ playwright-cli find "Add to cart"
294
+ playwright-cli find --regex "\\$[0-9]+\\.[0-9]{2}"
295
+ ```
296
+
297
+ ## Targeting elements
298
+
299
+ By default, use refs from the snapshot to interact with page elements.
300
+
301
+ ```bash
302
+ # get snapshot with refs
303
+ playwright-cli snapshot
304
+
305
+ # interact using a ref
306
+ playwright-cli click e15
307
+ ```
308
+
309
+ You can also use css selectors or Playwright locators.
310
+
311
+ ```bash
312
+ # css selector
313
+ playwright-cli click "#main > button.submit"
314
+
315
+ # role locator
316
+ playwright-cli click "getByRole('button', { name: 'Submit' })"
317
+
318
+ # test id
319
+ playwright-cli click "getByTestId('submit-button')"
320
+ ```
321
+
322
+ ## Browser Sessions
323
+
324
+ ```bash
325
+ # create new browser session named "mysession" with persistent profile
326
+ playwright-cli -s=mysession open example.com --persistent
327
+ # same with manually specified profile directory (use when requested explicitly)
328
+ playwright-cli -s=mysession open example.com --profile=/path/to/profile
329
+ playwright-cli -s=mysession click e6
330
+ playwright-cli -s=mysession close # stop a named browser
331
+ playwright-cli -s=mysession delete-data # delete user data for persistent session
332
+
333
+ playwright-cli list
334
+ # Close all browsers
335
+ playwright-cli close-all
336
+ # Forcefully kill all browser processes
337
+ playwright-cli kill-all
338
+ ```
339
+
340
+ ## Example: Form submission
341
+
342
+ ```bash
343
+ playwright-cli open https://example.com/form
344
+ playwright-cli snapshot
345
+
346
+ playwright-cli fill e1 "user@example.com"
347
+ playwright-cli fill e2 "password123"
348
+ playwright-cli click e3
349
+ playwright-cli snapshot
350
+ playwright-cli close
351
+ ```
352
+
353
+ ## Example: Multi-tab workflow
354
+
355
+ ```bash
356
+ playwright-cli open https://example.com
357
+ playwright-cli tab-new https://example.com/other
358
+ playwright-cli tab-list
359
+ playwright-cli tab-select 0
360
+ playwright-cli snapshot
361
+ playwright-cli close
362
+ ```
363
+
364
+ ## Example: Debugging with DevTools
365
+
366
+ ```bash
367
+ playwright-cli open https://example.com
368
+ playwright-cli click e4
369
+ playwright-cli fill e7 "test"
370
+ playwright-cli console
371
+ playwright-cli requests
372
+ playwright-cli close
373
+ ```
374
+
375
+ ```bash
376
+ playwright-cli open https://example.com
377
+ playwright-cli tracing-start
378
+ playwright-cli click e4
379
+ playwright-cli fill e7 "test"
380
+ playwright-cli tracing-stop
381
+ playwright-cli close
382
+ ```
383
+
384
+ ## Example: Interactive session
385
+
386
+ Ask the user for UI review or design feedback. The user draws boxes on the live page and types comments; you receive the annotated screenshot, the snapshot of the marked region, and the user's notes. Use this whenever the user asks for "UI review", "design feedback", or to "ask the user what they think / want / mean":
387
+
388
+ ```bash
389
+ playwright-cli open https://example.com
390
+ playwright-cli show --annotate
391
+ ```
392
+
393
+ ## Specific tasks
394
+
395
+ * **Running and Debugging Playwright tests** [references/playwright-tests.md](references/playwright-tests.md)
396
+ * **Request mocking** [references/request-mocking.md](references/request-mocking.md)
397
+ * **Running Playwright code** [references/running-code.md](references/running-code.md)
398
+ * **Browser session management** [references/session-management.md](references/session-management.md)
399
+ * **Storage state (cookies, localStorage)** [references/storage-state.md](references/storage-state.md)
400
+ * **Test generation (plan / generate / heal)** [references/test-generation.md](references/test-generation.md)
401
+ * **Tracing** [references/tracing.md](references/tracing.md)
402
+ * **Video recording** [references/video-recording.md](references/video-recording.md)
403
+ * **Inspecting element attributes** [references/element-attributes.md](references/element-attributes.md)
@@ -0,0 +1,23 @@
1
+ # Inspecting Element Attributes
2
+
3
+ When the snapshot doesn't show an element's `id`, `class`, `data-*` attributes, or other DOM properties, use `eval` to inspect them.
4
+
5
+ ## Examples
6
+
7
+ ```bash
8
+ playwright-cli snapshot
9
+ # snapshot shows a button as e7 but doesn't reveal its id or data attributes
10
+
11
+ # get the element's id
12
+ playwright-cli eval "el => el.id" e7
13
+
14
+ # get all CSS classes
15
+ playwright-cli eval "el => el.className" e7
16
+
17
+ # get a specific attribute
18
+ playwright-cli eval "el => el.getAttribute('data-testid')" e7
19
+ playwright-cli eval "el => el.getAttribute('aria-label')" e7
20
+
21
+ # get a computed style property
22
+ playwright-cli eval "el => getComputedStyle(el).display" e7
23
+ ```
@@ -0,0 +1,39 @@
1
+ # Running Playwright Tests
2
+
3
+ To run Playwright tests, use the `npx playwright test` command, or a package manager script. To avoid opening the interactive html report, use `PLAYWRIGHT_HTML_OPEN=never` environment variable.
4
+
5
+ ```bash
6
+ # Run all tests
7
+ PLAYWRIGHT_HTML_OPEN=never npx playwright test
8
+
9
+ # Run all tests through a custom npm script
10
+ PLAYWRIGHT_HTML_OPEN=never npm run special-test-command
11
+ ```
12
+
13
+ # Debugging Playwright Tests
14
+
15
+ To debug a failing Playwright test, run it with `--debug=cli` option. This command will pause the test at the start and print the debugging instructions.
16
+
17
+ **IMPORTANT**: run the command in the background and check the output until "Debugging Instructions" is printed. Make sure to stop the command after you have finished.
18
+
19
+ Once instructions containing a session name are printed, use `playwright-cli` to attach the session and explore the page.
20
+
21
+ ```bash
22
+ # Run the test
23
+ PLAYWRIGHT_HTML_OPEN=never npx playwright test --debug=cli
24
+ # ...
25
+ # ... debugging instructions for "tw-abcdef" session ...
26
+ # ...
27
+
28
+ # Attach to the test
29
+ playwright-cli attach tw-abcdef
30
+ ```
31
+
32
+ Keep the test running in the background while you explore and look for a fix.
33
+ The test is paused at the start, so you should step over or pause at a particular location
34
+ where the problem is most likely to be.
35
+
36
+ Every action you perform with `playwright-cli` generates corresponding Playwright TypeScript code.
37
+ This code appears in the output and can be copied directly into the test. Most of the time, a specific locator or an expectation should be updated, but it could also be a bug in the app. Use your judgement.
38
+
39
+ After fixing the test, stop the background test run. Rerun to check that test passes.
@@ -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
+ playwright-cli route "**/*.jpg" --status=404
10
+
11
+ # Mock with JSON body
12
+ playwright-cli route "**/api/users" --body='[{"id":1,"name":"Alice"}]' --content-type=application/json
13
+
14
+ # Mock with custom headers
15
+ playwright-cli route "**/api/data" --body='{"ok":true}' --header="X-Custom: value"
16
+
17
+ # Remove headers from requests
18
+ playwright-cli route "**/*" --remove-header=cookie,authorization
19
+
20
+ # List active routes
21
+ playwright-cli route-list
22
+
23
+ # Remove a route or all routes
24
+ playwright-cli unroute "**/*.jpg"
25
+ playwright-cli 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
+ playwright-cli 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
+ playwright-cli 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
+ playwright-cli 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
+ playwright-cli 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
+ ```