UNPKG

@lewiswright/vitest-plugin-vis

Version:
17 lines (15 loc) 507 B
import type { BrowserCommandContext } from 'vitest/node' import type { BrowserApi } from './types.ts' export function playwright(context: BrowserCommandContext): BrowserApi { return { async takeScreenshot(filePath, selector, options) { // The `Locator` type from `vitest` has less props than the `Locator` in `playwright` const subject = context.iframe.locator(selector) return subject.screenshot({ timeout: options?.timeout, animations: 'disabled', path: filePath, }) }, } }