@testdriverai/agent 7.9.33-test → 7.9.34-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.
Files changed (76) hide show
  1. package/ai/skills/testdriver:ai/SKILL.md +204 -0
  2. package/ai/skills/testdriver:assert/SKILL.md +315 -0
  3. package/ai/skills/testdriver:aws-setup/SKILL.md +448 -0
  4. package/ai/skills/testdriver:cache/SKILL.md +221 -0
  5. package/ai/skills/testdriver:caching/SKILL.md +124 -0
  6. package/ai/skills/testdriver:captcha/SKILL.md +158 -0
  7. package/ai/skills/testdriver:ci-cd/SKILL.md +602 -0
  8. package/ai/skills/testdriver:click/SKILL.md +286 -0
  9. package/ai/skills/testdriver:client/SKILL.md +477 -0
  10. package/ai/skills/testdriver:customizing-devices/SKILL.md +319 -0
  11. package/ai/skills/testdriver:dashcam/SKILL.md +451 -0
  12. package/ai/skills/testdriver:debugging-with-screenshots/SKILL.md +415 -0
  13. package/ai/skills/testdriver:device-config/SKILL.md +317 -0
  14. package/ai/skills/testdriver:double-click/SKILL.md +102 -0
  15. package/ai/skills/testdriver:elements/SKILL.md +605 -0
  16. package/ai/skills/testdriver:enterprise/SKILL.md +7 -0
  17. package/ai/skills/testdriver:errors/SKILL.md +246 -0
  18. package/ai/skills/testdriver:events/SKILL.md +356 -0
  19. package/ai/skills/testdriver:exec/SKILL.md +317 -0
  20. package/ai/skills/testdriver:find/SKILL.md +860 -0
  21. package/ai/skills/testdriver:focus-application/SKILL.md +293 -0
  22. package/ai/skills/testdriver:generating-tests/SKILL.md +36 -0
  23. package/ai/skills/testdriver:hosted/SKILL.md +156 -0
  24. package/ai/skills/testdriver:hover/SKILL.md +278 -0
  25. package/ai/skills/testdriver:locating-elements/SKILL.md +71 -0
  26. package/ai/skills/testdriver:making-assertions/SKILL.md +32 -0
  27. package/ai/skills/testdriver:mcp/SKILL.md +7 -0
  28. package/ai/skills/testdriver:mouse-down/SKILL.md +161 -0
  29. package/ai/skills/testdriver:mouse-up/SKILL.md +164 -0
  30. package/ai/skills/testdriver:parse/SKILL.md +236 -0
  31. package/ai/skills/testdriver:performing-actions/SKILL.md +53 -0
  32. package/ai/skills/testdriver:press-keys/SKILL.md +348 -0
  33. package/ai/skills/testdriver:provision/SKILL.md +331 -0
  34. package/ai/skills/testdriver:quickstart/SKILL.md +172 -0
  35. package/ai/skills/testdriver:redraw/SKILL.md +214 -0
  36. package/ai/skills/testdriver:reusable-code/SKILL.md +249 -0
  37. package/ai/skills/testdriver:right-click/SKILL.md +123 -0
  38. package/ai/skills/testdriver:running-tests/SKILL.md +185 -0
  39. package/ai/skills/testdriver:screenshot/SKILL.md +248 -0
  40. package/ai/skills/testdriver:screenshots/SKILL.md +184 -0
  41. package/ai/skills/testdriver:scroll/SKILL.md +205 -0
  42. package/ai/skills/testdriver:secrets/SKILL.md +115 -0
  43. package/ai/skills/testdriver:self-hosted/SKILL.md +147 -0
  44. package/ai/skills/testdriver:test-results-json/SKILL.md +257 -0
  45. package/ai/skills/testdriver:testdriver/SKILL.md +624 -0
  46. package/ai/skills/testdriver:type/SKILL.md +357 -0
  47. package/ai/skills/testdriver:variables/SKILL.md +111 -0
  48. package/ai/skills/testdriver:wait/SKILL.md +50 -0
  49. package/ai/skills/testdriver:waiting-for-elements/SKILL.md +90 -0
  50. package/ai/skills/testdriver:what-is-testdriver/SKILL.md +54 -0
  51. package/docs/_data/examples-manifest.json +42 -42
  52. package/docs/v7/debugging-with-screenshots.mdx +14 -0
  53. package/docs/v7/examples/ai.mdx +1 -1
  54. package/docs/v7/examples/assert.mdx +1 -1
  55. package/docs/v7/examples/chrome-extension.mdx +2 -2
  56. package/docs/v7/examples/element-not-found.mdx +1 -1
  57. package/docs/v7/examples/exec-output.mdx +1 -1
  58. package/docs/v7/examples/exec-pwsh.mdx +1 -1
  59. package/docs/v7/examples/findall-coffee-icons.mdx +1 -1
  60. package/docs/v7/examples/focus-window.mdx +1 -1
  61. package/docs/v7/examples/hover-image.mdx +1 -1
  62. package/docs/v7/examples/hover-text-with-description.mdx +1 -1
  63. package/docs/v7/examples/hover-text.mdx +1 -1
  64. package/docs/v7/examples/installer.mdx +1 -1
  65. package/docs/v7/examples/launch-vscode-linux.mdx +1 -1
  66. package/docs/v7/examples/parse.mdx +1 -1
  67. package/docs/v7/examples/press-keys.mdx +1 -1
  68. package/docs/v7/examples/prompt.mdx +1 -1
  69. package/docs/v7/examples/scroll-keyboard.mdx +1 -1
  70. package/docs/v7/examples/scroll-until-image.mdx +1 -1
  71. package/docs/v7/examples/scroll.mdx +1 -1
  72. package/docs/v7/examples/type.mdx +1 -1
  73. package/docs/v7/examples/windows-installer.mdx +1 -1
  74. package/docs/v7/find.mdx +33 -0
  75. package/package.json +1 -1
  76. package/setup/aws/spawn-runner.sh +24 -3
@@ -0,0 +1,293 @@
1
+ ---
2
+ name: testdriver:focus-application
3
+ description: Bring an application window to the foreground
4
+ ---
5
+ <!-- Generated from focus-application.mdx. DO NOT EDIT. -->
6
+
7
+ ## Overview
8
+
9
+ Bring a specific application window to the foreground and make it the active window for interactions.
10
+
11
+ ## Syntax
12
+
13
+ ```javascript
14
+ await testdriver.focusApplication(name)
15
+ ```
16
+
17
+ ## Parameters
18
+
19
+ <ParamField path="name" type="string" required>
20
+ Application name (e.g., `'Google Chrome'`, `'Microsoft Edge'`, `'Notepad'`)
21
+ </ParamField>
22
+
23
+ ## Returns
24
+
25
+ `Promise<string>` - Result message
26
+
27
+ ## Examples
28
+
29
+ ### Common Applications
30
+
31
+ ```javascript
32
+ // Focus Chrome browser
33
+ await testdriver.focusApplication('Google Chrome');
34
+
35
+ // Focus Edge browser
36
+ await testdriver.focusApplication('Microsoft Edge');
37
+
38
+ // Focus Notepad
39
+ await testdriver.focusApplication('Notepad');
40
+
41
+ // Focus File Explorer
42
+ await testdriver.focusApplication('File Explorer');
43
+
44
+ // Focus Visual Studio Code
45
+ await testdriver.focusApplication('Visual Studio Code');
46
+ ```
47
+
48
+ ### After Opening Applications
49
+
50
+ ```javascript
51
+ // Open Chrome and focus it
52
+ await testdriver.exec('pwsh', `
53
+ Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "https://example.com"
54
+ `, 5000);
55
+
56
+ await new Promise(r => setTimeout(r, 2000)); // Wait for launch
57
+
58
+ // Focus the Chrome window
59
+ await testdriver.focusApplication('Google Chrome');
60
+ ```
61
+
62
+ ## Best Practices
63
+
64
+ <Check>
65
+ **Focus before UI interactions**
66
+
67
+ Always focus the target application before interacting with its UI:
68
+
69
+ ```javascript
70
+ await testdriver.focusApplication('Google Chrome');
71
+
72
+ const button = await testdriver.find('submit button');
73
+ await button.click();
74
+ ```
75
+ </Check>
76
+
77
+ <Check>
78
+ **Wait after launching apps**
79
+
80
+ Give applications time to open before focusing:
81
+
82
+ ```javascript
83
+ await testdriver.exec('pwsh', 'Start-Process notepad', 5000);
84
+ await new Promise(r => setTimeout(r, 1000)); // Wait for launch
85
+ await testdriver.focusApplication('Notepad');
86
+ ```
87
+ </Check>
88
+
89
+ <Check>
90
+ **Use exact application names**
91
+
92
+ ```javascript
93
+ // ✅ Correct
94
+ await testdriver.focusApplication('Google Chrome');
95
+
96
+ // ❌ May not work
97
+ await testdriver.focusApplication('Chrome');
98
+ await testdriver.focusApplication('chrome.exe');
99
+ ```
100
+ </Check>
101
+
102
+ <Warning>
103
+ **Application must be running**
104
+
105
+ The application must already be running. `focusApplication()` won't launch applications, only bring existing windows to the foreground.
106
+ </Warning>
107
+
108
+ ## Use Cases
109
+
110
+ <AccordionGroup>
111
+ <Accordion title="Multi-Application Testing">
112
+ ```javascript
113
+ // Test workflow across multiple apps
114
+ await testdriver.focusApplication('Google Chrome');
115
+ const data = await testdriver.extract('the order number');
116
+
117
+ await testdriver.focusApplication('Notepad');
118
+ await testdriver.type(data);
119
+ await testdriver.pressKeys(['ctrl', 's']);
120
+
121
+ await testdriver.focusApplication('Google Chrome');
122
+ const nextButton = await testdriver.find('next button');
123
+ await nextButton.click();
124
+ ```
125
+ </Accordion>
126
+
127
+ <Accordion title="Browser Switching">
128
+ ```javascript
129
+ // Compare behavior in different browsers
130
+ await testdriver.focusApplication('Google Chrome');
131
+ await testdriver.assert('page loaded correctly in Chrome');
132
+
133
+ await testdriver.focusApplication('Microsoft Edge');
134
+ await testdriver.assert('page loaded correctly in Edge');
135
+ ```
136
+ </Accordion>
137
+
138
+ <Accordion title="Desktop Application Testing">
139
+ ```javascript
140
+ // Launch and focus desktop app
141
+ await testdriver.exec('pwsh', 'Start-Process notepad', 5000);
142
+ await new Promise(r => setTimeout(r, 1000));
143
+
144
+ await testdriver.focusApplication('Notepad');
145
+ await testdriver.type('Test content');
146
+ ```
147
+ </Accordion>
148
+
149
+ <Accordion title="Window Management">
150
+ ```javascript
151
+ // Show desktop first
152
+ await testdriver.pressKeys(['winleft', 'd']);
153
+
154
+ // Click desktop icon
155
+ const icon = await testdriver.find('Chrome icon on desktop');
156
+ await icon.click();
157
+
158
+ await new Promise(r => setTimeout(r, 2000));
159
+
160
+ // Focus the opened window
161
+ await testdriver.focusApplication('Google Chrome');
162
+ ```
163
+ </Accordion>
164
+ </AccordionGroup>
165
+
166
+ ## Common Application Names
167
+
168
+ ### Browsers
169
+ - `'Google Chrome'`
170
+ - `'Microsoft Edge'`
171
+ - `'Mozilla Firefox'`
172
+ - `'Safari'` (macOS)
173
+
174
+ ### Office Applications
175
+ - `'Microsoft Word'`
176
+ - `'Microsoft Excel'`
177
+ - `'Microsoft PowerPoint'`
178
+ - `'Microsoft Outlook'`
179
+
180
+ ### Development Tools
181
+ - `'Visual Studio Code'`
182
+ - `'Visual Studio'`
183
+ - `'IntelliJ IDEA'`
184
+ - `'Sublime Text'`
185
+
186
+ ### System Applications
187
+ - `'Notepad'`
188
+ - `'File Explorer'`
189
+ - `'Command Prompt'`
190
+ - `'Windows PowerShell'`
191
+ - `'Task Manager'`
192
+
193
+ ### Communication
194
+ - `'Microsoft Teams'`
195
+ - `'Slack'`
196
+ - `'Discord'`
197
+ - `'Zoom'`
198
+
199
+ ## Complete Example
200
+
201
+ ```javascript
202
+ import { beforeAll, afterAll, describe, it } from 'vitest';
203
+ import TestDriver from 'testdriverai';
204
+
205
+ describe('Multi-Application Workflow', () => {
206
+ let testdriver;
207
+
208
+ beforeAll(async () => {
209
+ client = new TestDriver(process.env.TD_API_KEY);
210
+ await testdriver.auth();
211
+ await testdriver.connect();
212
+ });
213
+
214
+ afterAll(async () => {
215
+ await testdriver.disconnect();
216
+ });
217
+
218
+ it('should work across multiple applications', async () => {
219
+ // Start in browser
220
+ await testdriver.focusApplication('Google Chrome');
221
+
222
+ // Get data from web page
223
+ const orderNumber = await testdriver.extract('the order number');
224
+ console.log('Order:', orderNumber);
225
+
226
+ // Open Notepad
227
+ await testdriver.exec('pwsh', 'Start-Process notepad', 5000);
228
+ await new Promise(r => setTimeout(r, 1500));
229
+
230
+ // Focus Notepad and save data
231
+ await testdriver.focusApplication('Notepad');
232
+ await testdriver.type(`Order Number: ${orderNumber}`);
233
+ await testdriver.type('\n');
234
+ await testdriver.type(`Date: ${new Date().toISOString()}`);
235
+
236
+ // Save file
237
+ await testdriver.pressKeys(['ctrl', 's']);
238
+ await new Promise(r => setTimeout(r, 500));
239
+
240
+ await testdriver.type('C:\\order-info.txt');
241
+ await testdriver.pressKeys(['enter']);
242
+
243
+ // Return to browser
244
+ await testdriver.focusApplication('Google Chrome');
245
+
246
+ const confirmButton = await testdriver.find('confirm order button');
247
+ await confirmButton.click();
248
+
249
+ await testdriver.assert('order confirmed');
250
+ });
251
+
252
+ it('should switch between browser tabs', async () => {
253
+ await testdriver.focusApplication('Google Chrome');
254
+
255
+ // Open new tab
256
+ await testdriver.pressKeys(['ctrl', 't']);
257
+ await new Promise(r => setTimeout(r, 500));
258
+
259
+ // Navigate to URL
260
+ await testdriver.pressKeys(['ctrl', 'l']);
261
+ await testdriver.type('https://example.com');
262
+ await testdriver.pressKeys(['enter']);
263
+
264
+ await new Promise(r => setTimeout(r, 2000));
265
+
266
+ // Ensure Chrome is still focused
267
+ await testdriver.focusApplication('Google Chrome');
268
+
269
+ await testdriver.assert('example.com page is loaded');
270
+ });
271
+
272
+ it('should handle dialog boxes', async () => {
273
+ await testdriver.focusApplication('Google Chrome');
274
+
275
+ const deleteButton = await testdriver.find('delete account button');
276
+ await deleteButton.click();
277
+
278
+ await new Promise(r => setTimeout(r, 500));
279
+
280
+ // Dialog appears - make sure it's focused
281
+ await testdriver.focusApplication('Google Chrome');
282
+
283
+ const confirmBtn = await testdriver.find('confirm deletion button');
284
+ await confirmBtn.click();
285
+ });
286
+ });
287
+ ```
288
+
289
+ ## Related Methods
290
+
291
+ - [`exec()`](/v7/exec) - Launch applications with PowerShell
292
+ - [`pressKeys()`](/v7/press-keys) - Use Alt+Tab to switch windows
293
+ - [`find()`](/v7/find) - Locate elements in the focused window
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: testdriver:generating-tests
3
+ description: Use AI coding agents and exploration mode to generate TestDriver tests
4
+ ---
5
+ <!-- Generated from generating-tests.mdx. DO NOT EDIT. -->
6
+
7
+ ## Instructions for Coding Agents
8
+
9
+ We recommend starting with [our quickstart](./quickstart) then supplying your coding agent with our agent instructions file.
10
+
11
+ <Card title="TestDriver Agent Instructions" icon="link" arrow="true" horizontal href="https://github.com/testdriverai/testdriverai/blob/main/ai/agents/testdriver.md?plain=1">
12
+ Copy the current version of our agent instructions to provide your coding agent with up-to-date instructions on how to generate TestDriver tests.
13
+ </Card>
14
+
15
+ Then, you can prompt your coding agent to generate tests. Here is an example prompt:
16
+
17
+ ```md
18
+ Make me a TestDriver test that does the following steps:
19
+
20
+ Navigate to practicetestautomation.com
21
+ Type username student into Username field
22
+ Type password Password123 into Password field
23
+ Push Submit button
24
+ Verify new page contains expected text 'logged in'
25
+ ```
26
+
27
+ ## AI Exploration Mode
28
+
29
+ Within a test, the `ai()` method lets TestDriver autonomously figure out how to accomplish a task. It's useful for dynamic or unpredictable UIs where explicit actions may be difficult to define.
30
+
31
+ ```javascript
32
+ // Handle dynamic or unpredictable UI
33
+ await testdriver.ai('dismiss any popups or modals that appear');
34
+ ```
35
+
36
+ <Info>Explicit commands are preferred for production tests, as they are cheaper, faster, and more reliable.</Info>
@@ -0,0 +1,156 @@
1
+ ---
2
+ name: testdriver:hosted
3
+ description: The fastest way to get started with TestDriver. Just set your API key and start testing.
4
+ ---
5
+ <!-- Generated from hosted.mdx. DO NOT EDIT. -->
6
+
7
+ Hosted pricing is based on **device-seconds**: the amount of time your tests run on **our infrastructure**.
8
+
9
+ - **Zero Setup** — Start testing immediately. No DevOps required.
10
+ - **Free Tier** — Get started with a limited preview at no cost.
11
+ - **Pay As You Go** — Only pay for the device-seconds you use.
12
+
13
+ ## Hosted Plans
14
+
15
+ <CardGroup cols={3}>
16
+ <Card title="Free Trial" icon="gift" href="https://docs.testdriver.ai">
17
+ **$0/month**
18
+
19
+ - 1 Concurrent Sandbox
20
+ - 60 Minutes Included
21
+ - 1 Team User
22
+ - Community Support
23
+ </Card>
24
+
25
+ <Card title="Pro" icon="rocket" href="https://console.testdriver.ai/checkout/pro">
26
+ **$20/month**
27
+
28
+ - 2 Concurrent Sandboxes
29
+ - 600 Minutes Included
30
+ - Overage: $0.002/second
31
+ - 1 Team User
32
+ - Test Recordings
33
+ - Community Support
34
+ </Card>
35
+
36
+ <Card title="Team" icon="users" href="https://console.testdriver.ai/checkout/team">
37
+ **$600/month**
38
+
39
+ - 8 Concurrent Sandboxes
40
+ - 10,000 Minutes Included
41
+ - Overage: $0.001/second
42
+ - 5 Team Users
43
+ - Test Recordings
44
+ - Private Support
45
+ - Test Analytics
46
+ - CPU, RAM, & Network Profiles
47
+ </Card>
48
+ </CardGroup>
49
+
50
+ ## Get Started
51
+ Hosted is the default when you follow the Quickstart guide.
52
+ <Card
53
+ title="Try the Quickstart"
54
+ icon="play"
55
+ href="/v7/quickstart"
56
+ >
57
+ Set your API key and start testing in minutes.
58
+ </Card>
59
+
60
+ ## Parallel Testing Limits
61
+
62
+ Your account has a set number of **license slots** that determine how many devices can run simultaneously. You can view your available slots in the [TestDriver Dashboard](https://console.testdriver.ai).
63
+
64
+ <Info>
65
+ **When is a slot in use?** A license slot is occupied when a test client is connected. As soon as your device is destroyed the slot becomes available immediately.
66
+ </Info>
67
+
68
+ ## Avoiding Slot Conflicts
69
+
70
+ To prevent tests from failing due to exceeding your license slot limit, we recommend two key configurations:
71
+
72
+ <AccordionGroup>
73
+ <Accordion title="Set Maximum Concurrency in Vitest">
74
+ Limit concurrent tests to match your available license slots:
75
+
76
+ ```javascript vitest.config.mjs
77
+ import { defineConfig } from 'vitest/config';
78
+ import TestDriver from 'testdriverai/vitest';
79
+
80
+ export default defineConfig({
81
+ test: {
82
+ testTimeout: 900000,
83
+ hookTimeout: 900000,
84
+ maxConcurrency: 5, // Set to your license slot limit
85
+ reporters: ['default', TestDriver()],
86
+ setupFiles: ['testdriverai/vitest/setup'],
87
+ },
88
+ });
89
+ ```
90
+
91
+ <Tip>
92
+ Check your slot count at [console.testdriver.ai](https://console.testdriver.ai) and set `maxConcurrency` to that number or lower.
93
+ </Tip>
94
+ </Accordion>
95
+
96
+ <Accordion title="Use GitHub Concurrency Keys">
97
+ Prevent multiple workflow runs from competing for the same slots by using [GitHub's concurrency controls](https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs):
98
+
99
+ ```yaml .github/workflows/test.yml
100
+ name: Tests
101
+
102
+ on:
103
+ push:
104
+ branches: [main]
105
+ pull_request:
106
+
107
+ # Prevent concurrent runs from competing for license slots
108
+ concurrency:
109
+ group: ${{ github.workflow }}-${{ github.ref }}
110
+ cancel-in-progress: true
111
+
112
+ jobs:
113
+ test:
114
+ runs-on: ubuntu-latest
115
+ steps:
116
+ - uses: actions/checkout@v4
117
+
118
+ - name: Setup Node.js
119
+ uses: actions/setup-node@v4
120
+ with:
121
+ node-version: '20'
122
+
123
+ - name: Install dependencies
124
+ run: npm install
125
+
126
+ - name: Run tests
127
+ run: vitest run
128
+ env:
129
+ TD_API_KEY: ${{ secrets.TD_API_KEY }}
130
+ ```
131
+
132
+ The `concurrency` block ensures:
133
+ - Only one workflow run per branch runs at a time
134
+ - New pushes cancel in-progress runs on the same branch
135
+ - Different branches/PRs can run in parallel (up to your slot limit)
136
+ </Accordion>
137
+ </AccordionGroup>
138
+
139
+ ## When to Consider Self-Hosted
140
+
141
+ Hosted is perfect for getting started and for teams that want zero infrastructure management. However, you might consider [Self-Hosted](/v7/self-hosted) if you:
142
+
143
+ - Want to escape per-second billing with a flat license fee
144
+ - Require greater concurrency than offered in Cloud plans
145
+ - Need full control over your infrastructure and privacy
146
+ - Want to use your own AI API keys
147
+ - Require custom hardware configurations
148
+ - Have high test volumes that make self-hosting more economical
149
+
150
+ <Card
151
+ title="Explore Self-Hosted"
152
+ icon="server"
153
+ href="/v7/self-hosted"
154
+ >
155
+ Learn about self-hosting for unlimited test execution at a flat rate.
156
+ </Card>