mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: add iframe screenshot tests (#2495)
This commit is contained in:
parent
9aa9d6bc1d
commit
8c6c571f22
16
test/assets/grid-iframe-in-shadow.html
Normal file
16
test/assets/grid-iframe-in-shadow.html
Normal file
@ -0,0 +1,16 @@
|
||||
<style>
|
||||
body, html {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const container = document.createElement('div');
|
||||
document.body.appendChild(container);
|
||||
const shadow = container.attachShadow({mode: 'open'});
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.src = './grid.html';
|
||||
iframe.style.cssText = 'width: 300px; height: 300px; margin: 0; padding: 0; border: 0;';
|
||||
shadow.appendChild(iframe);
|
||||
});
|
||||
</script>
|
||||
@ -150,13 +150,12 @@ describe('OOPIF', function() {
|
||||
expect(await countOOPIFs(browser)).toBe(1);
|
||||
expect(intercepted).toBe(true);
|
||||
});
|
||||
it.fail(CHROMIUM)('should take screenshot', async({browser, page, server}) => {
|
||||
// Screenshot differs on the bots, needs debugging.
|
||||
it('should take screenshot', async({browser, page, server, golden}) => {
|
||||
await page.setViewportSize({width: 500, height: 500});
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
expect(page.frames().length).toBe(2);
|
||||
expect(await countOOPIFs(browser)).toBe(1);
|
||||
expect(await page.screenshot()).toBeGolden('screenshot-iframe.png');
|
||||
expect(await page.screenshot()).toBeGolden(golden('screenshot-oopif.png'));
|
||||
});
|
||||
it('should load oopif iframes with subresources and request interception', async function({browser, page, server, context}) {
|
||||
await page.route('**/*', route => route.continue());
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 14 KiB |
BIN
test/golden-chromium/screenshot-oopif.png
Normal file
BIN
test/golden-chromium/screenshot-oopif.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
test/golden-firefox/screenshot-iframe.png
Normal file
BIN
test/golden-firefox/screenshot-iframe.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
test/golden-webkit/screenshot-iframe.png
Normal file
BIN
test/golden-webkit/screenshot-iframe.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
@ -223,6 +223,11 @@ describe.skip(ffheadful)('Page.screenshot', function() {
|
||||
expect(screenshot).toBeGolden(golden('screenshot-device-scale-factor.png'));
|
||||
await context.close();
|
||||
});
|
||||
it('should work with iframe in shadow', async({browser, page, server, golden}) => {
|
||||
await page.setViewportSize({width: 500, height: 500});
|
||||
await page.goto(server.PREFIX + '/grid-iframe-in-shadow.html');
|
||||
expect(await page.screenshot()).toBeGolden(golden('screenshot-iframe.png'));
|
||||
});
|
||||
});
|
||||
|
||||
describe.skip(ffheadful)('ElementHandle.screenshot', function() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user