testdriver:screenshot
БесплатноБез исполняемых скриптовНе проверенCapture and save screenshots during test execution
от testdriverai★ 342 звезды на GitHubОб этом скилле
Overview
Capture a screenshot of the screen. TestDriver saves it to a local file automatically. TestDriver groups the screenshots by test file. This makes debug and review easy.
Syntax
const filePath = await testdriver.screenshot(filename)
Parameters
Returns
Promise<string> - The absolute file path where TestDriver saved the screenshot
File Organization
TestDriver saves screenshots automatically to .testdriver/screenshots/<test-file-name>/ in your project root:
.testdriver/
screenshots/
login.test/
001-find-before-L15-email-input.png # Auto: before find()
002-find-after-L15-email-input.png # Auto: after find()
003-click-before-L16-email-input.png # Auto: before click()
004-click-after-L16-email-input.png # Auto: after click()
005-type-before-L17-userexamplecom.png # Auto: before type()
006-type-after-L17-userexamplecom.png # Auto: after type()
custom-screenshot.png # Manual: screenshot("custom-screenshot")
checkout.test/
001-find-before-L12-checkout-button.png
...
Automatic Screenshot Naming
When autoScreenshots is enabled, filenames follow this format:
<seq>-<action>-<phase>-L<line>-<description>.png
| Component | Description | Example |
|---|---|---|
seq |
Sequential number (001, 002, ...) | 001 |
action |
Command name | click, type, find |
phase |
Before, after, or error | before, after |
L<line> |
Line number from test file | L42 |
description |
Element description or action target | submit-button |
Examples
Basic Screenshot
// Capture a screenshot with auto-generated filename
const screenshotPath = await testdriver.screenshot();
console.log('Screenshot saved to:', screenshotPath);
Custom Filename
// Save with a descriptive filename
await testdriver.screenshot("login-page");
// Saves to: .testdriver/screenshots/<test>/login-page.png
await testdriver.screenshot("after-click");
// Saves to: .testdriver/screenshots/<test>/after-click.png
Debugging with Screenshots
import { describe, expect, it } from "vitest";
import { TestDriver } from "testdriverai/vitest/hooks";
describe("Login Flow", () => {
it("should log in successfully", async (context) => {
const testdriver = TestDriver(context);
await testdriver.provision.chrome({
url: 'https://myapp.com/login',
});
// Capture initial state
await testdriver.screenshot();
// Fill in login form
const emailInput = await testdriver.find("email input");
await emailInput.click();
await testdriver.type("[email protected]");
// Capture state after typing
await testdriver.screenshot();
const passwordInput = await testdriver.find("password input");
await passwordInput.click();
await testdriver.type("password123");
// Capture before clicking login
await testdriver.screenshot();
const loginButton = await testdriver.find("Login button");
await loginButton.click();
// Capture after login attempt
await testdriver.screenshot();
const result = await testdriver.assert("dashboard is visible");
expect(result).toBeTruthy();
});
});
Automatic Screenshots
By default, TestDriver captures screenshots automatically before and after every command. This creates a complete visual timeline of your test execution without any additional code.
Enabling/Disabling
// Auto-screenshots enabled by default
const testdriver = TestDriver(context);
// Explicitly disable if needed (not recommended)
const testdriver = TestDriver(context, {
autoScreenshots: false
});
What Gets Captured
Automatic screenshots are taken around these commands:
find()/findAll()click()/hover()/doubleClick()/rightClick()type()/pressKeys()scroll()waitForText()/waitForImage()focusApplication()assert()/extract()/exec()
Example Output
For this test code:
// Line 15: Find email input
const emailInpu
Установить testdriver:screenshot в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл testdriver:screenshot?
Capture and save screenshots during test execution
Как установить скилл testdriver:screenshot?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл testdriver:screenshot запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic