From 9405e5a2874fff382c2511de80fbc08528aa36cf Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Tue, 24 Sep 2024 17:44:43 +0200 Subject: [PATCH] e2e: allow warmup failures --- tests/e2e/testRunner.ts | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/e2e/testRunner.ts b/tests/e2e/testRunner.ts index 41d1d039913d..18caa9495409 100644 --- a/tests/e2e/testRunner.ts +++ b/tests/e2e/testRunner.ts @@ -246,16 +246,35 @@ const runTests = async (): Promise => { const warmupText = `Warmup for test '${test.name}' [${testIndex + 1}/${tests.length}]`; + // For each warmup we allow the warmup to fail three times before we stop the warmup run: + const errorCountWarmupRef = { + errorCount: 0, + allowedExceptions: 3, + }; + // by default we do 2 warmups: // - first warmup to pass a login flow // - second warmup to pass an actual flow and cache network requests const iterations = 2; for (let i = 0; i < iterations; i++) { - // Warmup the main app: - await runTestIteration(config.MAIN_APP_PACKAGE, `[MAIN] ${warmupText}. Iteration ${i + 1}/${iterations}`, config.BRANCH_MAIN); + try { + // Warmup the main app: + await runTestIteration(config.MAIN_APP_PACKAGE, `[MAIN] ${warmupText}. Iteration ${i + 1}/${iterations}`, config.BRANCH_MAIN); + + // Warmup the delta app: + await runTestIteration(config.DELTA_APP_PACKAGE, `[DELTA] ${warmupText}. Iteration ${i + 1}/${iterations}`, config.BRANCH_DELTA); + } catch (e) { + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + Logger.error(`Warmup failed with error: ${e}`); + + errorCountWarmupRef.errorCount++; + i--; // repeat warmup again - // Warmup the delta app: - await runTestIteration(config.DELTA_APP_PACKAGE, `[DELTA] ${warmupText}. Iteration ${i + 1}/${iterations}`, config.BRANCH_DELTA); + if (errorCountWarmupRef.errorCount === errorCountWarmupRef.allowedExceptions) { + Logger.error("There was an error running the warmup and we've reached the maximum number of allowed exceptions. Stopping the test run."); + throw e; + } + } } server.setReadyToAcceptTestResults(true);