testdriverai 7.2.30 ā 7.2.32
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/lib/commands.js +2 -1
- package/docs/GITHUB_COMMENTS.md +1 -1
- package/docs/snippets/tests/type-repeated-replay.mdx +1 -1
- package/docs/v7/client.mdx +1 -1
- package/docs/v7/quickstart.mdx +2 -2
- package/package.json +1 -1
- package/test/api-resilience.test.mjs +0 -110
- package/test/testdriver/scroll-keyboard.test.mjs +1 -1
- package/test/testdriver/scroll.test.mjs +1 -1
package/agent/lib/commands.js
CHANGED
|
@@ -356,8 +356,9 @@ const createCommands = (
|
|
|
356
356
|
);
|
|
357
357
|
|
|
358
358
|
// Wait for redraw and track duration
|
|
359
|
+
// Increase timeout for scroll operations as they can take 1-2 seconds to complete
|
|
359
360
|
const redrawStartTime = Date.now();
|
|
360
|
-
await redraw.wait(
|
|
361
|
+
await redraw.wait(5000, redrawOptions);
|
|
361
362
|
const redrawDuration = Date.now() - redrawStartTime;
|
|
362
363
|
|
|
363
364
|
const after = await system.captureScreenBase64();
|
package/docs/GITHUB_COMMENTS.md
CHANGED
|
@@ -273,7 +273,7 @@ Posts or updates a GitHub comment with test results.
|
|
|
273
273
|
- `prNumber` (number): PR number (optional)
|
|
274
274
|
- `commitSha` (string): Commit SHA (optional)
|
|
275
275
|
|
|
276
|
-
**Returns:** Promise<Object
|
|
276
|
+
**Returns:** `Promise<Object>` - GitHub API response
|
|
277
277
|
|
|
278
278
|
## Examples
|
|
279
279
|
|
package/docs/v7/client.mdx
CHANGED
|
@@ -127,7 +127,7 @@ await testdriver.connect(options)
|
|
|
127
127
|
</Expandable>
|
|
128
128
|
</ParamField>
|
|
129
129
|
|
|
130
|
-
**Returns:** `Promise
|
|
130
|
+
**Returns:** `Promise<Object>` - Sandbox instance details including `instanceId`, `ip`, `vncPort`, etc.
|
|
131
131
|
|
|
132
132
|
#### Examples
|
|
133
133
|
|
package/docs/v7/quickstart.mdx
CHANGED
|
@@ -65,13 +65,13 @@ TestDriver makes it easy to write automated computer-use tests for web browsers,
|
|
|
65
65
|
You will need a TestDriver account to get an API key.
|
|
66
66
|
|
|
67
67
|
<Card
|
|
68
|
-
title="
|
|
68
|
+
title="Get an API Key"
|
|
69
69
|
icon="user-plus"
|
|
70
70
|
href="https://console.testdriver.ai/team"
|
|
71
71
|
arrow
|
|
72
72
|
horizontal
|
|
73
73
|
>
|
|
74
|
-
|
|
74
|
+
Start with 60 free device minutes, no credit-card required!
|
|
75
75
|
</Card>
|
|
76
76
|
|
|
77
77
|
</Step>
|
package/package.json
CHANGED
|
@@ -1,110 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -31,7 +31,7 @@ describe("Scroll Keyboard Test", () => {
|
|
|
31
31
|
|
|
32
32
|
// Assert the page is scrolled down
|
|
33
33
|
const result = await testdriver.assert(
|
|
34
|
-
"the hamster dance
|
|
34
|
+
"the text 'the hamster dance' is not visible on the webpage",
|
|
35
35
|
);
|
|
36
36
|
expect(result).toBeTruthy();
|
|
37
37
|
});
|
|
@@ -35,7 +35,7 @@ describe("Scroll Test", () => {
|
|
|
35
35
|
await testdriver.scroll("down", { amount: 1000 });
|
|
36
36
|
|
|
37
37
|
// Assert page is scrolled
|
|
38
|
-
const result = await testdriver.assert("the page is scrolled down, the hamster dance heading is not visible on the
|
|
38
|
+
const result = await testdriver.assert("the page is scrolled down, the hamster dance h1 text heading is not visible on the webpage");
|
|
39
39
|
expect(result).toBeTruthy();
|
|
40
40
|
});
|
|
41
41
|
});
|