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