@testdriverai/mcp 7.10.0-canary.0 → 7.10.1-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/.claude-plugin/marketplace.json +17 -0
- package/agent/index.js +116 -71
- package/agent/interface.js +13 -1
- package/agent/lib/commands.js +35 -15
- package/agent/lib/provision-commands.js +92 -11
- package/agent/lib/sandbox.js +263 -30
- package/agent/lib/sdk.js +16 -12
- package/agent/lib/system.js +107 -31
- package/ai/.claude-plugin/plugin.json +89 -4
- package/ai/agents/testdriver.md +4 -8
- package/ai/skills/testdriver-assert/SKILL.md +0 -1
- package/ai/skills/testdriver-aws-setup/SKILL.md +1 -1
- package/ai/skills/testdriver-caching/SKILL.md +13 -6
- package/ai/skills/testdriver-ci-cd/SKILL.md +57 -14
- package/ai/skills/testdriver-client/SKILL.md +10 -6
- package/ai/skills/testdriver-customizing-devices/SKILL.md +7 -5
- package/ai/skills/testdriver-dashcam/SKILL.md +36 -3
- package/ai/skills/testdriver-debugging-with-screenshots/SKILL.md +28 -4
- package/ai/skills/testdriver-device-config/SKILL.md +5 -5
- package/ai/skills/testdriver-find/SKILL.md +50 -11
- package/ai/skills/testdriver-generating-tests/SKILL.md +163 -8
- package/ai/skills/testdriver-hosted/SKILL.md +1 -1
- package/ai/skills/testdriver-machine-setup/SKILL.md +331 -0
- package/ai/skills/testdriver-making-assertions/SKILL.md +78 -2
- package/ai/skills/testdriver-mcp-workflow/SKILL.md +2 -2
- package/ai/skills/testdriver-parse/SKILL.md +1 -1
- package/ai/skills/testdriver-performing-actions/SKILL.md +97 -3
- package/ai/skills/testdriver-provision/SKILL.md +0 -20
- package/ai/skills/testdriver-quickstart/SKILL.md +299 -21
- package/ai/skills/testdriver-reusable-code/SKILL.md +3 -3
- package/ai/skills/testdriver-running-tests/SKILL.md +1 -1
- package/ai/skills/testdriver-screenshot/SKILL.md +5 -5
- package/ai/skills/testdriver-scroll/SKILL.md +30 -160
- package/ai/skills/testdriver-test-writer/SKILL.md +3 -5
- package/ai/skills/testdriver-testdriver/SKILL.md +3 -7
- package/ai/skills/testdriver-wait/SKILL.md +1 -1
- package/{docs/v7/ai.mdx → ai/skills/testdriver:ai/SKILL.md} +3 -4
- package/ai/skills/testdriver:assert/SKILL.md +315 -0
- package/ai/skills/testdriver:aws-setup/SKILL.md +448 -0
- package/ai/skills/testdriver:cache/SKILL.md +221 -0
- package/ai/skills/testdriver:caching/SKILL.md +124 -0
- package/ai/skills/testdriver:captcha/SKILL.md +158 -0
- package/ai/skills/testdriver:ci-cd/SKILL.md +659 -0
- package/ai/skills/testdriver:click/SKILL.md +286 -0
- package/ai/skills/testdriver:client/SKILL.md +477 -0
- package/ai/skills/testdriver:customizing-devices/SKILL.md +319 -0
- package/ai/skills/testdriver:dashcam/SKILL.md +451 -0
- package/ai/skills/testdriver:debugging-with-screenshots/SKILL.md +415 -0
- package/{docs/v7/device-config.mdx → ai/skills/testdriver:device-config/SKILL.md} +8 -8
- package/ai/skills/testdriver:double-click/SKILL.md +102 -0
- package/ai/skills/testdriver:elements/SKILL.md +605 -0
- package/ai/skills/testdriver:enterprise/SKILL.md +7 -0
- package/ai/skills/testdriver:errors/SKILL.md +246 -0
- package/ai/skills/testdriver:events/SKILL.md +356 -0
- package/ai/skills/testdriver:exec/SKILL.md +317 -0
- package/ai/skills/testdriver:find/SKILL.md +860 -0
- package/ai/skills/testdriver:focus-application/SKILL.md +293 -0
- package/ai/skills/testdriver:generating-tests/SKILL.md +25 -0
- package/ai/skills/testdriver:hosted/SKILL.md +156 -0
- package/ai/skills/testdriver:hover/SKILL.md +278 -0
- package/{docs/v7/locating-elements.mdx → ai/skills/testdriver:locating-elements/SKILL.md} +3 -3
- package/ai/skills/testdriver:making-assertions/SKILL.md +32 -0
- package/ai/skills/testdriver:mcp/SKILL.md +7 -0
- package/ai/skills/testdriver:mouse-down/SKILL.md +161 -0
- package/ai/skills/testdriver:mouse-up/SKILL.md +164 -0
- package/ai/skills/testdriver:parse/SKILL.md +236 -0
- package/ai/skills/testdriver:performing-actions/SKILL.md +53 -0
- package/ai/skills/testdriver:press-keys/SKILL.md +348 -0
- package/ai/skills/testdriver:provision/SKILL.md +331 -0
- package/ai/skills/testdriver:quickstart/SKILL.md +172 -0
- package/ai/skills/testdriver:redraw/SKILL.md +214 -0
- package/ai/skills/testdriver:reusable-code/SKILL.md +249 -0
- package/ai/skills/testdriver:right-click/SKILL.md +123 -0
- package/{docs/v7/running-tests.mdx → ai/skills/testdriver:running-tests/SKILL.md} +4 -4
- package/ai/skills/testdriver:screenshot/SKILL.md +248 -0
- package/ai/skills/testdriver:screenshots/SKILL.md +184 -0
- package/ai/skills/testdriver:scroll/SKILL.md +205 -0
- package/ai/skills/testdriver:secrets/SKILL.md +115 -0
- package/ai/skills/testdriver:self-hosted/SKILL.md +147 -0
- package/ai/skills/testdriver:test-results-json/SKILL.md +257 -0
- package/ai/skills/testdriver:testdriver/SKILL.md +624 -0
- package/ai/skills/testdriver:type/SKILL.md +357 -0
- package/ai/skills/testdriver:variables/SKILL.md +111 -0
- package/ai/skills/testdriver:wait/SKILL.md +50 -0
- package/{docs/v7/waiting-for-elements.mdx → ai/skills/testdriver:waiting-for-elements/SKILL.md} +3 -3
- package/ai/skills/testdriver:what-is-testdriver/SKILL.md +54 -0
- package/debugger/index.html +12 -0
- package/docs/_data/examples-manifest.json +54 -46
- package/docs/_data/examples-manifest.schema.json +12 -2
- package/docs/_scripts/extract-example-urls.js +21 -3
- package/docs/_scripts/generate-examples.js +64 -16
- package/docs/changelog.mdx +29 -2
- package/docs/claude-mcp-plugin.mdx +65 -18
- package/docs/docs.json +16 -33
- package/docs/snippets/tests/scroll-yaml.mdx +2 -2
- package/docs/v6/commands/scroll-until-image.mdx +1 -1
- package/docs/v6/commands/scroll-until-text.mdx +2 -2
- package/docs/v6/commands/scroll.mdx +2 -2
- package/docs/v7/_drafts/agents.mdx +0 -4
- package/docs/v7/_drafts/best-practices.mdx +0 -12
- package/docs/v7/_drafts/commands/scroll-until-image.mdx +1 -1
- package/docs/v7/_drafts/commands/scroll-until-text.mdx +2 -2
- package/docs/v7/_drafts/commands/scroll.mdx +1 -1
- package/docs/v7/_drafts/configuration.mdx +0 -12
- package/docs/v7/_drafts/faq.mdx +2 -10
- package/docs/v7/_drafts/readme.mdx +0 -1
- package/docs/v7/_drafts/troubleshooting.mdx +1 -4
- package/docs/v7/assert.mdx +0 -1
- package/docs/v7/aws-setup.mdx +1 -1
- package/docs/v7/caching.mdx +14 -10
- package/docs/v7/ci-cd.mdx +98 -14
- package/docs/v7/client.mdx +10 -6
- package/docs/v7/copilot/auto-healing.mdx +167 -18
- package/docs/v7/copilot/running-tests.mdx +915 -54
- package/docs/v7/customizing-devices.mdx +7 -5
- package/docs/v7/dashcam.mdx +36 -3
- package/docs/v7/debugging-with-screenshots.mdx +31 -7
- package/docs/v7/examples/ai.mdx +13 -8
- package/docs/v7/examples/assert.mdx +1 -1
- package/docs/v7/examples/chrome-extension.mdx +30 -13
- package/docs/v7/examples/element-not-found.mdx +1 -1
- package/docs/v7/examples/findall-coffee-icons.mdx +3 -2
- package/docs/v7/examples/formatted-logging.mdx +74 -0
- package/docs/v7/examples/hover-image.mdx +1 -1
- package/docs/v7/examples/hover-text-with-description.mdx +2 -2
- 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 +27 -27
- package/docs/v7/examples/match-image.mdx +1 -1
- package/docs/v7/examples/parse.mdx +3 -2
- package/docs/v7/examples/press-keys.mdx +2 -2
- package/docs/v7/examples/scroll-keyboard.mdx +2 -2
- 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/find.mdx +50 -11
- package/docs/v7/generating-tests.mdx +166 -10
- package/docs/v7/hosted.mdx +1 -1
- package/docs/v7/making-assertions.mdx +81 -4
- package/docs/v7/parse.mdx +1 -1
- package/docs/v7/performing-actions.mdx +100 -5
- package/docs/v7/provision.mdx +0 -20
- package/docs/v7/quickstart.mdx +299 -21
- package/docs/v7/reusable-code.mdx +3 -3
- package/docs/v7/screenshot.mdx +5 -5
- package/docs/v7/scroll.mdx +30 -160
- package/docs/v7/wait.mdx +1 -1
- package/examples/chrome-extension.test.mjs +29 -12
- package/examples/config.mjs +1 -1
- package/examples/launch-vscode-linux.test.mjs +25 -25
- package/interfaces/cli/commands/init.js +84 -2
- package/interfaces/vitest-plugin.mjs +51 -61
- package/lib/core/Dashcam.js +43 -2
- package/lib/core/index.d.ts +13 -1
- package/lib/github-comment.mjs +11 -5
- package/lib/init-project.js +98 -44
- package/lib/install-clients.js +470 -0
- package/lib/provision.js +749 -0
- package/lib/resolve-channel.js +2 -2
- package/lib/sentry.js +15 -2
- package/lib/vitest/hooks.mjs +44 -34
- package/mcp-server/README.md +32 -0
- package/mcp-server/dist/core/actions.d.ts +176 -0
- package/mcp-server/dist/core/actions.js +753 -0
- package/mcp-server/dist/env-utils.d.ts +45 -0
- package/mcp-server/dist/env-utils.js +63 -0
- package/mcp-server/dist/provision-types.d.ts +6 -2
- package/mcp-server/dist/provision-types.js +3 -1
- package/mcp-server/dist/server.mjs +449 -751
- package/mcp-server/package-lock.json +384 -1
- package/mcp-server/package.json +5 -2
- package/mcp-server/src/core/actions.ts +912 -0
- package/mcp-server/src/env-utils.test.ts +82 -0
- package/mcp-server/src/env-utils.ts +77 -0
- package/mcp-server/src/provision-types.ts +4 -1
- package/mcp-server/src/server.ts +533 -954
- package/mcp-server/tsconfig.json +1 -1
- package/mcp-server/vitest.config.ts +7 -0
- package/package.json +15 -3
- package/sdk.d.ts +11 -9
- package/sdk.js +116 -746
- package/setup/aws/spawn-runner.sh +24 -3
- package/docs/v7/_drafts/caching-ai.mdx +0 -215
- package/docs/v7/_drafts/caching.mdx +0 -366
- package/docs/v7/_drafts/prompt-cache.mdx +0 -200
- package/docs/v7/copilot/creating-tests.mdx +0 -156
- package/docs/v7/copilot/github.mdx +0 -143
- package/docs/v7/copilot/setup.mdx +0 -143
- package/docs/v7/examples/exec-output.mdx +0 -84
- package/docs/v7/examples/exec-pwsh.mdx +0 -82
- package/docs/v7/examples/focus-window.mdx +0 -61
- package/docs/v7/examples/scroll-until-image.mdx +0 -82
- package/docs/v7/examples/windows-installer.mdx +0 -95
- package/examples/formatted-logging.test.mjs +0 -27
- package/examples/match-image.test.mjs +0 -55
- package/manual/exec-stream-logs.test.mjs +0 -25
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for env-utils.ts
|
|
3
|
+
*
|
|
4
|
+
* Verifies that the OS and E2B template ID resolution helpers apply the
|
|
5
|
+
* correct priority order:
|
|
6
|
+
* explicit param > environment variable > built-in default
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { describe, it, expect } from "vitest";
|
|
10
|
+
import { resolveOs, resolveE2bTemplateId } from "./env-utils.js";
|
|
11
|
+
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// resolveOs
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
describe("resolveOs", () => {
|
|
17
|
+
it("returns the explicit param when provided", () => {
|
|
18
|
+
const { os } = resolveOs("windows", { TD_OS: "linux" });
|
|
19
|
+
expect(os).toBe("windows");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("falls back to TD_OS env var when no explicit param is given", () => {
|
|
23
|
+
const { os } = resolveOs(undefined, { TD_OS: "windows" });
|
|
24
|
+
expect(os).toBe("windows");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("defaults to linux when neither param nor TD_OS is set", () => {
|
|
28
|
+
const { os } = resolveOs(undefined, {});
|
|
29
|
+
expect(os).toBe("linux");
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("returns linux and a warning when TD_OS has an unsupported value", () => {
|
|
33
|
+
const { os, warning } = resolveOs(undefined, { TD_OS: "mac" });
|
|
34
|
+
expect(os).toBe("linux");
|
|
35
|
+
expect(warning).toMatch(/unsupported/i);
|
|
36
|
+
expect(warning).toContain("mac");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("returns linux and a warning when TD_OS is 'Linux' (wrong case)", () => {
|
|
40
|
+
const { os, warning } = resolveOs(undefined, { TD_OS: "Linux" });
|
|
41
|
+
expect(os).toBe("linux");
|
|
42
|
+
expect(warning).toBeDefined();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("explicit param takes priority over TD_OS env var", () => {
|
|
46
|
+
const { os, warning } = resolveOs("linux", { TD_OS: "windows" });
|
|
47
|
+
expect(os).toBe("linux");
|
|
48
|
+
expect(warning).toBeUndefined();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("returns no warning when TD_OS is valid", () => {
|
|
52
|
+
const { os, warning } = resolveOs(undefined, { TD_OS: "windows" });
|
|
53
|
+
expect(os).toBe("windows");
|
|
54
|
+
expect(warning).toBeUndefined();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
// resolveE2bTemplateId
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
|
|
62
|
+
describe("resolveE2bTemplateId", () => {
|
|
63
|
+
it("returns the explicit param when provided", () => {
|
|
64
|
+
const id = resolveE2bTemplateId("explicit-id", { TD_E2B_TEMPLATE_ID: "env-id" });
|
|
65
|
+
expect(id).toBe("explicit-id");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("falls back to TD_E2B_TEMPLATE_ID env var when no explicit param is given", () => {
|
|
69
|
+
const id = resolveE2bTemplateId(undefined, { TD_E2B_TEMPLATE_ID: "env-id" });
|
|
70
|
+
expect(id).toBe("env-id");
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("returns undefined when neither param nor TD_E2B_TEMPLATE_ID is set", () => {
|
|
74
|
+
const id = resolveE2bTemplateId(undefined, {});
|
|
75
|
+
expect(id).toBeUndefined();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("explicit param takes priority over TD_E2B_TEMPLATE_ID env var", () => {
|
|
79
|
+
const id = resolveE2bTemplateId("my-template", { TD_E2B_TEMPLATE_ID: "other-template" });
|
|
80
|
+
expect(id).toBe("my-template");
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for resolving TestDriver environment variables.
|
|
3
|
+
*
|
|
4
|
+
* These helpers centralise the "param > env var > default" fallback logic
|
|
5
|
+
* so the server handler stays clean and the logic can be unit-tested
|
|
6
|
+
* independently.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// ============================================================
|
|
10
|
+
// OS resolution
|
|
11
|
+
// ============================================================
|
|
12
|
+
|
|
13
|
+
const VALID_OS_VALUES = ["linux", "windows"] as const;
|
|
14
|
+
export type SandboxOs = (typeof VALID_OS_VALUES)[number];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the sandbox OS with the following priority:
|
|
18
|
+
* 1. Explicit `os` parameter passed to session_start
|
|
19
|
+
* 2. `TD_OS` environment variable (validated against supported values)
|
|
20
|
+
* 3. `"linux"` default
|
|
21
|
+
*
|
|
22
|
+
* Mirrors the behaviour in `hooks.mjs` so the MCP server and the
|
|
23
|
+
* Vitest integration are consistent.
|
|
24
|
+
*
|
|
25
|
+
* @param explicitOs - The value passed explicitly by the caller (may be undefined)
|
|
26
|
+
* @param env - The environment variables map (defaults to `process.env`)
|
|
27
|
+
* @returns - The resolved OS and a warning message if TD_OS was invalid
|
|
28
|
+
*/
|
|
29
|
+
export function resolveOs(
|
|
30
|
+
explicitOs: SandboxOs | undefined,
|
|
31
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
32
|
+
): { os: SandboxOs; warning?: string } {
|
|
33
|
+
if (explicitOs) {
|
|
34
|
+
return { os: explicitOs };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const envOs = env.TD_OS;
|
|
38
|
+
if (envOs) {
|
|
39
|
+
if ((VALID_OS_VALUES as readonly string[]).includes(envOs)) {
|
|
40
|
+
return { os: envOs as SandboxOs };
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
os: "linux",
|
|
44
|
+
warning: `TD_OS has unsupported value "${envOs}" (supported: ${VALID_OS_VALUES.join(", ")}), ignoring`,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return { os: "linux" };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ============================================================
|
|
52
|
+
// E2B template ID resolution
|
|
53
|
+
// ============================================================
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Resolve the E2B template ID with the following priority:
|
|
57
|
+
* 1. Explicit `e2bTemplateId` parameter passed to session_start
|
|
58
|
+
* 2. `TD_E2B_TEMPLATE_ID` environment variable
|
|
59
|
+
* 3. `undefined` (let the SDK use its own default)
|
|
60
|
+
*
|
|
61
|
+
* Mirrors the behaviour in `hooks.mjs`:
|
|
62
|
+
* ```js
|
|
63
|
+
* if (!config.e2bTemplateId && process.env.TD_E2B_TEMPLATE_ID) {
|
|
64
|
+
* config.e2bTemplateId = process.env.TD_E2B_TEMPLATE_ID;
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @param explicitId - The value passed explicitly by the caller (may be undefined)
|
|
69
|
+
* @param env - The environment variables map (defaults to `process.env`)
|
|
70
|
+
* @returns - The resolved template ID, or undefined if none is set
|
|
71
|
+
*/
|
|
72
|
+
export function resolveE2bTemplateId(
|
|
73
|
+
explicitId: string | undefined,
|
|
74
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
75
|
+
): string | undefined {
|
|
76
|
+
return explicitId || env.TD_E2B_TEMPLATE_ID;
|
|
77
|
+
}
|
|
@@ -143,7 +143,7 @@ export const SessionStartInputSchema = z.object({
|
|
|
143
143
|
|
|
144
144
|
// Common session options
|
|
145
145
|
/** Operating system for the sandbox */
|
|
146
|
-
os: z.enum(["linux", "windows"]).
|
|
146
|
+
os: z.enum(["linux", "windows"]).optional().describe("Sandbox OS (default: 'linux', or TD_OS environment variable if set)"),
|
|
147
147
|
/** Keep sandbox alive duration in ms (default: 5 minutes) */
|
|
148
148
|
keepAlive: z.number().default(300000).describe("Keep sandbox alive for this many ms"),
|
|
149
149
|
/** Path to test file - when provided, you MUST append generated code to this file after each action */
|
|
@@ -157,6 +157,9 @@ export const SessionStartInputSchema = z.object({
|
|
|
157
157
|
/** Direct IP address of self-hosted instance (bypasses cloud provisioning) */
|
|
158
158
|
ip: z.string().optional().describe("Direct IP address of self-hosted Windows instance (e.g., from AWS). When provided, connects directly to this IP instead of using cloud provisioning."),
|
|
159
159
|
|
|
160
|
+
/** E2B sandbox template ID (overrides TD_E2B_TEMPLATE_ID env var) */
|
|
161
|
+
e2bTemplateId: z.string().optional().describe("E2B sandbox template ID. Overrides the TD_E2B_TEMPLATE_ID environment variable when provided."),
|
|
162
|
+
|
|
160
163
|
// Debug mode - connect to existing sandbox
|
|
161
164
|
/** Sandbox ID to connect to (for debug-on-failure mode). When provided, connects to an existing sandbox instead of creating a new one. Skip provisioning. */
|
|
162
165
|
sandboxId: z.string().optional().describe("Existing sandbox ID to connect to (from debug-on-failure mode). Skips provisioning."),
|