electron-playwright-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +69 -0
- package/package.json +62 -0
- package/playwright-cli.js +256 -0
- package/playwright-electron/electron-context-factory.js +49 -0
- package/playwright-electron/electron-daemon.js +119 -0
- package/playwright-electron/electron-tools.js +69 -0
- package/skills/playwright-cli/SKILL.md +272 -0
- package/skills/playwright-cli/references/request-mocking.md +87 -0
- package/skills/playwright-cli/references/running-code.md +226 -0
- package/skills/playwright-cli/references/session-management.md +145 -0
- package/skills/playwright-cli/references/storage-state.md +270 -0
- package/skills/playwright-cli/references/test-generation.md +88 -0
- package/skills/playwright-cli/references/tracing.md +135 -0
- package/skills/playwright-cli/references/video-recording.md +42 -0
|
@@ -0,0 +1,135 @@
|
|
|
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
|
+
electron-playwright-cli tracing-start
|
|
10
|
+
|
|
11
|
+
# Perform actions
|
|
12
|
+
electron-playwright-cli click e1
|
|
13
|
+
electron-playwright-cli fill e2 "test"
|
|
14
|
+
|
|
15
|
+
# Stop trace recording
|
|
16
|
+
electron-playwright-cli tracing-stop
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Trace Output Files
|
|
20
|
+
|
|
21
|
+
When you start tracing, Playwright creates a `traces/` directory with several files:
|
|
22
|
+
|
|
23
|
+
### `trace-{timestamp}.trace`
|
|
24
|
+
|
|
25
|
+
**Action log** - The main trace file containing:
|
|
26
|
+
- Every action performed (clicks, fills, navigations)
|
|
27
|
+
- DOM snapshots before and after each action
|
|
28
|
+
- Screenshots at each step
|
|
29
|
+
- Timing information
|
|
30
|
+
- Console messages
|
|
31
|
+
- Source locations
|
|
32
|
+
|
|
33
|
+
### `trace-{timestamp}.network`
|
|
34
|
+
|
|
35
|
+
**Network log** - Complete network activity:
|
|
36
|
+
- All HTTP requests and responses
|
|
37
|
+
- Request headers and bodies
|
|
38
|
+
- Response headers and bodies
|
|
39
|
+
- Timing (DNS, connect, TLS, TTFB, download)
|
|
40
|
+
- Resource sizes
|
|
41
|
+
- Failed requests and errors
|
|
42
|
+
|
|
43
|
+
### `resources/`
|
|
44
|
+
|
|
45
|
+
**Resources directory** - Cached resources:
|
|
46
|
+
- Images, fonts, stylesheets, scripts
|
|
47
|
+
- Response bodies for replay
|
|
48
|
+
- Assets needed to reconstruct page state
|
|
49
|
+
|
|
50
|
+
## What Traces Capture
|
|
51
|
+
|
|
52
|
+
| Category | Details |
|
|
53
|
+
|----------|---------|
|
|
54
|
+
| **Actions** | Clicks, fills, hovers, keyboard input, navigations |
|
|
55
|
+
| **DOM** | Full DOM snapshot before/after each action |
|
|
56
|
+
| **Screenshots** | Visual state at each step |
|
|
57
|
+
| **Network** | All requests, responses, headers, bodies, timing |
|
|
58
|
+
| **Console** | All console.log, warn, error messages |
|
|
59
|
+
| **Timing** | Precise timing for each operation |
|
|
60
|
+
|
|
61
|
+
## Use Cases
|
|
62
|
+
|
|
63
|
+
### Debugging Failed Actions
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
electron-playwright-cli tracing-start
|
|
67
|
+
|
|
68
|
+
# This click fails - why?
|
|
69
|
+
electron-playwright-cli click e5
|
|
70
|
+
|
|
71
|
+
electron-playwright-cli tracing-stop
|
|
72
|
+
# Open trace to see DOM state when click was attempted
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Analyzing App Performance
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
electron-playwright-cli tracing-start
|
|
79
|
+
electron-playwright-cli snapshot
|
|
80
|
+
electron-playwright-cli tracing-stop
|
|
81
|
+
|
|
82
|
+
# View network waterfall to identify slow resources
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Capturing Evidence
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Record a complete user flow for documentation
|
|
89
|
+
electron-playwright-cli tracing-start
|
|
90
|
+
|
|
91
|
+
electron-playwright-cli fill e1 "4111111111111111"
|
|
92
|
+
electron-playwright-cli fill e2 "12/25"
|
|
93
|
+
electron-playwright-cli fill e3 "123"
|
|
94
|
+
electron-playwright-cli click e4
|
|
95
|
+
|
|
96
|
+
electron-playwright-cli tracing-stop
|
|
97
|
+
# Trace shows exact sequence of events
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Trace vs Video vs Screenshot
|
|
101
|
+
|
|
102
|
+
| Feature | Trace | Video | Screenshot |
|
|
103
|
+
|---------|-------|-------|------------|
|
|
104
|
+
| **Format** | .trace file | .webm video | .png/.jpeg image |
|
|
105
|
+
| **DOM inspection** | Yes | No | No |
|
|
106
|
+
| **Network details** | Yes | No | No |
|
|
107
|
+
| **Step-by-step replay** | Yes | Continuous | Single frame |
|
|
108
|
+
| **File size** | Medium | Large | Small |
|
|
109
|
+
| **Best for** | Debugging | Demos | Quick capture |
|
|
110
|
+
|
|
111
|
+
## Best Practices
|
|
112
|
+
|
|
113
|
+
### 1. Start Tracing Before the Problem
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Trace the entire flow, not just the failing step
|
|
117
|
+
electron-playwright-cli tracing-start
|
|
118
|
+
# ... all steps leading to the issue ...
|
|
119
|
+
electron-playwright-cli tracing-stop
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 2. Clean Up Old Traces
|
|
123
|
+
|
|
124
|
+
Traces can consume significant disk space:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Remove traces older than 7 days
|
|
128
|
+
find .playwright-cli/traces -mtime +7 -delete
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Limitations
|
|
132
|
+
|
|
133
|
+
- Traces add overhead to automation
|
|
134
|
+
- Large traces can consume significant disk space
|
|
135
|
+
- Some dynamic content may not replay perfectly
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Video Recording
|
|
2
|
+
|
|
3
|
+
Capture Electron app automation sessions as video for debugging, documentation, or verification. Produces WebM (VP8/VP9 codec).
|
|
4
|
+
|
|
5
|
+
## Basic Recording
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Start recording
|
|
9
|
+
electron-playwright-cli video-start
|
|
10
|
+
|
|
11
|
+
# Perform actions
|
|
12
|
+
electron-playwright-cli snapshot
|
|
13
|
+
electron-playwright-cli click e1
|
|
14
|
+
electron-playwright-cli fill e2 "test input"
|
|
15
|
+
|
|
16
|
+
# Stop and save
|
|
17
|
+
electron-playwright-cli video-stop demo.webm
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Best Practices
|
|
21
|
+
|
|
22
|
+
### 1. Use Descriptive Filenames
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Include context in filename
|
|
26
|
+
electron-playwright-cli video-stop recordings/login-flow-2024-01-15.webm
|
|
27
|
+
electron-playwright-cli video-stop recordings/settings-test-run-42.webm
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Tracing vs Video
|
|
31
|
+
|
|
32
|
+
| Feature | Video | Tracing |
|
|
33
|
+
|---------|-------|---------|
|
|
34
|
+
| Output | WebM file | Trace file (viewable in Trace Viewer) |
|
|
35
|
+
| Shows | Visual recording | DOM snapshots, network, console, actions |
|
|
36
|
+
| Use case | Demos, documentation | Debugging, analysis |
|
|
37
|
+
| Size | Larger | Smaller |
|
|
38
|
+
|
|
39
|
+
## Limitations
|
|
40
|
+
|
|
41
|
+
- Recording adds slight overhead to automation
|
|
42
|
+
- Large recordings can consume significant disk space
|