Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions actions/matchScreenshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export type Theme = 'light' | 'dark';

export type OnSwitchThemeCallback = (theme: Theme, page: Page) => Promise<void>;

export type OnBeforeScreenshotCallback = (page: Page) => Promise<void>;

export type ScreenshotOptions = Omit<PageScreenshotOptions, 'type' | 'quality' | 'path'> & {
/**
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
Expand All @@ -32,6 +30,8 @@ export type ScreenshotOptions = Omit<PageScreenshotOptions, 'type' | 'quality' |
threshold?: number;
};

export type OnBeforeScreenshotCallback = (page: Page, options: ScreenshotOptions) => Promise<void>;

export type MatchScreenshotOptions = {
/**
* The element or page to be screenshotted
Expand Down Expand Up @@ -158,7 +158,7 @@ export async function matchScreenshot(
await page.mouse.move(x, y);
}

await onBeforeScreenshot?.(page);
await onBeforeScreenshot?.(page, combinedOptions);

const slug = getTestSlug(page);

Expand Down