Skip to content

Commit

Permalink
Do not add CLOUD_NAME when generating reports for CLI or API tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anandbagmar committed Nov 20, 2024
1 parent 08bc510 commit 19192c3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/znsio/teswiz/runner/DeviceSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ private static void fetchAppVersion(String[] commandToGetAppVersion, Pattern pat
}

static String getCloudNameFromCapabilities() {
if (Runner.isRunningInCI()) {
if (Runner.isRunningInCI() && !Runner.isAPI() && !Runner.isCLI()) {
String capabilityFile = Setup.getFromConfigs(CAPS);
return JsonFile.getValueFromLoadedJsonMap(capabilityFile,
new String[]{"serverConfig", "server", "plugin",
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/znsio/teswiz/runner/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ public static boolean isRunningInCI() {
return Setup.getBooleanValueFromConfigs(Setup.RUN_IN_CI);
}

public static boolean isCLI() {
return Runner.getPlatform().equals(Platform.cli);
}

public static boolean isAPI() {
return Runner.getPlatform().equals(Platform.api);
}

public static String getBrowser() {
return Setup.getFromConfigs(Setup.BROWSER);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/znsio/teswiz/runner/Setup.java
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ private static void setupListenersForWebOrAPIOrCLIExecution(ArrayList<String> we
}

static Map<String, Object> initialiseApplitoolsConfiguration() {
if (applitoolsConfiguration.isEmpty() && !Runner.getPlatform().equals(Platform.api) && !Runner.getPlatform().equals(Platform.cli)) {
if (applitoolsConfiguration.isEmpty() && !Runner.isAPI() && !Runner.isCLI()) {
getApplitoolsConfigFromProvidedConfigFile();
applitoolsConfiguration.put(APPLITOOLS.SERVER_URL, getServerUrl());
applitoolsConfiguration.put(APPLITOOLS.APP_NAME, configs.get(APP_NAME));
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/znsio/teswiz/steps/Hooks.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void beforeScenario(Scenario scenario) {
scenario.getName()));
LOGGER.info(String.format("Hooks: Running test %s on %s", testExecutionContext.getTestName(),
Runner.getPlatform().name()));
if (!Runner.getPlatform().equals(Platform.api) || !Runner.getPlatform().equals(Platform.cli)) {
if (!Runner.isAPI() || !Runner.isCLI()) {
testExecutionContext.addTestState(TEST_CONTEXT.SCREENSHOT_MANAGER, new ScreenShotManager());
}
testExecutionContext.addTestState(TEST_CONTEXT.CURRENT_USER_PERSONA_DETAILS,
Expand All @@ -60,7 +60,7 @@ public void afterScenario(Scenario scenario) {
}

private void startTheAsyncCommandLineExecutor() {
if (Runner.getPlatform().equals(Platform.cli)) {
if (Runner.isCLI()) {
LOGGER.info("Start the AsyncCommandLineExecutor");
testExecutionContext.addTestState(TEST_CONTEXT.CLI_COMMAND_NUMBER, 1);
AsyncCommandLineExecutor asyncCommandLineExecutor = new AsyncCommandLineExecutor();
Expand Down Expand Up @@ -105,7 +105,7 @@ private void addSystemPropertiesToReportPortal() {
}

private void closeTheAsyncCommandLineExecutor() {
if (Runner.getPlatform().equals(Platform.cli)) {
if (Runner.isCLI()) {
LOGGER.info("Close the AsyncCommandLineExecutor");
AsyncCommandLineExecutor asyncCommandLineExecutor = (AsyncCommandLineExecutor) testExecutionContext.getTestState(TEST_CONTEXT.ASYNC_COMMAND_LINE_EXECUTOR);
asyncCommandLineExecutor.close();
Expand Down

0 comments on commit 19192c3

Please sign in to comment.