mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test: fix serviceWorker test flakiness (#2195)
This patch starts waiting on serviceWorker registration.
This commit is contained in:
parent
625c7ebdda
commit
4b7fbf8ee0
@ -1,4 +1,4 @@
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
<script>
|
||||
navigator.serviceWorker.register('sw.js');
|
||||
window.registrationPromise = navigator.serviceWorker.register('sw.js');
|
||||
</script>
|
||||
|
@ -2862,6 +2862,7 @@ describe('Page', function() {
|
||||
|
||||
// Load and re-load to make sure serviceworker is installed and running.
|
||||
await page.goto(server.PREFIX + '/serviceworkers/fetch/sw.html', {waitUntil: 'networkidle2'});
|
||||
await page.evaluate(async() => await window.registrationPromise);
|
||||
await page.reload();
|
||||
|
||||
expect(responses.size).toBe(2);
|
||||
|
Loading…
Reference in New Issue
Block a user