File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,17 @@ const PAGES = [
123123 } ,
124124] ;
125125
126+ async function retry ( fn , retries = 1 , delayMs = 1000 ) {
127+ for ( let i = 0 ; i <= retries ; i ++ ) {
128+ try {
129+ return await fn ( ) ;
130+ } catch ( err ) {
131+ if ( i === retries ) throw err ;
132+ await new Promise ( ( r ) => setTimeout ( r , delayMs ) ) ;
133+ }
134+ }
135+ }
136+
126137// Loops through each page config, performing:
127138// - checkPath
128139// - checkButton
@@ -133,7 +144,7 @@ async function runChecks(page) {
133144 await checkPath ( page , path ) ;
134145 await page . goto ( `${ BASE_URL } ${ path } ` , { waitUntil : "networkidle" } ) ;
135146 for ( const btn of buttons ) {
136- await checkButton ( page , path , btn ) ;
147+ await retry ( ( ) => checkButton ( page , path , btn ) ) ;
137148 }
138149 for ( const lnk of links ) {
139150 await checkLink ( page , path , lnk ) ;
You can’t perform that action at this time.
0 commit comments