testdriverai 7.2.87 → 7.2.89
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/lib/redraw.js +1 -1
- package/ai/agents/testdriver.md +10 -8
- package/package.json +1 -1
package/agent/lib/redraw.js
CHANGED
|
@@ -7,7 +7,7 @@ const theme = require("./theme");
|
|
|
7
7
|
const DEFAULT_REDRAW_OPTIONS = {
|
|
8
8
|
enabled: true, // Master switch to enable/disable redraw detection
|
|
9
9
|
screenRedraw: true, // Enable screen redraw detection
|
|
10
|
-
networkMonitor:
|
|
10
|
+
networkMonitor: false, // Enable network activity monitoring
|
|
11
11
|
noChangeTimeoutMs: 1500, // Exit early if no screen change detected after this time
|
|
12
12
|
};
|
|
13
13
|
|
package/ai/agents/testdriver.md
CHANGED
|
@@ -44,7 +44,8 @@ Use this agent when the user asks to:
|
|
|
44
44
|
4. **⚠️ WRITE CODE IMMEDIATELY**: After EVERY successful action, append the generated code to the test file RIGHT AWAY. Do NOT wait until the end.
|
|
45
45
|
5. **Verify Actions**: Use `check` after actions to verify they succeeded (for YOUR understanding only).
|
|
46
46
|
6. **Add Assertions**: Use `assert` for test conditions that should be in the final test file.
|
|
47
|
-
7. **⚠️ RUN THE TEST YOURSELF**: Use `
|
|
47
|
+
7. **⚠️ RUN THE TEST YOURSELF**: Use `vitest run <testFile> --reporter=dot` to run the test - do NOT tell the user to run it. Iterate until it passes. **NEVER use `npx vitest`** - always use `vitest` directly.
|
|
48
|
+
8. **⚠️ SHARE THE TEST REPORT**: After EVERY test run, find the `TESTDRIVER_RUN_URL` in the output (e.g., `TESTDRIVER_RUN_URL=https://console.testdriver.ai/runs/...`) and share it with the user so they can view the recording and results.
|
|
48
49
|
|
|
49
50
|
## Prerequisites
|
|
50
51
|
|
|
@@ -80,7 +81,7 @@ The `init` command creates:
|
|
|
80
81
|
|
|
81
82
|
**After running init:**
|
|
82
83
|
1. User adds their API key to `.env`: `TD_API_KEY=...`
|
|
83
|
-
2. Test the setup: `
|
|
84
|
+
2. Test the setup: `vitest run`
|
|
84
85
|
3. Start building custom tests using the examples as templates
|
|
85
86
|
|
|
86
87
|
### API Key Setup
|
|
@@ -254,7 +255,7 @@ TestDriver **automatically captures screenshots before and after every command**
|
|
|
254
255
|
|
|
255
256
|
**Every MCP tool response includes "ACTION REQUIRED: Append this code..." - you MUST write that code to the test file IMMEDIATELY before proceeding to the next action.**
|
|
256
257
|
|
|
257
|
-
**When ready to validate, RUN THE TEST YOURSELF using `
|
|
258
|
+
**When ready to validate, RUN THE TEST YOURSELF using `vitest run`. Do NOT tell the user to run it. NEVER use `npx vitest`.**
|
|
258
259
|
|
|
259
260
|
### Step 1: Start a Session
|
|
260
261
|
|
|
@@ -311,17 +312,17 @@ assert({ assertion: "the dashboard is visible" })
|
|
|
311
312
|
|
|
312
313
|
### Step 5: Run the Test Yourself
|
|
313
314
|
|
|
314
|
-
**⚠️ YOU must run the test - do NOT tell the user to run it:**
|
|
315
|
+
**⚠️ YOU must run the test - do NOT tell the user to run it. NEVER use `npx vitest` - always use `vitest` directly:**
|
|
315
316
|
|
|
316
317
|
```bash
|
|
317
|
-
|
|
318
|
+
vitest run tests/login.test.mjs --reporter=dot
|
|
318
319
|
```
|
|
319
320
|
|
|
320
321
|
**Always use `--reporter=dot`** for cleaner, more concise output that's easier to parse.
|
|
321
322
|
|
|
322
323
|
Analyze the output, fix any issues, and iterate until the test passes.
|
|
323
324
|
|
|
324
|
-
**⚠️ ALWAYS share the test report link with the user.** After each test run, look for
|
|
325
|
+
**⚠️ ALWAYS share the test report link with the user.** After each test run, look for `TESTDRIVER_RUN_URL` in the test output (e.g., `TESTDRIVER_RUN_URL=https://console.testdriver.ai/runs/...`) and share it with the user so they can view the recording and results. This is CRITICAL - users need to see the visual recording to understand test behavior.
|
|
325
326
|
|
|
326
327
|
### MCP Tools Reference
|
|
327
328
|
|
|
@@ -456,7 +457,7 @@ list_local_screenshots({ directory: "checkout.test", phase: "before", limit: 10
|
|
|
456
457
|
### Tips for MCP Workflow
|
|
457
458
|
|
|
458
459
|
1. **⚠️ Write code IMMEDIATELY** - After EVERY action, append generated code to test file RIGHT AWAY
|
|
459
|
-
2. **⚠️ Run tests YOURSELF** - Use `
|
|
460
|
+
2. **⚠️ Run tests YOURSELF** - Use `vitest run` (NEVER `npx vitest`) - do NOT tell user to run tests
|
|
460
461
|
3. **⚠️ Add screenshots liberally** - Include `await testdriver.screenshot()` after every significant action for debugging
|
|
461
462
|
4. **⚠️ Use screenshot viewing for debugging** - When tests fail, use `list_local_screenshots` and `view_local_screenshot` to understand what went wrong
|
|
462
463
|
5. **Work incrementally** - Don't try to build the entire test at once
|
|
@@ -616,7 +617,8 @@ await testdriver.screenshot(1, false, true);
|
|
|
616
617
|
## Tips for Agents
|
|
617
618
|
|
|
618
619
|
1. **⚠️ WRITE CODE IMMEDIATELY** - After EVERY successful MCP action, append the generated code to the test file RIGHT AWAY. Do NOT wait until the session ends.
|
|
619
|
-
2. **⚠️ RUN TESTS YOURSELF** - Do NOT tell the user to run tests. YOU must run the tests using `
|
|
620
|
+
2. **⚠️ RUN TESTS YOURSELF** - Do NOT tell the user to run tests. YOU must run the tests using `vitest run <testFile> --reporter=dot` (NEVER use `npx vitest` - it breaks the reporter). Always use `--reporter=dot` for cleaner output. Analyze the output and iterate until the test passes.
|
|
621
|
+
3. **⚠️ SHARE THE TEST REPORT URL** - After EVERY test run, find `TESTDRIVER_RUN_URL=https://console.testdriver.ai/runs/...` in the output and share it with the user. This is CRITICAL - users need to view the recording to understand what happened.
|
|
620
622
|
3. **Screenshots are automatic** - TestDriver captures screenshots before/after every command by default. Each screenshot filename includes the line number (e.g., `001-click-before-L42-submit-button.png`) making it easy to trace issues.
|
|
621
623
|
4. **⚠️ USE SCREENSHOT VIEWING FOR DEBUGGING** - When tests fail, use `list_local_screenshots` and `view_local_screenshot` MCP commands to see exactly what the UI looked like. The filenames tell you which line of code triggered each screenshot.
|
|
622
624
|
5. **⚠️ NEVER USE `.wait()`** - Do NOT use any `.wait()` method. Instead, use `find()` with a `timeout` option to poll for elements, or use `assert()` / `check()` to verify state. Explicit waits are flaky and slow.
|