Skip to content

Commit 96a82a4

Browse files
Enable the maximum performance mode with and without the headless execution (#242)
* Enable the maximum performance mode but without the headless execution Ticket #241 * Add default for the maximumPerformanceMode switch case * Update test.yml update maximumPerformanceMode value in test.yml file
1 parent 21ab575 commit 96a82a4

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
run: docker ps
2323
- name: Run all tests
2424
continue-on-error: true
25-
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.*]"
25+
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.*]"
2626
- name: Generate Allure Report with history
2727
uses: simple-elf/[email protected]
2828
with:

src/main/java/com/shaft/tools/io/PropertyFileManager.java

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.shaft.tools.io;
22

33
import com.shaft.cli.FileActions;
4+
import com.shaft.validation.Assertions;
45
import org.apache.commons.io.FileUtils;
56
import org.apache.commons.lang3.SystemUtils;
67

@@ -136,10 +137,10 @@ public static String getDefaultPropertiesFolderPath() {
136137
* </ul>
137138
*/
138139
private static void manageMaximumPerformanceMode() {
139-
if (Boolean.TRUE.equals(Boolean.valueOf(System.getProperty("maximumPerformanceMode")))) {
140+
String maximumPerformanceMode = System.getProperty("maximumPerformanceMode");
141+
if (!maximumPerformanceMode.equals("0")) {
140142
// Beast Mode On
141143
System.setProperty("aiPoweredSelfHealingElementIdentification", String.valueOf(false));
142-
System.setProperty("headlessExecution", String.valueOf(true));
143144
System.setProperty("autoMaximizeBrowserWindow", String.valueOf(true));
144145
System.setProperty("forceCheckForElementVisibility", String.valueOf(false));
145146
System.setProperty("forceCheckElementLocatorIsUnique", String.valueOf(false));
@@ -151,8 +152,15 @@ private static void manageMaximumPerformanceMode() {
151152
System.setProperty("createAnimatedGif", String.valueOf(false));
152153
System.setProperty("recordVideo", String.valueOf(false));
153154
System.setProperty("debugMode", String.valueOf(false));
155+
switch (maximumPerformanceMode) {
156+
case ("1") -> System.setProperty("headlessExecution", String.valueOf(false));
157+
case ("2") -> System.setProperty("headlessExecution", String.valueOf(true));
158+
default -> {
159+
ReportManager.log("Unexpected maximumPerformanceMode Property value: " + maximumPerformanceMode);
160+
Assertions.assertFail("Unexpected maximumPerformanceMode Property value: " + maximumPerformanceMode);
161+
}
162+
}
154163
}
155-
156164
}
157165

158166
private static void loadPropertiesFileIntoSystemProperties(Properties properties, File propertyFile) {

src/main/javadoc/index.html

+10-3
Original file line numberDiff line numberDiff line change
@@ -378,15 +378,22 @@ <h1>Configuration Manager</h1>
378378
<div class="radio-inline">
379379
<label for="maximumPerformanceMode-0">
380380
<input id="maximumPerformanceMode-0"
381-
name="maximumPerformanceMode" type="radio" value="true">
382-
Enabled
381+
name="maximumPerformanceMode" type="radio" value="0">
382+
Disabled
383383
</label>
384384
</div>
385385
<div class="radio-inline">
386386
<label for="maximumPerformanceMode-1">
387387
<input checked="checked" id="maximumPerformanceMode-1"
388388
name="maximumPerformanceMode"
389-
type="radio" value="false"> Disabled
389+
type="radio" value="1"> Without Headless Execution
390+
</label>
391+
</div>
392+
<div class="radio-inline">
393+
<label for="maximumPerformanceMode-2">
394+
<input checked="checked" id="maximumPerformanceMode-2"
395+
name="maximumPerformanceMode"
396+
type="radio" value="2"> With Headless Execution
390397
</label>
391398
</div>
392399
<span class="help-block"><b>ExperimentalFeature* </b>Enabling maximumPerformanceMode will disable all complementary features to ensure the fastest execution possible with a 400% calculated performance boost.</span>

src/main/resources/defaultProperties/PlatformFlags.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ autoMaximizeBrowserWindow=true
66
forceCheckForElementVisibility=true
77
forceCheckElementLocatorIsUnique=true
88
forceCheckTextWasTypedCorrectly=true
9-
maximumPerformanceMode=false
9+
maximumPerformanceMode=0
1010
skipTestsWithLinkedIssues=false
1111
aiPoweredSelfHealingElementIdentification=false
1212
###################################################

0 commit comments

Comments
 (0)