Skip to content

Commit a2b9e32

Browse files
author
Ives van Hoorne
committed
Fix integration test waiting
1 parent 1a392f3 commit a2b9e32

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

packages/app/integration-tests/tests/sandboxes.test.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ const SANDBOXES = [
1919
'lp5rjr0z4z',
2020
'nOymMxyY',
2121
];
22+
23+
function pageLoaded(page) {
24+
return new Promise(async resolve => {
25+
await page.exposeFunction('__puppeteer__', () => {
26+
if (resolve) {
27+
resolve();
28+
}
29+
});
30+
});
31+
}
32+
2233
describe('sandboxes', () => {
2334
let browser = puppeteer.launch({
2435
args: ['--no-sandbox', '--disable-setuid-sandbox'],
@@ -36,10 +47,11 @@ describe('sandboxes', () => {
3647
async () => {
3748
browser = await browser;
3849
const page = await browser.newPage();
39-
await page.goto('http://localhost:3001/#' + id, {
40-
waitUntil: 'networkidle0',
50+
const waitFunction = pageLoaded(page);
51+
page.goto('http://localhost:3001/#' + id, {
4152
timeout: 60000,
4253
});
54+
await waitFunction;
4355
await page.waitFor(2000);
4456

4557
const screenshot = await page.screenshot();

0 commit comments

Comments
 (0)