Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
feat(types): export ScreenshotOptions (#6419)
Joel Einbinder447a0c4bb8ae
diff --git a/types/types.d.ts b/types/types.d.tsindex d97b2b083e..6bfed713b8 100644--- a/types/types.d.ts+++ b/types/types.d.ts@@ -2418,69 +2418,7 @@ export interface Page {* Returns the buffer with the captured screenshot.* @param options*/- screenshot(options?: {- /**- * An object which specifies clipping of the resulting image. Should have the following fields:- */- clip?: {- /**- * x-coordinate of top-left corner of clip area- */- x: number;-- /**- * y-coordinate of top-left corner of clip area- */- y: number;-- /**- * width of clipping area- */- width: number;-- /**- * height of clipping area- */- height: number;- };-- /**- * When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Defaults to- * `false`.- */- fullPage?: boolean;-- /**- * Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images.- * Defaults to `false`.- */- omitBackground?: boolean;-- /**- * The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative- * path, then it is resolved relative to the current working directory. If no path is provided, the image won't be saved to- * the disk.- */- path?: string;-- /**- * The quality of the image, between 0-100. Not applicable to `png` images.- */- quality?: number;-- /**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by- * using the- * [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browsercontextsetdefaulttimeouttimeout)- * or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#pagesetdefaulttimeouttimeout) methods.- */- timeout?: number;-- /**- * Specify screenshot type, defaults to `png`.- */- type?: "png"|"jpeg";- }): Promise<Buffer>;+ screenshot(options?: PageScreenshotOptions): Promise<Buffer>;/*** This method waits for an element matching `selector`, waits for [actionability](https://playwright.dev/docs/actionability) checks, waits until@@ -11499,6 +11437,70 @@ interface PageWaitForFunctionOptions {timeout?: number;}+export interface PageScreenshotOptions {+ /**+ * An object which specifies clipping of the resulting image. Should have the following fields:+ */+ clip?: {+ /**+ * x-coordinate of top-left corner of clip area+ */+ x: number;++ /**+ * y-coordinate of top-left corner of clip area+ */+ y: number;++ /**+ * width of clipping area+ */+ width: number;++ /**+ * height of clipping area+ */+ height: number;+ };++ /**+ * When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Defaults to+ * `false`.+ */+ fullPage?: boolean;++ /**+ * Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images.+ * Defaults to `false`.+ */+ omitBackground?: boolean;++ /**+ * The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative+ * path, then it is resolved relative to the current working directory. If no path is provided, the image won't be saved to+ * the disk.+ */+ path?: string;++ /**+ * The quality of the image, between 0-100. Not applicable to `png` images.+ */+ quality?: number;++ /**+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by+ * using the+ * [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browsercontextsetdefaulttimeouttimeout)+ * or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#pagesetdefaulttimeouttimeout) methods.+ */+ timeout?: number;++ /**+ * Specify screenshot type, defaults to `png`.+ */+ type?: "png"|"jpeg";+}+type Devices = {"Blackberry PlayBook": DeviceDescriptor;"Blackberry PlayBook landscape": DeviceDescriptor;diff --git a/utils/generate_types/exported.json b/utils/generate_types/exported.jsonindex 0fe766c915..fd8584e644 100644--- a/utils/generate_types/exported.json+++ b/utils/generate_types/exported.json@@ -6,5 +6,6 @@"BrowserNewContextOptions": "BrowserContextOptions","BrowserNewContextOptionsViewport": "ViewportSize","BrowserNewContextOptionsGeolocation": "Geolocation",- "BrowserNewContextOptionsHttpCredentials": "HTTPCredentials"+ "BrowserNewContextOptionsHttpCredentials": "HTTPCredentials",+ "PageScreenshotOptions": "PageScreenshotOptions"}