From 068218d5f05c49e7d36432d6da38ad6793902ded Mon Sep 17 00:00:00 2001 From: Joan Perals Tresserra Date: Thu, 9 Jan 2025 15:48:13 +0100 Subject: [PATCH] Take pixelRatio into account in captureViewport --- src/page-objects/screenshot.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/page-objects/screenshot.ts b/src/page-objects/screenshot.ts index fa2ec82..003e2a9 100644 --- a/src/page-objects/screenshot.ts +++ b/src/page-objects/screenshot.ts @@ -52,7 +52,7 @@ export default class ScreenshotPageObject extends BasePageObject { } async captureViewport(): Promise { - const { height, width } = await this.getViewportSize(); + const { height, width, pixelRatio } = await this.getViewportSize(); const offset: ElementOffset = { top: 0, @@ -61,6 +61,6 @@ export default class ScreenshotPageObject extends BasePageObject { const screenshot = await this.browser.takeScreenshot(); const image = await parsePng(screenshot); - return { image, offset, height, width }; + return { image, offset, height: height * pixelRatio, width: width * pixelRatio }; } }