Test Framework Integration
The JavaScript client works anywhere you can produce a PNG or screenshot buffer.
The common pattern is:
- run tests through
vizzly run, or startvizzly tdd start - capture a screenshot in your test framework
- send it with
vizzlyScreenshot()
Playwright
import { test } from '@playwright/test';import { vizzlyScreenshot } from '@vizzly-testing/cli/client';
test('homepage', async ({ page, browserName }) => { await page.goto('/');
let screenshot = await page.screenshot();
await vizzlyScreenshot('homepage', screenshot, { properties: { browser: browserName, viewport: page.viewportSize(), }, });});Jest or Puppeteer
import { vizzlyScreenshot } from '@vizzly-testing/cli/client';
test('dashboard', async () => { let screenshot = await page.screenshot();
await vizzlyScreenshot('dashboard', screenshot, { properties: { browser: 'chrome', viewport: page.viewport(), }, });});WebDriver and WebdriverIO
If your framework returns a base64 screenshot, convert it to a Buffer. A
plain string is treated as a file path by the Vizzly client.
let screenshot = Buffer.from(await driver.takeScreenshot(), 'base64');
await vizzlyScreenshot('checkout', screenshot, { properties: { browser: 'chrome', },});Useful patterns
- Keep screenshot names stable across runs.
- Use properties like
viewport,theme, orstatewhen you want separate baselines for variants. - Use
vizzly run "your test command" --waitwhen CI should fail on unresolved visual changes.