@testdriverai/mcp 7.11.136-test → 7.11.138-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-assert/SKILL.md +5 -5
- package/ai/skills/testdriver-caching/SKILL.md +2 -2
- package/ai/skills/testdriver-changelog/SKILL.md +186 -0
- package/ai/skills/testdriver-claude-mcp-plugin/SKILL.md +208 -0
- package/ai/skills/testdriver-click/SKILL.md +13 -13
- package/ai/skills/testdriver-client/SKILL.md +1 -1
- package/ai/skills/testdriver-debugging-with-screenshots/SKILL.md +5 -5
- package/ai/skills/testdriver-double-click/SKILL.md +7 -7
- package/ai/skills/testdriver-enterprise/SKILL.md +1 -1
- package/ai/skills/testdriver-events/SKILL.md +1 -1
- package/ai/skills/testdriver-exec/SKILL.md +10 -10
- package/ai/skills/testdriver-extract/SKILL.md +6 -6
- package/ai/skills/testdriver-find/SKILL.md +61 -61
- package/ai/skills/testdriver-focus-application/SKILL.md +6 -6
- package/ai/skills/testdriver-generating-tests/SKILL.md +3 -3
- package/ai/skills/testdriver-hosted/SKILL.md +3 -3
- package/ai/skills/testdriver-hover/SKILL.md +6 -6
- package/ai/skills/testdriver-making-assertions/SKILL.md +2 -2
- package/ai/skills/testdriver-mouse-down/SKILL.md +9 -9
- package/ai/skills/testdriver-mouse-up/SKILL.md +9 -9
- package/ai/skills/testdriver-parse/SKILL.md +4 -4
- package/ai/skills/testdriver-performing-actions/SKILL.md +4 -4
- package/ai/skills/testdriver-press-keys/SKILL.md +5 -5
- package/ai/skills/testdriver-quickstart/SKILL.md +51 -54
- package/ai/skills/testdriver-redraw/SKILL.md +1 -1
- package/ai/skills/testdriver-right-click/SKILL.md +7 -7
- package/ai/skills/testdriver-screenshot/SKILL.md +9 -9
- package/ai/skills/testdriver-scroll/SKILL.md +13 -13
- package/ai/skills/testdriver-self-hosted/SKILL.md +1 -1
- package/ai/skills/testdriver-type/SKILL.md +7 -7
- package/ai/skills/testdriver-wait/SKILL.md +5 -5
- package/ai/skills/testdriver-what-is-testdriver/SKILL.md +11 -11
- package/docs/{v7/_drafts → _drafts}/agents.mdx +1 -1
- package/docs/{v7/_drafts → _drafts}/best-practices.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/caching-selectors.mdx +3 -3
- package/docs/{v7/_drafts → _drafts}/configuration.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/debugging.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/error-handling.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/faq.mdx +7 -7
- package/docs/{v7/_drafts → _drafts}/installation.mdx +2 -2
- package/docs/{v7/_drafts → _drafts}/migration.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/observable.mdx +3 -3
- package/docs/{v7/_drafts → _drafts}/powerful.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/readme.mdx +11 -11
- package/docs/{v7/_drafts → _drafts}/reports.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/scalable.mdx +10 -10
- package/docs/{v7/_drafts → _drafts}/troubleshooting.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/vitest-plugin.mdx +2 -2
- package/docs/{v7/_drafts → _drafts}/vitest.mdx +9 -9
- package/docs/_scripts/generate-examples.js +9 -10
- package/docs/_scripts/generate-skills.js +4 -4
- package/docs/{v7/agent.mdx → agent.mdx} +17 -17
- package/docs/{v7/assert.mdx → assert.mdx} +5 -5
- package/docs/{v7/aws-setup.mdx → aws-setup.mdx} +6 -6
- package/docs/{v7/cache.mdx → cache.mdx} +9 -9
- package/docs/{v7/caching.mdx → caching.mdx} +13 -12
- package/docs/{v7/captcha.mdx → captcha.mdx} +7 -7
- package/docs/changelog.mdx +13 -13
- package/docs/{v7/ci-cd.mdx → ci-cd.mdx} +10 -10
- package/docs/{v7/click.mdx → click.mdx} +13 -13
- package/docs/client.mdx +323 -0
- package/docs/{v7/copilot → copilot}/auto-healing.mdx +2 -2
- package/docs/{v7/copilot → copilot}/running-tests.mdx +8 -8
- package/docs/{v7/customizing-devices.mdx → customizing-devices.mdx} +1 -1
- package/docs/{v7/dashcam.mdx → dashcam.mdx} +3 -3
- package/docs/{v7/debugging-with-screenshots.mdx → debugging-with-screenshots.mdx} +12 -12
- package/docs/docs.json +429 -288
- package/docs/{v7/double-click.mdx → double-click.mdx} +7 -7
- package/docs/{v7/elements.mdx → elements.mdx} +7 -7
- package/docs/{v7/enterprise.mdx → enterprise.mdx} +2 -2
- package/docs/{v7/errors.mdx → errors.mdx} +3 -3
- package/docs/{v7/events.mdx → events.mdx} +4 -4
- package/docs/{v7/exec.mdx → exec.mdx} +10 -10
- package/docs/{v7/extract.mdx → extract.mdx} +10 -10
- package/docs/{v7/find.mdx → find.mdx} +61 -61
- package/docs/{v7/focus-application.mdx → focus-application.mdx} +6 -6
- package/docs/{v7/generating-tests.mdx → generating-tests.mdx} +10 -10
- package/docs/guide/best-practices-polling.mdx +6 -1
- package/docs/{v7/hosted.mdx → hosted.mdx} +7 -7
- package/docs/{v7/hover.mdx → hover.mdx} +6 -6
- package/docs/interacting-with-your-app.mdx +198 -0
- package/docs/locating-elements.mdx +423 -0
- package/docs/{v7/making-assertions.mdx → making-assertions.mdx} +7 -7
- package/docs/{v7/mouse-down.mdx → mouse-down.mdx} +9 -9
- package/docs/{v7/mouse-up.mdx → mouse-up.mdx} +9 -9
- package/docs/options.mdx +320 -0
- package/docs/{v7/parse.mdx → parse.mdx} +12 -12
- package/docs/{v7/performing-actions.mdx → performing-actions.mdx} +11 -11
- package/docs/{v7/press-keys.mdx → press-keys.mdx} +5 -5
- package/docs/{v7/provision.mdx → provision.mdx} +9 -9
- package/docs/quickstart-cli.mdx +437 -0
- package/docs/quickstart-github.mdx +54 -0
- package/docs/quickstart-manual.mdx +135 -0
- package/docs/quickstart.mdx +22 -0
- package/docs/{v7/redraw.mdx → redraw.mdx} +7 -7
- package/docs/{v7/reusable-code.mdx → reusable-code.mdx} +3 -3
- package/docs/{v7/right-click.mdx → right-click.mdx} +7 -7
- package/docs/{v7/screenshot.mdx → screenshot.mdx} +9 -9
- package/docs/{v7/screenshots.mdx → screenshots.mdx} +3 -3
- package/docs/{v7/scroll.mdx → scroll.mdx} +13 -13
- package/docs/{v7/secrets.mdx → secrets.mdx} +4 -4
- package/docs/{v7/self-hosted.mdx → self-hosted.mdx} +7 -7
- package/docs/{v7/test-results-json.mdx → test-results-json.mdx} +4 -4
- package/docs/{v7/type.mdx → type.mdx} +7 -7
- package/docs/{v7/variables.mdx → variables.mdx} +2 -2
- package/docs/{v7/wait.mdx → wait.mdx} +5 -5
- package/docs/what-is-testdriver.mdx +54 -0
- package/lib/environments.json +1 -1
- package/lib/github-comment.mjs +2 -3
- package/package.json +1 -1
- package/scripts/generate-skills.js +1 -1
- package/docs/v7/client.mdx +0 -486
- package/docs/v7/quickstart.mdx +0 -451
- package/docs/v7/what-is-testdriver.mdx +0 -54
- /package/docs/{v7/_drafts → _drafts}/architecture.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/auto-cache-key.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/awesome-logs-quick-ref.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/cli-to-sdk-migration.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/assert.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/exec.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/focus-application.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/hover-image.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/hover-text.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/if.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/match-image.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/press-keys.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/remember.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/run.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/scroll-until-image.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/scroll-until-text.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/scroll.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/type.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/wait-for-image.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/wait-for-text.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/wait.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/contributing.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/dashcam-title-feature.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/hooks.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/init-command.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/playwright.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/plugin-migration.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/presets.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/progressive-disclosure.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/provision.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/quick-start-test-recording.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/screenshot.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/sdk-awesome-logs.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/sdk-browser-rendering.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/sdk-migration.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/sdk-v7-complete.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/self-hosting.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/test-recording.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/writing-tests.mdx +0 -0
- /package/docs/{v7/examples → examples}/ai.mdx +0 -0
- /package/docs/{v7/examples → examples}/assert.mdx +0 -0
- /package/docs/{v7/examples → examples}/captcha-api.mdx +0 -0
- /package/docs/{v7/examples → examples}/chrome-extension.mdx +0 -0
- /package/docs/{v7/examples → examples}/drag-and-drop.mdx +0 -0
- /package/docs/{v7/examples → examples}/element-not-found.mdx +0 -0
- /package/docs/{v7/examples → examples}/findall-coffee-icons.mdx +0 -0
- /package/docs/{v7/examples → examples}/formatted-logging.mdx +0 -0
- /package/docs/{v7/examples → examples}/hover-image.mdx +0 -0
- /package/docs/{v7/examples → examples}/hover-text-with-description.mdx +0 -0
- /package/docs/{v7/examples → examples}/hover-text.mdx +0 -0
- /package/docs/{v7/examples → examples}/installer.mdx +0 -0
- /package/docs/{v7/examples → examples}/launch-vscode-linux.mdx +0 -0
- /package/docs/{v7/examples → examples}/match-image.mdx +0 -0
- /package/docs/{v7/examples → examples}/parse.mdx +0 -0
- /package/docs/{v7/examples → examples}/press-keys.mdx +0 -0
- /package/docs/{v7/examples → examples}/scroll-keyboard.mdx +0 -0
- /package/docs/{v7/examples → examples}/scroll-until-text.mdx +0 -0
- /package/docs/{v7/examples → examples}/scroll.mdx +0 -0
- /package/docs/{v7/examples → examples}/type.mdx +0 -0
- /package/docs/{v7/mcp.mdx → mcp.mdx} +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Explore"
|
|
3
|
-
sidebarTitle: "
|
|
3
|
+
sidebarTitle: "Generating tests"
|
|
4
4
|
description: "Generate tests by exploring your app with the AI vision agent"
|
|
5
5
|
icon: "compass"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
Start
|
|
8
|
+
Start with an exploration of your app. Tests begin here: you describe a flow in plain English. Then the TestDriver vision agent clicks, types, and reads the screen to understand it. Then it writes the test for you. There are no selectors, no DOM, and no weak locators. Only describe what you want to test. Let the agent find the other parts.
|
|
9
9
|
|
|
10
|
-
There are two
|
|
10
|
+
There are two methods for an exploration. You can chat with your AI assistant through the TestDriver MCP server. Or you can give a coding agent our instructions file and tell it to generate a test.
|
|
11
11
|
|
|
12
12
|
<Info>
|
|
13
|
-
Both paths need an MCP-capable AI coding assistant. If you don't have one yet, start with **GitHub Copilot** — there's a [free tier](https://github.com/features/copilot/plans), no credit card required. See [Run → Setup](/
|
|
13
|
+
Both paths need an MCP-capable AI coding assistant. If you don't have one yet, start with **GitHub Copilot** — there's a [free tier](https://github.com/features/copilot/plans), no credit card required. See [Run → Setup](/copilot/running-tests#setup) for the full install and sign-in walkthrough.
|
|
14
14
|
</Info>
|
|
15
15
|
|
|
16
16
|
## Instructions for Coding Agents
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Start with [our quickstart](./quickstart). Then give your coding agent our agent instructions file.
|
|
19
19
|
|
|
20
20
|
<Card title="TestDriver Agent Instructions" icon="link" arrow="true" horizontal href="https://github.com/testdriverai/testdriverai/blob/main/ai/agents/testdriver.md?plain=1">
|
|
21
21
|
Copy the current version of our agent instructions to provide your coding agent with up-to-date instructions on how to generate TestDriver tests.
|
|
@@ -33,13 +33,13 @@ Push Submit button
|
|
|
33
33
|
Verify new page contains expected text 'logged in'
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
<Info>
|
|
36
|
+
<Info>Use explicit commands for production tests. They are at a lower cost, faster, and more reliable.</Info>
|
|
37
37
|
|
|
38
38
|
## Start a Conversation
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Use the TestDriver MCP server and your AI assistant (GitHub Copilot, Cursor, or Claude Desktop) to make tests. You chat with an AI agent. The agent starts a virtual machine, does actions, and writes the test code for you.
|
|
41
41
|
|
|
42
|
-
Open your AI assistant
|
|
42
|
+
Open the chat of your AI assistant. If your project has no other agents, TestDriver uses the TestDriver agent by default. If not, select **testdriver** from the agent dropdown in the chat panel.
|
|
43
43
|
|
|
44
44
|
Describe what you want to test:
|
|
45
45
|
|
|
@@ -66,7 +66,7 @@ When the agent starts a session, a **live preview panel** opens in your editor.
|
|
|
66
66
|
- **Debug issues** — see exactly what the AI sees
|
|
67
67
|
|
|
68
68
|
<Note>
|
|
69
|
-
The live preview panel requires the TestDriver VS Code extension. Set `TD_PREVIEW=ide` in your MCP configuration to enable it. See the [Run page](/
|
|
69
|
+
The live preview panel requires the TestDriver VS Code extension. Set `TD_PREVIEW=ide` in your MCP configuration to enable it. See the [Run page](/copilot/running-tests) for all device and preview options.
|
|
70
70
|
</Note>
|
|
71
71
|
|
|
72
72
|
## Interactive Workflow
|
|
@@ -187,6 +187,6 @@ describe("Login Flow", () => {
|
|
|
187
187
|
|
|
188
188
|
## Next
|
|
189
189
|
|
|
190
|
-
<Card title="Learn" icon="brain" arrow="true" horizontal href="/
|
|
190
|
+
<Card title="Learn" icon="brain" arrow="true" horizontal href="/caching">
|
|
191
191
|
Once the agent has explored your app, TestDriver caches what it discovers so your tests replay instantly without re-reasoning over the screen every time.
|
|
192
192
|
</Card>
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
title: "Waiting for Elements"
|
|
3
|
+
sidebarTitle: "Waiting for Elements"
|
|
4
|
+
description: "Prefer find() with a timeout over fixed wait() delays when waiting for elements to appear."
|
|
5
|
+
icon: "hourglass-half"
|
|
6
|
+
---
|
|
2
7
|
|
|
3
8
|
**When waiting for elements to appear, prefer `find()` with a `timeout` option over `wait()`.**
|
|
4
9
|
|
|
@@ -6,11 +6,11 @@ icon: "cloud"
|
|
|
6
6
|
mode: "wide"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
The hosted price uses **device-seconds**: the time that your tests run on **our infrastructure**.
|
|
10
10
|
|
|
11
|
-
- **Zero Setup
|
|
12
|
-
- **Free Tier** —
|
|
13
|
-
- **Pay As You Go** —
|
|
11
|
+
- **Zero Setup**. Start tests immediately. You do not need DevOps.
|
|
12
|
+
- **Free Tier** — Start with a limited preview at no cost.
|
|
13
|
+
- **Pay As You Go** — Pay only for the device-seconds that you use.
|
|
14
14
|
|
|
15
15
|
## Hosted Plans
|
|
16
16
|
|
|
@@ -53,7 +53,7 @@ Hosted is the default when you follow the Quickstart guide.
|
|
|
53
53
|
<Card
|
|
54
54
|
title="Try the Quickstart"
|
|
55
55
|
icon="play"
|
|
56
|
-
href="/
|
|
56
|
+
href="/quickstart"
|
|
57
57
|
>
|
|
58
58
|
Set your API key and start testing in minutes.
|
|
59
59
|
</Card>
|
|
@@ -139,7 +139,7 @@ To prevent tests from failing due to exceeding your license slot limit, we recom
|
|
|
139
139
|
|
|
140
140
|
## When to Consider Self-Hosted
|
|
141
141
|
|
|
142
|
-
Hosted is perfect for getting started and for teams that want zero infrastructure management. However, you might consider [Self-Hosted](/
|
|
142
|
+
Hosted is perfect for getting started and for teams that want zero infrastructure management. However, you might consider [Self-Hosted](/self-hosted) if you:
|
|
143
143
|
|
|
144
144
|
- Want to escape per-second billing with a flat license fee
|
|
145
145
|
- Require greater concurrency than offered in Cloud plans
|
|
@@ -151,7 +151,7 @@ Hosted is perfect for getting started and for teams that want zero infrastructur
|
|
|
151
151
|
<Card
|
|
152
152
|
title="Explore Self-Hosted"
|
|
153
153
|
icon="server"
|
|
154
|
-
href="/
|
|
154
|
+
href="/self-hosted"
|
|
155
155
|
>
|
|
156
156
|
Learn about self-hosting for unlimited test execution at a flat rate.
|
|
157
157
|
</Card>
|
|
@@ -7,11 +7,11 @@ icon: "hand-pointer"
|
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
Move the mouse cursor
|
|
10
|
+
Move the mouse cursor onto elements or coordinates without a click. Use this to show tooltips, dropdowns, and hover effects.
|
|
11
11
|
|
|
12
12
|
## Element Hover
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Put the cursor on a found element.
|
|
15
15
|
|
|
16
16
|
### Syntax
|
|
17
17
|
|
|
@@ -43,7 +43,7 @@ await submenu.click();
|
|
|
43
43
|
|
|
44
44
|
## Coordinate Hover
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
Put the cursor at screen coordinates.
|
|
47
47
|
|
|
48
48
|
### Syntax
|
|
49
49
|
|
|
@@ -274,6 +274,6 @@ describe('Hover Interactions', () => {
|
|
|
274
274
|
|
|
275
275
|
## Related Methods
|
|
276
276
|
|
|
277
|
-
- [`find()`](/
|
|
278
|
-
- [`click()`](/
|
|
279
|
-
- [`mouseDown()`](/
|
|
277
|
+
- [`find()`](/find) - Locate elements to hover
|
|
278
|
+
- [`click()`](/click) - Click after hovering
|
|
279
|
+
- [`mouseDown()`](/click) - Start drag operations
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Interacting With Your App"
|
|
3
|
+
sidebarTitle: "Interacting With Your App"
|
|
4
|
+
description: "Click, hover, drag, and interact with located UI elements"
|
|
5
|
+
icon: "hand-pointer"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Once you've [located an element](/locating-elements), the `Element` object exposes methods to interact with it. Use these to click, hover, and perform mouse operations that drive your app.
|
|
11
|
+
|
|
12
|
+
## Interaction Methods
|
|
13
|
+
|
|
14
|
+
#### click()
|
|
15
|
+
|
|
16
|
+
Click on the element.
|
|
17
|
+
|
|
18
|
+
```javascript
|
|
19
|
+
await element.click(action)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Parameters:**
|
|
23
|
+
- `action` (string, optional) - Type of click: `'click'` (default), `'double-click'`, `'right-click'`, `'hover'`, `'mouseDown'`, `'mouseUp'`
|
|
24
|
+
|
|
25
|
+
**Returns:** `Promise<void>`
|
|
26
|
+
|
|
27
|
+
**Example:**
|
|
28
|
+
```javascript
|
|
29
|
+
const button = await testdriver.find('submit button');
|
|
30
|
+
await button.click(); // Regular click
|
|
31
|
+
|
|
32
|
+
const file = await testdriver.find('document.txt');
|
|
33
|
+
await file.click('double-click'); // Double-click
|
|
34
|
+
|
|
35
|
+
const menu = await testdriver.find('settings icon');
|
|
36
|
+
await menu.click('right-click'); // Right-click
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
<Note>
|
|
40
|
+
The element must be found before clicking. The `find()` method automatically locates the element.
|
|
41
|
+
</Note>
|
|
42
|
+
|
|
43
|
+
#### hover()
|
|
44
|
+
|
|
45
|
+
Hover over the element without clicking.
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
await element.hover()
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Returns:** `Promise<void>`
|
|
52
|
+
|
|
53
|
+
**Example:**
|
|
54
|
+
```javascript
|
|
55
|
+
const tooltip = await testdriver.find('info icon');
|
|
56
|
+
await tooltip.hover();
|
|
57
|
+
// Wait to see tooltip
|
|
58
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### doubleClick()
|
|
62
|
+
|
|
63
|
+
Double-click on the element.
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
await element.doubleClick()
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Returns:** `Promise<void>`
|
|
70
|
+
|
|
71
|
+
**Example:**
|
|
72
|
+
```javascript
|
|
73
|
+
const file = await testdriver.find('README.txt file icon');
|
|
74
|
+
await file.doubleClick();
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### rightClick()
|
|
78
|
+
|
|
79
|
+
Right-click on the element to open context menu.
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
await element.rightClick()
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Returns:** `Promise<void>`
|
|
86
|
+
|
|
87
|
+
**Example:**
|
|
88
|
+
```javascript
|
|
89
|
+
const folder = await testdriver.find('Documents folder');
|
|
90
|
+
await folder.rightClick();
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### mouseDown() / mouseUp()
|
|
94
|
+
|
|
95
|
+
Press or release mouse button on the element (for drag operations).
|
|
96
|
+
|
|
97
|
+
```javascript
|
|
98
|
+
await element.mouseDown()
|
|
99
|
+
await element.mouseUp()
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Returns:** `Promise<void>`
|
|
103
|
+
|
|
104
|
+
**Example:**
|
|
105
|
+
```javascript
|
|
106
|
+
// Drag and drop
|
|
107
|
+
const item = await testdriver.find('draggable item');
|
|
108
|
+
await item.mouseDown();
|
|
109
|
+
|
|
110
|
+
// Move to drop target (using coordinates or another element)
|
|
111
|
+
const target = await testdriver.find('drop zone');
|
|
112
|
+
await target.hover();
|
|
113
|
+
await target.mouseUp();
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Examples
|
|
117
|
+
|
|
118
|
+
### Basic Element Interaction
|
|
119
|
+
|
|
120
|
+
```javascript
|
|
121
|
+
// Find and click
|
|
122
|
+
const submitButton = await testdriver.find('submit button');
|
|
123
|
+
await submitButton.click();
|
|
124
|
+
|
|
125
|
+
// Find, verify, then interact
|
|
126
|
+
const emailInput = await testdriver.find('email input field');
|
|
127
|
+
if (emailInput.found()) {
|
|
128
|
+
await emailInput.click();
|
|
129
|
+
await testdriver.type('user@example.com');
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Working with Forms
|
|
134
|
+
|
|
135
|
+
```javascript
|
|
136
|
+
// Fill out a multi-field form
|
|
137
|
+
const nameField = await testdriver.find('name input field');
|
|
138
|
+
await nameField.click();
|
|
139
|
+
await testdriver.type('John Doe');
|
|
140
|
+
|
|
141
|
+
const emailField = await testdriver.find('email input field');
|
|
142
|
+
await emailField.click();
|
|
143
|
+
await testdriver.type('john@example.com');
|
|
144
|
+
|
|
145
|
+
const submitButton = await testdriver.find('submit button');
|
|
146
|
+
await submitButton.click();
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Conditional Interactions
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
// Check if element exists before interacting
|
|
153
|
+
const closeButton = await testdriver.find('close popup button');
|
|
154
|
+
|
|
155
|
+
if (closeButton.found()) {
|
|
156
|
+
await closeButton.click();
|
|
157
|
+
console.log('Popup closed');
|
|
158
|
+
} else {
|
|
159
|
+
console.log('No popup to close');
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Re-locating Dynamic Elements
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
// Element that moves or changes
|
|
167
|
+
const notification = await testdriver.find('success notification');
|
|
168
|
+
|
|
169
|
+
// Do something that might cause it to move
|
|
170
|
+
await testdriver.scroll('down', 300);
|
|
171
|
+
|
|
172
|
+
// Re-locate the element
|
|
173
|
+
await notification.find();
|
|
174
|
+
|
|
175
|
+
if (notification.found()) {
|
|
176
|
+
await notification.click();
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Best Practices
|
|
181
|
+
|
|
182
|
+
<AccordionGroup>
|
|
183
|
+
<Accordion title="Reuse element references when possible">
|
|
184
|
+
If you need to interact with the same element multiple times, reuse the reference:
|
|
185
|
+
|
|
186
|
+
```javascript
|
|
187
|
+
const input = await testdriver.find('search input');
|
|
188
|
+
await input.click();
|
|
189
|
+
await testdriver.type('first search');
|
|
190
|
+
await testdriver.pressKeys(['enter']);
|
|
191
|
+
|
|
192
|
+
// Re-use the same element reference
|
|
193
|
+
await input.click();
|
|
194
|
+
await testdriver.pressKeys(['ctrl', 'a']); // Select all
|
|
195
|
+
await testdriver.type('second search');
|
|
196
|
+
```
|
|
197
|
+
</Accordion>
|
|
198
|
+
</AccordionGroup>
|