testdriverai 7.8.0-test.7 → 7.8.0-test.71
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/agent/index.js +18 -5
- package/agent/lib/commands.js +3 -2
- package/agent/lib/http.js +162 -0
- package/agent/lib/logger.js +15 -0
- package/agent/lib/sandbox.js +554 -209
- package/agent/lib/sdk.js +5 -22
- package/agent/lib/system.js +25 -65
- package/ai/skills/testdriver-cache/SKILL.md +221 -0
- package/ai/skills/testdriver-errors/SKILL.md +246 -0
- package/ai/skills/testdriver-events/SKILL.md +356 -0
- package/ai/skills/testdriver-find/SKILL.md +14 -20
- package/ai/skills/testdriver-mcp/SKILL.md +7 -0
- package/ai/skills/testdriver-provision/SKILL.md +331 -0
- package/ai/skills/testdriver-redraw/SKILL.md +214 -0
- package/ai/skills/testdriver-running-tests/SKILL.md +1 -1
- package/ai/skills/testdriver-screenshots/SKILL.md +184 -0
- package/docs/_data/examples-manifest.json +46 -46
- package/docs/_scripts/extract-example-urls.js +67 -72
- package/docs/changelog.mdx +148 -8
- package/docs/docs.json +46 -38
- package/docs/images/content/vscode/v7-chat.png +0 -0
- package/docs/images/content/vscode/v7-choose-agent.png +0 -0
- package/docs/images/content/vscode/v7-full.png +0 -0
- package/docs/images/content/vscode/v7-onboarding.png +0 -0
- package/docs/v7/cache.mdx +223 -0
- package/docs/v7/copilot/auto-healing.mdx +265 -0
- package/docs/v7/copilot/creating-tests.mdx +156 -0
- package/docs/v7/copilot/github.mdx +143 -0
- package/docs/v7/copilot/running-tests.mdx +149 -0
- package/docs/v7/copilot/setup.mdx +143 -0
- package/docs/v7/enterprise.mdx +3 -110
- package/docs/v7/errors.mdx +248 -0
- package/docs/v7/events.mdx +358 -0
- package/docs/v7/examples/ai.mdx +1 -1
- package/docs/v7/examples/assert.mdx +1 -1
- package/docs/v7/examples/captcha-api.mdx +1 -1
- package/docs/v7/examples/chrome-extension.mdx +1 -1
- package/docs/v7/examples/drag-and-drop.mdx +1 -1
- package/docs/v7/examples/element-not-found.mdx +1 -1
- package/docs/v7/examples/exec-output.mdx +85 -0
- package/docs/v7/examples/exec-pwsh.mdx +83 -0
- package/docs/v7/examples/focus-window.mdx +62 -0
- package/docs/v7/examples/hover-image.mdx +1 -1
- package/docs/v7/examples/hover-text.mdx +1 -1
- package/docs/v7/examples/installer.mdx +1 -1
- package/docs/v7/examples/launch-vscode-linux.mdx +1 -1
- package/docs/v7/examples/match-image.mdx +1 -1
- package/docs/v7/examples/press-keys.mdx +1 -1
- package/docs/v7/examples/scroll-keyboard.mdx +1 -1
- package/docs/v7/examples/scroll-until-image.mdx +1 -1
- package/docs/v7/examples/scroll-until-text.mdx +1 -1
- package/docs/v7/examples/scroll.mdx +1 -1
- package/docs/v7/examples/type.mdx +1 -1
- package/docs/v7/examples/windows-installer.mdx +1 -1
- package/docs/v7/find.mdx +14 -20
- package/docs/v7/{cloud.mdx → hosted.mdx} +43 -5
- package/docs/v7/mcp.mdx +9 -0
- package/docs/v7/provision.mdx +333 -0
- package/docs/v7/quickstart.mdx +30 -2
- package/docs/v7/redraw.mdx +216 -0
- package/docs/v7/running-tests.mdx +1 -1
- package/docs/v7/screenshots.mdx +186 -0
- package/docs/v7/self-hosted.mdx +127 -44
- package/docs/v7/test-results-json.mdx +258 -0
- package/examples/scroll-keyboard.test.mjs +1 -1
- package/examples/scroll.test.mjs +1 -12
- package/interfaces/logger.js +0 -12
- package/interfaces/vitest-plugin.mjs +170 -51
- package/lib/core/Dashcam.js +30 -23
- package/lib/environments.json +22 -0
- package/lib/github-comment.mjs +58 -40
- package/lib/init-project.js +5 -67
- package/lib/resolve-channel.js +42 -12
- package/lib/sentry.js +47 -23
- package/lib/vitest/hooks.mjs +63 -3
- package/{examples → manual}/drag-and-drop.test.mjs +1 -1
- package/manual/exec-stream-logs.test.mjs +25 -0
- package/mcp-server/dist/server.mjs +28 -8
- package/mcp-server/src/server.ts +31 -8
- package/package.json +4 -3
- package/sdk.d.ts +4 -0
- package/sdk.js +45 -15
- package/setup/aws/install-dev-runner.sh +79 -0
- package/setup/aws/spawn-runner.sh +165 -0
- package/test-sentry-span.js +35 -0
- package/vitest.config.mjs +22 -34
- package/vitest.runner.config.mjs +33 -0
- /package/{examples → manual}/flake-diffthreshold-001.test.mjs +0 -0
- /package/{examples → manual}/flake-diffthreshold-01.test.mjs +0 -0
- /package/{examples → manual}/flake-diffthreshold-05.test.mjs +0 -0
- /package/{examples → manual}/flake-noredraw-cache.test.mjs +0 -0
- /package/{examples → manual}/flake-noredraw-nocache.test.mjs +0 -0
- /package/{examples → manual}/flake-redraw-cache.test.mjs +0 -0
- /package/{examples → manual}/flake-redraw-nocache.test.mjs +0 -0
- /package/{examples → manual}/flake-rocket-match.test.mjs +0 -0
- /package/{examples → manual}/flake-shared.mjs +0 -0
- /package/{examples → manual}/no-provision.test.mjs +0 -0
- /package/{examples → manual}/scroll-until-text.test.mjs +0 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testdriver:screenshots
|
|
3
|
+
description: Capture and manage screenshots during test execution
|
|
4
|
+
---
|
|
5
|
+
<!-- Generated from screenshots.mdx. DO NOT EDIT. -->
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
TestDriver can capture screenshots manually at any point during a test, or automatically before and after every command. Screenshots are saved to a structured directory for easy debugging.
|
|
10
|
+
|
|
11
|
+
## Manual Screenshots
|
|
12
|
+
|
|
13
|
+
Use `testdriver.screenshot()` to capture the current screen:
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
const path = await testdriver.screenshot();
|
|
17
|
+
console.log('Saved to:', path);
|
|
18
|
+
// .testdriver/screenshots/my-test/screenshot-1719849312345.png
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Options
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
await testdriver.screenshot(filename?)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
<ParamField path="filename" type="string">
|
|
28
|
+
Custom filename for the screenshot. `.png` is appended automatically if missing. If omitted, defaults to `screenshot-<timestamp>.png`.
|
|
29
|
+
</ParamField>
|
|
30
|
+
|
|
31
|
+
**Returns:** `Promise<string>` — the absolute file path of the saved screenshot.
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
// Default filename
|
|
35
|
+
await testdriver.screenshot();
|
|
36
|
+
// → .testdriver/screenshots/my-test/screenshot-1719849312345.png
|
|
37
|
+
|
|
38
|
+
// Custom filename
|
|
39
|
+
await testdriver.screenshot('login-page');
|
|
40
|
+
// → .testdriver/screenshots/my-test/login-page.png
|
|
41
|
+
|
|
42
|
+
// With .png extension
|
|
43
|
+
await testdriver.screenshot('dashboard-loaded.png');
|
|
44
|
+
// → .testdriver/screenshots/my-test/dashboard-loaded.png
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Auto Screenshots
|
|
48
|
+
|
|
49
|
+
Enable automatic screenshots before and after every command:
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
const testdriver = new TestDriver({
|
|
53
|
+
autoScreenshots: true,
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
<ParamField path="autoScreenshots" type="boolean" default={false}>
|
|
58
|
+
When `true`, captures a screenshot before and after every SDK command (`click`, `type`, `find`, `scroll`, `hover`, `pressKeys`, `assert`, `exec`, etc.). On error, an error-phase screenshot replaces the after-phase screenshot.
|
|
59
|
+
</ParamField>
|
|
60
|
+
|
|
61
|
+
### Filename Format
|
|
62
|
+
|
|
63
|
+
Auto-screenshots follow this naming convention:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
<seq>-<action>-<phase>-L<line>-<description>.png
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
| Part | Description | Example |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| `seq` | 3-digit zero-padded sequence number | `001` |
|
|
72
|
+
| `action` | Command name | `click`, `type`, `find` |
|
|
73
|
+
| `phase` | `before`, `after`, or `error` | `before` |
|
|
74
|
+
| `L<line>` | Source line number from your test file | `L42` |
|
|
75
|
+
| `description` | Sanitized from command arguments (max 30 chars) | `submit-button` |
|
|
76
|
+
|
|
77
|
+
**Examples:**
|
|
78
|
+
```
|
|
79
|
+
001-find-before-L15-login-button.png
|
|
80
|
+
002-find-after-L15-login-button.png
|
|
81
|
+
003-click-before-L16-login-button.png
|
|
82
|
+
004-click-after-L16-login-button.png
|
|
83
|
+
005-type-before-L18-username-field.png
|
|
84
|
+
006-type-error-L18-username-field.png
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Phases
|
|
88
|
+
|
|
89
|
+
| Phase | When | Description |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| `before` | Before command executes | Captures the screen state before the action |
|
|
92
|
+
| `after` | After successful command | Captures the result of the action |
|
|
93
|
+
| `error` | After failed command | Captures the screen at the point of failure (replaces `after`) |
|
|
94
|
+
|
|
95
|
+
## Screenshot Directory
|
|
96
|
+
|
|
97
|
+
Screenshots are saved to:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
<cwd>/.testdriver/screenshots/<testFileName>/
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Where `<testFileName>` is the test file name without its extension. For example, a test at `tests/login.test.mjs` saves screenshots to `.testdriver/screenshots/login.test/`.
|
|
104
|
+
|
|
105
|
+
### Directory Cleanup
|
|
106
|
+
|
|
107
|
+
The screenshot directory for each test file is **automatically cleaned** at the start of a test run. This happens once per process per test file to prevent concurrent tests from the same file from interfering with each other.
|
|
108
|
+
|
|
109
|
+
## Debug Screenshots
|
|
110
|
+
|
|
111
|
+
Elements have a `saveDebugScreenshot()` method for debugging element detection:
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
const el = await testdriver.find('submit button');
|
|
115
|
+
|
|
116
|
+
// Save the screenshot that was used to detect this element
|
|
117
|
+
const debugPath = await el.saveDebugScreenshot();
|
|
118
|
+
console.log('Debug screenshot:', debugPath);
|
|
119
|
+
// → ./debug-screenshot-1719849312345.png
|
|
120
|
+
|
|
121
|
+
// Custom path
|
|
122
|
+
await el.saveDebugScreenshot('./my-debug.png');
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
This saves the screenshot that was captured during the `find()` call, which can be useful for understanding what the AI "saw" when locating the element.
|
|
126
|
+
|
|
127
|
+
## Complete Example
|
|
128
|
+
|
|
129
|
+
```javascript
|
|
130
|
+
import { describe, it, beforeAll, afterAll } from 'vitest';
|
|
131
|
+
import TestDriver from 'testdriverai';
|
|
132
|
+
|
|
133
|
+
describe('Screenshot Example', () => {
|
|
134
|
+
let testdriver;
|
|
135
|
+
|
|
136
|
+
beforeAll(async () => {
|
|
137
|
+
testdriver = new TestDriver({
|
|
138
|
+
autoScreenshots: true, // capture every step
|
|
139
|
+
});
|
|
140
|
+
await testdriver.ready();
|
|
141
|
+
await testdriver.provision.chrome({ url: 'https://example.com' });
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
afterAll(async () => {
|
|
145
|
+
await testdriver.disconnect();
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('captures the login flow', async () => {
|
|
149
|
+
// Auto-screenshots capture before/after each command
|
|
150
|
+
|
|
151
|
+
// Manual screenshot for a specific moment
|
|
152
|
+
await testdriver.screenshot('initial-page-load');
|
|
153
|
+
|
|
154
|
+
const username = await testdriver.find('username input');
|
|
155
|
+
await username.click();
|
|
156
|
+
await testdriver.type('testuser@example.com');
|
|
157
|
+
|
|
158
|
+
await testdriver.screenshot('after-username-entry');
|
|
159
|
+
|
|
160
|
+
const password = await testdriver.find('password input');
|
|
161
|
+
await password.click();
|
|
162
|
+
await testdriver.type('password123');
|
|
163
|
+
|
|
164
|
+
await testdriver.find('login button').click();
|
|
165
|
+
|
|
166
|
+
await testdriver.screenshot('after-login-click');
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
After running, your screenshot directory will contain:
|
|
172
|
+
```
|
|
173
|
+
.testdriver/screenshots/login-flow.test/
|
|
174
|
+
├── initial-page-load.png
|
|
175
|
+
├── 001-find-before-L18-username-input.png
|
|
176
|
+
├── 002-find-after-L18-username-input.png
|
|
177
|
+
├── 003-click-before-L19-username-input.png
|
|
178
|
+
├── 004-click-after-L19-username-input.png
|
|
179
|
+
├── 005-type-before-L20-testuser-example-com.png
|
|
180
|
+
├── 006-type-after-L20-testuser-example-com.png
|
|
181
|
+
├── after-username-entry.png
|
|
182
|
+
├── 007-find-before-L24-password-input.png
|
|
183
|
+
├── ...
|
|
184
|
+
```
|
|
@@ -2,104 +2,104 @@
|
|
|
2
2
|
"$schema": "./examples-manifest.schema.json",
|
|
3
3
|
"examples": {
|
|
4
4
|
"assert.test.mjs": {
|
|
5
|
-
"url": "https://console.testdriver.ai/runs/
|
|
6
|
-
"lastUpdated": "2026-03-
|
|
5
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32ca86560e1c6d04ac340",
|
|
6
|
+
"lastUpdated": "2026-03-25T00:36:26.387Z"
|
|
7
7
|
},
|
|
8
8
|
"drag-and-drop.test.mjs": {
|
|
9
9
|
"url": "https://console.testdriver.ai/runs/69a62b3aaa712ecd3dea730a/69a62b42fc0ac3cc632a918b",
|
|
10
10
|
"lastUpdated": "2026-03-03T00:32:25.275Z"
|
|
11
11
|
},
|
|
12
12
|
"exec-pwsh.test.mjs": {
|
|
13
|
-
"url": "https://console.testdriver.ai/runs/
|
|
14
|
-
"lastUpdated": "2026-03-
|
|
13
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32c9816690e8f8d0fd3a7",
|
|
14
|
+
"lastUpdated": "2026-03-25T00:31:30.158Z"
|
|
15
15
|
},
|
|
16
16
|
"match-image.test.mjs": {
|
|
17
|
-
"url": "https://console.testdriver.ai/runs/
|
|
18
|
-
"lastUpdated": "2026-03-
|
|
17
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32c9a6560e1c6d04ac33c",
|
|
18
|
+
"lastUpdated": "2026-03-25T00:31:31.550Z"
|
|
19
19
|
},
|
|
20
20
|
"scroll-until-text.test.mjs": {
|
|
21
21
|
"url": "https://console.testdriver.ai/runs/69a62b3aaa712ecd3dea730a/69a62b99dc33133fc0da9440",
|
|
22
22
|
"lastUpdated": "2026-03-03T00:32:25.282Z"
|
|
23
23
|
},
|
|
24
24
|
"hover-text-with-description.test.mjs": {
|
|
25
|
-
"url": "https://console.testdriver.ai/runs/
|
|
26
|
-
"lastUpdated": "2026-03-
|
|
25
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32c9b6f1e64e218b9e1c1",
|
|
26
|
+
"lastUpdated": "2026-03-25T00:30:19.815Z"
|
|
27
27
|
},
|
|
28
28
|
"windows-installer.test.mjs": {
|
|
29
|
-
"url": "https://console.testdriver.ai/runs/
|
|
30
|
-
"lastUpdated": "2026-03-
|
|
29
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32c9e6f1e64e218b9e1c3",
|
|
30
|
+
"lastUpdated": "2026-03-25T00:31:36.152Z"
|
|
31
31
|
},
|
|
32
32
|
"exec-output.test.mjs": {
|
|
33
|
-
"url": "https://console.testdriver.ai/runs/
|
|
34
|
-
"lastUpdated": "2026-03-
|
|
33
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32ca06560e1c6d04ac33e",
|
|
34
|
+
"lastUpdated": "2026-03-25T00:31:37.612Z"
|
|
35
35
|
},
|
|
36
36
|
"chrome-extension.test.mjs": {
|
|
37
|
-
"url": "https://console.testdriver.ai/runs/
|
|
38
|
-
"lastUpdated": "2026-03-
|
|
37
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32c9716690e8f8d0fd3a6",
|
|
38
|
+
"lastUpdated": "2026-03-25T00:30:51.808Z"
|
|
39
39
|
},
|
|
40
40
|
"launch-vscode-linux.test.mjs": {
|
|
41
|
-
"url": "https://console.testdriver.ai/runs/
|
|
42
|
-
"lastUpdated": "2026-03-
|
|
41
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32c9d6560e1c6d04ac33d",
|
|
42
|
+
"lastUpdated": "2026-03-25T00:33:18.181Z"
|
|
43
43
|
},
|
|
44
44
|
"hover-image.test.mjs": {
|
|
45
|
-
"url": "https://console.testdriver.ai/runs/
|
|
46
|
-
"lastUpdated": "2026-03-
|
|
45
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32ca16f1e64e218b9e1c5",
|
|
46
|
+
"lastUpdated": "2026-03-25T00:31:02.500Z"
|
|
47
47
|
},
|
|
48
48
|
"installer.test.mjs": {
|
|
49
|
-
"url": "https://console.testdriver.ai/runs/
|
|
50
|
-
"lastUpdated": "2026-03-
|
|
49
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32ca3b4a333234cc21a71",
|
|
50
|
+
"lastUpdated": "2026-03-25T00:30:27.405Z"
|
|
51
51
|
},
|
|
52
52
|
"type.test.mjs": {
|
|
53
|
-
"url": "https://console.testdriver.ai/runs/
|
|
54
|
-
"lastUpdated": "2026-03-
|
|
53
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32ca56560e1c6d04ac33f",
|
|
54
|
+
"lastUpdated": "2026-03-25T00:31:05.803Z"
|
|
55
55
|
},
|
|
56
56
|
"press-keys.test.mjs": {
|
|
57
|
-
"url": "https://console.testdriver.ai/runs/
|
|
58
|
-
"lastUpdated": "2026-03-
|
|
57
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32ca6b4a333234cc21a72",
|
|
58
|
+
"lastUpdated": "2026-03-25T00:36:02.167Z"
|
|
59
59
|
},
|
|
60
60
|
"scroll-keyboard.test.mjs": {
|
|
61
|
-
"url": "https://console.testdriver.ai/runs/
|
|
62
|
-
"lastUpdated": "2026-03-
|
|
61
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32cab6f1e64e218b9e1c8",
|
|
62
|
+
"lastUpdated": "2026-03-25T00:31:48.884Z"
|
|
63
63
|
},
|
|
64
64
|
"scroll.test.mjs": {
|
|
65
|
-
"url": "https://console.testdriver.ai/runs/
|
|
66
|
-
"lastUpdated": "2026-03-
|
|
65
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32cb1ca96d9648a141714",
|
|
66
|
+
"lastUpdated": "2026-03-25T00:37:40.747Z"
|
|
67
67
|
},
|
|
68
68
|
"scroll-until-image.test.mjs": {
|
|
69
|
-
"url": "https://console.testdriver.ai/runs/
|
|
70
|
-
"lastUpdated": "2026-03-
|
|
69
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32cad6560e1c6d04ac342",
|
|
70
|
+
"lastUpdated": "2026-03-25T00:30:37.291Z"
|
|
71
71
|
},
|
|
72
72
|
"prompt.test.mjs": {
|
|
73
|
-
"url": "https://console.testdriver.ai/runs/
|
|
74
|
-
"lastUpdated": "2026-03-
|
|
73
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32cae6f1e64e218b9e1c9",
|
|
74
|
+
"lastUpdated": "2026-03-25T00:31:51.753Z"
|
|
75
75
|
},
|
|
76
76
|
"focus-window.test.mjs": {
|
|
77
|
-
"url": "https://console.testdriver.ai/runs/
|
|
78
|
-
"lastUpdated": "2026-03-
|
|
77
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32cb0ca96d9648a141713",
|
|
78
|
+
"lastUpdated": "2026-03-25T00:30:40.087Z"
|
|
79
79
|
},
|
|
80
80
|
"captcha-api.test.mjs": {
|
|
81
81
|
"url": "https://console.testdriver.ai/runs/698f7df69e27ce1528d7d087/698f7fb0d3b320ad547d9d44",
|
|
82
82
|
"lastUpdated": "2026-02-13T19:55:05.951Z"
|
|
83
83
|
},
|
|
84
84
|
"element-not-found.test.mjs": {
|
|
85
|
-
"url": "https://console.testdriver.ai/runs/
|
|
86
|
-
"lastUpdated": "2026-03-
|
|
85
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32cb5ca96d9648a141716",
|
|
86
|
+
"lastUpdated": "2026-03-25T00:31:57.845Z"
|
|
87
87
|
},
|
|
88
88
|
"formatted-logging.test.mjs": {
|
|
89
|
-
"url": "https://console.testdriver.ai/runs/
|
|
90
|
-
"lastUpdated": "2026-03-
|
|
89
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32cb36f1e64e218b9e1cb",
|
|
90
|
+
"lastUpdated": "2026-03-25T00:31:56.270Z"
|
|
91
91
|
},
|
|
92
92
|
"hover-text.test.mjs": {
|
|
93
|
-
"url": "https://console.testdriver.ai/runs/
|
|
94
|
-
"lastUpdated": "2026-03-
|
|
93
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32cb86f1e64e218b9e1cd",
|
|
94
|
+
"lastUpdated": "2026-03-25T00:30:48.128Z"
|
|
95
95
|
},
|
|
96
96
|
"no-provision.test.mjs": {
|
|
97
97
|
"url": "https://console.testdriver.ai/runs/69a62b3aaa712ecd3dea730a/69a62b7706a177a05bccd1cf",
|
|
98
98
|
"lastUpdated": "2026-03-03T00:32:25.279Z"
|
|
99
99
|
},
|
|
100
100
|
"ai.test.mjs": {
|
|
101
|
-
"url": "https://console.testdriver.ai/runs/
|
|
102
|
-
"lastUpdated": "2026-03-
|
|
101
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32cb6ca96d9648a141717",
|
|
102
|
+
"lastUpdated": "2026-03-25T00:38:54.978Z"
|
|
103
103
|
},
|
|
104
104
|
"popup-loading.test.mjs": {
|
|
105
105
|
"url": "https://console.testdriver.ai/runs/698bc89f7140c3fa7daaca8d/698bca7f7140c3fa7daacbf7",
|
|
@@ -134,12 +134,12 @@
|
|
|
134
134
|
"lastUpdated": "2026-02-13T19:55:05.953Z"
|
|
135
135
|
},
|
|
136
136
|
"findall-coffee-icons.test.mjs": {
|
|
137
|
-
"url": "https://console.testdriver.ai/runs/
|
|
138
|
-
"lastUpdated": "2026-03-
|
|
137
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32caa6f1e64e218b9e1c7",
|
|
138
|
+
"lastUpdated": "2026-03-25T00:31:10.542Z"
|
|
139
139
|
},
|
|
140
140
|
"parse.test.mjs": {
|
|
141
|
-
"url": "https://console.testdriver.ai/runs/
|
|
142
|
-
"lastUpdated": "2026-03-
|
|
141
|
+
"url": "https://console-test.testdriver.ai/runs/69c32c95b4a333234cc21a6c/69c32cb96560e1c6d04ac34e",
|
|
142
|
+
"lastUpdated": "2026-03-25T00:32:02.419Z"
|
|
143
143
|
},
|
|
144
144
|
"flake-diffthreshold-001.test.mjs": {
|
|
145
145
|
"url": "https://console.testdriver.ai/runs/69a62b3aaa712ecd3dea730a/69a62bcafc0ac3cc632a91aa",
|
|
@@ -1,39 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Extract Example URLs from
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* and updates
|
|
8
|
-
*
|
|
4
|
+
* Extract Example URLs from Test Result JSON Files
|
|
5
|
+
*
|
|
6
|
+
* Reads per-test-case JSON result files written by the vitest plugin
|
|
7
|
+
* to .testdriver/results/ and updates examples-manifest.json.
|
|
8
|
+
*
|
|
9
9
|
* Usage:
|
|
10
|
-
*
|
|
11
|
-
* node extract-example-urls.js < ci-log.txt
|
|
12
|
-
* node extract-example-urls.js --file=ci-log.txt
|
|
10
|
+
* node extract-example-urls.js --results-dir=.testdriver/results
|
|
13
11
|
*/
|
|
14
12
|
|
|
15
13
|
const fs = require("fs");
|
|
16
14
|
const path = require("path");
|
|
17
|
-
const readline = require("readline");
|
|
18
15
|
|
|
19
16
|
const MANIFEST_PATH = path.join(__dirname, "../_data/examples-manifest.json");
|
|
20
17
|
|
|
21
|
-
// Regex to match TESTDRIVER_EXAMPLE_URL::filename::url (handles optional timestamp prefix from CI logs)
|
|
22
|
-
const URL_PATTERN = /TESTDRIVER_EXAMPLE_URL::([^:]+)::(.+)$/;
|
|
23
|
-
|
|
24
18
|
// Parse command line arguments
|
|
25
19
|
function parseArgs() {
|
|
26
20
|
const args = process.argv.slice(2);
|
|
27
21
|
const options = {
|
|
28
|
-
|
|
22
|
+
resultsDir: null,
|
|
29
23
|
help: false,
|
|
30
24
|
};
|
|
31
25
|
|
|
32
26
|
for (const arg of args) {
|
|
33
27
|
if (arg === "--help" || arg === "-h") {
|
|
34
28
|
options.help = true;
|
|
35
|
-
} else if (arg.startsWith("--
|
|
36
|
-
options.
|
|
29
|
+
} else if (arg.startsWith("--results-dir=")) {
|
|
30
|
+
options.resultsDir = arg.slice(14);
|
|
37
31
|
}
|
|
38
32
|
}
|
|
39
33
|
|
|
@@ -62,40 +56,51 @@ function saveManifest(manifest) {
|
|
|
62
56
|
fs.writeFileSync(MANIFEST_PATH, JSON.stringify(manifest, null, 2) + "\n", "utf-8");
|
|
63
57
|
}
|
|
64
58
|
|
|
65
|
-
// Process
|
|
66
|
-
function
|
|
67
|
-
const match = line.match(URL_PATTERN);
|
|
68
|
-
if (match) {
|
|
69
|
-
const [, filename, url] = match;
|
|
70
|
-
const isNew = !manifest.examples[filename];
|
|
71
|
-
|
|
72
|
-
manifest.examples[filename] = {
|
|
73
|
-
url: url.trim(),
|
|
74
|
-
lastUpdated: new Date().toISOString(),
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
if (isNew) {
|
|
78
|
-
stats.added++;
|
|
79
|
-
} else {
|
|
80
|
-
stats.updated++;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
console.log(`${isNew ? "➕" : "🔄"} ${filename}: ${url}`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Process input stream
|
|
88
|
-
async function processInput(inputStream) {
|
|
59
|
+
// Process JSON result files from .testdriver/results/
|
|
60
|
+
function processResultsDir(resultsDir) {
|
|
89
61
|
const manifest = loadManifest();
|
|
90
62
|
const stats = { added: 0, updated: 0 };
|
|
91
63
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
});
|
|
64
|
+
// Look for JSON files under examples/ subdirectories
|
|
65
|
+
const examplesDir = path.join(resultsDir, "examples");
|
|
66
|
+
if (!fs.existsSync(examplesDir)) {
|
|
67
|
+
console.log(`\n⚠️ No examples results found in ${examplesDir}`);
|
|
68
|
+
return stats;
|
|
69
|
+
}
|
|
96
70
|
|
|
97
|
-
|
|
98
|
-
|
|
71
|
+
// Walk example test directories (e.g., examples/assert.test.mjs/)
|
|
72
|
+
const testDirs = fs.readdirSync(examplesDir, { withFileTypes: true });
|
|
73
|
+
for (const entry of testDirs) {
|
|
74
|
+
if (!entry.isDirectory()) continue;
|
|
75
|
+
const testDir = path.join(examplesDir, entry.name);
|
|
76
|
+
const jsonFiles = fs.readdirSync(testDir).filter(f => f.endsWith(".json"));
|
|
77
|
+
|
|
78
|
+
for (const jsonFile of jsonFiles) {
|
|
79
|
+
try {
|
|
80
|
+
const content = fs.readFileSync(path.join(testDir, jsonFile), "utf-8");
|
|
81
|
+
const result = JSON.parse(content);
|
|
82
|
+
const testFileName = path.basename(result.test?.file || result.testFile || entry.name);
|
|
83
|
+
const url = result.urls?.testRun || result.testRunLink;
|
|
84
|
+
|
|
85
|
+
if (!url) continue;
|
|
86
|
+
|
|
87
|
+
const isNew = !manifest.examples[testFileName];
|
|
88
|
+
manifest.examples[testFileName] = {
|
|
89
|
+
url: url,
|
|
90
|
+
lastUpdated: result.date || new Date().toISOString(),
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
if (isNew) {
|
|
94
|
+
stats.added++;
|
|
95
|
+
} else {
|
|
96
|
+
stats.updated++;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
console.log(`${isNew ? "➕" : "🔄"} ${testFileName}: ${url}`);
|
|
100
|
+
} catch (err) {
|
|
101
|
+
console.warn(`⚠️ Failed to read ${jsonFile}: ${err.message}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
if (stats.added > 0 || stats.updated > 0) {
|
|
@@ -103,7 +108,7 @@ async function processInput(inputStream) {
|
|
|
103
108
|
console.log(`\n✨ Manifest updated: ${stats.added} added, ${stats.updated} updated`);
|
|
104
109
|
console.log(`📂 Written to: ${MANIFEST_PATH}`);
|
|
105
110
|
} else {
|
|
106
|
-
console.log("\n⚠️ No
|
|
111
|
+
console.log("\n⚠️ No example URLs found in result files");
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
return stats;
|
|
@@ -112,28 +117,24 @@ async function processInput(inputStream) {
|
|
|
112
117
|
// Show help
|
|
113
118
|
function showHelp() {
|
|
114
119
|
console.log(`
|
|
115
|
-
Extract Example URLs from
|
|
120
|
+
Extract Example URLs from Test Result JSON Files
|
|
116
121
|
|
|
117
122
|
Usage:
|
|
118
|
-
|
|
119
|
-
node extract-example-urls.js < ci-log.txt
|
|
120
|
-
node extract-example-urls.js --file=ci-log.txt
|
|
123
|
+
node extract-example-urls.js --results-dir=.testdriver/results
|
|
121
124
|
|
|
122
125
|
Options:
|
|
123
|
-
--
|
|
124
|
-
--help, -h
|
|
126
|
+
--results-dir=<path> Path to .testdriver/results directory (required)
|
|
127
|
+
--help, -h Show this help message
|
|
125
128
|
|
|
126
129
|
Description:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
Updates docs/_data/examples-manifest.json with the extracted URLs.
|
|
130
|
+
Reads per-test-case JSON result files from .testdriver/results/examples/
|
|
131
|
+
and updates docs/_data/examples-manifest.json with the extracted URLs.
|
|
131
132
|
Existing entries are updated, new entries are added.
|
|
132
133
|
`);
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
// Main function
|
|
136
|
-
|
|
137
|
+
function main() {
|
|
137
138
|
const options = parseArgs();
|
|
138
139
|
|
|
139
140
|
if (options.help) {
|
|
@@ -141,25 +142,19 @@ async function main() {
|
|
|
141
142
|
process.exit(0);
|
|
142
143
|
}
|
|
143
144
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (options.file) {
|
|
148
|
-
if (!fs.existsSync(options.file)) {
|
|
149
|
-
console.error(`❌ File not found: ${options.file}`);
|
|
150
|
-
process.exit(1);
|
|
151
|
-
}
|
|
152
|
-
inputStream = fs.createReadStream(options.file);
|
|
153
|
-
} else {
|
|
154
|
-
inputStream = process.stdin;
|
|
145
|
+
if (!options.resultsDir) {
|
|
146
|
+
console.error("❌ --results-dir is required. Example: --results-dir=.testdriver/results");
|
|
147
|
+
process.exit(1);
|
|
155
148
|
}
|
|
156
149
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
console.error(`❌
|
|
150
|
+
console.log("🔍 Reading example URLs from JSON result files...\n");
|
|
151
|
+
|
|
152
|
+
if (!fs.existsSync(options.resultsDir)) {
|
|
153
|
+
console.error(`❌ Results directory not found: ${options.resultsDir}`);
|
|
161
154
|
process.exit(1);
|
|
162
155
|
}
|
|
156
|
+
|
|
157
|
+
processResultsDir(options.resultsDir);
|
|
163
158
|
}
|
|
164
159
|
|
|
165
160
|
main();
|