@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
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Exec Output Test Example"
|
|
3
|
-
sidebarTitle: "Exec Output"
|
|
4
|
-
description: "Example test demonstrating how to capture and use output from PowerShell exec commands."
|
|
5
|
-
icon: "terminal"
|
|
6
|
-
mode: "wide"
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Demo Test Run
|
|
10
|
-
|
|
11
|
-
Watch this test execute in a real sandbox environment:
|
|
12
|
-
|
|
13
|
-
{/* exec-output.test.mjs output */}
|
|
14
|
-
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d02ee8a04db4b705cbeb/replay"
|
|
16
|
-
width="100%"
|
|
17
|
-
height="390"
|
|
18
|
-
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
19
|
-
allow="fullscreen"
|
|
20
|
-
/>
|
|
21
|
-
|
|
22
|
-
## Source Code
|
|
23
|
-
|
|
24
|
-
```javascript title="exec-output.test.mjs" {22-27}
|
|
25
|
-
/**
|
|
26
|
-
* TestDriver SDK - Exec Output Test (Vitest)
|
|
27
|
-
* Converted from: testdriver/acceptance/exec-output.yaml
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
import { describe, expect, it } from "vitest";
|
|
31
|
-
import { TestDriver } from "testdriverai/vitest/hooks";
|
|
32
|
-
|
|
33
|
-
describe.skip("Exec Output Test", () => {
|
|
34
|
-
it(
|
|
35
|
-
"should set date using PowerShell and navigate to calendar",
|
|
36
|
-
async (context) => {
|
|
37
|
-
const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP, headless: true });
|
|
38
|
-
await testdriver.provision.chrome({ url: 'http://testdriver-sandbox.vercel.app/login' });
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
// Generate date in query string format
|
|
42
|
-
const queryString = await testdriver.exec(
|
|
43
|
-
"pwsh",
|
|
44
|
-
`
|
|
45
|
-
$date = (Get-Date).AddMonths(1)
|
|
46
|
-
Write-Output $date.ToString("yyyy-MM-dd")
|
|
47
|
-
`,
|
|
48
|
-
10000,
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
// Assert that the date is valid
|
|
52
|
-
const dateValidResult = await testdriver.assert(
|
|
53
|
-
`${queryString} is a valid date`,
|
|
54
|
-
);
|
|
55
|
-
expect(dateValidResult).toBeTruthy();
|
|
56
|
-
|
|
57
|
-
// Generate date in display format
|
|
58
|
-
const expectedDate = await testdriver.exec(
|
|
59
|
-
"pwsh",
|
|
60
|
-
`
|
|
61
|
-
$date = (Get-Date).AddMonths(1)
|
|
62
|
-
Write-Output $date.ToString("ddd MMM d yyyy")
|
|
63
|
-
`,
|
|
64
|
-
10000,
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
// Navigate to calendar with date parameter
|
|
68
|
-
await testdriver.focusApplication("Google Chrome");
|
|
69
|
-
await testdriver.pressKeys(["ctrl", "l"]);
|
|
70
|
-
await testdriver.type(
|
|
71
|
-
`https://teamup.com/ks48cf2135e7e080bc?view=d&date=${queryString}`,
|
|
72
|
-
);
|
|
73
|
-
await testdriver.pressKeys(["enter"]);
|
|
74
|
-
|
|
75
|
-
// Assert that the expected date shows
|
|
76
|
-
await testdriver.focusApplication("Google Chrome");
|
|
77
|
-
const result = await testdriver.assert(
|
|
78
|
-
`the text ${expectedDate} is visible on screen`,
|
|
79
|
-
);
|
|
80
|
-
expect(result).toBeTruthy();
|
|
81
|
-
},
|
|
82
|
-
);
|
|
83
|
-
});
|
|
84
|
-
```
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Exec PowerShell Test Example"
|
|
3
|
-
sidebarTitle: "Exec Pwsh"
|
|
4
|
-
description: "Example test demonstrating how to generate dynamic data using PowerShell and use it in test interactions."
|
|
5
|
-
icon: "terminal"
|
|
6
|
-
mode: "wide"
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Demo Test Run
|
|
10
|
-
|
|
11
|
-
Watch this test execute in a real sandbox environment:
|
|
12
|
-
|
|
13
|
-
{/* exec-pwsh.test.mjs output */}
|
|
14
|
-
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d026a0a3ef8239de4746/replay"
|
|
16
|
-
width="100%"
|
|
17
|
-
height="390"
|
|
18
|
-
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
19
|
-
allow="fullscreen"
|
|
20
|
-
/>
|
|
21
|
-
|
|
22
|
-
## Source Code
|
|
23
|
-
|
|
24
|
-
```javascript title="exec-pwsh.test.mjs" {20-38}
|
|
25
|
-
/**
|
|
26
|
-
* TestDriver SDK - Exec Shell Test (Vitest)
|
|
27
|
-
* Converted from: testdriver/acceptance/exec-shell.yaml
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
import { describe, expect, it } from "vitest";
|
|
31
|
-
import { TestDriver } from "testdriverai/vitest/hooks";
|
|
32
|
-
|
|
33
|
-
describe.skip("Exec PowerShell Test", () => {
|
|
34
|
-
it(
|
|
35
|
-
"should generate random email using PowerShell and enter it",
|
|
36
|
-
async (context) => {
|
|
37
|
-
const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP, headless: true });
|
|
38
|
-
await testdriver.provision.chrome({ url: 'http://testdriver-sandbox.vercel.app/login' });
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
// Generate random email using PowerShell
|
|
42
|
-
const randomEmail = await testdriver.exec({
|
|
43
|
-
language: "pwsh",
|
|
44
|
-
code: `
|
|
45
|
-
# Random email generator in PowerShell
|
|
46
|
-
|
|
47
|
-
# Arrays of possible names and domains
|
|
48
|
-
$firstNames = @("john", "jane", "alex", "chris", "sara", "mike", "lisa", "david", "emma", "ryan")
|
|
49
|
-
$lastNames = @("smith", "johnson", "williams", "brown", "jones", "garcia", "miller", "davis", "martin", "lee")
|
|
50
|
-
$domains = @("example.com", "testmail.com", "mailinator.com", "demo.org", "company.net")
|
|
51
|
-
|
|
52
|
-
# Random selection
|
|
53
|
-
$first = Get-Random -InputObject $firstNames
|
|
54
|
-
$last = Get-Random -InputObject $lastNames
|
|
55
|
-
$domain = Get-Random -InputObject $domains
|
|
56
|
-
$number = Get-Random -Minimum 1 -Maximum 1000
|
|
57
|
-
|
|
58
|
-
# Generate the email
|
|
59
|
-
$email = "$first.$last$number@$domain".ToLower()
|
|
60
|
-
|
|
61
|
-
# Output
|
|
62
|
-
Write-Output "$email"
|
|
63
|
-
`,
|
|
64
|
-
timeout: 10000,
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// Enter the email in username field
|
|
68
|
-
const usernameField = await testdriver.find(
|
|
69
|
-
"Username, input field for username",
|
|
70
|
-
);
|
|
71
|
-
await usernameField.click();
|
|
72
|
-
await testdriver.type(randomEmail);
|
|
73
|
-
|
|
74
|
-
// Assert that the username field shows a valid email address
|
|
75
|
-
const result = await testdriver.assert(
|
|
76
|
-
`the username field contains ${randomEmail} which is a valid email address`,
|
|
77
|
-
);
|
|
78
|
-
expect(result).toBeTruthy();
|
|
79
|
-
},
|
|
80
|
-
);
|
|
81
|
-
});
|
|
82
|
-
```
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Focus Window Test Example"
|
|
3
|
-
sidebarTitle: "Focus Window"
|
|
4
|
-
description: "Example test demonstrating how to switch focus between application windows."
|
|
5
|
-
icon: "window-maximize"
|
|
6
|
-
mode: "wide"
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Demo Test Run
|
|
10
|
-
|
|
11
|
-
Watch this test execute in a real sandbox environment:
|
|
12
|
-
|
|
13
|
-
{/* focus-window.test.mjs output */}
|
|
14
|
-
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d042e8a04db4b705cbf2/replay"
|
|
16
|
-
width="100%"
|
|
17
|
-
height="390"
|
|
18
|
-
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
19
|
-
allow="fullscreen"
|
|
20
|
-
/>
|
|
21
|
-
|
|
22
|
-
## Source Code
|
|
23
|
-
|
|
24
|
-
```javascript title="focus-window.test.mjs" {23-25}
|
|
25
|
-
/**
|
|
26
|
-
* TestDriver SDK - Focus Window Test (Vitest)
|
|
27
|
-
* Converted from: testdriver/acceptance/focus-window.yaml
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
import { describe, expect, it } from "vitest";
|
|
31
|
-
import { TestDriver } from "testdriverai/vitest/hooks";
|
|
32
|
-
|
|
33
|
-
describe("Focus Window Test", () => {
|
|
34
|
-
it.skip(
|
|
35
|
-
"should click Microsoft Edge icon and focus Google Chrome",
|
|
36
|
-
async (context) => {
|
|
37
|
-
const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP, headless: true });
|
|
38
|
-
await testdriver.provision.chrome({ url: 'http://testdriver-sandbox.vercel.app/login' });
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
// Show desktop
|
|
42
|
-
await testdriver.pressKeys(["winleft", "d"]);
|
|
43
|
-
|
|
44
|
-
// Click on the Microsoft Edge icon
|
|
45
|
-
const edgeIcon = await testdriver.find(
|
|
46
|
-
"a blue and green swirl icon on the taskbar representing Microsoft Edge",
|
|
47
|
-
);
|
|
48
|
-
await edgeIcon.click();
|
|
49
|
-
|
|
50
|
-
// Focus Google Chrome
|
|
51
|
-
await testdriver.focusApplication("Google Chrome");
|
|
52
|
-
|
|
53
|
-
// Assert Chrome is focused (implicit through successful focus)
|
|
54
|
-
const result = await testdriver.assert(
|
|
55
|
-
"Google Chrome is the focused application",
|
|
56
|
-
);
|
|
57
|
-
expect(result).toBeTruthy();
|
|
58
|
-
},
|
|
59
|
-
);
|
|
60
|
-
});
|
|
61
|
-
```
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Scroll Until Image Test"
|
|
3
|
-
sidebarTitle: "Scroll Until Image"
|
|
4
|
-
description: "Example test demonstrating how to scroll a page until a specific image becomes visible."
|
|
5
|
-
icon: "scroll"
|
|
6
|
-
mode: "wide"
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Demo Test Run
|
|
10
|
-
|
|
11
|
-
Watch this test execute in a real sandbox environment:
|
|
12
|
-
|
|
13
|
-
{/* scroll-until-image.test.mjs output */}
|
|
14
|
-
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d03f0201196437256cda/replay"
|
|
16
|
-
width="100%"
|
|
17
|
-
height="390"
|
|
18
|
-
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
19
|
-
allow="fullscreen"
|
|
20
|
-
/>
|
|
21
|
-
|
|
22
|
-
## Source Code
|
|
23
|
-
|
|
24
|
-
```javascript title="scroll-until-image.test.mjs" {26}
|
|
25
|
-
/**
|
|
26
|
-
* TestDriver SDK - Scroll Until Image Test (Vitest)
|
|
27
|
-
* Converted from: testdriver/acceptance/scroll-until-image.yaml
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
import { describe, expect, it } from "vitest";
|
|
31
|
-
import { TestDriver } from "testdriverai/vitest/hooks";
|
|
32
|
-
|
|
33
|
-
describe("Scroll Until Image Test", () => {
|
|
34
|
-
it.skip("should scroll until brown colored house image appears", async (context) => {
|
|
35
|
-
const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP, headless: true });
|
|
36
|
-
await testdriver.provision.chrome({ url: 'http://testdriver-sandbox.vercel.app/login' });
|
|
37
|
-
|
|
38
|
-
//
|
|
39
|
-
// Navigate to Wikipedia page
|
|
40
|
-
await testdriver.pressKeys(["ctrl", "l"]);
|
|
41
|
-
await testdriver.type("https://en.wikipedia.org/wiki/Leonardo_da_Vinci");
|
|
42
|
-
await testdriver.pressKeys(["enter"]);
|
|
43
|
-
|
|
44
|
-
// sleep for 5 seconds
|
|
45
|
-
await new Promise((r) => setTimeout(r, 5000));
|
|
46
|
-
|
|
47
|
-
// Click on heading
|
|
48
|
-
const heading = await testdriver.find(
|
|
49
|
-
"Leonardo Da Vinci, the page heading",
|
|
50
|
-
0,
|
|
51
|
-
);
|
|
52
|
-
await heading.click();
|
|
53
|
-
|
|
54
|
-
// Scroll until image appears
|
|
55
|
-
await testdriver.scrollUntilImage("a brown colored house", "down", 10000);
|
|
56
|
-
|
|
57
|
-
// Assert image of brown colored house appears on screen
|
|
58
|
-
const result = await testdriver.assert(
|
|
59
|
-
"image of brown colored house appears on screen",
|
|
60
|
-
);
|
|
61
|
-
expect(result).toBeTruthy();
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Running This Example
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
# Clone the TestDriver repository
|
|
70
|
-
git clone https://github.com/testdriverai/testdriverai
|
|
71
|
-
|
|
72
|
-
# Install dependencies
|
|
73
|
-
cd testdriverai
|
|
74
|
-
npm install
|
|
75
|
-
|
|
76
|
-
# Run this specific example
|
|
77
|
-
npx vitest run examples/scroll-until-image.test.mjs
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
<Note>
|
|
81
|
-
Make sure you have `TD_API_KEY` set in your environment. Get one at [testdriver.ai](https://testdriver.ai).
|
|
82
|
-
</Note>
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Windows App Installation"
|
|
3
|
-
sidebarTitle: "Windows Installer"
|
|
4
|
-
description: "Example test showing how to download and install Windows applications using MSI installers."
|
|
5
|
-
icon: "download"
|
|
6
|
-
mode: "wide"
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Demo Test Run
|
|
10
|
-
|
|
11
|
-
Watch this test execute in a real sandbox environment:
|
|
12
|
-
|
|
13
|
-
{/* windows-installer.test.mjs output */}
|
|
14
|
-
<iframe
|
|
15
|
-
src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d02ce8a04db4b705cbe9/replay"
|
|
16
|
-
width="100%"
|
|
17
|
-
height="390"
|
|
18
|
-
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
19
|
-
allow="fullscreen"
|
|
20
|
-
/>
|
|
21
|
-
|
|
22
|
-
## Source Code
|
|
23
|
-
|
|
24
|
-
```javascript title="windows-installer.test.mjs" {22-25}
|
|
25
|
-
/**
|
|
26
|
-
* TestDriver SDK - Windows Installer Example (Vitest)
|
|
27
|
-
*
|
|
28
|
-
* This example demonstrates how to download and install a Windows application
|
|
29
|
-
* using PowerShell commands, then launch and interact with it.
|
|
30
|
-
*
|
|
31
|
-
* Based on the v6 GitButler provisioning workflow.
|
|
32
|
-
*
|
|
33
|
-
* Run: TD_OS=windows vitest run examples/windows-installer.test.mjs
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
import { describe, it } from "vitest";
|
|
37
|
-
import { TestDriver } from "testdriverai/vitest/hooks";
|
|
38
|
-
|
|
39
|
-
const isLinux = (process.env.TD_OS || "linux") === "linux";
|
|
40
|
-
|
|
41
|
-
describe("Windows App Installation", () => {
|
|
42
|
-
|
|
43
|
-
it.skipIf(isLinux)("should download, install, and launch GitButler on Windows", async (context) => {
|
|
44
|
-
// Alternative approach using provision.installer helper
|
|
45
|
-
const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP,
|
|
46
|
-
os: 'windows'
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// Download the MSI installer
|
|
50
|
-
const installerPath = await testdriver.provision.installer({
|
|
51
|
-
url: 'https://app.gitbutler.com/downloads/release/windows/x86_64/msi',
|
|
52
|
-
launch: false, // Don't auto-launch, we'll install manually
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
console.log('Installer downloaded to:', installerPath);
|
|
56
|
-
|
|
57
|
-
// Install the MSI silently (the file might not have an extension, so we try MSI first)
|
|
58
|
-
await testdriver.exec('pwsh',
|
|
59
|
-
`Start-Process msiexec.exe -ArgumentList "/i \`"${installerPath}\`" /qn /norestart" -Wait`,
|
|
60
|
-
120000
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
// Verify installation by checking if executable exists
|
|
64
|
-
const verifyScript = `
|
|
65
|
-
$exePath = "C:\\Program Files\\GitButler\\gitbutler-tauri.exe"
|
|
66
|
-
if (Test-Path $exePath) {
|
|
67
|
-
Write-Host "GitButler installed successfully at $exePath"
|
|
68
|
-
} else {
|
|
69
|
-
Write-Error "GitButler not found"
|
|
70
|
-
exit 1
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
|
|
74
|
-
await testdriver.exec('pwsh', verifyScript, 5000);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## Running This Example
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
# Clone the TestDriver repository
|
|
83
|
-
git clone https://github.com/testdriverai/testdriverai
|
|
84
|
-
|
|
85
|
-
# Install dependencies
|
|
86
|
-
cd testdriverai
|
|
87
|
-
npm install
|
|
88
|
-
|
|
89
|
-
# Run this specific example
|
|
90
|
-
npx vitest run examples/windows-installer.test.mjs
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
<Note>
|
|
94
|
-
Make sure you have `TD_API_KEY` set in your environment. Get one at [testdriver.ai](https://testdriver.ai).
|
|
95
|
-
</Note>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TestDriver SDK - Formatted Logging Demo
|
|
3
|
-
* Demonstrates nice Vitest-style formatted logs for Dashcam replay
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, expect, it } from "vitest";
|
|
7
|
-
import { TestDriver } from "../lib/vitest/hooks.mjs";
|
|
8
|
-
import { getDefaults } from "./config.mjs";
|
|
9
|
-
|
|
10
|
-
describe("Formatted Logging Test", () => {
|
|
11
|
-
it("should demonstrate formatted logs in dashcam replay", async (context) => {
|
|
12
|
-
const testdriver = TestDriver(context, { ...getDefaults(context), headless: true });
|
|
13
|
-
await testdriver.provision.chrome({ url: 'http://testdriver-sandbox.vercel.app/login' });
|
|
14
|
-
|
|
15
|
-
// Find and click - logs will be nicely formatted
|
|
16
|
-
const signInButton = await testdriver.find(
|
|
17
|
-
"Sign In, black button below the password field",
|
|
18
|
-
);
|
|
19
|
-
await signInButton.click();
|
|
20
|
-
|
|
21
|
-
// Assert - logs will show pass/fail with nice formatting
|
|
22
|
-
const result = await testdriver.assert(
|
|
23
|
-
"an error shows that fields are required",
|
|
24
|
-
);
|
|
25
|
-
expect(result).toBeTruthy();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TestDriver SDK - Match Image Test (Vitest)
|
|
3
|
-
* Converted from: testdriver/acceptance/match-image.yaml
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import path, { dirname } from "path";
|
|
7
|
-
import { fileURLToPath } from "url";
|
|
8
|
-
import { describe, expect, it } from "vitest";
|
|
9
|
-
import { TestDriver } from "../lib/vitest/hooks.mjs";
|
|
10
|
-
import { getDefaults } from "./config.mjs";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Perform login flow for SauceLabs demo app
|
|
14
|
-
* @param {TestDriver} client - TestDriver client
|
|
15
|
-
* @param {string} username - Username (default: 'standard_user')
|
|
16
|
-
*/
|
|
17
|
-
async function performLogin(client, username = "standard_user") {
|
|
18
|
-
await client.focusApplication("Google Chrome");
|
|
19
|
-
const password = await client.extract("the password");
|
|
20
|
-
const usernameField = await client.find(
|
|
21
|
-
"username input",
|
|
22
|
-
);
|
|
23
|
-
await usernameField.click();
|
|
24
|
-
await client.type(username);
|
|
25
|
-
await client.pressKeys(["tab"]);
|
|
26
|
-
await client.type(password, { secret: true });
|
|
27
|
-
await client.pressKeys(["tab"]);
|
|
28
|
-
await client.pressKeys(["enter"]);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Get the directory of the current module
|
|
32
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
33
|
-
const __dirname = dirname(__filename);
|
|
34
|
-
|
|
35
|
-
describe("Match Image Test", () => {
|
|
36
|
-
it.skip("should match shopping cart image and verify empty cart", async (context) => {
|
|
37
|
-
const testdriver = TestDriver(context, { ...getDefaults(context), headless: true });
|
|
38
|
-
await testdriver.provision.chrome({ url: 'http://testdriver-sandbox.vercel.app/login' });
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
// Perform login first
|
|
42
|
-
await performLogin(testdriver);
|
|
43
|
-
|
|
44
|
-
// Match and click the shopping cart icon
|
|
45
|
-
const cartImagePath = path.resolve(
|
|
46
|
-
__dirname,
|
|
47
|
-
"../../_testdriver/acceptance/screenshots/cart.png",
|
|
48
|
-
);
|
|
49
|
-
await testdriver.matchImage(cartImagePath, "click");
|
|
50
|
-
|
|
51
|
-
// Assert that you see an empty shopping cart
|
|
52
|
-
const result = await testdriver.assert("Your cart is empty");
|
|
53
|
-
expect(result).toBeTruthy();
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { TestDriver } from "../lib/vitest/hooks.mjs";
|
|
3
|
-
import { getDefaults } from "../examples/config.mjs";
|
|
4
|
-
|
|
5
|
-
describe("Exec Log Streaming", () => {
|
|
6
|
-
it("should stream exec logs every second for 20 seconds", async (context) => {
|
|
7
|
-
const testdriver = TestDriver(context, { ...getDefaults(context), headless: true });
|
|
8
|
-
await testdriver.provision.chrome({ url: "about:blank" });
|
|
9
|
-
|
|
10
|
-
const code = `for i in $(seq 1 20); do echo "log line $i at $(date +%T)"; sleep 1; done`;
|
|
11
|
-
|
|
12
|
-
const result = await testdriver.exec({
|
|
13
|
-
language: "sh",
|
|
14
|
-
code,
|
|
15
|
-
timeout: 30000,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
console.log("exec result:", result);
|
|
19
|
-
|
|
20
|
-
// Verify we got all 20 log lines
|
|
21
|
-
for (let i = 1; i <= 20; i++) {
|
|
22
|
-
expect(result).toContain(`log line ${i}`);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
});
|