@testdriverai/agent 7.11.240-test → 7.11.241-canary

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 (52) hide show
  1. package/ai/skills/testdriver-agent/SKILL.md +174 -91
  2. package/ai/skills/testdriver-assert/SKILL.md +73 -269
  3. package/ai/skills/testdriver-aws-setup/SKILL.md +194 -312
  4. package/ai/skills/testdriver-bring-your-own-machine/SKILL.md +137 -204
  5. package/ai/skills/testdriver-cache/SKILL.md +142 -149
  6. package/ai/skills/testdriver-caching/SKILL.md +97 -87
  7. package/ai/skills/testdriver-captcha/SKILL.md +126 -111
  8. package/ai/skills/testdriver-ci-cd/SKILL.md +153 -542
  9. package/ai/skills/testdriver-click/SKILL.md +74 -229
  10. package/ai/skills/testdriver-client/SKILL.md +175 -229
  11. package/ai/skills/testdriver-customizing-devices/SKILL.md +72 -250
  12. package/ai/skills/testdriver-dashcam/SKILL.md +71 -404
  13. package/ai/skills/testdriver-debugging-with-screenshots/SKILL.md +103 -369
  14. package/ai/skills/testdriver-double-click/SKILL.md +46 -67
  15. package/ai/skills/testdriver-errors/SKILL.md +102 -176
  16. package/ai/skills/testdriver-events/SKILL.md +170 -327
  17. package/ai/skills/testdriver-exec/SKILL.md +92 -256
  18. package/ai/skills/testdriver-extract/SKILL.md +69 -170
  19. package/ai/skills/testdriver-find/SKILL.md +140 -736
  20. package/ai/skills/testdriver-focus-application/SKILL.md +69 -246
  21. package/ai/skills/testdriver-generating-tests/SKILL.md +102 -136
  22. package/ai/skills/testdriver-hosted/SKILL.md +79 -143
  23. package/ai/skills/testdriver-hover/SKILL.md +62 -235
  24. package/ai/skills/testdriver-locating-elements/SKILL.md +71 -366
  25. package/ai/skills/testdriver-making-assertions/SKILL.md +114 -72
  26. package/ai/skills/testdriver-mcp-setup/SKILL.md +79 -62
  27. package/ai/skills/testdriver-mouse-down/SKILL.md +46 -124
  28. package/ai/skills/testdriver-mouse-up/SKILL.md +45 -128
  29. package/ai/skills/testdriver-options/SKILL.md +73 -46
  30. package/ai/skills/testdriver-parse/SKILL.md +95 -184
  31. package/ai/skills/testdriver-performing-actions/SKILL.md +101 -91
  32. package/ai/skills/testdriver-press-keys/SKILL.md +59 -299
  33. package/ai/skills/testdriver-provision/SKILL.md +135 -179
  34. package/ai/skills/testdriver-quickstart/SKILL.md +24 -8
  35. package/ai/skills/testdriver-quickstart-claude/SKILL.md +84 -0
  36. package/ai/skills/testdriver-quickstart-github/SKILL.md +62 -32
  37. package/ai/skills/testdriver-quickstart-manual/SKILL.md +59 -32
  38. package/ai/skills/testdriver-quickstart-vscode/SKILL.md +96 -0
  39. package/ai/skills/testdriver-redraw/SKILL.md +100 -164
  40. package/ai/skills/testdriver-reusable-code/SKILL.md +95 -199
  41. package/ai/skills/testdriver-right-click/SKILL.md +45 -88
  42. package/ai/skills/testdriver-screenshot/SKILL.md +47 -201
  43. package/ai/skills/testdriver-screenshots/SKILL.md +86 -136
  44. package/ai/skills/testdriver-scroll/SKILL.md +71 -154
  45. package/ai/skills/testdriver-secrets/SKILL.md +94 -90
  46. package/ai/skills/testdriver-self-hosted/SKILL.md +82 -140
  47. package/ai/skills/testdriver-test-results-json/SKILL.md +165 -202
  48. package/ai/skills/testdriver-type/SKILL.md +56 -304
  49. package/ai/skills/testdriver-variables/SKILL.md +119 -80
  50. package/ai/skills/testdriver-wait/SKILL.md +31 -29
  51. package/ai/skills/testdriver-what-is-testdriver/SKILL.md +80 -32
  52. package/package.json +1 -1
@@ -1,224 +1,123 @@
1
1
  ---
2
2
  name: testdriver:extract
3
- description: Read information from the screen using AI and return it as a string
3
+ description: Read a value off the screen with AI and get it back as a string.
4
4
  ---
5
5
  <!-- Generated from extract.mdx. DO NOT EDIT. -->
6
6
 
7
- ## Overview
7
+ Read a value off the screen, such as an order number or a price. Describe what you want, and the AI returns it as a string.
8
8
 
9
- Get information from the screen with AI. TestDriver returns it as a string. Describe what you want in natural language. The AI reads the screen and returns the correct value: text, numbers, labels, status messages, or other content on the screen.
9
+ ```javascript
10
+ const orderNumber = await testdriver.extract('the order confirmation number');
11
+ ```
10
12
 
11
- [`assert()`](/assert) returns a boolean result. But `extract()` returns the real value. Thus you can store it, compare it, or use it in later steps and in framework assertions.
13
+ [`assert()`](/assert) tells you whether something is true. `extract()` gives you the value itself, so you can compare it, log it, or type it somewhere else.
12
14
 
13
- ## Syntax
15
+ ## Signature
14
16
 
15
- ```javascript
16
- const value = await testdriver.extract(description)
17
- const value = await testdriver.extract({ description })
17
+ ```typescript
18
+ testdriver.extract(description: string): Promise<string>
19
+ testdriver.extract(options: { description: string }): Promise<string>
18
20
  ```
19
21
 
22
+ Both forms do the same thing.
23
+
20
24
  ## Parameters
21
25
 
22
26
  <ParamField path="description" type="string" required>
23
- A natural language description of the information to read from the screen.
27
+ What to read from the screen, such as `'the total price in the order summary'`. Say what format you want, too: `'the cart total as a number, without the dollar sign'`.
24
28
  </ParamField>
25
29
 
26
- <Info>
27
- `extract()` also accepts an options object, `extract({ description })`. This is the same as the positional form. The string form is the most common.
28
- </Info>
29
-
30
30
  ## Returns
31
31
 
32
- `Promise<string>` — The information from the screen. TestDriver returns the value as text. Parse it or cast it yourself if you need a number or another type.
32
+ `Promise<string>`. The value the AI read, with no extra text. Convert it yourself when you need a number or another type.
33
33
 
34
- ## Examples
35
-
36
- ### Basic Extraction
34
+ ## Errors
37
35
 
38
- ```javascript
39
- // Read text content
40
- const title = await testdriver.extract('the page title');
41
- const heading = await testdriver.extract('the main heading text');
36
+ `extract()` throws if the AI service fails, for example when it's temporarily unavailable.
42
37
 
43
- // Read numbers and prices
44
- const price = await testdriver.extract('the total price shown in the cart');
45
- const count = await testdriver.extract('the number of items in the list');
38
+ It doesn't throw when the value isn't on screen. Check the result before you rely on it.
46
39
 
47
- // Read status and confirmation values
48
- const status = await testdriver.extract('the order status');
49
- const orderNumber = await testdriver.extract('the order confirmation number');
50
- ```
40
+ ## Examples
51
41
 
52
- ### Using the Extracted Value
42
+ ### Compare a value with expect()
53
43
 
54
44
  ```javascript
55
- // Store and reuse across steps
56
- const orderNumber = await testdriver.extract('the order confirmation number');
57
- console.log('Order:', orderNumber);
58
-
59
- // Combine with framework assertions
60
- import { expect } from 'vitest';
61
-
62
45
  const message = await testdriver.extract('the success message text');
63
46
  expect(message).toContain('successfully');
64
-
65
- // Cast to a number when you need to compare
66
- const totalText = await testdriver.extract('the cart total as a number without currency symbol');
67
- expect(Number(totalText)).toBeGreaterThan(0);
68
47
  ```
69
48
 
70
- ## Best Practices
71
-
72
- <Check>
73
- **Be specific about what to read**
74
-
75
- Precise descriptions produce cleaner values:
76
-
77
- ```javascript
78
- // ❌ Too vague — may return extra surrounding text
79
- const price = await testdriver.extract('price');
80
-
81
- // ✅ Specific — targets a single value
82
- const price = await testdriver.extract('the total price in the order summary, digits only');
83
- ```
84
- </Check>
85
-
86
- <Check>
87
- **Ask for the format you want**
88
-
89
- Steer the output by describing the desired shape in the prompt:
49
+ ### Read a number
90
50
 
91
- ```javascript
92
- // Strip currency symbols
93
- const total = await testdriver.extract('the order total as a number without the dollar sign');
94
-
95
- // Isolate a single field
96
- const email = await testdriver.extract('the email address shown in the profile header');
97
- ```
98
- </Check>
99
-
100
- <Check>
101
- **Extract for detailed assertions**
102
-
103
- Use `extract()` when a boolean [`assert()`](/assert) isn't enough and you need the actual value to inspect:
104
-
105
- ```javascript
106
- const confirmation = await testdriver.extract('the confirmation number');
107
- expect(confirmation).toMatch(/^ORD-\d{6}$/);
108
- ```
109
- </Check>
110
-
111
- ## Use Cases
112
-
113
- <AccordionGroup>
114
- <Accordion title="Capturing Confirmation Details">
115
- ```javascript
116
- const submitBtn = await testdriver.find('place order button');
117
- await submitBtn.click();
118
-
119
- // Read the confirmation the app generated
120
- const orderNumber = await testdriver.extract('the order confirmation number');
121
- const eta = await testdriver.extract('the estimated delivery date');
51
+ ```javascript
52
+ const total = await testdriver.extract('the cart total as a number, without the dollar sign');
53
+ expect(Number(total)).toBeGreaterThan(0);
54
+ ```
122
55
 
123
- console.log(`Order ${orderNumber} arrives ${eta}`);
124
- ```
125
- </Accordion>
56
+ ### Check the format of a generated value
126
57
 
127
- <Accordion title="Reading Tooltip and Hover Content">
128
- ```javascript
129
- const icon = await testdriver.find('info icon next to the price');
130
- await icon.hover();
58
+ ```javascript
59
+ const confirmation = await testdriver.extract('the confirmation number');
60
+ expect(confirmation).toMatch(/^ORD-\d{6}$/);
61
+ ```
131
62
 
132
- const tooltipText = await testdriver.extract('the tooltip text');
133
- expect(tooltipText).toContain('tax included');
134
- ```
135
- </Accordion>
63
+ ### Pass a value to the next step
136
64
 
137
- <Accordion title="Verifying Dynamic Values">
138
- ```javascript
139
- // Read a value before an action
140
- const before = await testdriver.extract('the account balance');
65
+ ```javascript
66
+ const resetCode = await testdriver.extract('the password reset code');
141
67
 
142
- const addBtn = await testdriver.find('add funds button');
143
- await addBtn.click();
68
+ await testdriver.find('Reset code input field').click();
69
+ await testdriver.type(resetCode);
70
+ ```
144
71
 
145
- // Read it again after and compare
146
- const after = await testdriver.extract('the account balance');
147
- expect(Number(after.replace(/[^0-9.]/g, ''))).toBeGreaterThan(
148
- Number(before.replace(/[^0-9.]/g, ''))
149
- );
150
- ```
151
- </Accordion>
72
+ ### Read text that appears on hover
152
73
 
153
- <Accordion title="Passing Data Between Steps">
154
- ```javascript
155
- // Read a generated code on one screen...
156
- const resetCode = await testdriver.extract('the password reset code');
74
+ ```javascript
75
+ await testdriver.find('info icon next to the price').hover();
157
76
 
158
- // ...and type it into the next
159
- const codeField = await testdriver.find('reset code input');
160
- await codeField.click();
161
- await testdriver.type(resetCode);
162
- ```
163
- </Accordion>
164
- </AccordionGroup>
77
+ const tooltip = await testdriver.extract('the tooltip text');
78
+ expect(tooltip).toContain('tax included');
79
+ ```
165
80
 
166
- ## Complete Example
81
+ ## How it works
167
82
 
168
- ```javascript
169
- import { beforeAll, afterAll, describe, it, expect } from 'vitest';
170
- import TestDriver from 'testdriverai';
83
+ 1. TestDriver takes a screenshot of the sandbox.
84
+ 2. It sends the screenshot and your description to the AI.
85
+ 3. The AI returns only the value you asked for.
171
86
 
172
- describe('Extraction', () => {
173
- let testdriver;
87
+ Results aren't cached. Every call reads the current screen.
174
88
 
175
- beforeAll(async () => {
176
- testdriver = new TestDriver(process.env.TD_API_KEY);
177
- await testdriver.auth();
178
- await testdriver.connect();
179
- });
89
+ ## Complete example
180
90
 
181
- afterAll(async () => {
182
- await testdriver.disconnect();
183
- });
91
+ ```javascript tests/login.test.mjs
92
+ import { describe, expect, it } from 'vitest';
93
+ import { TestDriver } from 'testdriverai/vitest/hooks';
184
94
 
185
- it('should capture the order confirmation', async () => {
186
- await testdriver.focusApplication('Google Chrome');
95
+ describe('Login', () => {
96
+ it('signs in with the password shown on the page', async (context) => {
97
+ const testdriver = TestDriver(context);
98
+ await testdriver.provision.chrome({ url: 'https://testdriver-sandbox.vercel.app/login' });
187
99
 
188
- // Complete a checkout
189
- const checkoutBtn = await testdriver.find('checkout button');
190
- await checkoutBtn.click();
100
+ // The sandbox login page shows its test password on screen
101
+ const password = await testdriver.extract('the password');
102
+ expect(password).not.toBe('');
191
103
 
192
- const placeOrderBtn = await testdriver.find('place order button');
193
- await placeOrderBtn.click();
104
+ await testdriver.find('Username input field').click();
105
+ await testdriver.type('standard_user');
194
106
 
195
- // Verify we reached confirmation
196
- await testdriver.assert('the order confirmation page is displayed');
107
+ await testdriver.find('Password input field').click();
108
+ await testdriver.type(password, { secret: true });
197
109
 
198
- // Extract the details the app generated
199
- const orderNumber = await testdriver.extract('the order confirmation number');
200
- const total = await testdriver.extract('the order total as a number without currency symbol');
110
+ await testdriver.find('Sign in button below the password field').click();
201
111
 
202
- // Assert on the extracted values
203
- expect(orderNumber).toBeTruthy();
204
- expect(Number(total)).toBeGreaterThan(0);
112
+ const result = await testdriver.assert('the product list is shown');
113
+ expect(result).toBe(true);
205
114
  });
206
115
  });
207
116
  ```
208
117
 
209
- ## How It Works
210
-
211
- 1. TestDriver captures a screenshot of the current screen
212
- 2. The image and your description are sent to the TestDriver API
213
- 3. The AI reads the requested information from the screenshot
214
- 4. The extracted value is returned as a string
215
-
216
- <Note>
217
- Like [assertions](/making-assertions), `extract()` reads the screen fresh on every call — it is not cached — so it always reflects the current state of the app.
218
- </Note>
219
-
220
- ## Related Methods
118
+ ## Related
221
119
 
222
- - [`assert()`](/assert) - Verify screen state with a boolean AI judgment
223
- - [`find()`](/find) - Locate elements to interact with
224
- - [`parse()`](/parse) - Detect all UI elements on screen
120
+ - [assert()](/assert): check a statement about the screen
121
+ - [Make assertions](/making-assertions): choose between `assert()` and `extract()`
122
+ - [find()](/find): locate an element to act on
123
+ - [parse()](/parse): list every element on screen