pi-ui-extend 1.0.41 → 1.0.45

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 (236) hide show
  1. package/README.md +50 -13
  2. package/dist/app/app.d.ts +13 -0
  3. package/dist/app/app.js +158 -8
  4. package/dist/app/cli/install.js +2 -2
  5. package/dist/app/commands/command-controller.d.ts +4 -0
  6. package/dist/app/commands/command-controller.js +11 -0
  7. package/dist/app/commands/command-git-actions.d.ts +25 -0
  8. package/dist/app/commands/command-git-actions.js +381 -0
  9. package/dist/app/commands/command-host.d.ts +4 -0
  10. package/dist/app/commands/command-host.js +5 -2
  11. package/dist/app/commands/command-model-actions.d.ts +1 -0
  12. package/dist/app/commands/command-model-actions.js +57 -35
  13. package/dist/app/commands/command-navigation-actions.d.ts +1 -0
  14. package/dist/app/commands/command-navigation-actions.js +16 -3
  15. package/dist/app/commands/command-registry.d.ts +2 -0
  16. package/dist/app/commands/command-registry.js +15 -1
  17. package/dist/app/commands/command-session-actions.js +9 -3
  18. package/dist/app/commands/reload-context-inventory.d.ts +11 -0
  19. package/dist/app/commands/reload-context-inventory.js +70 -0
  20. package/dist/app/extensions/extension-actions-controller.d.ts +1 -0
  21. package/dist/app/extensions/extension-actions-controller.js +6 -0
  22. package/dist/app/extensions/subagent-catalog-state.d.ts +9 -0
  23. package/dist/app/extensions/subagent-catalog-state.js +23 -0
  24. package/dist/app/input/autocomplete-controller.js +61 -34
  25. package/dist/app/input/input-action-controller.d.ts +2 -0
  26. package/dist/app/input/input-action-controller.js +8 -1
  27. package/dist/app/input/input-controller.d.ts +2 -1
  28. package/dist/app/input/input-controller.js +7 -2
  29. package/dist/app/input/prompt-enhancer-controller.js +53 -35
  30. package/dist/app/input/voice-controller.d.ts +41 -45
  31. package/dist/app/input/voice-controller.js +351 -419
  32. package/dist/app/model/model-usage-controller.js +17 -7
  33. package/dist/app/model/model-usage-status.d.ts +4 -1
  34. package/dist/app/model/model-usage-status.js +270 -46
  35. package/dist/app/popup/menu-items-controller.d.ts +13 -3
  36. package/dist/app/popup/menu-items-controller.js +37 -21
  37. package/dist/app/popup/popup-action-controller.d.ts +12 -2
  38. package/dist/app/popup/popup-action-controller.js +77 -24
  39. package/dist/app/popup/popup-menu-controller.d.ts +36 -14
  40. package/dist/app/popup/popup-menu-controller.js +239 -69
  41. package/dist/app/rendering/dcp-stats.d.ts +9 -4
  42. package/dist/app/rendering/dcp-stats.js +40 -425
  43. package/dist/app/rendering/editor-panels.js +10 -4
  44. package/dist/app/rendering/popup-menu-renderer.d.ts +3 -5
  45. package/dist/app/rendering/popup-menu-renderer.js +42 -37
  46. package/dist/app/rendering/render-controller.js +23 -2
  47. package/dist/app/rendering/status-line-renderer.d.ts +5 -0
  48. package/dist/app/rendering/status-line-renderer.js +41 -5
  49. package/dist/app/rendering/tab-line-renderer.js +26 -20
  50. package/dist/app/runtime.d.ts +12 -1
  51. package/dist/app/runtime.js +120 -12
  52. package/dist/app/screen/mouse-controller.d.ts +2 -0
  53. package/dist/app/screen/mouse-controller.js +17 -7
  54. package/dist/app/screen/status-controller.d.ts +4 -0
  55. package/dist/app/screen/status-controller.js +5 -0
  56. package/dist/app/session/lazy-session-manager.js +34 -0
  57. package/dist/app/session/session-event-controller.d.ts +1 -0
  58. package/dist/app/session/session-event-controller.js +10 -1
  59. package/dist/app/session/session-history.d.ts +1 -0
  60. package/dist/app/session/session-history.js +12 -1
  61. package/dist/app/session/session-lifecycle-controller.d.ts +7 -1
  62. package/dist/app/session/session-lifecycle-controller.js +16 -1
  63. package/dist/app/session/tabs-controller.d.ts +26 -1
  64. package/dist/app/session/tabs-controller.js +454 -147
  65. package/dist/app/subagents/subagents-files.js +60 -1
  66. package/dist/app/subagents/subagents-model.d.ts +1 -0
  67. package/dist/app/subagents/subagents-model.js +18 -2
  68. package/dist/app/subagents/subagents-widget-controller.d.ts +1 -0
  69. package/dist/app/subagents/subagents-widget-controller.js +6 -0
  70. package/dist/app/types.d.ts +16 -1
  71. package/dist/app/workspace/workspace-actions-controller.js +10 -2
  72. package/dist/app/workspace/workspace-undo.d.ts +1 -0
  73. package/dist/app/workspace/workspace-undo.js +1 -0
  74. package/dist/bundled-extensions/question/index.js +9 -1
  75. package/dist/bundled-extensions/question/remote.d.ts +4 -0
  76. package/dist/bundled-extensions/question/remote.js +33 -0
  77. package/dist/bundled-extensions/telegram-connector/bot.d.ts +43 -0
  78. package/dist/bundled-extensions/telegram-connector/bot.js +166 -0
  79. package/dist/bundled-extensions/telegram-connector/config.d.ts +8 -0
  80. package/dist/bundled-extensions/telegram-connector/config.js +87 -0
  81. package/dist/bundled-extensions/telegram-connector/coordinator.d.ts +66 -0
  82. package/dist/bundled-extensions/telegram-connector/coordinator.js +413 -0
  83. package/dist/bundled-extensions/telegram-connector/index.d.ts +3 -0
  84. package/dist/bundled-extensions/telegram-connector/index.js +195 -0
  85. package/dist/bundled-extensions/terminal-bell/index.d.ts +0 -8
  86. package/dist/bundled-extensions/terminal-bell/index.js +0 -76
  87. package/dist/bundled-extensions/workspace-undo/index.d.ts +26 -0
  88. package/dist/bundled-extensions/workspace-undo/index.js +191 -0
  89. package/dist/config.d.ts +21 -2
  90. package/dist/config.js +159 -32
  91. package/dist/default-pix-config.js +25 -5
  92. package/dist/schemas/index.d.ts +1 -0
  93. package/dist/schemas/index.js +1 -0
  94. package/dist/schemas/pi-tools-suite-schema.d.ts +88 -62
  95. package/dist/schemas/pi-tools-suite-schema.js +54 -83
  96. package/dist/schemas/pix-schema.d.ts +19 -2
  97. package/dist/schemas/pix-schema.js +47 -5
  98. package/dist/schemas/tasks-schema.d.ts +18 -0
  99. package/dist/schemas/tasks-schema.js +41 -0
  100. package/docs/concurrency.md +9 -1
  101. package/docs/desktop-mvp.md +22 -6
  102. package/docs/desktop-task-manager.md +148 -84
  103. package/docs/release.md +30 -6
  104. package/external/pi-tools-suite/README.md +197 -84
  105. package/external/pi-tools-suite/docs/evals.md +1 -1
  106. package/external/pi-tools-suite/docs/session-recovery.md +47 -14
  107. package/external/pi-tools-suite/docs/subagent-model-pools.md +48 -30
  108. package/external/pi-tools-suite/docs/ui-qa-subagent.md +440 -0
  109. package/external/pi-tools-suite/package.json +6 -1
  110. package/external/pi-tools-suite/src/antigravity-auth/auth-store.ts +2 -1
  111. package/external/pi-tools-suite/src/antigravity-auth/constants.ts +9 -3
  112. package/external/pi-tools-suite/src/antigravity-auth/headers.ts +41 -3
  113. package/external/pi-tools-suite/src/antigravity-auth/models.ts +94 -21
  114. package/external/pi-tools-suite/src/antigravity-auth/oauth.ts +5 -17
  115. package/external/pi-tools-suite/src/antigravity-auth/payload.ts +72 -7
  116. package/external/pi-tools-suite/src/antigravity-auth/stream.ts +13 -1
  117. package/external/pi-tools-suite/src/async-subagents/agents/frontier-review.md +23 -0
  118. package/external/pi-tools-suite/src/async-subagents/agents/implement.md +1 -1
  119. package/external/pi-tools-suite/src/async-subagents/agents/presets.jsonc +16 -0
  120. package/external/pi-tools-suite/src/async-subagents/agents/research.md +5 -3
  121. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/backends/browser.mjs +346 -0
  122. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/backends/desktop.mjs +1038 -0
  123. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/backends/tui.mjs +759 -0
  124. package/external/pi-tools-suite/src/async-subagents/agents/{browser-qa → ui-qa/browser}/scripts/browser-qa-runner.mjs +32 -23
  125. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/drivers/chrome-devtools/chrome-devtools-provider.mjs +895 -0
  126. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/drivers/linux/linux-atspi.py +494 -0
  127. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/drivers/macos/macos-accessibility.swift +1085 -0
  128. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/drivers/native-terminal/bridge-client.mjs +50 -0
  129. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/drivers/native-terminal/native-terminal-host.mjs +501 -0
  130. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/drivers/windows/windows-uia.ps1 +454 -0
  131. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/browser-auth.md +114 -0
  132. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/browser-chrome-devtools.md +91 -0
  133. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/browser-playwright.md +145 -0
  134. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/browser.md +82 -0
  135. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/desktop-linux.md +26 -0
  136. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/desktop-macos.md +29 -0
  137. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/desktop-windows.md +23 -0
  138. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/desktop.md +54 -0
  139. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/tui-native-terminal.md +59 -0
  140. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/tui-pty.md +37 -0
  141. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/tui.md +60 -0
  142. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/scripts/ui-qa-runner.mjs +535 -0
  143. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa.md +75 -0
  144. package/external/pi-tools-suite/src/async-subagents/commands.ts +15 -71
  145. package/external/pi-tools-suite/src/async-subagents/core/activity.ts +33 -0
  146. package/external/pi-tools-suite/src/async-subagents/core/agent-catalog.ts +5 -4
  147. package/external/pi-tools-suite/src/async-subagents/core/agent-strategy.ts +1 -1
  148. package/external/pi-tools-suite/src/async-subagents/core/agents-dir.ts +8 -5
  149. package/external/pi-tools-suite/src/async-subagents/core/browser-qa.ts +16 -2
  150. package/external/pi-tools-suite/src/async-subagents/core/config.ts +160 -327
  151. package/external/pi-tools-suite/src/async-subagents/core/model-selection.ts +2 -1
  152. package/external/pi-tools-suite/src/async-subagents/core/registry.ts +158 -33
  153. package/external/pi-tools-suite/src/async-subagents/core/routing.ts +21 -5
  154. package/external/pi-tools-suite/src/async-subagents/core/spawn.ts +40 -26
  155. package/external/pi-tools-suite/src/async-subagents/core/state.ts +40 -0
  156. package/external/pi-tools-suite/src/async-subagents/core/types.ts +7 -0
  157. package/external/pi-tools-suite/src/async-subagents/core/ultrawork-auto.ts +51 -45
  158. package/external/pi-tools-suite/src/async-subagents/index.ts +69 -5
  159. package/external/pi-tools-suite/src/async-subagents/lib.ts +16 -9
  160. package/external/pi-tools-suite/src/async-subagents/tools/spawn.ts +8 -5
  161. package/external/pi-tools-suite/src/async-subagents/tools/subagents.ts +5 -4
  162. package/external/pi-tools-suite/src/async-subagents/types.ts +1 -0
  163. package/external/pi-tools-suite/src/coding-discipline/index.ts +90 -59
  164. package/external/pi-tools-suite/src/config.ts +55 -1
  165. package/external/pi-tools-suite/src/context-gateway/accounting-log.ts +282 -0
  166. package/external/pi-tools-suite/src/context-gateway/config.ts +77 -3
  167. package/external/pi-tools-suite/src/context-gateway/efficiency.ts +414 -0
  168. package/external/pi-tools-suite/src/context-gateway/enforcement.ts +222 -0
  169. package/external/pi-tools-suite/src/context-gateway/index.ts +206 -19
  170. package/external/pi-tools-suite/src/context-gateway/storeless-capabilities.ts +7 -7
  171. package/external/pi-tools-suite/src/context-gateway/telemetry.ts +101 -28
  172. package/external/pi-tools-suite/src/context-gateway/types.ts +16 -3
  173. package/external/pi-tools-suite/src/context-inventory.ts +99 -0
  174. package/external/pi-tools-suite/src/dcp/auto-compress-budget.ts +39 -4
  175. package/external/pi-tools-suite/src/dcp/auto-compress.ts +128 -49
  176. package/external/pi-tools-suite/src/dcp/commands.ts +32 -156
  177. package/external/pi-tools-suite/src/dcp/compress-tool.ts +177 -46
  178. package/external/pi-tools-suite/src/dcp/compression-blocks.ts +6 -58
  179. package/external/pi-tools-suite/src/dcp/compression-preview.ts +9 -0
  180. package/external/pi-tools-suite/src/dcp/compression-progress.ts +22 -0
  181. package/external/pi-tools-suite/src/dcp/config.ts +114 -17
  182. package/external/pi-tools-suite/src/dcp/conversation-index.ts +36 -9
  183. package/external/pi-tools-suite/src/dcp/diagnostics.ts +41 -0
  184. package/external/pi-tools-suite/src/dcp/fresh-tool-results.ts +38 -0
  185. package/external/pi-tools-suite/src/dcp/index.ts +338 -66
  186. package/external/pi-tools-suite/src/dcp/journal.ts +126 -4
  187. package/external/pi-tools-suite/src/dcp/progress-controller.ts +2 -1
  188. package/external/pi-tools-suite/src/dcp/prompts.ts +83 -192
  189. package/external/pi-tools-suite/src/dcp/protected-continuity.ts +175 -0
  190. package/external/pi-tools-suite/src/dcp/pruner-candidates.ts +93 -3
  191. package/external/pi-tools-suite/src/dcp/pruner-message-ids.ts +6 -10
  192. package/external/pi-tools-suite/src/dcp/pruner-nudge.ts +36 -33
  193. package/external/pi-tools-suite/src/dcp/pruner-tools.ts +6 -3
  194. package/external/pi-tools-suite/src/dcp/pruner.ts +1 -0
  195. package/external/pi-tools-suite/src/dcp/routine-pressure.ts +86 -0
  196. package/external/pi-tools-suite/src/dcp/state.ts +9 -0
  197. package/external/pi-tools-suite/src/dcp/statistics.d.ts +8 -0
  198. package/external/pi-tools-suite/src/dcp/statistics.js +156 -0
  199. package/external/pi-tools-suite/src/default-pi-tools-suite-config.ts +78 -22
  200. package/external/pi-tools-suite/src/index.ts +7 -1
  201. package/external/pi-tools-suite/src/lib/project.ts +36 -1
  202. package/external/pi-tools-suite/src/model-tools/index.ts +10 -7
  203. package/external/pi-tools-suite/src/repo-discovery/index.ts +304 -4
  204. package/external/pi-tools-suite/src/resource-registry/index.ts +2551 -0
  205. package/external/pi-tools-suite/src/session-recovery/index.ts +17 -0
  206. package/external/pi-tools-suite/src/shell-command-policy.ts +219 -0
  207. package/external/pi-tools-suite/src/todo/index.ts +21 -0
  208. package/external/pi-tools-suite/src/todo/todo.ts +19 -1
  209. package/external/pi-tools-suite/src/tool-descriptions.ts +47 -19
  210. package/package.json +10 -9
  211. package/schemas/pi-tools-suite.json +466 -287
  212. package/schemas/pix.json +129 -11
  213. package/schemas/tasks.json +131 -0
  214. package/skills/simplify/SKILL.md +33 -5
  215. package/docs/desktop-markdown-media.md +0 -77
  216. package/external/pi-tools-suite/docs/browser-qa-subagent.md +0 -177
  217. package/external/pi-tools-suite/docs/dcp-emergency-current-turn.md +0 -102
  218. package/external/pi-tools-suite/src/async-subagents/agents/browser-qa.md +0 -598
  219. package/external/pi-tools-suite/src/async-subagents/async-subagents.sample.jsonc +0 -54
  220. package/external/pi-tools-suite/src/skill-installer/index.ts +0 -333
  221. package/skills/playwright-cli/SKILL.md +0 -420
  222. package/skills/playwright-cli/references/element-attributes.md +0 -23
  223. package/skills/playwright-cli/references/playwright-tests.md +0 -50
  224. package/skills/playwright-cli/references/request-mocking.md +0 -87
  225. package/skills/playwright-cli/references/running-code.md +0 -241
  226. package/skills/playwright-cli/references/session-management.md +0 -273
  227. package/skills/playwright-cli/references/spec-driven-testing.md +0 -311
  228. package/skills/playwright-cli/references/storage-state.md +0 -290
  229. package/skills/playwright-cli/references/test-generation.md +0 -142
  230. package/skills/playwright-cli/references/tracing.md +0 -154
  231. package/skills/playwright-cli/references/video-recording.md +0 -147
  232. package/skills/spec-lite/SKILL.md +0 -140
  233. /package/external/pi-tools-suite/src/async-subagents/agents/{browser-qa → ui-qa/browser}/examples/qa-auth.example.jsonc +0 -0
  234. /package/external/pi-tools-suite/src/async-subagents/agents/{browser-qa → ui-qa/browser}/examples/qa-flow.example.jsonc +0 -0
  235. /package/external/pi-tools-suite/src/async-subagents/agents/{browser-qa → ui-qa/browser}/vendor/fflate.LICENSE +0 -0
  236. /package/external/pi-tools-suite/src/async-subagents/agents/{browser-qa → ui-qa/browser}/vendor/fflate.mjs +0 -0
@@ -1,311 +0,0 @@
1
- # Spec-driven testing (plan → generate → heal)
2
-
3
- End-to-end workflow for authoring and maintaining Playwright tests using `playwright-cli`. The three sections below can be used independently:
4
-
5
- - **Planning** — explore the app, produce a spec file describing what to test.
6
- - **Generate** — turn a spec into Playwright test files. Update the spec if it's vague or stale.
7
- - **Heal** — diagnose failing tests, fix the code, reconcile the spec with reality.
8
-
9
- All three lean on the same mechanic: run `npx playwright test --debug=cli` in the background, then `playwright-cli attach tw-XXXX` to drive the paused page interactively. See [playwright-tests.md](playwright-tests.md) for the debug/attach mechanics and [test-generation.md](test-generation.md) for how every `playwright-cli` action emits Playwright TypeScript.
10
-
11
- Each debug run owns two resources: the background test PID and the unique generated `tw-XXXX` session. Record both as soon as they exist. On success, failure, interruption, or timeout, detach that exact CLI session, stop and reap that exact PID, and verify the session name is absent from `playwright-cli list` before starting another run or responding. Never substitute `close-all` or `kill-all`, because other sessions may have different owners.
12
-
13
- ---
14
-
15
- ## 1. Planning
16
-
17
- Goal: produce a spec file (e.g. `specs/<feature>.plan.md`) that enumerates the scenarios to test. **Always** write the spec to a file.
18
-
19
- ### 1.1 Prerequisite: workspace
20
-
21
- Check the workspace has Playwright installed before anything else:
22
-
23
- ```bash
24
- # Either of these confirms a workspace:
25
- test -f playwright.config.ts || test -f playwright.config.js
26
- npx --no-install playwright --version
27
- ```
28
-
29
- If there is no Playwright install, bootstrap one and let the user pick the defaults:
30
-
31
- ```bash
32
- npm init playwright@latest
33
- ```
34
-
35
- ### 1.2 Prerequisite: seed test
36
-
37
- A **seed test** is a minimal test that lands the page in the state every scenario starts from: navigation to the app, any required login, feature flags, etc. Scenarios assume a fresh start *after* the seed. `--debug=cli` pauses *inside* this test, so the seed is where every planning and generation session begins.
38
-
39
- Minimum viable seed:
40
-
41
- ```ts
42
- // tests/seed.spec.ts
43
- import { test } from '@playwright/test';
44
-
45
- test('seed', async ({ page }) => {
46
- await page.goto('https://example.com/');
47
- });
48
- ```
49
-
50
- Preferred — push navigation into a fixture so scenario tests reuse it:
51
-
52
- ```ts
53
- // tests/fixtures.ts
54
- import { test as baseTest } from '@playwright/test';
55
- export { expect } from '@playwright/test';
56
-
57
- export const test = baseTest.extend({
58
- page: async ({ page }, use) => {
59
- await page.goto('https://example.com/');
60
- await use(page);
61
- },
62
- });
63
- ```
64
-
65
- ```ts
66
- // tests/seed.spec.ts
67
- import { test } from './fixtures';
68
-
69
- test('seed', async ({ page }) => {
70
- // Fixture already navigates. This empty body tells agents where to start.
71
- });
72
- ```
73
-
74
- If no seed exists, create one that at least navigates to the app.
75
-
76
- ### 1.3 Explore the app
77
-
78
- Launch the app via the seed in the background and attach:
79
-
80
- ```bash
81
- PLAYWRIGHT_HTML_OPEN=never npx playwright test tests/seed.spec.ts --debug=cli > playwright-debug.log 2>&1 &
82
- TEST_PID=$!
83
- # wait for "Debugging Instructions" and the session name tw-XXXX
84
- playwright-cli attach tw-XXXX
85
- ```
86
-
87
- Resume so the seed runs, then probe the app:
88
-
89
- ```bash
90
- playwright-cli resume # resume so that seed test runs fully
91
- playwright-cli snapshot # inventory of interactive elements
92
- playwright-cli click e5 # follow a flow
93
- playwright-cli eval "location.href" # read URL / state
94
- playwright-cli show --annotate # ask the user to point at something
95
- ```
96
-
97
- Map out:
98
-
99
- - Interactive surfaces (forms, buttons, lists, filters, modals).
100
- - Primary user journeys end-to-end.
101
- - Edge cases: empty states, validation errors, very long input, boundary values.
102
- - Persistence: reload, local/session storage, URL fragments.
103
- - Navigation: which controls change the URL, back/forward behaviour.
104
-
105
- **Important**: Do not just open the app url with playwright-cli, always go through the test to capture any custom setup done there.
106
- **Important**: When done exploring, run `playwright-cli -s=tw-XXXX detach`, stop and `wait` for `$TEST_PID`, then run `playwright-cli list` and verify `tw-XXXX` is absent.
107
-
108
- ### 1.4 Write the spec file
109
-
110
- Save under `specs/<feature>.plan.md`. Use this structure:
111
-
112
- ```markdown
113
- # <Feature> Test Plan
114
-
115
- ## Application Overview
116
-
117
- <One paragraph describing what the feature does and why it matters.>
118
-
119
- ## Test Scenarios
120
-
121
- ### 1. <Group Name>
122
-
123
- **Seed:** `tests/seed.spec.ts`
124
-
125
- #### 1.1. <kebab-case-scenario-name>
126
-
127
- **File:** `tests/<group>/<kebab-case-scenario-name>.spec.ts`
128
-
129
- **Steps:**
130
- 1. <Concrete user step>
131
- - expect: <observable outcome>
132
- - expect: <another observable outcome>
133
- 2. <Next step>
134
- - expect: <outcome>
135
-
136
- #### 1.2. <next-scenario>
137
- ...
138
-
139
- ### 2. <Next Group>
140
-
141
- **Seed:** `tests/seed.spec.ts`
142
- ...
143
- ```
144
-
145
- Guidelines:
146
-
147
- - Each scenario is independent and starts from the seed's fresh state — never chain scenarios.
148
- - Scenario names are kebab-case and match the test file name (`should-add-single-todo` → `should-add-single-todo.spec.ts`).
149
- - Cover happy path, edge cases, validation, negative flows, persistence.
150
- - Write steps at the user level ("Type 'Buy milk' into the input"), not the API level ("call `fill`").
151
- - Put observable outcomes in `- expect:` bullets; each becomes an assertion during generation.
152
-
153
- ---
154
-
155
- ## 2. Generate
156
-
157
- Goal: take a spec file and produce Playwright test files. Optionally update the spec if it has drifted.
158
-
159
- ### 2.1 Inputs
160
-
161
- - **Spec file**, e.g. `specs/basic-operations.plan.md`.
162
- - **Target**: either a single scenario (e.g. `1.2`), a whole group (`1`), or all.
163
- - **Seed file**, read from the `**Seed:**` line of the scenario's group.
164
-
165
- ### 2.2 Generate one scenario
166
-
167
- For each target scenario, in sequence (never in parallel — scenarios share the seed session):
168
-
169
- ```bash
170
- PLAYWRIGHT_HTML_OPEN=never npx playwright test <seed-file> --debug=cli > playwright-debug.log 2>&1 &
171
- TEST_PID=$!
172
- # Read the log, register the generated session name, then attach.
173
- playwright-cli attach tw-XXXX
174
- # resume
175
- ```
176
-
177
- **Do not** just open the app url with playwright-cli, always go through the test to capture any custom setup done there.
178
-
179
- Walk the scenario's `Steps:` one by one with `playwright-cli`, treating the spec as the plan and the live app as the source of truth. If a step is vague ("click the button" — which button?), references an element that no longer exists, or contradicts the app's actual behaviour, use your judgement: update the spec to match what the app really does, then keep going. Editing the spec mid-generation is expected.
180
-
181
- Every action prints the equivalent Playwright TypeScript (see [test-generation.md](test-generation.md)):
182
-
183
- ```bash
184
- playwright-cli snapshot # find refs
185
- playwright-cli fill e3 "John Doe" # -> page.getByRole('textbox', {...}).fill(...)
186
- playwright-cli press Enter
187
- playwright-cli click e7
188
- ```
189
-
190
- For each `- expect:` bullet, add an explicit assertion. See [test-generation.md](test-generation.md) for details.
191
-
192
- Collect the generated code and write the test file at the path given in the spec:
193
-
194
- ```ts
195
- // spec: specs/basic-operations.plan.md
196
- // seed: tests/seed.spec.ts
197
- import { test, expect } from './fixtures'; // or '@playwright/test' if no fixtures file
198
-
199
- test.describe('Singing in and out', () => {
200
- test('should sign in', async ({ page }) => {
201
- // 1. Navigate to the application
202
- // (handled by the seed fixture)
203
-
204
- // 2. Type 'John Doe' into the username field
205
- await page.getByRole('textbox', { name: 'username' }).fill('John Doe');
206
-
207
- // 3. Type password
208
- await page.getByRole('textbox', { name: 'password' }).fill('TestPassword');
209
-
210
- // 4. Press Enter to submit
211
- await page.getByRole('textbox', { name: 'password' }).press('Enter');
212
-
213
- await expect(page.getByRole('heading')).toContainText('Welcome, John Doe!');
214
- });
215
- });
216
- ```
217
-
218
- Rules:
219
-
220
- - **One test per file.** File path, describe name, and test name come verbatim from the spec (minus the ordinal).
221
- - Prefix each numbered step with a `// N. <step text>` comment before its actions.
222
- - Use the describe group name verbatim from the spec (no `1.` ordinal).
223
- - Import from `./fixtures` if the project has one; otherwise `@playwright/test`.
224
- - **Important**: detach the exact `tw-XXXX` CLI session, stop and reap `$TEST_PID`, and verify the session is absent from `playwright-cli list` before moving to the next scenario.
225
-
226
- ### 2.3 Generate multiple scenarios
227
-
228
- Loop 2.2 over the targeted scenarios one at a time, restarting the seed between each so every test starts from a clean page. Keep this sequential as required above; unique generated names prevent collisions but do not replace per-run ownership and verified cleanup.
229
-
230
- ### 2.4 Run generated tests
231
-
232
- After generation, run the new tests once:
233
-
234
- ```bash
235
- PLAYWRIGHT_HTML_OPEN=never npx playwright test tests/<group>/<scenario>.spec.ts
236
- ```
237
-
238
- Any failure goes to Section 3.
239
-
240
- ---
241
-
242
- ## 3. Heal
243
-
244
- Goal: fix failing tests, and update the spec if the app's intended behaviour changed.
245
-
246
- ### 3.1 Find failing tests
247
-
248
- ```bash
249
- PLAYWRIGHT_HTML_OPEN=never npx playwright test
250
- ```
251
-
252
- Record the list of failing `<file>:<line>` entries and process them one at a time. Do not attempt parallel fixes — shared state and the single CLI session make that fragile.
253
-
254
- ### 3.2 Debug one failure
255
-
256
- Run the single failing test in debug mode in the background, then attach:
257
-
258
- ```bash
259
- PLAYWRIGHT_HTML_OPEN=never npx playwright test tests/<group>/<scenario>.spec.ts:<line> --debug=cli > playwright-debug.log 2>&1 &
260
- TEST_PID=$!
261
- # wait for "Debugging Instructions" and the tw-XXXX session name
262
- playwright-cli attach tw-XXXX
263
- ```
264
-
265
- The test is paused at the start. Step forward or run to until just before the failing action or assertion, then diagnose:
266
-
267
- ```bash
268
- playwright-cli snapshot # did the element change / move / rename?
269
- playwright-cli console # app-side errors?
270
- playwright-cli network # failed request? wrong payload?
271
- playwright-cli show --annotate # ask the user to point somewhere
272
- ```
273
-
274
- Common causes: selector drift, new wrapper element, label/ARIA rename, timing (transition, async load), assertion text updated in the app, test data leaking between runs.
275
-
276
- Rehearse the corrected interaction with `playwright-cli` — the generated code in the output is what you paste back into the test.
277
-
278
- ### 3.3 Apply the fix
279
-
280
- Edit the test file: update the locator, assertion, step order, or inputs to match the corrected behaviour. Detach the exact generated CLI session, stop and reap the background debug PID, and verify the session name is absent from `playwright-cli list`. Then rerun the single test to confirm green.
281
-
282
- Never skip hooks or add sleeps as a fix. Never use `networkidle`.
283
-
284
- ### 3.4 Reconcile with the spec
285
-
286
- Open the spec referenced by the `// spec:` header in the test file and locate the scenario that matches the test.
287
-
288
- - **Fix was purely technical** (locator drift, better assertion shape) and the spec's user-level behaviour still matches the app → leave the spec alone.
289
- - **Fix changed user-visible steps, inputs, order, or expected outcomes** that the spec describes → update the spec to match reality. Keep the scenario id and file path stable; only the step / expect lines change.
290
- - **Unclear whether the app change is intentional** (spec is stale) **or a regression** (test was right, app is wrong) → **stop and ask the user**. Provide:
291
- - the scenario id (e.g. `2.3`),
292
- - the spec lines that no longer match,
293
- - the observed app behaviour (quote a snapshot excerpt or a concrete outcome).
294
-
295
- Only after the user answers, either update the spec (intentional change) or file/flag the test as covering a bug (regression).
296
-
297
- ### 3.5 Iteration and giving up
298
-
299
- - Fix failures one at a time; rerun after each.
300
- - If after thorough investigation you are confident the test is correct but the app is wrong *and* the user has confirmed it's a bug: mark the test `test.fixme(...)` with a comment pointing at the user's decision or issue link. Never silently skip.
301
-
302
- ---
303
-
304
- ## Cross-references
305
-
306
- | For... | See |
307
- |---|---|
308
- | `--debug=cli` / attach mechanics | [playwright-tests.md](playwright-tests.md) |
309
- | How `playwright-cli` actions become TS | [test-generation.md](test-generation.md) |
310
- | Mocking requests during exploration/generation | [request-mocking.md](request-mocking.md) |
311
- | Managing the CLI browser session | [session-management.md](session-management.md) |
@@ -1,290 +0,0 @@
1
- # Storage Management
2
-
3
- Manage cookies, localStorage, sessionStorage, and browser storage state.
4
-
5
- ## Storage State
6
-
7
- Save and restore complete browser state including cookies and storage.
8
-
9
- ### Save Storage State
10
-
11
- ```bash
12
- # Save to auto-generated filename (storage-state-{timestamp}.json)
13
- playwright-cli state-save
14
-
15
- # Save to specific filename
16
- playwright-cli state-save my-auth-state.json
17
- ```
18
-
19
- ### Restore Storage State
20
-
21
- ```bash
22
- SESSION="state-restore-$(date +%s)-$$" # record as owned before first command
23
- # Load storage state from file
24
- playwright-cli -s="$SESSION" state-load my-auth-state.json
25
-
26
- # Reload page to apply cookies
27
- playwright-cli -s="$SESSION" open https://example.com
28
- playwright-cli -s="$SESSION" close
29
- playwright-cli list # verify $SESSION is absent
30
- ```
31
-
32
- ### Storage State File Format
33
-
34
- The saved file contains:
35
-
36
- ```json
37
- {
38
- "cookies": [
39
- {
40
- "name": "session_id",
41
- "value": "abc123",
42
- "domain": "example.com",
43
- "path": "/",
44
- "expires": 1735689600,
45
- "httpOnly": true,
46
- "secure": true,
47
- "sameSite": "Lax"
48
- }
49
- ],
50
- "origins": [
51
- {
52
- "origin": "https://example.com",
53
- "localStorage": [
54
- { "name": "theme", "value": "dark" },
55
- { "name": "user_id", "value": "12345" }
56
- ]
57
- }
58
- ]
59
- }
60
- ```
61
-
62
- ## Cookies
63
-
64
- ### List All Cookies
65
-
66
- ```bash
67
- playwright-cli cookie-list
68
- ```
69
-
70
- ### Filter Cookies by Domain
71
-
72
- ```bash
73
- playwright-cli cookie-list --domain=example.com
74
- ```
75
-
76
- ### Filter Cookies by Path
77
-
78
- ```bash
79
- playwright-cli cookie-list --path=/api
80
- ```
81
-
82
- ### Get Specific Cookie
83
-
84
- ```bash
85
- playwright-cli cookie-get session_id
86
- ```
87
-
88
- ### Set a Cookie
89
-
90
- ```bash
91
- # Basic cookie
92
- playwright-cli cookie-set session abc123
93
-
94
- # Cookie with options
95
- playwright-cli cookie-set session abc123 --domain=example.com --path=/ --httpOnly --secure --sameSite=Lax
96
-
97
- # Cookie with expiration (Unix timestamp)
98
- playwright-cli cookie-set remember_me token123 --expires=1735689600
99
- ```
100
-
101
- ### Delete a Cookie
102
-
103
- ```bash
104
- playwright-cli cookie-delete session_id
105
- ```
106
-
107
- ### Clear All Cookies
108
-
109
- ```bash
110
- playwright-cli cookie-clear
111
- ```
112
-
113
- ### Advanced: Multiple Cookies or Custom Options
114
-
115
- For complex scenarios like adding multiple cookies at once, use `run-code`:
116
-
117
- ```bash
118
- playwright-cli run-code "async page => {
119
- await page.context().addCookies([
120
- { name: 'session_id', value: 'sess_abc123', domain: 'example.com', path: '/', httpOnly: true },
121
- { name: 'preferences', value: JSON.stringify({ theme: 'dark' }), domain: 'example.com', path: '/' }
122
- ]);
123
- }"
124
- ```
125
-
126
- ## Local Storage
127
-
128
- ### List All localStorage Items
129
-
130
- ```bash
131
- playwright-cli localstorage-list
132
- ```
133
-
134
- ### Get Single Value
135
-
136
- ```bash
137
- playwright-cli localstorage-get token
138
- ```
139
-
140
- ### Set Value
141
-
142
- ```bash
143
- playwright-cli localstorage-set theme dark
144
- ```
145
-
146
- ### Set JSON Value
147
-
148
- ```bash
149
- playwright-cli localstorage-set user_settings '{"theme":"dark","language":"en"}'
150
- ```
151
-
152
- ### Delete Single Item
153
-
154
- ```bash
155
- playwright-cli localstorage-delete token
156
- ```
157
-
158
- ### Clear All localStorage
159
-
160
- ```bash
161
- playwright-cli localstorage-clear
162
- ```
163
-
164
- ### Advanced: Multiple Operations
165
-
166
- For complex scenarios like setting multiple values at once, use `run-code`:
167
-
168
- ```bash
169
- playwright-cli run-code "async page => {
170
- await page.evaluate(() => {
171
- localStorage.setItem('token', 'jwt_abc123');
172
- localStorage.setItem('user_id', '12345');
173
- localStorage.setItem('expires_at', Date.now() + 3600000);
174
- });
175
- }"
176
- ```
177
-
178
- ## Session Storage
179
-
180
- ### List All sessionStorage Items
181
-
182
- ```bash
183
- playwright-cli sessionstorage-list
184
- ```
185
-
186
- ### Get Single Value
187
-
188
- ```bash
189
- playwright-cli sessionstorage-get form_data
190
- ```
191
-
192
- ### Set Value
193
-
194
- ```bash
195
- playwright-cli sessionstorage-set step 3
196
- ```
197
-
198
- ### Delete Single Item
199
-
200
- ```bash
201
- playwright-cli sessionstorage-delete step
202
- ```
203
-
204
- ### Clear sessionStorage
205
-
206
- ```bash
207
- playwright-cli sessionstorage-clear
208
- ```
209
-
210
- ## IndexedDB
211
-
212
- ### List Databases
213
-
214
- ```bash
215
- playwright-cli run-code "async page => {
216
- return await page.evaluate(async () => {
217
- const databases = await indexedDB.databases();
218
- return databases;
219
- });
220
- }"
221
- ```
222
-
223
- ### Delete Database
224
-
225
- ```bash
226
- playwright-cli run-code "async page => {
227
- await page.evaluate(() => {
228
- indexedDB.deleteDatabase('myDatabase');
229
- });
230
- }"
231
- ```
232
-
233
- ## Common Patterns
234
-
235
- ### Authentication State Reuse
236
-
237
- ```bash
238
- # Step 1: Login and save state
239
- LOGIN_SESSION="auth-save-$(date +%s)-$$"
240
- playwright-cli -s="$LOGIN_SESSION" open https://app.example.com/login
241
- playwright-cli -s="$LOGIN_SESSION" snapshot
242
- playwright-cli -s="$LOGIN_SESSION" fill e1 "user@example.com"
243
- playwright-cli -s="$LOGIN_SESSION" fill e2 "password123"
244
- playwright-cli -s="$LOGIN_SESSION" click e3
245
-
246
- # Save the authenticated state
247
- playwright-cli -s="$LOGIN_SESSION" state-save auth.json
248
- playwright-cli -s="$LOGIN_SESSION" close
249
- playwright-cli list # verify $LOGIN_SESSION is absent
250
-
251
- # Step 2: Later, restore state and skip login
252
- RESTORE_SESSION="auth-restore-$(date +%s)-$$"
253
- playwright-cli -s="$RESTORE_SESSION" state-load auth.json
254
- playwright-cli -s="$RESTORE_SESSION" open https://app.example.com/dashboard
255
- # Already logged in!
256
- playwright-cli -s="$RESTORE_SESSION" close
257
- playwright-cli list # verify $RESTORE_SESSION is absent
258
- ```
259
-
260
- ### Save and Restore Roundtrip
261
-
262
- ```bash
263
- # Set up authentication state
264
- SAVE_SESSION="state-save-$(date +%s)-$$"
265
- playwright-cli -s="$SAVE_SESSION" open https://example.com
266
- playwright-cli -s="$SAVE_SESSION" eval "() => { document.cookie = 'session=abc123'; localStorage.setItem('user', 'john'); }"
267
-
268
- # Save state to file
269
- playwright-cli -s="$SAVE_SESSION" state-save my-session.json
270
- playwright-cli -s="$SAVE_SESSION" close
271
- playwright-cli list # verify $SAVE_SESSION is absent
272
-
273
- # ... later, in a new session ...
274
-
275
- # Restore state
276
- LOAD_SESSION="state-load-$(date +%s)-$$"
277
- playwright-cli -s="$LOAD_SESSION" state-load my-session.json
278
- playwright-cli -s="$LOAD_SESSION" open https://example.com
279
- # Cookies and localStorage are restored!
280
- playwright-cli -s="$LOAD_SESSION" close
281
- playwright-cli list # verify $LOAD_SESSION is absent
282
- ```
283
-
284
- ## Security Notes
285
-
286
- - Never commit storage state files containing auth tokens
287
- - Add `*.auth-state.json` to `.gitignore`
288
- - Delete state files after automation completes
289
- - Use environment variables for sensitive data
290
- - By default, sessions run in-memory mode which is safer for sensitive operations