@testdriverai/agent 7.11.229-canary → 7.11.231-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/docs/_data/examples-manifest.json +16 -16
- package/docs/_scripts/generate-examples.js +38 -45
- package/docs/agent.mdx +174 -93
- package/docs/assert.mdx +73 -269
- package/docs/aws-setup.mdx +196 -314
- package/docs/bring-your-own-machine.mdx +139 -206
- package/docs/cache.mdx +144 -151
- package/docs/caching.mdx +99 -89
- package/docs/captcha.mdx +126 -111
- package/docs/ci-cd.mdx +154 -543
- package/docs/click.mdx +74 -229
- package/docs/client.mdx +177 -231
- package/docs/copilot/auto-healing.mdx +86 -370
- package/docs/copilot/running-tests.mdx +121 -930
- package/docs/customizing-devices.mdx +74 -251
- package/docs/dashcam.mdx +72 -405
- package/docs/debugging-with-screenshots.mdx +105 -371
- package/docs/docs.json +75 -18
- package/docs/double-click.mdx +48 -68
- package/docs/errors.mdx +102 -176
- package/docs/events.mdx +170 -327
- package/docs/examples/{hover-text-with-description.mdx → add-to-cart.mdx} +30 -35
- package/docs/examples/assert.mdx +28 -41
- package/docs/examples/click-button.mdx +71 -0
- package/docs/examples/{hover-image.mdx → click-icon.mdx} +32 -28
- package/docs/examples/element-not-found.mdx +27 -26
- package/docs/examples/findall-coffee-icons.mdx +28 -32
- package/docs/examples/installer.mdx +61 -25
- package/docs/examples/launch-vscode-linux.mdx +28 -51
- package/docs/examples/navigate-and-scroll.mdx +82 -0
- package/docs/examples/parse.mdx +24 -28
- package/docs/examples/press-keys.mdx +28 -25
- package/docs/examples/scroll.mdx +25 -27
- package/docs/examples/type.mdx +26 -21
- package/docs/exec.mdx +92 -256
- package/docs/extract.mdx +69 -170
- package/docs/find.mdx +140 -736
- package/docs/focus-application.mdx +69 -246
- package/docs/generating-tests.mdx +103 -137
- package/docs/guide/best-practices-polling.mdx +65 -141
- package/docs/hosted.mdx +80 -144
- package/docs/hover.mdx +62 -235
- package/docs/locating-elements.mdx +74 -369
- package/docs/making-assertions.mdx +116 -74
- package/docs/mcp-setup.mdx +80 -63
- package/docs/mouse-down.mdx +48 -125
- package/docs/mouse-up.mdx +47 -129
- package/docs/options.mdx +75 -48
- package/docs/parse.mdx +95 -184
- package/docs/performing-actions.mdx +104 -94
- package/docs/press-keys.mdx +59 -299
- package/docs/provision.mdx +137 -182
- package/docs/quickstart-claude.mdx +85 -0
- package/docs/quickstart-github.mdx +62 -32
- package/docs/quickstart-manual.mdx +60 -33
- package/docs/quickstart-vscode.mdx +97 -0
- package/docs/quickstart.mdx +25 -9
- package/docs/redraw.mdx +101 -165
- package/docs/reusable-code.mdx +97 -200
- package/docs/right-click.mdx +47 -89
- package/docs/screenshot.mdx +47 -201
- package/docs/screenshots.mdx +87 -137
- package/docs/scroll.mdx +71 -154
- package/docs/secrets.mdx +96 -91
- package/docs/self-hosted.mdx +83 -142
- package/docs/snippets/enterprise.mdx +15 -0
- package/docs/styles.css +68 -0
- package/docs/test-results-json.mdx +167 -204
- package/docs/type.mdx +56 -304
- package/docs/variables.mdx +121 -81
- package/docs/wait.mdx +33 -31
- package/docs/what-is-testdriver.mdx +80 -32
- package/examples/{hover-text-with-description.test.mjs → add-to-cart.test.mjs} +4 -5
- package/examples/assert.test.mjs +3 -20
- package/examples/{hover-text.test.mjs → click-button.test.mjs} +3 -4
- package/examples/{hover-image.test.mjs → click-icon.test.mjs} +5 -6
- package/examples/element-not-found.test.mjs +3 -5
- package/examples/findall-coffee-icons.test.mjs +3 -3
- package/examples/installer.test.mjs +1 -1
- package/examples/launch-vscode-linux.test.mjs +6 -33
- package/examples/{scroll-keyboard.test.mjs → navigate-and-scroll.test.mjs} +4 -5
- package/examples/parse.test.mjs +1 -2
- package/examples/press-keys.test.mjs +4 -4
- package/examples/scroll.test.mjs +3 -6
- package/examples/type.test.mjs +5 -2
- package/lib/provision.js +6 -2
- package/package.json +1 -1
- package/sdk.d.ts +4 -2
- package/sdk.js +1 -1
- package/docs/claude-mcp-plugin.mdx +0 -244
- package/docs/elements.mdx +0 -606
- package/docs/examples/ai.mdx +0 -78
- package/docs/examples/captcha-api.mdx +0 -92
- package/docs/examples/chrome-extension.mdx +0 -156
- package/docs/examples/drag-and-drop.mdx +0 -100
- package/docs/examples/formatted-logging.mdx +0 -74
- package/docs/examples/hover-text.mdx +0 -70
- package/docs/examples/match-image.mdx +0 -97
- package/docs/examples/scroll-keyboard.mdx +0 -80
- package/docs/examples/scroll-until-text.mdx +0 -109
package/docs/aws-setup.mdx
CHANGED
|
@@ -1,238 +1,180 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
3
|
-
sidebarTitle: "AWS
|
|
4
|
-
description: "
|
|
2
|
+
title: "Self-host on AWS"
|
|
3
|
+
sidebarTitle: "AWS setup guide"
|
|
4
|
+
description: "Run each test on a fresh Windows EC2 instance in your AWS account, set up with CloudFormation."
|
|
5
5
|
icon: "aws"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import { EnterpriseBadge, EnterpriseCta } from '/snippets/enterprise.mdx';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
graph LR
|
|
12
|
-
A[Vitest Test] --> B[setup-aws hook]
|
|
13
|
-
B --> C[Spawns EC2]
|
|
14
|
-
C --> D[Runs Test]
|
|
15
|
-
D --> E[Terminates EC2]
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## How It Works
|
|
19
|
-
|
|
20
|
-
TestDriver manages the AWS EC2 instances for your tests automatically:
|
|
21
|
-
|
|
22
|
-
1. **Deploy CloudFormation**. Set up the infrastructure one time.
|
|
23
|
-
2. **Configure Vitest**. Add one line to your config.
|
|
24
|
-
3. **Run Tests**. The instances start automatically, run the tests, and stop.
|
|
25
|
-
|
|
26
|
-
That is all. You do not need to manage the instances by hand.
|
|
27
|
-
|
|
28
|
-
# Quickstart
|
|
29
|
-
|
|
30
|
-
<Steps>
|
|
31
|
-
<Step title="Deploy Infrastructure">
|
|
32
|
-
<Card
|
|
33
|
-
title="Launch CloudFormation Stack"
|
|
34
|
-
icon="aws"
|
|
35
|
-
href="https://console.aws.amazon.com/cloudformation/home#/stacks/create/review?templateURL=https://v7-cloudformation-template.s3.us-east-2.amazonaws.com/cloudformation.yaml"
|
|
36
|
-
horizontal
|
|
37
|
-
arrow
|
|
38
|
-
>
|
|
39
|
-
One-click AWS setup
|
|
40
|
-
</Card>
|
|
41
|
-
</Step>
|
|
42
|
-
|
|
43
|
-
<Step title="Add to Vitest Config">
|
|
44
|
-
```javascript vitest.config.mjs
|
|
45
|
-
setupFiles: ['testdriverai/vitest/setup', 'testdriverai/vitest/setup-aws']
|
|
46
|
-
```
|
|
47
|
-
</Step>
|
|
48
|
-
|
|
49
|
-
<Step title="Run Tests">
|
|
50
|
-
```bash
|
|
51
|
-
TD_OS=windows AWS_REGION=us-east-2 \
|
|
52
|
-
AWS_LAUNCH_TEMPLATE_ID=lt-xxx AMI_ID=ami-xxx \
|
|
53
|
-
vitest run
|
|
54
|
-
```
|
|
55
|
-
</Step>
|
|
56
|
-
</Steps>
|
|
10
|
+
Run your Windows tests on EC2 instances in your own AWS account. For each test, TestDriver:
|
|
57
11
|
|
|
58
|
-
|
|
12
|
+
1. Launches a fresh instance from the TestDriver AMI.
|
|
13
|
+
2. Installs and starts the runner on it over AWS Systems Manager (SSM).
|
|
14
|
+
3. Runs the test, then terminates the instance.
|
|
59
15
|
|
|
60
|
-
|
|
16
|
+
A CloudFormation stack creates the network, security group, IAM role, and launch template the instances need. You deploy it once.
|
|
61
17
|
|
|
62
|
-
|
|
63
|
-
2. **Configure Vitest** — Add `setup-aws` to automatically manage instance lifecycle
|
|
64
|
-
3. **Run Tests** — Set `TD_OS=windows` with AWS credentials and instances spawn/terminate automatically
|
|
18
|
+
<EnterpriseCta feature="Self-hosting on AWS" />
|
|
65
19
|
|
|
20
|
+
<Note>
|
|
21
|
+
Self-hosting is part of the Enterprise plan. See [Self-hosted](/self-hosted).
|
|
22
|
+
</Note>
|
|
66
23
|
|
|
67
|
-
##
|
|
24
|
+
## Before you begin
|
|
68
25
|
|
|
69
|
-
|
|
26
|
+
- **Access to the TestDriver AMI.** TestDriver shares it with your AWS account. [Contact TestDriver](https://testdriver.ai/enterprise) with your account ID and region to get the AMI ID.
|
|
27
|
+
- **The AWS CLI**, [installed](https://aws.amazon.com/cli/) and signed in, on every machine that runs tests (your laptop and your CI runners).
|
|
28
|
+
- **`jq`**, which the instance launch script uses to read AWS responses.
|
|
29
|
+
- **A TestDriver project** with your API key in `TD_API_KEY`. See [Set up a project](/quickstart-manual).
|
|
70
30
|
|
|
71
|
-
|
|
72
|
-
- [AWS CLI](https://aws.amazon.com/cli/) installed and configured (`aws configure`)
|
|
73
|
-
- Access to the TestDriver AMI — [Contact us](https://testdriver.ai/enterprise) with your AWS region
|
|
74
|
-
- A GitHub repository for your tests
|
|
31
|
+
## Step 1: Deploy the CloudFormation stack
|
|
75
32
|
|
|
76
|
-
|
|
77
|
-
The TestDriver Golden Image AMI ID is `ami-0504bf50fad62f312`. Contact us to get access in your preferred AWS region.
|
|
78
|
-
</Tip>
|
|
33
|
+
The template creates:
|
|
79
34
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
- Dedicated VPC with public subnet
|
|
85
|
-
- Security group with required port access
|
|
86
|
-
- IAM roles and instance profiles
|
|
87
|
-
- EC2 launch template for instance creation
|
|
35
|
+
- A VPC with a public subnet and internet gateway.
|
|
36
|
+
- A security group that allows RDP, VNC, and web traffic from the IP range you choose.
|
|
37
|
+
- An IAM role and instance profile with SSM access.
|
|
38
|
+
- An EC2 launch template, and optionally a key pair.
|
|
88
39
|
|
|
89
40
|
<Tabs>
|
|
90
|
-
<Tab title="
|
|
91
|
-
Click the button below to launch the CloudFormation stack in your AWS Console:
|
|
92
|
-
|
|
93
|
-
<Card
|
|
94
|
-
title="Launch Stack"
|
|
95
|
-
icon="aws"
|
|
96
|
-
href="https://console.aws.amazon.com/cloudformation/home#/stacks/create/review?templateURL=https://v7-cloudformation-template.s3.us-east-2.amazonaws.com/cloudformation.yaml"
|
|
97
|
-
horizontal
|
|
98
|
-
arrow
|
|
99
|
-
>
|
|
100
|
-
Deploy TestDriver infrastructure with one click
|
|
101
|
-
</Card>
|
|
41
|
+
<Tab title="AWS console">
|
|
102
42
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
- **AllowedIngressCidr**: Your IP range (e.g., `203.0.113.0/24`)
|
|
107
|
-
- **InstanceType**: `c5.xlarge` (recommended)
|
|
108
|
-
- **CreateKeyPair**: `true`
|
|
109
|
-
|
|
110
|
-
<Warning>
|
|
111
|
-
**Security**: Replace `AllowedIngressCidr` with your specific IP ranges to restrict VPC access. Avoid using `0.0.0.0/0` in production.
|
|
112
|
-
</Warning>
|
|
113
|
-
|
|
114
|
-
### Get Your Launch Template ID
|
|
43
|
+
<Card title="Launch the stack" icon="aws" href="https://console.aws.amazon.com/cloudformation/home#/stacks/create/review?templateURL=https://v7-cloudformation-template.s3.us-east-2.amazonaws.com/cloudformation.yaml" horizontal arrow>
|
|
44
|
+
Open the template in the CloudFormation console.
|
|
45
|
+
</Card>
|
|
115
46
|
|
|
116
|
-
|
|
47
|
+
Switch the console to the region you'll run tests in, fill in the parameters below, and create the stack.
|
|
117
48
|
|
|
118
|
-
|
|
49
|
+
When the stack finishes, open its **Outputs** tab and copy `LaunchTemplateId`.
|
|
119
50
|
|
|
120
|
-
<Tip>
|
|
121
|
-
**Save this ID** — you'll need it for spawning instances and CI configuration.
|
|
122
|
-
</Tip>
|
|
123
51
|
</Tab>
|
|
124
|
-
<Tab title="CLI">
|
|
125
|
-
|
|
52
|
+
<Tab title="AWS CLI">
|
|
53
|
+
|
|
54
|
+
The template ships with the SDK. From your project, deploy it with:
|
|
126
55
|
|
|
127
56
|
```bash
|
|
128
57
|
aws cloudformation deploy \
|
|
129
|
-
--
|
|
58
|
+
--region us-east-2 \
|
|
59
|
+
--template-file node_modules/testdriverai/setup/aws/cloudformation.yaml \
|
|
130
60
|
--stack-name testdriver-infrastructure \
|
|
131
61
|
--parameter-overrides \
|
|
132
|
-
|
|
133
|
-
AllowedIngressCidr=0.0.0.0/0 \
|
|
62
|
+
AllowedIngressCidr=203.0.113.0/24 \
|
|
134
63
|
InstanceType=c5.xlarge \
|
|
135
|
-
CreateKeyPair=
|
|
64
|
+
CreateKeyPair=yes \
|
|
136
65
|
--capabilities CAPABILITY_IAM
|
|
137
66
|
```
|
|
138
67
|
|
|
139
|
-
|
|
140
|
-
**Security**: Replace `AllowedIngressCidr=0.0.0.0/0` with your specific IP ranges to restrict VPC access.
|
|
141
|
-
</Warning>
|
|
142
|
-
|
|
143
|
-
### Get Your Launch Template ID
|
|
144
|
-
|
|
145
|
-
After deployment completes, retrieve the launch template ID:
|
|
68
|
+
Then get the launch template ID:
|
|
146
69
|
|
|
147
70
|
```bash
|
|
148
71
|
aws cloudformation describe-stacks \
|
|
72
|
+
--region us-east-2 \
|
|
149
73
|
--stack-name testdriver-infrastructure \
|
|
150
74
|
--query 'Stacks[0].Outputs[?OutputKey==`LaunchTemplateId`].OutputValue' \
|
|
151
75
|
--output text
|
|
152
76
|
```
|
|
153
77
|
|
|
154
|
-
<Tip>
|
|
155
|
-
**Save this ID** — you'll need it for spawning instances and CI configuration.
|
|
156
|
-
</Tip>
|
|
157
78
|
</Tab>
|
|
158
79
|
</Tabs>
|
|
159
80
|
|
|
160
|
-
|
|
81
|
+
### Stack parameters
|
|
82
|
+
|
|
83
|
+
| Parameter | Default | Description |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| `AllowedIngressCidr` | `0.0.0.0/0` | The IP range allowed to reach the instances over RDP and VNC. Set it to your office or VPN range. |
|
|
86
|
+
| `InstanceType` | `c5.xlarge` | The EC2 instance type. Allowed: `c5.xlarge` to `c5.24xlarge`, `c5.metal`, or `i3.metal`. |
|
|
87
|
+
| `CreateKeyPair` | `yes` | `yes` creates a new key pair. `no` uses the key named in `ExistingKeyName`. |
|
|
88
|
+
| `ExistingKeyName` | | An existing EC2 key pair. Required when `CreateKeyPair` is `no`. |
|
|
89
|
+
| `ProjectTag` | `testdriver` | The `Project` tag added to every resource. |
|
|
90
|
+
| `NotificationEmail` | | An email address to notify when the stack finishes. Optional. |
|
|
91
|
+
|
|
92
|
+
<Warning>
|
|
93
|
+
The default `AllowedIngressCidr` of `0.0.0.0/0` opens RDP and VNC to the whole internet. Set it to your own IP range.
|
|
94
|
+
</Warning>
|
|
161
95
|
|
|
162
|
-
Add the AWS setup
|
|
96
|
+
## Step 2: Add the AWS setup file to Vitest
|
|
97
|
+
|
|
98
|
+
Add `testdriverai/vitest/setup-aws` to `setupFiles`. It launches an instance before each test that runs on Windows.
|
|
163
99
|
|
|
164
100
|
```javascript vitest.config.mjs
|
|
165
101
|
import { defineConfig } from 'vitest/config';
|
|
166
|
-
import { config } from 'dotenv';
|
|
167
102
|
import TestDriver from 'testdriverai/vitest';
|
|
168
103
|
|
|
169
|
-
config(); // Load .env file
|
|
170
|
-
|
|
171
104
|
export default defineConfig({
|
|
172
105
|
test: {
|
|
173
106
|
testTimeout: 900000,
|
|
174
107
|
hookTimeout: 900000,
|
|
175
|
-
|
|
176
|
-
reporters: [
|
|
177
|
-
'default',
|
|
178
|
-
TestDriver(),
|
|
179
|
-
['junit', { outputFile: 'test-report.junit.xml' }]
|
|
180
|
-
],
|
|
108
|
+
reporters: ['default', TestDriver()],
|
|
181
109
|
setupFiles: ['testdriverai/vitest/setup', 'testdriverai/vitest/setup-aws'],
|
|
182
110
|
},
|
|
183
111
|
});
|
|
184
112
|
```
|
|
185
113
|
|
|
186
|
-
|
|
187
|
-
**That's it!** The `setup-aws` hook automatically spawns and terminates instances when `TD_OS=windows` is set. No manual instance management needed.
|
|
188
|
-
</Note>
|
|
114
|
+
The 15-minute `hookTimeout` gives a new instance time to boot, pass its status checks, and register with SSM.
|
|
189
115
|
|
|
190
|
-
## Step 3: Write
|
|
116
|
+
## Step 3: Write your test
|
|
191
117
|
|
|
192
|
-
|
|
118
|
+
Your tests don't change. The setup file passes the instance's IP address and ID to `TestDriver()` for you:
|
|
193
119
|
|
|
194
|
-
```javascript
|
|
195
|
-
import { describe, it } from
|
|
196
|
-
import { TestDriver } from
|
|
120
|
+
```javascript tests/login.test.mjs
|
|
121
|
+
import { describe, it } from 'vitest';
|
|
122
|
+
import { TestDriver } from 'testdriverai/vitest/hooks';
|
|
197
123
|
|
|
198
|
-
describe(
|
|
199
|
-
it(
|
|
200
|
-
const testdriver = TestDriver(context
|
|
201
|
-
|
|
202
|
-
});
|
|
124
|
+
describe('Login', () => {
|
|
125
|
+
it('shows the login page', async (context) => {
|
|
126
|
+
const testdriver = TestDriver(context);
|
|
127
|
+
await testdriver.provision.chrome({ url: 'https://testdriver-sandbox.vercel.app/login' });
|
|
203
128
|
|
|
204
|
-
await testdriver.
|
|
205
|
-
// ... your test steps
|
|
129
|
+
await testdriver.assert('the login form is visible');
|
|
206
130
|
});
|
|
207
131
|
});
|
|
208
132
|
```
|
|
209
133
|
|
|
210
|
-
|
|
211
|
-
**How it works**: When `TD_OS=windows` with AWS credentials, `context.ip` is automatically set by the setup hook. When running without AWS setup (cloud-hosted), both are undefined and TestDriver uses the cloud. When `TD_IP` is provided manually, it takes precedence.
|
|
212
|
-
</Note>
|
|
213
|
-
|
|
214
|
-
## Step 4: Run Tests
|
|
134
|
+
## Step 4: Run the tests
|
|
215
135
|
|
|
216
|
-
|
|
136
|
+
Set `TD_OS=windows` to turn on the setup file, along with your launch template and AMI:
|
|
217
137
|
|
|
218
138
|
```bash
|
|
219
139
|
TD_OS=windows \
|
|
220
140
|
AWS_REGION=us-east-2 \
|
|
221
|
-
AWS_LAUNCH_TEMPLATE_ID=lt-
|
|
222
|
-
AMI_ID=ami-
|
|
223
|
-
vitest run
|
|
141
|
+
AWS_LAUNCH_TEMPLATE_ID=lt-0123456789abcdef0 \
|
|
142
|
+
AMI_ID=ami-0123456789abcdef0 \
|
|
143
|
+
npx vitest run
|
|
224
144
|
```
|
|
225
145
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
146
|
+
Each test gets its own instance. The instance is terminated after the test ends, once its recording has stopped. If the test process exits early, TestDriver terminates any instances still running.
|
|
147
|
+
|
|
148
|
+
When `TD_OS` isn't `windows`, the setup file does nothing and tests run on TestDriver's cloud.
|
|
149
|
+
|
|
150
|
+
### Environment variables
|
|
151
|
+
|
|
152
|
+
| Variable | Default | Description |
|
|
153
|
+
| --- | --- | --- |
|
|
154
|
+
| `TD_OS` | | Set to `windows` to launch instances. Required. |
|
|
155
|
+
| `AWS_LAUNCH_TEMPLATE_ID` | | `LaunchTemplateId` from the stack outputs. Required. |
|
|
156
|
+
| `AMI_ID` | | The TestDriver AMI, or your own AMI built from it. Required. |
|
|
157
|
+
| `AWS_REGION` | `us-east-2` | The region of your stack and AMI. |
|
|
158
|
+
| `AWS_LAUNCH_TEMPLATE_VERSION` | `$Latest` | The launch template version to use. |
|
|
159
|
+
| `RESOLUTION` | `1920x1080` | The instance's screen resolution. |
|
|
160
|
+
| `AWS_TAG_PREFIX` | `td` | Prefix for each instance's `Name` tag, followed by a timestamp. |
|
|
161
|
+
|
|
162
|
+
The AWS CLI reads your credentials from its usual sources, such as `aws configure`, `AWS_PROFILE`, or `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.
|
|
229
163
|
|
|
230
|
-
###
|
|
164
|
+
### AWS permissions
|
|
231
165
|
|
|
232
|
-
|
|
166
|
+
The credentials that run your tests need these actions:
|
|
233
167
|
|
|
234
|
-
|
|
235
|
-
|
|
168
|
+
- `ec2:RunInstances`, `ec2:CreateTags`, `ec2:DescribeInstances`, `ec2:DescribeInstanceStatus`, and `ec2:TerminateInstances`
|
|
169
|
+
- `iam:PassRole` for the stack's instance role
|
|
170
|
+
- `ssm:DescribeInstanceInformation`, `ssm:SendCommand`, and `ssm:GetCommandInvocation`
|
|
171
|
+
|
|
172
|
+
## Run in GitHub Actions
|
|
173
|
+
|
|
174
|
+
This workflow authenticates to TestDriver with the [TestDriver action](/ci-cd#github-actions) and to AWS with stored access keys:
|
|
175
|
+
|
|
176
|
+
```yaml .github/workflows/testdriver-windows.yml
|
|
177
|
+
name: Windows tests
|
|
236
178
|
|
|
237
179
|
on:
|
|
238
180
|
push:
|
|
@@ -242,208 +184,148 @@ on:
|
|
|
242
184
|
jobs:
|
|
243
185
|
test:
|
|
244
186
|
runs-on: ubuntu-latest
|
|
245
|
-
|
|
187
|
+
permissions:
|
|
188
|
+
id-token: write
|
|
189
|
+
contents: read
|
|
190
|
+
|
|
246
191
|
steps:
|
|
247
|
-
-
|
|
248
|
-
uses: actions/checkout@v4
|
|
192
|
+
- uses: actions/checkout@v4
|
|
249
193
|
|
|
250
|
-
-
|
|
251
|
-
uses: actions/setup-node@v4
|
|
194
|
+
- uses: actions/setup-node@v4
|
|
252
195
|
with:
|
|
253
196
|
node-version: '20'
|
|
254
197
|
cache: 'npm'
|
|
255
198
|
|
|
256
|
-
-
|
|
257
|
-
|
|
199
|
+
- run: npm ci
|
|
200
|
+
|
|
201
|
+
- uses: testdriverai/action@stable
|
|
258
202
|
|
|
259
|
-
-
|
|
260
|
-
|
|
203
|
+
- uses: aws-actions/configure-aws-credentials@v4
|
|
204
|
+
with:
|
|
205
|
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
206
|
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
207
|
+
aws-region: us-east-2
|
|
208
|
+
|
|
209
|
+
- name: Run tests on Windows instances
|
|
210
|
+
run: npx vitest run
|
|
261
211
|
env:
|
|
262
|
-
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
263
212
|
TD_OS: windows
|
|
264
|
-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
265
|
-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
266
|
-
AWS_REGION: us-east-2
|
|
267
213
|
AWS_LAUNCH_TEMPLATE_ID: ${{ secrets.AWS_LAUNCH_TEMPLATE_ID }}
|
|
268
214
|
AMI_ID: ${{ secrets.AMI_ID }}
|
|
269
|
-
|
|
270
|
-
- name: Upload test results
|
|
271
|
-
if: always()
|
|
272
|
-
uses: actions/upload-artifact@v4
|
|
273
|
-
with:
|
|
274
|
-
name: test-results
|
|
275
|
-
path: test-report.junit.xml
|
|
276
215
|
```
|
|
277
216
|
|
|
278
|
-
|
|
279
|
-
**Automatic Instance Management**: Setting `TD_OS=windows` with AWS credentials enables automatic instance spawning. Each test gets its own fresh instance that's terminated after the test completes.
|
|
280
|
-
</Note>
|
|
281
|
-
|
|
282
|
-
### Required GitHub Secrets
|
|
283
|
-
|
|
284
|
-
| Secret | Description | Example |
|
|
285
|
-
|--------|-------------|---------|
|
|
286
|
-
| `AWS_ACCESS_KEY_ID` | AWS access key | `AKIAIOSFODNN7EXAMPLE` |
|
|
287
|
-
| `AWS_SECRET_ACCESS_KEY` | AWS secret key | `wJalrXUtnFEMI/K7MDENG...` |
|
|
288
|
-
| `AWS_REGION` | AWS region | `us-east-2` |
|
|
289
|
-
| `AWS_LAUNCH_TEMPLATE_ID` | From CloudFormation output | `lt-07c53ce8349b958d1` |
|
|
290
|
-
| `AMI_ID` | TestDriver AMI ID | `ami-0504bf50fad62f312` |
|
|
291
|
-
| `TD_API_KEY` | Your TestDriver API key | From [console.testdriver.ai](https://console.testdriver.ai) |
|
|
217
|
+
GitHub's `ubuntu-latest` runners already include the AWS CLI and `jq`.
|
|
292
218
|
|
|
293
219
|
<Tip>
|
|
294
|
-
|
|
220
|
+
To avoid storing AWS keys, give `configure-aws-credentials` a `role-to-assume` instead. The job's `id-token: write` permission covers both TestDriver and AWS. See [GitHub's OIDC guide](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect).
|
|
295
221
|
</Tip>
|
|
296
222
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
For complete production examples, see:
|
|
300
|
-
- **[Scheduled Tests](https://github.com/testdriverai/testdriverai/blob/main/.github/workflows/acceptance-windows-scheduled.yaml)** — Daily automated test runs
|
|
301
|
-
- **[Reusable Workflow](https://github.com/testdriverai/testdriverai/blob/main/.github/workflows/windows-self-hosted.yaml)** — Shared configuration for PR and scheduled tests
|
|
302
|
-
|
|
303
|
-
## Advanced Usage
|
|
304
|
-
|
|
305
|
-
### Using an Existing Instance
|
|
306
|
-
|
|
307
|
-
If you already have a running instance, you can skip automatic spawning by providing `TD_IP`:
|
|
308
|
-
|
|
309
|
-
```bash
|
|
310
|
-
TD_OS=windows TD_IP=1.2.3.4 vitest run
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
The `setup-aws` hook will detect `TD_IP` is already set and skip spawning a new instance.
|
|
314
|
-
|
|
315
|
-
### Manual Instance Management
|
|
316
|
-
|
|
317
|
-
For advanced use cases, you can manually spawn instances using the [`spawn-runner.sh`](https://github.com/testdriverai/testdriverai/blob/main/setup/aws/spawn-runner.sh) script:
|
|
223
|
+
## Connect to an instance
|
|
318
224
|
|
|
319
|
-
|
|
320
|
-
AWS_REGION=us-east-2 \
|
|
321
|
-
AMI_ID=ami-0504bf50fad62f312 \
|
|
322
|
-
AWS_LAUNCH_TEMPLATE_ID=lt-xxx \
|
|
323
|
-
bash setup/aws/spawn-runner.sh
|
|
324
|
-
```
|
|
225
|
+
To watch or debug a test, connect to its instance over RDP on port 3389 while it runs. The setup file prints the instance's IP address when it launches it.
|
|
325
226
|
|
|
326
|
-
|
|
327
|
-
```
|
|
328
|
-
PUBLIC_IP=1.2.3.4
|
|
329
|
-
INSTANCE_ID=i-1234567890abcdef0
|
|
330
|
-
AWS_REGION=us-east-2
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
Then manually terminate when done:
|
|
334
|
-
|
|
335
|
-
```bash
|
|
336
|
-
aws ec2 terminate-instances \
|
|
337
|
-
--instance-ids i-1234567890abcdef0 \
|
|
338
|
-
--region us-east-2
|
|
339
|
-
```
|
|
227
|
+
The TestDriver AMI signs in as the user `testdriver`. Ask TestDriver for the default password, and change it before you build your own image.
|
|
340
228
|
|
|
341
|
-
|
|
342
|
-
- **[Scheduled Tests](https://github.com/testdriverai/testdriverai/blob/main/.github/workflows/acceptance-windows-scheduled.yaml)** — Daily automated test runs
|
|
343
|
-
- **[Reusable Workflow](https://github.com/testdriverai/testdriverai/blob/main/.github/workflows/windows-self-hosted.yaml)** — Shared configuration for PR and scheduled tests
|
|
229
|
+
## Create a custom AMI
|
|
344
230
|
|
|
345
|
-
|
|
231
|
+
Preinstall your apps and test data so tests don't spend time on setup.
|
|
346
232
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
- **VNC** — Access via web browser at `http://<public-ip>:5900`
|
|
350
|
-
- **AWS Console** — Use EC2 Instance Connect or Session Manager
|
|
351
|
-
|
|
352
|
-
<Note>
|
|
353
|
-
Stopped instances retain their EBS volumes and can be restarted later. Terminated instances are permanently deleted. Always terminate instances when done to avoid storage costs.
|
|
354
|
-
</Note>
|
|
233
|
+
<Steps>
|
|
234
|
+
<Step title="Launch an instance and connect">
|
|
355
235
|
|
|
356
|
-
|
|
236
|
+
Launch an instance from the TestDriver AMI with the stack's launch template:
|
|
357
237
|
|
|
358
|
-
|
|
238
|
+
```bash
|
|
239
|
+
aws ec2 run-instances \
|
|
240
|
+
--region us-east-2 \
|
|
241
|
+
--image-id ami-0123456789abcdef0 \
|
|
242
|
+
--launch-template 'LaunchTemplateId=lt-0123456789abcdef0,Version=$Latest'
|
|
243
|
+
```
|
|
359
244
|
|
|
360
|
-
|
|
361
|
-
- VNC + web server for remote access
|
|
362
|
-
- Python, Node.js, Git
|
|
363
|
-
- TestDriver agent and dependencies
|
|
245
|
+
When it's running, connect to its public IP address over RDP.
|
|
364
246
|
|
|
365
|
-
|
|
247
|
+
</Step>
|
|
248
|
+
<Step title="Rotate the default password">
|
|
366
249
|
|
|
367
|
-
|
|
250
|
+
Run the password rotation script and save the new password:
|
|
368
251
|
|
|
369
|
-
<Steps>
|
|
370
|
-
<Step title="Connect via RDP">
|
|
371
|
-
Use the default credentials:
|
|
372
|
-
- **Username**: `testdriver`
|
|
373
|
-
- **Password**: `wwv9uJ0sqlulbN3`
|
|
374
|
-
</Step>
|
|
375
|
-
|
|
376
|
-
<Step title="Change the Password">
|
|
377
|
-
**Critical**: Run the password rotation script immediately:
|
|
378
252
|
```powershell
|
|
379
253
|
C:\testdriver\RotateLocalPasswords.ps1
|
|
380
254
|
```
|
|
381
|
-
|
|
382
|
-
</Step>
|
|
383
|
-
|
|
384
|
-
<Step title="Install Your Software">
|
|
385
|
-
Install any additional dependencies, configure settings, or modify the environment as needed.
|
|
255
|
+
|
|
386
256
|
</Step>
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
257
|
+
<Step title="Install your software">
|
|
258
|
+
|
|
259
|
+
Install your apps, dependencies, certificates, and data.
|
|
260
|
+
|
|
390
261
|
</Step>
|
|
391
|
-
|
|
262
|
+
<Step title="Create the AMI">
|
|
392
263
|
|
|
393
|
-
|
|
394
|
-
**Security**: Never use the default password in production. Always rotate passwords before creating custom AMIs.
|
|
395
|
-
</Warning>
|
|
264
|
+
Create an image from the instance:
|
|
396
265
|
|
|
397
|
-
|
|
266
|
+
```bash
|
|
267
|
+
aws ec2 create-image \
|
|
268
|
+
--region us-east-2 \
|
|
269
|
+
--instance-id i-0123456789abcdef0 \
|
|
270
|
+
--name my-testdriver-image
|
|
271
|
+
```
|
|
398
272
|
|
|
399
|
-
|
|
273
|
+
Set `AMI_ID` to the new image's ID when you run tests.
|
|
400
274
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
- **Enable VPC Flow Logs** — For network monitoring
|
|
275
|
+
</Step>
|
|
276
|
+
</Steps>
|
|
404
277
|
|
|
405
|
-
|
|
278
|
+
## Troubleshooting
|
|
406
279
|
|
|
407
|
-
|
|
280
|
+
<AccordionGroup>
|
|
281
|
+
<Accordion title="TD_OS=windows requires AWS_LAUNCH_TEMPLATE_ID and AMI_ID">
|
|
408
282
|
|
|
409
|
-
|
|
410
|
-
permissions:
|
|
411
|
-
id-token: write
|
|
412
|
-
contents: read
|
|
283
|
+
Set both variables in the environment that runs `npx vitest run`. In CI, check that the secrets are passed to the test step.
|
|
413
284
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
uses: aws-actions/configure-aws-credentials@v4
|
|
417
|
-
with:
|
|
418
|
-
role-to-assume: arn:aws:iam::123456789012:role/GitHubActionsRole
|
|
419
|
-
aws-region: us-east-2
|
|
420
|
-
```
|
|
285
|
+
</Accordion>
|
|
286
|
+
<Accordion title="AWS CLI is not installed">
|
|
421
287
|
|
|
422
|
-
|
|
288
|
+
Install the [AWS CLI](https://aws.amazon.com/cli/) on the machine that runs the tests, and check that `aws` is on the `PATH`.
|
|
423
289
|
|
|
424
|
-
|
|
290
|
+
</Accordion>
|
|
291
|
+
<Accordion title="SSM registration timeout">
|
|
425
292
|
|
|
426
|
-
|
|
427
|
-
- **Monitor costs** with AWS billing alerts
|
|
428
|
-
- **Use least-privilege IAM roles**
|
|
429
|
-
- **Enable CloudTrail** for audit logging
|
|
293
|
+
The instance didn't register with Systems Manager. Check that:
|
|
430
294
|
|
|
431
|
-
|
|
295
|
+
- The launch template from the stack is used, so the instance gets the stack's IAM role.
|
|
296
|
+
- The instance is in the stack's public subnet, so it can reach SSM.
|
|
297
|
+
- The AMI is the TestDriver AMI, or an image built from it.
|
|
432
298
|
|
|
433
|
-
|
|
299
|
+
</Accordion>
|
|
300
|
+
<Accordion title="A test fails before it starts with a hook timeout">
|
|
434
301
|
|
|
435
|
-
|
|
436
|
-
- **Verify status checks** — Ensure instance has passed AWS status checks
|
|
437
|
-
- **Check AMI compatibility** — Some instance types don't support certain AMIs
|
|
302
|
+
Launching and preparing an instance takes several minutes. Raise `hookTimeout` in `vitest.config.mjs`.
|
|
438
303
|
|
|
439
|
-
|
|
304
|
+
</Accordion>
|
|
305
|
+
<Accordion title="Instances are left running">
|
|
440
306
|
|
|
441
|
-
|
|
442
|
-
- Check VPC routing and internet gateway configuration
|
|
443
|
-
- Confirm instance is in the correct subnet
|
|
307
|
+
TestDriver terminates instances after each test and when the process exits. A killed CI job can still leave one behind. Find instances by their `Name` tag, which starts with `td-`, and terminate them:
|
|
444
308
|
|
|
445
|
-
|
|
309
|
+
```bash
|
|
310
|
+
aws ec2 terminate-instances --region us-east-2 --instance-ids i-0123456789abcdef0
|
|
311
|
+
```
|
|
446
312
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
313
|
+
</Accordion>
|
|
314
|
+
</AccordionGroup>
|
|
315
|
+
|
|
316
|
+
## Next steps
|
|
317
|
+
|
|
318
|
+
<CardGroup cols={2}>
|
|
319
|
+
<Card title="Run on your own machine" icon="display" href="/bring-your-own-machine">
|
|
320
|
+
Run the runner on a laptop, lab machine, or on-prem VM.
|
|
321
|
+
</Card>
|
|
322
|
+
<Card title="Run tests in CI/CD" icon="code-branch" href="/ci-cd">
|
|
323
|
+
Authenticate and run tests in any CI provider.
|
|
324
|
+
</Card>
|
|
325
|
+
<Card title="Self-hosted" icon="server" href="/self-hosted">
|
|
326
|
+
What the Enterprise plan includes.
|
|
327
|
+
</Card>
|
|
328
|
+
<Card title="Launch apps" icon="rocket" href="/provision">
|
|
329
|
+
Start Chrome, desktop apps, and installers in the sandbox.
|
|
330
|
+
</Card>
|
|
331
|
+
</CardGroup>
|