Skill240 repo starsupdated 20d ago
testdriver:debugging-with-screenshots
View and analyze saved screenshots using MCP commands for test debugging and development
Install in Claude Code
Copygit clone --depth 1 https://github.com/testdriverai/testdriverai /tmp/testdriver-debugging-with-screenshots && cp -r /tmp/testdriver-debugging-with-screenshots/ai/skills/testdriver:debugging-with-screenshots ~/.claude/skills/testdriver-debugging-with-screenshotsThen start a new Claude Code session; the skill loads automatically.
Definition
SKILL.md
<!-- Generated from debugging-with-screenshots.mdx. DO NOT EDIT. -->
## Overview
TestDriver MCP provides powerful commands to view and analyze screenshots saved during test execution. This enables rapid debugging, test development, and comparison workflows without manually opening image files.
<Note>
**Automatic Screenshots (Default: Enabled)**: TestDriver automatically captures screenshots before and after every command. Screenshots are named with the line number and action, making it easy to trace exactly which line of code produced each screenshot. For example: `001-click-before-L42-submit-button.png`
</Note>
## MCP Commands
### list_local_screenshots
List and filter screenshots saved in the `.testdriver/screenshots/` directory:
```
list_local_screenshots()
```
**Filter Parameters:**
<ParamField path="directory" type="string" optional>
Filter screenshots by test file or subdirectory (e.g., "login.test", "mcp-screenshots"). If omitted, lists all screenshots.
</ParamField>
<ParamField path="line" type="number" optional>
Filter by exact line number from test file (e.g., 42 matches L42 in filename).
</ParamField>
<ParamField path="lineRange" type="object" optional>
Filter by line number range. Example: `{ start: 10, end: 20 }` matches screenshots from lines 10-20.
</ParamField>
<ParamField path="action" type="string" optional>
Filter by action type: `click`, `find`, `type`, `assert`, `provision`, `scroll`, `hover`, etc.
</ParamField>
<ParamField path="phase" type="string" optional>
Filter by phase: `"before"` (state before action) or `"after"` (state after action).
</ParamField>
<ParamField path="pattern" type="string" optional>
Regex pattern to match against filename. Example: `"login|signin"` or `"button.*click"`.
</ParamField>
<ParamField path="sequence" type="number" optional>
Filter by exact sequence number.
</ParamField>
<ParamField path="sequenceRange" type="object" optional>
Filter by sequence range. Example: `{ start: 1, end: 10 }` matches first 10 screenshots.
</ParamField>
<ParamField path="limit" type="number" optional>
Maximum number of results to return (default: 50).
</ParamField>
<ParamField path="sortBy" type="string" optional>
Sort results by: `"modified"` (newest first, default), `"sequence"` (execution order), or `"line"` (line number).
</ParamField>
**Returns:**
Array of screenshot metadata including:
- `path` - Full absolute path to the screenshot file
- `relativePath` - Path relative to `.testdriver/screenshots/`
- `name` - Screenshot filename
- `sizeBytes` - File size in bytes
- `modified` - Last modification timestamp
- `sequence` - Sequential number (from auto-screenshots)
- `action` - Action type (click, find, etc.)
- `phase` - Before/after phase
- `lineNumber` - Line number from test file
- `description` - Element or action description
**Example Responses:**
```json
// Basic listing
[
{
"path": "/Users/user/project/.testdriver/screenshots/login.test/001-click-before-L42-submit-button.png",
"relativePath": "login.test/001-click-before-L42-submit-button.png",
"name": "001-click-before-L42-submit-button.png",
"sizeBytes": 145632,
"modified": "2026-01-23T10:00:00.000Z",
"sequence": 1,
"action": "click",
"phase": "before",
"lineNumber": 42,
"description": "submit-button"
}
]
```
### view_local_screenshot
View a specific screenshot from the list:
```
view_local_screenshot({ path: "/full/path/to/screenshot.png" })
```
**Parameters:**
<ParamField path="path" type="string" required>
Full absolute path to the screenshot file (as returned by `list_local_screenshots`)
</ParamField>
**Returns:**
- Image content (displayed to both AI and user via MCP App)
- Screenshot metadata
- Success/error status
## Common Workflows
### Test Debugging After Failures
When a test fails, use powerful filtering to quickly find relevant screenshots:
**1. Find screenshots at the failing line:**
```
// If test failed at line 42
list_local_screenshots({ line: 42 })
// View before and after states at that line
view_local_screenshot({ path: ".testdriver/screenshots/login.test/005-click-before-L42-submit-button.png" })
view_local_screenshot({ path: ".testdriver/screenshots/login.test/006-click-after-L42-submit-button.png" })
```
**2. See what happened leading up to the failure:**
```
// Get screenshots from lines 35-45 to see context
list_local_screenshots({ directory: "login.test", lineRange: { start: 35, end: 45 } })
```
**3. Find all assertion screenshots:**
```
// See what the screen looked like during assertions
list_local_screenshots({ action: "assert" })
```
**4. View the final state before failure:**
```
// Get the last 5 screenshots in execution order
list_local_screenshots({ directory: "login.test", sortBy: "sequence", limit: 5 })
```
### Finding Specific Actions
When debugging element interactions:
```
// Find all click actions
list_local_screenshots({ action: "click" })
// Find what the screen looked like BEFORE each click
list_local_screenshots({ action: "click", phase: "before" })
// Find screenshots related to a specific element using regex
list_local_screenshots({ pattern: "submit|button" })
// Find all type actions (for form filling issues)
list_local_screenshots({ action: "type" })
```
### Understanding Test Flow
View screenshots in execution order to trace test behavior:
```
// Get screenshots in execution order
list_local_screenshots({ directory: "checkout.test", sortBy: "sequence" })
// Get just the first 10 actions
list_local_screenshots({ sequenceRange: { start: 1, end: 10 }, sortBy: "sequence" })
// Get just the last 10 actions
list_local_screenshots({ directory: "checkout.test", sortBy: "sequence", limit: 10 })
```
### Interactive Test Development
While building tests using MCP tools, view screenshots to verify your test logic:
1. **After a test run**, filter screenshots to see specific actions:
```
// See all assertions
list_local_screenshots({ action:More from this repository
testdriver:aiSkill
Execute natural language tasks using AI
testdriver:assertSkill
Make AI-powered assertions about screen state
testdriver:aws-setupSkill
Deploy TestDriver on your AWS infrastructure using CloudFormation
testdriver:cacheSkill
Speed up tests with screenshot-based caching
testdriver:cachingSkill
1.7x faster test execution with intelligent caching and optimization
testdriver:captchaSkill
Solve captchas using 2captcha service
testdriver:ci-cdSkill
Run TestDriver tests in CI/CD with parallel execution and cross-platform support
testdriver:clickSkill
Click at specific coordinates or on elements