test: unflake network idle test (#17784)

Too slow on Firefox to fit 500ms network idle timeout.
This commit is contained in:
Dmitry Gozman 2022-10-03 12:28:19 -07:00 committed by GitHub
parent 06e0ea5e24
commit f14f69624f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,17 +156,23 @@ it('should wait for networkidle from the popup', async ({ page, server }) => {
} }
}); });
it('should wait for networkidle when iframe attaches and detaches', async ({ page }) => { it('should wait for networkidle when iframe attaches and detaches', async ({ page, server }) => {
await page.setContent(` server.setRoute('/empty.html', () => {});
let done = false;
const promise = page.setContent(`
<body> <body>
<script> <script>
setTimeout(() => { const iframe = document.createElement('iframe');
const iframe = document.createElement('iframe'); iframe.src = ${JSON.stringify(server.EMPTY_PAGE)};
document.body.appendChild(iframe); document.body.appendChild(iframe);
setTimeout(() => iframe.remove(), 400);
}, 400);
</script> </script>
</body> </body>
`, { waitUntil: 'networkidle' }); `, { waitUntil: 'networkidle' }).then(() => done = true);
expect(await page.$('iframe')).toBe(null); await page.waitForTimeout(600);
expect(done).toBe(false);
await page.evaluate(() => {
document.querySelector('iframe').remove();
});
await promise;
expect(done).toBe(true);
}); });