test: should take fullPage screenshots and mask elements outside of it (#30802)

Regression test for #30770.
This commit is contained in:
Max Schmitt 2024-05-14 19:09:18 +02:00 committed by GitHub
parent c8c37009c3
commit 27ce5c0226
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 0 deletions

View File

@ -221,6 +221,17 @@ it.describe('page screenshot', () => {
expect(screenshot).toMatchSnapshot('screenshot-grid-fullpage.png');
});
it('should take fullPage screenshots and mask elements outside of it', async ({ page, server }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30770' });
await page.setViewportSize({ width: 500, height: 500 });
await page.goto(server.PREFIX + '/grid.html');
const screenshot = await page.screenshot({
fullPage: true,
mask: [page.locator('.box').nth(144)],
});
expect(screenshot).toMatchSnapshot('screenshot-grid-fullpage-mask-outside-viewport.png');
});
it('should restore viewport after fullPage screenshot', async ({ page, server }) => {
await page.setViewportSize({ width: 500, height: 500 });
await page.goto(server.PREFIX + '/grid.html');

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB