File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
packages/flex-plugin-e2e-tests/src/utils/pages/view Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 11import { logger } from '@twilio/flex-dev-utils' ;
22import { ElementHandle , Page , PuppeteerLifeCycleEvent } from 'puppeteer' ;
33
4+ import { sleep } from '../../timers' ;
5+
46export 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 }
You can’t perform that action at this time.
0 commit comments