/playwright-visual:visual-test-generationfrom playwright-visual
Generate visual snapshot tests using Playwright's `toHaveScreenshot()` assertion. Covers full-page captures, element-level screenshots, masked regions for dynamic content, and responsive viewport sweeps across mobile, tablet, and desktop breakpoints.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /playwright-visual:visual-test-generation still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Generate visual snapshot tests using Playwright's toHaveScreenshot() assertion. Covers full-page captures, element-level screenshots, masked regions for dynamic content, and responsive viewport sweeps across mobile, tablet, and desktop breakpoints.
*.visual.spec.ts files from natural language descriptions, component names, or page URLs.toHaveScreenshot() calls with appropriate options (fullPage, clip, mask, animations).*.visual.spec.ts file per described surface.import { test, expect } from '@playwright/test';
test('landing page — desktop', async ({ page }) => {
await page.goto('/');
await page.waitForLoadState('networkidle');
// Disable animations for a stable capture
await page.addStyleTag({
content: `*, *::before, *::after {
animation-duration: 0s !important;
transition-duration: 0s !important;
}`,
});
await expect(page).toHaveScreenshot('landing-desktop.png', {
fullPage: true,
animations: 'disabled',
});
});
test('primary CTA button', async ({ page }) => {
await page.goto('/');
const cta = page.getByRole('link', { name: 'Get started' });
await expect(cta).toHaveScreenshot('cta-button.png', {
animations: 'disabled',
});
});
const viewports = [
{ name: 'mobile', width: 375, height: 667 },
{ name: 'tablet', width: 768, height: 1024 },
{ name: 'desktop', width: 1280, height: 800 },
];
for (const vp of viewports) {
test(`hero section — ${vp.name}`, async ({ page }) => {
await page.setViewportSize({ width: vp.width, height: vp.height });
await page.goto('/');
await page.addStyleTag({
content: `*, *::before, *::after {
animation-duration: 0s !important;
transition-duration: 0s !important;
}`,
});
await expect(page.getByTestId('hero')).toHaveScreenshot(
`hero-${vp.name}.png`,
{ animations: 'disabled' },
);
});
}
test('dashboard with live data', async ({ page }) => {
await page.goto('/dashboard');
await expect(page).toHaveScreenshot('dashboard.png', {
fullPage: true,
animations: 'disabled',
mask: [
page.getByTestId('last-updated-timestamp'),
page.getByTestId('user-avatar'),
page.locator('[data-ad]'),
],
});
});
page.addStyleTag with zero-duration animation overrides before toHaveScreenshot.animations: 'disabled' as a belt-and-suspenders measure alongside the style tag.<description>-<viewport>.png in kebab-case.tests/visual/specs/.When categorization.enabled is true, invoke the test-case-categorizer skill before generating test blocks. Each test() receives a { tag: ['@<category>'] } option.
test.describe('Hero Section', () => {
// --- Positive scenarios ---
test('hero matches baseline at desktop', { tag: ['@positive'] }, async ({ page }) => {
await page.goto('/');
await expect(page.locator('.hero')).toHaveScreenshot('hero-desktop.png');
});
test('hero matches baseline at tablet', { tag: ['@positive'] }, async ({ page }) => {
await page.setViewportSize({ width: 768, height: 1024 });
await page.goto('/');
await expect(page.locator('.hero')).toHaveScreenshot('hero-tablet.png');
});
// --- Negative scenarios ---
test('hero with broken image shows fallback', { tag: ['@negative'] }, async ({ page }) => {
await page.route('**/hero-bg.jpg', route => route.abort());
await page.goto('/');
await expect(page.locator('.hero')).toHaveScreenshot('hero-broken-image.png');
});
// --- Edge scenarios ---
test('hero at 320px minimum viewport', { tag: ['@edge'] }, async ({ page }) => {
await page.setViewportSize({ width: 320, height: 568 });
await page.goto('/');
await expect(page.locator('.hero')).toHaveScreenshot('hero-320px.png');
});
// --- Security scenarios ---
test('error page does not expose stack trace', { tag: ['@security'] }, async ({ page }) => {
await page.goto('/nonexistent-page');
await expect(page.locator('body')).not.toContainText('at Object.');
await expect(page.locator('body')).not.toContainText('node_modules');
await expect(page).toHaveScreenshot('error-page-safe.png');
});
});
test() block must include a tag option with exactly one category tag.coverageBreadth.security may default to 0 for visual test type.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub gagandeepp/software-agent-teams --plugin playwright-visualNone: SKILL.md is the whole skill.
6 skills in this plugin
/screenshot-baselineSkill: screenshot-baselineManage the full lifecycle of visual regression baselines: initial capture, intentional updates, platform-specific naming conventions, Git LFS storage, and PR review gates./visual-assertionsSkill: visual-assertionsPatterns for `toHaveScreenshot` and `toMatchSnapshot` assertions: full-page vs element captures, all supported options, masking dynamic regions, and DO / DON'T examples./visual-comparison