testdriverai 7.11.264-test → 7.11.265-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 (67) hide show
  1. package/ai/skills/testdriver-quickstart/SKILL.md +1 -1
  2. package/ai/skills/testdriver-quickstart-claude/SKILL.md +47 -10
  3. package/docs/_scripts/generate-skills.js +76 -24
  4. package/docs/quickstart-claude.mdx +47 -10
  5. package/docs/quickstart.mdx +1 -1
  6. package/package.json +2 -2
  7. package/ai/skills/testdriver-ai/SKILL.md +0 -204
  8. package/ai/skills/testdriver-claude-mcp-plugin/SKILL.md +0 -245
  9. package/ai/skills/testdriver-cloud/SKILL.md +0 -119
  10. package/ai/skills/testdriver-device-config/SKILL.md +0 -317
  11. package/ai/skills/testdriver-elements/SKILL.md +0 -605
  12. package/ai/skills/testdriver-examples/SKILL.md +0 -7
  13. package/ai/skills/testdriver-machine-setup/SKILL.md +0 -331
  14. package/ai/skills/testdriver-running-tests/SKILL.md +0 -185
  15. package/ai/skills/testdriver-test-writer/SKILL.md +0 -446
  16. package/ai/skills/testdriver-waiting-for-elements/SKILL.md +0 -90
  17. package/ai/skills/testdriver:ai/SKILL.md +0 -204
  18. package/ai/skills/testdriver:assert/SKILL.md +0 -315
  19. package/ai/skills/testdriver:aws-setup/SKILL.md +0 -448
  20. package/ai/skills/testdriver:cache/SKILL.md +0 -221
  21. package/ai/skills/testdriver:caching/SKILL.md +0 -124
  22. package/ai/skills/testdriver:captcha/SKILL.md +0 -158
  23. package/ai/skills/testdriver:ci-cd/SKILL.md +0 -659
  24. package/ai/skills/testdriver:click/SKILL.md +0 -286
  25. package/ai/skills/testdriver:client/SKILL.md +0 -481
  26. package/ai/skills/testdriver:customizing-devices/SKILL.md +0 -319
  27. package/ai/skills/testdriver:dashcam/SKILL.md +0 -451
  28. package/ai/skills/testdriver:debugging-with-screenshots/SKILL.md +0 -415
  29. package/ai/skills/testdriver:device-config/SKILL.md +0 -317
  30. package/ai/skills/testdriver:double-click/SKILL.md +0 -102
  31. package/ai/skills/testdriver:elements/SKILL.md +0 -605
  32. package/ai/skills/testdriver:enterprise/SKILL.md +0 -7
  33. package/ai/skills/testdriver:errors/SKILL.md +0 -246
  34. package/ai/skills/testdriver:events/SKILL.md +0 -356
  35. package/ai/skills/testdriver:exec/SKILL.md +0 -317
  36. package/ai/skills/testdriver:find/SKILL.md +0 -856
  37. package/ai/skills/testdriver:focus-application/SKILL.md +0 -293
  38. package/ai/skills/testdriver:generating-tests/SKILL.md +0 -25
  39. package/ai/skills/testdriver:hosted/SKILL.md +0 -155
  40. package/ai/skills/testdriver:hover/SKILL.md +0 -278
  41. package/ai/skills/testdriver:locating-elements/SKILL.md +0 -71
  42. package/ai/skills/testdriver:making-assertions/SKILL.md +0 -32
  43. package/ai/skills/testdriver:mcp/SKILL.md +0 -7
  44. package/ai/skills/testdriver:mouse-down/SKILL.md +0 -161
  45. package/ai/skills/testdriver:mouse-up/SKILL.md +0 -164
  46. package/ai/skills/testdriver:parse/SKILL.md +0 -236
  47. package/ai/skills/testdriver:performing-actions/SKILL.md +0 -53
  48. package/ai/skills/testdriver:press-keys/SKILL.md +0 -348
  49. package/ai/skills/testdriver:provision/SKILL.md +0 -331
  50. package/ai/skills/testdriver:quickstart/SKILL.md +0 -172
  51. package/ai/skills/testdriver:redraw/SKILL.md +0 -214
  52. package/ai/skills/testdriver:reusable-code/SKILL.md +0 -249
  53. package/ai/skills/testdriver:right-click/SKILL.md +0 -123
  54. package/ai/skills/testdriver:running-tests/SKILL.md +0 -185
  55. package/ai/skills/testdriver:screenshot/SKILL.md +0 -248
  56. package/ai/skills/testdriver:screenshots/SKILL.md +0 -184
  57. package/ai/skills/testdriver:scroll/SKILL.md +0 -205
  58. package/ai/skills/testdriver:secrets/SKILL.md +0 -115
  59. package/ai/skills/testdriver:self-hosted/SKILL.md +0 -147
  60. package/ai/skills/testdriver:test-results-json/SKILL.md +0 -257
  61. package/ai/skills/testdriver:testdriver/SKILL.md +0 -624
  62. package/ai/skills/testdriver:type/SKILL.md +0 -357
  63. package/ai/skills/testdriver:variables/SKILL.md +0 -111
  64. package/ai/skills/testdriver:wait/SKILL.md +0 -50
  65. package/ai/skills/testdriver:waiting-for-elements/SKILL.md +0 -90
  66. package/ai/skills/testdriver:what-is-testdriver/SKILL.md +0 -54
  67. package/scripts/generate-skills.js +0 -94
@@ -1,245 +0,0 @@
1
- ---
2
- name: testdriver:claude-mcp-plugin
3
- description: claude-mcp-plugin
4
- ---
5
- <!-- Generated from claude-mcp-plugin.mdx. DO NOT EDIT. -->
6
-
7
- TestDriver ships as a native [Claude Code plugin](https://docs.claude.com/en/docs/claude-code/plugins) that bundles the **TestDriver MCP server**, the **`testdriver` expert sub-agent**, and all **TestDriver skills**. You get everything you need to drive TestDriver from Claude Code with a single install.
8
-
9
- > The plugin lives inside the `testdriverai` npm package at `ai/.claude-plugin/plugin.json`, and the marketplace entry lives at `.claude-plugin/marketplace.json` in this repo.
10
-
11
- ## 1. Get a TestDriver API key
12
-
13
- - Visit your team page (e.g. `https://console.testdriver.ai/settings`)
14
- - Create or copy a **Team API Key** (or User API Key)
15
- - Export it in your shell so Claude Code can pass it to the MCP server:
16
-
17
- ```bash
18
- export TD_API_KEY="your_api_key_here"
19
- ```
20
-
21
- ## 2. Install the plugin in Claude Code
22
-
23
- From inside Claude Code, add this repo as a plugin marketplace and install the `testdriver` plugin:
24
-
25
- ```text
26
- /plugin marketplace add testdriverai/testdriverai
27
- /plugin install testdriver@testdriver
28
- ```
29
-
30
- That registers three things:
31
-
32
- - **`testdriver` MCP server** — spawned via `npx -p testdriverai testdriverai-mcp`, with `TD_API_KEY` forwarded from your environment.
33
- - **`testdriver` sub-agent** — the TestDriver expert agent from `ai/agents/testdriver.md`. Invoke it with `@testdriver ...`.
34
- - **TestDriver skills** — every `ai/skills/testdriver-*` skill, auto-loaded by Claude Code.
35
-
36
- ## 3. Write tests with the agent
37
-
38
- In a Claude Code session, delegate to the agent:
39
-
40
- ```text
41
- @testdriver Write a test that signs into https://example.com and adds an item to the cart.
42
- ```
43
-
44
- The agent will use the TestDriver MCP tools (`session_start`, `find`, `click`, `type`, `assert`, …) to interactively build a Vitest test, append generated code to your test file after every action, and run it with `vitest run` until it passes.
45
-
46
- For the full agent guide, see the [`testdriver` agent definition](https://github.com/testdriverai/testdriverai/blob/main/ai/agents/testdriver.md) and the [MCP workflow skill](https://github.com/testdriverai/testdriverai/blob/main/ai/skills/testdriver-mcp-workflow/SKILL.md).
47
-
48
- ## Manual MCP configuration (no plugin)
49
-
50
- If you prefer not to use the plugin, you can register the MCP server manually in any MCP-compatible client (Claude Desktop, Cursor, VS Code, …):
51
-
52
- ```json
53
- {
54
- "mcpServers": {
55
- "testdriver": {
56
- "command": "npx",
57
- "args": ["-p", "testdriverai", "testdriverai-mcp"],
58
- "env": {
59
- "TD_API_KEY": "${TD_API_KEY}"
60
- }
61
- }
62
- }
63
- }
64
- ```
65
-
66
- This is the same config the plugin wires up for you — the plugin just bundles it alongside the agent and skills.
67
-
68
- ---
69
-
70
- ## Remote (hosted URL) install — no CLI, browser login
71
-
72
- TestDriver also runs a **hosted MCP server** you can connect to with just a URL. There is no `npx` command and no API key to paste: the server speaks OAuth 2.1, so your client opens a browser, you sign in with TestDriver, and the tools appear. It exposes the **full live tool set** (`session_start`, `find`, `click`, `type`, `assert`, …) plus the read-only data tools, all scoped to your team.
73
-
74
- Hosted endpoint:
75
-
76
- ```text
77
- https://mcp.testdriver.ai/mcp
78
- ```
79
-
80
- The server advertises its authorization server (Auth0) via [RFC 9728](https://www.rfc-editor.org/rfc/rfc9728) protected-resource metadata at:
81
-
82
- ```text
83
- https://mcp.testdriver.ai/.well-known/oauth-protected-resource
84
- ```
85
-
86
- Spec-compliant clients discover and complete the OAuth flow automatically:
87
-
88
- - **Claude** — add a custom connector pointing at the URL above; Claude runs the browser login for you.
89
- - **VS Code / Copilot** — add a remote MCP server entry with the URL; VS Code handles the OAuth handshake.
90
- - **ChatGPT** — add it as a connector by URL.
91
- - **Any spec-compliant client** — point it at the URL; it will read the metadata, sign you in, and connect.
92
-
93
- ```json
94
- {
95
- "mcpServers": {
96
- "testdriver": {
97
- "url": "https://mcp.testdriver.ai/mcp"
98
- }
99
- }
100
- }
101
- ```
102
-
103
- Each connection gets its own isolated sandbox, so multiple people (or multiple chats) can run tests at the same time without interfering. The API-key paths above still work for automation and CI.
104
-
105
- ---
106
-
107
- ## Observing test runs via HTTP MCP
108
-
109
- TestDriver also exposes **test results and analytics** over an HTTP MCP endpoint, so Claude Code (or any MCP-compatible client) can inspect your test runs, failures, and filters without provisioning a sandbox.
110
-
111
- ### HTTP MCP endpoint contract
112
-
113
- The HTTP endpoint lives at:
114
-
115
- ```text
116
- POST /api/v1/mcp
117
- ```
118
-
119
- It expects the TestDriver API key in the `X-Api-Key` header (or `Authorization: Bearer <key>`).
120
-
121
- Common request shapes:
122
-
123
- - **List tools**
124
-
125
- ```json
126
- {
127
- "kind": "list_tools"
128
- }
129
- ```
130
-
131
- - **Call a tool**
132
-
133
- ```json
134
- {
135
- "kind": "call_tool",
136
- "tool": "list_test_runs",
137
- "arguments": {
138
- "status": "failed",
139
- "page": 1,
140
- "limit": 20
141
- }
142
- }
143
- ```
144
-
145
- Responses from tool calls follow the MCP content convention:
146
-
147
- ```json
148
- {
149
- "content": [
150
- {
151
- "type": "json",
152
- "json": {
153
- "testRuns": [],
154
- "totalCount": 0,
155
- "hasMore": false
156
- }
157
- }
158
- ]
159
- }
160
- ```
161
-
162
- ### Available tools
163
-
164
- The MCP server advertises at least these tools in `list_tools`:
165
-
166
- - `list_test_runs`
167
- List recent TestDriver test runs for the current team, with filters and pagination.
168
-
169
- - `get_test_run_detail`
170
- Get a single test run and its test cases (including replay IDs / share keys when available).
171
-
172
- - `list_test_cases`
173
- List individual test cases for the team with status, duration, error messages, and replay info.
174
-
175
- - `get_filter_options`
176
- Get branch, suite, repo, filename, commit, status, platform, and test name options for building queries.
177
-
178
- ### Pointing Claude Code at the HTTP MCP endpoint
179
-
180
- You can point Claude Code at the HTTP MCP endpoint using a JSON configuration similar to:
181
-
182
- ```json
183
- {
184
- "$schema": "https://schema.anthropic.com/mcp/servers.json",
185
- "mcpServers": {
186
- "testdriver-cloud": {
187
- "type": "sse",
188
- "url": "https://your-api-host.example.com/api/v1/mcp",
189
- "requestHeaders": {
190
- "X-Api-Key": "${TD_API_KEY}"
191
- },
192
- "description": "Query TestDriver test runs, test cases, and filters for your team using an API key."
193
- }
194
- }
195
- }
196
- ```
197
-
198
- You can find this exact snippet in the repo at:
199
-
200
- - `claude-mcp-config.example.json`
201
-
202
- Replace `https://your-api-host.example.com` with your actual API origin (e.g. `https://api.testdriver.ai` or `http://localhost:1337` in development).
203
-
204
- ### Local development
205
-
206
- For local development:
207
-
208
- - Run your API server on `http://localhost:1337`
209
- - Point `baseUrl` at `http://localhost:1337/api/v1/mcp`
210
- - Use a local team or user API key in `TD_API_KEY`
211
-
212
- ```json
213
- {
214
- "mcpServers": {
215
- "testdriver-cloud-local": {
216
- "type": "sse",
217
- "url": "http://localhost:1337/api/v1/mcp",
218
- "requestHeaders": {
219
- "X-Api-Key": "${TD_API_KEY}"
220
- }
221
- }
222
- }
223
- }
224
- ```
225
-
226
- ### Skills documentation for Claude
227
-
228
- Claude Code loads the agent and skills automatically when you install the plugin (see step 2). The underlying sources are:
229
-
230
- - `ai/agents/testdriver.md` contains the **full TestDriver Agent Guide**
231
- - `ai/skills/testdriver-*/SKILL.md` provide task-specific skills (MCP workflow, assertions, provisioning, etc.)
232
-
233
- Use these as the primary reference for:
234
-
235
- - How to initialize the `TestDriver` SDK in Vitest
236
- - The MCP workflow for building tests interactively with visual feedback
237
- - How to find elements, click, type, scroll, assert, and capture screenshots
238
-
239
- The MCP tools described above are **read-only** helpers for:
240
-
241
- - Inspecting recent test runs and failures
242
- - Discovering branches, files, and suites to focus on
243
- - Pulling detailed test case and replay information into Claude for analysis
244
-
245
- Use the SDK (`testdriverai`) for **driving tests**, and the HTTP MCP server (`/api/v1/mcp`) for **observing and debugging** them from Claude Code.
@@ -1,119 +0,0 @@
1
- ---
2
- name: testdriver:cloud
3
- description: The fastest way to get started with TestDriver. Just set your API key and start testing.
4
- ---
5
- <!-- Generated from cloud.mdx. DO NOT EDIT. -->
6
-
7
- Cloud pricing is based on **device-seconds**: the amount of time your tests run on **our infrastructure**.
8
-
9
- - **Zero Setup** — Start testing immediately. No DevOps required.
10
- - **Free Tier** — Get started with a limited preview at no cost.
11
- - **Pay As You Go** — Only pay for the device-seconds you use.
12
-
13
- ## Get Started
14
- Cloud is the default when you follow the Quickstart guide.
15
- <Card
16
- title="Try the Quickstart"
17
- icon="play"
18
- href="/v7/quickstart"
19
- >
20
- Set your API key and start testing in minutes.
21
- </Card>
22
-
23
- ## Parallel Testing Limits
24
-
25
- Your account has a set number of **license slots** that determine how many devices can run simultaneously. You can view your available slots in the [TestDriver Dashboard](https://console.testdriver.ai).
26
-
27
- <Info>
28
- **When is a slot in use?** A license slot is occupied when a test client is connected. As soon as your device is destroyed the slot becomes available immediately.
29
- </Info>
30
-
31
- ## Avoiding Slot Conflicts
32
-
33
- To prevent tests from failing due to exceeding your license slot limit, we recommend two key configurations:
34
-
35
- <AccordionGroup>
36
- <Accordion title="Set Maximum Concurrency in Vitest">
37
- Limit concurrent tests to match your available license slots:
38
-
39
- ```javascript vitest.config.mjs
40
- import { defineConfig } from 'vitest/config';
41
- import { TestDriver } from 'testdriverai/vitest';
42
-
43
- export default defineConfig({
44
- test: {
45
- testTimeout: 900000,
46
- hookTimeout: 900000,
47
- maxConcurrency: 5, // Set to your license slot limit
48
- reporters: ['default', TestDriver()],
49
- setupFiles: ['testdriverai/vitest/setup'],
50
- },
51
- });
52
- ```
53
-
54
- <Tip>
55
- Check your slot count at [console.testdriver.ai](https://console.testdriver.ai) and set `maxConcurrency` to that number or lower.
56
- </Tip>
57
- </Accordion>
58
-
59
- <Accordion title="Use GitHub Concurrency Keys">
60
- Prevent multiple workflow runs from competing for the same slots by using [GitHub's concurrency controls](https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs):
61
-
62
- ```yaml .github/workflows/test.yml
63
- name: Tests
64
-
65
- on:
66
- push:
67
- branches: [main]
68
- pull_request:
69
-
70
- # Prevent concurrent runs from competing for license slots
71
- concurrency:
72
- group: ${{ github.workflow }}-${{ github.ref }}
73
- cancel-in-progress: true
74
-
75
- jobs:
76
- test:
77
- runs-on: ubuntu-latest
78
- steps:
79
- - uses: actions/checkout@v4
80
-
81
- - name: Setup Node.js
82
- uses: actions/setup-node@v4
83
- with:
84
- node-version: '20'
85
-
86
- - name: Install dependencies
87
- run: npm install
88
-
89
- - name: Run tests
90
- run: vitest run
91
- env:
92
- TD_API_KEY: ${{ secrets.TD_API_KEY }}
93
- ```
94
-
95
- The `concurrency` block ensures:
96
- - Only one workflow run per branch runs at a time
97
- - New pushes cancel in-progress runs on the same branch
98
- - Different branches/PRs can run in parallel (up to your slot limit)
99
- </Accordion>
100
- </AccordionGroup>
101
-
102
- ## When to Consider Self-Hosted
103
-
104
- Cloud is perfect for getting started and for teams that want zero infrastructure management. However, you might consider [Self-Hosted](/v7/self-hosted) if you:
105
-
106
- - Want to escape per-second billing with a flat license fee
107
- - Require greater concurrency than offered in Cloud plans
108
- - Need full control over your infrastructure and privacy
109
- - Want to use your own AI API keys
110
- - Require custom hardware configurations
111
- - Have high test volumes that make self-hosting more economical
112
-
113
- <Card
114
- title="Explore Self-Hosted"
115
- icon="server"
116
- href="/v7/self-hosted"
117
- >
118
- Learn about self-hosting for unlimited test execution at a flat rate.
119
- </Card>
@@ -1,317 +0,0 @@
1
- ---
2
- name: testdriver:device-config
3
- description: Launch browsers, desktop apps, and extensions in your TestDriver sandbox
4
- ---
5
- <!-- Generated from device-config.mdx. DO NOT EDIT. -->
6
-
7
- Provision methods are the starting point for most tests. They launch applications in your sandbox and prepare the environment for testing.
8
-
9
- ## Chrome Browser
10
-
11
- The most common starting point for web testing. Launches Chrome browser and navigates to a URL.
12
-
13
- ```javascript
14
- await testdriver.provision.chrome({
15
- url: 'https://example.com',
16
- });
17
- ```
18
-
19
- ### Options
20
-
21
- | Option | Type | Default | Description |
22
- |--------|------|---------|-------------|
23
- | `url` | string | `'http://testdriver-sandbox.vercel.app/'` | URL to navigate to |
24
- | `maximized` | boolean | `true` | Start browser maximized |
25
- | `guest` | boolean | `false` | Use guest mode (no profile) |
26
-
27
- ### Example: Basic Web Test
28
-
29
- ```javascript
30
- import { describe, expect, it } from "vitest";
31
- import { TestDriver } from "testdriverai/vitest/hooks";
32
-
33
- describe("Login Flow", () => {
34
- it("should log in successfully", async (context) => {
35
- const testdriver = TestDriver(context);
36
-
37
- await testdriver.provision.chrome({
38
- url: 'https://myapp.com/login',
39
- });
40
-
41
- await testdriver.find("Email input").click();
42
- await testdriver.type("user@example.com");
43
-
44
- await testdriver.find("Password input").click();
45
- await testdriver.type("password123");
46
-
47
- await testdriver.find("Sign In button").click();
48
-
49
- const result = await testdriver.assert("the dashboard is visible");
50
- expect(result).toBeTruthy();
51
- });
52
- });
53
- ```
54
-
55
- <Info>
56
- `provision.chrome()` automatically starts Dashcam recording and waits for Chrome to be ready before returning.
57
- </Info>
58
-
59
- ---
60
-
61
- ## Chrome Extensions
62
-
63
- Launch Chrome with a custom extension loaded. Supports both local extensions and Chrome Web Store extensions.
64
-
65
- ### Load from Local Path
66
-
67
- Clone or create an extension locally, then load it:
68
-
69
- ```javascript
70
- // First, get the extension onto the sandbox
71
- await testdriver.exec(
72
- 'sh',
73
- 'git clone https://github.com/user/my-extension.git /tmp/my-extension',
74
- 60000
75
- );
76
-
77
- // Launch Chrome with the extension
78
- await testdriver.provision.chromeExtension({
79
- extensionPath: '/tmp/my-extension',
80
- url: 'https://example.com'
81
- });
82
- ```
83
-
84
- ### Load from Chrome Web Store
85
-
86
- Load any published extension by its Chrome Web Store ID:
87
-
88
- ```javascript
89
- await testdriver.provision.chromeExtension({
90
- extensionId: 'cjpalhdlnbpafiamejdnhcphjbkeiagm', // uBlock Origin
91
- url: 'https://example.com'
92
- });
93
- ```
94
-
95
- <Tip>
96
- Find the extension ID in the Chrome Web Store URL. For example, `https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm` → ID is `cjpalhdlnbpafiamejdnhcphjbkeiagm`
97
- </Tip>
98
-
99
- ### Options
100
-
101
- | Option | Type | Default | Description |
102
- |--------|------|---------|-------------|
103
- | `extensionPath` | string | - | Local path to unpacked extension directory |
104
- | `extensionId` | string | - | Chrome Web Store extension ID |
105
- | `url` | string | - | URL to navigate to after launch |
106
- | `maximized` | boolean | `true` | Start browser maximized |
107
-
108
- <Warning>
109
- You must provide either `extensionPath` or `extensionId`, but not both.
110
- </Warning>
111
-
112
- ### Example: Testing a Chrome Extension
113
-
114
- ```javascript
115
- import { describe, expect, it } from "vitest";
116
- import { TestDriver } from "testdriverai/vitest/hooks";
117
-
118
- describe("Chrome Extension Test", () => {
119
- it("should load and interact with extension", async (context) => {
120
- const testdriver = TestDriver(context);
121
-
122
- // Clone extension from GitHub
123
- await testdriver.exec(
124
- 'sh',
125
- 'git clone https://github.com/user/my-extension.git /tmp/my-extension',
126
- 60000,
127
- true
128
- );
129
-
130
- // Launch Chrome with extension loaded
131
- await testdriver.provision.chromeExtension({
132
- extensionPath: '/tmp/my-extension',
133
- url: 'https://testdriver.ai'
134
- });
135
-
136
- // Click extensions puzzle icon
137
- const extensionsButton = await testdriver.find("puzzle-shaped icon in Chrome toolbar");
138
- await extensionsButton.click();
139
-
140
- // Interact with your extension
141
- const myExtension = await testdriver.find("My Extension in the dropdown");
142
- await myExtension.click();
143
-
144
- const result = await testdriver.assert("extension popup is visible");
145
- expect(result).toBeTruthy();
146
- });
147
- });
148
- ```
149
-
150
- ---
151
-
152
- ## Desktop Apps
153
-
154
- Download and install desktop applications. Supports `.deb`, `.rpm`, `.msi`, `.exe`, `.AppImage`, `.dmg`, `.pkg`, and shell scripts.
155
-
156
- ```javascript
157
- const filePath = await testdriver.provision.installer({
158
- url: 'https://example.com/app.deb',
159
- appName: 'MyApp', // Focus this app after install
160
- launch: true, // Auto-launch after install
161
- });
162
- ```
163
-
164
- ### Options
165
-
166
- | Option | Type | Default | Description |
167
- |--------|------|---------|-------------|
168
- | `url` | string | **required** | URL to download the installer from |
169
- | `filename` | string | auto-detected | Filename to save as |
170
- | `appName` | string | - | Application name to focus after install |
171
- | `launch` | boolean | `true` | Launch the app after installation |
172
-
173
- ### Supported File Types
174
-
175
- | Extension | OS | Install Method |
176
- |-----------|-----|----------------|
177
- | `.deb` | Linux | `dpkg -i` + `apt-get install -f` |
178
- | `.rpm` | Linux | `rpm -i` |
179
- | `.AppImage` | Linux | `chmod +x` |
180
- | `.sh` | Linux | `chmod +x` + execute |
181
- | `.msi` | Windows | `msiexec /i /quiet` |
182
- | `.exe` | Windows | Silent install (`/S`) |
183
- | `.dmg` | macOS | Mount + copy to Applications |
184
- | `.pkg` | macOS | `installer -pkg` |
185
-
186
- ### Example: Install and Test a Desktop App
187
-
188
- ```javascript
189
- import { describe, expect, it } from "vitest";
190
- import { TestDriver } from "testdriverai/vitest/hooks";
191
-
192
- describe("Desktop App Test", () => {
193
- it("should install and launch app", async (context) => {
194
- const testdriver = TestDriver(context);
195
-
196
- // Download and install
197
- const installerPath = await testdriver.provision.installer({
198
- url: 'https://github.com/sharkdp/bat/releases/download/v0.24.0/bat_0.24.0_amd64.deb',
199
- });
200
-
201
- // Verify installation
202
- const output = await testdriver.exec('sh', 'bat --version', 5000);
203
- expect(output).toContain('bat');
204
- });
205
- });
206
- ```
207
-
208
- ### Example: Windows Installer
209
-
210
- ```javascript
211
- import { describe, expect, it } from "vitest";
212
- import { TestDriver } from "testdriverai/vitest/hooks";
213
-
214
- describe("Windows App Test", () => {
215
- it("should install on Windows", async (context) => {
216
- const testdriver = TestDriver(context, {
217
- os: 'windows'
218
- });
219
-
220
- // Download MSI installer
221
- const installerPath = await testdriver.provision.installer({
222
- url: 'https://example.com/app.msi',
223
- launch: false, // Don't auto-launch
224
- });
225
-
226
- // Custom installation if needed
227
- await testdriver.exec(
228
- 'pwsh',
229
- `Start-Process msiexec.exe -ArgumentList "/i", "${installerPath}", "/qn" -Wait`,
230
- 120000
231
- );
232
-
233
- // Verify installation
234
- const result = await testdriver.assert("application is installed");
235
- expect(result).toBeTruthy();
236
- });
237
- });
238
- ```
239
-
240
- ### Manual Installation
241
-
242
- Set `launch: false` to download without auto-installing:
243
-
244
- ```javascript
245
- const filePath = await testdriver.provision.installer({
246
- url: 'https://example.com/custom-script.sh',
247
- launch: false,
248
- });
249
-
250
- // Run custom install commands
251
- await testdriver.exec('sh', `chmod +x "${filePath}"`, 5000);
252
- await testdriver.exec('sh', `"${filePath}" --custom-flag`, 60000);
253
- ```
254
-
255
- ---
256
-
257
- ## VS Code
258
-
259
- Launch Visual Studio Code with optional workspace and extensions.
260
-
261
- ```javascript
262
- await testdriver.provision.vscode({
263
- workspace: '/home/testdriver/my-project',
264
- extensions: ['ms-python.python', 'esbenp.prettier-vscode'],
265
- });
266
- ```
267
-
268
- ### Options
269
-
270
- | Option | Type | Default | Description |
271
- |--------|------|---------|-------------|
272
- | `workspace` | string | - | Workspace folder to open |
273
- | `extensions` | string[] | `[]` | Extensions to install (by ID) |
274
-
275
- ### Example: VS Code Extension Test
276
-
277
- ```javascript
278
- import { describe, expect, it } from "vitest";
279
- import { TestDriver } from "testdriverai/vitest/hooks";
280
-
281
- describe("VS Code Test", () => {
282
- it("should open workspace with extensions", async (context) => {
283
- const testdriver = TestDriver(context);
284
-
285
- // Create a test project
286
- await testdriver.exec('sh', 'mkdir -p /tmp/test-project && echo "print(1)" > /tmp/test-project/test.py', 10000);
287
-
288
- // Launch VS Code
289
- await testdriver.provision.vscode({
290
- workspace: '/tmp/test-project',
291
- extensions: ['ms-python.python'],
292
- });
293
-
294
- // Verify VS Code is ready
295
- const result = await testdriver.assert("VS Code is open with the project");
296
- expect(result).toBeTruthy();
297
-
298
- // Open the Python file
299
- await testdriver.find("test.py in the explorer").click();
300
- });
301
- });
302
- ```
303
-
304
- ---
305
-
306
- ## Choosing the Right Provision Method
307
-
308
- | Use Case | Method |
309
- |----------|--------|
310
- | Testing a website | `provision.chrome` |
311
- | Testing a Chrome extension | `provision.chromeExtension` |
312
- | Testing a desktop app (needs installation) | `provision.installer` |
313
- | Testing VS Code or VS Code extensions | `provision.vscode` |
314
-
315
- <Tip>
316
- All provision methods automatically start Dashcam recording and wait for the application to be ready before returning. You don't need to call `dashcam.start()` manually.
317
- </Tip>