testdriverai 7.2.29 → 7.2.30

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/README.md CHANGED
@@ -49,7 +49,7 @@ expect(result).toBeTruthy();
49
49
 
50
50
  ### Step 1: Create a TestDriver Account
51
51
 
52
- <a href="https://app.testdriver.ai/team"><img src="https://img.shields.io/badge/Sign_Up-Free_Account-blue?style=for-the-badge" alt="Sign Up"/></a>
52
+ <a href="https://console.testdriver.ai/team"><img src="https://img.shields.io/badge/Sign_Up-Free_Account-blue?style=for-the-badge" alt="Sign Up"/></a>
53
53
 
54
54
  *No credit card required!*
55
55
 
package/docs/docs.json CHANGED
@@ -294,7 +294,7 @@
294
294
  {
295
295
  "icon": "gauge-high",
296
296
  "label": "Dashboard",
297
- "href": "https://app.testdriver.ai"
297
+ "href": "https://console.testdriver.ai"
298
298
  }
299
299
  ]
300
300
  },
@@ -22,7 +22,7 @@ TestDriver makes it easy to write automated computer-use tests for web browsers,
22
22
  <Card
23
23
  title="Sign Up for TestDriver"
24
24
  icon="user-plus"
25
- href="https://app.testdriver.ai/team"
25
+ href="https://console.testdriver.ai/team"
26
26
  arrow
27
27
  horizontal
28
28
  >
@@ -67,7 +67,7 @@ TestDriver makes it easy to write automated computer-use tests for web browsers,
67
67
  <Card
68
68
  title="Sign Up for TestDriver"
69
69
  icon="user-plus"
70
- href="https://app.testdriver.ai/team"
70
+ href="https://console.testdriver.ai/team"
71
71
  arrow
72
72
  horizontal
73
73
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "7.2.29",
3
+ "version": "7.2.30",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "sdk.js",
6
6
  "exports": {
@@ -0,0 +1,110 @@
1
+ /**
2
+ * TestDriver SDK - API Resilience Test
3
+ *
4
+ * This test verifies that TestDriver client can handle API restarts gracefully.
5
+ * It will:
6
+ * 1. Start a sandbox and browser
7
+ * 2. Make some API calls (TestDriver operations)
8
+ * 3. Kill the API (dev.sh)
9
+ * 4. Restart the API
10
+ * 5. Continue making API calls and verify they work
11
+ *
12
+ * Usage:
13
+ * npm test -- test/api-resilience.test.mjs
14
+ */
15
+
16
+ import { describe, expect, it } from "vitest";
17
+ import { TestDriver } from "../lib/vitest/hooks.mjs";
18
+ import { spawn, exec } from 'child_process';
19
+ import { promisify } from 'util';
20
+
21
+ const execAsync = promisify(exec);
22
+
23
+ describe("API Resilience Test", () => {
24
+ it("should continue working after API restart", async (context) => {
25
+ const testdriver = TestDriver(context, {
26
+ newSandbox: true,
27
+ headless: false
28
+ });
29
+
30
+ console.log("\nšŸ“‹ Step 1: Provision Chrome and navigate to test page");
31
+ await testdriver.provision.chrome({
32
+ url: 'http://testdriver-sandbox.vercel.app/login',
33
+ });
34
+
35
+ console.log("āœ… Provisioned successfully");
36
+
37
+ console.log("\nšŸ“‹ Step 2: Perform initial test operations");
38
+ const button1 = await testdriver.find("Sign In button");
39
+ console.log("āœ… Found Sign In button:", button1.found());
40
+ expect(button1.found()).toBe(true);
41
+
42
+ const result1 = await testdriver.assert("I can see a login page");
43
+ console.log("āœ… First assertion passed:", result1);
44
+ expect(result1).toBeTruthy();
45
+
46
+ console.log("\nšŸ“‹ Step 3: Simulate API going down");
47
+ console.log("āš ļø Killing dev.sh process...");
48
+
49
+ try {
50
+ // Kill all node processes running app.js (the API server)
51
+ await execAsync("pkill -f 'node.*app.js'");
52
+ console.log("āœ… API killed");
53
+ } catch (error) {
54
+ // pkill returns non-zero exit code if no processes found, which is okay
55
+ console.log("Note: No app.js processes found to kill (or already killed)");
56
+ }
57
+
58
+ // Wait a bit to ensure API is down
59
+ console.log("ā³ Waiting 3 seconds to ensure API is down...");
60
+ await new Promise(resolve => setTimeout(resolve, 3000));
61
+
62
+ console.log("\nšŸ“‹ Step 4: Restart API");
63
+ console.log("šŸ”„ Starting dev.sh...");
64
+
65
+ // Start dev.sh in background
66
+ const apiProcess = spawn('bash', ['dev.sh'], {
67
+ cwd: '/Users/ianjennings/Development/api',
68
+ detached: true,
69
+ stdio: 'ignore'
70
+ });
71
+
72
+ // Unref so the process doesn't keep this test running
73
+ apiProcess.unref();
74
+
75
+ console.log("āœ… API restarted (PID:", apiProcess.pid, ")");
76
+
77
+ // Wait for API to be ready
78
+ console.log("ā³ Waiting 10 seconds for API to initialize...");
79
+ await new Promise(resolve => setTimeout(resolve, 10000));
80
+
81
+ console.log("\nšŸ“‹ Step 5: Continue test operations after API restart");
82
+ console.log("šŸ”„ Attempting to find element again...");
83
+
84
+ const button2 = await testdriver.find("Sign In button");
85
+ console.log("āœ… Found Sign In button again:", button2.found());
86
+ expect(button2.found()).toBe(true);
87
+
88
+ console.log("šŸ”„ Performing another assertion...");
89
+ const result2 = await testdriver.assert("I can see a login page");
90
+ console.log("āœ… Second assertion passed:", result2);
91
+ expect(result2).toBeTruthy();
92
+
93
+ console.log("\nšŸ“‹ Step 6: Perform additional operations to verify full functionality");
94
+ const emailInput = await testdriver.find("email input field");
95
+ console.log("āœ… Found email input:", emailInput.found());
96
+ expect(emailInput.found()).toBe(true);
97
+
98
+ await emailInput.click();
99
+ await testdriver.type("test@example.com");
100
+ console.log("āœ… Typed into email field");
101
+
102
+ const result3 = await testdriver.assert("the email field contains text");
103
+ console.log("āœ… Final assertion passed:", result3);
104
+ expect(result3).toBeTruthy();
105
+
106
+ console.log("\nšŸŽ‰ Test completed successfully! API resilience verified.");
107
+ });
108
+ }, {
109
+ timeout: 120000 // 2 minute timeout for this test
110
+ });