Skip to content

Commit

Permalink
Take pixelRatio into account in captureViewport
Browse files Browse the repository at this point in the history
  • Loading branch information
jperals committed Jan 9, 2025
1 parent cf5e307 commit 068218d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/page-objects/screenshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class ScreenshotPageObject extends BasePageObject {
}

async captureViewport(): Promise<ScreenshotWithOffset> {
const { height, width } = await this.getViewportSize();
const { height, width, pixelRatio } = await this.getViewportSize();

const offset: ElementOffset = {
top: 0,
Expand All @@ -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 };
}
}

0 comments on commit 068218d

Please sign in to comment.