test: screenshot of css transformation (#26533)

Failing tests for #26447.
This commit is contained in:
Yury Semikhatsky 2023-08-18 14:30:43 -07:00 committed by GitHub
parent 22dacdb75f
commit 14a57a788b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 93 additions and 0 deletions

View File

@ -444,4 +444,53 @@ browserTest.describe('element screenshot', () => {
expect(screenshot).toMatchSnapshot('element-larger-than-viewport-dsf-css-size.png');
await context.close();
});
browserTest('page screenshot should capture css transform with device pixels', async function({ browser, browserName }) {
browserTest.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/26447' });
browserTest.fixme(browserName === 'webkit');
const context = await browser.newContext({
viewport: { width: 500, height: 500 },
deviceScaleFactor: 3,
});
const page = await context.newPage();
await page.setContent(`
<style>
.container {
width: 150px;
height: 150px;
margin: 75px 0 0 75px;
border: none;
}
.cube {
width: 100%;
height: 100%;
perspective: 550px;
perspective-origin: 150% 150%;
}
.face {
display: block;
position: absolute;
width: 100px;
height: 100px;
border: none;
}
.right {
background: rgba(196, 0, 0, 0.7);
transform: rotateY(70deg);
}
</style>
<div class="container">
<div class="cube showbf">
<div class="face right"></div>
</div>
</div>
`);
await expect(page).toHaveScreenshot({ scale: 'device' });
await context.close();
});
});

View File

@ -840,3 +840,47 @@ it('should throw if screenshot size is too large', async ({ page, browserName, i
expect(exception.message).toContain('Cannot take screenshot larger than 32767');
}
});
it('page screenshot should capture css transform', async function({ page, browserName, isElectron }) {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/26447' });
it.fixme(browserName === 'webkit');
it.fixme(isElectron, 'Returns screenshot of a different size.');
await page.setContent(`
<style>
.container {
width: 150px;
height: 150px;
margin: 75px 0 0 75px;
border: none;
}
.cube {
width: 100%;
height: 100%;
perspective: 550px;
perspective-origin: 150% 150%;
}
.face {
display: block;
position: absolute;
width: 100px;
height: 100px;
border: none;
}
.right {
background: rgba(196, 0, 0, 0.7);
transform: rotateY(70deg);
}
</style>
<div class="container">
<div class="cube showbf">
<div class="face right"></div>
</div>
</div>
`);
await expect(page).toHaveScreenshot();
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB