@gravity-ui/playwright-tools 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
1
  import type { Locator, Page, PageScreenshotOptions } from '@playwright/test';
2
2
  export type Theme = 'light' | 'dark';
3
3
  export type OnSwitchThemeCallback = (theme: Theme, page: Page) => Promise<void>;
4
- export type OnBeforeScreenshotCallback = (page: Page) => Promise<void>;
5
4
  export type ScreenshotOptions = Omit<PageScreenshotOptions, 'type' | 'quality' | 'path'> & {
6
5
  /**
7
6
  * An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
@@ -20,6 +19,7 @@ export type ScreenshotOptions = Omit<PageScreenshotOptions, 'type' | 'quality' |
20
19
  */
21
20
  threshold?: number;
22
21
  };
22
+ export type OnBeforeScreenshotCallback = (page: Page, options: ScreenshotOptions) => Promise<void>;
23
23
  export type MatchScreenshotOptions = {
24
24
  /**
25
25
  * The element or page to be screenshotted
@@ -45,7 +45,7 @@ async function matchScreenshot(page, { locator = page, name = globalSettings_1.g
45
45
  }
46
46
  await page.mouse.move(x, y);
47
47
  }
48
- await onBeforeScreenshot?.(page);
48
+ await onBeforeScreenshot?.(page, combinedOptions);
49
49
  const slug = (0, getTestSlug_1.getTestSlug)(page);
50
50
  await page.waitForTimeout(pause);
51
51
  if (themes && themes.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/playwright-tools",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Tools for Playwright Test",
5
5
  "keywords": [
6
6
  "playwright",