testdriverai 7.8.0-test.7 → 7.8.0-test.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent/index.js +18 -5
- package/agent/lib/commands.js +3 -2
- package/agent/lib/http.js +162 -0
- package/agent/lib/logger.js +15 -0
- package/agent/lib/sandbox.js +554 -209
- package/agent/lib/sdk.js +5 -22
- package/agent/lib/system.js +25 -65
- package/ai/skills/testdriver-cache/SKILL.md +221 -0
- package/ai/skills/testdriver-errors/SKILL.md +246 -0
- package/ai/skills/testdriver-events/SKILL.md +356 -0
- package/ai/skills/testdriver-find/SKILL.md +14 -20
- package/ai/skills/testdriver-mcp/SKILL.md +7 -0
- package/ai/skills/testdriver-provision/SKILL.md +331 -0
- package/ai/skills/testdriver-redraw/SKILL.md +214 -0
- package/ai/skills/testdriver-running-tests/SKILL.md +1 -1
- package/ai/skills/testdriver-screenshots/SKILL.md +184 -0
- package/docs/_data/examples-manifest.json +46 -46
- package/docs/_scripts/extract-example-urls.js +67 -72
- package/docs/changelog.mdx +148 -8
- package/docs/docs.json +46 -38
- package/docs/images/content/vscode/v7-chat.png +0 -0
- package/docs/images/content/vscode/v7-choose-agent.png +0 -0
- package/docs/images/content/vscode/v7-full.png +0 -0
- package/docs/images/content/vscode/v7-onboarding.png +0 -0
- package/docs/v7/cache.mdx +223 -0
- package/docs/v7/copilot/auto-healing.mdx +265 -0
- package/docs/v7/copilot/creating-tests.mdx +156 -0
- package/docs/v7/copilot/github.mdx +143 -0
- package/docs/v7/copilot/running-tests.mdx +149 -0
- package/docs/v7/copilot/setup.mdx +143 -0
- package/docs/v7/enterprise.mdx +3 -110
- package/docs/v7/errors.mdx +248 -0
- package/docs/v7/events.mdx +358 -0
- package/docs/v7/examples/ai.mdx +1 -1
- package/docs/v7/examples/assert.mdx +1 -1
- package/docs/v7/examples/captcha-api.mdx +1 -1
- package/docs/v7/examples/chrome-extension.mdx +1 -1
- package/docs/v7/examples/drag-and-drop.mdx +1 -1
- package/docs/v7/examples/element-not-found.mdx +1 -1
- package/docs/v7/examples/exec-output.mdx +85 -0
- package/docs/v7/examples/exec-pwsh.mdx +83 -0
- package/docs/v7/examples/focus-window.mdx +62 -0
- package/docs/v7/examples/hover-image.mdx +1 -1
- package/docs/v7/examples/hover-text.mdx +1 -1
- package/docs/v7/examples/installer.mdx +1 -1
- package/docs/v7/examples/launch-vscode-linux.mdx +1 -1
- package/docs/v7/examples/match-image.mdx +1 -1
- package/docs/v7/examples/press-keys.mdx +1 -1
- package/docs/v7/examples/scroll-keyboard.mdx +1 -1
- package/docs/v7/examples/scroll-until-image.mdx +1 -1
- package/docs/v7/examples/scroll-until-text.mdx +1 -1
- package/docs/v7/examples/scroll.mdx +1 -1
- package/docs/v7/examples/type.mdx +1 -1
- package/docs/v7/examples/windows-installer.mdx +1 -1
- package/docs/v7/find.mdx +14 -20
- package/docs/v7/{cloud.mdx → hosted.mdx} +43 -5
- package/docs/v7/mcp.mdx +9 -0
- package/docs/v7/provision.mdx +333 -0
- package/docs/v7/quickstart.mdx +30 -2
- package/docs/v7/redraw.mdx +216 -0
- package/docs/v7/running-tests.mdx +1 -1
- package/docs/v7/screenshots.mdx +186 -0
- package/docs/v7/self-hosted.mdx +127 -44
- package/docs/v7/test-results-json.mdx +258 -0
- package/examples/scroll-keyboard.test.mjs +1 -1
- package/examples/scroll.test.mjs +1 -12
- package/interfaces/logger.js +0 -12
- package/interfaces/vitest-plugin.mjs +170 -51
- package/lib/core/Dashcam.js +30 -23
- package/lib/environments.json +22 -0
- package/lib/github-comment.mjs +58 -40
- package/lib/init-project.js +5 -67
- package/lib/resolve-channel.js +42 -12
- package/lib/sentry.js +47 -23
- package/lib/vitest/hooks.mjs +63 -3
- package/{examples → manual}/drag-and-drop.test.mjs +1 -1
- package/manual/exec-stream-logs.test.mjs +25 -0
- package/mcp-server/dist/server.mjs +28 -8
- package/mcp-server/src/server.ts +31 -8
- package/package.json +4 -3
- package/sdk.d.ts +4 -0
- package/sdk.js +45 -15
- package/setup/aws/install-dev-runner.sh +79 -0
- package/setup/aws/spawn-runner.sh +165 -0
- package/test-sentry-span.js +35 -0
- package/vitest.config.mjs +22 -34
- package/vitest.runner.config.mjs +33 -0
- /package/{examples → manual}/flake-diffthreshold-001.test.mjs +0 -0
- /package/{examples → manual}/flake-diffthreshold-01.test.mjs +0 -0
- /package/{examples → manual}/flake-diffthreshold-05.test.mjs +0 -0
- /package/{examples → manual}/flake-noredraw-cache.test.mjs +0 -0
- /package/{examples → manual}/flake-noredraw-nocache.test.mjs +0 -0
- /package/{examples → manual}/flake-redraw-cache.test.mjs +0 -0
- /package/{examples → manual}/flake-redraw-nocache.test.mjs +0 -0
- /package/{examples → manual}/flake-rocket-match.test.mjs +0 -0
- /package/{examples → manual}/flake-shared.mjs +0 -0
- /package/{examples → manual}/no-provision.test.mjs +0 -0
- /package/{examples → manual}/scroll-until-text.test.mjs +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const Sentry = require('@sentry/node');
|
|
2
|
+
const crypto = require('crypto');
|
|
3
|
+
|
|
4
|
+
Sentry.init({ dsn: 'https://test@sentry.io/123', tracesSampleRate: 1.0 });
|
|
5
|
+
|
|
6
|
+
const sessionId = 'test-session-123';
|
|
7
|
+
const traceId = crypto.createHash('md5').update(sessionId).digest('hex');
|
|
8
|
+
console.log('expected traceId:', traceId);
|
|
9
|
+
|
|
10
|
+
const sentryTraceHeader = traceId + '-' + crypto.randomBytes(8).toString('hex') + '-1';
|
|
11
|
+
const baggageHeader = 'sentry-trace_id=' + traceId + ',sentry-sampled=true';
|
|
12
|
+
|
|
13
|
+
// Approach: Use continueTrace + startInactiveSpan for the root, then rely on scope
|
|
14
|
+
// for getTraceData propagation
|
|
15
|
+
Sentry.continueTrace(
|
|
16
|
+
{ sentryTrace: sentryTraceHeader, baggage: baggageHeader },
|
|
17
|
+
() => {
|
|
18
|
+
// This sets propagation context on the current scope
|
|
19
|
+
const rootSpan = Sentry.startInactiveSpan({ name: 'sdk.session', op: 'session', forceTransaction: true });
|
|
20
|
+
|
|
21
|
+
// After continueTrace returns, check if getTraceData still uses the right traceId
|
|
22
|
+
const td = Sentry.getTraceData();
|
|
23
|
+
console.log('after continueTrace getTraceData:', JSON.stringify(td));
|
|
24
|
+
console.log('traceId matches:', td['sentry-trace'] && td['sentry-trace'].startsWith(traceId));
|
|
25
|
+
|
|
26
|
+
// Simulate async: do a child span later
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
const td2 = Sentry.getTraceData();
|
|
29
|
+
console.log('async getTraceData:', JSON.stringify(td2));
|
|
30
|
+
console.log('async traceId matches:', td2['sentry-trace'] && td2['sentry-trace'].startsWith(traceId));
|
|
31
|
+
rootSpan.end();
|
|
32
|
+
process.exit(0);
|
|
33
|
+
}, 100);
|
|
34
|
+
}
|
|
35
|
+
);
|
package/vitest.config.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import TestDriver from "testdriverai/vitest";
|
|
2
2
|
import { defineConfig } from "vitest/config";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { createRequire } from "module";
|
|
4
|
+
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const { resolveEnv, getEnvironmentNames } = require("../shared/resolve-env");
|
|
5
7
|
|
|
6
8
|
// Always include AWS setup - it will be a no-op unless TD_OS=windows
|
|
7
9
|
// Note: dotenv is loaded automatically by the TestDriver SDK
|
|
@@ -12,8 +14,8 @@ const setupFiles = [
|
|
|
12
14
|
|
|
13
15
|
const sharedTestConfig = {
|
|
14
16
|
retry: 0,
|
|
15
|
-
testTimeout:
|
|
16
|
-
hookTimeout:
|
|
17
|
+
testTimeout: 480000,
|
|
18
|
+
hookTimeout: 480000,
|
|
17
19
|
maxConcurrency: 100,
|
|
18
20
|
disableConsoleIntercept: false,
|
|
19
21
|
silent: false,
|
|
@@ -25,45 +27,31 @@ const sharedTestConfig = {
|
|
|
25
27
|
include: ["examples/**/*.test.mjs"],
|
|
26
28
|
};
|
|
27
29
|
|
|
28
|
-
// ──
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
35
|
-
const idx = trimmed.indexOf("=");
|
|
36
|
-
if (idx === -1) continue;
|
|
37
|
-
env[trimmed.slice(0, idx)] = trimmed.slice(idx + 1);
|
|
38
|
-
}
|
|
39
|
-
return env;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// ── Load base .env + per-environment overlay ────────────────────────
|
|
43
|
-
const monoRoot = resolve(import.meta.dirname, "..");
|
|
44
|
-
const baseEnv = parseEnvFile(resolve(monoRoot, ".env"));
|
|
45
|
-
|
|
46
|
-
const environments = ["dev", "test", "canary", "stable"];
|
|
30
|
+
// ── Resolve env vars via shared/resolve-env.js ──────────────────────
|
|
31
|
+
// Uses: environments.json (URLs) + envs/{env}.env (overlay) + fixtures (API keys)
|
|
32
|
+
// TD_PLAN selects which plan's API key to use (default: enterprise)
|
|
33
|
+
const plan = process.env.TD_PLAN || "enterprise";
|
|
34
|
+
const defaultEnv = process.env.TD_CHANNEL || "dev";
|
|
35
|
+
const environments = getEnvironmentNames();
|
|
47
36
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
// Apply default env to the main process so the reporter/plugin picks it up
|
|
38
|
+
// (vitest's test.env only propagates to worker processes, not the main process)
|
|
39
|
+
const defaultResolved = resolveEnv(defaultEnv, plan);
|
|
40
|
+
Object.assign(process.env, defaultResolved);
|
|
52
41
|
|
|
53
|
-
// ──
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
// vitest run --project canary --project stable
|
|
42
|
+
// ── Usage ───────────────────────────────────────────────────────────
|
|
43
|
+
// TD_PLAN=enterprise vitest run --project dev
|
|
44
|
+
// TD_PLAN=free vitest run --project test examples/assert.test.mjs
|
|
45
|
+
// vitest run --project canary --project stable
|
|
58
46
|
export default defineConfig({
|
|
59
47
|
test: {
|
|
60
48
|
...sharedTestConfig,
|
|
61
|
-
env:
|
|
49
|
+
env: defaultResolved,
|
|
62
50
|
projects: environments.map((envName) => ({
|
|
63
51
|
extends: true,
|
|
64
52
|
test: {
|
|
65
53
|
name: envName,
|
|
66
|
-
env:
|
|
54
|
+
env: resolveEnv(envName, plan),
|
|
67
55
|
},
|
|
68
56
|
})),
|
|
69
57
|
},
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vitest config for runner/packer tests.
|
|
3
|
+
* Lives under sdk/ so vitest resolves from sdk/node_modules,
|
|
4
|
+
* but uses shared/resolve-env.js for environment variable loading.
|
|
5
|
+
*/
|
|
6
|
+
import { defineConfig } from "vitest/config";
|
|
7
|
+
import { createRequire } from "module";
|
|
8
|
+
import { dirname, resolve } from "path";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
|
|
11
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const monoRoot = resolve(__dirname, "..");
|
|
13
|
+
|
|
14
|
+
const require = createRequire(import.meta.url);
|
|
15
|
+
const { resolveEnv } = require("../shared/resolve-env");
|
|
16
|
+
|
|
17
|
+
const plan = process.env.TD_PLAN || "enterprise";
|
|
18
|
+
const env = process.env.TD_CHANNEL || "dev";
|
|
19
|
+
const resolved = resolveEnv(env, plan);
|
|
20
|
+
|
|
21
|
+
// Apply to the main process so test code sees the vars immediately
|
|
22
|
+
Object.assign(process.env, resolved);
|
|
23
|
+
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
test: {
|
|
26
|
+
root: monoRoot,
|
|
27
|
+
testTimeout: 900_000, // 15 min per test
|
|
28
|
+
hookTimeout: 2_400_000, // 40 min for beforeAll (AMI build + spawn)
|
|
29
|
+
reporters: ["default"],
|
|
30
|
+
include: ["runner/packer/test/**/*.test.mjs"],
|
|
31
|
+
env: resolved,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|