Test framework integration
Use the client from Node.js tests that can produce an image buffer or file:
- 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.
- Add variant metadata in
properties, then configure those keys in localsignaturePropertiesor the cloud project’s matching settings. - Use
vizzly run "your test command" --waitwhen CI should fail on unresolved visual changes.