@desplega.ai/qa-use 2.3.1 → 2.3.3
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/README.md +179 -907
- package/dist/lib/api/browser.d.ts +7 -2
- package/dist/lib/api/browser.d.ts.map +1 -1
- package/dist/lib/api/browser.js +11 -2
- package/dist/lib/api/browser.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/cli/commands/browser/run.d.ts.map +1 -1
- package/dist/src/cli/commands/browser/run.js +11 -3
- package/dist/src/cli/commands/browser/run.js.map +1 -1
- package/dist/src/cli/commands/browser/screenshot.d.ts.map +1 -1
- package/dist/src/cli/commands/browser/screenshot.js +10 -2
- package/dist/src/cli/commands/browser/screenshot.js.map +1 -1
- package/lib/api/browser.ts +15 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,1002 +1,274 @@
|
|
|
1
|
-
#
|
|
1
|
+
# qa-use
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
QA automation CLI for browser testing and E2E test management.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- 🌐 **HTTP/SSE** - StreamableHTTP transport for remote access and web integrations
|
|
8
|
-
- 🔄 **tunnel** - Persistent WebSocket tunnel for backend-initiated tasks
|
|
5
|
+
[](https://www.npmjs.com/package/@desplega.ai/qa-use)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
7
|
|
|
10
8
|
[](https://www.youtube.com/watch?v=ts3XsYneiO4)
|
|
11
9
|
|
|
12
|
-
> **Learn more:** Check out our comprehensive [MCP integration guide](https://www.desplega.ai/how-to/mcp) for detailed setup instructions and advanced usage patterns.
|
|
13
|
-
|
|
14
10
|
## Quick Start
|
|
15
11
|
|
|
16
12
|
```bash
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
# Run with HTTP transport (for web/remote access)
|
|
21
|
-
npx @desplega.ai/qa-use mcp --http --port 3000
|
|
22
|
-
|
|
23
|
-
# Run persistent tunnel (for backend-initiated tasks)
|
|
24
|
-
npx @desplega.ai/qa-use mcp tunnel
|
|
13
|
+
# Install globally
|
|
14
|
+
npm install -g @desplega.ai/qa-use
|
|
25
15
|
|
|
26
|
-
#
|
|
27
|
-
npx @desplega.ai/qa-use
|
|
16
|
+
# Or use with npx
|
|
17
|
+
npx @desplega.ai/qa-use setup
|
|
28
18
|
```
|
|
29
19
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
> **For AI Assistants:** See [CLAUDE.md](./CLAUDE.md) for a concise onboarding guide with quick commands, architecture overview, and key concepts.
|
|
33
|
-
|
|
34
|
-
> **Package Manager:** This project uses **bun** as the package manager. Bun provides fast installs, a built-in test runner, and native TypeScript support.
|
|
35
|
-
|
|
36
|
-
## Table of Contents
|
|
37
|
-
|
|
38
|
-
- [MCP Client Configuration (stdio mode)](#mcp-client-configuration-stdio-mode)
|
|
39
|
-
- [HTTP Transport Mode (SSE)](#http-transport-mode-sse)
|
|
40
|
-
- [Tunnel Mode](#tunnel-mode)
|
|
41
|
-
- [Features](#features)
|
|
42
|
-
- [Installation](#installation)
|
|
43
|
-
- [Development](#development)
|
|
44
|
-
- [Available Tools](#available-tools)
|
|
45
|
-
|
|
46
|
-
## MCP Client Configuration (stdio mode)
|
|
20
|
+
## Getting Started
|
|
47
21
|
|
|
48
|
-
|
|
22
|
+
### 1. Setup
|
|
49
23
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
{
|
|
54
|
-
"mcpServers": {
|
|
55
|
-
"desplega-qa": {
|
|
56
|
-
"command": "npx",
|
|
57
|
-
"args": ["-y", "@desplega.ai/qa-use@latest", "mcp"],
|
|
58
|
-
"env": {
|
|
59
|
-
"QA_USE_API_KEY": "your-desplega-ai-api-key"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
24
|
+
```bash
|
|
25
|
+
qa-use setup # Configure your API key
|
|
26
|
+
qa-use test init # Initialize test directory with example
|
|
64
27
|
```
|
|
65
28
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<details>
|
|
69
|
-
<summary>Claude Code</summary>
|
|
70
|
-
Use the Claude Code CLI to add the QA-Use MCP server (<a href="https://docs.anthropic.com/en/docs/claude-code/mcp">guide</a>):
|
|
29
|
+
### 2. Create Your First Test
|
|
71
30
|
|
|
72
|
-
|
|
73
|
-
claude mcp add desplega-qa -- npx @desplega.ai/qa-use@latest mcp --env QA_USE_API_KEY=your-desplega-ai-api-key
|
|
74
|
-
```
|
|
31
|
+
Create `qa-tests/login.yaml`:
|
|
75
32
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
33
|
+
```yaml
|
|
34
|
+
name: Login Test
|
|
35
|
+
app_config: your-app-config-id
|
|
36
|
+
steps:
|
|
37
|
+
- action: goto
|
|
38
|
+
url: /login
|
|
39
|
+
- action: fill
|
|
40
|
+
target: email input
|
|
41
|
+
value: test@example.com
|
|
42
|
+
- action: click
|
|
43
|
+
target: login button
|
|
44
|
+
- action: to_be_visible
|
|
45
|
+
target: dashboard
|
|
79
46
|
```
|
|
80
47
|
|
|
81
|
-
|
|
48
|
+
### 3. Run Tests
|
|
82
49
|
|
|
83
50
|
```bash
|
|
84
|
-
|
|
51
|
+
qa-use test run login # Run single test
|
|
52
|
+
qa-use test run --all # Run all tests
|
|
85
53
|
```
|
|
86
54
|
|
|
87
|
-
|
|
55
|
+
## CLI Reference
|
|
88
56
|
|
|
89
|
-
|
|
90
|
-
<summary>Claude Desktop</summary>
|
|
91
|
-
Add to your <code>claude_desktop_config.json</code>:
|
|
57
|
+
### Test Commands
|
|
92
58
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
```
|
|
59
|
+
| Command | Description |
|
|
60
|
+
|---------|-------------|
|
|
61
|
+
| `qa-use test init` | Initialize test directory with example |
|
|
62
|
+
| `qa-use test run <name>` | Run a test by name |
|
|
63
|
+
| `qa-use test run --all` | Run all tests in `qa-tests/` |
|
|
64
|
+
| `qa-use test list` | List local tests |
|
|
65
|
+
| `qa-use test list --cloud` | List cloud tests |
|
|
66
|
+
| `qa-use test validate <name>` | Validate test syntax |
|
|
67
|
+
| `qa-use test sync --push` | Push local tests to cloud |
|
|
68
|
+
| `qa-use test sync --pull` | Pull cloud tests to local |
|
|
69
|
+
| `qa-use test export <id>` | Export cloud test to local file |
|
|
106
70
|
|
|
107
|
-
|
|
71
|
+
Run `qa-use test --help` for all options.
|
|
108
72
|
|
|
109
|
-
|
|
110
|
-
<summary>Cline</summary>
|
|
111
|
-
Follow <a href="https://docs.cline.bot/mcp/configuring-mcp-servers">https://docs.cline.bot/mcp/configuring-mcp-servers</a> and use the config provided above.
|
|
112
|
-
</details>
|
|
73
|
+
### Browser Commands
|
|
113
74
|
|
|
114
|
-
|
|
115
|
-
<summary>Codex</summary>
|
|
116
|
-
Follow the <a href="https://github.com/openai/codex/blob/main/docs/advanced.md#model-context-protocol-mcp">configure MCP guide</a>
|
|
117
|
-
using the standard config from above. You can also install the QA-Use MCP server using the Codex CLI:
|
|
75
|
+
Interactive browser control for test development and debugging:
|
|
118
76
|
|
|
119
77
|
```bash
|
|
120
|
-
|
|
78
|
+
qa-use browser create # Start browser session
|
|
79
|
+
qa-use browser goto https://example.com
|
|
80
|
+
qa-use browser snapshot # Get element refs like [ref=e3]
|
|
81
|
+
qa-use browser click e3 # Click by element ref
|
|
82
|
+
qa-use browser fill e5 "hello" # Fill input field
|
|
83
|
+
qa-use browser run # Interactive REPL mode
|
|
121
84
|
```
|
|
122
85
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
</details>
|
|
86
|
+
| Command | Description |
|
|
87
|
+
|---------|-------------|
|
|
88
|
+
| `qa-use browser create` | Start browser session |
|
|
89
|
+
| `qa-use browser goto <url>` | Navigate to URL |
|
|
90
|
+
| `qa-use browser snapshot` | Get page element refs |
|
|
91
|
+
| `qa-use browser click <ref>` | Click element by ref |
|
|
92
|
+
| `qa-use browser fill <ref> <value>` | Fill input field |
|
|
93
|
+
| `qa-use browser screenshot <path>` | Save screenshot |
|
|
94
|
+
| `qa-use browser run` | Interactive REPL mode |
|
|
95
|
+
| `qa-use browser close` | Close browser session |
|
|
134
96
|
|
|
135
|
-
|
|
136
|
-
<summary>Cursor</summary>
|
|
97
|
+
Run `qa-use browser --help` for the full list of 29 browser commands.
|
|
137
98
|
|
|
138
|
-
|
|
99
|
+
### Setup Commands
|
|
139
100
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
<summary>Continue</summary>
|
|
146
|
-
Add to your Continue <code>config.json</code>:
|
|
147
|
-
|
|
148
|
-
```json
|
|
149
|
-
{
|
|
150
|
-
"mcpServers": {
|
|
151
|
-
"desplega-qa": {
|
|
152
|
-
"command": "npx",
|
|
153
|
-
"args": ["-y", "@desplega.ai/qa-use@latest", "mcp"],
|
|
154
|
-
"env": {
|
|
155
|
-
"QA_USE_API_KEY": "your-desplega-ai-api-key"
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
```
|
|
101
|
+
| Command | Description |
|
|
102
|
+
|---------|-------------|
|
|
103
|
+
| `qa-use setup` | Interactive configuration (API key, base URL, etc.) |
|
|
104
|
+
| `qa-use info` | Show current configuration |
|
|
105
|
+
| `qa-use install-deps` | Install Playwright browsers |
|
|
161
106
|
|
|
162
|
-
|
|
107
|
+
## Test Definition Format
|
|
163
108
|
|
|
164
|
-
|
|
165
|
-
<summary>Gemini CLI</summary>
|
|
166
|
-
Install the QA-Use MCP server using the Gemini CLI.
|
|
109
|
+
Tests are YAML files with steps that describe user interactions:
|
|
167
110
|
|
|
168
|
-
|
|
111
|
+
```yaml
|
|
112
|
+
name: Checkout Flow
|
|
113
|
+
app_config: your-app-id
|
|
114
|
+
variables:
|
|
115
|
+
email: test@example.com
|
|
116
|
+
depends_on: login-test # Optional dependency
|
|
117
|
+
steps:
|
|
118
|
+
- action: goto
|
|
119
|
+
url: /cart
|
|
120
|
+
- action: click
|
|
121
|
+
target: checkout button
|
|
122
|
+
- action: fill
|
|
123
|
+
target: email input
|
|
124
|
+
value: $email
|
|
125
|
+
- action: to_be_visible
|
|
126
|
+
target: order confirmation
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Supported actions:**
|
|
130
|
+
|
|
131
|
+
| Category | Actions |
|
|
132
|
+
|----------|---------|
|
|
133
|
+
| Navigation | `goto`, `go_back`, `go_forward`, `reload` |
|
|
134
|
+
| Input | `fill`, `type`, `click`, `hover`, `press`, `check`, `uncheck`, `select_option` |
|
|
135
|
+
| Waiting | `wait_for_selector`, `wait_for_timeout`, `wait_for_load_state` |
|
|
136
|
+
| Assertions | `to_be_visible`, `to_have_text`, `to_have_url`, `to_contain_text`, `to_be_checked` |
|
|
137
|
+
| Advanced | `ai_action`, `ai_assertion`, `extract_structured_data` |
|
|
138
|
+
|
|
139
|
+
See [SETUP.md](./SETUP.md) for the complete test definition guide.
|
|
169
140
|
|
|
170
|
-
|
|
171
|
-
gemini mcp add desplega-qa npx @desplega.ai/qa-use@latest mcp
|
|
172
|
-
```
|
|
141
|
+
## Configuration
|
|
173
142
|
|
|
174
|
-
|
|
143
|
+
### Environment Variables
|
|
175
144
|
|
|
176
145
|
```bash
|
|
177
|
-
|
|
146
|
+
QA_USE_API_KEY=xxx # Required: Your desplega.ai API key
|
|
147
|
+
QA_USE_REGION=us # Optional: "us" or "auto" (default)
|
|
178
148
|
```
|
|
179
149
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
</details>
|
|
183
|
-
|
|
184
|
-
<details>
|
|
185
|
-
<summary>Gemini Code Assist</summary>
|
|
186
|
-
Follow the <a href="https://cloud.google.com/gemini/docs/codeassist/use-agentic-chat-pair-programmer#configure-mcp-servers">configure MCP guide</a>
|
|
187
|
-
using the standard config from above.
|
|
188
|
-
</details>
|
|
189
|
-
|
|
190
|
-
<details>
|
|
191
|
-
<summary>JetBrains AI Assistant & Junie</summary>
|
|
192
|
-
|
|
193
|
-
Go to `Settings | Tools | AI Assistant | Model Context Protocol (MCP)` -> `Add`. Use the config provided above.
|
|
194
|
-
The same way @desplega.ai/qa-use can be configured for JetBrains Junie in `Settings | Tools | Junie | MCP Settings` -> `Add`. Use the config provided above.
|
|
150
|
+
### Config File
|
|
195
151
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
<details>
|
|
199
|
-
<summary>Zed</summary>
|
|
200
|
-
Add to your Zed settings:
|
|
152
|
+
Alternatively, use `~/.qa-use.json`:
|
|
201
153
|
|
|
202
154
|
```json
|
|
203
155
|
{
|
|
204
|
-
"
|
|
205
|
-
"
|
|
206
|
-
|
|
207
|
-
"args": ["-y", "@desplega.ai/qa-use@latest", "mcp"],
|
|
208
|
-
"env": {
|
|
209
|
-
"QA_USE_API_KEY": "your-desplega-ai-api-key"
|
|
210
|
-
}
|
|
211
|
-
}
|
|
156
|
+
"env": {
|
|
157
|
+
"QA_USE_API_KEY": "your-api-key-here",
|
|
158
|
+
"QA_USE_REGION": "us"
|
|
212
159
|
}
|
|
213
160
|
}
|
|
214
161
|
```
|
|
215
162
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
### Your first prompt
|
|
219
|
-
|
|
220
|
-
Enter the following prompt in your MCP Client to check if everything is working:
|
|
221
|
-
|
|
222
|
-
```
|
|
223
|
-
Initialize QA server and test the login form at https://app.example.com
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
Your MCP client should initialize the server, set up browser automation, and start testing the specified form.
|
|
227
|
-
|
|
228
|
-
> [!NOTE]
|
|
229
|
-
> The MCP server will start browser and tunnel resources automatically when needed. First-time setup requires running `init_qa_server` with `interactive=true` or providing your desplega.ai API key.
|
|
230
|
-
|
|
231
|
-
## Features
|
|
232
|
-
|
|
233
|
-
- **Browser Management**: Launch and control Playwright browser instances with headless/headed modes
|
|
234
|
-
- **Tunneling**: Create public tunnels for browser WebSocket endpoints using localtunnel
|
|
235
|
-
- **API Integration**: Full integration with desplega.ai API for comprehensive QA testing workflows
|
|
236
|
-
- **Session Management**: Create, monitor, and control multiple QA testing sessions with real-time status
|
|
237
|
-
- Smart session lifecycle management with automatic cleanup
|
|
238
|
-
- Up to 10 concurrent browser sessions with clear error handling
|
|
239
|
-
- 30-minute default TTL with automatic deadline refresh on interaction
|
|
240
|
-
- Background cleanup task for expired sessions
|
|
241
|
-
- **Progress Monitoring**: Real-time progress notifications with MCP timeout protection (25s max per call)
|
|
242
|
-
- **Batch Test Execution**: Run multiple automated tests simultaneously with dependency management
|
|
243
|
-
- **Interactive Elicitation**: Intelligent prompts when remote sessions need user input to continue
|
|
244
|
-
- **Test Discovery**: Search and list automated tests with pagination and filtering
|
|
245
|
-
- **Test Run Analytics**: View test execution history with performance metrics and flakiness scores
|
|
246
|
-
- **AAA Framework Templates**: Pre-built prompts for login, forms, e-commerce, navigation, and comprehensive testing scenarios
|
|
247
|
-
- **User Registration**: Built-in user registration system for new desplega.ai accounts
|
|
248
|
-
- **Comprehensive Documentation**: Built-in MCP resources with guides, workflows, and best practices
|
|
249
|
-
|
|
250
|
-
## HTTP Transport Mode (SSE)
|
|
251
|
-
|
|
252
|
-
In addition to the standard MCP stdio transport, QA-Use can run with StreamableHTTP transport using Server-Sent Events (SSE). This mode implements the official [MCP Streamable HTTP specification](https://spec.modelcontextprotocol.io/specification/basic/transports/#http-with-sse) and is useful for web-based integrations, remote access, or when you need HTTP-based MCP connectivity.
|
|
253
|
-
|
|
254
|
-
### When to Use Each Mode
|
|
255
|
-
|
|
256
|
-
| Feature | stdio (default) | HTTP/SSE | Tunnel |
|
|
257
|
-
|---------|----------------|----------|---------|
|
|
258
|
-
| **Use Case** | Local MCP clients (Claude Desktop, Cline, etc.) | Web apps, remote access, API integrations | Backend-initiated tasks, CI/CD |
|
|
259
|
-
| **Setup** | Configured in MCP client settings | Start server, connect via HTTP | Single command, auto-registers |
|
|
260
|
-
| **Authentication** | Via environment variables | Bearer token on each request | Via environment variables |
|
|
261
|
-
| **Network** | Local process only | Can be exposed remotely | Tunneled to backend |
|
|
262
|
-
| **Protocol** | Native MCP stdio | MCP over HTTP with SSE | WebSocket via localtunnel |
|
|
263
|
-
| **Browser** | On-demand | On-demand | Persistent with heartbeat |
|
|
264
|
-
| **Best For** | Desktop IDE integrations | Microservices, web dashboards, custom clients | Backend-controlled testing, CI/CD pipelines |
|
|
265
|
-
|
|
266
|
-
### Starting the HTTP Server
|
|
267
|
-
|
|
268
|
-
Run the server with the `mcp --http` or `mcp --api` flags:
|
|
269
|
-
|
|
270
|
-
```bash
|
|
271
|
-
# Default port (3000)
|
|
272
|
-
npx @desplega.ai/qa-use mcp --http
|
|
273
|
-
|
|
274
|
-
# Custom port
|
|
275
|
-
npx @desplega.ai/qa-use mcp --http --port 8080
|
|
276
|
-
|
|
277
|
-
# Show help
|
|
278
|
-
npx @desplega.ai/qa-use mcp --help
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
### Authentication
|
|
282
|
-
|
|
283
|
-
All MCP endpoints (except `/health`) require authentication via Bearer token with a valid desplega.ai API key:
|
|
284
|
-
|
|
285
|
-
```bash
|
|
286
|
-
# Establish SSE connection
|
|
287
|
-
curl -N -H "Authorization: Bearer YOUR_API_KEY" \
|
|
288
|
-
http://localhost:3000/mcp
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
Get your API key by:
|
|
292
|
-
- Using the `register_user` tool
|
|
293
|
-
- Signing up at [desplega.ai](https://desplega.ai)
|
|
294
|
-
|
|
295
|
-
### MCP Endpoints
|
|
296
|
-
|
|
297
|
-
This server implements the [MCP Streamable HTTP transport specification](https://spec.modelcontextprotocol.io/specification/basic/transports/#http-with-sse):
|
|
298
|
-
|
|
299
|
-
#### Health Check
|
|
300
|
-
```bash
|
|
301
|
-
GET /health
|
|
302
|
-
# No authentication required
|
|
303
|
-
# Returns server status and version
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
#### MCP Protocol Endpoint
|
|
307
|
-
```bash
|
|
308
|
-
# Establish SSE connection for receiving messages
|
|
309
|
-
GET /mcp
|
|
310
|
-
Headers: Authorization: Bearer YOUR_API_KEY
|
|
311
|
-
|
|
312
|
-
# Send JSON-RPC messages to the server
|
|
313
|
-
POST /mcp
|
|
314
|
-
Headers:
|
|
315
|
-
Authorization: Bearer YOUR_API_KEY
|
|
316
|
-
Content-Type: application/json
|
|
317
|
-
Body: JSON-RPC 2.0 message
|
|
318
|
-
|
|
319
|
-
# Close session
|
|
320
|
-
DELETE /mcp
|
|
321
|
-
Headers:
|
|
322
|
-
Authorization: Bearer YOUR_API_KEY
|
|
323
|
-
MCP-Session-ID: <session-id>
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
### Example Usage
|
|
327
|
-
|
|
328
|
-
#### Initialize MCP Connection
|
|
329
|
-
```bash
|
|
330
|
-
# Start SSE stream in one terminal
|
|
331
|
-
curl -N -H "Authorization: Bearer YOUR_API_KEY" \
|
|
332
|
-
http://localhost:3000/mcp
|
|
333
|
-
|
|
334
|
-
# In another terminal, send initialize message
|
|
335
|
-
curl -X POST http://localhost:3000/mcp \
|
|
336
|
-
-H "Authorization: Bearer YOUR_API_KEY" \
|
|
337
|
-
-H "Content-Type: application/json" \
|
|
338
|
-
-d '{
|
|
339
|
-
"jsonrpc": "2.0",
|
|
340
|
-
"id": 1,
|
|
341
|
-
"method": "initialize",
|
|
342
|
-
"params": {
|
|
343
|
-
"protocolVersion": "2024-11-05",
|
|
344
|
-
"capabilities": {},
|
|
345
|
-
"clientInfo": {
|
|
346
|
-
"name": "test-client",
|
|
347
|
-
"version": "1.0.0"
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}'
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
#### Call MCP Tools
|
|
354
|
-
```bash
|
|
355
|
-
# List available tools
|
|
356
|
-
curl -X POST http://localhost:3000/mcp \
|
|
357
|
-
-H "Authorization: Bearer YOUR_API_KEY" \
|
|
358
|
-
-H "Content-Type: application/json" \
|
|
359
|
-
-d '{
|
|
360
|
-
"jsonrpc": "2.0",
|
|
361
|
-
"id": 2,
|
|
362
|
-
"method": "tools/list",
|
|
363
|
-
"params": {}
|
|
364
|
-
}'
|
|
365
|
-
|
|
366
|
-
# Start automated test session
|
|
367
|
-
curl -X POST http://localhost:3000/mcp \
|
|
368
|
-
-H "Authorization: Bearer YOUR_API_KEY" \
|
|
369
|
-
-H "Content-Type: application/json" \
|
|
370
|
-
-d '{
|
|
371
|
-
"jsonrpc": "2.0",
|
|
372
|
-
"id": 3,
|
|
373
|
-
"method": "tools/call",
|
|
374
|
-
"params": {
|
|
375
|
-
"name": "start_automated_session",
|
|
376
|
-
"arguments": {
|
|
377
|
-
"task": "Test login functionality"
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
}'
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
### MCP Client Support
|
|
384
|
-
|
|
385
|
-
Any MCP client that supports the StreamableHTTP transport can connect to this server. You'll need to:
|
|
386
|
-
|
|
387
|
-
1. Configure the client with the HTTP endpoint: `http://localhost:3000/mcp`
|
|
388
|
-
2. Add authentication header: `Authorization: Bearer YOUR_API_KEY`
|
|
389
|
-
3. The client will automatically handle SSE streams and JSON-RPC messaging
|
|
390
|
-
|
|
391
|
-
> **Note:** Most current MCP clients (Claude Desktop, Cline, etc.) use stdio transport by default. The HTTP mode is primarily for:
|
|
392
|
-
> - Custom integrations and web applications
|
|
393
|
-
> - Remote server deployments
|
|
394
|
-
> - Microservices architectures
|
|
395
|
-
> - API gateways and proxies
|
|
396
|
-
|
|
397
|
-
### Security Considerations
|
|
398
|
-
|
|
399
|
-
When running in HTTP mode:
|
|
400
|
-
|
|
401
|
-
- ✅ **Always use HTTPS** in production (consider using a reverse proxy like nginx)
|
|
402
|
-
- ✅ **Protect your API key** - it provides full access to your desplega.ai account
|
|
403
|
-
- ✅ **Use firewall rules** to restrict access to trusted IP addresses
|
|
404
|
-
- ✅ **Consider rate limiting** for public-facing deployments
|
|
405
|
-
- ✅ **Monitor access logs** for suspicious activity
|
|
406
|
-
|
|
407
|
-
Example nginx configuration for HTTPS:
|
|
408
|
-
|
|
409
|
-
```nginx
|
|
410
|
-
server {
|
|
411
|
-
listen 443 ssl;
|
|
412
|
-
server_name qa-mcp.example.com;
|
|
413
|
-
|
|
414
|
-
ssl_certificate /path/to/cert.pem;
|
|
415
|
-
ssl_certificate_key /path/to/key.pem;
|
|
416
|
-
|
|
417
|
-
location / {
|
|
418
|
-
proxy_pass http://localhost:3000;
|
|
419
|
-
proxy_http_version 1.1;
|
|
420
|
-
proxy_set_header Upgrade $http_upgrade;
|
|
421
|
-
proxy_set_header Connection 'upgrade';
|
|
422
|
-
proxy_set_header Host $host;
|
|
423
|
-
proxy_cache_bypass $http_upgrade;
|
|
424
|
-
|
|
425
|
-
# Required for SSE
|
|
426
|
-
proxy_buffering off;
|
|
427
|
-
proxy_read_timeout 24h;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
### Docker Deployment
|
|
433
|
-
|
|
434
|
-
The HTTP mode is perfect for containerized deployments. Example Dockerfile:
|
|
435
|
-
|
|
436
|
-
```dockerfile
|
|
437
|
-
FROM node:18-slim
|
|
438
|
-
|
|
439
|
-
# Install dependencies for Playwright
|
|
440
|
-
RUN apt-get update && apt-get install -y \
|
|
441
|
-
libnss3 libatk-bridge2.0-0 libdrm2 libxkbcommon0 \
|
|
442
|
-
libgbm1 libasound2 libxshmfence1 \
|
|
443
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
444
|
-
|
|
445
|
-
# Install qa-use
|
|
446
|
-
RUN npm install -g @desplega.ai/qa-use
|
|
447
|
-
|
|
448
|
-
# Expose port
|
|
449
|
-
EXPOSE 3000
|
|
450
|
-
|
|
451
|
-
# Set API key via environment variable
|
|
452
|
-
ENV QA_USE_API_KEY=your-api-key-here
|
|
453
|
-
|
|
454
|
-
# Start in HTTP mode
|
|
455
|
-
CMD ["qa-use", "mcp", "--http", "--port", "3000"]
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
Run the container:
|
|
459
|
-
|
|
460
|
-
```bash
|
|
461
|
-
docker build -t qa-use .
|
|
462
|
-
docker run -d -p 3000:3000 \
|
|
463
|
-
-e QA_USE_API_KEY=your-api-key \
|
|
464
|
-
qa-use
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
### Vercel Deployment
|
|
468
|
-
|
|
469
|
-
Deploy to Vercel for serverless hosting:
|
|
470
|
-
|
|
471
|
-
[](https://vercel.com/new/clone?repository-url=https://github.com/desplega-ai/qa-use)
|
|
472
|
-
|
|
473
|
-
**Quick setup:**
|
|
474
|
-
|
|
475
|
-
```bash
|
|
476
|
-
# Install Vercel CLI
|
|
477
|
-
npm i -g vercel
|
|
478
|
-
|
|
479
|
-
# Deploy
|
|
480
|
-
vercel --prod
|
|
481
|
-
```
|
|
482
|
-
|
|
483
|
-
**Vercel Build Settings:**
|
|
484
|
-
- **Build Command**: `bun build`
|
|
485
|
-
- **Output Directory**: `dist`
|
|
486
|
-
- **Install Command**: `bun install`
|
|
487
|
-
|
|
488
|
-
**Environment Variables** (set in Vercel dashboard):
|
|
489
|
-
- `QA_USE_API_KEY` - Your desplega.ai API key
|
|
490
|
-
|
|
491
|
-
⚠️ **Important**: Vercel has execution time limits (60s max on Pro plan) which may affect long-running SSE connections. For production use with long-running sessions, consider:
|
|
492
|
-
- **Railway** - Better for persistent connections
|
|
493
|
-
- **Render** - Supports long-running services
|
|
494
|
-
- **Fly.io** - Full control over processes
|
|
495
|
-
- **Self-hosted VPS** - No limits
|
|
496
|
-
|
|
497
|
-
See [VERCEL_DEPLOYMENT.md](./VERCEL_DEPLOYMENT.md) for detailed deployment guide and limitations.
|
|
498
|
-
|
|
499
|
-
### Unified CLI
|
|
500
|
-
|
|
501
|
-
All MCP modes are accessed via the `mcp` subcommand:
|
|
502
|
-
|
|
503
|
-
```bash
|
|
504
|
-
# Standard MCP mode (stdio) - default
|
|
505
|
-
npx @desplega.ai/qa-use mcp
|
|
506
|
-
|
|
507
|
-
# HTTP transport mode (SSE)
|
|
508
|
-
npx @desplega.ai/qa-use mcp --http
|
|
509
|
-
|
|
510
|
-
# Tunnel mode (persistent WebSocket)
|
|
511
|
-
npx @desplega.ai/qa-use mcp tunnel
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
All modes support the complete MCP tools and functionality. The HTTP mode follows the official MCP Streamable HTTP specification.
|
|
515
|
-
|
|
516
|
-
## Tunnel Mode
|
|
517
|
-
|
|
518
|
-
The tunnel mode creates a persistent WebSocket tunnel that allows the desplega.ai backend to initiate browser automation tasks using your local browser. This is perfect for scenarios where you want the backend to control test execution while using your local environment's browser.
|
|
519
|
-
|
|
520
|
-
### When to Use Tunnel Mode
|
|
163
|
+
Environment variables take precedence over the config file.
|
|
521
164
|
|
|
522
|
-
|
|
523
|
-
|----------|-----------|
|
|
524
|
-
| Backend-initiated tests | **Tunnel** ✅ |
|
|
525
|
-
| CI/CD pipelines with local browsers | **Tunnel** ✅ |
|
|
526
|
-
| Remote test execution on local environment | **Tunnel** ✅ |
|
|
527
|
-
| Interactive MCP client testing | **stdio** |
|
|
528
|
-
| Web dashboard integrations | **HTTP/SSE** |
|
|
165
|
+
## CI/CD Integration
|
|
529
166
|
|
|
530
|
-
###
|
|
167
|
+
### Basic GitHub Actions
|
|
531
168
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
4. **Backend Control**: Backend can now initiate test sessions using your local browser
|
|
536
|
-
|
|
537
|
-
### Starting Tunnel Mode
|
|
538
|
-
|
|
539
|
-
```bash
|
|
540
|
-
# Start tunnel with headless browser (default)
|
|
541
|
-
npx @desplega.ai/qa-use mcp tunnel
|
|
542
|
-
|
|
543
|
-
# Start tunnel with visible browser
|
|
544
|
-
npx @desplega.ai/qa-use mcp tunnel --visible
|
|
545
|
-
```
|
|
546
|
-
|
|
547
|
-
### Example Output
|
|
548
|
-
|
|
549
|
-
```
|
|
550
|
-
🔧 QA-Use Tunnel Mode
|
|
551
|
-
====================
|
|
552
|
-
Mode: Headless
|
|
553
|
-
|
|
554
|
-
🔑 Validating API key...
|
|
555
|
-
✅ API key valid
|
|
169
|
+
```yaml
|
|
170
|
+
# .github/workflows/e2e.yml
|
|
171
|
+
name: E2E Tests
|
|
556
172
|
|
|
557
|
-
|
|
558
|
-
✅ Browser started
|
|
559
|
-
✅ Tunnel created
|
|
173
|
+
on: [push, pull_request]
|
|
560
174
|
|
|
561
|
-
|
|
562
|
-
|
|
175
|
+
jobs:
|
|
176
|
+
e2e:
|
|
177
|
+
runs-on: ubuntu-latest
|
|
178
|
+
steps:
|
|
179
|
+
- uses: actions/checkout@v4
|
|
180
|
+
- uses: actions/setup-node@v4
|
|
181
|
+
with:
|
|
182
|
+
node-version: '20'
|
|
563
183
|
|
|
564
|
-
|
|
565
|
-
|
|
184
|
+
- name: Run E2E Tests
|
|
185
|
+
env:
|
|
186
|
+
QA_USE_API_KEY: ${{ secrets.QA_USE_API_KEY }}
|
|
187
|
+
run: |
|
|
188
|
+
npm install -g @desplega.ai/qa-use
|
|
189
|
+
qa-use test run --all --download
|
|
566
190
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
191
|
+
- name: Upload Results
|
|
192
|
+
if: always()
|
|
193
|
+
uses: actions/upload-artifact@v4
|
|
194
|
+
with:
|
|
195
|
+
name: e2e-results
|
|
196
|
+
path: /tmp/qa-use/downloads/
|
|
570
197
|
```
|
|
571
198
|
|
|
572
|
-
###
|
|
199
|
+
### PR Verification with Claude Code
|
|
573
200
|
|
|
574
|
-
|
|
201
|
+
Use the qa-use plugin with Claude Code to automatically verify PRs:
|
|
575
202
|
|
|
576
203
|
```bash
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
```
|
|
204
|
+
# Install the qa-use plugin
|
|
205
|
+
claude plugin install @desplega.ai/qa-use
|
|
580
206
|
|
|
581
|
-
|
|
207
|
+
# Verify a feature works
|
|
208
|
+
/qa-use:verify "the login form accepts valid credentials"
|
|
582
209
|
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
export QA_USE_REGION=us
|
|
586
|
-
npx @desplega.ai/qa-use mcp tunnel
|
|
210
|
+
# Verify PR changes
|
|
211
|
+
/qa-use:verify-pr
|
|
587
212
|
```
|
|
588
213
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
### Options
|
|
214
|
+
See [SETUP.md](./SETUP.md) for advanced CI workflows including AI-assisted test generation.
|
|
592
215
|
|
|
593
|
-
|
|
216
|
+
## Claude Code Plugin
|
|
594
217
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
#### 1. CI/CD Integration
|
|
598
|
-
Run tunnel mode in your CI/CD pipeline to allow backend-initiated tests:
|
|
599
|
-
|
|
600
|
-
```yaml
|
|
601
|
-
# .github/workflows/qa.yml
|
|
602
|
-
- name: Start QA Tunnel
|
|
603
|
-
run: |
|
|
604
|
-
export QA_USE_API_KEY=${{ secrets.QA_USE_API_KEY }}
|
|
605
|
-
npx @desplega.ai/qa-use mcp tunnel &
|
|
606
|
-
sleep 10 # Wait for tunnel to establish
|
|
607
|
-
```
|
|
608
|
-
|
|
609
|
-
#### 2. Development Testing
|
|
610
|
-
Keep a tunnel running while developing to allow ad-hoc tests from the backend:
|
|
218
|
+
qa-use includes a Claude Code plugin for AI-assisted testing workflows:
|
|
611
219
|
|
|
612
220
|
```bash
|
|
613
|
-
#
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
# Terminal 2: Trigger tests from backend via API/dashboard
|
|
617
|
-
# The backend will use your local browser through the tunnel
|
|
221
|
+
# Install the plugin
|
|
222
|
+
claude plugin install @desplega.ai/qa-use
|
|
618
223
|
```
|
|
619
224
|
|
|
620
|
-
|
|
621
|
-
When you need to see what's happening:
|
|
622
|
-
|
|
623
|
-
```bash
|
|
624
|
-
npx @desplega.ai/qa-use mcp tunnel --visible
|
|
625
|
-
```
|
|
626
|
-
|
|
627
|
-
### Graceful Shutdown
|
|
628
|
-
|
|
629
|
-
Press `Ctrl+C` to stop the tunnel. The server will:
|
|
630
|
-
1. Stop sending heartbeats
|
|
631
|
-
2. Close the tunnel
|
|
632
|
-
3. Shutdown the browser
|
|
633
|
-
4. Clean up resources
|
|
634
|
-
|
|
635
|
-
### Differences from Other Modes
|
|
636
|
-
|
|
637
|
-
| Feature | stdio | HTTP/SSE | **Tunnel** |
|
|
638
|
-
|---------|-------|----------|------------|
|
|
639
|
-
| **Control** | Local MCP client | HTTP requests | Backend-initiated |
|
|
640
|
-
| **Browser** | On-demand | On-demand | **Persistent** |
|
|
641
|
-
| **Heartbeat** | N/A | N/A | **Every 5s** |
|
|
642
|
-
| **Use Case** | Desktop IDEs | Web apps | **Backend tasks** |
|
|
643
|
-
| **Visibility** | Configurable | Configurable | **Headless default** |
|
|
225
|
+
**Available skills:**
|
|
644
226
|
|
|
227
|
+
| Skill | Description |
|
|
228
|
+
|-------|-------------|
|
|
229
|
+
| `/qa-use:verify <description>` | Verify a feature works through browser automation |
|
|
230
|
+
| `/qa-use:verify-pr` | Verify PR changes with automated browser testing |
|
|
231
|
+
| `/qa-use:explore` | Explore a web page interactively |
|
|
232
|
+
| `/qa-use:record` | Record browser actions into a test definition |
|
|
233
|
+
| `/qa-use:test-run` | Run E2E tests |
|
|
234
|
+
| `/qa-use:test-validate` | Validate test syntax |
|
|
645
235
|
|
|
646
|
-
##
|
|
236
|
+
## MCP Server
|
|
647
237
|
|
|
648
|
-
|
|
238
|
+
For AI assistant integration (Claude Desktop, VS Code Copilot, Cursor, etc.), qa-use includes an MCP server with full browser automation capabilities.
|
|
649
239
|
|
|
650
240
|
```bash
|
|
651
|
-
#
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
# Run automated tests
|
|
655
|
-
npx @desplega.ai/qa-use test run
|
|
241
|
+
qa-use mcp # Start stdio server (default)
|
|
242
|
+
qa-use mcp --http # Start HTTP/SSE server
|
|
243
|
+
qa-use mcp tunnel # Start persistent tunnel mode
|
|
656
244
|
```
|
|
657
245
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
qa-use test run # Run automated tests
|
|
664
|
-
qa-use --help # Show all commands
|
|
665
|
-
```
|
|
246
|
+
See [MCP.md](./MCP.md) for complete MCP server documentation including:
|
|
247
|
+
- Client configurations for all major AI assistants
|
|
248
|
+
- HTTP transport mode for web integrations
|
|
249
|
+
- Tunnel mode for backend-initiated testing
|
|
250
|
+
- Full MCP tools reference
|
|
666
251
|
|
|
667
252
|
## Development
|
|
668
253
|
|
|
669
|
-
Clone the repository and install dependencies:
|
|
670
|
-
|
|
671
254
|
```bash
|
|
672
|
-
git clone
|
|
255
|
+
git clone https://github.com/desplega-ai/qa-use.git
|
|
673
256
|
cd qa-use
|
|
674
257
|
bun install
|
|
258
|
+
bun run build
|
|
259
|
+
bun run dev
|
|
675
260
|
```
|
|
676
261
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
```bash
|
|
680
|
-
bun build
|
|
681
|
-
```
|
|
682
|
-
|
|
683
|
-
Start the development server:
|
|
684
|
-
|
|
685
|
-
```bash
|
|
686
|
-
bun dev
|
|
687
|
-
```
|
|
688
|
-
|
|
689
|
-
<!-- AUTO-GENERATED-TOOLS-START -->
|
|
690
|
-
## MCP Tools
|
|
691
|
-
|
|
692
|
-
The server exposes the following MCP tools for browser automation and QA testing:
|
|
693
|
-
|
|
694
|
-
### Setup & Configuration
|
|
695
|
-
|
|
696
|
-
#### `ensure_installed`
|
|
697
|
-
Ensure API key is set, validate authentication, and install Playwright browsers.
|
|
698
|
-
|
|
699
|
-
**Parameters:**
|
|
700
|
-
- `apiKey` (string, optional): API key for desplega.ai (optional if QA_USE_API_KEY env var is set)
|
|
701
|
-
|
|
702
|
-
#### `register_user`
|
|
703
|
-
Register a new user account with desplega.ai and receive an API key.
|
|
704
|
-
|
|
705
|
-
**Parameters:**
|
|
706
|
-
- `email` (string, required): Email address for registration
|
|
707
|
-
|
|
708
|
-
#### `update_configuration`
|
|
709
|
-
Update application configuration settings including base URL, login credentials, and viewport type.
|
|
710
|
-
|
|
711
|
-
**Parameters:**
|
|
712
|
-
- `base_url` (string, optional): Base URL for the application being tested
|
|
713
|
-
- `login_url` (string, optional): Login page URL for the application
|
|
714
|
-
- `login_username` (string, optional): Default username for login testing
|
|
715
|
-
- `login_password` (string, optional): Default password for login testing
|
|
716
|
-
- `vp_type` (string, optional): Viewport configuration type: big_desktop, desktop, mobile, or tablet (default: desktop)
|
|
717
|
-
|
|
718
|
-
#### `get_configuration`
|
|
719
|
-
Get the current application configuration details including base URL, login settings, and viewport.
|
|
720
|
-
|
|
721
|
-
**Parameters:** None
|
|
722
|
-
|
|
723
|
-
### Session Management
|
|
724
|
-
|
|
725
|
-
#### `search_sessions`
|
|
726
|
-
Search and list all sessions (automated tests and development sessions) with pagination and filtering.
|
|
727
|
-
|
|
728
|
-
**Parameters:**
|
|
729
|
-
- `limit` (number, optional): Maximum number of sessions to return (default: 10, min: 1)
|
|
730
|
-
- `offset` (number, optional): Number of sessions to skip (default: 0, min: 0)
|
|
731
|
-
- `query` (string, optional): Search query to filter sessions by task, URL, or status
|
|
732
|
-
|
|
733
|
-
#### `start_automated_session`
|
|
734
|
-
Start an automated E2E test session for QA flows and automated testing. Returns sessionId for monitoring.
|
|
735
|
-
|
|
736
|
-
**Parameters:**
|
|
737
|
-
- `task` (string, required): The testing task or scenario to execute
|
|
738
|
-
- `url` (string, optional): Optional URL to test (overrides app config base_url if provided)
|
|
739
|
-
- `dependencyId` (string, optional): Optional test ID that this session depends on (must be a self test ID created by your app configuration)
|
|
740
|
-
- `headless` (boolean, optional): Run browser in headless mode (default: false for better visibility)
|
|
741
|
-
|
|
742
|
-
#### `start_dev_session`
|
|
743
|
-
Start an interactive development session for debugging and exploration. Session will not auto-pilot and allows manual browser interaction.
|
|
744
|
-
|
|
745
|
-
**Parameters:**
|
|
746
|
-
- `task` (string, required): Description of what you want to explore or debug. Can be a placeholder like "Waiting for user input"
|
|
747
|
-
- `url` (string, optional): Optional URL to start from (overrides app config base_url if provided)
|
|
748
|
-
- `headless` (boolean, optional): Run browser in headless mode (default: false for development visibility)
|
|
749
|
-
|
|
750
|
-
#### `monitor_session`
|
|
751
|
-
Monitor a session status. Keep calling until status is "closed". Will alert if session needs user input, is idle, or pending.
|
|
752
|
-
|
|
753
|
-
**Parameters:**
|
|
754
|
-
- `sessionId` (string, required): The session ID to monitor
|
|
755
|
-
- `wait` (boolean, optional): Wait for session to reach any non-running state with MCP timeout protection (max 25s per call)
|
|
756
|
-
- `timeout` (number, optional): User timeout in seconds for wait mode (default: 60)
|
|
757
|
-
|
|
758
|
-
#### `interact_with_session`
|
|
759
|
-
Interact with a session - respond to questions, pause, or close the session.
|
|
760
|
-
|
|
761
|
-
**Parameters:**
|
|
762
|
-
- `sessionId` (string, required): The session ID to interact with
|
|
763
|
-
- `action` (string, required): Action to perform: respond (answer question), pause (stop session), or close (end session)
|
|
764
|
-
- `message` (string, optional): Your response message (required for "respond" action, optional for others)
|
|
765
|
-
|
|
766
|
-
### Test Management
|
|
767
|
-
|
|
768
|
-
#### `search_automated_tests`
|
|
769
|
-
Search for automated tests by ID or query. If testId provided, returns detailed info for that test. Otherwise searches with optional query/pagination.
|
|
770
|
-
|
|
771
|
-
**Parameters:**
|
|
772
|
-
- `testId` (string, optional): Specific test ID to retrieve detailed information for (if provided, other params ignored)
|
|
773
|
-
- `query` (string, optional): Search query to filter tests by name, description, URL, or task (ignored if testId provided)
|
|
774
|
-
- `limit` (number, optional): Maximum number of tests to return (default: 10, min: 1) (ignored if testId provided)
|
|
775
|
-
- `offset` (number, optional): Number of tests to skip (default: 0, min: 0) (ignored if testId provided)
|
|
776
|
-
- `self_only` (boolean, optional): Filter tests by app configuration. When true, only returns tests created by your application configuration. Default: false to allow running tests from other configs locally.
|
|
777
|
-
|
|
778
|
-
#### `run_automated_tests`
|
|
779
|
-
Execute multiple automated tests simultaneously.
|
|
780
|
-
|
|
781
|
-
**Parameters:**
|
|
782
|
-
- `test_ids` (array, required): Array of test IDs to execute
|
|
783
|
-
- `app_config_id` (string, optional): Optional app config ID to run tests against (uses API key default config if not provided)
|
|
784
|
-
- `ws_url` (string, optional): Optional WebSocket URL override (uses global tunnel URL by default)
|
|
785
|
-
|
|
786
|
-
#### `search_automated_test_runs`
|
|
787
|
-
Search automated test runs with optional filtering by test ID or run ID.
|
|
788
|
-
|
|
789
|
-
**Parameters:**
|
|
790
|
-
- `test_id` (string, optional): Filter test runs by specific test ID
|
|
791
|
-
- `run_id` (string, optional): Filter test runs by specific run ID
|
|
792
|
-
- `limit` (number, optional): Maximum number of test runs to return (default: 10, min: 1)
|
|
793
|
-
- `offset` (number, optional): Number of tests to skip (default: 0, min: 0)
|
|
794
|
-
|
|
795
|
-
<!-- AUTO-GENERATED-TOOLS-END -->
|
|
262
|
+
> **Note:** This project uses **bun** as the package manager.
|
|
796
263
|
|
|
797
|
-
|
|
264
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for development guidelines.
|
|
798
265
|
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
#### MCP Resources
|
|
802
|
-
- **Getting Started Guide**: Complete setup and usage instructions
|
|
803
|
-
- **Testing Workflows**: Common patterns for interactive, batch, and development testing
|
|
804
|
-
- **Tool Reference**: Detailed documentation for all available MCP tools
|
|
805
|
-
|
|
806
|
-
#### MCP Prompts
|
|
807
|
-
- **`aaa_test`**: Generate structured test scenarios using the Arrange-Act-Assert (AAA) framework with customizable parameters
|
|
808
|
-
|
|
809
|
-
## Configuration
|
|
810
|
-
|
|
811
|
-
### Environment Variables
|
|
812
|
-
|
|
813
|
-
Create a `.env` file in your project root or set the following environment variables:
|
|
814
|
-
|
|
815
|
-
```bash
|
|
816
|
-
# Required: Your desplega.ai API key
|
|
817
|
-
QA_USE_API_KEY=your-desplega-ai-api-key
|
|
818
|
-
|
|
819
|
-
# Optional: Region selection for tunnel and API routing
|
|
820
|
-
# Values: "us" | "auto"
|
|
821
|
-
# Default: "auto" (if not set)
|
|
822
|
-
# - "us": Uses lt.us.desplega.ai for localtunnel and routes to US region
|
|
823
|
-
# - "auto": Uses default lt.desplega.ai and automatic region routing
|
|
824
|
-
QA_USE_REGION=us
|
|
825
|
-
|
|
826
|
-
# Optional: Custom API endpoint (default: https://api.desplega.ai)
|
|
827
|
-
QA_USE_API_URL=https://api.desplega.ai
|
|
828
|
-
|
|
829
|
-
# Optional: Custom app URL (default: https://app.desplega.ai)
|
|
830
|
-
QA_USE_APP_URL=https://app.desplega.ai
|
|
831
|
-
|
|
832
|
-
# Optional: Custom tunnel host (overrides QA_USE_REGION setting)
|
|
833
|
-
TUNNEL_HOST=https://lt.desplega.ai
|
|
834
|
-
```
|
|
835
|
-
|
|
836
|
-
#### Regional Configuration
|
|
837
|
-
|
|
838
|
-
The `QA_USE_REGION` variable allows you to route your tunnel and API requests to specific regions:
|
|
839
|
-
|
|
840
|
-
- **Not set** (default): Uses automatic region selection (`lt.desplega.ai`)
|
|
841
|
-
- **`QA_USE_REGION=us`**: Uses US-based tunnel host (`lt.us.desplega.ai`) and routes sessions to the US region. Recommended for users primarily testing from North America.
|
|
842
|
-
- **`QA_USE_REGION=auto`**: Explicitly sets automatic region selection (same as not setting it)
|
|
843
|
-
|
|
844
|
-
Example configuration for US region:
|
|
845
|
-
```bash
|
|
846
|
-
export QA_USE_API_KEY=your-api-key
|
|
847
|
-
export QA_USE_REGION=us
|
|
848
|
-
npx @desplega.ai/qa-use mcp
|
|
849
|
-
```
|
|
850
|
-
|
|
851
|
-
> **Note:** If `QA_USE_REGION` is not set, the system automatically defaults to `"auto"` behavior.
|
|
852
|
-
|
|
853
|
-
### Configuration File
|
|
854
|
-
|
|
855
|
-
As an alternative to environment variables, you can store your configuration in `~/.qa-use.json`:
|
|
856
|
-
|
|
857
|
-
```json
|
|
858
|
-
{
|
|
859
|
-
"env": {
|
|
860
|
-
"QA_USE_API_KEY": "your-api-key-here",
|
|
861
|
-
"QA_USE_API_URL": "https://api.desplega.ai",
|
|
862
|
-
"QA_USE_APP_URL": "https://app.desplega.ai",
|
|
863
|
-
"QA_USE_REGION": "us"
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
```
|
|
867
|
-
|
|
868
|
-
**Priority order:**
|
|
869
|
-
1. Environment variables (highest priority)
|
|
870
|
-
2. Config file (`~/.qa-use.json`)
|
|
871
|
-
3. Default values
|
|
872
|
-
|
|
873
|
-
This is useful when you don't want to set environment variables or when using MCP clients that don't support environment configuration.
|
|
874
|
-
|
|
875
|
-
An example config file is available at [`.qa-use.example.json`](.qa-use.example.json) in this repository.
|
|
876
|
-
|
|
877
|
-
## Usage Examples
|
|
878
|
-
|
|
879
|
-
### Interactive Testing Workflow
|
|
880
|
-
```bash
|
|
881
|
-
# 1. Initialize server and install browsers
|
|
882
|
-
ensure_installed
|
|
883
|
-
|
|
884
|
-
# 2. Configure app settings (one-time setup)
|
|
885
|
-
update_configuration with base_url="https://app.example.com" and login_url="https://app.example.com/login" and login_username="testuser@example.com"
|
|
886
|
-
|
|
887
|
-
# 3. Start an automated test session
|
|
888
|
-
start_automated_session with task="Test user registration flow"
|
|
889
|
-
|
|
890
|
-
# 4. Monitor session progress
|
|
891
|
-
monitor_session with sessionId="session-123" and wait=true and timeout=300
|
|
892
|
-
|
|
893
|
-
# 5. Interact with session if needed (respond, pause, or close)
|
|
894
|
-
interact_with_session with sessionId="session-123" and action="respond" and message="john.doe@example.com"
|
|
895
|
-
```
|
|
896
|
-
|
|
897
|
-
### Development & Debugging Workflow
|
|
898
|
-
```bash
|
|
899
|
-
# 1. Start an interactive dev session (no auto-pilot)
|
|
900
|
-
start_dev_session with task="Exploring the checkout flow" and url="https://app.example.com/cart"
|
|
901
|
-
|
|
902
|
-
# 2. Monitor and interact as needed
|
|
903
|
-
monitor_session with sessionId="dev-session-456"
|
|
904
|
-
|
|
905
|
-
# 3. Close when done
|
|
906
|
-
interact_with_session with sessionId="dev-session-456" and action="close"
|
|
907
|
-
```
|
|
908
|
-
|
|
909
|
-
### Batch Testing Workflow
|
|
910
|
-
```bash
|
|
911
|
-
# 1. Find available tests
|
|
912
|
-
search_automated_tests with query="login" and limit=10
|
|
913
|
-
|
|
914
|
-
# 2. Run multiple tests simultaneously
|
|
915
|
-
run_automated_tests with test_ids=["login-test-1", "signup-test-2", "checkout-test-3"]
|
|
916
|
-
|
|
917
|
-
# 3. Monitor progress
|
|
918
|
-
search_sessions with limit=20
|
|
919
|
-
|
|
920
|
-
# 4. Check test run history
|
|
921
|
-
search_automated_test_runs with limit=50
|
|
922
|
-
```
|
|
923
|
-
|
|
924
|
-
### Using AAA Framework Template
|
|
925
|
-
```bash
|
|
926
|
-
# Generate a structured test using AAA framework
|
|
927
|
-
Use prompt: aaa_test with test_type="login" and url="https://app.example.com/login" and feature="user authentication"
|
|
928
|
-
```
|
|
929
|
-
|
|
930
|
-
### Resource Management
|
|
931
|
-
```bash
|
|
932
|
-
# When you hit the 10 session limit or need to free up resources
|
|
933
|
-
reset_browser_sessions
|
|
934
|
-
|
|
935
|
-
# This will clean up all active browsers and tunnels
|
|
936
|
-
# Useful when sessions aren't closing properly or you need to restart fresh
|
|
937
|
-
```
|
|
938
|
-
|
|
939
|
-
## Testing
|
|
940
|
-
|
|
941
|
-
Use the provided test scripts to test MCP server functionality:
|
|
942
|
-
|
|
943
|
-
```bash
|
|
944
|
-
# Test server initialization (uses env var if available)
|
|
945
|
-
./scripts/test-init.sh
|
|
946
|
-
|
|
947
|
-
# Test listing sessions
|
|
948
|
-
./scripts/test-list-sessions.sh
|
|
949
|
-
|
|
950
|
-
# Test starting a session
|
|
951
|
-
./scripts/test-start-session.sh
|
|
952
|
-
|
|
953
|
-
# Test with real API key from environment
|
|
954
|
-
node scripts/mcp-test.js
|
|
955
|
-
```
|
|
266
|
+
## Documentation
|
|
956
267
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
- **`src/`**: Main MCP server implementation with comprehensive tool handlers
|
|
962
|
-
- MCP protocol implementation with tools, resources, and prompts
|
|
963
|
-
- Session management and monitoring with timeout protection
|
|
964
|
-
- BrowserSession management with automatic lifecycle tracking
|
|
965
|
-
- Each session wraps browser + tunnel with TTL and deadline tracking
|
|
966
|
-
- Session types: 'dev', 'automated', and 'test_run'
|
|
967
|
-
- Automatic cleanup on expiration or completion
|
|
968
|
-
- Real-time progress notifications using MCP logging specification
|
|
969
|
-
- AAA framework prompt templates for structured testing
|
|
970
|
-
- **`lib/browser/`**: Browser management functionality using Playwright
|
|
971
|
-
- Headless and headed browser support
|
|
972
|
-
- WebSocket endpoint management for remote control
|
|
973
|
-
- **`lib/tunnel/`**: Tunneling and port forwarding using localtunnel
|
|
974
|
-
- Public tunnel creation for browser WebSocket access
|
|
975
|
-
- Automatic WebSocket URL conversion for remote testing
|
|
976
|
-
- **`lib/api/`**: Complete API client for desplega.ai integration
|
|
977
|
-
- Session lifecycle management (create, monitor, respond)
|
|
978
|
-
- Test discovery and execution
|
|
979
|
-
- Test run analytics and history
|
|
980
|
-
- User registration and authentication
|
|
981
|
-
- Batch test execution with dependency handling
|
|
982
|
-
|
|
983
|
-
### Key Features Implementation
|
|
984
|
-
|
|
985
|
-
#### MCP Timeout Protection
|
|
986
|
-
- Limited monitoring calls to 25 seconds to prevent MCP timeouts
|
|
987
|
-
- Automatic continuation support for long-running sessions
|
|
988
|
-
- Real-time progress notifications during session monitoring
|
|
989
|
-
|
|
990
|
-
#### AAA Framework Integration
|
|
991
|
-
- Pre-built templates for login, forms, e-commerce, and navigation testing
|
|
992
|
-
- Comprehensive test scenarios for accessibility, performance, and mobile testing
|
|
993
|
-
- Dynamic argument support for customizable test generation
|
|
994
|
-
|
|
995
|
-
#### Test Analytics
|
|
996
|
-
- Complete test run history with performance metrics
|
|
997
|
-
- Probabilistic Flakiness Score (PFS) tracking
|
|
998
|
-
- Execution timing and error tracking
|
|
999
|
-
- Filtering and pagination for large datasets
|
|
268
|
+
- [SETUP.md](./SETUP.md) - Complete E2E test setup guide
|
|
269
|
+
- [MCP.md](./MCP.md) - MCP server documentation
|
|
270
|
+
- [CONTRIBUTING.md](./CONTRIBUTING.md) - Development guide
|
|
271
|
+
- [CLAUDE.md](./CLAUDE.md) - AI assistant onboarding
|
|
1000
272
|
|
|
1001
273
|
## License
|
|
1002
274
|
|