Skip to content

Commit

Permalink
fix(core): Fix navigation wait logic
Browse files Browse the repository at this point in the history
  • Loading branch information
wadackel committed Nov 8, 2020
1 parent 553e5c3 commit 1178dc9
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions packages/core/src/tester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,24 +296,17 @@ export class Tester {
}

private async _waitForReady(page: Page): Promise<void> {
const { readyTimeout } = this._config;
const { readyTimeout: timeout } = this._config;

await Promise.all([
page.goto(this._config.url, {
timeout: readyTimeout,
waitUntil: 'networkidle2',
timeout,
}),
page.waitForNavigation({
waitUntil: 'domcontentloaded',
timeout,
}),
page.waitForFunction(
(url: string) => {
const { readyState } = window.document;
const ready = ['interactive', 'complete'].includes(readyState);
return window.location.href === url && ready;
},
{
polling: 'raf',
timeout: readyTimeout,
},
this._config.url,
),
]);
}

Expand Down

0 comments on commit 1178dc9

Please sign in to comment.