@testdriverai/agent 7.11.229-test → 7.11.232-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 (100) hide show
  1. package/docs/_data/examples-manifest.json +16 -16
  2. package/docs/_scripts/generate-examples.js +38 -45
  3. package/docs/agent.mdx +174 -93
  4. package/docs/assert.mdx +73 -269
  5. package/docs/aws-setup.mdx +196 -314
  6. package/docs/bring-your-own-machine.mdx +139 -206
  7. package/docs/cache.mdx +144 -151
  8. package/docs/caching.mdx +99 -89
  9. package/docs/captcha.mdx +126 -111
  10. package/docs/ci-cd.mdx +154 -543
  11. package/docs/click.mdx +74 -229
  12. package/docs/client.mdx +177 -231
  13. package/docs/copilot/auto-healing.mdx +86 -370
  14. package/docs/copilot/running-tests.mdx +121 -930
  15. package/docs/customizing-devices.mdx +74 -251
  16. package/docs/dashcam.mdx +72 -405
  17. package/docs/debugging-with-screenshots.mdx +105 -371
  18. package/docs/docs.json +79 -22
  19. package/docs/double-click.mdx +48 -68
  20. package/docs/errors.mdx +102 -176
  21. package/docs/events.mdx +170 -327
  22. package/docs/examples/{hover-text-with-description.mdx → add-to-cart.mdx} +30 -35
  23. package/docs/examples/assert.mdx +28 -41
  24. package/docs/examples/click-button.mdx +71 -0
  25. package/docs/examples/{hover-image.mdx → click-icon.mdx} +32 -28
  26. package/docs/examples/element-not-found.mdx +27 -26
  27. package/docs/examples/findall-coffee-icons.mdx +28 -32
  28. package/docs/examples/installer.mdx +61 -25
  29. package/docs/examples/launch-vscode-linux.mdx +28 -51
  30. package/docs/examples/navigate-and-scroll.mdx +82 -0
  31. package/docs/examples/parse.mdx +24 -28
  32. package/docs/examples/press-keys.mdx +28 -25
  33. package/docs/examples/scroll.mdx +25 -27
  34. package/docs/examples/type.mdx +26 -21
  35. package/docs/exec.mdx +92 -256
  36. package/docs/extract.mdx +69 -170
  37. package/docs/find.mdx +140 -736
  38. package/docs/focus-application.mdx +69 -246
  39. package/docs/generating-tests.mdx +103 -137
  40. package/docs/guide/best-practices-polling.mdx +65 -141
  41. package/docs/hosted.mdx +80 -144
  42. package/docs/hover.mdx +62 -235
  43. package/docs/locating-elements.mdx +74 -369
  44. package/docs/making-assertions.mdx +116 -74
  45. package/docs/mcp-setup.mdx +80 -63
  46. package/docs/mouse-down.mdx +48 -125
  47. package/docs/mouse-up.mdx +47 -129
  48. package/docs/options.mdx +75 -48
  49. package/docs/parse.mdx +95 -184
  50. package/docs/performing-actions.mdx +104 -94
  51. package/docs/press-keys.mdx +59 -299
  52. package/docs/provision.mdx +137 -182
  53. package/docs/quickstart-claude.mdx +85 -0
  54. package/docs/quickstart-github.mdx +62 -32
  55. package/docs/quickstart-manual.mdx +60 -33
  56. package/docs/quickstart-vscode.mdx +97 -0
  57. package/docs/quickstart.mdx +26 -9
  58. package/docs/redraw.mdx +101 -165
  59. package/docs/reusable-code.mdx +97 -200
  60. package/docs/right-click.mdx +47 -89
  61. package/docs/screenshot.mdx +47 -201
  62. package/docs/screenshots.mdx +87 -137
  63. package/docs/scroll.mdx +71 -154
  64. package/docs/secrets.mdx +96 -91
  65. package/docs/self-hosted.mdx +83 -142
  66. package/docs/snippets/enterprise.mdx +15 -0
  67. package/docs/styles.css +68 -0
  68. package/docs/test-results-json.mdx +167 -204
  69. package/docs/type.mdx +56 -304
  70. package/docs/variables.mdx +121 -81
  71. package/docs/wait.mdx +33 -31
  72. package/docs/what-is-testdriver.mdx +80 -32
  73. package/examples/{hover-text-with-description.test.mjs → add-to-cart.test.mjs} +4 -5
  74. package/examples/assert.test.mjs +3 -20
  75. package/examples/{hover-text.test.mjs → click-button.test.mjs} +3 -4
  76. package/examples/{hover-image.test.mjs → click-icon.test.mjs} +5 -6
  77. package/examples/element-not-found.test.mjs +3 -5
  78. package/examples/findall-coffee-icons.test.mjs +3 -3
  79. package/examples/installer.test.mjs +1 -1
  80. package/examples/launch-vscode-linux.test.mjs +6 -33
  81. package/examples/{scroll-keyboard.test.mjs → navigate-and-scroll.test.mjs} +4 -5
  82. package/examples/parse.test.mjs +1 -2
  83. package/examples/press-keys.test.mjs +4 -4
  84. package/examples/scroll.test.mjs +3 -6
  85. package/examples/type.test.mjs +5 -2
  86. package/lib/provision.js +6 -2
  87. package/package.json +1 -1
  88. package/sdk.d.ts +4 -2
  89. package/sdk.js +1 -1
  90. package/docs/claude-mcp-plugin.mdx +0 -244
  91. package/docs/elements.mdx +0 -606
  92. package/docs/examples/ai.mdx +0 -78
  93. package/docs/examples/captcha-api.mdx +0 -92
  94. package/docs/examples/chrome-extension.mdx +0 -156
  95. package/docs/examples/drag-and-drop.mdx +0 -100
  96. package/docs/examples/formatted-logging.mdx +0 -74
  97. package/docs/examples/hover-text.mdx +0 -70
  98. package/docs/examples/match-image.mdx +0 -97
  99. package/docs/examples/scroll-keyboard.mdx +0 -80
  100. package/docs/examples/scroll-until-text.mdx +0 -109
package/docs/hover.mdx CHANGED
@@ -1,279 +1,106 @@
1
1
  ---
2
2
  title: "hover()"
3
3
  sidebarTitle: "hover"
4
- description: "Hover over elements or coordinates"
4
+ description: "Move the mouse over an element or a point without clicking, to reveal tooltips and menus."
5
5
  icon: "hand-pointer"
6
6
  ---
7
7
 
8
- ## Overview
9
-
10
- Move the mouse cursor onto elements or coordinates without a click. Use this to show tooltips, dropdowns, and hover effects.
11
-
12
- ## Element Hover
13
-
14
- Put the cursor on a found element.
15
-
16
- ### Syntax
8
+ Move the mouse onto an element without clicking. Use it to reveal tooltips, dropdown menus and hover styles.
17
9
 
18
10
  ```javascript
19
- await element.hover()
11
+ await testdriver.find('Products menu in the top navigation').hover();
12
+ await testdriver.find('Laptops in the Products dropdown').click();
20
13
  ```
21
14
 
22
- ### Returns
15
+ ## element.hover()
23
16
 
24
- `Promise<void>`
25
-
26
- ### Examples
27
-
28
- ```javascript
29
- // Find and hover
30
- const tooltip = await testdriver.find('info icon');
31
- await tooltip.hover();
17
+ Moves the mouse to the point where [`find()`](/find) located the element. It's the same as `element.click('hover')`.
32
18
 
33
- // Wait to see tooltip
34
- await new Promise(r => setTimeout(r, 1000));
19
+ ```typescript
20
+ element.hover(): Promise<void>
21
+ ```
35
22
 
36
- // Hover over menu to reveal submenu
37
- const menu = await testdriver.find('Products menu');
38
- await menu.hover();
23
+ It takes no parameters.
39
24
 
40
- const submenu = await testdriver.find('Laptops submenu item');
41
- await submenu.click();
42
- ```
25
+ ### Errors
43
26
 
44
- ## Coordinate Hover
27
+ Throws an `ElementNotFoundError` if `find()` didn't locate the element. See [click()](/click#errors) for how to check `found()` first.
45
28
 
46
- Put the cursor at screen coordinates.
29
+ ## testdriver.hover(options)
47
30
 
48
- ### Syntax
31
+ Moves the mouse to a point on the screen by its coordinates. Prefer `element.hover()`, which keeps working when the layout or screen size changes.
49
32
 
50
- ```javascript
51
- await testdriver.hover(x, y)
33
+ ```typescript
34
+ testdriver.hover(options: { x: number; y: number }): Promise<void>
52
35
  ```
53
36
 
54
- ### Parameters
55
-
56
- <ParamField path="x" type="number" required>
57
- X coordinate
37
+ <ParamField path="options" type="object" required>
38
+ <Expandable title="properties">
39
+ <ParamField path="x" type="number" required>
40
+ Distance from the left edge of the screen, in pixels.
41
+ </ParamField>
42
+ <ParamField path="y" type="number" required>
43
+ Distance from the top edge of the screen, in pixels.
44
+ </ParamField>
45
+ </Expandable>
58
46
  </ParamField>
59
47
 
60
- <ParamField path="y" type="number" required>
61
- Y coordinate
62
- </ParamField>
48
+ ```javascript
49
+ await testdriver.hover({ x: 640, y: 360 });
50
+ ```
63
51
 
64
- ### Returns
52
+ <Note>
53
+ The older form `testdriver.hover(x, y)` still works. Use the options object in new tests.
54
+ </Note>
65
55
 
66
- `Promise<void>`
56
+ ## Examples
67
57
 
68
- ### Examples
58
+ ### Read a tooltip
69
59
 
70
60
  ```javascript
71
- // Hover at coordinates
72
- await testdriver.hover(500, 300);
73
-
74
- // Hover and wait
75
- await testdriver.hover(500, 300);
76
- await new Promise(r => setTimeout(r, 1000));
61
+ await testdriver.find('help icon next to the Password label').hover();
62
+ const tooltip = await testdriver.extract('the text of the tooltip');
77
63
  ```
78
64
 
79
- ## Best Practices
80
-
81
- <Check>
82
- **Prefer element hover over coordinates**
83
-
84
- ```javascript
85
- // ✅ Preferred
86
- const icon = await testdriver.find('info icon');
87
- await icon.hover();
88
-
89
- // ❌ Avoid
90
- await testdriver.hover(500, 300);
91
- ```
92
- </Check>
93
-
94
- <Check>
95
- **Wait after hovering for dynamic content**
96
-
97
- ```javascript
98
- const menuItem = await testdriver.find('Settings menu');
99
- await menuItem.hover();
100
-
101
- // Wait for submenu to appear
102
- await new Promise(r => setTimeout(r, 500));
103
-
104
- const subItem = await testdriver.find('Profile submenu');
105
- await subItem.click();
106
- ```
107
- </Check>
65
+ ### Check a hover style
108
66
 
109
- <Check>
110
- **Verify element was found before hovering**
111
-
112
- ```javascript
113
- const element = await testdriver.find('tooltip trigger');
114
- if (!element.found()) {
115
- throw new Error('Element not found');
116
- }
117
- await element.hover();
118
- ```
119
- </Check>
120
-
121
- ## Use Cases
67
+ ```javascript
68
+ await testdriver.find('Sign in button').hover();
69
+ await testdriver.assert('the Sign in button is highlighted');
70
+ ```
122
71
 
123
- <AccordionGroup>
124
- <Accordion title="Tooltips">
125
- ```javascript
126
- // Hover to show tooltip
127
- const icon = await testdriver.find('help icon');
128
- await icon.hover();
129
-
130
- await new Promise(r => setTimeout(r, 1000));
131
-
132
- // Read tooltip content
133
- const tooltipText = await testdriver.extract('the tooltip text');
134
- console.log('Tooltip:', tooltipText);
135
- ```
136
- </Accordion>
137
-
138
- <Accordion title="Dropdown Menus">
139
- ```javascript
140
- // Hover to reveal dropdown
141
- const menuItem = await testdriver.find('Products menu item');
142
- await menuItem.hover();
143
-
144
- // Wait for dropdown animation
145
- await new Promise(r => setTimeout(r, 500));
146
-
147
- // Click submenu option
148
- const category = await testdriver.find('Electronics category');
149
- await category.click();
150
- ```
151
- </Accordion>
152
-
153
- <Accordion title="Image Previews">
154
- ```javascript
155
- // Hover over thumbnail to see preview
156
- const thumbnail = await testdriver.find('product thumbnail');
157
- await thumbnail.hover();
158
-
159
- await new Promise(r => setTimeout(r, 800));
160
-
161
- // Verify preview appears
162
- await testdriver.assert('product preview is displayed');
163
- ```
164
- </Accordion>
165
-
166
- <Accordion title="Hover Effects">
167
- ```javascript
168
- // Test hover state styling
169
- const button = await testdriver.find('call to action button');
170
- await button.hover();
171
-
172
- await new Promise(r => setTimeout(r, 500));
173
-
174
- // Verify hover effect
175
- await testdriver.assert('button background changed to blue');
176
- ```
177
- </Accordion>
178
-
179
- <Accordion title="Drag and Drop">
180
- ```javascript
181
- // Use hover in drag and drop
182
- const item = await testdriver.find('draggable item');
183
- await item.mouseDown();
184
-
185
- // Hover over drop zone
186
- const dropZone = await testdriver.find('drop area');
187
- await dropZone.hover();
188
-
189
- await new Promise(r => setTimeout(r, 300));
190
- await dropZone.mouseUp();
191
- ```
192
- </Accordion>
193
- </AccordionGroup>
72
+ ### Drag an item
194
73
 
195
- ## Complete Example
74
+ `hover()` moves the mouse while the button is held down by [`mouseDown()`](/mouse-down):
196
75
 
197
76
  ```javascript
198
- import { beforeAll, afterAll, describe, it } from 'vitest';
199
- import TestDriver from 'testdriverai';
200
-
201
- describe('Hover Interactions', () => {
202
- let testdriver;
77
+ await testdriver.find('Task card titled "Write docs"').mouseDown();
78
+ await testdriver.find('Done column').hover();
79
+ await testdriver.find('Done column').mouseUp();
80
+ ```
203
81
 
204
- beforeAll(async () => {
205
- client = new TestDriver(process.env.TD_API_KEY);
206
- await testdriver.auth();
207
- await testdriver.connect();
208
- });
82
+ ## Complete example
209
83
 
210
- afterAll(async () => {
211
- await testdriver.disconnect();
212
- });
84
+ ```javascript tests/hover.test.mjs
85
+ import { describe, expect, it } from 'vitest';
86
+ import { TestDriver } from 'testdriverai/vitest/hooks';
213
87
 
214
- it('should show tooltip on hover', async () => {
215
- await testdriver.focusApplication('Google Chrome');
216
-
217
- // Find and hover over icon
218
- const infoIcon = await testdriver.find('information icon');
219
- await infoIcon.hover();
220
-
221
- // Wait for tooltip to appear
222
- await new Promise(r => setTimeout(r, 1000));
223
-
224
- // Verify tooltip is visible
225
- await testdriver.assert('tooltip is displayed');
226
-
227
- // Extract tooltip text
228
- const tooltipText = await testdriver.extract('the tooltip message');
229
- console.log('Tooltip says:', tooltipText);
230
- });
88
+ describe('Hover', () => {
89
+ it('highlights the sign in button on hover', async (context) => {
90
+ const testdriver = TestDriver(context);
91
+ await testdriver.provision.chrome({ url: 'https://testdriver-sandbox.vercel.app/login' });
231
92
 
232
- it('should navigate dropdown menu', async () => {
233
- // Hover over main menu
234
- const menu = await testdriver.find('Navigation menu');
235
- await menu.hover();
236
-
237
- // Wait for dropdown
238
- await new Promise(r => setTimeout(r, 500));
239
-
240
- // Hover over submenu item
241
- const submenu = await testdriver.find('Account submenu');
242
- await submenu.hover();
243
-
244
- await new Promise(r => setTimeout(r, 300));
245
-
246
- // Click nested menu item
247
- const settings = await testdriver.find('Settings option');
248
- await settings.click();
249
-
250
- await testdriver.assert('settings page is displayed');
251
- });
93
+ await testdriver.find('Sign in button below the password field').hover();
252
94
 
253
- it('should preview images on hover', async () => {
254
- // Hover over product image
255
- const productImg = await testdriver.find('product 1 thumbnail');
256
- await productImg.hover();
257
-
258
- // Wait for preview
259
- await new Promise(r => setTimeout(r, 800));
260
-
261
- // Verify preview appeared
262
- await testdriver.assert('large product preview is shown');
263
-
264
- // Move away
265
- const otherElement = await testdriver.find('page heading');
266
- await otherElement.hover();
267
-
268
- // Verify preview disappeared
269
- await new Promise(r => setTimeout(r, 500));
270
- await testdriver.assert('product preview is hidden');
95
+ const result = await testdriver.assert('the mouse pointer is over the Sign in button');
96
+ expect(result).toBe(true);
271
97
  });
272
98
  });
273
99
  ```
274
100
 
275
- ## Related Methods
101
+ ## Related
276
102
 
277
- - [`find()`](/find) - Locate elements to hover
278
- - [`click()`](/click) - Click after hovering
279
- - [`mouseDown()`](/click) - Start drag operations
103
+ - [find()](/find): locate the element to hover over
104
+ - [click()](/click): click after a menu opens
105
+ - [mouseDown()](/mouse-down) and [mouseUp()](/mouse-up): drag and drop
106
+ - [Perform actions](/performing-actions): every kind of action in one guide