test: goto finishes on window.stop() (#10070)

This commit is contained in:
Yury Semikhatsky 2021-11-05 16:51:22 -07:00 committed by GitHub
parent f3fd3ebc37
commit 15a8b29961
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,4 @@
<script type="module" src="./module.js"></script>
<script>
setTimeout(() => window.stop(), 100);
</script>

View file

@ -629,6 +629,25 @@ it('should properly wait for load', async ({ page, server, browserName }) => {
]); ]);
}); });
it('should properly report window.stop()', async ({ page, server, browserName }) => {
server.setRoute('/module.js', async (req, res) => void 0);
await page.goto(server.PREFIX + '/window-stop.html');
});
it('should return from goto if new navigation is started', 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) => void 0);
let finished = false;
const navigation = page.goto(server.PREFIX + '/load-event/load-event.html').then(r => {
finished = true;
return r;
});
await new Promise(r => setTimeout(r, 500));
expect(finished).toBeFalsy();
await page.goto(server.EMPTY_PAGE);
expect((await navigation).status()).toBe(200);
});
it('should return when navigation is committed if commit is specified', async ({ page, server }) => { it('should return when navigation is committed if commit is specified', async ({ page, server }) => {
server.setRoute('/empty.html', (req, res) => { server.setRoute('/empty.html', (req, res) => {
res.writeHead(200, { res.writeHead(200, {