@cloud411716/fancy-webnovel 0.1.77 → 0.1.78

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 (122) hide show
  1. package/package.json +1 -1
  2. package/plugins/fancy-scan/scripts/run-scan.js +22 -44
  3. package/plugins/fancy-scan/scripts/scraper-registry.md +3 -5
  4. package/plugins/fancy-scan/scripts/scrapers/cdp-utils.cjs +7 -5
  5. package/plugins/fancy-scan/scripts/scrapers/fanqie-rank-scraper.cjs +282 -253
  6. package/plugins/fancy-scan/scripts/scrapers/jjwxc-rank-scraper.cjs +193 -253
  7. package/plugins/fancy-scan/scripts/scrapers/node_modules/.package-lock.json +20 -0
  8. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/LICENSE +202 -0
  9. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/NOTICE +5 -0
  10. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/README.md +3 -0
  11. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/ThirdPartyNotices.txt +13 -0
  12. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/install_media_pack.ps1 +5 -0
  13. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/install_webkit_wsl.ps1 +33 -0
  14. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
  15. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
  16. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
  17. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
  18. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
  19. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
  20. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
  21. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
  22. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
  23. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
  24. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
  25. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
  26. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
  27. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
  28. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
  29. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/browsers.json +75 -0
  30. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/cli.js +21 -0
  31. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/index.d.ts +17 -0
  32. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/index.js +17 -0
  33. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/index.mjs +28 -0
  34. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/bootstrap.js +88 -0
  35. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/coreBundle.js +74830 -0
  36. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/entry/cliDaemon.js +5 -0
  37. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/entry/dashboardApp.js +3 -0
  38. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/entry/mcp.js +10 -0
  39. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/entry/oopBrowserDownload.js +3 -0
  40. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/package.js +50 -0
  41. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
  42. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/server/electron/loader.js +118 -0
  43. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/serverRegistry.js +7347 -0
  44. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/serverRegistry.js.LICENSE +354 -0
  45. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/channelSessions.js +141 -0
  46. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/cli.js +6 -0
  47. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/help.json +708 -0
  48. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/minimist.js +128 -0
  49. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/output.js +343 -0
  50. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/program.js +404 -0
  51. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/registry.js +176 -0
  52. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/session.js +258 -0
  53. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/dashboard/appIcon.png +0 -0
  54. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/SKILL.md +420 -0
  55. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
  56. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
  57. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
  58. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/running-code.md +241 -0
  59. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/session-management.md +225 -0
  60. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
  61. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
  62. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
  63. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/video-recording.md +143 -0
  64. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/SKILL.md +143 -0
  65. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
  66. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/migration.md +85 -0
  67. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/react.md +67 -0
  68. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/vue.md +75 -0
  69. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-trace/SKILL.md +171 -0
  70. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/utils/extension.js +101 -0
  71. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/utils/socketConnection.js +108 -0
  72. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/utilsBundle.js +90764 -0
  73. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/utilsBundle.js.LICENSE +2179 -0
  74. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
  75. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
  76. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
  77. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
  78. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/assets/index-CyWAfh-p.js +11 -0
  79. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/assets/index-DhC616m4.css +1 -0
  80. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
  81. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/index.html +29 -0
  82. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/playwright-logo.svg +24 -0
  83. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/htmlReport/index.html +16 -0
  84. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/htmlReport/report.css +2 -0
  85. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/htmlReport/report.js +32 -0
  86. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
  87. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-CwYYHbcZ.js +32 -0
  88. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
  89. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/recorder/assets/index-DYjdXIbE.js +129 -0
  90. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/recorder/assets/index-l_lX622x.css +1 -0
  91. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/recorder/index.html +29 -0
  92. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +9 -0
  93. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-rXmQmLUY.js +32 -0
  94. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-B-dXF5JN.js +181 -0
  95. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
  96. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-BuZfJS5v.js +7 -0
  97. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
  98. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
  99. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.BLFoOugd.css +1 -0
  100. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
  101. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/index.KZ4wOW1K.js +1 -0
  102. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/index.html +44 -0
  103. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/manifest.webmanifest +16 -0
  104. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
  105. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
  106. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +10 -0
  107. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +4 -0
  108. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/uiMode.C7UW1sC9.css +1 -0
  109. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/uiMode.Dzuouizj.js +5 -0
  110. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +18 -0
  111. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
  112. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/webp_codec.LICENSE +173 -0
  113. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/webp_codec.wasm +0 -0
  114. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/xdg-open +1267 -0
  115. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/package.json +34 -0
  116. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/types/protocol.d.ts +24842 -0
  117. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/types/structs.d.ts +52 -0
  118. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/types/types.d.ts +26188 -0
  119. package/plugins/fancy-scan/scripts/scrapers/package-lock.json +27 -0
  120. package/plugins/fancy-scan/scripts/scrapers/package.json +9 -0
  121. package/plugins/fancy-scan/scripts/scrapers/qimao-rank-scraper.cjs +200 -297
  122. package/plugins/fancy-scan/scripts/scrapers/zhihu-rank-scraper.cjs +80 -80
@@ -0,0 +1,67 @@
1
+ # React setup
2
+
3
+ Follow the setup workflow in `SKILL.md`. Implement the gallery per `references/gallery-spec.md` (which has a React worked example); this page covers React-specific details.
4
+
5
+ ## Files
6
+
7
+ - `playwright/gallery/` — the gallery you implement to `references/gallery-spec.md` (an `index.html` + a `main.tsx` module). Requires `react` and `react-dom` 18+ (`createRoot`).
8
+ - Stories: `src/**/*.story.tsx` (the glob also picks up `.story.jsx`); example in `templates/react/Button.story.tsx`.
9
+
10
+ ## StrictMode
11
+
12
+ Wrap the rendered story in `<React.StrictMode>` in your gallery to match how most apps render. In development builds StrictMode intentionally double-invokes render functions and effects. This matters for stories that record events with counters set in effects — recording via state updates from event handlers (like the `CountsClicks` example story) is unaffected. If a story misbehaves under StrictMode, that is usually a real finding about the component; drop the wrapper only if the app itself does not use StrictMode.
13
+
14
+ ## Global providers
15
+
16
+ If components require context (theme, store, i18n, router), create one shared decorator and use it in stories, so each story states its scenario and nothing more:
17
+
18
+ ```tsx
19
+ // src/stories/decorators.tsx
20
+ import { ThemeProvider } from '../theme';
21
+ import { MemoryRouter } from 'react-router-dom';
22
+
23
+ export function AppScaffold({ children, route = '/' }: { children: React.ReactNode, route?: string }) {
24
+ return (
25
+ <ThemeProvider theme="light">
26
+ <MemoryRouter initialEntries={[route]}>{children}</MemoryRouter>
27
+ </ThemeProvider>
28
+ );
29
+ }
30
+ ```
31
+
32
+ ```tsx
33
+ // src/components/ProfilePage.story.tsx
34
+ export const LoggedIn = () => (
35
+ <AppScaffold route="/profile/42">
36
+ <ProfilePage user={{ id: 42, name: 'Test User' }} />
37
+ </AppScaffold>
38
+ );
39
+ ```
40
+
41
+ Do not build the decorator into the gallery — keeping it in story files makes the wrapping visible and lets stories opt out.
42
+
43
+ ## Typed props
44
+
45
+ `mount` is generic over the story: pass the story type as a template argument to type-check per-test props (and `update()`). Props are inferred from the component signature; function and class components both work.
46
+
47
+ ```tsx
48
+ // src/components/Button.story.tsx
49
+ export const WithTitle = ({ title = 'Default' }: { title?: string }) =>
50
+ <Button title={title} />;
51
+ ```
52
+
53
+ ```ts
54
+ // src/components/button.spec.ts
55
+ import type { WithTitle } from './Button.story';
56
+
57
+ const component = await mount<typeof WithTitle>('components/Button/WithTitle', { title: 'Hello' });
58
+ ```
59
+
60
+ ## CSS
61
+
62
+ - Global stylesheets: import them in your gallery entry (`playwright/gallery/main.tsx`, e.g. `import '../../src/index.css'`), mirroring the app's own entry point.
63
+ - Tailwind: if content scanning is path-based, make sure `*.story.tsx` files are covered.
64
+
65
+ ## Data fetching
66
+
67
+ For libraries with client objects (React Query, Apollo), create the client inside the story or decorator so each navigation starts fresh.
@@ -0,0 +1,75 @@
1
+ # Vue setup
2
+
3
+ Follow the setup workflow in `SKILL.md`. Implement the gallery per `references/gallery-spec.md`, exposing `window.mount`/`window.unmount` — in Vue, mount with `app = createApp(h(story, props)); app.mount('#root')` and unmount with `app.unmount()`; this page covers Vue-specific details.
4
+
5
+ ## Files
6
+
7
+ - `playwright/gallery/` — the gallery you implement to `references/gallery-spec.md` (an `index.html` + a `main.ts` module). Requires Vue 3.
8
+ - Stories: `src/**/*.story.{ts,js,vue}`; example in `templates/vue/Button.story.ts`.
9
+
10
+ ## Two ways to write stories
11
+
12
+ **Render-function stories** (`Button.story.ts`) — several scenarios per file, one named export each; see `templates/vue/Button.story.ts`. Uses `defineComponent` + `h()`, no SFC compilation involved.
13
+
14
+ **Single-file-component stories** (`Button.primary.story.vue`) — one story per file, full template syntax:
15
+
16
+ ```vue
17
+ <script setup lang="ts">
18
+ import { ref } from 'vue';
19
+ import Button from './Button.vue';
20
+ const clicks = ref(0);
21
+ </script>
22
+
23
+ <template>
24
+ <Button title="Submit" @click="clicks++" />
25
+ <form hidden><input data-testid="click-count" readonly :value="String(clicks)" /></form>
26
+ </template>
27
+ ```
28
+
29
+ An SFC story is addressed by its path without the extension: `mount('components/Button.primary')`. Prefer SFC stories when the scenario needs slots or non-trivial templates.
30
+
31
+ ## Global plugins
32
+
33
+ Apps that rely on plugins (Pinia, vue-router, i18n) should wrap components with a decorator story helper that creates a fresh instance per story:
34
+
35
+ ```ts
36
+ // src/stories/decorators.ts
37
+ import { defineComponent, h, type Component } from 'vue';
38
+ import { createPinia } from 'pinia';
39
+
40
+ export function withStore(story: Component) {
41
+ return defineComponent(() => {
42
+ const pinia = createPinia();
43
+ return () => h(story, { pinia });
44
+ });
45
+ }
46
+ ```
47
+
48
+ For plugins that must be installed on the app instance (`app.use(...)`), add them in your gallery right after `createApp(...)` — that is the equivalent of the app's own bootstrap.
49
+
50
+ ## Typed props
51
+
52
+ A story that takes per-test props declares them twice: in the setup signature (for the type) and in the `props` option (so Vue delivers them as props rather than `attrs`):
53
+
54
+ ```ts
55
+ // src/components/Button.story.ts
56
+ export const WithTitle = defineComponent(
57
+ (props: { title?: string }) => () => h(Button, { title: props.title ?? 'Default' }),
58
+ { props: ['title'] },
59
+ );
60
+ ```
61
+
62
+ `mount` is generic over the story: pass the story type as a template argument to type-check the props (and `update()`):
63
+
64
+ ```ts
65
+ // src/components/button.spec.ts
66
+ import type { WithTitle } from './Button.story';
67
+
68
+ const component = await mount<typeof WithTitle>('components/Button/WithTitle', { title: 'Hello' });
69
+ ```
70
+
71
+ Options-API stories (`defineComponent({ props: { ... } })`) infer props the same way. For `.story.vue` SFC stories, prop types are only inferable when the setup generates SFC types (Volar/vue-tsc); otherwise pass the props type directly: `mount<{ title?: string }>('components/Button.primary', { title: 'Hello' })`.
72
+
73
+ ## CSS
74
+
75
+ Import global stylesheets in your gallery entry (`playwright/gallery/main.ts`, e.g. `import '../../src/assets/main.css'`), mirroring the app's entry point.
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: playwright-trace
3
+ description: Inspect Playwright trace files from the command line — list actions, view requests, console, errors, snapshots and screenshots.
4
+ allowed-tools: Bash(npx:*)
5
+ ---
6
+
7
+ # Playwright Trace CLI
8
+
9
+ Inspect `.zip` trace files produced by Playwright tests without opening a browser.
10
+
11
+ ## Workflow
12
+
13
+ 1. Start with `trace open <trace.zip>` to extract the trace and see its metadata.
14
+ 2. Use `trace actions` to see all actions with their action IDs.
15
+ 3. Use `trace action <action-id>` to drill into a specific action — see parameters, logs, source location, and available snapshots.
16
+ 4. Use `trace requests`, `trace console`, or `trace errors` for cross-cutting views.
17
+ 5. Use `trace snapshot <action-id>` to get the DOM snapshot, or run a browser command against it.
18
+ 6. Use `trace close` to remove the extracted trace data when done.
19
+
20
+ All commands after `open` operate on the currently opened trace — no need to pass the trace file again. Opening a new trace replaces the previous one.
21
+
22
+ ## Commands
23
+
24
+ ### Open a trace
25
+
26
+ ```bash
27
+ # Extract trace and show metadata: browser, viewport, duration, action/error counts
28
+ npx playwright trace open <trace.zip>
29
+ ```
30
+
31
+ ### Close a trace
32
+
33
+ ```bash
34
+ # Remove extracted trace data
35
+ npx playwright trace close
36
+ ```
37
+
38
+ ### Actions
39
+
40
+ ```bash
41
+ # List all actions as a tree with action IDs and timing
42
+ npx playwright trace actions
43
+
44
+ # Filter by action title (regex, case-insensitive)
45
+ npx playwright trace actions --grep "click"
46
+
47
+ # Only failed actions
48
+ npx playwright trace actions --errors-only
49
+ ```
50
+
51
+ ### Action details
52
+
53
+ ```bash
54
+ # Show full details for one action: params, result, logs, source, snapshots
55
+ npx playwright trace action <action-id>
56
+ ```
57
+
58
+ The `action` command displays available snapshot phases (before, input, after) and the exact command to extract them.
59
+
60
+ ### Requests
61
+
62
+ ```bash
63
+ # All network requests: method, status, URL, duration, size
64
+ npx playwright trace requests
65
+
66
+ # Filter by URL pattern
67
+ npx playwright trace requests --grep "api"
68
+
69
+ # Filter by HTTP method
70
+ npx playwright trace requests --method POST
71
+
72
+ # Only failed requests (status >= 400)
73
+ npx playwright trace requests --failed
74
+ ```
75
+
76
+ ### Request details
77
+
78
+ ```bash
79
+ # Show full details for one request: headers, body, security
80
+ npx playwright trace request <request-id>
81
+ ```
82
+
83
+ ### Console
84
+
85
+ ```bash
86
+ # All console messages and stdout/stderr
87
+ npx playwright trace console
88
+
89
+ # Only errors
90
+ npx playwright trace console --errors-only
91
+
92
+ # Only browser console (no stdout/stderr)
93
+ npx playwright trace console --browser
94
+
95
+ # Only stdout/stderr (no browser console)
96
+ npx playwright trace console --stdio
97
+ ```
98
+
99
+ ### Errors
100
+
101
+ ```bash
102
+ # All errors with stack traces and associated actions
103
+ npx playwright trace errors
104
+ ```
105
+
106
+ ### Snapshots
107
+
108
+ The `snapshot` command loads the DOM snapshot for an action into a headless browser and runs a single browser command against it. Without a browser command, it returns the accessibility snapshot.
109
+
110
+ ```bash
111
+ # Get the accessibility snapshot (default)
112
+ npx playwright trace snapshot <action-id>
113
+
114
+ # Use a specific phase
115
+ npx playwright trace snapshot <action-id> --name before
116
+
117
+ # Run eval to query the DOM
118
+ npx playwright trace snapshot <action-id> -- eval "document.title"
119
+ npx playwright trace snapshot <action-id> -- eval "document.querySelector('#error').textContent"
120
+
121
+ # Eval on a specific element ref (from the snapshot)
122
+ npx playwright trace snapshot <action-id> -- eval "el => el.getAttribute('data-testid')" e5
123
+
124
+ # Take a screenshot of the snapshot
125
+ npx playwright trace snapshot <action-id> -- screenshot
126
+
127
+ # Redirect output to a file
128
+ npx playwright trace snapshot <action-id> -- eval "document.body.outerHTML" --filename=page.html
129
+ npx playwright trace snapshot <action-id> -- screenshot --filename=screenshot.png
130
+ ```
131
+
132
+ Only three browser commands are useful on a frozen snapshot: `snapshot`, `eval`, and `screenshot`.
133
+
134
+ ### Attachments
135
+
136
+ ```bash
137
+ # List all trace attachments
138
+ npx playwright trace attachments
139
+
140
+ # Extract an attachment by its number
141
+ npx playwright trace attachment 1
142
+ npx playwright trace attachment 1 -o out.png
143
+ ```
144
+
145
+ ## Typical investigation
146
+
147
+ ```bash
148
+ # 1. Open the trace and see what's inside
149
+ npx playwright trace open test-results/my-test/trace.zip
150
+
151
+ # 2. What actions ran?
152
+ npx playwright trace actions
153
+
154
+ # 3. Which action failed?
155
+ npx playwright trace actions --errors-only
156
+
157
+ # 4. What went wrong?
158
+ npx playwright trace action 12
159
+
160
+ # 5. What did the page look like at that moment?
161
+ npx playwright trace snapshot 12
162
+
163
+ # 6. Query the DOM for more detail
164
+ npx playwright trace snapshot 12 -- eval "document.querySelector('.error-message').textContent"
165
+
166
+ # 7. Any relevant network failures?
167
+ npx playwright trace requests --failed
168
+
169
+ # 8. Any console errors?
170
+ npx playwright trace console --errors-only
171
+ ```
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var extension_exports = {};
30
+ __export(extension_exports, {
31
+ findPlaywrightExtensionProfile: () => findPlaywrightExtensionProfile,
32
+ isPlaywrightExtensionInstalled: () => isPlaywrightExtensionInstalled,
33
+ playwrightExtensionId: () => playwrightExtensionId,
34
+ playwrightExtensionInstallUrl: () => playwrightExtensionInstallUrl
35
+ });
36
+ module.exports = __toCommonJS(extension_exports);
37
+ var import_fs = __toESM(require("fs"));
38
+ var import_path = __toESM(require("path"));
39
+ const playwrightExtensionId = "mmlmfjhmonkocbjadbfplnigmagldckm";
40
+ const playwrightExtensionInstallUrl = `https://chromewebstore.google.com/detail/playwright-extension/${playwrightExtensionId}`;
41
+ async function findPlaywrightExtensionProfile(userDataDir) {
42
+ const profiles = await listProfileDirectories(userDataDir);
43
+ const lastUsed = await readLastUsedProfile(userDataDir);
44
+ const ordered = lastUsed && profiles.includes(lastUsed) ? [lastUsed, ...profiles.filter((profile) => profile !== lastUsed)] : profiles;
45
+ for (const profile of ordered) {
46
+ if (await isExtensionInstalledInProfile(import_path.default.join(userDataDir, profile)))
47
+ return profile;
48
+ }
49
+ return void 0;
50
+ }
51
+ async function listProfileDirectories(userDataDir) {
52
+ let entries;
53
+ try {
54
+ entries = await import_fs.default.promises.readdir(userDataDir);
55
+ } catch {
56
+ return [];
57
+ }
58
+ const profiles = entries.filter((entry) => entry === "Default" || /^Profile \d+$/.test(entry));
59
+ profiles.sort((a, b) => profileRank(a) - profileRank(b));
60
+ return profiles;
61
+ }
62
+ function profileRank(profile) {
63
+ return profile === "Default" ? -1 : parseInt(profile.slice("Profile ".length), 10);
64
+ }
65
+ async function readLastUsedProfile(userDataDir) {
66
+ try {
67
+ const localState = JSON.parse(await import_fs.default.promises.readFile(import_path.default.join(userDataDir, "Local State"), "utf-8"));
68
+ const lastUsed = localState?.profile?.last_used;
69
+ return typeof lastUsed === "string" ? lastUsed : void 0;
70
+ } catch {
71
+ return void 0;
72
+ }
73
+ }
74
+ async function isPlaywrightExtensionInstalled(userDataDir) {
75
+ return await findPlaywrightExtensionProfile(userDataDir) !== void 0;
76
+ }
77
+ async function isExtensionInstalledInProfile(profileDir) {
78
+ if (await pathExists(import_path.default.join(profileDir, "Extensions", playwrightExtensionId)))
79
+ return true;
80
+ try {
81
+ const prefs = await import_fs.default.promises.readFile(import_path.default.join(profileDir, "Preferences"), "utf-8");
82
+ return prefs.includes(`"${playwrightExtensionId}"`);
83
+ } catch {
84
+ return false;
85
+ }
86
+ }
87
+ async function pathExists(p) {
88
+ try {
89
+ await import_fs.default.promises.access(p);
90
+ return true;
91
+ } catch {
92
+ return false;
93
+ }
94
+ }
95
+ // Annotate the CommonJS export names for ESM import in node:
96
+ 0 && (module.exports = {
97
+ findPlaywrightExtensionProfile,
98
+ isPlaywrightExtensionInstalled,
99
+ playwrightExtensionId,
100
+ playwrightExtensionInstallUrl
101
+ });
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var socketConnection_exports = {};
20
+ __export(socketConnection_exports, {
21
+ SocketConnection: () => SocketConnection,
22
+ compareSemver: () => compareSemver
23
+ });
24
+ module.exports = __toCommonJS(socketConnection_exports);
25
+ class SocketConnection {
26
+ constructor(socket) {
27
+ this._pendingBuffers = [];
28
+ this._socket = socket;
29
+ socket.on("data", (buffer) => this._onData(buffer));
30
+ socket.on("close", () => {
31
+ this.onclose?.();
32
+ });
33
+ socket.on("error", (e) => console.error(`error: ${e.message}`));
34
+ }
35
+ async send(message) {
36
+ await new Promise((resolve, reject) => {
37
+ this._socket.write(`${JSON.stringify(message)}
38
+ `, (error) => {
39
+ if (error)
40
+ reject(error);
41
+ else
42
+ resolve(void 0);
43
+ });
44
+ });
45
+ }
46
+ close() {
47
+ this._socket.destroy();
48
+ }
49
+ _onData(buffer) {
50
+ let end = buffer.indexOf("\n");
51
+ if (end === -1) {
52
+ this._pendingBuffers.push(buffer);
53
+ return;
54
+ }
55
+ this._pendingBuffers.push(buffer.slice(0, end));
56
+ const message = Buffer.concat(this._pendingBuffers).toString();
57
+ this._dispatchMessage(message);
58
+ let start = end + 1;
59
+ end = buffer.indexOf("\n", start);
60
+ while (end !== -1) {
61
+ const message2 = buffer.toString(void 0, start, end);
62
+ this._dispatchMessage(message2);
63
+ start = end + 1;
64
+ end = buffer.indexOf("\n", start);
65
+ }
66
+ this._pendingBuffers = [buffer.slice(start)];
67
+ }
68
+ _dispatchMessage(message) {
69
+ try {
70
+ this.onmessage?.(JSON.parse(message));
71
+ } catch (e) {
72
+ console.error("failed to dispatch message", e);
73
+ }
74
+ }
75
+ }
76
+ function compareSemver(a, b) {
77
+ const aBase = a.replace(/-.*$/, "");
78
+ const bBase = b.replace(/-.*$/, "");
79
+ const aParts = aBase.split(".").map(Number);
80
+ const bParts = bBase.split(".").map(Number);
81
+ for (let i = 0; i < 3; i++) {
82
+ if (aParts[i] > bParts[i])
83
+ return 1;
84
+ if (aParts[i] < bParts[i])
85
+ return -1;
86
+ }
87
+ const aTimestamp = parseSuffixTimestamp(a);
88
+ const bTimestamp = parseSuffixTimestamp(b);
89
+ if (aTimestamp > bTimestamp)
90
+ return 1;
91
+ if (aTimestamp < bTimestamp)
92
+ return -1;
93
+ return 0;
94
+ }
95
+ function parseSuffixTimestamp(version) {
96
+ const match = version.match(/^\d+\.\d+\.\d+-(?:alpha|beta)-(.+)$/);
97
+ if (!match)
98
+ return Infinity;
99
+ const suffix = match[1];
100
+ if (/^\d{4}-\d{2}-\d{2}$/.test(suffix))
101
+ return new Date(suffix).getTime();
102
+ return Number(suffix);
103
+ }
104
+ // Annotate the CommonJS export names for ESM import in node:
105
+ 0 && (module.exports = {
106
+ SocketConnection,
107
+ compareSemver
108
+ });