testdriverai 7.9.0-test.4 → 7.9.0-test.40

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.
Files changed (35) hide show
  1. package/agent/lib/sandbox.js +36 -5
  2. package/agent/lib/sdk.js +4 -4
  3. package/ai/skills/testdriver-enterprise/SKILL.md +2 -109
  4. package/ai/skills/testdriver-hosted/SKILL.md +156 -0
  5. package/ai/skills/testdriver-mcp/SKILL.md +2 -2
  6. package/ai/skills/testdriver-quickstart/SKILL.md +30 -2
  7. package/ai/skills/testdriver-self-hosted/SKILL.md +125 -43
  8. package/ai/skills/testdriver-test-results-json/SKILL.md +257 -0
  9. package/docs/_scripts/generate-examples.js +127 -60
  10. package/docs/docs.json +27 -28
  11. package/docs/v7/examples/ai.mdx +4 -3
  12. package/docs/v7/examples/assert.mdx +19 -4
  13. package/docs/v7/examples/chrome-extension.mdx +36 -29
  14. package/docs/v7/examples/element-not-found.mdx +2 -1
  15. package/docs/v7/examples/exec-output.mdx +3 -4
  16. package/docs/v7/examples/exec-pwsh.mdx +3 -4
  17. package/docs/v7/examples/findall-coffee-icons.mdx +88 -0
  18. package/docs/v7/examples/focus-window.mdx +3 -4
  19. package/docs/v7/examples/hover-image.mdx +4 -3
  20. package/docs/v7/examples/hover-text-with-description.mdx +104 -0
  21. package/docs/v7/examples/hover-text.mdx +4 -3
  22. package/docs/v7/examples/installer.mdx +5 -4
  23. package/docs/v7/examples/launch-vscode-linux.mdx +3 -7
  24. package/docs/v7/examples/match-image.mdx +3 -2
  25. package/docs/v7/examples/parse.mdx +66 -0
  26. package/docs/v7/examples/press-keys.mdx +8 -14
  27. package/docs/v7/examples/scroll-keyboard.mdx +4 -3
  28. package/docs/v7/examples/scroll-until-image.mdx +3 -2
  29. package/docs/v7/examples/scroll.mdx +6 -14
  30. package/docs/v7/examples/type.mdx +1 -5
  31. package/docs/v7/examples/windows-installer.mdx +10 -4
  32. package/interfaces/vitest-plugin.mjs +2 -2
  33. package/package.json +1 -1
  34. package/setup/aws/install-dev-runner.sh +7 -2
  35. package/setup/aws/spawn-runner.sh +12 -0
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
12
12
 
13
13
  {/* assert.test.mjs output */}
14
14
  <iframe
15
- src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c5d038058ffe89003c6adc/replay"
15
+ src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d038058ffe89003c6adc/replay"
16
16
  width="100%"
17
17
  height="390"
18
18
  style={{ border: "1px solid #333", borderRadius: "8px" }}
@@ -23,7 +23,8 @@ Watch this test execute in a real sandbox environment:
23
23
 
24
24
  ```javascript title="assert.test.mjs" {22-24}
25
25
  /**
26
- * TestDriver SDK - Assert Test
26
+ * TestDriver SDK - Assert Test (Vitest)
27
+ * Converted from: testdriver/acceptance/assert.yaml
27
28
  */
28
29
 
29
30
  import { describe, expect, it } from "vitest";
@@ -31,8 +32,7 @@ import { TestDriver } from "testdriverai/vitest/hooks";
31
32
 
32
33
  describe("Assert Test", () => {
33
34
  it("should assert the testdriver login page shows", async (context) => {
34
- const testdriver = TestDriver(context, {
35
- ip: context.ip || process.env.TD_IP,
35
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP,
36
36
  });
37
37
 
38
38
  // provision.chrome() automatically calls ready() and starts dashcam
@@ -50,6 +50,21 @@ describe("Assert Test", () => {
50
50
 
51
51
  expect(result).toBeTruthy();
52
52
  });
53
+ // it("should assert the testdriver login page shows 2", async (context) => {
54
+ // const testdriver = TestDriver(context);
55
+
56
+ // // provision.chrome() automatically calls ready() and starts dashcam
57
+ // await testdriver.provision.chrome({
58
+ // url: 'http://testdriver-sandbox.vercel.app/login',
59
+ // });
60
+
61
+ // // Assert the TestDriver.ai Sandbox login page is displayed
62
+ // const result = await testdriver.assert(
63
+ // "the TestDriver.ai Sandbox login page is displayed",
64
+ // );
65
+
66
+ // expect(result).toBeTruthy();
67
+ // });
53
68
  });
54
69
  ```
55
70
 
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
12
12
 
13
13
  {/* chrome-extension.test.mjs output */}
14
14
  <iframe
15
- src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c5d024c2e6e94933886763/replay"
15
+ src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d024c2e6e94933886763/replay"
16
16
  width="100%"
17
17
  height="390"
18
18
  style={{ border: "1px solid #333", borderRadius: "8px" }}
@@ -23,7 +23,12 @@ Watch this test execute in a real sandbox environment:
23
23
 
24
24
  ```javascript title="chrome-extension.test.mjs" {31-33}
25
25
  /**
26
- * TestDriver SDK - Chrome Extension Test
26
+ * TestDriver SDK - Chrome Extension Test (Vitest)
27
+ * Tests loading a Chrome extension using provision.chromeExtension()
28
+ *
29
+ * This test suite covers:
30
+ * 1. Loading extension from local path (extensionPath)
31
+ * 2. Loading extension from Chrome Web Store (extensionId)
27
32
  */
28
33
 
29
34
  import { describe, expect, it } from "vitest";
@@ -78,38 +83,40 @@ describe("Chrome Extension Test", () => {
78
83
  const helloExtension = await testdriver.find("Hello Extensions extension in the extensions dropdown");
79
84
  await helloExtension.click();
80
85
 
86
+ await testdriver.wait(2000); // wait for the popup to open
87
+
81
88
  // Verify the extension popup shows "Hello Extensions" text
82
89
  const popupResult = await testdriver.assert("a popup shows with the text 'Hello Extensions'");
83
90
  expect(popupResult).toBeTruthy();
84
91
  });
85
92
 
86
- it("should load Loom from Chrome Web Store by extensionId", async (context) => {
87
- const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP });
88
-
89
- // Launch Chrome with Loom loaded by its Chrome Web Store ID
90
- // Loom ID: liecbddmkiiihnedobmlmillhodjkdmb
91
- await testdriver.provision.chromeExtension({
92
- extensionId: 'liecbddmkiiihnedobmlmillhodjkdmb'
93
- });
94
-
95
- // Navigate to testdriver.ai (extensions don't load on New Tab)
96
- const addressBar = await testdriver.find("Chrome address bar");
97
- await addressBar.click();
98
- await testdriver.type("testdriver.ai");
99
- await testdriver.pressKeys(["enter"]);
100
-
101
- // Wait for page to load
102
- const pageResult = await testdriver.assert("I can see testdriver.ai");
103
- expect(pageResult).toBeTruthy();
104
-
105
- // Click on the extensions button (puzzle piece icon) in Chrome toolbar
106
- const extensionsButton = await testdriver.find("The puzzle-shaped icon in the Chrome toolbar.", {zoom: true});
107
- await extensionsButton.click();
108
-
109
- // Look for Loom in the extensions menu
110
- const loomExtension = await testdriver.find("Loom extension in the extensions dropdown");
111
- expect(loomExtension.found()).toBeTruthy();
112
- });
93
+ // it("should load Loom from Chrome Web Store by extensionId", async (context) => {
94
+ // const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP});
95
+
96
+ // // Launch Chrome with Loom loaded by its Chrome Web Store ID
97
+ // // Loom ID: liecbddmkiiihnedobmlmillhodjkdmb
98
+ // await testdriver.provision.chromeExtension({
99
+ // extensionId: 'liecbddmkiiihnedobmlmillhodjkdmb'
100
+ // });
101
+
102
+ // // Navigate to testdriver.ai (extensions don't load on New Tab)
103
+ // const addressBar = await testdriver.find("Chrome address bar");
104
+ // await addressBar.click();
105
+ // await testdriver.type("testdriver.ai");
106
+ // await testdriver.pressKeys(["enter"]);
107
+
108
+ // // Wait for page to load
109
+ // const pageResult = await testdriver.assert("I can see testdriver.ai");
110
+ // expect(pageResult).toBeTruthy();
111
+
112
+ // // Click on the extensions button (puzzle piece icon) in Chrome toolbar
113
+ // const extensionsButton = await testdriver.find("The puzzle-shaped icon in the Chrome toolbar.", {zoom: true});
114
+ // await extensionsButton.click();
115
+
116
+ // // Look for Loom in the extensions menu
117
+ // const loomExtension = await testdriver.find("Loom extension in the extensions dropdown");
118
+ // expect(loomExtension.found()).toBeTruthy();
119
+ // });
113
120
  });
114
121
  ```
115
122
 
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
12
12
 
13
13
  {/* element-not-found.test.mjs output */}
14
14
  <iframe
15
- src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c5d047058ffe89003c6ae4/replay"
15
+ src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d047058ffe89003c6ae4/replay"
16
16
  width="100%"
17
17
  height="390"
18
18
  style={{ border: "1px solid #333", borderRadius: "8px" }}
@@ -24,6 +24,7 @@ Watch this test execute in a real sandbox environment:
24
24
  ```javascript title="element-not-found.test.mjs" {16-18}
25
25
  /**
26
26
  * TestDriver SDK - Element Not Found Test
27
+ * Tests that finding a non-existent element returns properly without timing out
27
28
  */
28
29
 
29
30
  import { describe, expect, it } from "vitest";
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
12
12
 
13
13
  {/* exec-output.test.mjs output */}
14
14
  <iframe
15
- src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c5d02ee8a04db4b705cbeb/replay"
15
+ src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d02ee8a04db4b705cbeb/replay"
16
16
  width="100%"
17
17
  height="390"
18
18
  style={{ border: "1px solid #333", borderRadius: "8px" }}
@@ -28,14 +28,13 @@ Watch this test execute in a real sandbox environment:
28
28
  */
29
29
 
30
30
  import { describe, expect, it } from "vitest";
31
- import { TestDriver } from "../lib/vitest/hooks.mjs";
32
- import { getDefaults } from "./config.mjs";
31
+ import { TestDriver } from "testdriverai/vitest/hooks";
33
32
 
34
33
  describe.skip("Exec Output Test", () => {
35
34
  it(
36
35
  "should set date using PowerShell and navigate to calendar",
37
36
  async (context) => {
38
- const testdriver = TestDriver(context, { ...getDefaults(context), headless: true });
37
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP, headless: true });
39
38
  await testdriver.provision.chrome({ url: 'http://testdriver-sandbox.vercel.app/login' });
40
39
 
41
40
  //
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
12
12
 
13
13
  {/* exec-pwsh.test.mjs output */}
14
14
  <iframe
15
- src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c5d026a0a3ef8239de4746/replay"
15
+ src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d026a0a3ef8239de4746/replay"
16
16
  width="100%"
17
17
  height="390"
18
18
  style={{ border: "1px solid #333", borderRadius: "8px" }}
@@ -28,14 +28,13 @@ Watch this test execute in a real sandbox environment:
28
28
  */
29
29
 
30
30
  import { describe, expect, it } from "vitest";
31
- import { TestDriver } from "../lib/vitest/hooks.mjs";
32
- import { getDefaults } from "./config.mjs";
31
+ import { TestDriver } from "testdriverai/vitest/hooks";
33
32
 
34
33
  describe.skip("Exec PowerShell Test", () => {
35
34
  it(
36
35
  "should generate random email using PowerShell and enter it",
37
36
  async (context) => {
38
- const testdriver = TestDriver(context, { ...getDefaults(context), headless: true });
37
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP, headless: true });
39
38
  await testdriver.provision.chrome({ url: 'http://testdriver-sandbox.vercel.app/login' });
40
39
 
41
40
  //
@@ -0,0 +1,88 @@
1
+ ---
2
+ title: "FindAll Coffee Icons"
3
+ sidebarTitle: "Findall Coffee Icons"
4
+ description: "TestDriver SDK - FindAll Coffee Icons Test Loads a random icon grid and uses findAll() to locate and click all 4 coffee cup icons."
5
+ icon: "play"
6
+ ---
7
+
8
+ ## Overview
9
+
10
+ TestDriver SDK - FindAll Coffee Icons Test Loads a random icon grid and uses findAll() to locate and click all 4 coffee cup icons
11
+
12
+ Review the source code below to understand the implementation details and patterns used.
13
+
14
+ ## Live Test Run
15
+
16
+ Watch this test execute in a real sandbox environment:
17
+
18
+ {/* findall-coffee-icons.test.mjs output */}
19
+ <iframe
20
+ src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d03ae8a04db4b705cbf0/replay"
21
+ width="100%"
22
+ height="600"
23
+ style={{ border: "1px solid #333", borderRadius: "8px" }}
24
+ allow="fullscreen"
25
+ />
26
+
27
+ ## Source Code
28
+
29
+ ```javascript title="findall-coffee-icons.test.mjs"
30
+ /**
31
+ * TestDriver SDK - FindAll Coffee Icons Test
32
+ * Loads a random icon grid and uses findAll() to locate and click all 4 coffee cup icons
33
+ */
34
+
35
+ import { describe, expect, it } from "vitest";
36
+ import { TestDriver } from "testdriverai/vitest/hooks";
37
+
38
+ describe("FindAll Coffee Icons", () => {
39
+ it("should find and click all 4 coffee cup icons", async (context) => {
40
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP,
41
+ headless: true,
42
+ });
43
+
44
+ await testdriver.provision.chrome({
45
+ url: "https://v0-random-icon-grid.vercel.app/",
46
+ });
47
+
48
+ // Use findAll to locate all coffee cup icons on the page
49
+ const coffeeIcons = await testdriver.findAll("coffee cup icon, there are exactly 4 on the page");
50
+
51
+ // Log each icon's coordinates
52
+ console.log(`Found ${coffeeIcons.length} coffee icons:`);
53
+ coffeeIcons.forEach((icon, i) => {
54
+ console.log(` Icon ${i + 1}: (${icon.x}, ${icon.y}) center=(${icon.centerX}, ${icon.centerY})`);
55
+ });
56
+
57
+ // Verify we found 3 or 4 coffee icons
58
+ expect(coffeeIcons.length).toBeGreaterThanOrEqual(3);
59
+ expect(coffeeIcons.length).toBeLessThanOrEqual(4);
60
+
61
+ // Click each coffee cup icon
62
+ for (const icon of coffeeIcons) {
63
+ await icon.click();
64
+ }
65
+
66
+ // Verify the selection count is displayed
67
+ await testdriver.assert("the page says 'Selected: 3 / 4' or 'Matched 4 of a kind!'");
68
+ });
69
+ });
70
+ ```
71
+
72
+ ## Running This Example
73
+
74
+ ```bash
75
+ # Clone the TestDriver repository
76
+ git clone https://github.com/testdriverai/testdriverai
77
+
78
+ # Install dependencies
79
+ cd testdriverai
80
+ npm install
81
+
82
+ # Run this specific example
83
+ npx vitest run examples/findall-coffee-icons.test.mjs
84
+ ```
85
+
86
+ <Note>
87
+ Make sure you have `TD_API_KEY` set in your environment. Get one at [testdriver.ai](https://testdriver.ai).
88
+ </Note>
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
12
12
 
13
13
  {/* focus-window.test.mjs output */}
14
14
  <iframe
15
- src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c5d042e8a04db4b705cbf2/replay"
15
+ src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d042e8a04db4b705cbf2/replay"
16
16
  width="100%"
17
17
  height="390"
18
18
  style={{ border: "1px solid #333", borderRadius: "8px" }}
@@ -28,14 +28,13 @@ Watch this test execute in a real sandbox environment:
28
28
  */
29
29
 
30
30
  import { describe, expect, it } from "vitest";
31
- import { TestDriver } from "../lib/vitest/hooks.mjs";
32
- import { getDefaults } from "./config.mjs";
31
+ import { TestDriver } from "testdriverai/vitest/hooks";
33
32
 
34
33
  describe("Focus Window Test", () => {
35
34
  it.skip(
36
35
  "should click Microsoft Edge icon and focus Google Chrome",
37
36
  async (context) => {
38
- const testdriver = TestDriver(context, { ...getDefaults(context), headless: true });
37
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP, headless: true });
39
38
  await testdriver.provision.chrome({ url: 'http://testdriver-sandbox.vercel.app/login' });
40
39
 
41
40
  //
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
12
12
 
13
13
  {/* hover-image.test.mjs output */}
14
14
  <iframe
15
- src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c5d0300201196437256cd3/replay"
15
+ src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d0300201196437256cd3/replay"
16
16
  width="100%"
17
17
  height="390"
18
18
  style={{ border: "1px solid #333", borderRadius: "8px" }}
@@ -23,7 +23,8 @@ Watch this test execute in a real sandbox environment:
23
23
 
24
24
  ```javascript title="hover-image.test.mjs" {40-42,47}
25
25
  /**
26
- * TestDriver SDK - Hover Image Test
26
+ * TestDriver SDK - Hover Image Test (Vitest)
27
+ * Converted from: testdriver/acceptance/hover-image.yaml
27
28
  */
28
29
 
29
30
  import { describe, expect, it } from "vitest";
@@ -50,7 +51,7 @@ async function performLogin(client, username = "standard_user") {
50
51
 
51
52
  describe("Hover Image Test", () => {
52
53
  it("should click on shopping cart icon and verify empty cart", async (context) => {
53
- const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP, redraw: false });
54
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP});
54
55
 
55
56
  // provision.chrome() automatically calls ready() and starts dashcam
56
57
  await testdriver.provision.chrome({
@@ -0,0 +1,104 @@
1
+ ---
2
+ title: "Hover Text With Description Test"
3
+ sidebarTitle: "Hover Text With Description"
4
+ description: "TestDriver SDK - Hover Text With Description Test (Vitest) Converted from: testdriver/acceptance/hover-text-with-description.yaml."
5
+ icon: "hand-pointer"
6
+ mode: "wide"
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ TestDriver SDK - Hover Text With Description Test (Vitest) Converted from: testdriver/acceptance/hover-text-with-description.yaml
12
+
13
+ Review the source code below to understand the implementation details and patterns used.
14
+
15
+ ## Live Test Run
16
+
17
+ Watch this test execute in a real sandbox environment:
18
+
19
+ {/* hover-text-with-description.test.mjs output */}
20
+ <iframe
21
+ src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d029c2e6e94933886764/replay"
22
+ width="100%"
23
+ height="600"
24
+ style={{ border: "1px solid #333", borderRadius: "8px" }}
25
+ allow="fullscreen"
26
+ />
27
+
28
+ ## Source Code
29
+
30
+ ```javascript title="hover-text-with-description.test.mjs"
31
+ /**
32
+ * TestDriver SDK - Hover Text With Description Test (Vitest)
33
+ * Converted from: testdriver/acceptance/hover-text-with-description.yaml
34
+ */
35
+
36
+ import { describe, expect, it } from "vitest";
37
+ import { TestDriver } from "testdriverai/vitest/hooks";
38
+
39
+ /**
40
+ * Perform login flow for SauceLabs demo app
41
+ * @param {TestDriver} client - TestDriver client
42
+ * @param {string} username - Username (default: 'standard_user')
43
+ */
44
+ async function performLogin(client, username = "standard_user") {
45
+ await client.focusApplication("Google Chrome");
46
+ const password = await client.extract("the password");
47
+ const usernameField = await client.find("username input");
48
+ await usernameField.click();
49
+ await client.type(username);
50
+ await client.pressKeys(["tab"]);
51
+ await client.type(password, { secret: true });
52
+ await client.pressKeys(["tab"]);
53
+ await client.pressKeys(["enter"]);
54
+ }
55
+
56
+ describe("Hover Text With Description Test", () => {
57
+ it("should add TestDriver Hat to cart and verify", async (context) => {
58
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP,
59
+ headless: true,
60
+ });
61
+ await testdriver.provision.chrome({
62
+ url: "http://testdriver-sandbox.vercel.app/login",
63
+ });
64
+
65
+ //
66
+ // Perform login first
67
+ await performLogin(testdriver);
68
+
69
+ // Click on "Add to Cart" under TestDriver Hat
70
+ const addToCartButton = await testdriver.find(
71
+ "Add to Cart, add to cart button under TestDriver Hat",
72
+ );
73
+ await addToCartButton.click();
74
+
75
+ // Click on the cart
76
+ const cartButton = await testdriver.find(
77
+ "Cart, cart button in the top right corner",
78
+ );
79
+ await cartButton.click();
80
+
81
+ // Assert the TestDriver Hat is in the cart
82
+ const result = await testdriver.assert("There is an item in the cart");
83
+ expect(result).toBeTruthy();
84
+ });
85
+ });
86
+ ```
87
+
88
+ ## Running This Example
89
+
90
+ ```bash
91
+ # Clone the TestDriver repository
92
+ git clone https://github.com/testdriverai/testdriverai
93
+
94
+ # Install dependencies
95
+ cd testdriverai
96
+ npm install
97
+
98
+ # Run this specific example
99
+ npx vitest run examples/hover-text-with-description.test.mjs
100
+ ```
101
+
102
+ <Note>
103
+ Make sure you have `TD_API_KEY` set in your environment. Get one at [testdriver.ai](https://testdriver.ai).
104
+ </Note>
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
12
12
 
13
13
  {/* hover-text.test.mjs output */}
14
14
  <iframe
15
- src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c5d04b0201196437256ce6/replay"
15
+ src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d04b0201196437256ce6/replay"
16
16
  width="100%"
17
17
  height="390"
18
18
  style={{ border: "1px solid #333", borderRadius: "8px" }}
@@ -23,7 +23,8 @@ Watch this test execute in a real sandbox environment:
23
23
 
24
24
  ```javascript title="hover-text.test.mjs" {13-15,18-20}
25
25
  /**
26
- * TestDriver SDK - Hover Text Test
26
+ * TestDriver SDK - Hover Text Test (Vitest)
27
+ * Converted from: testdriver/acceptance/hover-text.yaml
27
28
  */
28
29
 
29
30
  import { describe, expect, it } from "vitest";
@@ -31,7 +32,7 @@ import { TestDriver } from "testdriverai/vitest/hooks";
31
32
 
32
33
  describe("Hover Text Test", () => {
33
34
  it("should click Sign In and verify error message", async (context) => {
34
- const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP });
35
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP});
35
36
  await testdriver.provision.chrome({ url: 'http://testdriver-sandbox.vercel.app/login' });
36
37
 
37
38
  // Click on Sign In button using new find() API
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
12
12
 
13
13
  {/* installer.test.mjs output */}
14
14
  <iframe
15
- src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c5d032c2e6e94933886769/replay"
15
+ src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d032c2e6e94933886769/replay"
16
16
  width="100%"
17
17
  height="390"
18
18
  style={{ border: "1px solid #333", borderRadius: "8px" }}
@@ -23,7 +23,8 @@ Watch this test execute in a real sandbox environment:
23
23
 
24
24
  ```javascript title="installer.test.mjs" {16-18}
25
25
  /**
26
- * TestDriver SDK - Installer Test
26
+ * TestDriver SDK - Installer Test (Vitest)
27
+ * Tests the provision.installer() method for downloading and installing apps
27
28
  */
28
29
 
29
30
  import { describe, expect, it } from "vitest";
@@ -35,7 +36,7 @@ describe("Provision Installer", () => {
35
36
  it.skipIf(!isLinux)(
36
37
  "should download and install a .deb package on Linux",
37
38
  async (context) => {
38
- const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP });
39
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP});
39
40
 
40
41
  // Install bat (a cat clone with syntax highlighting) using provision.installer
41
42
  const filePath = await testdriver.provision.installer({
@@ -53,7 +54,7 @@ describe("Provision Installer", () => {
53
54
  it.skipIf(!isLinux)(
54
55
  "should download a shell script and verify it exists",
55
56
  async (context) => {
56
- const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP });
57
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP});
57
58
 
58
59
  // Download a shell script (nvm installer)
59
60
  const filePath = await testdriver.provision.installer({
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
12
12
 
13
13
  {/* launch-vscode-linux.test.mjs output */}
14
14
  <iframe
15
- src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c5d02be8a04db4b705cbe5/replay"
15
+ src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d02be8a04db4b705cbe5/replay"
16
16
  width="100%"
17
17
  height="390"
18
18
  style={{ border: "1px solid #333", borderRadius: "8px" }}
@@ -22,10 +22,6 @@ Watch this test execute in a real sandbox environment:
22
22
  ## Source Code
23
23
 
24
24
  ```javascript title="launch-vscode-linux.test.mjs" {13,27-29}
25
- /**
26
- * TestDriver SDK - Launch VS Code Test
27
- */
28
-
29
25
  import { describe, expect, it } from "vitest";
30
26
  import { TestDriver } from "testdriverai/vitest/hooks";
31
27
 
@@ -35,7 +31,7 @@ describe("Launch VS Code on Linux", () => {
35
31
  it.skipIf(!isLinux)(
36
32
  "should launch VS Code on Debian/Ubuntu",
37
33
  async (context) => {
38
- const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP });
34
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP});
39
35
 
40
36
  // provision.vscode() automatically calls ready() and starts dashcam
41
37
  await testdriver.provision.vscode();
@@ -52,7 +48,7 @@ describe("Launch VS Code on Linux", () => {
52
48
  it.skipIf(!isLinux)(
53
49
  "should install and use a VS Code extension",
54
50
  async (context) => {
55
- const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP });
51
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP});
56
52
 
57
53
  // Launch VS Code with the Prettier extension installed
58
54
  await testdriver.provision.vscode({
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
12
12
 
13
13
  {/* match-image.test.mjs output */}
14
14
  <iframe
15
- src="https://api-test.testdriver.ai/api/v1/testdriver/testcase/69c5d0270201196437256ccf/replay"
15
+ src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d0270201196437256ccf/replay"
16
16
  width="100%"
17
17
  height="390"
18
18
  style={{ border: "1px solid #333", borderRadius: "8px" }}
@@ -23,7 +23,8 @@ Watch this test execute in a real sandbox environment:
23
23
 
24
24
  ```javascript title="match-image.test.mjs" {42}
25
25
  /**
26
- * TestDriver SDK - Match Image Test
26
+ * TestDriver SDK - Match Image Test (Vitest)
27
+ * Converted from: testdriver/acceptance/match-image.yaml
27
28
  */
28
29
 
29
30
  import path, { dirname } from "path";
@@ -0,0 +1,66 @@
1
+ ---
2
+ title: "Parse Test"
3
+ sidebarTitle: "Parse"
4
+ description: "TestDriver SDK - Parse Test (Vitest) Opens Airbnb and runs the .parse() SDK command to analyze the screen."
5
+ icon: "play"
6
+ ---
7
+
8
+ ## Overview
9
+
10
+ TestDriver SDK - Parse Test (Vitest) Opens Airbnb and runs the .parse() SDK command to analyze the screen.
11
+
12
+ Review the source code below to understand the implementation details and patterns used.
13
+
14
+ ## Live Test Run
15
+
16
+ Watch this test execute in a real sandbox environment:
17
+
18
+ {/* parse.test.mjs output */}
19
+ <iframe
20
+ src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d04d0201196437256ce7/replay"
21
+ width="100%"
22
+ height="600"
23
+ style={{ border: "1px solid #333", borderRadius: "8px" }}
24
+ allow="fullscreen"
25
+ />
26
+
27
+ ## Source Code
28
+
29
+ ```javascript title="parse.test.mjs"
30
+ /**
31
+ * TestDriver SDK - Parse Test (Vitest)
32
+ * Opens Airbnb and runs the .parse() SDK command to analyze the screen.
33
+ */
34
+
35
+ import { describe, it } from "vitest";
36
+ import { TestDriver } from "testdriverai/vitest/hooks";
37
+
38
+ describe("Parse Test", () => {
39
+ it("should open Airbnb and parse the screen", async (context) => {
40
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP});
41
+ await testdriver.provision.chrome({ url: "https://www.airbnb.com" });
42
+
43
+ // The SDK automatically outputs elements as a formatted table
44
+ const result = await testdriver.parse();
45
+ console.log(`Found ${result.elements?.length || 0} elements`);
46
+ });
47
+ });
48
+ ```
49
+
50
+ ## Running This Example
51
+
52
+ ```bash
53
+ # Clone the TestDriver repository
54
+ git clone https://github.com/testdriverai/testdriverai
55
+
56
+ # Install dependencies
57
+ cd testdriverai
58
+ npm install
59
+
60
+ # Run this specific example
61
+ npx vitest run examples/parse.test.mjs
62
+ ```
63
+
64
+ <Note>
65
+ Make sure you have `TD_API_KEY` set in your environment. Get one at [testdriver.ai](https://testdriver.ai).
66
+ </Note>