Skip to content

Commit

Permalink
test: should take fullPage screenshots and mask elements outside of it (
Browse files Browse the repository at this point in the history
#30802)

Regression test for #30770.
  • Loading branch information
mxschmitt committed May 14, 2024
1 parent c8c3700 commit 27ce5c0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/page/page-screenshot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 27ce5c0

Please sign in to comment.