From dbcf7758bf2a48c8a3c3ec4f377c5531044a818b Mon Sep 17 00:00:00 2001 From: Mahmoud El-Sharkawy Date: Sat, 23 Jan 2021 23:46:38 +0200 Subject: [PATCH 1/3] Enable the maximum performance mode but without the headless execution Ticket #241 --- .../com/shaft/tools/io/PropertyFileManager.java | 9 ++++++--- src/main/javadoc/index.html | 13 ++++++++++--- .../defaultProperties/PlatformFlags.properties | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/shaft/tools/io/PropertyFileManager.java b/src/main/java/com/shaft/tools/io/PropertyFileManager.java index 4e3aedfbfc2..366230aad29 100644 --- a/src/main/java/com/shaft/tools/io/PropertyFileManager.java +++ b/src/main/java/com/shaft/tools/io/PropertyFileManager.java @@ -136,10 +136,10 @@ public static String getDefaultPropertiesFolderPath() { * */ private static void manageMaximumPerformanceMode() { - if (Boolean.TRUE.equals(Boolean.valueOf(System.getProperty("maximumPerformanceMode")))) { + String maximumPerformanceMode = System.getProperty("maximumPerformanceMode"); + if (!maximumPerformanceMode.equals("0")) { // Beast Mode On System.setProperty("aiPoweredSelfHealingElementIdentification", String.valueOf(false)); - System.setProperty("headlessExecution", String.valueOf(true)); System.setProperty("autoMaximizeBrowserWindow", String.valueOf(true)); System.setProperty("forceCheckForElementVisibility", String.valueOf(false)); System.setProperty("forceCheckElementLocatorIsUnique", String.valueOf(false)); @@ -151,8 +151,11 @@ private static void manageMaximumPerformanceMode() { System.setProperty("createAnimatedGif", String.valueOf(false)); System.setProperty("recordVideo", String.valueOf(false)); System.setProperty("debugMode", String.valueOf(false)); + switch (maximumPerformanceMode) { + case ("1") -> System.setProperty("headlessExecution", String.valueOf(false)); + case ("2") -> System.setProperty("headlessExecution", String.valueOf(true)); + } } - } private static void loadPropertiesFileIntoSystemProperties(Properties properties, File propertyFile) { diff --git a/src/main/javadoc/index.html b/src/main/javadoc/index.html index 67343be19f6..63a813391ab 100644 --- a/src/main/javadoc/index.html +++ b/src/main/javadoc/index.html @@ -378,15 +378,22 @@

Configuration Manager

+
+
+
ExperimentalFeature* Enabling maximumPerformanceMode will disable all complementary features to ensure the fastest execution possible with a 400% calculated performance boost. diff --git a/src/main/resources/defaultProperties/PlatformFlags.properties b/src/main/resources/defaultProperties/PlatformFlags.properties index 26e8df6f1c1..ae2b9fee683 100644 --- a/src/main/resources/defaultProperties/PlatformFlags.properties +++ b/src/main/resources/defaultProperties/PlatformFlags.properties @@ -6,7 +6,7 @@ autoMaximizeBrowserWindow=true forceCheckForElementVisibility=true forceCheckElementLocatorIsUnique=true forceCheckTextWasTypedCorrectly=true -maximumPerformanceMode=false +maximumPerformanceMode=0 skipTestsWithLinkedIssues=false aiPoweredSelfHealingElementIdentification=false ################################################### From bd3f91a9726239593f04b341901ff1326973fcc4 Mon Sep 17 00:00:00 2001 From: Mahmoud El-Sharkawy Date: Sun, 24 Jan 2021 17:15:38 +0200 Subject: [PATCH 2/3] Add default for the maximumPerformanceMode switch case --- src/main/java/com/shaft/tools/io/PropertyFileManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/shaft/tools/io/PropertyFileManager.java b/src/main/java/com/shaft/tools/io/PropertyFileManager.java index 366230aad29..cf57863a34e 100644 --- a/src/main/java/com/shaft/tools/io/PropertyFileManager.java +++ b/src/main/java/com/shaft/tools/io/PropertyFileManager.java @@ -1,6 +1,7 @@ package com.shaft.tools.io; import com.shaft.cli.FileActions; +import com.shaft.validation.Assertions; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.SystemUtils; @@ -154,6 +155,10 @@ private static void manageMaximumPerformanceMode() { switch (maximumPerformanceMode) { case ("1") -> System.setProperty("headlessExecution", String.valueOf(false)); case ("2") -> System.setProperty("headlessExecution", String.valueOf(true)); + default -> { + ReportManager.log("Unexpected maximumPerformanceMode Property value: " + maximumPerformanceMode); + Assertions.assertFail("Unexpected maximumPerformanceMode Property value: " + maximumPerformanceMode); + } } } } From 356234fe3032f816749d177cc2aedf15ec407e04 Mon Sep 17 00:00:00 2001 From: Mahmoud El-Sharkawy Date: Mon, 25 Jan 2021 23:08:12 +0200 Subject: [PATCH 3/3] Update test.yml update maximumPerformanceMode value in test.yml file --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0a9de5327f3..37c7985e947 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: run: docker ps - name: Run all tests continue-on-error: true - run: mvn test -DexecutionAddress="localhost:4444" -DtargetOperatingSystem="Linux-64" -DmaximumPerformanceMode="true" -DtargetBrowserName="GoogleChrome" -Dtest="!%regex[.*checksum.*], !%regex[.*cucumber.*], !%regex[.*sikulix.*], !%regex[.*imageComparison.*], !%regex[.*FileActions.*], !%regex[.*TerminalActions.*], !%regex[.*localShell.*], !%regex[.*fullPageScreenshotWithHeader.*], !%regex[.*dbConnection.*], !%regex[.*Appium.*]" + run: mvn test -DexecutionAddress="localhost:4444" -DtargetOperatingSystem="Linux-64" -DmaximumPerformanceMode="2" -DtargetBrowserName="GoogleChrome" -Dtest="!%regex[.*checksum.*], !%regex[.*cucumber.*], !%regex[.*sikulix.*], !%regex[.*imageComparison.*], !%regex[.*FileActions.*], !%regex[.*TerminalActions.*], !%regex[.*localShell.*], !%regex[.*fullPageScreenshotWithHeader.*], !%regex[.*dbConnection.*], !%regex[.*Appium.*]" - name: Generate Allure Report with history uses: simple-elf/allure-report-action@v1.3 with: