@testdriverai/agent 7.11.304-test → 7.11.310-test
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 +4 -0
- package/agent/lib/commands.js +22 -3
- package/agent/lib/sandbox.js +83 -4
- package/ai/skills/testdriver-self-hosted/SKILL.md +1 -1
- package/docs/_data/examples-manifest.json +44 -44
- package/docs/examples/add-to-cart.mdx +1 -1
- package/docs/examples/assert.mdx +1 -1
- package/docs/examples/click-button.mdx +1 -1
- package/docs/examples/click-icon.mdx +1 -1
- package/docs/examples/element-not-found.mdx +1 -1
- package/docs/examples/findall-coffee-icons.mdx +1 -1
- package/docs/examples/installer.mdx +1 -1
- package/docs/examples/launch-vscode-linux.mdx +1 -1
- package/docs/examples/navigate-and-scroll.mdx +1 -1
- package/docs/examples/parse.mdx +1 -1
- package/docs/examples/press-keys.mdx +6 -5
- package/docs/examples/scroll.mdx +1 -1
- package/docs/examples/type.mdx +1 -1
- package/docs/options.mdx +10 -3
- package/docs/press-keys.mdx +14 -6
- package/docs/self-hosted.mdx +1 -1
- package/examples/press-keys.test.mjs +7 -5
- package/examples/windows-installer.test.mjs +2 -2
- package/lib/core/Dashcam.js +6 -1
- package/lib/vitest/setup-aws.mjs +5 -0
- package/package.json +1 -1
- package/schema.json +3 -1
- package/sdk.d.ts +12 -4
- package/sdk.js +12 -1
- package/vitest.pool.config.mjs +27 -0
package/agent/index.js
CHANGED
|
@@ -2288,6 +2288,10 @@ Please check your network connection, TD_API_KEY, or the service status.`,
|
|
|
2288
2288
|
if (this.e2bTemplateId) {
|
|
2289
2289
|
sandboxConfig.e2bTemplateId = this.e2bTemplateId;
|
|
2290
2290
|
}
|
|
2291
|
+
// Use one of the team's own runners (runner/index.js) instead of a cloud sandbox
|
|
2292
|
+
if (this.pool) {
|
|
2293
|
+
sandboxConfig.pool = true;
|
|
2294
|
+
}
|
|
2291
2295
|
// Add keepAlive TTL if specified
|
|
2292
2296
|
if (this.keepAlive !== undefined && this.keepAlive !== null) {
|
|
2293
2297
|
sandboxConfig.keepAlive = this.keepAlive;
|
package/agent/lib/commands.js
CHANGED
|
@@ -93,6 +93,24 @@ const extractRedrawOptions = (options = {}) => {
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
// Factory function that creates commands with the provided emitter
|
|
96
|
+
// Cross-platform modifier names: Command and Option on a Mac, Ctrl and Alt
|
|
97
|
+
// everywhere else. Resolved here, where the sandbox OS is known; the runner
|
|
98
|
+
// resolves them too, for callers that send keys to it directly.
|
|
99
|
+
const CROSS_PLATFORM_KEYS = {
|
|
100
|
+
cmdorctrl: { mac: "command", other: "ctrl" },
|
|
101
|
+
commandorcontrol: { mac: "command", other: "ctrl" },
|
|
102
|
+
altoroption: { mac: "option", other: "alt" },
|
|
103
|
+
altoropt: { mac: "option", other: "alt" },
|
|
104
|
+
};
|
|
105
|
+
const resolveKeys = (keys, sandboxOs) => {
|
|
106
|
+
const isMac = sandboxOs === "mac" || sandboxOs === "darwin";
|
|
107
|
+
const resolve = (key) => {
|
|
108
|
+
const entry = typeof key === "string" && CROSS_PLATFORM_KEYS[key.toLowerCase()];
|
|
109
|
+
return entry ? (isMac ? entry.mac : entry.other) : key;
|
|
110
|
+
};
|
|
111
|
+
return Array.isArray(keys) ? keys.map(resolve) : resolve(keys);
|
|
112
|
+
};
|
|
113
|
+
|
|
96
114
|
const createCommands = (
|
|
97
115
|
emitter,
|
|
98
116
|
system,
|
|
@@ -1033,8 +1051,9 @@ const createCommands = (
|
|
|
1033
1051
|
// Log nested action details
|
|
1034
1052
|
const pressKeysActionLogStart = Date.now();
|
|
1035
1053
|
|
|
1036
|
-
// finally, press the keys
|
|
1037
|
-
|
|
1054
|
+
// finally, press the keys ('cmdorctrl' and 'altoroption' become the
|
|
1055
|
+
// sandbox OS's own modifier)
|
|
1056
|
+
await sandbox.send({ type: "press", keys: resolveKeys(keys, sandbox.os) });
|
|
1038
1057
|
|
|
1039
1058
|
// Update the action log with duration
|
|
1040
1059
|
const pressKeysActionEndTime = Date.now();
|
|
@@ -1713,4 +1732,4 @@ const createCommands = (
|
|
|
1713
1732
|
};
|
|
1714
1733
|
|
|
1715
1734
|
// Export the factory function
|
|
1716
|
-
module.exports = { createCommands };
|
|
1735
|
+
module.exports = { createCommands, resolveKeys };
|
package/agent/lib/sandbox.js
CHANGED
|
@@ -6,6 +6,12 @@ const { version } = require("../../package.json");
|
|
|
6
6
|
const { withRetry, getSentryTraceHeaders } = require("./sdk");
|
|
7
7
|
const sentry = require("../../lib/sentry");
|
|
8
8
|
|
|
9
|
+
// How long the runner may be silent (after answering a keepalive at least
|
|
10
|
+
// once) before the session is ended. 0 turns the check off.
|
|
11
|
+
const RUNNER_SILENCE_MS = process.env.TD_RUNNER_SILENCE_MS !== undefined
|
|
12
|
+
? Number(process.env.TD_RUNNER_SILENCE_MS) || 0
|
|
13
|
+
: 120000;
|
|
14
|
+
|
|
9
15
|
// How long (ms) to keep polling for a free concurrency slot before giving up.
|
|
10
16
|
// Configurable via TD_CONCURRENCY_MAX_WAIT (in seconds). Defaults to 60s.
|
|
11
17
|
// A value of 0 (or negative) disables polling entirely — fail on first denial.
|
|
@@ -195,6 +201,7 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
195
201
|
// full stdout can be reconstructed when the final response arrives.
|
|
196
202
|
// (The runner streams stdout in ~16KB chunks and omits it from the
|
|
197
203
|
// final response to stay under Ably's 64KB message limit.)
|
|
204
|
+
self._noteRunnerAlive();
|
|
198
205
|
if (message.type === "exec.output") {
|
|
199
206
|
if (message.requestId) {
|
|
200
207
|
if (!self._execBuffers[message.requestId]) {
|
|
@@ -295,6 +302,7 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
295
302
|
this._onFileMsg = function (msg) {
|
|
296
303
|
var message = msg.data;
|
|
297
304
|
if (!message) return;
|
|
305
|
+
self._noteRunnerAlive();
|
|
298
306
|
logger.debug(`[realtime] Received file: type=${message.type || 'unknown'} (requestId=${message.requestId || 'none'})`);
|
|
299
307
|
if (message.requestId && self.ps[message.requestId]) {
|
|
300
308
|
emitter.emit(events.sandbox.received);
|
|
@@ -305,6 +313,25 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
305
313
|
};
|
|
306
314
|
this._fileSubscription = await this._sessionChannel.subscribe("file", this._onFileMsg);
|
|
307
315
|
|
|
316
|
+
// ─── Is the runner still there? ────────────────────────────────────
|
|
317
|
+
// The runner answers each keepalive below with "keepalive.ack" marked
|
|
318
|
+
// `from: "runner"` (the API answers too, unmarked: it is not the
|
|
319
|
+
// sandbox). Once it has answered one, two minutes with no ack and no
|
|
320
|
+
// other message from it means the sandbox was stopped or lost its
|
|
321
|
+
// connection: end the
|
|
322
|
+
// session, so every later command does not wait out its own timeout
|
|
323
|
+
// (five minutes each) on a machine that is gone.
|
|
324
|
+
this._runnerAckSeen = false;
|
|
325
|
+
this._lastRunnerSignal = Date.now();
|
|
326
|
+
this._runnerGone = null;
|
|
327
|
+
this._onLivenessMsg = function (msg) {
|
|
328
|
+
if (msg.data && msg.data.type === "keepalive.ack" && msg.data.from === "runner") {
|
|
329
|
+
self._runnerAckSeen = true;
|
|
330
|
+
self._noteRunnerAlive();
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
await this._sessionChannel.subscribe("control", this._onLivenessMsg);
|
|
334
|
+
|
|
308
335
|
// Idle keepalive: publish a control message every 30s so the API renews the
|
|
309
336
|
// Redis lease (LEASE_RENEWAL_WINDOW_MS = 2min). Without this, an idle session
|
|
310
337
|
// (no commands) lets the lease lapse and the sandbox is reaped mid-test on
|
|
@@ -314,6 +341,10 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
314
341
|
self._sessionChannel.publish("control", { type: "keepalive" }).catch(function (err) {
|
|
315
342
|
logger.debug("[realtime] keepalive publish failed (non-fatal): " + (err.message || err));
|
|
316
343
|
});
|
|
344
|
+
var silentMs = Date.now() - self._lastRunnerSignal;
|
|
345
|
+
if (RUNNER_SILENCE_MS > 0 && self._runnerAckSeen && !self._runnerGone && silentMs > RUNNER_SILENCE_MS) {
|
|
346
|
+
self._declareRunnerGone(silentMs);
|
|
347
|
+
}
|
|
317
348
|
}, 30000);
|
|
318
349
|
if (this.heartbeat.unref) this.heartbeat.unref();
|
|
319
350
|
|
|
@@ -345,6 +376,8 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
345
376
|
this._ably.connection.on("connected", function () {
|
|
346
377
|
// Log reconnection so the user knows the blip was recovered
|
|
347
378
|
logger.debug("[realtime] Connection: reconnected");
|
|
379
|
+
// Nothing from the runner could arrive while this side was offline.
|
|
380
|
+
self._lastRunnerSignal = Date.now();
|
|
348
381
|
// Extend any pending command timeouts by the disconnection duration so
|
|
349
382
|
// commands whose timer was counting down while the connection was down
|
|
350
383
|
// don't get incorrectly timed out.
|
|
@@ -429,6 +462,42 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
429
462
|
});
|
|
430
463
|
}
|
|
431
464
|
|
|
465
|
+
_noteRunnerAlive() {
|
|
466
|
+
this._lastRunnerSignal = Date.now();
|
|
467
|
+
if (this._runnerGone) {
|
|
468
|
+
logger.warn("[realtime] The sandbox's runner is answering again");
|
|
469
|
+
this._runnerGone = null;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* The runner has gone silent: fail what is waiting on it, and (in
|
|
475
|
+
* _sendAbly) everything sent after, with one error that says so.
|
|
476
|
+
*/
|
|
477
|
+
_declareRunnerGone(silentMs) {
|
|
478
|
+
var seconds = Math.round(silentMs / 1000);
|
|
479
|
+
var error = new Error(
|
|
480
|
+
"The sandbox stopped answering: nothing from its runner for " + seconds +
|
|
481
|
+
"s. It was stopped or lost its connection, so this session is over."
|
|
482
|
+
);
|
|
483
|
+
error.name = "SandboxGoneError";
|
|
484
|
+
error.code = "SANDBOX_GONE";
|
|
485
|
+
this._runnerGone = error;
|
|
486
|
+
logger.error("[realtime] " + error.message);
|
|
487
|
+
var pendingIds = Object.keys(this.ps);
|
|
488
|
+
for (var i = 0; i < pendingIds.length; i++) {
|
|
489
|
+
var entry = this.ps[pendingIds[i]];
|
|
490
|
+
delete this.ps[pendingIds[i]];
|
|
491
|
+
delete this._execBuffers[pendingIds[i]];
|
|
492
|
+
if (entry) entry.reject(error);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/** The error that ended the session if the sandbox is gone, or null. */
|
|
497
|
+
gone() {
|
|
498
|
+
return this._runnerGone || null;
|
|
499
|
+
}
|
|
500
|
+
|
|
432
501
|
/**
|
|
433
502
|
* Recover missed messages after a channel discontinuity.
|
|
434
503
|
* Uses historyBeforeSubscribe() on each subscription, which guarantees
|
|
@@ -525,9 +594,11 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
525
594
|
});
|
|
526
595
|
return response.data;
|
|
527
596
|
} catch (err) {
|
|
528
|
-
// Concurrency limit
|
|
597
|
+
// Concurrency limit, or (pool: true) every runner in the team's
|
|
598
|
+
// pool busy or none connected yet — poll until one frees up
|
|
529
599
|
var responseData = err.response && err.response.data;
|
|
530
|
-
|
|
600
|
+
var waitingForRunner = !!responseData && responseData.errorCode === "RUNNER_UNAVAILABLE";
|
|
601
|
+
if (responseData && (responseData.errorCode === "CONCURRENCY_LIMIT_EXCEEDED" || waitingForRunner)) {
|
|
531
602
|
var elapsed = Date.now() - startTime;
|
|
532
603
|
if (elapsed >= concurrencyMaxWait) {
|
|
533
604
|
var giveUpErr = new Error(
|
|
@@ -539,9 +610,11 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
539
610
|
throw giveUpErr;
|
|
540
611
|
}
|
|
541
612
|
logger.log(
|
|
542
|
-
|
|
613
|
+
(waitingForRunner
|
|
614
|
+
? (responseData.errorMessage || "No runner available") + " — waiting "
|
|
615
|
+
: "Concurrency limit reached — waiting ") +
|
|
543
616
|
concurrencyRetryInterval / 1000 +
|
|
544
|
-
"s for a slot to become available (" +
|
|
617
|
+
(waitingForRunner ? "s for a runner (" : "s for a slot to become available (") +
|
|
545
618
|
Math.round(elapsed / 1000) +
|
|
546
619
|
"s elapsed)...",
|
|
547
620
|
);
|
|
@@ -568,6 +641,9 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
568
641
|
|
|
569
642
|
send(message, timeout) {
|
|
570
643
|
if (timeout === undefined) timeout = 300000;
|
|
644
|
+
|
|
645
|
+
// A sandbox that is gone answers nothing: fail now, not after the timeout.
|
|
646
|
+
if (this._runnerGone) return Promise.reject(this._runnerGone);
|
|
571
647
|
if (message.type === "create" || message.type === "direct") {
|
|
572
648
|
return this._sendHttp(message, timeout);
|
|
573
649
|
}
|
|
@@ -593,6 +669,7 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
593
669
|
if (message.ami) body.ami = message.ami;
|
|
594
670
|
if (message.instanceType) body.instanceType = message.instanceType;
|
|
595
671
|
if (message.e2bTemplateId) body.e2bTemplateId = message.e2bTemplateId;
|
|
672
|
+
if (message.pool) body.pool = true;
|
|
596
673
|
if (message.keepAlive !== undefined) body.keepAlive = message.keepAlive;
|
|
597
674
|
}
|
|
598
675
|
|
|
@@ -805,6 +882,7 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
805
882
|
if (message.ami) provisionBody.ami = message.ami;
|
|
806
883
|
if (message.instanceType) provisionBody.instanceType = message.instanceType;
|
|
807
884
|
if (message.e2bTemplateId) provisionBody.e2bTemplateId = message.e2bTemplateId;
|
|
885
|
+
if (message.pool) provisionBody.pool = true;
|
|
808
886
|
if (message.keepAlive !== undefined) provisionBody.keepAlive = message.keepAlive;
|
|
809
887
|
|
|
810
888
|
reply = await this._httpPostWithConcurrencyRetry(
|
|
@@ -953,6 +1031,7 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
953
1031
|
if (message.ami) pollBody.ami = message.ami;
|
|
954
1032
|
if (message.instanceType) pollBody.instanceType = message.instanceType;
|
|
955
1033
|
if (message.e2bTemplateId) pollBody.e2bTemplateId = message.e2bTemplateId;
|
|
1034
|
+
if (message.pool) pollBody.pool = true;
|
|
956
1035
|
if (message.keepAlive !== undefined) pollBody.keepAlive = message.keepAlive;
|
|
957
1036
|
|
|
958
1037
|
reply = await this._httpPostWithConcurrencyRetry(
|
|
@@ -43,7 +43,7 @@ Self-hosted teams that use their own AI key can't use TestDriver's managed Windo
|
|
|
43
43
|
Self-hosted teams send AI requests through their own Google Gemini key. Add it on the [API keys page](https://console.testdriver.ai/team/api-keys) under **Business API Keys**.
|
|
44
44
|
|
|
45
45
|
<Note>
|
|
46
|
-
|
|
46
|
+
Create a Gemini API key in the Google Cloud console under [APIs & Services > Credentials](https://console.cloud.google.com/apis/credentials), then add it on the API keys page. The key must be [bound to a service account](https://cloud.google.com/docs/authentication/api-keys#create).
|
|
47
47
|
</Note>
|
|
48
48
|
|
|
49
49
|
The same page has optional fields for an OpenRouter key and an E2B key.
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
"$schema": "./examples-manifest.schema.json",
|
|
3
3
|
"examples": {
|
|
4
4
|
"assert.test.mjs": {
|
|
5
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
6
|
-
"lastUpdated": "2026-
|
|
5
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b72411d61b24e1df2bf7",
|
|
6
|
+
"lastUpdated": "2026-12-03T00:26:12.409Z"
|
|
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-test.testdriver.ai/runs/
|
|
14
|
-
"lastUpdated": "2026-
|
|
13
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b71c11d61b24e1df2bed",
|
|
14
|
+
"lastUpdated": "2026-12-03T00:26:14.698Z"
|
|
15
15
|
},
|
|
16
16
|
"match-image.test.mjs": {
|
|
17
17
|
"url": "https://console-test.testdriver.ai/runs/69c8738614b73310c7839412/69c8738c14b73310c783941d",
|
|
@@ -22,58 +22,58 @@
|
|
|
22
22
|
"lastUpdated": "2026-03-03T00:32:25.282Z"
|
|
23
23
|
},
|
|
24
24
|
"windows-installer.test.mjs": {
|
|
25
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
26
|
-
"lastUpdated": "2026-
|
|
25
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b71c11d61b24e1df2bee",
|
|
26
|
+
"lastUpdated": "2026-12-03T00:26:35.298Z"
|
|
27
27
|
},
|
|
28
28
|
"exec-output.test.mjs": {
|
|
29
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
30
|
-
"lastUpdated": "2026-
|
|
29
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b71d16e5de0397290cf1",
|
|
30
|
+
"lastUpdated": "2026-12-03T00:26:26.398Z"
|
|
31
31
|
},
|
|
32
32
|
"chrome-extension.test.mjs": {
|
|
33
33
|
"url": "https://console-test.testdriver.ai/runs/6a87988fb7cddebeab9bfbea/6a8798913062df0fb9b85592",
|
|
34
34
|
"lastUpdated": "2026-08-21T00:15:47.131Z"
|
|
35
35
|
},
|
|
36
36
|
"launch-vscode-linux.test.mjs": {
|
|
37
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
38
|
-
"lastUpdated": "2026-
|
|
37
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b72511d61b24e1df2bf8",
|
|
38
|
+
"lastUpdated": "2026-12-03T00:26:32.709Z"
|
|
39
39
|
},
|
|
40
40
|
"installer.test.mjs": {
|
|
41
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
42
|
-
"lastUpdated": "2026-
|
|
41
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b71c16e5de0397290cf0",
|
|
42
|
+
"lastUpdated": "2026-12-03T00:26:04.443Z"
|
|
43
43
|
},
|
|
44
44
|
"type.test.mjs": {
|
|
45
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
46
|
-
"lastUpdated": "2026-
|
|
45
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b71f11d61b24e1df2bf2",
|
|
46
|
+
"lastUpdated": "2026-12-03T00:26:27.542Z"
|
|
47
47
|
},
|
|
48
48
|
"press-keys.test.mjs": {
|
|
49
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
50
|
-
"replayUrl": "https://console-test.testdriver.ai/replay/
|
|
51
|
-
"embedUrl": "https://console-test.testdriver.ai/replay/
|
|
52
|
-
"lastUpdated": "2026-
|
|
49
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b71e16e5de0397290cf2",
|
|
50
|
+
"replayUrl": "https://console-test.testdriver.ai/replay/6b10b77711d61b24e1df2c07?share=P7Tf0BimBj92KtoA821Tw",
|
|
51
|
+
"embedUrl": "https://console-test.testdriver.ai/replay/6b10b77711d61b24e1df2c07?share=P7Tf0BimBj92KtoA821Tw&embed=true",
|
|
52
|
+
"lastUpdated": "2026-12-03T00:27:40.784Z"
|
|
53
53
|
},
|
|
54
54
|
"scroll.test.mjs": {
|
|
55
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
56
|
-
"lastUpdated": "2026-
|
|
55
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b72311d61b24e1df2bf4",
|
|
56
|
+
"lastUpdated": "2026-12-03T00:26:20.794Z"
|
|
57
57
|
},
|
|
58
58
|
"scroll-until-image.test.mjs": {
|
|
59
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
60
|
-
"lastUpdated": "2026-
|
|
59
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b72116e5de0397290cf5",
|
|
60
|
+
"lastUpdated": "2026-12-03T00:26:09.315Z"
|
|
61
61
|
},
|
|
62
62
|
"prompt.test.mjs": {
|
|
63
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
64
|
-
"lastUpdated": "2026-
|
|
63
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b72116e5de0397290cf7",
|
|
64
|
+
"lastUpdated": "2026-12-03T00:26:30.043Z"
|
|
65
65
|
},
|
|
66
66
|
"focus-window.test.mjs": {
|
|
67
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
68
|
-
"lastUpdated": "2026-
|
|
67
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b72211d61b24e1df2bf3",
|
|
68
|
+
"lastUpdated": "2026-12-03T00:26:30.768Z"
|
|
69
69
|
},
|
|
70
70
|
"captcha-api.test.mjs": {
|
|
71
71
|
"url": "https://console.testdriver.ai/runs/698f7df69e27ce1528d7d087/698f7fb0d3b320ad547d9d44",
|
|
72
72
|
"lastUpdated": "2026-02-13T19:55:05.951Z"
|
|
73
73
|
},
|
|
74
74
|
"element-not-found.test.mjs": {
|
|
75
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
76
|
-
"lastUpdated": "2026-
|
|
75
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b72311d61b24e1df2bf6",
|
|
76
|
+
"lastUpdated": "2026-12-03T00:26:22.099Z"
|
|
77
77
|
},
|
|
78
78
|
"formatted-logging.test.mjs": {
|
|
79
79
|
"url": "https://console-test.testdriver.ai/runs/69c8738614b73310c7839412/69c873a714b73310c7839450",
|
|
@@ -122,12 +122,12 @@
|
|
|
122
122
|
"lastUpdated": "2026-02-13T19:55:05.953Z"
|
|
123
123
|
},
|
|
124
124
|
"findall-coffee-icons.test.mjs": {
|
|
125
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
126
|
-
"lastUpdated": "2026-
|
|
125
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b72116e5de0397290cf6",
|
|
126
|
+
"lastUpdated": "2026-12-03T00:26:08.985Z"
|
|
127
127
|
},
|
|
128
128
|
"parse.test.mjs": {
|
|
129
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
130
|
-
"lastUpdated": "2026-
|
|
129
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b72511d61b24e1df2bf9",
|
|
130
|
+
"lastUpdated": "2026-12-03T00:26:23.671Z"
|
|
131
131
|
},
|
|
132
132
|
"flake-diffthreshold-001.test.mjs": {
|
|
133
133
|
"url": "https://console.testdriver.ai/runs/69a62b3aaa712ecd3dea730a/69a62bcafc0ac3cc632a91aa",
|
|
@@ -166,24 +166,24 @@
|
|
|
166
166
|
"lastUpdated": "2026-03-30T00:35:14.437Z"
|
|
167
167
|
},
|
|
168
168
|
"click-icon.test.mjs": {
|
|
169
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
170
|
-
"replayUrl": "https://console-test.testdriver.ai/replay/
|
|
171
|
-
"embedUrl": "https://console-test.testdriver.ai/replay/
|
|
172
|
-
"lastUpdated": "2026-
|
|
169
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b71f11d61b24e1df2bf1",
|
|
170
|
+
"replayUrl": "https://console-test.testdriver.ai/replay/6b10b7d111d61b24e1df2c25?share=hMbkuHQlzyu1TZ25kphdw",
|
|
171
|
+
"embedUrl": "https://console-test.testdriver.ai/replay/6b10b7d111d61b24e1df2c25?share=hMbkuHQlzyu1TZ25kphdw&embed=true",
|
|
172
|
+
"lastUpdated": "2026-12-03T00:29:11.028Z"
|
|
173
173
|
},
|
|
174
174
|
"click-button.test.mjs": {
|
|
175
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
176
|
-
"lastUpdated": "2026-
|
|
175
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b72311d61b24e1df2bf5",
|
|
176
|
+
"lastUpdated": "2026-12-03T00:26:31.112Z"
|
|
177
177
|
},
|
|
178
178
|
"add-to-cart.test.mjs": {
|
|
179
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
180
|
-
"lastUpdated": "2026-
|
|
179
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b71d11d61b24e1df2bf0",
|
|
180
|
+
"lastUpdated": "2026-12-03T00:26:05.490Z"
|
|
181
181
|
},
|
|
182
182
|
"navigate-and-scroll.test.mjs": {
|
|
183
|
-
"url": "https://console-test.testdriver.ai/runs/
|
|
184
|
-
"replayUrl": "https://console-test.testdriver.ai/replay/
|
|
185
|
-
"embedUrl": "https://console-test.testdriver.ai/replay/
|
|
186
|
-
"lastUpdated": "2026-
|
|
183
|
+
"url": "https://console-test.testdriver.ai/runs/6b10b71a16e5de0397290ced/6b10b72016e5de0397290cf4",
|
|
184
|
+
"replayUrl": "https://console-test.testdriver.ai/replay/6b10b81611d61b24e1df2c34?share=yVsZoLdfjspAe1NL2ssi7w",
|
|
185
|
+
"embedUrl": "https://console-test.testdriver.ai/replay/6b10b81611d61b24e1df2c34?share=yVsZoLdfjspAe1NL2ssi7w&embed=true",
|
|
186
|
+
"lastUpdated": "2026-12-03T00:30:20.849Z"
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
}
|
|
@@ -12,7 +12,7 @@ This test logs in to a demo store, adds a product to the cart, and asserts that
|
|
|
12
12
|
|
|
13
13
|
{/* add-to-cart.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/6b10b71d11d61b24e1df2bf0/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="600"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
package/docs/examples/assert.mdx
CHANGED
|
@@ -12,7 +12,7 @@ This test opens a login page in Chrome, saves a screenshot, and asserts that the
|
|
|
12
12
|
|
|
13
13
|
{/* assert.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/6b10b72411d61b24e1df2bf7/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ This test clicks **Sign In** on an empty login form and asserts that a "fields r
|
|
|
12
12
|
|
|
13
13
|
{/* click-button.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/6b10b72311d61b24e1df2bf5/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ This test logs in to a demo store, clicks the shopping cart icon, and asserts th
|
|
|
12
12
|
|
|
13
13
|
{/* click-icon.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://console-test.testdriver.ai/replay/
|
|
15
|
+
src="https://console-test.testdriver.ai/replay/6b10b7d111d61b24e1df2c25?share=hMbkuHQlzyu1TZ25kphdw&embed=true"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ This test looks for an element that isn't on the page. Use this pattern when an
|
|
|
12
12
|
|
|
13
13
|
{/* element-not-found.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/6b10b72311d61b24e1df2bf6/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ This test uses `findAll()` to find every coffee cup in an icon grid, clicks each
|
|
|
12
12
|
|
|
13
13
|
{/* findall-coffee-icons.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/6b10b72116e5de0397290cf6/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="600"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -16,7 +16,7 @@ This file has three `provision.installer()` tests in a Linux sandbox:
|
|
|
16
16
|
|
|
17
17
|
{/* installer.test.mjs output */}
|
|
18
18
|
<iframe
|
|
19
|
-
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/
|
|
19
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/6b10b71c16e5de0397290cf0/replay"
|
|
20
20
|
width="100%"
|
|
21
21
|
height="390"
|
|
22
22
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ This test launches VS Code with `provision.vscode()` and waits for its window to
|
|
|
12
12
|
|
|
13
13
|
{/* launch-vscode-linux.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/6b10b72511d61b24e1df2bf8/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ This test types a URL into Chrome's address bar, scrolls down, and asserts that
|
|
|
12
12
|
|
|
13
13
|
{/* navigate-and-scroll.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://console-test.testdriver.ai/replay/
|
|
15
|
+
src="https://console-test.testdriver.ai/replay/6b10b81611d61b24e1df2c34?share=yVsZoLdfjspAe1NL2ssi7w&embed=true"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
package/docs/examples/parse.mdx
CHANGED
|
@@ -12,7 +12,7 @@ This test opens Airbnb in Chrome and calls `parse()` to detect every UI element
|
|
|
12
12
|
|
|
13
13
|
{/* parse.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/6b10b72511d61b24e1df2bf9/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="600"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -12,7 +12,7 @@ This test drives Chrome with keyboard shortcuts to open tabs and DevTools, then
|
|
|
12
12
|
|
|
13
13
|
{/* press-keys.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://console-test.testdriver.ai/replay/
|
|
15
|
+
src="https://console-test.testdriver.ai/replay/6b10b77711d61b24e1df2c07?share=P7Tf0BimBj92KtoA821Tw&embed=true"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -36,22 +36,23 @@ describe("Press Keys Test", () => {
|
|
|
36
36
|
await signInButton.click();
|
|
37
37
|
|
|
38
38
|
// Open new tab
|
|
39
|
-
await testdriver.pressKeys(["
|
|
39
|
+
await testdriver.pressKeys(["cmdorctrl", "t"]);
|
|
40
40
|
|
|
41
41
|
// Wait for the new tab page to load
|
|
42
42
|
let imagesLink = await testdriver.find("Images", {timeout: 5000});
|
|
43
43
|
|
|
44
44
|
expect(imagesLink.found()).toBeTruthy();
|
|
45
45
|
|
|
46
|
-
// Open DevTools
|
|
47
|
-
|
|
46
|
+
// Open DevTools: Chrome uses Cmd+Option+I on a Mac, Ctrl+Shift+I elsewhere
|
|
47
|
+
const isMac = (process.env.TD_OS || "linux") === "mac";
|
|
48
|
+
await testdriver.pressKeys(isMac ? ["cmdorctrl", "altoroption", "i"] : ["ctrl", "shift", "i"]);
|
|
48
49
|
|
|
49
50
|
// Wait for the DevTools Elements panel
|
|
50
51
|
let elements = await testdriver.find("Elements", {timeout: 5000});
|
|
51
52
|
expect(elements.found()).toBeTruthy();
|
|
52
53
|
|
|
53
54
|
// Open another tab and navigate
|
|
54
|
-
await testdriver.pressKeys(["
|
|
55
|
+
await testdriver.pressKeys(["cmdorctrl", "t"]);
|
|
55
56
|
await testdriver.type("google.com");
|
|
56
57
|
await testdriver.pressKeys(["enter"]);
|
|
57
58
|
|
package/docs/examples/scroll.mdx
CHANGED
|
@@ -12,7 +12,7 @@ This test opens a page, scrolls down, and asserts that the page heading is no lo
|
|
|
12
12
|
|
|
13
13
|
{/* scroll.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/6b10b72311d61b24e1df2bf4/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
package/docs/examples/type.mdx
CHANGED
|
@@ -12,7 +12,7 @@ This file has two login form tests. One types a username and checks the field. T
|
|
|
12
12
|
|
|
13
13
|
{/* type.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/
|
|
15
|
+
src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/6b10b71f11d61b24e1df2bf2/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
package/docs/options.mdx
CHANGED
|
@@ -47,8 +47,8 @@ Options you pass to [`connect()`](/client#connect-options) override the client's
|
|
|
47
47
|
|
|
48
48
|
These options control the virtual machine that runs your test.
|
|
49
49
|
|
|
50
|
-
<ParamField path="os" type="'linux' | 'windows'" default="linux">
|
|
51
|
-
The operating system of the sandbox. You can also set this with the `TD_OS` environment variable.
|
|
50
|
+
<ParamField path="os" type="'linux' | 'windows' | 'mac'" default="linux">
|
|
51
|
+
The operating system of the sandbox. You can also set this with the `TD_OS` environment variable. `'mac'` runs only on your own runners ([`pool`](#param-pool)).
|
|
52
52
|
|
|
53
53
|
<EnterpriseBadge /> `'windows'` is available on Enterprise plans.
|
|
54
54
|
</ParamField>
|
|
@@ -306,6 +306,12 @@ Most projects don't need these. They're for self-hosted or custom deployments.
|
|
|
306
306
|
<EnterpriseBadge /> Connecting to your own machines is available on Enterprise plans.
|
|
307
307
|
</ParamField>
|
|
308
308
|
|
|
309
|
+
<ParamField path="pool" type="boolean" default="false">
|
|
310
|
+
Run on one of your team's own runners instead of a cloud sandbox. A runner is a machine running `npx @testdriverai/runner` with your API key (`TD_API_KEY`); it waits in your team's pool until a test claims it. The test waits for a free runner of its `os`. You can also set this with `TD_POOL=true`.
|
|
311
|
+
|
|
312
|
+
To run Linux, macOS and Windows runners on a Mac for development, see `deploy/local` in the TestDriver repository.
|
|
313
|
+
</ParamField>
|
|
314
|
+
|
|
309
315
|
<ParamField path="sandboxAmi" type="string">
|
|
310
316
|
A custom AMI id for the sandbox instance (AWS deployments). Example: `'ami-1234'`.
|
|
311
317
|
</ParamField>
|
|
@@ -322,7 +328,7 @@ Most projects don't need these. They're for self-hosted or custom deployments.
|
|
|
322
328
|
|
|
323
329
|
| Option | Type | Default |
|
|
324
330
|
|---|---|---|
|
|
325
|
-
| `os` | `'linux' \| 'windows'` | `'linux'` |
|
|
331
|
+
| `os` | `'linux' \| 'windows' \| 'mac'` | `'linux'` |
|
|
326
332
|
| `resolution` | `string` | `'1366x768'` |
|
|
327
333
|
| `newSandbox` | `boolean` | `true` |
|
|
328
334
|
| `reconnect` | `boolean` | `false` |
|
|
@@ -342,6 +348,7 @@ Most projects don't need these. They're for self-hosted or custom deployments.
|
|
|
342
348
|
| `redraw` | `boolean \| object` | `false` |
|
|
343
349
|
| `apiRoot` | `string` | channel default |
|
|
344
350
|
| `ip` | `string` | — |
|
|
351
|
+
| `pool` | `boolean` | `false` |
|
|
345
352
|
| `sandboxAmi` | `string` | — |
|
|
346
353
|
| `sandboxInstance` | `string` | — |
|
|
347
354
|
| `e2bTemplateId` | `string` | — |
|
package/docs/press-keys.mdx
CHANGED
|
@@ -39,14 +39,22 @@ Key names are lowercase. The most common ones:
|
|
|
39
39
|
| Letters, digits, symbols | `'a'`–`'z'`, `'0'`–`'9'`, and single characters like `'/'` or `'.'` |
|
|
40
40
|
| Editing | `'enter'`, `'tab'`, `'space'`, `'backspace'`, `'delete'`, `'escape'` |
|
|
41
41
|
| Navigation | `'up'`, `'down'`, `'left'`, `'right'`, `'home'`, `'end'`, `'pageup'`, `'pagedown'` |
|
|
42
|
-
| Modifiers | `'ctrl'`, `'shift'`, `'alt'`, `'win'`, and left/right forms like `'ctrlleft'` |
|
|
42
|
+
| Modifiers | `'ctrl'`, `'shift'`, `'alt'`, `'win'`, `'command'`, `'option'`, and left/right forms like `'ctrlleft'` |
|
|
43
|
+
| Cross-platform modifiers | `'cmdorctrl'` (Command on a Mac, Ctrl elsewhere), `'altoroption'` (Option on a Mac, Alt elsewhere) |
|
|
43
44
|
| Function keys | `'f1'`–`'f24'` |
|
|
44
45
|
|
|
45
46
|
The full list is the `KeyboardKey` type in `sdk.d.ts`, which your editor autocompletes.
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
## Shortcuts on every OS
|
|
49
|
+
|
|
50
|
+
A Mac uses Command where Linux and Windows use Ctrl. Write `'cmdorctrl'` and TestDriver presses the right one for the sandbox, so one test runs on all of them:
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
await testdriver.pressKeys(['cmdorctrl', 'a']); // Cmd+A on a Mac, Ctrl+A elsewhere
|
|
54
|
+
await testdriver.pressKeys(['cmdorctrl', 't']); // new tab in Chrome
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`'altoroption'` works the same way for Alt and Option. Some apps use different shortcuts on a Mac altogether; Chrome opens DevTools with Cmd+Option+I there and Ctrl+Shift+I elsewhere, for example. Check `process.env.TD_OS` for those.
|
|
50
58
|
|
|
51
59
|
## Examples
|
|
52
60
|
|
|
@@ -64,14 +72,14 @@ await testdriver.pressKeys(['enter']);
|
|
|
64
72
|
|
|
65
73
|
```javascript
|
|
66
74
|
await testdriver.find('Search input').click();
|
|
67
|
-
await testdriver.pressKeys(['
|
|
75
|
+
await testdriver.pressKeys(['cmdorctrl', 'a']);
|
|
68
76
|
await testdriver.type('wireless headphones');
|
|
69
77
|
```
|
|
70
78
|
|
|
71
79
|
### Go to a URL in Chrome
|
|
72
80
|
|
|
73
81
|
```javascript
|
|
74
|
-
await testdriver.pressKeys(['
|
|
82
|
+
await testdriver.pressKeys(['cmdorctrl', 'l']);
|
|
75
83
|
await testdriver.type('https://testdriver-sandbox.vercel.app/login');
|
|
76
84
|
await testdriver.pressKeys(['enter']);
|
|
77
85
|
```
|
package/docs/self-hosted.mdx
CHANGED
|
@@ -44,7 +44,7 @@ Self-hosted teams that use their own AI key can't use TestDriver's managed Windo
|
|
|
44
44
|
Self-hosted teams send AI requests through their own Google Gemini key. Add it on the [API keys page](https://console.testdriver.ai/team/api-keys) under **Business API Keys**.
|
|
45
45
|
|
|
46
46
|
<Note>
|
|
47
|
-
|
|
47
|
+
Create a Gemini API key in the Google Cloud console under [APIs & Services > Credentials](https://console.cloud.google.com/apis/credentials), then add it on the API keys page. The key must be [bound to a service account](https://cloud.google.com/docs/authentication/api-keys#create).
|
|
48
48
|
</Note>
|
|
49
49
|
|
|
50
50
|
The same page has optional fields for an OpenRouter key and an E2B key.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Uses keyboard shortcuts to open a new tab, open DevTools, and navigate
|
|
3
|
-
* to a URL.
|
|
3
|
+
* to a URL. 'cmdorctrl' and 'altoroption' are Command and Option on a Mac
|
|
4
|
+
* sandbox and Ctrl and Alt elsewhere, so the same test runs on every OS.
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
import { describe, expect, it } from "vitest";
|
|
@@ -18,22 +19,23 @@ describe("Press Keys Test", () => {
|
|
|
18
19
|
await signInButton.click();
|
|
19
20
|
|
|
20
21
|
// Open new tab
|
|
21
|
-
await testdriver.pressKeys(["
|
|
22
|
+
await testdriver.pressKeys(["cmdorctrl", "t"]);
|
|
22
23
|
|
|
23
24
|
// Wait for the new tab page to load
|
|
24
25
|
let imagesLink = await testdriver.find("Images", {timeout: 5000});
|
|
25
26
|
|
|
26
27
|
expect(imagesLink.found()).toBeTruthy();
|
|
27
28
|
|
|
28
|
-
// Open DevTools
|
|
29
|
-
|
|
29
|
+
// Open DevTools: Chrome uses Cmd+Option+I on a Mac, Ctrl+Shift+I elsewhere
|
|
30
|
+
const isMac = (process.env.TD_OS || "linux") === "mac";
|
|
31
|
+
await testdriver.pressKeys(isMac ? ["cmdorctrl", "altoroption", "i"] : ["ctrl", "shift", "i"]);
|
|
30
32
|
|
|
31
33
|
// Wait for the DevTools Elements panel
|
|
32
34
|
let elements = await testdriver.find("Elements", {timeout: 5000});
|
|
33
35
|
expect(elements.found()).toBeTruthy();
|
|
34
36
|
|
|
35
37
|
// Open another tab and navigate
|
|
36
|
-
await testdriver.pressKeys(["
|
|
38
|
+
await testdriver.pressKeys(["cmdorctrl", "t"]);
|
|
37
39
|
await testdriver.type("google.com");
|
|
38
40
|
await testdriver.pressKeys(["enter"]);
|
|
39
41
|
|
|
@@ -13,11 +13,11 @@ import { describe, it } from "vitest";
|
|
|
13
13
|
import { TestDriver } from "../lib/vitest/hooks.mjs";
|
|
14
14
|
import { getDefaults } from "./config.mjs";
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const isWindows = (process.env.TD_OS || "linux") === "windows";
|
|
17
17
|
|
|
18
18
|
describe("Windows App Installation", () => {
|
|
19
19
|
|
|
20
|
-
it.skipIf(
|
|
20
|
+
it.skipIf(!isWindows)("should download, install, and launch GitButler on Windows", async (context) => {
|
|
21
21
|
// Alternative approach using provision.installer helper
|
|
22
22
|
const testdriver = TestDriver(context, {
|
|
23
23
|
...getDefaults(context),
|
package/lib/core/Dashcam.js
CHANGED
|
@@ -92,7 +92,9 @@ class Dashcam {
|
|
|
92
92
|
* @returns {string} The corresponding console URL
|
|
93
93
|
*/
|
|
94
94
|
static getConsoleUrl(apiRoot = (() => { const c = require("../../lib/resolve-channel.js"); return c.channels[c.active]; })()) {
|
|
95
|
-
// Allow explicit override via env
|
|
95
|
+
// Allow explicit override via env. TD_CONSOLE_URL is the documented one
|
|
96
|
+
// (required for private deployments); VITE_DOMAIN is the dev .env value.
|
|
97
|
+
if (process.env.TD_CONSOLE_URL) return process.env.TD_CONSOLE_URL;
|
|
96
98
|
if (process.env.VITE_DOMAIN) return process.env.VITE_DOMAIN;
|
|
97
99
|
|
|
98
100
|
if (!apiRoot) return "https://console.testdriver.ai";
|
|
@@ -144,6 +146,9 @@ class Dashcam {
|
|
|
144
146
|
|
|
145
147
|
if (this.client.os === "windows") {
|
|
146
148
|
return "C:\\Program Files\\nodejs\\dashcam.cmd";
|
|
149
|
+
} else if (this.client.os === "mac" || this.client.os === "darwin") {
|
|
150
|
+
// /usr/bin is read-only on macOS.
|
|
151
|
+
return "/usr/local/bin/dashcam";
|
|
147
152
|
} else {
|
|
148
153
|
return "/usr/bin/dashcam";
|
|
149
154
|
}
|
package/lib/vitest/setup-aws.mjs
CHANGED
|
@@ -133,6 +133,11 @@ beforeEach(async (context) => {
|
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
// Sessions run on the team's own runners (TD_POOL=true), not a spawned VM
|
|
137
|
+
if (process.env.TD_POOL === "true") {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
136
141
|
// If TD_IP is already set, use it and skip spawning
|
|
137
142
|
if (process.env.TD_IP) {
|
|
138
143
|
console.log(`[TestDriver] Using existing instance at ${process.env.TD_IP}`);
|
package/package.json
CHANGED
package/schema.json
CHANGED
package/sdk.d.ts
CHANGED
|
@@ -215,7 +215,11 @@ export type KeyboardKey =
|
|
|
215
215
|
| "command"
|
|
216
216
|
| "option"
|
|
217
217
|
| "optionleft"
|
|
218
|
-
| "optionright"
|
|
218
|
+
| "optionright"
|
|
219
|
+
/** Command on a Mac sandbox, Ctrl on Linux and Windows. */
|
|
220
|
+
| "cmdorctrl"
|
|
221
|
+
/** Option on a Mac sandbox, Alt on Linux and Windows. */
|
|
222
|
+
| "altoroption";
|
|
219
223
|
|
|
220
224
|
export interface TestDriverOptions {
|
|
221
225
|
/** API endpoint URL (default depends on release channel: latest → 'https://api.testdriver.ai') */
|
|
@@ -223,7 +227,7 @@ export interface TestDriverOptions {
|
|
|
223
227
|
/** Sandbox resolution (default: '1366x768') */
|
|
224
228
|
resolution?: string;
|
|
225
229
|
/** Operating system for the sandbox (default: 'linux') */
|
|
226
|
-
os?: "windows" | "linux";
|
|
230
|
+
os?: "windows" | "linux" | "mac";
|
|
227
231
|
/** Enable analytics tracking (default: true) */
|
|
228
232
|
analytics?: boolean;
|
|
229
233
|
/** Enable console logging output (default: true) */
|
|
@@ -275,6 +279,8 @@ export interface TestDriverOptions {
|
|
|
275
279
|
sandboxInstance?: string;
|
|
276
280
|
/** E2B template ID to use when creating the sandbox (e.g., 'my-template-id') */
|
|
277
281
|
e2bTemplateId?: string;
|
|
282
|
+
/** Run on one of your team's own runners (`npx @testdriverai/runner` with TD_API_KEY set, e.g. local VMs) instead of a cloud sandbox. Waits for a free runner of the requested `os`. Default: `TD_POOL=true` */
|
|
283
|
+
pool?: boolean;
|
|
278
284
|
/** Cache key for element finding operations. If provided, enables caching tied to this key */
|
|
279
285
|
cacheKey?: string;
|
|
280
286
|
/** Reconnect to the last used sandbox instead of creating a new one. When true, provision methods (chrome, vscode, installer, etc.) will be skipped since the application is already running. Looks up the sandbox id from `.testdriver/last-sandbox` if `sandboxId` is not also provided. */
|
|
@@ -345,8 +351,10 @@ export interface ConnectOptions {
|
|
|
345
351
|
sandboxInstance?: string;
|
|
346
352
|
/** E2B template ID to use when creating the sandbox (e.g., 'my-template-id') */
|
|
347
353
|
e2bTemplateId?: string;
|
|
354
|
+
/** Run on one of your team's own runners (`npx @testdriverai/runner` with TD_API_KEY set, e.g. local VMs) instead of a cloud sandbox. Waits for a free runner of the requested `os`. Default: `TD_POOL=true` */
|
|
355
|
+
pool?: boolean;
|
|
348
356
|
/** Operating system for the sandbox (default: 'linux') */
|
|
349
|
-
os?: "windows" | "linux";
|
|
357
|
+
os?: "windows" | "linux" | "mac";
|
|
350
358
|
/**
|
|
351
359
|
* Preview mode for live test visualization (default: "browser")
|
|
352
360
|
* - "browser": Opens debugger in default browser
|
|
@@ -1062,7 +1070,7 @@ export default class TestDriverSDK {
|
|
|
1062
1070
|
*/
|
|
1063
1071
|
getLastSandboxId(): {
|
|
1064
1072
|
sandboxId: string;
|
|
1065
|
-
os?: "windows" | "linux";
|
|
1073
|
+
os?: "windows" | "linux" | "mac";
|
|
1066
1074
|
e2bTemplateId?: string | null;
|
|
1067
1075
|
createdAt?: number;
|
|
1068
1076
|
} | null;
|
package/sdk.js
CHANGED
|
@@ -1447,7 +1447,7 @@ function normalizeRedrawOptions(opts) {
|
|
|
1447
1447
|
* @typedef {'keyboard' | 'mouse'} ScrollMethod
|
|
1448
1448
|
* @typedef {'ai' | 'turbo'} TextMatchMethod
|
|
1449
1449
|
* @typedef {'sh' | 'pwsh'} ExecLanguage
|
|
1450
|
-
* @typedef {'\\t' | '\n' | '\r' | ' ' | '!' | '"' | '#' | '$' | '%' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | '{' | '|' | '}' | '~' | 'accept' | 'add' | 'alt' | 'altleft' | 'altright' | 'apps' | 'backspace' | 'browserback' | 'browserfavorites' | 'browserforward' | 'browserhome' | 'browserrefresh' | 'browsersearch' | 'browserstop' | 'capslock' | 'clear' | 'convert' | 'ctrl' | 'ctrlleft' | 'ctrlright' | 'decimal' | 'del' | 'delete' | 'divide' | 'down' | 'end' | 'enter' | 'esc' | 'escape' | 'execute' | 'f1' | 'f10' | 'f11' | 'f12' | 'f13' | 'f14' | 'f15' | 'f16' | 'f17' | 'f18' | 'f19' | 'f2' | 'f20' | 'f21' | 'f22' | 'f23' | 'f24' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'final' | 'fn' | 'hanguel' | 'hangul' | 'hanja' | 'help' | 'home' | 'insert' | 'junja' | 'kana' | 'kanji' | 'launchapp1' | 'launchapp2' | 'launchmail' | 'launchmediaselect' | 'left' | 'modechange' | 'multiply' | 'nexttrack' | 'nonconvert' | 'num0' | 'num1' | 'num2' | 'num3' | 'num4' | 'num5' | 'num6' | 'num7' | 'num8' | 'num9' | 'numlock' | 'pagedown' | 'pageup' | 'pause' | 'pgdn' | 'pgup' | 'playpause' | 'prevtrack' | 'print' | 'printscreen' | 'prntscrn' | 'prtsc' | 'prtscr' | 'return' | 'right' | 'scrolllock' | 'select' | 'separator' | 'shift' | 'shiftleft' | 'shiftright' | 'sleep' | 'space' | 'stop' | 'subtract' | 'tab' | 'up' | 'volumedown' | 'volumemute' | 'volumeup' | 'win' | 'winleft' | 'winright' | 'yen' | 'command' | 'option' | 'optionleft' | 'optionright'} KeyboardKey
|
|
1450
|
+
* @typedef {'\\t' | '\n' | '\r' | ' ' | '!' | '"' | '#' | '$' | '%' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | '{' | '|' | '}' | '~' | 'accept' | 'add' | 'alt' | 'altleft' | 'altright' | 'apps' | 'backspace' | 'browserback' | 'browserfavorites' | 'browserforward' | 'browserhome' | 'browserrefresh' | 'browsersearch' | 'browserstop' | 'capslock' | 'clear' | 'convert' | 'ctrl' | 'ctrlleft' | 'ctrlright' | 'decimal' | 'del' | 'delete' | 'divide' | 'down' | 'end' | 'enter' | 'esc' | 'escape' | 'execute' | 'f1' | 'f10' | 'f11' | 'f12' | 'f13' | 'f14' | 'f15' | 'f16' | 'f17' | 'f18' | 'f19' | 'f2' | 'f20' | 'f21' | 'f22' | 'f23' | 'f24' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'final' | 'fn' | 'hanguel' | 'hangul' | 'hanja' | 'help' | 'home' | 'insert' | 'junja' | 'kana' | 'kanji' | 'launchapp1' | 'launchapp2' | 'launchmail' | 'launchmediaselect' | 'left' | 'modechange' | 'multiply' | 'nexttrack' | 'nonconvert' | 'num0' | 'num1' | 'num2' | 'num3' | 'num4' | 'num5' | 'num6' | 'num7' | 'num8' | 'num9' | 'numlock' | 'pagedown' | 'pageup' | 'pause' | 'pgdn' | 'pgup' | 'playpause' | 'prevtrack' | 'print' | 'printscreen' | 'prntscrn' | 'prtsc' | 'prtscr' | 'return' | 'right' | 'scrolllock' | 'select' | 'separator' | 'shift' | 'shiftleft' | 'shiftright' | 'sleep' | 'space' | 'stop' | 'subtract' | 'tab' | 'up' | 'volumedown' | 'volumemute' | 'volumeup' | 'win' | 'winleft' | 'winright' | 'yen' | 'command' | 'option' | 'optionleft' | 'optionright' | 'cmdorctrl' | 'altoroption'} KeyboardKey
|
|
1451
1451
|
*/
|
|
1452
1452
|
|
|
1453
1453
|
const TestDriverAgent = require("./agent/index.js");
|
|
@@ -1544,6 +1544,11 @@ class TestDriverSDK {
|
|
|
1544
1544
|
this.sandboxInstance = options.sandboxInstance || null;
|
|
1545
1545
|
this.e2bTemplateId = options.e2bTemplateId || null;
|
|
1546
1546
|
|
|
1547
|
+
// Claim one of the team's own runners (runner/index.js, e.g. local VMs)
|
|
1548
|
+
// instead of creating a cloud sandbox. Waits for a free one.
|
|
1549
|
+
this.pool =
|
|
1550
|
+
options.pool !== undefined ? !!options.pool : process.env.TD_POOL === "true";
|
|
1551
|
+
|
|
1547
1552
|
// Store reconnect preference from options
|
|
1548
1553
|
this.reconnect =
|
|
1549
1554
|
options.reconnect !== undefined ? options.reconnect : false;
|
|
@@ -1782,6 +1787,10 @@ class TestDriverSDK {
|
|
|
1782
1787
|
* @private
|
|
1783
1788
|
*/
|
|
1784
1789
|
async _getDashcamChromeExtensionPath() {
|
|
1790
|
+
if (this.os === "mac" || this.os === "darwin") {
|
|
1791
|
+
// /usr/lib is read-only on macOS; a Mac sandbox links the extension here.
|
|
1792
|
+
return "/usr/local/lib/node_modules/dashcam-chrome/build";
|
|
1793
|
+
}
|
|
1785
1794
|
if (this.os !== "windows") {
|
|
1786
1795
|
return "/usr/lib/node_modules/dashcam-chrome/build";
|
|
1787
1796
|
}
|
|
@@ -2174,6 +2183,8 @@ CAPTCHA_SOLVER_EOF`,
|
|
|
2174
2183
|
} else if (this.e2bTemplateId) {
|
|
2175
2184
|
this.agent.e2bTemplateId = this.e2bTemplateId;
|
|
2176
2185
|
}
|
|
2186
|
+
this.agent.pool =
|
|
2187
|
+
connectOptions.pool !== undefined ? !!connectOptions.pool : this.pool;
|
|
2177
2188
|
// Use os from connectOptions if provided, otherwise fall back to this.os
|
|
2178
2189
|
if (connectOptions.os !== undefined) {
|
|
2179
2190
|
this.agent.sandboxOs = connectOptions.os;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// The example suite (examples/) on your team's own runners instead of cloud
|
|
2
|
+
// sandboxes, e.g. the local ones from deploy/local/local.sh:
|
|
3
|
+
//
|
|
4
|
+
// TD_POOL=true TD_OS=mac TD_API_ROOT=... TD_API_KEY=... npx vitest run --config vitest.pool.config.mjs
|
|
5
|
+
//
|
|
6
|
+
// Unlike vitest.config.mjs it does not pick the API and key from
|
|
7
|
+
// shared/resolve-env.js: it uses the environment as given.
|
|
8
|
+
import TestDriver from "testdriverai/vitest";
|
|
9
|
+
import { defineConfig } from "vitest/config";
|
|
10
|
+
|
|
11
|
+
export default defineConfig({
|
|
12
|
+
test: {
|
|
13
|
+
include: ["examples/**/*.test.mjs"],
|
|
14
|
+
// Sessions wait for a free runner.
|
|
15
|
+
testTimeout: 900000,
|
|
16
|
+
hookTimeout: 900000,
|
|
17
|
+
// Report what happened, not what passed on a second try.
|
|
18
|
+
retry: 0,
|
|
19
|
+
pool: "forks",
|
|
20
|
+
// One test file per runner: files waiting for a runner would otherwise
|
|
21
|
+
// each hold a Node process in memory.
|
|
22
|
+
maxWorkers: Number(process.env.TD_WORKERS || 1),
|
|
23
|
+
maxConcurrency: 100,
|
|
24
|
+
reporters: ["verbose", TestDriver()],
|
|
25
|
+
setupFiles: ["testdriverai/vitest/setup", "testdriverai/vitest/setup-aws"],
|
|
26
|
+
},
|
|
27
|
+
});
|