@buddy-works/playwright

0.1.0 • Public • Published

Visual Test Playwright Plugin

A Playwright plugin for performing visual testing using Buddy Works Visual Testing. This plugin allows automatic capturing of website snapshots across different screen resolutions and comparing them with reference versions to detect visual regressions.

Installation

npm install @buddy-works/playwright

Usage

import { test as base } from "@playwright/test";
import withVisualTestPluginFixture from "@buddy-works/playwright";

const test = withVisualTestPluginFixture(base);

test("homepage visual test", async ({ page, visualTestPlugin }) => {
  await page.goto("https://example.com");

  await visualTestPlugin.takeSnap(page, "homepage", {
    devices: [{ viewport: { width: 1366, height: 768 } }],
    colorScheme: "DARK",
    cloneCookies: true,
  });
});

Examples

Example usage of the plugin can be found in the examples/ directory:

# Install dependencies
pnpm i
# Build plugin
pnpm run build
# Create link for plugin
pnpm link
# Go to examples folder
cd examples
# Link plugin
pnpm link @buddy-works/playwright
# Install examples dependencies
pnpm i
# Add enviroment variables with token
export BUDDY_VT_TOKEN=****
# Run an example
pnpm run test

License

MIT

Package Sidebar

Install

npm i @buddy-works/playwright

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

15.9 kB

Total Files

7

Last publish

Collaborators

  • mical
  • bylek
  • bartoszwrobel591