From fbccf71aabb87e4d2e2756d573c2871b89f5249c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= <die.drei99@yahoo.de>
Date: Fri, 27 Oct 2023 10:12:45 +0200
Subject: [PATCH 1/4] add cooldown period

---
 tests/e2e/config.js     | 3 +++
 tests/e2e/testRunner.js | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/tests/e2e/config.js b/tests/e2e/config.js
index 3b1856ab8ad8..d723682f79c1 100644
--- a/tests/e2e/config.js
+++ b/tests/e2e/config.js
@@ -46,6 +46,9 @@ module.exports = {
     // The time in milliseconds after which an operation fails due to timeout
     INTERACTION_TIMEOUT: 300000,
 
+    // Period we wait between each test runs, to let the device cool down
+    COOL_DOWN: 90 * 1000,
+
     TEST_NAMES,
 
     /**
diff --git a/tests/e2e/testRunner.js b/tests/e2e/testRunner.js
index 5c6c33bdf7e9..9bdbdfe8efe8 100644
--- a/tests/e2e/testRunner.js
+++ b/tests/e2e/testRunner.js
@@ -250,6 +250,15 @@ const runTests = async () => {
             }
         }
         testLog.done();
+
+        // If we still have tests add a cool down period
+        if (testIndex < numOfTests - 1) {
+            const coolDownLogs = Logger.progressInfo(`Cooling down for ${config.COOL_DOWN / 1000}s`);
+            coolDownLogs.updateText(`Cooling down for ${config.COOL_DOWN / 1000}s`);
+            // eslint-disable-next-line no-loop-func
+            await new Promise((resolve) => setTimeout(resolve, config.COOL_DOWN));
+            coolDownLogs.done();
+        }
     }
 
     // Calculate statistics and write them to our work file

From 0826b1123f5f38a5b870d6818193116f522be90b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= <die.drei99@yahoo.de>
Date: Fri, 27 Oct 2023 10:19:01 +0200
Subject: [PATCH 2/4] increase threshold

---
 tests/e2e/compare/compare.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/e2e/compare/compare.js b/tests/e2e/compare/compare.js
index 9d40ab2bf312..63d8697e4053 100644
--- a/tests/e2e/compare/compare.js
+++ b/tests/e2e/compare/compare.js
@@ -24,7 +24,7 @@ const PROBABILITY_CONSIDERED_SIGNIFICANCE = 0.02;
  * This is additional filter, in addition to probability threshold above.
  * Too small duration difference might be result of measurement grain of 1 ms.
  */
-const DURATION_DIFF_THRESHOLD_SIGNIFICANCE = 50;
+const DURATION_DIFF_THRESHOLD_SIGNIFICANCE = 100;
 
 const loadFile = (path) =>
     fs.readFile(path, 'utf8').then((data) => {

From c469811033001aa5f53efca024b81b013257c9d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= <die.drei99@yahoo.de>
Date: Fri, 27 Oct 2023 10:19:12 +0200
Subject: [PATCH 3/4] increase test runs

---
 tests/e2e/config.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/e2e/config.js b/tests/e2e/config.js
index d723682f79c1..dae35321fda3 100644
--- a/tests/e2e/config.js
+++ b/tests/e2e/config.js
@@ -31,7 +31,7 @@ module.exports = {
     SERVER_PORT: 4723,
 
     // The amount of times a test should be executed for average performance metrics
-    RUNS: 60,
+    RUNS: 80,
 
     DEFAULT_BASELINE_BRANCH: 'main',
 

From ca2b3e2ba77fe350c7c2c8012aaf5aae02747eb7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= <die.drei99@yahoo.de>
Date: Mon, 30 Oct 2023 09:50:06 +0100
Subject: [PATCH 4/4] fix e2e tests after eslint/prettier import changes

---
 .prettierignore                          | 2 ++
 src/libs/E2E/reactNativeLaunchingTest.js | 3 +--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/.prettierignore b/.prettierignore
index 5f6292b551c1..80888b18a317 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -15,3 +15,5 @@ package-lock.json
 *.css
 *.scss
 *.md
+# We need to modify the import here specifically, hence we disable prettier to get rid of the sorted imports
+src/libs/E2E/reactNativeLaunchingTest.js
diff --git a/src/libs/E2E/reactNativeLaunchingTest.js b/src/libs/E2E/reactNativeLaunchingTest.js
index 1e0d6a8afa3b..7621e462f8c5 100644
--- a/src/libs/E2E/reactNativeLaunchingTest.js
+++ b/src/libs/E2E/reactNativeLaunchingTest.js
@@ -7,7 +7,6 @@
  */
 import * as Metrics from '@libs/Metrics';
 import Performance from '@libs/Performance';
-import '../../../index';
 import E2EConfig from '../../../tests/e2e/config';
 import E2EClient from './client';
 
@@ -65,5 +64,5 @@ E2EClient.getTestConfig()
 
 // start the usual app
 Performance.markStart('regularAppStart');
-
+import '../../../index';
 Performance.markEnd('regularAppStart');