mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test(goto): add failing load event test for webkit (#8809)
This commit is contained in:
parent
eca82eee4a
commit
7fe30bb182
23
tests/assets/load-event/load-event.html
Normal file
23
tests/assets/load-event/load-event.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Load Event Test</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
window.results = [];
|
||||||
|
window.addEventListener('load', function() {
|
||||||
|
window.results.push('load');
|
||||||
|
});
|
||||||
|
window.addEventListener('DOMContentLoaded', function() {
|
||||||
|
window.results.push('DOMContentLoaded');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<script type="module" src="./module.js"></script>
|
||||||
|
<script>
|
||||||
|
window.results.push('script tag after after module');
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
3
tests/assets/load-event/module.js
Normal file
3
tests/assets/load-event/module.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import {foo} from '/slow.js';
|
||||||
|
console.log('foo is', foo);
|
||||||
|
window.results.push('module');
|
||||||
@ -526,3 +526,21 @@ it('should not crash when RTCPeerConnection is used', async ({ page, server, bro
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should properly wait for load', async ({page, server, browserName}) => {
|
||||||
|
it.fixme(browserName === 'webkit', 'WebKit has a bug where Page.frameStoppedLoading is sent too early.');
|
||||||
|
server.setRoute('/slow.js', async (req, res) => {
|
||||||
|
await new Promise(x => setTimeout(x, 100));
|
||||||
|
res.writeHead(200, {'Content-Type': 'application/javascript'});
|
||||||
|
res.end(`window.results.push('slow module');export const foo = 'slow';`);
|
||||||
|
});
|
||||||
|
await page.goto(server.PREFIX + '/load-event/load-event.html');
|
||||||
|
const results = await page.evaluate('window.results');
|
||||||
|
expect(results).toEqual([
|
||||||
|
'script tag after after module',
|
||||||
|
'slow module',
|
||||||
|
'module',
|
||||||
|
'DOMContentLoaded',
|
||||||
|
'load'
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user