testdriverai 6.2.0 → 6.2.2

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 (64) hide show
  1. package/.github/workflows/acceptance-tests.yml +2 -0
  2. package/.github/workflows/acceptance-v6.yml +2 -0
  3. package/.github/workflows/lint.yml +4 -1
  4. package/.github/workflows/publish-canary.yml +2 -0
  5. package/.github/workflows/publish-latest.yml +1 -0
  6. package/.github/workflows/self-hosted.yml +102 -0
  7. package/.prettierignore +1 -0
  8. package/.vscode/settings.json +4 -1
  9. package/agent/events.js +1 -10
  10. package/agent/index.js +98 -55
  11. package/agent/interface.js +43 -6
  12. package/agent/lib/censorship.js +15 -10
  13. package/agent/lib/commander.js +31 -18
  14. package/agent/lib/commands.js +62 -17
  15. package/agent/lib/debugger-server.js +0 -5
  16. package/agent/lib/generator.js +2 -2
  17. package/agent/lib/sdk.js +2 -1
  18. package/agent/lib/source-mapper.js +1 -1
  19. package/debugger/index.html +2 -2
  20. package/docs/account/enterprise.mdx +8 -12
  21. package/docs/account/pricing.mdx +2 -2
  22. package/docs/account/projects.mdx +5 -0
  23. package/docs/apps/tauri-apps.mdx +361 -0
  24. package/docs/cli/overview.mdx +6 -6
  25. package/docs/commands/assert.mdx +1 -0
  26. package/docs/commands/hover-text.mdx +3 -1
  27. package/docs/commands/match-image.mdx +5 -4
  28. package/docs/commands/press-keys.mdx +6 -8
  29. package/docs/commands/scroll-until-image.mdx +8 -7
  30. package/docs/commands/scroll-until-text.mdx +7 -6
  31. package/docs/commands/wait-for-image.mdx +5 -4
  32. package/docs/commands/wait-for-text.mdx +6 -5
  33. package/docs/docs.json +42 -40
  34. package/docs/getting-started/playwright.mdx +342 -0
  35. package/docs/getting-started/self-hosting.mdx +370 -0
  36. package/docs/getting-started/vscode.mdx +67 -56
  37. package/docs/guide/dashcam.mdx +118 -0
  38. package/docs/guide/environment-variables.mdx +5 -5
  39. package/docs/images/content/self-hosted/launchtemplateid.png +0 -0
  40. package/docs/images/content/vscode/ide-full.png +0 -0
  41. package/docs/images/content/vscode/running.png +0 -0
  42. package/docs/overview/comparison.mdx +22 -39
  43. package/docs/overview/quickstart.mdx +84 -32
  44. package/docs/styles.css +10 -1
  45. package/interfaces/cli/commands/generate.js +3 -0
  46. package/interfaces/cli/lib/base.js +27 -5
  47. package/interfaces/cli/utils/factory.js +17 -4
  48. package/interfaces/logger.js +4 -4
  49. package/interfaces/readline.js +1 -1
  50. package/package.json +3 -3
  51. package/schema.json +21 -0
  52. package/setup/aws/cloudformation.yaml +463 -0
  53. package/setup/aws/spawn-runner.sh +190 -0
  54. package/testdriver/acceptance/hover-text.yaml +2 -1
  55. package/testdriver/acceptance/prompt.yaml +4 -1
  56. package/testdriver/acceptance/scroll-until-image.yaml +5 -0
  57. package/testdriver/edge-cases/js-exception.yaml +8 -0
  58. package/testdriver/edge-cases/js-promise.yaml +19 -0
  59. package/testdriver/edge-cases/lifecycle/postrun.yaml +10 -0
  60. package/testdriver/edge-cases/success-test.yaml +9 -0
  61. package/testdriver/examples/web/lifecycle/postrun.yaml +7 -0
  62. package/testdriver/examples/web/lifecycle/{provision.yaml → prerun.yaml} +6 -0
  63. package/testdriver/lifecycle/postrun.yaml +7 -0
  64. package/testdriver/lifecycle/prerun.yaml +17 -0
@@ -0,0 +1,370 @@
1
+ ---
2
+ title: "Self-Hosting TestDriver"
3
+ sidebarTitle: "Self-Hosting"
4
+ description: "Complete guide to self-hosting TestDriver instances on AWS"
5
+ icon: "server"
6
+ ---
7
+
8
+ ```mermaid
9
+ graph LR
10
+ A[CLI] <--> B[api.testdriver.ai]
11
+ B <--> C[Your AWS EC2 Instance]
12
+ ```
13
+
14
+ Self-hosting TestDriver allows you to run tests on your own infrastructure, giving you full control over the environment, security, and configurations. This guide walks you through setting up and managing self-hosted TestDriver instances using AWS.
15
+
16
+ ## Why self host?
17
+
18
+ Self-hosting TestDriver gives you complete control over your test execution environment:
19
+
20
+ - **Enhanced security**: Get complete control over ingress and egress rules.
21
+ - **Complete customization**: Modify the TestDriver Golden Image (our pre-configured AMI) to include custom dependencies, software, and configurations at launch time.
22
+ - **Powerful Infrastructure**: Run tests on bare metal infrastructure that support emulators and simulators.
23
+
24
+ You'll use the [TestDriver CLI repository](https://github.com/testdriverai/cli) which contains all the infrastructure templates and setup scripts needed for self-hosting.
25
+
26
+ ## Overview
27
+
28
+ By the end of this guide, you'll have a complete self-hosted testing infrastructure that can:
29
+
30
+ - Spawn TestDriver instances on-demand in your AWS account
31
+ - Run tests on your own AWS infrastructure with custom configurations
32
+ - Integrate seamlessly with GitHub Actions CI/CD workflows
33
+ - Automatically clean up resources after test completion
34
+
35
+ The setup process involves three main steps:
36
+
37
+ 1. **CloudFormation Infrastructure**: Deploy our `setup/aws/cloudformation.yaml` template to create the foundational AWS resources (VPC, security groups, IAM roles, and a launch template for instance creation).
38
+ 2. **On-Demand Instance Spawning**: Use `setup/aws/spawn-runner.sh` with your Launch Template ID to programmatically spawn TestDriver instances whenever you need to run tests.
39
+ 3. **GitHub Actions Integration**: Use `.github/workflows/self-hosted.yml` as a template for running tests in CI. This workflow demonstrates the complete lifecycle: spawning an instance, running tests, and shutting down the instance to minimize costs.
40
+
41
+ ## Prerequisites
42
+
43
+ - AWS account with permissions to run CloudFormation.
44
+ - [AWS CLI](https://aws.amazon.com/cli/) installed locally.
45
+
46
+ <Tip>Be sure to run `aws configure` with your credentials</Tip>
47
+
48
+ - Access to the TestDriver AMI (Golden Image)\
49
+ [Contact us with your preferred AWS Region for access](https://form.typeform.com/to/UECf9rDx?typeform-source=testdriver.ai).
50
+ - A GitHub repository for committing your tests & workflow.
51
+
52
+ ## Step 1: Set Up AWS Infrastructure
53
+
54
+ ### Deploy CloudFormation Stack
55
+
56
+ Our [`setup/aws/cloudformation.yaml`](https://github.com/testdriverai/cli/tree/main/setup/aws/cloudformation.yaml) template creates:
57
+
58
+ - Dedicated VPC with public subnet
59
+ - Security group with proper port access
60
+ - IAM roles and instance profiles
61
+ - EC2 launch template for programmatic instance creation
62
+
63
+ This is a one-time setup used to generate a template ID for launching instances.
64
+
65
+ ```bash
66
+ # Deploy the CloudFormation stack
67
+ aws cloudformation deploy \
68
+ --template-file setup/aws/cloudformation.yaml \
69
+ --stack-name my-testdriver-infrastructure \
70
+ --parameter-overrides \
71
+ ProjectTag=testdriver \
72
+ AllowedIngressCidr=0.0.0.0/0 \
73
+ InstanceType=c5.xlarge \
74
+ CreateKeyPair=true \
75
+ --capabilities CAPABILITY_IAM
76
+ ```
77
+
78
+ <Danger>
79
+ **Security**: Replace `AllowedIngressCidr=0.0.0.0/0` with your specific IP
80
+ ranges to lock down access to your VPC.
81
+ </Danger>
82
+
83
+ ### Get Launch Template ID
84
+
85
+ After CloudFormation completes, find the launch template ID in the stack outputs:
86
+
87
+ ```bash
88
+ aws cloudformation describe-stacks \
89
+ --stack-name my-testdriver-infrastructure \
90
+ --query 'Stacks[0].Outputs[?OutputKey==`LaunchTemplateId`].OutputValue' \
91
+ --output text
92
+ ```
93
+
94
+ <Tip>**Save this ID** – you'll need it for the next step.</Tip>
95
+
96
+ ## Step 2: Spawn a New TestDriver Runner
97
+
98
+ This step is performed **every time you want to run tests**. The `spawn-runner.sh` script launches a new EC2 instance on-demand for test execution.
99
+
100
+ ### Using spawn-runner.sh
101
+
102
+ Our [`setup/aws/spawn-runner.sh`](https://github.com/testdriverai/cli/tree/main/setup/aws/spawn-runner.sh) script:
103
+
104
+ - Launches a new EC2 instance using your launch template from Step 1
105
+ - Waits for the instance to become ready
106
+ - Completes the TestDriver handshake
107
+ - Returns instance details (IP, instance ID) for CLI usage
108
+
109
+ The script accepts parameters as either environment variables or CLI arguments:
110
+
111
+ ```bash
112
+ # Launch an instance using environment variables
113
+ export AWS_REGION=us-east-2
114
+ export AMI_ID=ami-•••••••••• # Your TestDriver AMI (contact us to get one)
115
+ export AWS_LAUNCH_TEMPLATE_ID=lt-•••••••••• # From CloudFormation output from step 1
116
+ export RESOLUTION=1440x900 # Change screen resolution if desired (default is 1440x900)
117
+
118
+ /bin/bash ./setup/aws/spawn-runner.sh
119
+ ```
120
+
121
+ The script outputs:
122
+
123
+ ```
124
+ PUBLIC_IP=1.2.3.4
125
+ INSTANCE_ID=i-1234567890abcdef0
126
+ AWS_REGION=us-east-2
127
+ ```
128
+
129
+ <Note>
130
+ **Instance Lifecycle**: Instances spawned by this script will continue running
131
+ until you manually terminate them. They are automatically tagged with
132
+ `Name=TestDriverRunner` and `Project=[your ProjectTag value]` for easy
133
+ identification in the AWS console.
134
+ </Note>
135
+
136
+ #### Changing Resolution in Lifecycle Files
137
+
138
+ You can also change the resolution before running tests by adding an `exec` command in your `lifecycle/provision.yaml` file:
139
+
140
+ ```yaml lifecycle/provision.yaml
141
+ version: 6.0.0
142
+ steps:
143
+ - prompt: set screen resolution
144
+ commands:
145
+ - command: exec
146
+ lang: pwsh
147
+ code: |
148
+ C:\testdriver\SetResolution.ps1 -Width 1920 -Height 1080
149
+ ```
150
+
151
+ This approach is useful when you need different resolutions for different test scenarios. See the [Lifecycle Files documentation](/guide/lifecycle) for more information about provision scripts.
152
+
153
+ ### CLI Usage
154
+
155
+ Once you have an instance IP, run tests directly:
156
+
157
+ ```bash
158
+ # Basic test execution
159
+ npx testdriverai@latest run test.yaml --ip=1.2.3.4
160
+ ```
161
+
162
+ You can use the `PUBLIC_IP` to target the instance you just spawned via `./setup/aws/spawn-runner.sh`:
163
+
164
+ ```sh
165
+ npx testdriverai@latest run testdriver/your-test.yaml \
166
+ --ip="$PUBLIC_IP" \
167
+ ```
168
+
169
+ ### Terminating Instances
170
+
171
+ After your tests complete, terminate the instance to avoid unnecessary costs:
172
+
173
+ ```bash
174
+ # Terminate the instance
175
+ aws ec2 terminate-instances --instance-ids $INSTANCE_ID --region $AWS_REGION
176
+ ```
177
+
178
+ You can also terminate instances manually through the AWS console by searching for instances tagged with `Name=TestDriverRunner`.
179
+
180
+ ## Step 3: GitHub Actions Integration
181
+
182
+ This step shows you how to automate the entire test lifecycle in CI/CD.
183
+
184
+ ### Example Workflow
185
+
186
+ Our [`.github/workflows/self-hosted.yml`](https://github.com/testdriverai/cli/tree/main/.github/workflows/self-hosted.yml) demonstrates the complete workflow: spawning an EC2 instance, running your tests, and shutting down the instance automatically to minimize costs.
187
+
188
+ The workflow uses the GitHub secrets you configure (see below) to authenticate with AWS and spawn instances on-demand:
189
+
190
+ ```yaml
191
+ name: TestDriver Self-Hosted
192
+
193
+ on:
194
+ workflow_dispatch:
195
+ push:
196
+
197
+ jobs:
198
+ test:
199
+ runs-on: ubuntu-latest
200
+ steps:
201
+ - name: Checkout repository
202
+ uses: actions/checkout@v4
203
+
204
+ - name: Setup AWS Instance
205
+ id: aws-setup
206
+ run: |
207
+ OUTPUT=$(./setup/aws/spawn-runner.sh | tee /dev/stderr)
208
+ PUBLIC_IP=$(echo "$OUTPUT" | grep "PUBLIC_IP=" | cut -d'=' -f2)
209
+ INSTANCE_ID=$(echo "$OUTPUT" | grep "INSTANCE_ID=" | cut -d'=' -f2)
210
+ echo "public-ip=$PUBLIC_IP" >> $GITHUB_OUTPUT
211
+ echo "instance-id=$INSTANCE_ID" >> $GITHUB_OUTPUT
212
+ env:
213
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
214
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
215
+ AWS_REGION: ${{ secrets.AWS_REGION }}
216
+ AWS_LAUNCH_TEMPLATE_ID: ${{ secrets.AWS_LAUNCH_TEMPLATE_ID }}
217
+ AMI_ID: ${{ secrets.AMI_ID }}
218
+
219
+ - name: Run TestDriver
220
+ run: |
221
+ npx testdriverai run your-test.yaml \
222
+ --ip="${{ steps.aws-setup.outputs.public-ip }}"
223
+ env:
224
+ TD_API_KEY: ${{ secrets.TD_API_KEY }}
225
+
226
+ - name: Shutdown AWS Instance
227
+ if: always()
228
+ run: |
229
+ aws ec2 terminate-instances \
230
+ --region ${{ secrets.AWS_REGION }}
231
+ --instance-ids ${{ steps.aws-setup.outputs.instance-id }}
232
+ env:
233
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
234
+ AWS_REGION: ${{ secrets.AWS_REGION }}
235
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
236
+ ```
237
+
238
+ ### Required Secrets
239
+
240
+ Configure these secrets in your GitHub repository:
241
+
242
+ | Secret | Description | Example |
243
+ | ------------------------ | ----------------------------------- | ------------------------------------------------------------ |
244
+ | `AWS_ACCESS_KEY_ID` | AWS access key | `AKIAIOSFODNN7EXAMPLE` |
245
+ | `AWS_REGION` | AWS Region | `us-east-2` |
246
+ | `AWS_SECRET_ACCESS_KEY` | AWS secret key | `wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY` |
247
+ | `AWS_LAUNCH_TEMPLATE_ID` | Launch template from CloudFormation | `lt-07c53ce8349b958d1` |
248
+ | `AMI_ID` | TestDriver AMI ID | `ami-085f872ca0cd80fed` |
249
+ | `TD_API_KEY` | TestDriver API key | Your API key from [the dashboard](https://app.testdriver.ai) |
250
+
251
+ ## AMI Customization
252
+
253
+ ### Using the Base AMI
254
+
255
+ Our TestDriver Golden Image (AMI) comes pre-configured with everything you need to run tests:
256
+
257
+ **Operating System & Environment:**
258
+
259
+ - Windows Server with desktop environment
260
+ - VNC + web server for remote desktop access through the browser
261
+
262
+ **Development Tools:**
263
+
264
+ - Python (with pip)
265
+ - Node.js (with npm)
266
+ - Git
267
+
268
+ **Test Infrastructure:**
269
+
270
+ - TestDriver agent and dependencies
271
+ - Optimized settings for test execution
272
+ - Pre-configured networking for TestDriver CLI communication
273
+
274
+ ### Modifying the AMI
275
+
276
+ You can customize the AMI for your specific needs:
277
+
278
+ 1. **Launch an instance** from our base AMI
279
+ 2. **Make your changes** (install software, configure settings)
280
+ 3. **Create a new AMI** from your modified instance
281
+ 4. **Update your workflow** to use the new AMI ID
282
+
283
+ ### Amazon Image Builder
284
+
285
+ For automated AMI builds, use [Amazon EC2 Image Builder](https://aws.amazon.com/image-builder/):
286
+
287
+ ```yaml
288
+ # Example Image Builder pipeline
289
+ Components:
290
+ - Name: testdriver-base
291
+ Version: 1.0.0
292
+ Platform: Windows
293
+ Type: BUILD
294
+ Data: |
295
+ name: TestDriver Custom Setup
296
+ description: Custom TestDriver AMI with additional software
297
+ schemaVersion: 1.0
298
+ phases:
299
+ - name: build
300
+ steps:
301
+ - name: InstallSoftware
302
+ action: ExecutePowerShell
303
+ inputs:
304
+ commands:
305
+ - "# Your custom installation commands here"
306
+ ```
307
+
308
+ ## Security Considerations
309
+
310
+ ### Network Security
311
+
312
+ 1. **Restrict CIDR blocks**: Only allow access from your known IP ranges
313
+ 2. **Use VPC endpoints**: For private communication with AWS services
314
+ 3. **Enable VPC Flow Logs**: For network monitoring and debugging
315
+
316
+ ### AWS Authentication
317
+
318
+ Use [OIDC for GitHub Actions](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect) instead of long-term credentials:
319
+
320
+ ```yaml
321
+ permissions:
322
+ id-token: write
323
+ contents: read
324
+
325
+ steps:
326
+ - name: Configure AWS credentials
327
+ uses: aws-actions/configure-aws-credentials@v4
328
+ with:
329
+ role-to-assume: arn:aws:iam::123456789012:role/GitHubActionsRole
330
+ aws-region: us-east-2
331
+ ```
332
+
333
+ ### Instance Security
334
+
335
+ - **Terminate instances** immediately after use
336
+ - **Monitor costs** with AWS billing alerts
337
+ - **Use least-privilege IAM roles** for instance profiles
338
+ - **Enable CloudTrail** for audit logging
339
+
340
+ ## Troubleshooting
341
+
342
+ ### Common Issues
343
+
344
+ **Instance not responding in TestDriver CLI:**
345
+
346
+ When the CLI displays connection errors or timeouts, check:
347
+
348
+ - **Security group rules**: The CloudFormation template configures all necessary ports (RDP 3389, VNC 5900, and TestDriver communication ports). Verify your security group hasn't been modified.
349
+ - **Instance status checks**: Ensure the instance has passed both system and instance status checks in the AWS console.
350
+ - **AMI compatibility**: Verify the AMI is compatible with your selected instance type (some instance types don't support certain AMIs).
351
+
352
+ **Connection timeouts:**
353
+
354
+ - Verify network connectivity from runner to instance
355
+ - Check VPC routing and internet gateway configuration
356
+ - Confirm instance is in correct subnet
357
+
358
+ **AWS CLI errors:**
359
+
360
+ - Validate AWS credentials and permissions
361
+ - Check AWS service quotas and limits
362
+ - Verify region consistency across all resources
363
+
364
+ ### Getting Help
365
+
366
+ For enterprise customers:
367
+
368
+ - Contact your account manager for AMI access issues
369
+ - Use support channels for infrastructure questions
370
+ - Check the TestDriver documentation for CLI usage
@@ -1,75 +1,86 @@
1
1
  ---
2
2
  title: "Install the TestDriver VS Code Extension"
3
- sidebarTitle: "VS Code Setup"
3
+ sidebarTitle: "VS Code"
4
4
  description: "Comprehensive guide to installing and setting up TestDriver for VS Code"
5
5
  icon: "file-code"
6
+ tag: BETA
6
7
  ---
7
8
 
8
- <Card
9
- title="Get the VS Code Extension"
10
- icon="link"
11
- href="https://marketplace.visualstudio.com/items?itemName=testdriver.testdriver"
12
- >
13
- Turn your IDE into a powerful computer-use automation tool with our VS Code
14
- extension.
15
- </Card>
9
+ <iframe
10
+ className="w-full aspect-video rounded-xl"
11
+ src="https://www.youtube.com/embed/dell_2tI6nc"
12
+ title="YouTube video player"
13
+ frameBorder="0"
14
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
15
+ allowFullScreen
16
+ ></iframe>
17
+
18
+ The TestDriver VS Code extension is a powerful tool that integrates TestDriver's AI-driven test generation capabilities directly into your development environment:
19
+
20
+ - Get started with example scripts for different platforms
21
+ - Get syntax highlighting and autocompletion for [TestDriver YAML](/getting-started/editing)
22
+ - Chat with the TestDriver agent to generate tests based on your requirements
23
+ - Save and manage your tests directly within your project
24
+ - Run and debug tests directly from the IDE
25
+ - View test results and logs within the IDE
26
+
27
+ <Tip>
28
+ The TestDriver VS Code Extension is currently in beta. If you encounter any
29
+ issues or have feedback, please let us know [in
30
+ Discord](https://discord.com/invite/cWDFW8DzPm)
31
+ </Tip>
16
32
 
17
33
  <Steps>
18
- <Step title="Initialize Your Project" stepNumber={1}>
19
- Set up your project with:
20
-
21
- ```bash
22
- npx testdriverai@latest init
23
- ```
24
-
25
- This creates a `.env` file and sample workflow files.
34
+ <Step title="Install the VS Code Extension">
35
+
36
+ Click the button below to install the TestDriver extension for your preferred IDE. Then, follow the setup guide and chat with TestDriver to create your first test.
37
+
38
+ <Card
39
+ horizontal
40
+ title="VS Code"
41
+ arrow
42
+ href="vscode:extension/testdriver.testdriver"
43
+ icon="/images/content/extension/vscode.svg"
44
+ ></Card>
45
+
46
+ <Card
47
+ horizontal
48
+ title="Cursor"
49
+ arrow
50
+ href="cursor:extension/testdriver.testdriver"
51
+ icon="/images/content/extension/cursor.svg"
52
+
53
+ > </Card>
54
+
55
+ <Card
56
+ horizontal
57
+ title="Windsurf"
58
+ arrow
59
+ href="windsurf:extension/testdriver.testdriver"
60
+ icon="/images/content/extension/windsurf.svg"
61
+ ></Card>
26
62
 
27
63
  </Step>
28
- <Step title="Run TestDriver in Interactive Mode" stepNumber={2}>
29
- Start TestDriver in interactive mode to create and refine tests dynamically:
64
+ <Step title="Set Your TestDriver API Key">
65
+
66
+ After installing the extension, you'll need to set your TestDriver API key in the extension settings.
30
67
 
31
- ```bash
32
- npx testdriverai@latest
33
- ```
68
+ 1. Open the command palette (Cmd+Shift+P or Ctrl+Shift+P).
69
+ 2. Search for "Preferences: Open Settings (UI)" and select it.
70
+ 3. In the search bar, type "TestDriver" to filter the settings.
71
+ 4. Find the "TestDriver: Set API Key" field and enter your API key from [the TestDriver dashboard](https://app.testdriver.ai/team).
34
72
 
35
- Once started, you can use commands like `/explore`, `/run`, and `/save` to interactively build and test your flows.
73
+ <Tip>You can also set the `TD_API_KEY` environment variable in your system if you prefer not to enter it directly in the extension settings.</Tip>
36
74
 
37
75
  </Step>
38
- <Step title="Define Your Test Steps" stepNumber={3}>
39
- Use natural language to describe what you want to test. For example:
40
-
41
- ```
42
- > Open Google Chrome and search for "testdriverai"
43
- ```
44
-
45
- TestDriver will generate steps like:
46
-
47
- ```yaml
48
- - command: focus-application
49
- name: Google Chrome
50
- - command: hover-text
51
- text: Search Google or type a URL
52
- description: main search bar
53
- action: click
54
- - command: type
55
- text: testdriverai
56
- - command: press-keys
57
- keys:
58
- - enter
59
- ```
60
-
76
+ <Step title="Choose a Platform">
77
+ Click on the TestDriver icon in the sidebar to open the extension panel and choose a platform to get started (Web, Desktop, or Mobile).
61
78
  </Step>
62
- <Step title="Refine and Save Your Test" stepNumber={4}>
63
- - Save your test with `/save` to generate a reusable YAML file.
64
- - Use `/run` to run the test.
79
+ <Step title="Create Your First Test">
80
+ Now chat with the TestDriver agent to create your first test! Describe what you want to test, and the agent will generate the test steps for you.
65
81
  </Step>
66
- <Step title="Run Saved Tests" stepNumber={5}>
67
- Once saved, you can run your test file anytime:
68
-
69
- ```bash
70
- npx testdriverai@latest run path/to/test.yaml
71
- ```
72
-
82
+ <Step title="Run your test">
83
+ Run your test by clicking the "Run" button in the extension panel. You can view the test results and logs directly within VS Code's Test Explorer. [Learn more about running tests in VS Code](https://code.visualstudio.com/docs/debugtest/testing).
73
84
  </Step>
74
85
  </Steps>
75
86
 
@@ -0,0 +1,118 @@
1
+ ---
2
+ title: "Dashcam Replays"
3
+ sidebarTitle: "Dashcam"
4
+ description: "Learn how to use Dashcam to record and replay test sessions in TestDriver."
5
+ icon: "video"
6
+ ---
7
+
8
+ [Dashcam](https://www.dashcam.io), from the makers of TestDriver, is a powerful feature in TestDriver that allows you to record and replay your test sessions. This is particularly useful for debugging, sharing test runs with team members, or reviewing the steps taken during a test. For the full docs see the [Dashcam docs](https://docs.dashcam.io/dashcam/).
9
+
10
+ ## Recording a Test Session
11
+
12
+ To record a test session, you can use the `dashcam` command in your lifecycle scripts. There are two main lifecycle scripts where you can integrate Dashcam: `lifecycle/prerun.yaml` and `lifecycle/postrun.yaml`.
13
+
14
+ ## Ways to use Dashcam
15
+
16
+ Dashcam comes as a standalone app and a Chrome extension. You can use either or both to capture your test sessions.
17
+
18
+ <Info>
19
+ To capture web logs, make sure to install the Dashcam Chrome extension on the
20
+ browser you are testing with. We recommend installing it via CLI to Chrome for
21
+ Testing. You can also find the extension [in the Chrome
22
+ Webstore](https://chromewebstore.google.com/detail/dashcam/dkcoeknmlfnfimigfagbcjgpokhdcbbp)
23
+ </Info>
24
+
25
+ ### Installing the Dashcam Chrome extension via command line in prerun.yaml
26
+
27
+ In this lifecycle script, we install Chrome for Testing with a user profile that has the password manager disabled and sets up TestDriver Dashcam for replays and logs.
28
+
29
+ ```yaml lifecycle/prerun.yaml [expandable]
30
+ - prompt: launch chrome for testing and setup dashcam
31
+ commands:
32
+ # this script installs chrome for testing with a userprofile that has password manager disabled and sets up TestDriver Dashcam for replays and logs
33
+ - command: exec
34
+ lang: pwsh
35
+ code: |
36
+ cd $env:TEMP
37
+ Write-Host "Changed directory to TEMP: $env:TEMP"
38
+
39
+ Write-Host "Running 'npm init -y'..."
40
+ npm init -y
41
+
42
+ Write-Host "Installing dependencies: @puppeteer/browsers and dashcam-chrome..."
43
+ npm install @puppeteer/browsers dashcam-chrome
44
+
45
+ Write-Host "Installing Chromium via '@puppeteer/browsers'..."
46
+ npx @puppeteer/browsers install chrome
47
+
48
+ # Define paths
49
+ $extensionPath = Join-Path (Get-Location) "node_modules/dashcam-chrome/build"
50
+ $profilePath = Join-Path $env:TEMP "chrome-profile-$(Get-Random)"
51
+
52
+ Write-Host "Extension path: $extensionPath"
53
+ Write-Host "Chrome user data dir: $profilePath"
54
+
55
+ # Validate extension path
56
+ if (-not (Test-Path $extensionPath)) {
57
+ Write-Host "Extension not found at $extensionPath"
58
+ }
59
+
60
+ $chromeArgs = @(
61
+ "--start-maximized",
62
+ "--load-extension=$extensionPath",
63
+ "--user-data-dir=$profilePath",
64
+ "--no-first-run",
65
+ "--no-default-browser-check",
66
+ "--disable-infobars"
67
+ "${TD_WEBSITE}"
68
+ ) -join ' '
69
+
70
+ Start-Process "cmd.exe" -ArgumentList "/c", "npx @puppeteer/browsers launch chrome -- $chromeArgs"
71
+
72
+ Write-Host "Script complete."
73
+ exit 0
74
+ ```
75
+
76
+ ### Using the Chrome extension and capturing web logs
77
+
78
+ Now in the same `lifecycle/prerun.yaml` script, we set up Dashcam to track web logs and application logs. You can customize the patterns to match your needs. Testing Desktop? You can skip the web logs and just track application logs.
79
+
80
+ ```yaml lifecycle/prerun.yaml
81
+ ...
82
+ - command: exec
83
+ lang: pwsh
84
+ code: |
85
+ dashcam track --name="Web Logs" --type="web" --pattern="*"
86
+ dashcam track --name=TestDriver --type=application --pattern="C:\Users\testdriver\Documents\testdriver.log"
87
+ ```
88
+
89
+ ### Starting Dashcam
90
+
91
+ The final step in our `lifecycle/prerun.yaml` script is to start Dashcam recording.
92
+
93
+ ```yaml lifecycle/prerun.yaml
94
+ ...
95
+ - command: exec
96
+ lang: pwsh
97
+ code: dashcam start
98
+ ```
99
+
100
+ ### Publishing replays to a project in your account
101
+
102
+ Lastly, in the `lifecycle/postrun.yaml` script, we publish the recorded Dashcam session to a project in your Dashcam account. Make sure to replace `<YOUR_PROJECT_ID>` with the actual ID of your project.
103
+
104
+ ```yaml lifecycle/postrun.yaml
105
+ - prompt: send dashcam recording to server
106
+ # this script tells TestDriver Dashcam to send the recording to the server
107
+ commands:
108
+ - command: exec
109
+ lang: pwsh
110
+ code: dashcam -t '${TD_THIS_FILE}' -p -k <YOUR_PROJECT_ID> # optional add `-k MYFOLDERID` for the id of a folder in your Projects page at app.testdriver.ai
111
+ ```
112
+
113
+ <Info>
114
+ `${TD_THIS_FILE}` is an environment variable set by TestDriver that contains
115
+ the name of the current test file being executed. This will be used as the
116
+ title of the Dashcam recording. For more info see [parallel testing
117
+ docs](/features/parallel-testing).
118
+ </Info>
@@ -11,13 +11,13 @@ import GitignoreWarning from "/snippets/gitignore-warning.mdx";
11
11
  The supported environment variables in TestDriver are:
12
12
 
13
13
  <div className="env-vars-table">
14
- | Variable | Type | Description |
14
+ | Variable | Type | Description |
15
15
  |:---------------:|:---------:|---------------------------------------------------------------------------------|
16
- | TD_ANALYTICS | boolean | Send analytics to TestDriver servers. This helps provide feedback to inform our roadmap. |
17
- | TD_API_KEY | string | Set this to spawn VMs with TestDriver Pro. |
16
+ | TD_ANALYTICS | boolean | Send analytics to TestDriver servers. This helps
17
+ provide feedback to inform our roadmap. | | TD_API_KEY | string | Set this to
18
+ spawn VMs with TestDriver Pro. |
18
19
  </div>
19
-
20
- <GitignoreWarning/>
20
+ <GitignoreWarning />
21
21
  ## Example
22
22
 
23
23
  ```bash .env