@argos-ci/playwright
Advanced tools
@@ -44,2 +44,12 @@ import { ElementHandle, Locator, LocatorScreenshotOptions, PageScreenshotOptions, Page } from '@playwright/test'; | ||
stabilize?: boolean | StabilizationOptions; | ||
/** | ||
* Run a function before taking the screenshot. | ||
* When using viewports, this function will run before taking sreenshots on each viewport. | ||
*/ | ||
beforeScreenshot?: () => Promise<void> | void; | ||
/** | ||
* Run a function after taking the screenshot. | ||
* When using viewports, this function will run after taking sreenshots on each viewport. | ||
*/ | ||
afterScreenshot?: () => Promise<void> | void; | ||
} & LocatorOptions & ScreenshotOptions<LocatorScreenshotOptions> & ScreenshotOptions<PageScreenshotOptions>; | ||
@@ -46,0 +56,0 @@ /** |
@@ -240,2 +240,3 @@ // src/screenshot.ts | ||
const stabilizeAndScreenshot = async (name2) => { | ||
await options.beforeScreenshot?.(); | ||
if (stabilize) { | ||
@@ -300,2 +301,3 @@ const stabilizationOptions = typeof stabilize === "object" ? stabilize : {}; | ||
} | ||
await options.afterScreenshot?.(); | ||
}; | ||
@@ -302,0 +304,0 @@ if (viewports) { |
{ | ||
"name": "@argos-ci/playwright", | ||
"description": "Playwright SDK for visual testing with Argos.", | ||
"version": "3.9.4", | ||
"version": "3.10.0", | ||
"author": "Smooth Code", | ||
@@ -50,12 +50,12 @@ "license": "MIT", | ||
"dependencies": { | ||
"@argos-ci/browser": "2.2.1", | ||
"@argos-ci/core": "2.12.0", | ||
"@argos-ci/util": "2.2.1", | ||
"chalk": "^5.3.0", | ||
"debug": "^4.3.7" | ||
"@argos-ci/browser": "2.2.2", | ||
"@argos-ci/core": "3.0.0", | ||
"@argos-ci/util": "2.2.2", | ||
"chalk": "^5.4.1", | ||
"debug": "^4.4.0" | ||
}, | ||
"devDependencies": { | ||
"@argos-ci/cli": "2.5.3", | ||
"@argos-ci/cli": "workspace:*", | ||
"@argos-ci/playwright": "workspace:.", | ||
"@playwright/test": "^1.48.2", | ||
"@playwright/test": "^1.49.1", | ||
"@types/debug": "^4.1.12", | ||
@@ -69,3 +69,3 @@ "@types/node": "^18.19.44" | ||
}, | ||
"gitHead": "88672d5cd06a792974844d1cb798641cec6e0562" | ||
"gitHead": "0c91306ae0cb8bec5ef93db79565635e405086f7" | ||
} |
30737
1.69%814
1.5%