Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 748f22f

Browse files
committed
Bug 581863 - Fix screenshot test resize function when starting maximized.
When starting maximized the original target might not include decorations or what not.
1 parent f8b306a commit 748f22f

File tree

1 file changed

+8
-7
lines changed
  • browser/components/screenshots/tests/browser

1 file changed

+8
-7
lines changed

browser/components/screenshots/tests/browser/head.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -496,15 +496,16 @@ class ScreenshotsHelper {
496496

497497
async resizeContentWindow(width, height) {
498498
info(
499-
`Resizing window to ${width}x${height} (from ${innerWidth}x${innerHeight})`
500-
);
501-
window.resizeTo(
502-
outerWidth - innerWidth + width,
503-
outerHeight - innerHeight + height
499+
`Resizing window to ${width}x${height} from ${innerWidth}x${innerHeight} (outer ${outerWidth}x${outerHeight})`
504500
);
501+
let targetW = outerWidth - innerWidth + width;
502+
let targetH = outerHeight - innerHeight + height;
503+
window.resizeTo(targetW, targetH);
505504
await TestUtils.waitForCondition(() => {
506-
info(`Current: ${innerWidth}x${innerHeight}`);
507-
return innerHeight === height && innerWidth === width;
505+
info(
506+
`Current: ${innerWidth}x${innerHeight} (outer ${outerWidth}x${outerHeight})`
507+
);
508+
return outerHeight === targetH && outerWidth === targetW;
508509
}, "Waiting for window to resize");
509510
}
510511

0 commit comments

Comments
 (0)