File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,10 +10,20 @@ const endpoints = {
1010 SettingsActivity : '1d3dc3e03047b0c7/settings' ,
1111}
1212
13+ async function gotoPage ( page : Awaited < ReturnType < BrowserContext [ 'newPage' ] > > , path : string ) {
14+ const url = `${ baseUrl } /${ path } `
15+ try {
16+ await page . goto ( url , { waitUntil : 'networkidle' } )
17+ } catch ( error ) {
18+ if ( ! ( error instanceof Error ) || ! error . message . includes ( 'ERR_ABORTED' ) ) throw error
19+ await page . goto ( url , { waitUntil : 'domcontentloaded' } )
20+ }
21+ }
22+
1323async function takeScreenshots ( deviceType : string , context : BrowserContext ) {
1424 const page = await context . newPage ( )
1525 for ( const [ route , path ] of Object . entries ( endpoints ) ) {
16- await page . goto ( ` ${ baseUrl } / ${ path } ` , { waitUntil : 'networkidle' } )
26+ await gotoPage ( page , path )
1727 await page . waitForTimeout ( 1500 )
1828 await page . screenshot ( { path : `${ outDir } /${ route } -${ deviceType } .playwright.png` } )
1929 console . log ( `${ route } -${ deviceType } .playwright.png` )
You can’t perform that action at this time.
0 commit comments