@testdriverai/agent 7.11.240-test → 7.11.241-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/ai/skills/testdriver-agent/SKILL.md +174 -91
- package/ai/skills/testdriver-assert/SKILL.md +73 -269
- package/ai/skills/testdriver-aws-setup/SKILL.md +194 -312
- package/ai/skills/testdriver-bring-your-own-machine/SKILL.md +137 -204
- package/ai/skills/testdriver-cache/SKILL.md +142 -149
- package/ai/skills/testdriver-caching/SKILL.md +97 -87
- package/ai/skills/testdriver-captcha/SKILL.md +126 -111
- package/ai/skills/testdriver-ci-cd/SKILL.md +153 -542
- package/ai/skills/testdriver-click/SKILL.md +74 -229
- package/ai/skills/testdriver-client/SKILL.md +175 -229
- package/ai/skills/testdriver-customizing-devices/SKILL.md +72 -250
- package/ai/skills/testdriver-dashcam/SKILL.md +71 -404
- package/ai/skills/testdriver-debugging-with-screenshots/SKILL.md +103 -369
- package/ai/skills/testdriver-double-click/SKILL.md +46 -67
- package/ai/skills/testdriver-errors/SKILL.md +102 -176
- package/ai/skills/testdriver-events/SKILL.md +170 -327
- package/ai/skills/testdriver-exec/SKILL.md +92 -256
- package/ai/skills/testdriver-extract/SKILL.md +69 -170
- package/ai/skills/testdriver-find/SKILL.md +140 -736
- package/ai/skills/testdriver-focus-application/SKILL.md +69 -246
- package/ai/skills/testdriver-generating-tests/SKILL.md +102 -136
- package/ai/skills/testdriver-hosted/SKILL.md +79 -143
- package/ai/skills/testdriver-hover/SKILL.md +62 -235
- package/ai/skills/testdriver-locating-elements/SKILL.md +71 -366
- package/ai/skills/testdriver-making-assertions/SKILL.md +114 -72
- package/ai/skills/testdriver-mcp-setup/SKILL.md +79 -62
- package/ai/skills/testdriver-mouse-down/SKILL.md +46 -124
- package/ai/skills/testdriver-mouse-up/SKILL.md +45 -128
- package/ai/skills/testdriver-options/SKILL.md +73 -46
- package/ai/skills/testdriver-parse/SKILL.md +95 -184
- package/ai/skills/testdriver-performing-actions/SKILL.md +101 -91
- package/ai/skills/testdriver-press-keys/SKILL.md +59 -299
- package/ai/skills/testdriver-provision/SKILL.md +135 -179
- package/ai/skills/testdriver-quickstart/SKILL.md +24 -8
- package/ai/skills/testdriver-quickstart-claude/SKILL.md +84 -0
- package/ai/skills/testdriver-quickstart-github/SKILL.md +62 -32
- package/ai/skills/testdriver-quickstart-manual/SKILL.md +59 -32
- package/ai/skills/testdriver-quickstart-vscode/SKILL.md +96 -0
- package/ai/skills/testdriver-redraw/SKILL.md +100 -164
- package/ai/skills/testdriver-reusable-code/SKILL.md +95 -199
- package/ai/skills/testdriver-right-click/SKILL.md +45 -88
- package/ai/skills/testdriver-screenshot/SKILL.md +47 -201
- package/ai/skills/testdriver-screenshots/SKILL.md +86 -136
- package/ai/skills/testdriver-scroll/SKILL.md +71 -154
- package/ai/skills/testdriver-secrets/SKILL.md +94 -90
- package/ai/skills/testdriver-self-hosted/SKILL.md +82 -140
- package/ai/skills/testdriver-test-results-json/SKILL.md +165 -202
- package/ai/skills/testdriver-type/SKILL.md +56 -304
- package/ai/skills/testdriver-variables/SKILL.md +119 -80
- package/ai/skills/testdriver-wait/SKILL.md +31 -29
- package/ai/skills/testdriver-what-is-testdriver/SKILL.md +80 -32
- package/package.json +1 -1
|
@@ -1,161 +1,83 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: testdriver:mouse-down
|
|
3
|
-
description: Press the mouse button
|
|
3
|
+
description: Press and hold the left mouse button on an element, to start a drag.
|
|
4
4
|
---
|
|
5
5
|
<!-- Generated from mouse-down.mdx. DO NOT EDIT. -->
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
The `mouseDown()` method pushes the mouse button at the location of an element. It does not release the button. Use this for drag operations, custom gestures, or when you need precise control of the mouse events. You can call it on an [`Element`](/core-concepts/elements) instance. Or you can use it with a selector.
|
|
10
|
-
|
|
11
|
-
## Syntax
|
|
7
|
+
Press the left mouse button on an element and keep it held down. Use it with [`hover()`](/hover) and [`mouseUp()`](/mouse-up) to drag and drop:
|
|
12
8
|
|
|
13
9
|
```javascript
|
|
14
|
-
|
|
15
|
-
await
|
|
16
|
-
|
|
17
|
-
// Mouse down using a selector
|
|
18
|
-
await ai.mouseDown('selector');
|
|
10
|
+
await testdriver.find('Task card titled "Write docs"').mouseDown();
|
|
11
|
+
await testdriver.find('Done column').hover();
|
|
12
|
+
await testdriver.find('Done column').mouseUp();
|
|
19
13
|
```
|
|
20
14
|
|
|
21
|
-
##
|
|
15
|
+
## element.mouseDown()
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
Moves the mouse to the point where [`find()`](/find) located the element, then presses the left button. The button stays down until you call `mouseUp()`. It's the same as `element.click('mouseDown')`.
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
```typescript
|
|
20
|
+
element.mouseDown(): Promise<void>
|
|
21
|
+
```
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|-----------|------|-------------|
|
|
29
|
-
| `selector` | `string` | The selector describing the element where the mouse button should be pressed |
|
|
23
|
+
It takes no parameters.
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
### Errors
|
|
32
26
|
|
|
33
|
-
|
|
27
|
+
Throws an `ElementNotFoundError` if `find()` didn't locate the element. See [click()](/click#errors) for how to check `found()` first.
|
|
34
28
|
|
|
35
|
-
##
|
|
29
|
+
## Press at coordinates
|
|
36
30
|
|
|
37
|
-
|
|
31
|
+
The client has no `mouseDown()` method. To press the button at a point on the screen, pass `action: 'mouseDown'` to [`testdriver.click()`](/click#testdriver-click-options):
|
|
38
32
|
|
|
39
33
|
```javascript
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
await dragItem.mouseDown();
|
|
43
|
-
|
|
44
|
-
// Move to drop target
|
|
45
|
-
const dropTarget = await ai.find('folder to drop into');
|
|
46
|
-
await dropTarget.hover();
|
|
47
|
-
|
|
48
|
-
// Release
|
|
49
|
-
await ai.mouseUp();
|
|
34
|
+
await testdriver.click({ x: 200, y: 300, action: 'mouseDown' });
|
|
35
|
+
await testdriver.click({ x: 600, y: 300, action: 'mouseUp' });
|
|
50
36
|
```
|
|
51
37
|
|
|
52
|
-
|
|
38
|
+
Prefer the element methods, which keep working when the layout or screen size changes.
|
|
53
39
|
|
|
54
|
-
|
|
55
|
-
await ai.mouseDown('draggable card');
|
|
56
|
-
await ai.hover('drop zone');
|
|
57
|
-
await ai.mouseUp();
|
|
58
|
-
```
|
|
40
|
+
## Examples
|
|
59
41
|
|
|
60
|
-
###
|
|
42
|
+
### Reorder a list
|
|
61
43
|
|
|
62
44
|
```javascript
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
test('selects multiple items with click and drag', async () => {
|
|
67
|
-
const { ai } = await chrome('https://app.example.com');
|
|
68
|
-
|
|
69
|
-
// Start selection at first item
|
|
70
|
-
await ai.mouseDown('first item in grid');
|
|
71
|
-
|
|
72
|
-
// Drag to last item
|
|
73
|
-
await ai.hover('last item in grid');
|
|
74
|
-
|
|
75
|
-
// Release to complete selection
|
|
76
|
-
await ai.mouseUp();
|
|
77
|
-
|
|
78
|
-
// Verify multiple items selected
|
|
79
|
-
const selectedItems = await ai.find('selected items count');
|
|
80
|
-
expect(selectedItems.text).toContain('5 items selected');
|
|
81
|
-
});
|
|
45
|
+
await testdriver.find('drag handle on the first task in the list').mouseDown();
|
|
46
|
+
await testdriver.find('the third task in the list').mouseUp();
|
|
82
47
|
```
|
|
83
48
|
|
|
84
|
-
###
|
|
49
|
+
### Draw on a canvas
|
|
85
50
|
|
|
86
51
|
```javascript
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// Start drawing
|
|
91
|
-
await ai.mouseDown('canvas at top-left corner');
|
|
92
|
-
|
|
93
|
-
// Draw a line by moving mouse
|
|
94
|
-
await ai.hover('canvas at center');
|
|
95
|
-
await ai.hover('canvas at bottom-right corner');
|
|
96
|
-
|
|
97
|
-
// Stop drawing
|
|
98
|
-
await ai.mouseUp();
|
|
99
|
-
|
|
100
|
-
// Verify something was drawn
|
|
101
|
-
const canvas = await ai.exec('document.querySelector("canvas").toDataURL()');
|
|
102
|
-
expect(canvas).toBeTruthy();
|
|
103
|
-
});
|
|
52
|
+
await testdriver.find('top-left corner of the drawing canvas').mouseDown();
|
|
53
|
+
await testdriver.find('center of the drawing canvas').hover();
|
|
54
|
+
await testdriver.find('bottom-right corner of the drawing canvas').mouseUp();
|
|
104
55
|
```
|
|
105
56
|
|
|
106
|
-
|
|
57
|
+
## Complete example
|
|
107
58
|
|
|
108
|
-
```javascript
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
// Press and hold
|
|
113
|
-
await ai.mouseDown('message in chat');
|
|
114
|
-
|
|
115
|
-
// Wait for long-press menu
|
|
116
|
-
await new Promise(resolve => setTimeout(resolve, 500));
|
|
117
|
-
|
|
118
|
-
// Verify menu appeared before releasing
|
|
119
|
-
const menu = await ai.find('message options menu');
|
|
120
|
-
expect(menu).toBeTruthy();
|
|
121
|
-
|
|
122
|
-
// Release
|
|
123
|
-
await ai.mouseUp();
|
|
124
|
-
});
|
|
125
|
-
```
|
|
59
|
+
```javascript tests/drag-and-drop.test.mjs
|
|
60
|
+
import { describe, expect, it } from 'vitest';
|
|
61
|
+
import { TestDriver } from 'testdriverai/vitest/hooks';
|
|
126
62
|
|
|
127
|
-
|
|
63
|
+
describe('Drag and drop', () => {
|
|
64
|
+
it('moves a task to the Done column', async (context) => {
|
|
65
|
+
const testdriver = TestDriver(context);
|
|
66
|
+
await testdriver.provision.chrome({ url: 'https://your-app.example.com/board' });
|
|
128
67
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
// Drag to new position
|
|
137
|
-
await ai.hover('position 300 pixels from left edge');
|
|
138
|
-
|
|
139
|
-
// Release
|
|
140
|
-
await ai.mouseUp();
|
|
141
|
-
|
|
142
|
-
// Verify new size
|
|
143
|
-
const sidebar = await ai.find('sidebar');
|
|
144
|
-
expect(sidebar.width).toBeGreaterThan(250);
|
|
68
|
+
await testdriver.find('Task card titled "Write docs"').mouseDown();
|
|
69
|
+
await testdriver.find('Done column').hover();
|
|
70
|
+
await testdriver.find('Done column').mouseUp();
|
|
71
|
+
|
|
72
|
+
const result = await testdriver.assert('the "Write docs" card is in the Done column');
|
|
73
|
+
expect(result).toBe(true);
|
|
74
|
+
});
|
|
145
75
|
});
|
|
146
76
|
```
|
|
147
77
|
|
|
148
|
-
##
|
|
149
|
-
|
|
150
|
-
- Always pair `mouseDown()` with [`mouseUp()`](/mouse-up) to complete the gesture
|
|
151
|
-
- The mouse button remains pressed until `mouseUp()` is called
|
|
152
|
-
- Use [`hover()`](/hover) to move the mouse while the button is pressed
|
|
153
|
-
- For simple drag operations, consider using `ai()` with a natural language description like `"drag file to folder"`
|
|
154
|
-
|
|
155
|
-
## Related Methods
|
|
78
|
+
## Related
|
|
156
79
|
|
|
157
|
-
- [
|
|
158
|
-
- [
|
|
159
|
-
- [
|
|
160
|
-
- [
|
|
161
|
-
- [`rightClick()`](/right-click) - Right-click for context menu
|
|
80
|
+
- [mouseUp()](/mouse-up): release the button
|
|
81
|
+
- [hover()](/hover): move the mouse while the button is down
|
|
82
|
+
- [click()](/click): a full press and release
|
|
83
|
+
- [Perform actions](/performing-actions): every kind of action in one guide
|
|
@@ -1,164 +1,81 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: testdriver:mouse-up
|
|
3
|
-
description: Release the mouse button
|
|
3
|
+
description: Release the left mouse button on an element, to finish a drag.
|
|
4
4
|
---
|
|
5
5
|
<!-- Generated from mouse-up.mdx. DO NOT EDIT. -->
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
The `mouseUp()` method releases the mouse button. It completes a drag operation or a custom mouse gesture that you started with [`mouseDown()`](/mouse-down). Call it without parameters to release the button at the present mouse position.
|
|
10
|
-
|
|
11
|
-
## Syntax
|
|
7
|
+
Release the mouse button you pressed with [`mouseDown()`](/mouse-down). Call it on the element where the drag should end:
|
|
12
8
|
|
|
13
9
|
```javascript
|
|
14
|
-
|
|
15
|
-
await
|
|
10
|
+
await testdriver.find('Task card titled "Write docs"').mouseDown();
|
|
11
|
+
await testdriver.find('Done column').mouseUp();
|
|
16
12
|
```
|
|
17
13
|
|
|
18
|
-
##
|
|
14
|
+
## element.mouseUp()
|
|
19
15
|
|
|
20
|
-
|
|
16
|
+
Moves the mouse to the point where [`find()`](/find) located the element, then releases the left button. Because the mouse moves before the release, the app sees a drag rather than a jump. It's the same as `element.click('mouseUp')`.
|
|
21
17
|
|
|
22
|
-
|
|
18
|
+
```typescript
|
|
19
|
+
element.mouseUp(): Promise<void>
|
|
20
|
+
```
|
|
23
21
|
|
|
24
|
-
It
|
|
22
|
+
It takes no parameters.
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
### Errors
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
Throws an `ElementNotFoundError` if `find()` didn't locate the element. See [click()](/click#errors) for how to check `found()` first.
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
// Start dragging
|
|
32
|
-
await ai.mouseDown('file to drag');
|
|
28
|
+
## Release at coordinates
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
await ai.hover('target folder');
|
|
30
|
+
The client has no `mouseUp()` method. To release the button at a point on the screen, pass `action: 'mouseUp'` to [`testdriver.click()`](/click#testdriver-click-options):
|
|
36
31
|
|
|
37
|
-
|
|
38
|
-
await
|
|
32
|
+
```javascript
|
|
33
|
+
await testdriver.click({ x: 600, y: 300, action: 'mouseUp' });
|
|
39
34
|
```
|
|
40
35
|
|
|
41
|
-
|
|
36
|
+
Prefer `element.mouseUp()`, which keeps working when the layout or screen size changes.
|
|
42
37
|
|
|
43
|
-
|
|
44
|
-
import { test } from 'vitest';
|
|
45
|
-
import { vscode } from '@testdriver/sdk';
|
|
46
|
-
|
|
47
|
-
test('selects range of files', async () => {
|
|
48
|
-
const { ai } = await vscode();
|
|
49
|
-
|
|
50
|
-
// Click first file
|
|
51
|
-
await ai.click('first-file.js in explorer');
|
|
52
|
-
|
|
53
|
-
// Hold shift and click last file
|
|
54
|
-
await ai.pressKeys('Shift');
|
|
55
|
-
await ai.mouseDown('last-file.js in explorer');
|
|
56
|
-
await ai.mouseUp();
|
|
57
|
-
|
|
58
|
-
// Verify multiple files selected
|
|
59
|
-
const selectedCount = await ai.find('status bar showing file count');
|
|
60
|
-
expect(selectedCount.text).toContain('5 files');
|
|
61
|
-
});
|
|
62
|
-
```
|
|
38
|
+
## Examples
|
|
63
39
|
|
|
64
|
-
###
|
|
40
|
+
### Drop a file into an upload area
|
|
65
41
|
|
|
66
42
|
```javascript
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// Select pencil tool
|
|
71
|
-
await ai.click('pencil tool');
|
|
72
|
-
|
|
73
|
-
// Draw a line
|
|
74
|
-
await ai.mouseDown('canvas near top-left');
|
|
75
|
-
await ai.hover('canvas center');
|
|
76
|
-
await ai.hover('canvas bottom-right');
|
|
77
|
-
await ai.mouseUp();
|
|
78
|
-
|
|
79
|
-
// Verify drawing exists
|
|
80
|
-
const strokes = await ai.exec('canvas.getContext("2d").getImageData(0,0,100,100)');
|
|
81
|
-
expect(strokes).toBeTruthy();
|
|
82
|
-
});
|
|
43
|
+
await testdriver.find('invoice.pdf in the file list').mouseDown();
|
|
44
|
+
await testdriver.find('Drop files here area').hover();
|
|
45
|
+
await testdriver.find('Drop files here area').mouseUp();
|
|
83
46
|
```
|
|
84
47
|
|
|
85
|
-
###
|
|
48
|
+
### Resize a panel
|
|
86
49
|
|
|
87
50
|
```javascript
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
// Grab the divider
|
|
92
|
-
await ai.mouseDown('panel resize divider');
|
|
93
|
-
|
|
94
|
-
// Drag to new position
|
|
95
|
-
await ai.hover('position 400 pixels from left');
|
|
96
|
-
|
|
97
|
-
// Release to complete resize
|
|
98
|
-
await ai.mouseUp();
|
|
99
|
-
|
|
100
|
-
// Verify new panel size
|
|
101
|
-
const panel = await ai.find('editor panel');
|
|
102
|
-
expect(panel.width).toBeGreaterThan(350);
|
|
103
|
-
});
|
|
51
|
+
await testdriver.find('divider between the sidebar and the editor').mouseDown();
|
|
52
|
+
await testdriver.find('middle of the editor area').mouseUp();
|
|
104
53
|
```
|
|
105
54
|
|
|
106
|
-
|
|
55
|
+
## Complete example
|
|
107
56
|
|
|
108
|
-
```javascript
|
|
109
|
-
import {
|
|
110
|
-
import {
|
|
111
|
-
|
|
112
|
-
test('reorders tasks in list', async () => {
|
|
113
|
-
const { ai } = await chrome('https://todo-app.example.com');
|
|
114
|
-
|
|
115
|
-
// Start dragging first task
|
|
116
|
-
await ai.mouseDown('drag handle on first task');
|
|
117
|
-
|
|
118
|
-
// Move down to third position
|
|
119
|
-
await ai.hover('third task position');
|
|
120
|
-
|
|
121
|
-
// Drop the task
|
|
122
|
-
await ai.mouseUp();
|
|
123
|
-
|
|
124
|
-
// Verify new order
|
|
125
|
-
const thirdTask = await ai.find('third task in list');
|
|
126
|
-
expect(thirdTask.text).toContain('Original first task');
|
|
127
|
-
});
|
|
128
|
-
```
|
|
57
|
+
```javascript tests/drag-and-drop.test.mjs
|
|
58
|
+
import { describe, expect, it } from 'vitest';
|
|
59
|
+
import { TestDriver } from 'testdriverai/vitest/hooks';
|
|
129
60
|
|
|
130
|
-
|
|
61
|
+
describe('Drag and drop', () => {
|
|
62
|
+
it('moves a task to the Done column', async (context) => {
|
|
63
|
+
const testdriver = TestDriver(context);
|
|
64
|
+
await testdriver.provision.chrome({ url: 'https://your-app.example.com/board' });
|
|
131
65
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
// Drag to end of word
|
|
140
|
-
await ai.hover('end of "TestDriver" word');
|
|
141
|
-
|
|
142
|
-
// Complete selection
|
|
143
|
-
await ai.mouseUp();
|
|
144
|
-
|
|
145
|
-
// Verify selection
|
|
146
|
-
const selection = await ai.exec('window.getSelection().toString()');
|
|
147
|
-
expect(selection).toBe('TestDriver');
|
|
66
|
+
await testdriver.find('Task card titled "Write docs"').mouseDown();
|
|
67
|
+
await testdriver.find('Done column').hover();
|
|
68
|
+
await testdriver.find('Done column').mouseUp();
|
|
69
|
+
|
|
70
|
+
const result = await testdriver.assert('the "Write docs" card is in the Done column');
|
|
71
|
+
expect(result).toBe(true);
|
|
72
|
+
});
|
|
148
73
|
});
|
|
149
74
|
```
|
|
150
75
|
|
|
151
|
-
##
|
|
152
|
-
|
|
153
|
-
- `mouseUp()` must be preceded by [`mouseDown()`](/mouse-down) to have an effect
|
|
154
|
-
- Releases the button at the current cursor position
|
|
155
|
-
- Completes any drag or selection operation that was in progress
|
|
156
|
-
- For simple clicks, use [`click()`](/click) instead of mouseDown/mouseUp pair
|
|
157
|
-
|
|
158
|
-
## Related Methods
|
|
76
|
+
## Related
|
|
159
77
|
|
|
160
|
-
- [
|
|
161
|
-
- [
|
|
162
|
-
- [
|
|
163
|
-
- [
|
|
164
|
-
- [`rightClick()`](/right-click) - Right-click for context menu
|
|
78
|
+
- [mouseDown()](/mouse-down): press the button
|
|
79
|
+
- [hover()](/hover): move the mouse while the button is down
|
|
80
|
+
- [click()](/click): a full press and release
|
|
81
|
+
- [Perform actions](/performing-actions): every kind of action in one guide
|