testdriverai 7.2.41 → 7.2.43
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/agents.md +5 -10
- package/docs/docs.json +1 -1
- package/docs/v6/getting-started/self-hosting.mdx +1 -1
- package/docs/v7/_drafts/screenshot.mdx +1 -1
- package/docs/v7/_drafts/self-hosting.mdx +1 -1
- package/docs/v7/ai.mdx +1 -1
- package/docs/v7/assert.mdx +1 -1
- package/docs/v7/aws-setup.mdx +1 -1
- package/docs/v7/click.mdx +1 -1
- package/docs/v7/client.mdx +3 -3
- package/docs/v7/customizing-devices.mdx +20 -0
- package/docs/v7/device-config.mdx +4 -4
- package/docs/v7/exec.mdx +1 -1
- package/docs/v7/find.mdx +1 -1
- package/docs/v7/focus-application.mdx +1 -1
- package/docs/v7/hover.mdx +1 -1
- package/docs/v7/press-keys.mdx +1 -1
- package/docs/v7/reusable-code.mdx +4 -4
- package/docs/v7/scroll.mdx +1 -1
- package/docs/v7/type.mdx +1 -1
- package/package.json +1 -1
- package/sdk.js +4 -1
- package/test/testdriver/assert.test.mjs +1 -1
package/agents.md
CHANGED
|
@@ -41,8 +41,8 @@ import { TestDriver } from "testdriverai/lib/vitest/hooks.mjs";
|
|
|
41
41
|
|
|
42
42
|
describe("My Test Suite", () => {
|
|
43
43
|
it("should do something", async (context) => {
|
|
44
|
-
// Initialize TestDriver
|
|
45
|
-
const testdriver = TestDriver(context
|
|
44
|
+
// Initialize TestDriver
|
|
45
|
+
const testdriver = TestDriver(context);
|
|
46
46
|
|
|
47
47
|
// Start with provision - this launches the sandbox and browser
|
|
48
48
|
await testdriver.provision.chrome({
|
|
@@ -175,10 +175,7 @@ describe("Setup State", () => {
|
|
|
175
175
|
});
|
|
176
176
|
|
|
177
177
|
it("should set up the application state", async (context) => {
|
|
178
|
-
const testdriver = TestDriver(context
|
|
179
|
-
newSandbox: true,
|
|
180
|
-
headless: false
|
|
181
|
-
});
|
|
178
|
+
const testdriver = TestDriver(context);
|
|
182
179
|
|
|
183
180
|
await testdriver.provision.chrome({
|
|
184
181
|
url: 'https://your-app.com/login',
|
|
@@ -219,8 +216,6 @@ describe("Experiment", () => {
|
|
|
219
216
|
|
|
220
217
|
it("should continue from existing state", async (context) => {
|
|
221
218
|
const testdriver = TestDriver(context, {
|
|
222
|
-
newSandbox: true,
|
|
223
|
-
headless: false,
|
|
224
219
|
reconnect: true // ← Key: reconnects to last sandbox
|
|
225
220
|
});
|
|
226
221
|
|
|
@@ -278,7 +273,7 @@ import { TestDriver } from "testdriverai/lib/vitest/hooks.mjs";
|
|
|
278
273
|
|
|
279
274
|
describe("Login Flow", () => {
|
|
280
275
|
it("should log in and open settings", async (context) => {
|
|
281
|
-
const testdriver = TestDriver(context
|
|
276
|
+
const testdriver = TestDriver(context);
|
|
282
277
|
|
|
283
278
|
await testdriver.provision.chrome({ url: 'https://your-app.com/login' });
|
|
284
279
|
|
|
@@ -310,7 +305,7 @@ describe("Login Flow", () => {
|
|
|
310
305
|
```javascript
|
|
311
306
|
// Development workflow example
|
|
312
307
|
it("should incrementally build test", async (context) => {
|
|
313
|
-
const testdriver = TestDriver(context
|
|
308
|
+
const testdriver = TestDriver(context);
|
|
314
309
|
await testdriver.provision.chrome({ url: 'https://example.com' });
|
|
315
310
|
|
|
316
311
|
// Step 1: Find and inspect
|
package/docs/docs.json
CHANGED
|
@@ -47,7 +47,7 @@ The setup process involves three main steps:
|
|
|
47
47
|
Be sure to run `aws configure` with your credentials
|
|
48
48
|
</Tip>
|
|
49
49
|
- Access to the TestDriver AMI (Golden Image is `ami-086b5b4b86d78987c`)\
|
|
50
|
-
[Contact us with your preferred AWS Region for access](
|
|
50
|
+
[Contact us with your preferred AWS Region for access](http://testdriver.ai/demo).
|
|
51
51
|
- A GitHub repository for committing your tests & workflow.
|
|
52
52
|
|
|
53
53
|
## Step 1: Set Up AWS Infrastructure
|
|
@@ -113,7 +113,7 @@ const screenshot = await testdriver.screenshot(1, false, true);
|
|
|
113
113
|
|
|
114
114
|
```javascript
|
|
115
115
|
it('should complete checkout', async (context) => {
|
|
116
|
-
const testdriver = TestDriver(context
|
|
116
|
+
const testdriver = TestDriver(context);
|
|
117
117
|
await testdriver.provision.chrome({ url: 'https://shop.example.com' });
|
|
118
118
|
|
|
119
119
|
try {
|
|
@@ -47,7 +47,7 @@ The setup process involves three main steps:
|
|
|
47
47
|
Be sure to run `aws configure` with your credentials
|
|
48
48
|
</Tip>
|
|
49
49
|
- Access to the TestDriver AMI (Golden Image is `ami-055cd47506a2f39bb`)\
|
|
50
|
-
[Contact us with your preferred AWS Region for access](
|
|
50
|
+
[Contact us with your preferred AWS Region for access](http://testdriver.ai/demo).
|
|
51
51
|
- A GitHub repository for committing your tests & workflow.
|
|
52
52
|
|
|
53
53
|
## Step 1: Set Up AWS Infrastructure
|
package/docs/v7/ai.mdx
CHANGED
|
@@ -167,7 +167,7 @@ describe('E-commerce Flow with AI', () => {
|
|
|
167
167
|
beforeAll(async () => {
|
|
168
168
|
client = new TestDriver(process.env.TD_API_KEY);
|
|
169
169
|
await testdriver.auth();
|
|
170
|
-
await testdriver.connect(
|
|
170
|
+
await testdriver.connect();
|
|
171
171
|
});
|
|
172
172
|
|
|
173
173
|
afterAll(async () => {
|
package/docs/v7/assert.mdx
CHANGED
package/docs/v7/aws-setup.mdx
CHANGED
|
@@ -40,7 +40,7 @@ Before you begin, ensure you have:
|
|
|
40
40
|
|
|
41
41
|
- AWS account with CloudFormation permissions
|
|
42
42
|
- [AWS CLI](https://aws.amazon.com/cli/) installed and configured (`aws configure`)
|
|
43
|
-
- Access to the TestDriver AMI — [Contact us](
|
|
43
|
+
- Access to the TestDriver AMI — [Contact us](http://testdriver.ai/demo) with your AWS region
|
|
44
44
|
- A GitHub repository for your tests
|
|
45
45
|
|
|
46
46
|
<Tip>
|
package/docs/v7/click.mdx
CHANGED
|
@@ -235,7 +235,7 @@ describe('Click Interactions', () => {
|
|
|
235
235
|
beforeAll(async () => {
|
|
236
236
|
client = new TestDriver(process.env.TD_API_KEY);
|
|
237
237
|
await testdriver.auth();
|
|
238
|
-
await testdriver.connect(
|
|
238
|
+
await testdriver.connect();
|
|
239
239
|
});
|
|
240
240
|
|
|
241
241
|
afterAll(async () => {
|
package/docs/v7/client.mdx
CHANGED
|
@@ -133,7 +133,7 @@ await testdriver.connect(options)
|
|
|
133
133
|
|
|
134
134
|
**Basic connection:**
|
|
135
135
|
```javascript
|
|
136
|
-
await testdriver.connect(
|
|
136
|
+
await testdriver.connect();
|
|
137
137
|
```
|
|
138
138
|
|
|
139
139
|
**Reconnect to existing sandbox:**
|
|
@@ -273,7 +273,7 @@ describe('My Test Suite', () => {
|
|
|
273
273
|
|
|
274
274
|
// Authenticate and connect
|
|
275
275
|
await testdriver.auth();
|
|
276
|
-
const instance = await testdriver.connect(
|
|
276
|
+
const instance = await testdriver.connect();
|
|
277
277
|
|
|
278
278
|
console.log('Connected to sandbox:', instance.instanceId);
|
|
279
279
|
});
|
|
@@ -300,7 +300,7 @@ describe('My Test Suite', () => {
|
|
|
300
300
|
|
|
301
301
|
```javascript
|
|
302
302
|
try {
|
|
303
|
-
await testdriver.connect(
|
|
303
|
+
await testdriver.connect();
|
|
304
304
|
} catch (error) {
|
|
305
305
|
console.error('Failed to connect:', error.message);
|
|
306
306
|
throw error;
|
|
@@ -14,6 +14,26 @@ const testdriver = TestDriver(context, {
|
|
|
14
14
|
});
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
### Headless Mode
|
|
18
|
+
|
|
19
|
+
Run tests without a visible browser window. Useful for CI/CD pipeline or spawning multiple tests locally:
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
const testdriver = TestDriver(context, {
|
|
23
|
+
headless: true, // No visible browser window
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### IP Target
|
|
28
|
+
|
|
29
|
+
If self-hosting TestDriver, use `ip` to specify the device IP. See [Self-Hosting TestDriver](../self-hosting.md) for details.
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
const testdriver = TestDriver(context, {
|
|
33
|
+
ip: "203.0.113.42", // Your allowlisted IP
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
17
37
|
### Operating System
|
|
18
38
|
|
|
19
39
|
Set the `os` property to run tests on a specific operating system. Available options are `linux` (default) and `windows`.
|
|
@@ -32,7 +32,7 @@ import { TestDriver } from "testdriverai/lib/vitest/hooks.mjs";
|
|
|
32
32
|
|
|
33
33
|
describe("Login Flow", () => {
|
|
34
34
|
it("should log in successfully", async (context) => {
|
|
35
|
-
const testdriver = TestDriver(context
|
|
35
|
+
const testdriver = TestDriver(context);
|
|
36
36
|
|
|
37
37
|
await testdriver.provision.chrome({
|
|
38
38
|
url: 'https://myapp.com/login',
|
|
@@ -117,7 +117,7 @@ import { TestDriver } from "testdriverai/lib/vitest/hooks.mjs";
|
|
|
117
117
|
|
|
118
118
|
describe("Chrome Extension Test", () => {
|
|
119
119
|
it("should load and interact with extension", async (context) => {
|
|
120
|
-
const testdriver = TestDriver(context
|
|
120
|
+
const testdriver = TestDriver(context);
|
|
121
121
|
|
|
122
122
|
// Clone extension from GitHub
|
|
123
123
|
await testdriver.ready();
|
|
@@ -192,7 +192,7 @@ import { TestDriver } from "testdriverai/lib/vitest/hooks.mjs";
|
|
|
192
192
|
|
|
193
193
|
describe("Desktop App Test", () => {
|
|
194
194
|
it("should install and launch app", async (context) => {
|
|
195
|
-
const testdriver = TestDriver(context
|
|
195
|
+
const testdriver = TestDriver(context);
|
|
196
196
|
|
|
197
197
|
// Download and install
|
|
198
198
|
const installerPath = await testdriver.provision.installer({
|
|
@@ -281,7 +281,7 @@ import { TestDriver } from "testdriverai/lib/vitest/hooks.mjs";
|
|
|
281
281
|
|
|
282
282
|
describe("VS Code Test", () => {
|
|
283
283
|
it("should open workspace with extensions", async (context) => {
|
|
284
|
-
const testdriver = TestDriver(context
|
|
284
|
+
const testdriver = TestDriver(context);
|
|
285
285
|
|
|
286
286
|
// Create a test project
|
|
287
287
|
await testdriver.ready();
|
package/docs/v7/exec.mdx
CHANGED
package/docs/v7/find.mdx
CHANGED
|
@@ -209,7 +209,7 @@ describe('Multi-Application Workflow', () => {
|
|
|
209
209
|
beforeAll(async () => {
|
|
210
210
|
client = new TestDriver(process.env.TD_API_KEY);
|
|
211
211
|
await testdriver.auth();
|
|
212
|
-
await testdriver.connect(
|
|
212
|
+
await testdriver.connect();
|
|
213
213
|
});
|
|
214
214
|
|
|
215
215
|
afterAll(async () => {
|
package/docs/v7/hover.mdx
CHANGED
|
@@ -204,7 +204,7 @@ describe('Hover Interactions', () => {
|
|
|
204
204
|
beforeAll(async () => {
|
|
205
205
|
client = new TestDriver(process.env.TD_API_KEY);
|
|
206
206
|
await testdriver.auth();
|
|
207
|
-
await testdriver.connect(
|
|
207
|
+
await testdriver.connect();
|
|
208
208
|
});
|
|
209
209
|
|
|
210
210
|
afterAll(async () => {
|
package/docs/v7/press-keys.mdx
CHANGED
|
@@ -286,7 +286,7 @@ describe('Keyboard Navigation', () => {
|
|
|
286
286
|
beforeAll(async () => {
|
|
287
287
|
client = new TestDriver(process.env.TD_API_KEY);
|
|
288
288
|
await testdriver.auth();
|
|
289
|
-
await testdriver.connect(
|
|
289
|
+
await testdriver.connect();
|
|
290
290
|
});
|
|
291
291
|
|
|
292
292
|
afterAll(async () => {
|
|
@@ -45,7 +45,7 @@ import { login } from './helpers/auth.js';
|
|
|
45
45
|
|
|
46
46
|
describe("Checkout", () => {
|
|
47
47
|
it("should complete checkout as logged in user", async (context) => {
|
|
48
|
-
const testdriver = TestDriver(context
|
|
48
|
+
const testdriver = TestDriver(context);
|
|
49
49
|
|
|
50
50
|
await testdriver.provision.chrome({
|
|
51
51
|
url: 'https://shop.example.com',
|
|
@@ -116,7 +116,7 @@ import { LoginPage } from './pages/LoginPage.js';
|
|
|
116
116
|
|
|
117
117
|
describe("Authentication", () => {
|
|
118
118
|
it("should show error for invalid credentials", async (context) => {
|
|
119
|
-
const testdriver = TestDriver(context
|
|
119
|
+
const testdriver = TestDriver(context);
|
|
120
120
|
|
|
121
121
|
await testdriver.provision.chrome({
|
|
122
122
|
url: 'https://app.example.com/login',
|
|
@@ -131,7 +131,7 @@ describe("Authentication", () => {
|
|
|
131
131
|
});
|
|
132
132
|
|
|
133
133
|
it("should redirect to dashboard on success", async (context) => {
|
|
134
|
-
const testdriver = TestDriver(context
|
|
134
|
+
const testdriver = TestDriver(context);
|
|
135
135
|
|
|
136
136
|
await testdriver.provision.chrome({
|
|
137
137
|
url: 'https://app.example.com/login',
|
|
@@ -186,7 +186,7 @@ import { testUsers, testUrls, setupAuthenticatedSession } from './fixtures/index
|
|
|
186
186
|
|
|
187
187
|
describe("Admin Panel", () => {
|
|
188
188
|
it("should access admin settings", async (context) => {
|
|
189
|
-
const testdriver = TestDriver(context
|
|
189
|
+
const testdriver = TestDriver(context);
|
|
190
190
|
|
|
191
191
|
await testdriver.provision.chrome({
|
|
192
192
|
url: `${testUrls.staging}/login`,
|
package/docs/v7/scroll.mdx
CHANGED
package/docs/v7/type.mdx
CHANGED
|
@@ -296,7 +296,7 @@ describe('Form Filling with Type', () => {
|
|
|
296
296
|
beforeAll(async () => {
|
|
297
297
|
client = new TestDriver(process.env.TD_API_KEY);
|
|
298
298
|
await testdriver.auth();
|
|
299
|
-
await testdriver.connect(
|
|
299
|
+
await testdriver.connect();
|
|
300
300
|
});
|
|
301
301
|
|
|
302
302
|
afterAll(async () => {
|
package/package.json
CHANGED
package/sdk.js
CHANGED
|
@@ -2176,7 +2176,10 @@ with zipfile.ZipFile(io.BytesIO(zip_data)) as zf:
|
|
|
2176
2176
|
? connectOptions.reconnect
|
|
2177
2177
|
: this.reconnect;
|
|
2178
2178
|
|
|
2179
|
-
if
|
|
2179
|
+
// Skip reconnect if IP is supplied - directly connect to the provided IP
|
|
2180
|
+
const hasIp = Boolean(connectOptions.ip || this.ip);
|
|
2181
|
+
|
|
2182
|
+
if (shouldReconnect && !hasIp) {
|
|
2180
2183
|
const lastSandbox = this.agent.getLastSandboxId();
|
|
2181
2184
|
if (!lastSandbox || !lastSandbox.sandboxId) {
|
|
2182
2185
|
throw new Error(
|
|
@@ -8,7 +8,7 @@ import { TestDriver } from "../../lib/vitest/hooks.mjs";
|
|
|
8
8
|
|
|
9
9
|
describe("Assert Test", () => {
|
|
10
10
|
it("should assert the testdriver login page shows", async (context) => {
|
|
11
|
-
const testdriver = TestDriver(context
|
|
11
|
+
const testdriver = TestDriver(context);
|
|
12
12
|
|
|
13
13
|
// provision.chrome() automatically calls ready() and starts dashcam
|
|
14
14
|
await testdriver.provision.chrome({
|