puppeteer/test/assets/networkidle.html
Patrick Hulce 4b0b81fd9b Add better network idle definition (#38)
This patch:
- Changes network idle promise to wait for 2 or fewer network requests for at least idleTime (defaults to 5s) before resolving.
- Adds timer cleanup to failure navigation case.
- Adds handling of webSocketClosed.
- Ignores unrecognized requestIds to avoid negative inflight requests.

References #10
2017-06-28 14:39:37 -07:00

20 lines
389 B
HTML

<script>
async function sleep(delay) {
return new Promise(resolve => setTimeout(resolve, delay));
}
async function main() {
const roundOne = Promise.all([
fetch('fetch-request-a.js'),
fetch('fetch-request-b.js'),
fetch('fetch-request-c.js'),
]);
await roundOne;
await sleep(50);
await fetch('fetch-request-d.js');
}
main();
</script>