diff --git a/test/helpers.ts b/test/helpers.ts index ceb71a1185..ad057e149b 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -280,13 +280,14 @@ export function prettyPrintPuppeteerAssertionError(message) { } } -export async function retryAsync(fn: () => Promise, maxAttempts: number = 3): Promise { +export async function retryAsync(fn: () => Promise, maxAttempts: number = 3, interval: number = 1000): Promise { let attempts = 0; while (attempts <= maxAttempts) { try { return await fn(); } catch (err) { if (++attempts >= maxAttempts) throw err; + new Promise(resolve => setTimeout(resolve, interval)); } } }