venetian 0.1.0-aarch64-linux
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.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +52 -0
- data/Rakefile +14 -0
- data/exe/aarch64-linux/LICENSE +2946 -0
- data/exe/aarch64-linux/node +0 -0
- data/exe/aarch64-linux/package/LICENSE +202 -0
- data/exe/aarch64-linux/package/NOTICE +5 -0
- data/exe/aarch64-linux/package/README.md +3 -0
- data/exe/aarch64-linux/package/ThirdPartyNotices.txt +13 -0
- data/exe/aarch64-linux/package/api.json +1 -0
- data/exe/aarch64-linux/package/bin/install_media_pack.ps1 +5 -0
- data/exe/aarch64-linux/package/bin/install_webkit_wsl.ps1 +33 -0
- data/exe/aarch64-linux/package/bin/reinstall_chrome_beta_linux.sh +42 -0
- data/exe/aarch64-linux/package/bin/reinstall_chrome_beta_mac.sh +13 -0
- data/exe/aarch64-linux/package/bin/reinstall_chrome_beta_win.ps1 +24 -0
- data/exe/aarch64-linux/package/bin/reinstall_chrome_stable_linux.sh +42 -0
- data/exe/aarch64-linux/package/bin/reinstall_chrome_stable_mac.sh +12 -0
- data/exe/aarch64-linux/package/bin/reinstall_chrome_stable_win.ps1 +24 -0
- data/exe/aarch64-linux/package/bin/reinstall_msedge_beta_linux.sh +48 -0
- data/exe/aarch64-linux/package/bin/reinstall_msedge_beta_mac.sh +11 -0
- data/exe/aarch64-linux/package/bin/reinstall_msedge_beta_win.ps1 +23 -0
- data/exe/aarch64-linux/package/bin/reinstall_msedge_dev_linux.sh +48 -0
- data/exe/aarch64-linux/package/bin/reinstall_msedge_dev_mac.sh +11 -0
- data/exe/aarch64-linux/package/bin/reinstall_msedge_dev_win.ps1 +23 -0
- data/exe/aarch64-linux/package/bin/reinstall_msedge_stable_linux.sh +48 -0
- data/exe/aarch64-linux/package/bin/reinstall_msedge_stable_mac.sh +11 -0
- data/exe/aarch64-linux/package/bin/reinstall_msedge_stable_win.ps1 +24 -0
- data/exe/aarch64-linux/package/browsers.json +81 -0
- data/exe/aarch64-linux/package/cli.js +21 -0
- data/exe/aarch64-linux/package/index.d.ts +17 -0
- data/exe/aarch64-linux/package/index.js +32 -0
- data/exe/aarch64-linux/package/index.mjs +28 -0
- data/exe/aarch64-linux/package/lib/bootstrap.js +77 -0
- data/exe/aarch64-linux/package/lib/coreBundle.js +69799 -0
- data/exe/aarch64-linux/package/lib/entry/cliDaemon.js +5 -0
- data/exe/aarch64-linux/package/lib/entry/dashboardApp.js +3 -0
- data/exe/aarch64-linux/package/lib/entry/mcp.js +10 -0
- data/exe/aarch64-linux/package/lib/entry/oopBrowserDownload.js +3 -0
- data/exe/aarch64-linux/package/lib/package.js +50 -0
- data/exe/aarch64-linux/package/lib/server/chromium/appIcon.png +0 -0
- data/exe/aarch64-linux/package/lib/server/deviceDescriptorsSource.json +1779 -0
- data/exe/aarch64-linux/package/lib/server/electron/loader.js +115 -0
- data/exe/aarch64-linux/package/lib/serverRegistry.js +7343 -0
- data/exe/aarch64-linux/package/lib/serverRegistry.js.LICENSE +354 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/channelSessions.js +141 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/cli.js +6 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/help.json +679 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/minimist.js +128 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/output.js +343 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/program.js +380 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/registry.js +176 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/session.js +265 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/skill/SKILL.md +388 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/skill/references/element-attributes.md +23 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/skill/references/playwright-tests.md +39 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/skill/references/request-mocking.md +87 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/skill/references/running-code.md +241 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/skill/references/session-management.md +225 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/skill/references/spec-driven-testing.md +305 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/skill/references/storage-state.md +275 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/skill/references/test-generation.md +134 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/skill/references/tracing.md +139 -0
- data/exe/aarch64-linux/package/lib/tools/cli-client/skill/references/video-recording.md +143 -0
- data/exe/aarch64-linux/package/lib/tools/dashboard/appIcon.png +0 -0
- data/exe/aarch64-linux/package/lib/tools/trace/SKILL.md +171 -0
- data/exe/aarch64-linux/package/lib/tools/utils/extension.js +78 -0
- data/exe/aarch64-linux/package/lib/tools/utils/socketConnection.js +108 -0
- data/exe/aarch64-linux/package/lib/utilsBundle.js +85418 -0
- data/exe/aarch64-linux/package/lib/utilsBundle.js.LICENSE +2002 -0
- data/exe/aarch64-linux/package/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
- data/exe/aarch64-linux/package/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
- data/exe/aarch64-linux/package/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
- data/exe/aarch64-linux/package/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
- data/exe/aarch64-linux/package/lib/vite/dashboard/assets/index-BY2S1tHT.css +1 -0
- data/exe/aarch64-linux/package/lib/vite/dashboard/assets/index-DpEq2p62.js +52 -0
- data/exe/aarch64-linux/package/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
- data/exe/aarch64-linux/package/lib/vite/dashboard/index.html +29 -0
- data/exe/aarch64-linux/package/lib/vite/dashboard/playwright-logo.svg +24 -0
- data/exe/aarch64-linux/package/lib/vite/htmlReport/index.html +16 -0
- data/exe/aarch64-linux/package/lib/vite/htmlReport/report.css +1 -0
- data/exe/aarch64-linux/package/lib/vite/htmlReport/report.js +72 -0
- data/exe/aarch64-linux/package/lib/vite/recorder/assets/codeMirrorModule-BHYmBp6h.js +32 -0
- data/exe/aarch64-linux/package/lib/vite/recorder/assets/codeMirrorModule-DYBRYzYX.css +1 -0
- data/exe/aarch64-linux/package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- data/exe/aarch64-linux/package/lib/vite/recorder/assets/index-4ZiSSCmn.css +1 -0
- data/exe/aarch64-linux/package/lib/vite/recorder/assets/index-DA10QRaq.js +193 -0
- data/exe/aarch64-linux/package/lib/vite/recorder/index.html +29 -0
- data/exe/aarch64-linux/package/lib/vite/recorder/playwright-logo.svg +9 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/assets/codeMirrorModule-Ds_H_9Yq.js +32 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/assets/defaultSettingsView-D31xz8zv.js +262 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/assets/urlMatch-BYQrIQwR.js +1 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/assets/xtermModule-CsJ4vdCR.js +9 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/codeMirrorModule.DYBRYzYX.css +1 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/defaultSettingsView.BDKsFU3c.css +1 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/index.BCnMPevh.js +2 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/index.CzXZzn5A.css +1 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/index.html +44 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/manifest.webmanifest +16 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/playwright-logo.svg +9 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/snapshot.html +10 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/snapshot.v8KI4P3m.js +2 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/sw.bundle.js +5 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/uiMode.Btcz36p_.css +1 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/uiMode.C2Efnu2P.js +6 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/uiMode.html +18 -0
- data/exe/aarch64-linux/package/lib/vite/traceViewer/xtermModule.DYP7pi_n.css +32 -0
- data/exe/aarch64-linux/package/lib/xdg-open +1066 -0
- data/exe/aarch64-linux/package/package.json +34 -0
- data/exe/aarch64-linux/package/protocol.yml +4884 -0
- data/exe/aarch64-linux/package/types/protocol.d.ts +24565 -0
- data/exe/aarch64-linux/package/types/structs.d.ts +45 -0
- data/exe/aarch64-linux/package/types/types.d.ts +24518 -0
- data/exe/playwright +11 -0
- data/lib/tasks/venetian.rake +11 -0
- data/lib/venetian/browser_installer.rb +26 -0
- data/lib/venetian/browser_runner_extensions.rb +17 -0
- data/lib/venetian/executable.rb +154 -0
- data/lib/venetian/gemspec.rb +7 -0
- data/lib/venetian/playwright_create_extensions.rb +11 -0
- data/lib/venetian/railtie.rb +9 -0
- data/lib/venetian/tasks.rb +3 -0
- data/lib/venetian/upstream.rb +45 -0
- data/lib/venetian/version.rb +5 -0
- data/lib/venetian.rb +29 -0
- metadata +185 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Tracing
|
|
2
|
+
|
|
3
|
+
Capture detailed execution traces for debugging and analysis. Traces include DOM snapshots, screenshots, network activity, and console logs.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Start trace recording
|
|
9
|
+
playwright-cli tracing-start
|
|
10
|
+
|
|
11
|
+
# Perform actions
|
|
12
|
+
playwright-cli open https://example.com
|
|
13
|
+
playwright-cli click e1
|
|
14
|
+
playwright-cli fill e2 "test"
|
|
15
|
+
|
|
16
|
+
# Stop trace recording
|
|
17
|
+
playwright-cli tracing-stop
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Trace Output Files
|
|
21
|
+
|
|
22
|
+
When you start tracing, Playwright creates a `traces/` directory with several files:
|
|
23
|
+
|
|
24
|
+
### `trace-{timestamp}.trace`
|
|
25
|
+
|
|
26
|
+
**Action log** - The main trace file containing:
|
|
27
|
+
- Every action performed (clicks, fills, navigations)
|
|
28
|
+
- DOM snapshots before and after each action
|
|
29
|
+
- Screenshots at each step
|
|
30
|
+
- Timing information
|
|
31
|
+
- Console messages
|
|
32
|
+
- Source locations
|
|
33
|
+
|
|
34
|
+
### `trace-{timestamp}.network`
|
|
35
|
+
|
|
36
|
+
**Network log** - Complete network activity:
|
|
37
|
+
- All HTTP requests and responses
|
|
38
|
+
- Request headers and bodies
|
|
39
|
+
- Response headers and bodies
|
|
40
|
+
- Timing (DNS, connect, TLS, TTFB, download)
|
|
41
|
+
- Resource sizes
|
|
42
|
+
- Failed requests and errors
|
|
43
|
+
|
|
44
|
+
### `resources/`
|
|
45
|
+
|
|
46
|
+
**Resources directory** - Cached resources:
|
|
47
|
+
- Images, fonts, stylesheets, scripts
|
|
48
|
+
- Response bodies for replay
|
|
49
|
+
- Assets needed to reconstruct page state
|
|
50
|
+
|
|
51
|
+
## What Traces Capture
|
|
52
|
+
|
|
53
|
+
| Category | Details |
|
|
54
|
+
|----------|---------|
|
|
55
|
+
| **Actions** | Clicks, fills, hovers, keyboard input, navigations |
|
|
56
|
+
| **DOM** | Full DOM snapshot before/after each action |
|
|
57
|
+
| **Screenshots** | Visual state at each step |
|
|
58
|
+
| **Network** | All requests, responses, headers, bodies, timing |
|
|
59
|
+
| **Console** | All console.log, warn, error messages |
|
|
60
|
+
| **Timing** | Precise timing for each operation |
|
|
61
|
+
|
|
62
|
+
## Use Cases
|
|
63
|
+
|
|
64
|
+
### Debugging Failed Actions
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
playwright-cli tracing-start
|
|
68
|
+
playwright-cli open https://app.example.com
|
|
69
|
+
|
|
70
|
+
# This click fails - why?
|
|
71
|
+
playwright-cli click e5
|
|
72
|
+
|
|
73
|
+
playwright-cli tracing-stop
|
|
74
|
+
# Open trace to see DOM state when click was attempted
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Analyzing Performance
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
playwright-cli tracing-start
|
|
81
|
+
playwright-cli open https://slow-site.com
|
|
82
|
+
playwright-cli tracing-stop
|
|
83
|
+
|
|
84
|
+
# View network waterfall to identify slow resources
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Capturing Evidence
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Record a complete user flow for documentation
|
|
91
|
+
playwright-cli tracing-start
|
|
92
|
+
|
|
93
|
+
playwright-cli open https://app.example.com/checkout
|
|
94
|
+
playwright-cli fill e1 "4111111111111111"
|
|
95
|
+
playwright-cli fill e2 "12/25"
|
|
96
|
+
playwright-cli fill e3 "123"
|
|
97
|
+
playwright-cli click e4
|
|
98
|
+
|
|
99
|
+
playwright-cli tracing-stop
|
|
100
|
+
# Trace shows exact sequence of events
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Trace vs Video vs Screenshot
|
|
104
|
+
|
|
105
|
+
| Feature | Trace | Video | Screenshot |
|
|
106
|
+
|---------|-------|-------|------------|
|
|
107
|
+
| **Format** | .trace file | .webm video | .png/.jpeg image |
|
|
108
|
+
| **DOM inspection** | Yes | No | No |
|
|
109
|
+
| **Network details** | Yes | No | No |
|
|
110
|
+
| **Step-by-step replay** | Yes | Continuous | Single frame |
|
|
111
|
+
| **File size** | Medium | Large | Small |
|
|
112
|
+
| **Best for** | Debugging | Demos | Quick capture |
|
|
113
|
+
|
|
114
|
+
## Best Practices
|
|
115
|
+
|
|
116
|
+
### 1. Start Tracing Before the Problem
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Trace the entire flow, not just the failing step
|
|
120
|
+
playwright-cli tracing-start
|
|
121
|
+
playwright-cli open https://example.com
|
|
122
|
+
# ... all steps leading to the issue ...
|
|
123
|
+
playwright-cli tracing-stop
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 2. Clean Up Old Traces
|
|
127
|
+
|
|
128
|
+
Traces can consume significant disk space:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Remove traces older than 7 days
|
|
132
|
+
find .playwright-cli/traces -mtime +7 -delete
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Limitations
|
|
136
|
+
|
|
137
|
+
- Traces add overhead to automation
|
|
138
|
+
- Large traces can consume significant disk space
|
|
139
|
+
- Some dynamic content may not replay perfectly
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Video Recording
|
|
2
|
+
|
|
3
|
+
Capture browser automation sessions as video for debugging, documentation, or verification. Produces WebM (VP8/VP9 codec).
|
|
4
|
+
|
|
5
|
+
## Basic Recording
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Open browser first
|
|
9
|
+
playwright-cli open
|
|
10
|
+
|
|
11
|
+
# Start recording
|
|
12
|
+
playwright-cli video-start demo.webm
|
|
13
|
+
|
|
14
|
+
# Add a chapter marker for section transitions
|
|
15
|
+
playwright-cli video-chapter "Getting Started" --description="Opening the homepage" --duration=2000
|
|
16
|
+
|
|
17
|
+
# Navigate and perform actions
|
|
18
|
+
playwright-cli goto https://example.com
|
|
19
|
+
playwright-cli snapshot
|
|
20
|
+
playwright-cli click e1
|
|
21
|
+
|
|
22
|
+
# Add another chapter
|
|
23
|
+
playwright-cli video-chapter "Filling Form" --description="Entering test data" --duration=2000
|
|
24
|
+
playwright-cli fill e2 "test input"
|
|
25
|
+
|
|
26
|
+
# Stop and save
|
|
27
|
+
playwright-cli video-stop
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Best Practices
|
|
31
|
+
|
|
32
|
+
### 1. Use Descriptive Filenames
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Include context in filename
|
|
36
|
+
playwright-cli video-start recordings/login-flow-2024-01-15.webm
|
|
37
|
+
playwright-cli video-start recordings/checkout-test-run-42.webm
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 2. Record entire hero scripts.
|
|
41
|
+
|
|
42
|
+
When recording a video for the user or as a proof of work, it is best to create a code snippet and execute it with run-code.
|
|
43
|
+
It allows pulling appropriate pauses between the actions and annotating the video. There are new Playwright APIs for that.
|
|
44
|
+
|
|
45
|
+
1) Perform scenario using CLI and take note of all locators and actions. You'll need those locators to request their bounding boxes for highlight.
|
|
46
|
+
2) Create a file with the intended script for video (below). Use pressSequentially w/ delay for nice typing, make reasonable pauses.
|
|
47
|
+
3) Use playwright-cli run-code --filename your-script.js
|
|
48
|
+
|
|
49
|
+
**Important**: Overlays are `pointer-events: none` — they do not interfere with page interactions. You can safely keep sticky overlays visible while clicking, filling, or performing any actions on the page.
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
async page => {
|
|
53
|
+
await page.screencast.start({ path: 'video.webm', size: { width: 1280, height: 800 } });
|
|
54
|
+
await page.goto('https://demo.playwright.dev/todomvc');
|
|
55
|
+
|
|
56
|
+
// Show a chapter card — blurs the page and shows a dialog.
|
|
57
|
+
// Blocks until duration expires, then auto-removes.
|
|
58
|
+
// Use this for simple use cases, but always feel free to hand-craft your own beautiful
|
|
59
|
+
// overlay via await page.screencast.showOverlay().
|
|
60
|
+
await page.screencast.showChapter('Adding Todo Items', {
|
|
61
|
+
description: 'We will add several items to the todo list.',
|
|
62
|
+
duration: 2000,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Perform action
|
|
66
|
+
await page.getByRole('textbox', { name: 'What needs to be done?' }).pressSequentially('Walk the dog', { delay: 60 });
|
|
67
|
+
await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
|
|
68
|
+
await page.waitForTimeout(1000);
|
|
69
|
+
|
|
70
|
+
// Show next chapter
|
|
71
|
+
await page.screencast.showChapter('Verifying Results', {
|
|
72
|
+
description: 'Checking the item appeared in the list.',
|
|
73
|
+
duration: 2000,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Add a sticky annotation that stays while you perform actions.
|
|
77
|
+
// Overlays are pointer-events: none, so they won't block clicks.
|
|
78
|
+
const annotation = await page.screencast.showOverlay(`
|
|
79
|
+
<div style="position: absolute; top: 8px; right: 8px;
|
|
80
|
+
padding: 6px 12px; background: rgba(0,0,0,0.7);
|
|
81
|
+
border-radius: 8px; font-size: 13px; color: white;">
|
|
82
|
+
✓ Item added successfully
|
|
83
|
+
</div>
|
|
84
|
+
`);
|
|
85
|
+
|
|
86
|
+
// Perform more actions while the annotation is visible
|
|
87
|
+
await page.getByRole('textbox', { name: 'What needs to be done?' }).pressSequentially('Buy groceries', { delay: 60 });
|
|
88
|
+
await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
|
|
89
|
+
await page.waitForTimeout(1500);
|
|
90
|
+
|
|
91
|
+
// Remove the annotation when done
|
|
92
|
+
await annotation.dispose();
|
|
93
|
+
|
|
94
|
+
// You can also highlight relevant locators and provide contextual annotations.
|
|
95
|
+
const bounds = await page.getByText('Walk the dog').boundingBox();
|
|
96
|
+
await page.screencast.showOverlay(`
|
|
97
|
+
<div style="position: absolute;
|
|
98
|
+
top: ${bounds.y}px;
|
|
99
|
+
left: ${bounds.x}px;
|
|
100
|
+
width: ${bounds.width}px;
|
|
101
|
+
height: ${bounds.height}px;
|
|
102
|
+
border: 1px solid red;">
|
|
103
|
+
</div>
|
|
104
|
+
<div style="position: absolute;
|
|
105
|
+
top: ${bounds.y + bounds.height + 5}px;
|
|
106
|
+
left: ${bounds.x + bounds.width / 2}px;
|
|
107
|
+
transform: translateX(-50%);
|
|
108
|
+
padding: 6px;
|
|
109
|
+
background: #808080;
|
|
110
|
+
border-radius: 10px;
|
|
111
|
+
font-size: 14px;
|
|
112
|
+
color: white;">Check it out, it is right above this text
|
|
113
|
+
</div>
|
|
114
|
+
`, { duration: 2000 });
|
|
115
|
+
|
|
116
|
+
await page.screencast.stop();
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Embrace creativity, overlays are powerful.
|
|
121
|
+
|
|
122
|
+
### Overlay API Summary
|
|
123
|
+
|
|
124
|
+
| Method | Use Case |
|
|
125
|
+
|--------|----------|
|
|
126
|
+
| `page.screencast.showChapter(title, { description?, duration?, styleSheet? })` | Full-screen chapter card with blurred backdrop — ideal for section transitions |
|
|
127
|
+
| `page.screencast.showOverlay(html, { duration? })` | Custom HTML overlay — use for callouts, labels, highlights |
|
|
128
|
+
| `disposable.dispose()` | Remove a sticky overlay added without duration |
|
|
129
|
+
| `page.screencast.hideOverlays()` / `page.screencast.showOverlays()` | Temporarily hide/show all overlays |
|
|
130
|
+
|
|
131
|
+
## Tracing vs Video
|
|
132
|
+
|
|
133
|
+
| Feature | Video | Tracing |
|
|
134
|
+
|---------|-------|---------|
|
|
135
|
+
| Output | WebM file | Trace file (viewable in Trace Viewer) |
|
|
136
|
+
| Shows | Visual recording | DOM snapshots, network, console, actions |
|
|
137
|
+
| Use case | Demos, documentation | Debugging, analysis |
|
|
138
|
+
| Size | Larger | Smaller |
|
|
139
|
+
|
|
140
|
+
## Limitations
|
|
141
|
+
|
|
142
|
+
- Recording adds slight overhead to automation
|
|
143
|
+
- Large recordings can consume significant disk space
|
|
Binary file
|
|
@@ -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,78 @@
|
|
|
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
|
+
isPlaywrightExtensionInstalled: () => isPlaywrightExtensionInstalled,
|
|
32
|
+
playwrightExtensionId: () => playwrightExtensionId,
|
|
33
|
+
playwrightExtensionInstallUrl: () => playwrightExtensionInstallUrl
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(extension_exports);
|
|
36
|
+
var import_fs = __toESM(require("fs"));
|
|
37
|
+
var import_path = __toESM(require("path"));
|
|
38
|
+
const playwrightExtensionId = "mmlmfjhmonkocbjadbfplnigmagldckm";
|
|
39
|
+
const playwrightExtensionInstallUrl = `https://chromewebstore.google.com/detail/playwright-extension/${playwrightExtensionId}`;
|
|
40
|
+
async function isPlaywrightExtensionInstalled(userDataDir) {
|
|
41
|
+
let entries;
|
|
42
|
+
try {
|
|
43
|
+
entries = await import_fs.default.promises.readdir(userDataDir);
|
|
44
|
+
} catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
for (const entry of entries) {
|
|
48
|
+
if (entry !== "Default" && !entry.startsWith("Profile "))
|
|
49
|
+
continue;
|
|
50
|
+
if (await isExtensionInstalledInProfile(import_path.default.join(userDataDir, entry)))
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
async function isExtensionInstalledInProfile(profileDir) {
|
|
56
|
+
if (await pathExists(import_path.default.join(profileDir, "Extensions", playwrightExtensionId)))
|
|
57
|
+
return true;
|
|
58
|
+
try {
|
|
59
|
+
const prefs = await import_fs.default.promises.readFile(import_path.default.join(profileDir, "Preferences"), "utf-8");
|
|
60
|
+
return prefs.includes(`"${playwrightExtensionId}"`);
|
|
61
|
+
} catch {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function pathExists(p) {
|
|
66
|
+
try {
|
|
67
|
+
await import_fs.default.promises.access(p);
|
|
68
|
+
return true;
|
|
69
|
+
} catch {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
isPlaywrightExtensionInstalled,
|
|
76
|
+
playwrightExtensionId,
|
|
77
|
+
playwrightExtensionInstallUrl
|
|
78
|
+
});
|
|
@@ -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
|
+
});
|