test: unflake "should fail when frame detaches" (#9095)

This commit is contained in:
Dmitry Gozman 2021-09-22 17:09:02 -07:00 committed by GitHub
parent e6f5404621
commit b978ce33cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -238,12 +238,10 @@ it('should fail when frame detaches', async ({page, server}) => {
await page.goto(server.PREFIX + '/frames/one-frame.html');
const frame = page.frames()[1];
server.setRoute('/empty.html', () => {});
let error = null;
await Promise.all([
frame.waitForNavigation().catch(e => error = e),
frame.evaluate('window.location.href = "/empty.html"'),
page.evaluate('setTimeout(() => document.querySelector("iframe").remove())'),
]).catch(e => error = e);
const [error] = await Promise.all([
frame.waitForNavigation().catch(e => e),
page.evaluate('var frame = document.querySelector("iframe"); frame.contentWindow.location.href = "/empty.html"; setTimeout(() => frame.remove())'),
]);
expect(error.message).toContain('waiting for navigation until "load"');
expect(error.message).toContain('frame was detached');
});