Skip to content

Commit 7600927

Browse files
authored
Merge pull request #1136 from twilio/fix-macos-e2e
Catch error and add sleep
2 parents cbdba09 + 2abe902 commit 7600927

File tree

1 file changed

+12
-3
lines changed
  • packages/flex-plugin-e2e-tests/src/utils/pages/view

1 file changed

+12
-3
lines changed

packages/flex-plugin-e2e-tests/src/utils/pages/view/base.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { logger } from '@twilio/flex-dev-utils';
22
import { ElementHandle, Page, PuppeteerLifeCycleEvent } from 'puppeteer';
33

4+
import { sleep } from '../../timers';
5+
46
export abstract class Base {
57
protected static readonly DEFAULT_LOCATE_TIMEOUT = 3000000;
68

@@ -30,16 +32,23 @@ export abstract class Base {
3032
try {
3133
await Promise.all([
3234
this.page.waitForNavigation({
33-
waitUntil: 'load', // condition to consider navigation finished
35+
waitUntil: 'networkidle2', // condition to consider navigation finished
3436
timeout: Base.DEFAULT_PAGE_LOAD_TIMEOUT,
3537
}),
3638
this.page.goto(fullPath, {
37-
waitUntil: waitUntil || 'load',
39+
waitUntil: waitUntil || 'networkidle2',
3840
timeout: Base.DEFAULT_PAGE_LOAD_TIMEOUT,
3941
}),
4042
]);
4143
} catch (err) {
42-
logger.error(`Ignoring navigation error to ${fullPath} and ${(err as Error).message}`);
44+
if (err.message.includes('detached')) {
45+
logger.error('Page has been detached. adding a sleep to let other processes finish');
46+
/*
47+
* Just let it wait the rest of the timeout so the other contestants in the rest
48+
* can finish first.
49+
*/
50+
await sleep(5000);
51+
}
4352
// Intentionally doing nothing on error
4453
}
4554
}

0 commit comments

Comments
 (0)