Skip to content

Commit

Permalink
feat(e2e): e2e timeout configurable
Browse files Browse the repository at this point in the history
Closes #2662

Co-Authored-By: Matthias Max <matthias.max@bitflower.net>
  • Loading branch information
adamdbradley and bitflower committed Sep 17, 2020
1 parent 68cf9b0 commit 8b69731
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/testing/puppeteer/puppeteer-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ async function e2eGoTo(page: E2EPageInternal, url: string, options: NavigationOp
throw new Error(`Testing unable to load ${url}, HTTP status: ${rsp.status()}`);
}

await waitForStencil(page);
await waitForStencil(page, options);

return rsp;
}
Expand Down Expand Up @@ -267,14 +267,15 @@ async function e2eSetContent(page: E2EPageInternal, html: string, options: Navig
throw new Error(`Testing unable to load content`);
}

await waitForStencil(page);
await waitForStencil(page, options);

return rsp;
}

async function waitForStencil(page: E2EPage) {
async function waitForStencil(page: E2EPage, options: NavigationOptions) {
try {
await page.waitForFunction('window.stencilAppLoaded', { timeout: 4750 });
const timeout = typeof options.timeout === 'number' ? options.timeout : 4750;
await page.waitForFunction('window.stencilAppLoaded', { timeout });
} catch (e) {
throw new Error(`App did not load in allowed time. Please ensure the content loads a stencil application.`);
}
Expand Down

0 comments on commit 8b69731

Please sign in to comment.