@kamleshsk/claude-qa 1.0.1

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.
@@ -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