testdriverai 7.8.0 → 7.9.0-test.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.
- package/agent/index.js +12 -0
- package/agent/lib/http.js +21 -3
- package/agent/lib/logger.js +15 -0
- package/agent/lib/provision-commands.js +176 -0
- package/agent/lib/sandbox.js +667 -118
- package/agent/lib/sdk.js +1 -20
- package/ai/skills/testdriver-find/SKILL.md +14 -20
- package/docs/_data/examples-manifest.json +46 -46
- package/docs/_scripts/extract-example-urls.js +67 -72
- package/docs/docs.json +2 -1
- 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 +1 -1
- package/docs/v7/examples/exec-pwsh.mdx +1 -1
- package/docs/v7/examples/focus-window.mdx +1 -1
- 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/test-results-json.mdx +258 -0
- package/examples/scroll-keyboard.test.mjs +1 -1
- package/examples/scroll.test.mjs +1 -12
- package/interfaces/vitest-plugin.mjs +167 -51
- package/lib/core/Dashcam.js +16 -22
- package/lib/environments.json +8 -4
- package/lib/github-comment.mjs +58 -40
- package/lib/init-project.js +5 -67
- package/lib/resolve-channel.js +39 -10
- package/lib/sentry.js +47 -23
- package/lib/vitest/hooks.mjs +117 -20
- 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 +2 -1
- package/sdk.d.ts +4 -0
- package/sdk.js +42 -12
- 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 +7 -3
- package/vitest.runner.config.mjs +33 -0
- package/docs/v7/_drafts/core.mdx +0 -458
package/agent/lib/sdk.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { events } = require("../events");
|
|
2
|
-
const
|
|
2
|
+
const { getSentryTraceHeaders } = require("./http");
|
|
3
3
|
|
|
4
4
|
// get the version from package.json
|
|
5
5
|
const { version } = require("../../package.json");
|
|
@@ -114,25 +114,6 @@ async function withRetry(fn, options = {}) {
|
|
|
114
114
|
throw lastError;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
/**
|
|
118
|
-
* Generate Sentry trace headers for distributed tracing
|
|
119
|
-
* Uses the same trace ID derivation as the API (MD5 hash of session ID)
|
|
120
|
-
* @param {string} sessionId - The session ID
|
|
121
|
-
* @returns {Object} Headers object with sentry-trace and baggage
|
|
122
|
-
*/
|
|
123
|
-
function getSentryTraceHeaders(sessionId) {
|
|
124
|
-
if (!sessionId) return {};
|
|
125
|
-
|
|
126
|
-
// Same logic as API: derive trace ID from session ID
|
|
127
|
-
const traceId = crypto.createHash('md5').update(sessionId).digest('hex');
|
|
128
|
-
const spanId = crypto.randomBytes(8).toString('hex');
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
'sentry-trace': `${traceId}-${spanId}-1`,
|
|
132
|
-
'baggage': `sentry-trace_id=${traceId},sentry-sample_rate=1.0,sentry-sampled=true`
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
117
|
// Factory function that creates SDK with the provided emitter, config, and session
|
|
137
118
|
let token = null;
|
|
138
119
|
const createSDK = (emitter, config, sessionInstance) => {
|
|
@@ -49,8 +49,8 @@ const element = await testdriver.find(description, options)
|
|
|
49
49
|
- `"any"` — No wrapping, uses the description as-is (default behavior)
|
|
50
50
|
</ParamField>
|
|
51
51
|
|
|
52
|
-
<ParamField path="zoom" type="boolean" default={
|
|
53
|
-
|
|
52
|
+
<ParamField path="zoom" type="boolean" default={true}>
|
|
53
|
+
Two-phase zoom mode for better precision in crowded UIs with many similar elements. Enabled by default.
|
|
54
54
|
</ParamField>
|
|
55
55
|
|
|
56
56
|
<ParamField path="ai" type="object">
|
|
@@ -332,14 +332,19 @@ The `timeout` option:
|
|
|
332
332
|
- Returns the element (check `element.found()` if not throwing on failure)
|
|
333
333
|
- Set to `0` to disable polling and make a single attempt
|
|
334
334
|
|
|
335
|
-
## Zoom Mode
|
|
335
|
+
## Zoom Mode
|
|
336
336
|
|
|
337
|
-
|
|
337
|
+
Zoom mode is **enabled by default**. It uses a two-phase approach for better precision when locating elements, especially in crowded UIs with many similar elements.
|
|
338
|
+
|
|
339
|
+
To disable zoom for a specific find call, pass `zoom: false`:
|
|
338
340
|
|
|
339
341
|
```javascript
|
|
340
|
-
//
|
|
341
|
-
const extensionsBtn = await testdriver.find('extensions puzzle icon in Chrome toolbar'
|
|
342
|
+
// Zoom is on by default — no option needed
|
|
343
|
+
const extensionsBtn = await testdriver.find('extensions puzzle icon in Chrome toolbar');
|
|
342
344
|
await extensionsBtn.click();
|
|
345
|
+
|
|
346
|
+
// Disable zoom for a specific call if needed
|
|
347
|
+
const largeButton = await testdriver.find('big hero button', { zoom: false });
|
|
343
348
|
```
|
|
344
349
|
|
|
345
350
|
### How Zoom Mode Works
|
|
@@ -352,22 +357,11 @@ await extensionsBtn.click();
|
|
|
352
357
|
This two-phase approach gives the AI a higher-resolution view of the target area, improving accuracy when multiple similar elements are close together.
|
|
353
358
|
|
|
354
359
|
<Tip>
|
|
355
|
-
|
|
356
|
-
-
|
|
357
|
-
-
|
|
358
|
-
- Targeting elements in dense UI areas
|
|
359
|
-
- The default locate is clicking the wrong similar element
|
|
360
|
-
- You get an AI verification rejection like "The crosshair is located in the empty space of the browser's tab bar/title bar area" — this means the initial locate was imprecise and zoom will help the AI pinpoint the correct element
|
|
360
|
+
You may want to disable zoom with `zoom: false` when:
|
|
361
|
+
- Targeting large, isolated elements where the extra precision isn't needed
|
|
362
|
+
- You want to speed up find calls in simple UIs
|
|
361
363
|
</Tip>
|
|
362
364
|
|
|
363
|
-
```javascript
|
|
364
|
-
// Without zoom - may click wrong icon in toolbar
|
|
365
|
-
const icon = await testdriver.find('settings icon');
|
|
366
|
-
|
|
367
|
-
// With zoom - better precision for crowded areas
|
|
368
|
-
const icon = await testdriver.find('settings icon', { zoom: true });
|
|
369
|
-
```
|
|
370
|
-
|
|
371
365
|
## Cache Options
|
|
372
366
|
|
|
373
367
|
Control caching behavior to optimize performance, especially when using dynamic variables in prompts.
|
|
@@ -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/69c47eafbada9b8191b2daef/69c47ec55d526a093f1e6c99",
|
|
6
|
+
"lastUpdated": "2026-03-26T00:45:20.791Z"
|
|
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/69c47eafbada9b8191b2daef/69c47eb36ebfe4f295e7800a",
|
|
14
|
+
"lastUpdated": "2026-03-26T00:34:06.947Z"
|
|
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/69c47eafbada9b8191b2daef/69c47eb56f887c881af8c66b",
|
|
18
|
+
"lastUpdated": "2026-03-26T00:34:08.349Z"
|
|
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/69c47eafbada9b8191b2daef/69c47eb65d526a093f1e6c89",
|
|
26
|
+
"lastUpdated": "2026-03-26T00:32:54.875Z"
|
|
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/69c47eafbada9b8191b2daef/69c47eba6ebfe4f295e78011",
|
|
30
|
+
"lastUpdated": "2026-03-26T00:34:13.507Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ebc5d526a093f1e6c8d",
|
|
34
|
+
"lastUpdated": "2026-03-26T00:34:14.964Z"
|
|
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/69c47eafbada9b8191b2daef/69c47eb16ebfe4f295e78008",
|
|
38
|
+
"lastUpdated": "2026-03-26T00:33:28.632Z"
|
|
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/69c47eafbada9b8191b2daef/69c47eb85d526a093f1e6c8c",
|
|
42
|
+
"lastUpdated": "2026-03-26T00:38:10.516Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ebebada9b8191b2daf7",
|
|
46
|
+
"lastUpdated": "2026-03-26T00:33:39.385Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ec06f887c881af8c673",
|
|
50
|
+
"lastUpdated": "2026-03-26T00:33:04.023Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ec25d526a093f1e6c92",
|
|
54
|
+
"lastUpdated": "2026-03-26T00:33:43.124Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ec3d5e55524a4d6ca04",
|
|
58
|
+
"lastUpdated": "2026-03-26T00:44:36.564Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ec85d526a093f1e6c9b",
|
|
62
|
+
"lastUpdated": "2026-03-26T00:34:27.000Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ece5d526a093f1e6ca3",
|
|
66
|
+
"lastUpdated": "2026-03-26T00:49:45.385Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ecad5e55524a4d6ca0b",
|
|
70
|
+
"lastUpdated": "2026-03-26T00:33:14.195Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ecb5d526a093f1e6c9e",
|
|
74
|
+
"lastUpdated": "2026-03-26T00:34:30.082Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ecd6ebfe4f295e78023",
|
|
78
|
+
"lastUpdated": "2026-03-26T00:33:17.098Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ed16ebfe4f295e78027",
|
|
86
|
+
"lastUpdated": "2026-03-26T00:34:36.361Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ed06f887c881af8c67f",
|
|
90
|
+
"lastUpdated": "2026-03-26T00:34:34.692Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ed55d526a093f1e6ca5",
|
|
94
|
+
"lastUpdated": "2026-03-26T00:33:25.098Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ed3d5e55524a4d6ca10",
|
|
102
|
+
"lastUpdated": "2026-03-26T00:53:46.478Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ec75d526a093f1e6c9a",
|
|
138
|
+
"lastUpdated": "2026-03-26T00:33:48.000Z"
|
|
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/69c47eafbada9b8191b2daef/69c47ed66ebfe4f295e7802a",
|
|
142
|
+
"lastUpdated": "2026-03-26T00:34:41.328Z"
|
|
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();
|
package/docs/docs.json
CHANGED
package/docs/v7/examples/ai.mdx
CHANGED
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* ai.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c47ed3d5e55524a4d6ca10/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* assert.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c47ec55d526a093f1e6c99/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* captcha-api.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/698f7fb0d3b320ad547d9d44/replay"
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/698f7fb0d3b320ad547d9d44/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* chrome-extension.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c47eb16ebfe4f295e78008/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* drag-and-drop.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/69a62b42fc0ac3cc632a918b/replay"
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69a62b42fc0ac3cc632a918b/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* element-not-found.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c47ed16ebfe4f295e78027/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* exec-output.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c47ebc5d526a093f1e6c8d/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* exec-pwsh.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c47eb36ebfe4f295e7800a/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* focus-window.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c47ecd6ebfe4f295e78023/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* hover-image.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c47ebebada9b8191b2daf7/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* hover-text.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c47ed55d526a093f1e6ca5/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* installer.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c47ec06f887c881af8c673/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* launch-vscode-linux.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c47eb85d526a093f1e6c8c/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* match-image.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c47eb56f887c881af8c66b/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* press-keys.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c47ec3d5e55524a4d6ca04/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|