@testdriverai/mcp 7.9.149-test → 7.9.151-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/agent/interface.js +6 -0
- package/ai/skills/testdriver-caching/SKILL.md +13 -6
- package/ai/skills/testdriver-client/SKILL.md +5 -1
- package/ai/skills/testdriver-debugging-with-screenshots/SKILL.md +14 -4
- package/ai/skills/testdriver-find/SKILL.md +2 -0
- package/ai/skills/testdriver-generating-tests/SKILL.md +159 -8
- package/ai/skills/testdriver-machine-setup/SKILL.md +75 -8
- package/ai/skills/testdriver-making-assertions/SKILL.md +78 -2
- package/ai/skills/testdriver-performing-actions/SKILL.md +97 -2
- package/ai/skills/testdriver-quickstart/SKILL.md +47 -28
- package/ai/skills/testdriver-wait/SKILL.md +1 -1
- package/ai/skills/testdriver:generating-tests/SKILL.md +0 -11
- package/docs/changelog.mdx +1 -1
- package/docs/docs.json +14 -39
- package/docs/v7/assert.mdx +0 -1
- package/docs/v7/caching.mdx +14 -10
- package/docs/v7/client.mdx +1 -1
- package/docs/v7/copilot/auto-healing.mdx +167 -18
- package/docs/v7/copilot/running-tests.mdx +915 -54
- package/docs/v7/debugging-with-screenshots.mdx +17 -7
- package/docs/v7/generating-tests.mdx +166 -10
- package/docs/v7/making-assertions.mdx +81 -4
- package/docs/v7/performing-actions.mdx +100 -4
- package/docs/v7/quickstart.mdx +299 -21
- package/docs/v7/wait.mdx +1 -1
- package/interfaces/cli/commands/init.js +2 -0
- package/lib/init-project.js +7 -0
- package/mcp-server/dist/server.mjs +2 -0
- package/mcp-server/src/server.ts +2 -0
- package/package.json +3 -3
- package/docs/v7/ai/agent.mdx +0 -72
- package/docs/v7/ai/mcp.mdx +0 -228
- package/docs/v7/ai/skills.mdx +0 -73
- package/docs/v7/ai.mdx +0 -205
- package/docs/v7/copilot/creating-tests.mdx +0 -156
- package/docs/v7/copilot/github.mdx +0 -143
- package/docs/v7/copilot/setup.mdx +0 -143
- package/docs/v7/device-config.mdx +0 -317
- package/docs/v7/locating-elements.mdx +0 -71
- package/docs/v7/machine-setup.mdx +0 -331
- package/docs/v7/running-tests.mdx +0 -185
- package/docs/v7/waiting-for-elements.mdx +0 -90
|
@@ -9,6 +9,53 @@ TestDriver makes it easy to write automated computer-use tests for web browsers,
|
|
|
9
9
|
<Tip><a href="https://discord.com/invite/cWDFW8DzPm" target="_blank" rel="noreferrer">Join our Discord</a> if you have any questions or need help getting started!</Tip>
|
|
10
10
|
|
|
11
11
|
<Tabs>
|
|
12
|
+
<Tab title="Add to GitHub" icon="github">
|
|
13
|
+
|
|
14
|
+
Drop-in UI testing for any GitHub repository. Mention `@testdriverai` anywhere in your repo and it writes UI tests and catches regressions before they merge.
|
|
15
|
+
|
|
16
|
+
<Card
|
|
17
|
+
title="Add to GitHub"
|
|
18
|
+
icon="github"
|
|
19
|
+
href="https://go.testdriver.ai/github"
|
|
20
|
+
arrow
|
|
21
|
+
horizontal
|
|
22
|
+
>
|
|
23
|
+
Install the TestDriver GitHub app and start testing in minutes — no setup required.
|
|
24
|
+
</Card>
|
|
25
|
+
|
|
26
|
+
<Steps>
|
|
27
|
+
<Step title="Install the GitHub App">
|
|
28
|
+
Click **Add to GitHub** above and install TestDriver on the repositories you want to test.
|
|
29
|
+
</Step>
|
|
30
|
+
|
|
31
|
+
<Step title="Mention @testdriverai">
|
|
32
|
+
Open a pull request or issue and mention `@testdriverai` to have it write and run UI tests:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
@testdriverai Write a test that verifies the homepage loads and the signup button works.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
TestDriver spawns a sandbox, writes the test, and posts results right in the conversation.
|
|
39
|
+
</Step>
|
|
40
|
+
|
|
41
|
+
<Step title="Catch Regressions Automatically">
|
|
42
|
+
Once your tests are committed, TestDriver runs them on every pull request and flags regressions before they merge.
|
|
43
|
+
</Step>
|
|
44
|
+
</Steps>
|
|
45
|
+
|
|
46
|
+
Want to use TestDriver from GitHub Copilot or the GitHub Mobile app instead? See the full GitHub guide:
|
|
47
|
+
|
|
48
|
+
<Card
|
|
49
|
+
title="GitHub Integration Guide"
|
|
50
|
+
icon="arrow-right"
|
|
51
|
+
href="/v7/copilot/auto-healing#use-testdriver-in-github"
|
|
52
|
+
arrow
|
|
53
|
+
horizontal
|
|
54
|
+
>
|
|
55
|
+
Use TestDriver from GitHub web, Copilot chat, PR reviews, and mobile.
|
|
56
|
+
</Card>
|
|
57
|
+
|
|
58
|
+
</Tab>
|
|
12
59
|
<Tab title="CLI" icon="terminal">
|
|
13
60
|
|
|
14
61
|
Get started quickly with the TestDriver CLI.
|
|
@@ -39,34 +86,6 @@ TestDriver makes it easy to write automated computer-use tests for web browsers,
|
|
|
39
86
|
</Step>
|
|
40
87
|
</Steps>
|
|
41
88
|
</Tab>
|
|
42
|
-
<Tab title="GitHub Copilot" icon="github">
|
|
43
|
-
|
|
44
|
-
Use the TestDriver VS Code extension with GitHub Copilot for an AI-powered testing workflow.
|
|
45
|
-
|
|
46
|
-
<Card
|
|
47
|
-
title="Install TestDriver for VS Code"
|
|
48
|
-
icon="/images/content/extension/vscode.svg"
|
|
49
|
-
href="vscode:extension/testdriver.testdriver"
|
|
50
|
-
arrow
|
|
51
|
-
horizontal
|
|
52
|
-
>
|
|
53
|
-
</Card>
|
|
54
|
-
|
|
55
|
-
The extension provides one-click sign-in, project initialization, a live preview panel for watching tests execute, and MCP server configuration for GitHub Copilot.
|
|
56
|
-
|
|
57
|
-
Once installed, follow the full setup guide to configure MCP and start building tests with AI assistance:
|
|
58
|
-
|
|
59
|
-
<Card
|
|
60
|
-
title="VS Code + Copilot Setup Guide"
|
|
61
|
-
icon="arrow-right"
|
|
62
|
-
href="/v7/copilot/setup"
|
|
63
|
-
arrow
|
|
64
|
-
horizontal
|
|
65
|
-
>
|
|
66
|
-
Sign in, initialize your project, and configure MCP for GitHub Copilot.
|
|
67
|
-
</Card>
|
|
68
|
-
|
|
69
|
-
</Tab>
|
|
70
89
|
<Tab title="Manual" icon="wrench">
|
|
71
90
|
|
|
72
91
|
Install TestDriver and manually create the files yourself.
|
|
@@ -47,4 +47,4 @@ await testdriver.wait();
|
|
|
47
47
|
const element = await testdriver.find('success message');
|
|
48
48
|
```
|
|
49
49
|
- Avoid excessively long timeouts to keep tests efficient.
|
|
50
|
-
- Use sparingly — TestDriver's [redraw detection](/v7/waiting-for-
|
|
50
|
+
- Use sparingly — TestDriver's [redraw detection](/v7/performing-actions#waiting-for-dynamic-content) automatically waits for screen and network stability after each action.
|
|
@@ -23,14 +23,3 @@ Type password Password123 into Password field
|
|
|
23
23
|
Push Submit button
|
|
24
24
|
Verify new page contains expected text 'logged in'
|
|
25
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>
|
package/docs/changelog.mdx
CHANGED
|
@@ -93,7 +93,7 @@ This release includes all changes from v7.8.0-test.6 with version bumps across a
|
|
|
93
93
|
|
|
94
94
|
✨ New features
|
|
95
95
|
|
|
96
|
-
- **[GitHub Copilot integration](/v7/copilot/
|
|
96
|
+
- **[GitHub Copilot integration](/v7/copilot/running-tests)** — Use TestDriver directly from GitHub Copilot in VS Code. The new MCP server lets Copilot launch sandboxes, interact with elements, and run assertions through natural language. Includes guides for [creating tests](/v7/generating-tests), [running tests](/v7/copilot/running-tests), [GitHub Actions integration](/v7/copilot/auto-healing#use-testdriver-in-github), and [auto-healing](/v7/copilot/auto-healing).
|
|
97
97
|
|
|
98
98
|
🔧 Improvements
|
|
99
99
|
|
package/docs/docs.json
CHANGED
|
@@ -53,33 +53,16 @@
|
|
|
53
53
|
"/changelog"
|
|
54
54
|
]
|
|
55
55
|
},
|
|
56
|
-
{
|
|
57
|
-
"group": "GitHub Copilot",
|
|
58
|
-
"pages": [
|
|
59
|
-
"/v7/copilot/setup",
|
|
60
|
-
"/v7/copilot/creating-tests",
|
|
61
|
-
"/v7/copilot/running-tests",
|
|
62
|
-
"/v7/copilot/github",
|
|
63
|
-
"/v7/copilot/auto-healing"
|
|
64
|
-
]
|
|
65
|
-
},
|
|
66
56
|
{
|
|
67
57
|
"group": "Guide",
|
|
68
58
|
"pages": [
|
|
69
59
|
"/v7/generating-tests",
|
|
70
|
-
"/v7/device-config",
|
|
71
|
-
"/v7/machine-setup",
|
|
72
|
-
"/v7/locating-elements",
|
|
73
|
-
"/v7/waiting-for-elements",
|
|
74
|
-
"/v7/performing-actions",
|
|
75
|
-
"/v7/making-assertions"
|
|
76
|
-
]
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"group": "Running Tests",
|
|
80
|
-
"pages": [
|
|
81
|
-
"/v7/running-tests",
|
|
82
60
|
"/v7/caching",
|
|
61
|
+
"/v7/copilot/running-tests",
|
|
62
|
+
"/v7/making-assertions",
|
|
63
|
+
"/v7/performing-actions",
|
|
64
|
+
"/v7/debugging-with-screenshots",
|
|
65
|
+
"/v7/copilot/auto-healing",
|
|
83
66
|
"/v7/ci-cd",
|
|
84
67
|
"/v7/test-results-json"
|
|
85
68
|
]
|
|
@@ -91,7 +74,7 @@
|
|
|
91
74
|
"/v7/secrets",
|
|
92
75
|
"/v7/reusable-code",
|
|
93
76
|
{
|
|
94
|
-
"group": "Self-Hosting
|
|
77
|
+
"group": "Self-Hosting",
|
|
95
78
|
"icon": "server",
|
|
96
79
|
"pages": [
|
|
97
80
|
"/v7/aws-setup"
|
|
@@ -99,25 +82,9 @@
|
|
|
99
82
|
}
|
|
100
83
|
]
|
|
101
84
|
},
|
|
102
|
-
{
|
|
103
|
-
"group": "AI",
|
|
104
|
-
"icon": "robot",
|
|
105
|
-
"pages": [
|
|
106
|
-
"/v7/ai/agent",
|
|
107
|
-
"/v7/ai/skills",
|
|
108
|
-
"/v7/ai/mcp"
|
|
109
|
-
]
|
|
110
|
-
},
|
|
111
85
|
{
|
|
112
86
|
"group": "Actions",
|
|
113
87
|
"pages": [
|
|
114
|
-
{
|
|
115
|
-
"group": "ai",
|
|
116
|
-
"tag": "Beta",
|
|
117
|
-
"pages": [
|
|
118
|
-
"/v7/ai"
|
|
119
|
-
]
|
|
120
|
-
},
|
|
121
88
|
"/v7/assert",
|
|
122
89
|
"/v7/captcha",
|
|
123
90
|
"/v7/click",
|
|
@@ -366,6 +333,14 @@
|
|
|
366
333
|
}
|
|
367
334
|
},
|
|
368
335
|
"redirects": [
|
|
336
|
+
{
|
|
337
|
+
"source": "/v7/ai",
|
|
338
|
+
"destination": "/v7/quickstart"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"source": "/v7/ai/:slug*",
|
|
342
|
+
"destination": "/v7/quickstart"
|
|
343
|
+
},
|
|
369
344
|
{
|
|
370
345
|
"source": "/guides/github-actions",
|
|
371
346
|
"destination": "/v6/action/setup"
|
package/docs/v7/assert.mdx
CHANGED
package/docs/v7/caching.mdx
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
title: "Learn"
|
|
3
|
+
sidebarTitle: "Learn"
|
|
4
|
+
description: "How TestDriver learns your app and caches what it discovers for instant, deterministic replays"
|
|
5
|
+
icon: "brain"
|
|
5
6
|
---
|
|
6
7
|
|
|
7
|
-
TestDriver
|
|
8
|
+
Once the agent has [explored your app](/v7/generating-tests), TestDriver remembers what it found. Every element the AI vision agent discovers is cached with a vision fingerprint—a perceptual hash of the screen state where it was located. On the next run, TestDriver matches against that cache instead of calling the AI again. Passing tests replay instantly, deterministically, and cheaply.
|
|
8
9
|
|
|
10
|
+
This learning is what makes TestDriver fast. Intelligent caching delivers up to **1.7x faster** test execution by skipping redundant AI vision analysis—the agent only thinks when it sees something new.
|
|
9
11
|
|
|
10
12
|
```javascript
|
|
11
13
|
// First run: builds cache
|
|
@@ -17,7 +19,7 @@ await testdriver.find('submit button');
|
|
|
17
19
|
|
|
18
20
|
## Automatic Caching
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
Learning is enabled automatically with zero configuration. The cache key—the fingerprint TestDriver uses to recognize what it already knows—is computed from:
|
|
21
23
|
|
|
22
24
|
- **File hash**: SHA-256 hash of the test file contents
|
|
23
25
|
- **Selector prompt**: The exact text description passed to `find()`
|
|
@@ -53,7 +55,7 @@ You can clear the cache within the TestDriver console. There, you'll also find p
|
|
|
53
55
|
|
|
54
56
|
## Debugging Cache Hits and Misses
|
|
55
57
|
|
|
56
|
-
You can track cache performance in your tests:
|
|
58
|
+
You can track what TestDriver has learned by inspecting cache performance in your tests:
|
|
57
59
|
|
|
58
60
|
```javascript
|
|
59
61
|
test('monitor cache performance', async (context) => {
|
|
@@ -75,7 +77,7 @@ test('monitor cache performance', async (context) => {
|
|
|
75
77
|
|
|
76
78
|
## Configuring the Cache
|
|
77
79
|
|
|
78
|
-
You can configure
|
|
80
|
+
You can configure how TestDriver learns globally when initializing TestDriver:
|
|
79
81
|
|
|
80
82
|
```javascript
|
|
81
83
|
import { TestDriver } from 'testdriverai';
|
|
@@ -103,7 +105,7 @@ await testdriver.find('submit button', {
|
|
|
103
105
|
|
|
104
106
|
## Caching with Variables
|
|
105
107
|
|
|
106
|
-
Custom cache keys prevent cache pollution when using variables in prompts, dramatically improving cache hit rates.
|
|
108
|
+
Custom cache keys prevent cache pollution when using variables in prompts, dramatically improving cache hit rates—so TestDriver reuses what it learned even when your data changes.
|
|
107
109
|
|
|
108
110
|
```javascript
|
|
109
111
|
// ❌ Without cache key - creates new cache for each variable value
|
|
@@ -123,6 +125,8 @@ await testdriver.find(`order ${orderId} status`, {
|
|
|
123
125
|
});
|
|
124
126
|
```
|
|
125
127
|
|
|
128
|
+
## Next
|
|
126
129
|
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
<Card href="/v7/copilot/running-tests" title="Run" icon="play">
|
|
131
|
+
Now that TestDriver has learned your app, run your tests in CI and locally—replaying the cache for fast, deterministic results.
|
|
132
|
+
</Card>
|
package/docs/v7/client.mdx
CHANGED
|
@@ -54,7 +54,7 @@ const testdriver = new TestDriver(apiKey, options)
|
|
|
54
54
|
</ParamField>
|
|
55
55
|
|
|
56
56
|
<ParamField path="reconnect" type="boolean" default="false">
|
|
57
|
-
Reattach to the last used sandbox instead of creating a new one. When `true`, the SDK reads the sandbox id from `.testdriver/last-sandbox` (written automatically on every successful connect) and rejoins that VM. Provision methods (`chrome`, `vscode`, `installer`, etc.) are skipped because the application is already running. The previous sandbox must still be alive — see [`keepAlive`](#keepalive) and the [
|
|
57
|
+
Reattach to the last used sandbox instead of creating a new one. When `true`, the SDK reads the sandbox id from `.testdriver/last-sandbox` (written automatically on every successful connect) and rejoins that VM. Provision methods (`chrome`, `vscode`, `installer`, etc.) are skipped because the application is already running. The previous sandbox must still be alive — see [`keepAlive`](#keepalive) and the [Run guide](/v7/copilot/running-tests#keeping-machines-alive-between-runs).
|
|
58
58
|
</ParamField>
|
|
59
59
|
|
|
60
60
|
<ParamField path="sandboxId" type="string">
|
|
@@ -1,23 +1,168 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
3
|
-
sidebarTitle: "
|
|
4
|
-
description: "
|
|
5
|
-
icon: "
|
|
2
|
+
title: "Prevent"
|
|
3
|
+
sidebarTitle: "Prevent"
|
|
4
|
+
description: "Catch regressions automatically with CI, auto-healing, and GitHub integration"
|
|
5
|
+
icon: "shield-check"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Prevent regressions by letting TestDriver run and repair itself on every change. Once you've [explored](/v7/generating-tests), [taught it your app](/v7/caching), [run it](/v7/copilot/running-tests), [validated outcomes](/v7/making-assertions), [adapted to your UI](/v7/performing-actions), and learned to [debug with screenshots](/v7/debugging-with-screenshots), the last step is closing the loop: wire TestDriver into your pull requests so regressions never reach production.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Your AI agent can run tests on every PR, investigate failures, and propose fixes — and you can drive all of it from GitHub itself, whether you're at your desk or on your phone.
|
|
11
|
+
|
|
12
|
+
## Use TestDriver in GitHub
|
|
13
|
+
|
|
14
|
+
TestDriver works directly in GitHub's web interface and mobile app. The same MCP server that powers VS Code integration also works in GitHub, letting you create and manage tests from anywhere.
|
|
15
|
+
|
|
16
|
+
### How It Works
|
|
17
|
+
|
|
18
|
+
When you add a TestDriver agent file to your repository at `.github/agents/testdriver.agent.md`, GitHub Copilot can use TestDriver's MCP tools directly in:
|
|
19
|
+
|
|
20
|
+
- GitHub.com (web browser)
|
|
21
|
+
- GitHub Mobile app (iOS/Android)
|
|
22
|
+
- Pull request conversations
|
|
23
|
+
- Issue comments
|
|
24
|
+
|
|
25
|
+
### Using TestDriver in GitHub Web
|
|
26
|
+
|
|
27
|
+
<Steps>
|
|
28
|
+
<Step title="Navigate to Your Repository">
|
|
29
|
+
Open your repository on GitHub.com. Make sure you have the TestDriver agent file at `.github/agents/testdriver.agent.md`.
|
|
30
|
+
</Step>
|
|
31
|
+
|
|
32
|
+
<Step title="Start a Copilot Chat">
|
|
33
|
+
Click the **Copilot icon** in the GitHub interface to open a chat. You can find this in:
|
|
34
|
+
- The repository's Code tab
|
|
35
|
+
- Pull request pages
|
|
36
|
+
- Issue pages
|
|
37
|
+
</Step>
|
|
38
|
+
|
|
39
|
+
<Step title="Invoke the TestDriver Agent">
|
|
40
|
+
Start your message with `@testdriver`:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
@testdriver Create a test that verifies the homepage loads correctly at https://myapp.com
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The agent will spawn a sandbox environment and begin executing, just like in VS Code.
|
|
47
|
+
</Step>
|
|
48
|
+
|
|
49
|
+
<Step title="View Screenshots in Chat">
|
|
50
|
+
As the test runs, screenshots appear directly in the chat. You can see what the AI sees and provide guidance if needed.
|
|
51
|
+
</Step>
|
|
52
|
+
</Steps>
|
|
53
|
+
|
|
54
|
+
### Creating Tests from PR Comments
|
|
55
|
+
|
|
56
|
+
You can create tests directly from pull request reviews. Comment on a PR and mention Copilot:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
@copilot create a TestDriver test that verifies this new feature works.
|
|
60
|
+
Test the checkout flow with a guest user.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Copilot will:
|
|
64
|
+
1. Use the TestDriver MCP server
|
|
65
|
+
2. Create a test based on your description
|
|
66
|
+
3. Commit the test file to the PR branch
|
|
67
|
+
|
|
68
|
+
This is useful for:
|
|
69
|
+
- Adding test coverage during code review
|
|
70
|
+
- Verifying bug fixes before merging
|
|
71
|
+
- Creating regression tests for new features
|
|
72
|
+
|
|
73
|
+
### Creating Tests from Issues
|
|
74
|
+
|
|
75
|
+
You can also create tests from issue comments:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
@copilot Use TestDriver to create a test that reproduces this bug.
|
|
79
|
+
Navigate to /settings, change the theme, and verify it persists after refresh.
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The test will be created in a new branch and linked to the issue.
|
|
83
|
+
|
|
84
|
+
### Mobile App Support
|
|
85
|
+
|
|
86
|
+
The GitHub Mobile app supports Copilot chat, which means you can use TestDriver from your phone:
|
|
87
|
+
|
|
88
|
+
1. Open the GitHub app
|
|
89
|
+
2. Navigate to your repository
|
|
90
|
+
3. Tap the Copilot icon
|
|
91
|
+
4. Type `@testdriver` followed by your request
|
|
92
|
+
|
|
93
|
+
Screenshots and test progress appear in the chat, letting you create and debug tests on the go.
|
|
94
|
+
|
|
95
|
+
### Example: PR Review Workflow
|
|
96
|
+
|
|
97
|
+
Here's a complete workflow for adding tests during code review:
|
|
98
|
+
|
|
99
|
+
<Steps>
|
|
100
|
+
<Step title="Developer Opens PR">
|
|
101
|
+
A developer opens a pull request with a new feature.
|
|
102
|
+
</Step>
|
|
103
|
+
|
|
104
|
+
<Step title="Reviewer Requests Tests">
|
|
105
|
+
The reviewer comments:
|
|
106
|
+
```
|
|
107
|
+
@copilot Create a TestDriver test for this user registration flow.
|
|
108
|
+
Test both successful registration and validation errors.
|
|
109
|
+
```
|
|
110
|
+
</Step>
|
|
111
|
+
|
|
112
|
+
<Step title="Copilot Creates Tests">
|
|
113
|
+
Copilot spawns TestDriver, creates the tests, and commits them to the PR branch.
|
|
114
|
+
</Step>
|
|
115
|
+
|
|
116
|
+
<Step title="Tests Run in CI">
|
|
117
|
+
The new tests run automatically in CI, validating the feature works as expected.
|
|
118
|
+
</Step>
|
|
119
|
+
</Steps>
|
|
120
|
+
|
|
121
|
+
### Agent File Reference
|
|
122
|
+
|
|
123
|
+
The agent file at `.github/agents/testdriver.agent.md` contains the configuration for GitHub Copilot to use TestDriver. Here's the structure:
|
|
124
|
+
|
|
125
|
+
```yaml
|
|
126
|
+
---
|
|
127
|
+
name: testdriver
|
|
128
|
+
description: An expert at creating and refining automated tests using TestDriver.ai
|
|
129
|
+
mcp-servers:
|
|
130
|
+
testdriver:
|
|
131
|
+
command: npx
|
|
132
|
+
args:
|
|
133
|
+
- -p
|
|
134
|
+
- testdriverai
|
|
135
|
+
- testdriverai-mcp
|
|
136
|
+
env:
|
|
137
|
+
TD_API_KEY: ${TD_API_KEY}
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
# TestDriver Expert
|
|
141
|
+
|
|
142
|
+
You are an expert at writing automated tests using TestDriver...
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The `TD_API_KEY` is pulled from your repository secrets when running in GitHub Actions or from your environment when using the web interface.
|
|
146
|
+
|
|
147
|
+
<Warning>
|
|
148
|
+
Make sure `TD_API_KEY` is set in your repository secrets for CI workflows. Go to **Settings → Secrets and variables → Actions** to add it.
|
|
149
|
+
</Warning>
|
|
150
|
+
|
|
151
|
+
## Auto-Healing Tests
|
|
152
|
+
|
|
153
|
+
Auto-healing tests automatically fix themselves when your application changes. By integrating an AI coding agent with TestDriver in your CI pipeline, you can have AI investigate test failures and propose fixes. The example below uses GitHub Copilot in GitHub Actions, but the same approach works with any AI agent that can run TestDriver's MCP server.
|
|
154
|
+
|
|
155
|
+
### How It Works
|
|
11
156
|
|
|
12
157
|
When a test fails in CI:
|
|
13
158
|
|
|
14
159
|
1. **GitHub Actions detects the failure**
|
|
15
|
-
2. **
|
|
160
|
+
2. **The AI agent spawns TestDriver** with access to the MCP server
|
|
16
161
|
3. **The agent investigates** by running the failing test and analyzing what changed
|
|
17
|
-
4. **
|
|
162
|
+
4. **The agent creates a fix** by updating the test code
|
|
18
163
|
5. **A pull request is opened** with the proposed changes for review
|
|
19
164
|
|
|
20
|
-
|
|
165
|
+
### Setting Up Auto-Healing
|
|
21
166
|
|
|
22
167
|
<Steps>
|
|
23
168
|
<Step title="Add Repository Secrets">
|
|
@@ -131,7 +276,7 @@ When a test fails in CI:
|
|
|
131
276
|
</Step>
|
|
132
277
|
</Steps>
|
|
133
278
|
|
|
134
|
-
|
|
279
|
+
### Example: Button Text Change
|
|
135
280
|
|
|
136
281
|
Here's what auto-healing looks like when a button's text changes:
|
|
137
282
|
|
|
@@ -158,7 +303,7 @@ Here's what auto-healing looks like when a button's text changes:
|
|
|
158
303
|
</Step>
|
|
159
304
|
|
|
160
305
|
<Step title="Auto-Heal Triggers">
|
|
161
|
-
The auto-heal workflow runs, and
|
|
306
|
+
The auto-heal workflow runs, and the AI agent investigates:
|
|
162
307
|
|
|
163
308
|
```
|
|
164
309
|
The test is looking for a "Submit button" but I see a "Send button"
|
|
@@ -177,9 +322,9 @@ Here's what auto-healing looks like when a button's text changes:
|
|
|
177
322
|
</Step>
|
|
178
323
|
</Steps>
|
|
179
324
|
|
|
180
|
-
|
|
325
|
+
### Configuration Options
|
|
181
326
|
|
|
182
|
-
|
|
327
|
+
#### Selective Auto-Healing
|
|
183
328
|
|
|
184
329
|
You can limit auto-healing to specific test files or patterns:
|
|
185
330
|
|
|
@@ -190,7 +335,7 @@ You can limit auto-healing to specific test files or patterns:
|
|
|
190
335
|
vitest run tests/e2e/ 2>&1 | tee test-output.txt
|
|
191
336
|
```
|
|
192
337
|
|
|
193
|
-
|
|
338
|
+
#### Manual Approval
|
|
194
339
|
|
|
195
340
|
For safety, you can require manual approval before auto-heal runs:
|
|
196
341
|
|
|
@@ -202,7 +347,7 @@ jobs:
|
|
|
202
347
|
|
|
203
348
|
Configure the environment in **Settings → Environments** with required reviewers.
|
|
204
349
|
|
|
205
|
-
|
|
350
|
+
#### Limiting Changes
|
|
206
351
|
|
|
207
352
|
Add instructions to constrain what the AI can change:
|
|
208
353
|
|
|
@@ -220,7 +365,7 @@ Add instructions to constrain what the AI can change:
|
|
|
220
365
|
- Keep changes minimal
|
|
221
366
|
```
|
|
222
367
|
|
|
223
|
-
|
|
368
|
+
### Best Practices
|
|
224
369
|
|
|
225
370
|
<AccordionGroup>
|
|
226
371
|
<Accordion title="Always review auto-heal PRs">
|
|
@@ -250,7 +395,7 @@ Add instructions to constrain what the AI can change:
|
|
|
250
395
|
</Accordion>
|
|
251
396
|
</AccordionGroup>
|
|
252
397
|
|
|
253
|
-
|
|
398
|
+
### Limitations
|
|
254
399
|
|
|
255
400
|
Auto-healing works best for:
|
|
256
401
|
- Element text changes
|
|
@@ -262,4 +407,8 @@ It may struggle with:
|
|
|
262
407
|
- New features requiring new assertions
|
|
263
408
|
- Complex multi-step interactions
|
|
264
409
|
|
|
265
|
-
For significant changes, create new tests
|
|
410
|
+
For significant changes, create new tests by going back to [Explore](/v7/generating-tests) and generating them with the TestDriver agent.
|
|
411
|
+
|
|
412
|
+
<Card title="View Your Runs" icon="chart-line" href="https://console.testdriver.ai">
|
|
413
|
+
Open the TestDriver console to monitor test runs, healing PRs, and CI results across your projects.
|
|
414
|
+
</Card>
|