Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test(bidi): fix large screenshot test (#39295)

Holger Benlb1f4591dde40
diff --git a/tests/bidi/expectations/moz-firefox-nightly-page.txt b/tests/bidi/expectations/moz-firefox-nightly-page.txt
index 751f1cd01f..dc96e4a411 100644
--- a/tests/bidi/expectations/moz-firefox-nightly-page.txt
+++ b/tests/bidi/expectations/moz-firefox-nightly-page.txt
@@ -140,7 +140,6 @@ page/page-route.spec.ts › should not throw if request was cancelled by the pag
page/page-screenshot.spec.ts › page screenshot › should allow transparency [fail]
page/page-screenshot.spec.ts › page screenshot animations › should not capture css animations in shadow DOM [flaky]
page/page-screenshot.spec.ts › page screenshot animations › should not capture pseudo element css animation [fail]
-page/page-screenshot.spec.ts › should throw if screenshot size is too large [fail]
page/page-set-input-files.spec.ts › should upload a folder [fail]
page/page-wait-for-load-state.spec.ts › should wait for load state of empty url popup [timeout]
page/wheel.spec.ts › should dispatch wheel events after popup was opened @smoke [timeout]
diff --git a/tests/page/page-screenshot.spec.ts b/tests/page/page-screenshot.spec.ts
index d7f010f9a6..3cfbd8efb0 100644
--- a/tests/page/page-screenshot.spec.ts
+++ b/tests/page/page-screenshot.spec.ts
@@ -884,18 +884,21 @@ it.describe('page screenshot animations', () => {
});
});
-it('should throw if screenshot size is too large', async ({ page, browserName, isMac }) => {
+it('should throw if screenshot size is too large', async ({ page, browserName, isMac, isBidi }) => {
+ const maxSize = browserName === 'firefox' && isBidi ? 65535 : 32767;
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/16727' });
{
- await page.setContent(`<style>body {margin: 0; padding: 0;}</style><div style='min-height: 32767px; background: red;'></div>`);
+ await page.setContent(`<style>body {margin: 0; padding: 0;}</style><div style='min-height: ${maxSize}px; background: red;'></div>`);
const result = await page.screenshot({ fullPage: true });
expect(result).toBeTruthy();
}
{
- await page.setContent(`<style>body {margin: 0; padding: 0;}</style><div style='min-height: 32768px; background: red;'></div>`);
+ await page.setContent(`<style>body {margin: 0; padding: 0;}</style><div style='min-height: ${maxSize + 1}px; background: red;'></div>`);
const exception = await page.screenshot({ fullPage: true }).catch(e => e);
- if (browserName === 'firefox' || (browserName === 'webkit' && !isMac))
+ if ((browserName === 'firefox' && !isBidi) || (browserName === 'webkit' && !isMac))
expect(exception.message).toContain('Cannot take screenshot larger than 32767');
+ else if (browserName === 'firefox' && isBidi)
+ expect(exception.message).toContain('Unable to capture screenshot');
}
});