From c5782b556b53ce4fdd9c94038e73942d4f0f0045 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Thu, 24 Oct 2024 15:19:32 +0200 Subject: [PATCH] fix: proper handle a case, when app is totally unusable and always crashes --- tests/e2e/testRunner.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/e2e/testRunner.ts b/tests/e2e/testRunner.ts index d1e16b6999e1..ba6ed7a2a335 100644 --- a/tests/e2e/testRunner.ts +++ b/tests/e2e/testRunner.ts @@ -165,7 +165,7 @@ const runTests = async (): Promise => { await launchApp('android', appPackage, config.ACTIVITY_PATH, launchArgs); const {promise, resetTimeout} = withFailTimeout( - new Promise((resolve) => { + new Promise((resolve, reject) => { const removeListener = server.addTestDoneListener(() => { Logger.success(iterationText); @@ -215,9 +215,14 @@ const runTests = async (): Promise => { removeListener(); // something went wrong, let's wait a little bit and try again await sleep(5000); - // simply restart the test - await runTestIteration(appPackage, iterationText, branch, launchArgs); - resolve(); + try { + // simply restart the test + await runTestIteration(appPackage, iterationText, branch, launchArgs); + resolve(); + } catch (e) { + // okay, give up and throw the exception further + reject(e); + } }, }); }),