diff --git a/build.gradle b/build.gradle index a4ed8ecf3..9e383f901 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ -import java.text.SimpleDateFormat import org.codehaus.groovy.runtime.GStringImpl +import java.text.SimpleDateFormat + buildscript { ext { gradleVersion = "8.12" @@ -31,20 +32,17 @@ plugins { id "org.sonarqube" version "6.0.1.5171" id "java" id "idea" - id "com.github.johnrengelman.shadow" version '8.1.1' + id "com.gradleup.shadow" version '8.3.5' id "maven-publish" id "io.freefair.aspectj.post-compile-weaving" version "8.11" } group = 'com.github.znsio' -version '1.0.12' +version = '1.0.13-noATD' java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 - toolchain { - languageVersion = JavaLanguageVersion.of(17) - } } repositories { @@ -54,7 +52,7 @@ repositories { } mavenCentral() maven { - url 'https://jitpack.io' + url = 'https://jitpack.io' } } @@ -139,31 +137,13 @@ task downloadDependencies { doLast { println "Downloading required dependencies..." def dependencies = [ -// [ -// name : "teswiz", -// type : "github", -// params: [ -// repoUrl: "https://api.github.com/repos/znsio/teswiz/releases/latest", -// version: "$project.teswizVersion" -// ] -// ], - [ - name : "AppiumTestDistribution", - type : "jitpack", - params: [ - group : "com.github.AppiumTestDistribution", - artifact: "AppiumTestDistribution", - version : "$project.atdVersion", - fileNameSuffix: "-jar-with-dependencies" - ] - ], [ name : "jadb", type : "jitpack", params: [ - group : "com.github.vidstige", - artifact: "jadb", - version : "$project.jadbVersion", + group : "com.github.vidstige", + artifact : "jadb", + version : "$project.jadbVersion", fileNameSuffix: "" ] ] @@ -187,40 +167,73 @@ tasks.compileJava { } dependencies { + // Local JAR dependencies implementation fileTree(dir: "$project.projectDir/libs", include: ['*.jar']) - implementation files(layout.buildDirectory.files("/classes/main")) - implementation files(layout.buildDirectory.files("/classes/test")) - implementation ("com.github.AppiumTestDistribution:AppiumTestDistribution:$project.atdVersion") { - exclude group: 'io.appium', module: 'java-client' - } - implementation "com.github.vidstige:jadb:$project.jadbVersion" + + // Build-specific directories + implementation files(layout.buildDirectory.dir("classes/main")) + implementation files(layout.buildDirectory.dir("classes/test")) + + // Logging + implementation "org.apache.logging.log4j:log4j-api:2.24.3" + implementation "org.apache.logging.log4j:log4j-core:2.24.3" +// implementation "org.apache.logging.log4j:log4j-1.2-api:2.24.3" + + // JSON and YAML processing implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$project.fasterxmlJacksonVersion" - implementation "com.konghq:unirest-java:$project.unirestVersion" +// implementation "org.yaml:snakeyaml:$project.snakeyamlVersion" + implementation "com.flipkart.zjsonpatch:zjsonpatch:$project.jsonDiffVersion" + + // Assertions and testing implementation "org.assertj:assertj-core:$project.assertJVersion" - implementation "org.apache.commons:commons-lang3:$project.commonsLang3Version" - implementation "org.apache.commons:commons-rng-simple:$project.commonsRngSimpleVersion" - implementation "org.jetbrains:annotations:$project.jetbrainsAnnotationsVersion" - implementation "org.junit.jupiter:junit-jupiter:$project.junitVersion" - implementation "joda-time:joda-time:$project.jodaTimeVersion" +// implementation "org.junit.jupiter:junit-jupiter:$project.junitVersion" +// implementation "org.testng:testng:7.10.2" + implementation "io.cucumber:cucumber-java:7.20.1" + implementation "io.cucumber:cucumber-testng:7.20.1" + + // Unirest for API testing + implementation "com.konghq:unirest-java:$project.unirestVersion" + + // Appium and BrowserStack +// implementation "io.appium:java-client:9.3.0" implementation "com.browserstack:browserstack-local-java:$project.browserStackLocalVersion" + + // Applitools for visual testing implementation "com.applitools:eyes-images-java5:$project.applitoolsImagesVersion" - implementation("com.applitools:eyes-appium-java5:$project.applitoolsAppiumVersion") { -// exclude group: 'io.appium', module: 'java-client' - } - implementation "net.masterthought:cucumber-reporting:$masterThoughtVersion" + implementation "com.applitools:eyes-appium-java5:$project.applitoolsAppiumVersion" + + // Aspect-Oriented Programming (AOP) implementation "org.aspectj:aspectjrt:$project.aspectJVersion" + + // Specmatic and JSON Schema validation implementation "in.specmatic:specmatic-core:${project.specmaticVersion}" + implementation "org.everit.json:org.everit.json.schema:1.5.1" + implementation 'com.jayway.jsonpath:json-path:2.9.0' + + // Utility libraries + implementation "org.apache.commons:commons-lang3:$project.commonsLang3Version" + implementation "org.apache.commons:commons-rng-simple:$project.commonsRngSimpleVersion" + implementation "org.jetbrains:annotations:$project.jetbrainsAnnotationsVersion" + implementation "joda-time:joda-time:$project.jodaTimeVersion" implementation "io.github.bonigarcia:webdrivermanager:$project.webDriverManagerVersion" - implementation "org.yaml:snakeyaml:$project.snakeyamlVersion" - implementation "com.flipkart.zjsonpatch:zjsonpatch:$project.jsonDiffVersion" + + // Reporting + implementation "net.masterthought:cucumber-reporting:$masterThoughtVersion" + implementation 'com.epam.reportportal:agent-java-cucumber6:5.3.4' + + // PDF handling implementation "org.apache.pdfbox:pdfbox:$project.pdfBoxVersion" + + // Lombok + implementation 'org.projectlombok:lombok:1.18.36' } + shadowJar { archiveBaseName.set("$project.name") archiveClassifier.set('') archiveVersion.set("$project.version") - zip64 true + zip64 = true manifest { attributes "Multi-Release": true attributes "Main-Class": "com.znsio.e2e.runner.Runner" @@ -360,8 +373,17 @@ tasks.register('run', JavaExec) { } test { - useJUnitPlatform() + doFirst { + println "Using LOG_DIR for tests: ${project.logDir}" + def logDir = new File("${project.logDir}") + systemProperty "LOG_DIR", "${project.logDir}" + if (!logDir.exists()) { + logDir.mkdirs() + println "Created log directory at: ${logDir.absolutePath}" + } + } + useTestNG() outputs.upToDateWhen { false } testLogging { @@ -379,7 +401,6 @@ test { if (System.getProperty('debug', 'false') == 'true') { jvmArgs '-Xdebug', '-agentlib:jdwp=transport=dt_socket,server=n,address=192.168.29.248:9009,suspend=y' } - println "Using LOG_DIR: ${project.logDir}" reports { html.required.set(true) junitXml.required.set(true) @@ -389,7 +410,7 @@ test { } tasks.withType(JavaCompile).configureEach { - options.compilerArgs += ['--release', '17'] + options.compilerArgs += ['--release', '17', '-Xlint:deprecation'] } tasks.withType(JavaExec).configureEach { diff --git a/src/main/java/com/znsio/teswiz/context/SessionContext.java b/src/main/java/com/znsio/teswiz/context/SessionContext.java new file mode 100755 index 000000000..c4ebc870a --- /dev/null +++ b/src/main/java/com/znsio/teswiz/context/SessionContext.java @@ -0,0 +1,104 @@ +package com.znsio.teswiz.context; + +import com.znsio.teswiz.listener.CucumberScenarioListener; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.testng.ITestContext; + + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Optional; +import java.util.Properties; + +import static com.znsio.teswiz.tools.OverriddenVariable.getOverriddenStringValue; + + +public class SessionContext { + static final String TEST_RUNNER = "testrunner"; + private static final HashMap allTestsExecutionContext; + private static final Logger LOGGER = LogManager.getLogger(SessionContext.class.getName()); + private static final Properties reportPortalProperties; + private static String reportPortalLaunchURL = ""; + + static { + LOGGER.info("SessionContext default constructor"); + new SessionContext(); + allTestsExecutionContext = new HashMap<>(); + reportPortalProperties = loadReportPortalProperties(); + LOGGER.info("Initialized SessionContext"); + } + + static synchronized void addContext(long threadId, TestExecutionContext testExecutionContext) { + allTestsExecutionContext.put(String.valueOf(threadId), testExecutionContext); + LOGGER.info(String.format("Adding context for thread - %s", threadId)); + } + + public static synchronized TestExecutionContext getTestExecutionContext(long threadId) { + return allTestsExecutionContext.get(String.valueOf(threadId)); + } + + public static synchronized void remove(long threadId) { + LOGGER.info(String.format("Removing context for thread - %s", threadId)); + allTestsExecutionContext.remove(String.valueOf(threadId)); + } + + private static Properties loadReportPortalProperties() { + Properties properties = new Properties(); + try { + String reportPortalPropertiesFile = "src/test/resources/reportportal.properties"; + getOverriddenStringValue("REPORT_PORTAL_FILE", reportPortalPropertiesFile); + LOGGER.info("Using reportportal.properties file from " + + reportPortalPropertiesFile); + File reportPortalFile = new File(reportPortalPropertiesFile); + String absolutePath = reportPortalFile.getAbsolutePath(); + if (reportPortalFile.exists()) { + properties.load(new FileInputStream(absolutePath)); + LOGGER.info("Loaded reportportal.properties file - " + absolutePath); + } else { + LOGGER.info("reportportal.properties file NOT FOUND - " + absolutePath); + } + + } catch (IOException e) { + LOGGER.info("ERROR in loading reportportal.properties file\n" + e.getMessage()); + throw new RuntimeException(e.getMessage()); + } + return properties; + } + + public static void setReportPortalLaunchURL(ITestContext iTestContext) { + Optional reportPortalListener = Arrays.stream(iTestContext.getSuite().getXmlSuite() + .getListeners().toArray()).filter(x -> + x.equals("com.epam.reportportal.testng.ReportPortalTestNGListener")) + .findFirst(); + if (reportPortalListener.isPresent()) { + setReportPortalLaunchURL(); + } + } + + public static String getReportPortalLaunchURL() { + return reportPortalLaunchURL; + } + + public static void setReportPortalLaunchURL() { + boolean isReportPortalEnabledInProperties = + (null == reportPortalProperties.getProperty("rp.enable") + || (reportPortalProperties.getProperty("rp.enable") + .equalsIgnoreCase("true"))); + if (isReportPortalEnabledInProperties) { + String rpLaunchId = System.getProperty("rp.launch.id"); + LOGGER.debug(String.format("System property: rp.launch.id: '%s'", + rpLaunchId)); + reportPortalLaunchURL = String.format("%s/ui/#%s/launches/all/%s", + reportPortalProperties.getProperty("rp.endpoint"), + reportPortalProperties.getProperty("rp.project"), + rpLaunchId); + LOGGER.info(String.format( + "**** ReportPortal URL - %s ****", + reportPortalLaunchURL)); + } + } +} diff --git a/src/main/java/com/znsio/teswiz/context/TestExecutionContext.java b/src/main/java/com/znsio/teswiz/context/TestExecutionContext.java new file mode 100755 index 000000000..0cfa9741a --- /dev/null +++ b/src/main/java/com/znsio/teswiz/context/TestExecutionContext.java @@ -0,0 +1,40 @@ +package com.znsio.teswiz.context; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.HashMap; + +public class TestExecutionContext { + private final String testName; + private final HashMap testExecutionState; + private final String NOT_SET = "NOT-YET-SET"; + private static final Logger LOGGER = LogManager.getLogger(TestExecutionContext.class.getName()); + + public TestExecutionContext(String testName) { + SessionContext.addContext(Thread.currentThread().getId(), this); + this.testName = testName; + this.testExecutionState = new HashMap<>(); + LOGGER.info(String.format("%s - TestExecution context created", testName)); + } + + public String getTestName() { + return testName; + } + + public void addTestState(String key, Object details) { + testExecutionState.put(key, details); + } + + public Object getTestState(String key) { + return testExecutionState.get(key); + } + + public String getTestStateAsString(String key) { + return (String) testExecutionState.get(key); + } + + public HashMap getAllTestState() { + return testExecutionState; + } +} diff --git a/src/main/java/com/znsio/teswiz/entities/FileLocations.java b/src/main/java/com/znsio/teswiz/entities/FileLocations.java new file mode 100644 index 000000000..115be33d0 --- /dev/null +++ b/src/main/java/com/znsio/teswiz/entities/FileLocations.java @@ -0,0 +1,28 @@ +package com.znsio.teswiz.entities; + +import java.io.File; + +import static com.znsio.teswiz.tools.OverriddenVariable.getOverriddenStringValue; + +public interface FileLocations { + String OUTPUT_DIRECTORY = + getOverriddenStringValue("OUTPUT_DIRECTORY") != null + ? File.separator + getOverriddenStringValue("OUTPUT_DIRECTORY") + + File.separator + : File.separator + "target" + File.separator; + + String PARALLEL_XML_LOCATION = OUTPUT_DIRECTORY + "parallel.xml"; + + String SERVER_CONFIG = OUTPUT_DIRECTORY + "server.json"; + String REPORTS_DIRECTORY = OUTPUT_DIRECTORY + "reports" + File.separator; + + String SCREENSHOTS_DIRECTORY = OUTPUT_DIRECTORY + "screenshot" + File.separator; + String ANDROID_SCREENSHOTS_DIRECTORY = SCREENSHOTS_DIRECTORY + "android" + File.separator; + String IOS_SCREENSHOTS_DIRECTORY = SCREENSHOTS_DIRECTORY + "iOS" + File.separator; + + String APPIUM_LOGS_DIRECTORY = OUTPUT_DIRECTORY + "appiumlogs" + File.separator; + String ADB_LOGS_DIRECTORY = OUTPUT_DIRECTORY + "adblogs" + File.separator; + String DEVICE_LOGS_DIRECTORY = "deviceLogs" + File.separator; + String TEST_LOGS_DIRECTORY = "testLogs" + File.separator; + String DERIVED_DATA = OUTPUT_DIRECTORY + "derivedData" + File.separator; +} diff --git a/src/main/java/com/znsio/teswiz/listener/CucumberPlatformScenarioListener.java b/src/main/java/com/znsio/teswiz/listener/CucumberPlatformScenarioListener.java index 82e5fed78..29e91aa42 100644 --- a/src/main/java/com/znsio/teswiz/listener/CucumberPlatformScenarioListener.java +++ b/src/main/java/com/znsio/teswiz/listener/CucumberPlatformScenarioListener.java @@ -1,8 +1,8 @@ package com.znsio.teswiz.listener; -import com.appium.filelocations.FileLocations; -import com.context.SessionContext; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; +import com.znsio.teswiz.entities.FileLocations; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.TEST_CONTEXT; import com.znsio.teswiz.runner.Runner; diff --git a/src/main/java/com/znsio/teswiz/listener/CucumberPlatformScenarioReporterListener.java b/src/main/java/com/znsio/teswiz/listener/CucumberPlatformScenarioReporterListener.java index bbab20fa6..9837f784d 100644 --- a/src/main/java/com/znsio/teswiz/listener/CucumberPlatformScenarioReporterListener.java +++ b/src/main/java/com/znsio/teswiz/listener/CucumberPlatformScenarioReporterListener.java @@ -17,7 +17,7 @@ public class CucumberPlatformScenarioReporterListener public static String launchUUID; public CucumberPlatformScenarioReporterListener() { - LOGGER.info("CucumberScenarioReporterListener"); + LOGGER.info("CucumberPlatformScenarioReporterListener"); } @Override diff --git a/src/main/java/com/znsio/teswiz/listener/CucumberScenarioListener.java b/src/main/java/com/znsio/teswiz/listener/CucumberScenarioListener.java new file mode 100644 index 000000000..73cbdee29 --- /dev/null +++ b/src/main/java/com/znsio/teswiz/listener/CucumberScenarioListener.java @@ -0,0 +1,279 @@ +package com.znsio.teswiz.listener; + +import com.epam.reportportal.service.ReportPortal; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; +import com.znsio.teswiz.entities.FileLocations; +import com.znsio.teswiz.runner.AppiumDeviceManager; +import com.znsio.teswiz.runner.PluginClI; +import com.znsio.teswiz.tools.cmd.CommandLineExecutor; +import com.znsio.teswiz.tools.cmd.CommandLineResponse; +import io.appium.java_client.AppiumDriver; +import io.appium.java_client.CommandExecutionHelper; +import io.cucumber.plugin.ConcurrentEventListener; +import io.cucumber.plugin.event.*; +import lombok.SneakyThrows; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.json.JSONObject; +import org.openqa.selenium.logging.LogEntries; + +import java.io.File; +import java.io.PrintStream; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.stream.StreamSupport; + +import static com.znsio.teswiz.runner.Runner.NOT_SET; +import static com.znsio.teswiz.tools.OverriddenVariable.getOverriddenStringValue; + +public class CucumberScenarioListener implements ConcurrentEventListener { + private static final Logger LOGGER = LogManager.getLogger(CucumberScenarioListener.class.getName()); +// private final AppiumDriverManager appiumDriverManager; +// private final AppiumServerManager appiumServerManager; + private Map scenarioRunCounts = new HashMap(); + + public CucumberScenarioListener() throws Exception { + LOGGER.info(String.format("ThreadID: %d: CucumberScenarioListener%n", + Thread.currentThread().getId())); +// new ATDRunner(); +// appiumServerManager = new AppiumServerManager(); +// appiumDriverManager = new AppiumDriverManager(); + } + + private AppiumDriver allocateDeviceAndStartDriver(String scenarioName) { +// AppiumDriver driver = AppiumDriverManager.getDriver(); +// if (driver == null || driver.getSessionId() == null) { +// return appiumDriverManager.startAppiumDriverInstance(scenarioName); +// } else { +// return driver; +// } + return null; + } + + private String getCapabilityFor(org.openqa.selenium.Capabilities capabilities, String name) { + Object capability = capabilities.getCapability(name); + return null == capability ? "" : capability.toString(); + } + + @Override + public void setEventPublisher(EventPublisher eventPublisher) { + eventPublisher.registerHandlerFor(TestRunStarted.class, this::runStartedHandler); + eventPublisher.registerHandlerFor(TestCaseStarted.class, this::caseStartedHandler); + eventPublisher.registerHandlerFor(TestCaseFinished.class, this::caseFinishedHandler); + eventPublisher.registerHandlerFor(TestRunFinished.class, this::runFinishedHandler); + } + + private void runStartedHandler(TestRunStarted event) { + LOGGER.info("runStartedHandler"); + LOGGER.info(String.format("ThreadID: %d: beforeSuite: %n", + Thread.currentThread().getId())); + } + + public static File createFile(String dirName, String fileName) { + File logFile = new File(System.getProperty("user.dir") + + dirName + + fileName + ".txt"); + if (logFile.exists()) { + return logFile; + } + try { + logFile.getParentFile().mkdirs(); + logFile.createNewFile(); + } catch (Exception e) { + e.printStackTrace(); + } + return logFile; + } + + private void caseStartedHandler(TestCaseStarted event) { + String scenarioName = event.getTestCase().getName(); + LOGGER.info("$$$$$ TEST-CASE -- " + scenarioName + " STARTED $$$$$"); + LOGGER.info("caseStartedHandler: " + scenarioName); + Integer scenarioRunCount = getScenarioRunCount(scenarioName); + String normalisedScenarioName = normaliseScenarioName(scenarioName); + LOGGER.info( + String.format("ThreadID: %d: beforeScenario: for scenario: %s%n", + Thread.currentThread().getId(), scenarioName)); + String scenarioReportDirectory = FileLocations.REPORTS_DIRECTORY + + normalisedScenarioName + File.separator; + AppiumDriver createdAppiumDriver = allocateDeviceAndStartDriver(scenarioName); + String deviceLogFileName = startDataCapture(scenarioRunCount, + scenarioReportDirectory); + + TestExecutionContext testExecutionContext = new TestExecutionContext(scenarioName); + testExecutionContext.addTestState("appiumDriver", createdAppiumDriver); +// testExecutionContext.addTestState("deviceId", +// AppiumDeviceManager.getAppiumDevice().getUdid()); +// testExecutionContext.addTestState("deviceInfo", AppiumDeviceManager.getAppiumDevice()); + testExecutionContext.addTestState("deviceLog", deviceLogFileName); + testExecutionContext.addTestState("scenarioRunCount", scenarioRunCount); + testExecutionContext.addTestState("normalisedScenarioName", normalisedScenarioName); + testExecutionContext.addTestState("scenarioDirectory", scenarioReportDirectory); + testExecutionContext.addTestState("scenarioScreenshotsDirectory", + scenarioReportDirectory + + "screenshot" + + File.separator); + } + + @SneakyThrows + private String startDataCapture(Integer scenarioRunCount, + String deviceLogFileDirectory) { + String fileName = String.format("/run-%s", scenarioRunCount); +// if (AppiumDeviceManager.getAppiumDevice().getPlatformName().equalsIgnoreCase("android")) { +// fileName = String.format("/%s-run-%s", +// AppiumDeviceManager.getAppiumDevice().getUdid(), scenarioRunCount); +// File logFile = createFile(deviceLogFileDirectory +// + FileLocations.DEVICE_LOGS_DIRECTORY, +// fileName); +// fileName = logFile.getAbsolutePath(); +// LOGGER.debug("Capturing device logs here: " + fileName); +// PrintStream logFileStream = new PrintStream(logFile); +// try { +// LogEntries logcatOutput = AppiumDriverManager.getDriver() +// .manage().logs().get("logcat"); +// StreamSupport.stream(logcatOutput.spliterator(), false) +// .forEach(logFileStream::println); +// } catch (Exception e) { +// LOGGER.warn("ERROR in getting logcat. Skipping logcat capture"); +// } +// } + return fileName; + } + + private boolean isRunningOnpCloudy() { + boolean isPCloudy = getCloudName().equalsIgnoreCase("pCloudy"); +// LOGGER.info(AppiumDeviceManager.getAppiumDevice().getUdid() + ": running on: " +// + getCloudName()); + return isPCloudy; + } + + private static String getCloudName() { + return PluginClI.getInstance().getCloudName(); + } + + private boolean isRunningOnBrowserStack() { + boolean isBrowserStack = getCloudName().equalsIgnoreCase("browserstack"); +// LOGGER.info(AppiumDeviceManager.getAppiumDevice().getUdid() + ": running on: " +// + getCloudName()); + return isBrowserStack; + } + + private boolean isRunningOnHeadspin() { + boolean isHeadspin = getCloudName().equalsIgnoreCase("headspin"); +// LOGGER.info(AppiumDeviceManager.getAppiumDevice().getUdid() + ": running on: " +// + getCloudName()); + return isHeadspin; + } + + private String normaliseScenarioName(String scenarioName) { + return scenarioName.replaceAll("[`~ !@#$%^&*()\\-=+\\[\\]{}\\\\|;:'\",<.>/?]", "_"); + } + + private Integer getScenarioRunCount(String scenarioName) { + if (scenarioRunCounts.containsKey(scenarioName)) { + scenarioRunCounts.put(scenarioName, scenarioRunCounts.get(scenarioName) + 1); + } else { + scenarioRunCounts.put(scenarioName, 1); + } + return scenarioRunCounts.get(scenarioName); + } + + private void caseFinishedHandler(TestCaseFinished event) { + String scenarioName = event.getTestCase().getName(); + LOGGER.info("caseFinishedHandler Name: " + scenarioName); + long threadId = Thread.currentThread().getId(); + LOGGER.info( + String.format("ThreadID: %d: afterScenario: for scenario: %s%n", + threadId, event.getTestCase().toString())); + + TestExecutionContext testExecutionContext = + SessionContext.getTestExecutionContext(threadId); + + AppiumDriver driver = (AppiumDriver) testExecutionContext.getTestState("appiumDriver"); + attachCloudExecutionReportLinkToReportPortal(driver); + stopAppiumDriver(); + String deviceLogFileName = testExecutionContext.getTestStateAsString("deviceLog"); + if (null != deviceLogFileName) { + LOGGER.debug(String.format("Attaching device logs %s to ReportPortal: ", + deviceLogFileName)); + File file = new File(deviceLogFileName); + ReportPortal.emitLog("ADB Logs - " + file.getName(), + "DEBUG", new Date(), file); + } + SessionContext.remove(threadId); + LOGGER.info("$$$$$ TEST-CASE -- " + scenarioName + " ENDED $$$$$"); + } + + private void stopAppiumDriver() { +// try { +// appiumDriverManager.stopAppiumDriver(); +// } catch (Exception e) { +// LOGGER.warn("Error stopping Appium Driver", e); +// } + } + + private void attachCloudExecutionReportLinkToReportPortal(AppiumDriver driver) { + if ((PluginClI.getInstance().isCloudExecution()) && isRunningOnpCloudy()) { + String link = (String) driver.executeScript("pCloudy_getReportLink"); + String message = "pCloudy Report link available here: " + link; + LOGGER.info(message); + ReportPortal.emitLog(message, "DEBUG", new Date()); + } else if ((PluginClI.getInstance().isCloudExecution()) && isRunningOnHeadspin()) { + String sessionId = driver.getSessionId().toString(); + String link = "https://ui-dev.headspin.io/sessions/" + sessionId + "/waterfall"; + String message = "Headspin Report link available here: " + link; + LOGGER.info(message); + ReportPortal.emitLog(message, "DEBUG", new Date()); + } else if ((PluginClI.getInstance().isCloudExecution()) && isRunningOnBrowserStack()) { + String sessionId = driver.getSessionId().toString(); + String link = getReportLinkFromBrowserStack(sessionId); + String message = "BrowserStack Report link available here: " + link; + LOGGER.info(message); + ReportPortal.emitLog(message, "DEBUG", new Date()); + } + } + + private static String getReportLinkFromBrowserStack(String sessionId) { + String reportLink = ""; + String cloudUser = getOverriddenStringValue("CLOUD_USERNAME"); + String cloudPassword = getOverriddenStringValue("CLOUD_KEY"); + String[] curlCommand = new String[] {"curl --insecure " + getCurlProxyCommand() + " -u \"" + cloudUser + ":" + cloudPassword + "\" -X GET \"https://api-cloud.browserstack.com/app-automate/sessions/" + sessionId + ".json\""}; + LOGGER.debug(String.format("Curl command: '%s'", Arrays.toString(curlCommand))); + CommandLineResponse commandLineResponse = null; + try { + commandLineResponse = CommandLineExecutor.execCommand(curlCommand); + LOGGER.debug(String.format("Response from BrowserStack - '%s'", commandLineResponse.toString())); + JSONObject pr = new JSONObject(commandLineResponse.getStdOut()); + JSONObject automation_session = pr.getJSONObject("automation_session"); + reportLink = automation_session.getString("browser_url"); + LOGGER.debug("reportLink: " + reportLink); + } catch (Exception e) { + LOGGER.debug("Unable to get report link from BrowserStack: " + e.getMessage()); + e.printStackTrace(); + } + return reportLink; + } + + static String getCurlProxyCommand() { + String curlProxyCommand = ""; + if (null != getOverriddenStringValue("PROXY_URL")) { + curlProxyCommand = " --proxy " + System.getProperty("PROXY_URL"); + } + return curlProxyCommand; + } + + private void runFinishedHandler(TestRunFinished event) { + LOGGER.info("runFinishedHandler: " + event.getResult().toString()); + LOGGER.info(String.format("ThreadID: %d: afterSuite: %n", + Thread.currentThread().getId())); + try { +// appiumServerManager.destroyAppiumNode(); + SessionContext.setReportPortalLaunchURL(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/znsio/teswiz/listener/CucumberScenarioReporterListener.java b/src/main/java/com/znsio/teswiz/listener/CucumberScenarioReporterListener.java new file mode 100644 index 000000000..b56fb301a --- /dev/null +++ b/src/main/java/com/znsio/teswiz/listener/CucumberScenarioReporterListener.java @@ -0,0 +1,51 @@ +package com.znsio.teswiz.listener; + +import com.epam.reportportal.cucumber.ScenarioReporter; +import com.epam.reportportal.utils.MemoizingSupplier; +import com.epam.ta.reportportal.ws.model.StartTestItemRQ; +import com.znsio.teswiz.runner.AppiumDriverManager; +import com.znsio.teswiz.runner.AppiumServerManager; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; + +public class CucumberScenarioReporterListener extends ScenarioReporter { + + private static final Logger LOGGER = LogManager.getLogger(CucumberScenarioReporterListener.class.getName()); + private static final String DUMMY_ROOT_SUITE_NAME = "My Tests"; + private static final String RP_STORY_TYPE = "SUITE"; + public AppiumServerManager appiumServerManager; + public AppiumDriverManager appiumDriverManager; + + private static final Map MIME_TYPES_EXTENSIONS = + new HashMap() { + { + this.put("image/bmp", "bmp"); + this.put("image/gif", "gif"); + this.put("image/jpeg", "jpg"); + this.put("image/png", "png"); + this.put("image/svg+xml", "svg"); + this.put("video/ogg", "ogg"); + } + }; + + public CucumberScenarioReporterListener() throws Exception { + LOGGER.info("CucumberScenarioReporterListener"); + appiumServerManager = new AppiumServerManager(); + appiumDriverManager = new AppiumDriverManager(); + } + + @Override + protected void startRootItem() { + this.rootSuiteId = new MemoizingSupplier(() -> { + StartTestItemRQ rq = new StartTestItemRQ(); + rq.setName(DUMMY_ROOT_SUITE_NAME); + rq.setStartTime(Calendar.getInstance().getTime()); + rq.setType(RP_STORY_TYPE); + return this.getLaunch().startTestItem(rq); + }); + } +} diff --git a/src/main/java/com/znsio/teswiz/runner/AppiumDeviceManager.java b/src/main/java/com/znsio/teswiz/runner/AppiumDeviceManager.java new file mode 100644 index 000000000..aecccaead --- /dev/null +++ b/src/main/java/com/znsio/teswiz/runner/AppiumDeviceManager.java @@ -0,0 +1,4 @@ +package com.znsio.teswiz.runner; + +public class AppiumDeviceManager { +} diff --git a/src/main/java/com/znsio/teswiz/runner/AppiumDriverManager.java b/src/main/java/com/znsio/teswiz/runner/AppiumDriverManager.java index ea66b2968..4131c3449 100644 --- a/src/main/java/com/znsio/teswiz/runner/AppiumDriverManager.java +++ b/src/main/java/com/znsio/teswiz/runner/AppiumDriverManager.java @@ -1,11 +1,8 @@ package com.znsio.teswiz.runner; -import com.appium.capabilities.DriverSession; -import com.appium.filelocations.FileLocations; -import com.appium.manager.AppiumDeviceManager; -import com.appium.plugin.PluginClI; -import com.context.SessionContext; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; +import com.znsio.teswiz.entities.FileLocations; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.TEST_CONTEXT; import com.znsio.teswiz.exceptions.EnvironmentSetupException; @@ -31,19 +28,19 @@ import java.util.List; import java.util.stream.StreamSupport; -import static com.cucumber.listener.CucumberScenarioListener.createFile; +import static com.znsio.teswiz.listener.CucumberScenarioListener.createFile; import static com.znsio.teswiz.runner.Runner.DEFAULT; import static com.znsio.teswiz.runner.Runner.getCloudName; import static com.znsio.teswiz.runner.Setup.CAPS; -class AppiumDriverManager { +public class AppiumDriverManager { private static final int MAX_NUMBER_OF_APPIUM_DRIVERS = Runner.getMaxNumberOfAppiumDrivers(); - private static final List additionalDevices = new ArrayList<>(); + private static final List additionalDevices = new ArrayList<>(); private static final Logger LOGGER = LogManager.getLogger(AppiumDriverManager.class.getName()); private static final String CAPABILITIES = "CAPABILITIES: "; private static int numberOfAppiumDriversUsed = 0; - private AppiumDriverManager() { + public AppiumDriverManager() { LOGGER.debug("AppiumDriverManager - private constructor"); } @@ -92,7 +89,8 @@ private static File getCapabilityFileToUseForDriverCreation(String appName) { private static Driver createNewAppiumDriver(String userPersona, Platform forPlatform, TestExecutionContext context, String appName, File capabilityFileToUseForDriverCreation) { Driver currentDriver; try { - AppiumDriver appiumDriver = new com.appium.manager.AppiumDriverManager().startAppiumDriverInstance(userPersona, capabilityFileToUseForDriverCreation.getAbsolutePath()); + // TODO + AppiumDriver appiumDriver = TODO_createAppiumDriver(userPersona, capabilityFileToUseForDriverCreation); String scenarioDirectory = context.getTestStateAsString("scenarioDirectory"); @@ -112,22 +110,27 @@ private static Driver createNewAppiumDriver(String userPersona, Platform forPlat return currentDriver; } + private static AppiumDriver TODO_createAppiumDriver(String userPersona, File capabilityFileToUseForDriverCreation) { +// return new com.appium.manager.AppiumDriverManager().startAppiumDriverInstance(userPersona, capabilityFileToUseForDriverCreation.getAbsolutePath()); + return null; + } + private static String startDataCapture(Integer scenarioRunCount, String deviceLogFileDirectory) { String fileName = String.format("/run-%s", scenarioRunCount); - if (AppiumDeviceManager.getAppiumDevice().getPlatformName().equalsIgnoreCase("android")) { - try { - fileName = String.format("/%s-run-%s", AppiumDeviceManager.getAppiumDevice().getUdid(), scenarioRunCount); - File logFile = createFile(deviceLogFileDirectory + FileLocations.DEVICE_LOGS_DIRECTORY, fileName); - fileName = logFile.getAbsolutePath(); - LOGGER.debug("Capturing device logs here: " + fileName); - PrintStream logFileStream = null; - logFileStream = new PrintStream(logFile); - LogEntries logcatOutput = com.appium.manager.AppiumDriverManager.getDriver().manage().logs().get("logcat"); - StreamSupport.stream(logcatOutput.spliterator(), false).forEach(logFileStream::println); - } catch (FileNotFoundException e) { - LOGGER.warn("ERROR in getting logcat. Skipping logcat capture"); - } - } +// if (AppiumDeviceManager.getAppiumDevice().getPlatformName().equalsIgnoreCase("android")) { +// try { +// fileName = String.format("/%s-run-%s", AppiumDeviceManager.getAppiumDevice().getUdid(), scenarioRunCount); +// File logFile = createFile(deviceLogFileDirectory + FileLocations.DEVICE_LOGS_DIRECTORY, fileName); +// fileName = logFile.getAbsolutePath(); +// LOGGER.debug("Capturing device logs here: " + fileName); +// PrintStream logFileStream = null; +// logFileStream = new PrintStream(logFile); +// LogEntries logcatOutput = com.appium.manager.AppiumDriverManager.getDriver().manage().logs().get("logcat"); +// StreamSupport.stream(logcatOutput.spliterator(), false).forEach(logFileStream::println); +// } catch (FileNotFoundException e) { +// LOGGER.warn("ERROR in getting logcat. Skipping logcat capture"); +// } +// } return fileName; } @@ -298,9 +301,9 @@ private static void addDeviceLogFileNameFor(String userPersona, String forPlatfo } static void freeDevices() { - for (DriverSession additionalDevice : additionalDevices) { - LOGGER.info(String.format("Freeing device: %s", additionalDevice.getDeviceName())); - } +// for (DriverSession additionalDevice : additionalDevices) { +// LOGGER.info(String.format("Freeing device: %s", additionalDevice.getDeviceName())); +// } additionalDevices.clear(); } diff --git a/src/main/java/com/znsio/teswiz/runner/AppiumServerManager.java b/src/main/java/com/znsio/teswiz/runner/AppiumServerManager.java new file mode 100644 index 000000000..3c3e2184c --- /dev/null +++ b/src/main/java/com/znsio/teswiz/runner/AppiumServerManager.java @@ -0,0 +1,4 @@ +package com.znsio.teswiz.runner; + +public class AppiumServerManager { +} diff --git a/src/main/java/com/znsio/teswiz/runner/BrowserDriverManager.java b/src/main/java/com/znsio/teswiz/runner/BrowserDriverManager.java index b226d1a32..e5452f3a9 100644 --- a/src/main/java/com/znsio/teswiz/runner/BrowserDriverManager.java +++ b/src/main/java/com/znsio/teswiz/runner/BrowserDriverManager.java @@ -1,6 +1,6 @@ package com.znsio.teswiz.runner; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.TEST_CONTEXT; import com.znsio.teswiz.exceptions.EnvironmentSetupException; @@ -49,9 +49,9 @@ import java.util.Set; import java.util.logging.Level; -import static com.appium.utils.OverriddenVariable.getOverriddenStringValue; import static com.znsio.teswiz.runner.Runner.DEFAULT; import static com.znsio.teswiz.runner.Setup.CAPS; +import static com.znsio.teswiz.tools.OverriddenVariable.getOverriddenStringValue; class BrowserDriverManager { private static final Logger LOGGER = LogManager.getLogger(BrowserDriverManager.class.getName()); diff --git a/src/main/java/com/znsio/teswiz/runner/DeviceSetup.java b/src/main/java/com/znsio/teswiz/runner/DeviceSetup.java index b3e764146..6f32b61ab 100644 --- a/src/main/java/com/znsio/teswiz/runner/DeviceSetup.java +++ b/src/main/java/com/znsio/teswiz/runner/DeviceSetup.java @@ -23,6 +23,7 @@ import java.text.DecimalFormat; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Collection; import java.util.Map; import java.util.Objects; import java.util.regex.Matcher; @@ -78,7 +79,7 @@ static String getPathForFileInLogDir(String fullFilePath) { return newFileName; } - static ArrayList setupAndroidExecution() { + static Collection setupAndroidExecution() { ArrayList androidCukeArgs = new ArrayList<>(); if (Setup.getPlatform().equals(Platform.android)) { verifyAppExistsAtMentionedPath(); @@ -88,12 +89,6 @@ static ArrayList setupAndroidExecution() { } else { LocalDevicesSetup.setupLocalExecution(); } - androidCukeArgs.add("--threads"); - androidCukeArgs.add(Setup.getIntegerValueAsStringFromConfigs(PARALLEL)); - androidCukeArgs.add(PLUGIN); - androidCukeArgs.add(CUCUMBER_SCENARIO_LISTENER); - androidCukeArgs.add(PLUGIN); - androidCukeArgs.add(CUCUMBER_SCENARIO_REPORTER_LISTENER); } return androidCukeArgs; } @@ -333,15 +328,11 @@ private static String getCloudApiUrlFromCapabilities() { "device-farm", "cloud", "apiUrl"}, Setup.getLoadedCapabilities()); } - static ArrayList setupWindowsExecution() { + static Collection setupWindowsExecution() { ArrayList windowsCukeArgs = new ArrayList<>(); if (Setup.getPlatform().equals(Platform.windows)) { verifyAppExistsAtMentionedPath(); fetchWindowsAppVersion(); - windowsCukeArgs.add(PLUGIN); - windowsCukeArgs.add(CUCUMBER_SCENARIO_LISTENER); - windowsCukeArgs.add(PLUGIN); - windowsCukeArgs.add(CUCUMBER_SCENARIO_REPORTER_LISTENER); Setup.addToConfigs(EXECUTED_ON, "Local Desktop Apps"); } return windowsCukeArgs; @@ -383,7 +374,7 @@ static void cleanupCloudExecution() { } } - static ArrayList setupIOSExecution() { + static Collection setupIOSExecution() { ArrayList iOSCukeArgs = new ArrayList<>(); if (Setup.getPlatform().equals(Platform.iOS)) { verifyAppExistsAtMentionedPath(); @@ -394,14 +385,7 @@ static ArrayList setupIOSExecution() { } else { LocalDevicesSetup.setupLocalIOSExecution(); } - iOSCukeArgs.add("--threads"); - iOSCukeArgs.add(Setup.getIntegerValueAsStringFromConfigs(PARALLEL)); - iOSCukeArgs.add(PLUGIN); - iOSCukeArgs.add(CUCUMBER_SCENARIO_LISTENER); - iOSCukeArgs.add(PLUGIN); - iOSCukeArgs.add(CUCUMBER_SCENARIO_REPORTER_LISTENER); } return iOSCukeArgs; } - } diff --git a/src/main/java/com/znsio/teswiz/runner/Driver.java b/src/main/java/com/znsio/teswiz/runner/Driver.java index 3a6b54478..845bcac35 100644 --- a/src/main/java/com/znsio/teswiz/runner/Driver.java +++ b/src/main/java/com/znsio/teswiz/runner/Driver.java @@ -1,6 +1,6 @@ package com.znsio.teswiz.runner; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.google.common.collect.ImmutableMap; import com.znsio.teswiz.entities.Direction; import com.znsio.teswiz.entities.Platform; diff --git a/src/main/java/com/znsio/teswiz/runner/Drivers.java b/src/main/java/com/znsio/teswiz/runner/Drivers.java index e94a6c045..3d4ef25fc 100644 --- a/src/main/java/com/znsio/teswiz/runner/Drivers.java +++ b/src/main/java/com/znsio/teswiz/runner/Drivers.java @@ -1,6 +1,6 @@ package com.znsio.teswiz.runner; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.TEST_CONTEXT; import com.znsio.teswiz.exceptions.InvalidTestDataException; @@ -19,7 +19,7 @@ import java.util.Set; import java.util.stream.Collectors; -import static com.context.SessionContext.getTestExecutionContext; +import static com.znsio.teswiz.context.SessionContext.getTestExecutionContext; import static com.znsio.teswiz.runner.Runner.DEFAULT; import static io.appium.java_client.remote.options.SupportsDeviceNameOption.DEVICE_NAME_OPTION; import static org.openqa.selenium.remote.CapabilityType.BROWSER_NAME; diff --git a/src/main/java/com/znsio/teswiz/runner/PluginClI.java b/src/main/java/com/znsio/teswiz/runner/PluginClI.java new file mode 100644 index 000000000..016664d85 --- /dev/null +++ b/src/main/java/com/znsio/teswiz/runner/PluginClI.java @@ -0,0 +1,25 @@ +package com.znsio.teswiz.runner; + +import lombok.SneakyThrows; + +import static com.znsio.teswiz.runner.Runner.NOT_SET; + +public class PluginClI { + private static PluginClI instance; + + private PluginClI() { + instance = new PluginClI(); + } + @SneakyThrows + public static PluginClI getInstance() { + return instance; + } + + public boolean isCloudExecution() { + return false; + } + + public String getCloudName() { + return NOT_SET; + } +} diff --git a/src/main/java/com/znsio/teswiz/runner/Runner.java b/src/main/java/com/znsio/teswiz/runner/Runner.java index ac6bbd706..8bc144d2c 100644 --- a/src/main/java/com/znsio/teswiz/runner/Runner.java +++ b/src/main/java/com/znsio/teswiz/runner/Runner.java @@ -1,7 +1,7 @@ package com.znsio.teswiz.runner; -import com.context.SessionContext; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.TEST_CONTEXT; import com.znsio.teswiz.exceptions.InvalidTestDataException; diff --git a/src/main/java/com/znsio/teswiz/runner/Setup.java b/src/main/java/com/znsio/teswiz/runner/Setup.java index 0a4691f21..21b9e413a 100644 --- a/src/main/java/com/znsio/teswiz/runner/Setup.java +++ b/src/main/java/com/znsio/teswiz/runner/Setup.java @@ -11,8 +11,8 @@ import com.znsio.teswiz.tools.cmd.CommandLineExecutor; import com.znsio.teswiz.tools.cmd.CommandLineResponse; import org.apache.commons.io.FileUtils; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.LoggerContext; import org.jetbrains.annotations.NotNull; @@ -24,19 +24,10 @@ import java.net.UnknownHostException; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import static com.appium.utils.OverriddenVariable.getOverriddenBooleanValue; -import static com.appium.utils.OverriddenVariable.getOverriddenIntValue; -import static com.appium.utils.OverriddenVariable.getOverriddenStringValue; -import static com.znsio.teswiz.runner.Runner.NOT_SET; -import static com.znsio.teswiz.runner.Runner.OS_NAME; -import static com.znsio.teswiz.runner.Runner.USER_NAME; +import java.util.*; + +import static com.znsio.teswiz.runner.Runner.*; +import static com.znsio.teswiz.tools.OverriddenVariable.*; class Setup { static final String RUN_IN_CI = "RUN_IN_CI"; @@ -254,7 +245,9 @@ private static void setupExecutionEnvironment() { CUKE_ARGS.addAll(DeviceSetup.setupAndroidExecution()); CUKE_ARGS.addAll(DeviceSetup.setupIOSExecution()); CUKE_ARGS.addAll(DeviceSetup.setupWindowsExecution()); - CUKE_ARGS.addAll(setupPlatformExecution()); + CUKE_ARGS.addAll(setupCucumberListenersForExecution()); + CUKE_ARGS.addAll(setupParallelExecution()); + initialiseApplitoolsConfiguration(); String rpAttributes = String.format( @@ -293,6 +286,17 @@ private static void setupExecutionEnvironment() { System.setProperty("rp.attributes", rpAttributes); } + private static Collection setupParallelExecution() { + List parallelExecutionArgs = new ArrayList<>(); + parallelExecutionArgs.add("--threads"); + if (Setup.getPlatform().equals(Platform.windows) || Setup.getPlatform().equals(Platform.electron)) { + parallelExecutionArgs.add("1"); + } else { + parallelExecutionArgs.add(Setup.getIntegerValueAsStringFromConfigs(PARALLEL)); + } + return parallelExecutionArgs; + } + private static void printStringConfigsMap() { StringBuilder printString = new StringBuilder("Using string values" + ": \n"); for (Map.Entry entry : Setup.configs.entrySet()) { @@ -470,34 +474,15 @@ private static void addCucumberPlugsToArgs() { System.setProperty("cucumber.publish.quiet", "true"); } - private static ArrayList setupPlatformExecution() { - ArrayList webCukeArgs = new ArrayList<>(); - if (!useATD()) { - configs.put(APP_PATH, configs.get(BROWSER)); - configs.put(EXECUTED_ON, "Local Browsers"); - setupListenersForWebOrAPIOrCLIExecution(webCukeArgs); - } else if (currentPlatform.equals(Platform.electron)) { - configs.put(APP_PATH, configs.get(BROWSER)); - configs.put(EXECUTED_ON, "Local Electron Application"); - setupListenersForWebOrAPIOrCLIExecution(webCukeArgs); - } else if (currentPlatform.equals(Platform.api) || currentPlatform.equals(Platform.cli)) { - configs.put(EXECUTED_ON, currentPlatform.name()); - setupListenersForWebOrAPIOrCLIExecution(webCukeArgs); - } - return webCukeArgs; - } - - private static boolean useATD() { - return currentPlatform.equals(Platform.android) || currentPlatform.equals(Platform.iOS) || currentPlatform.equals(Platform.windows); - } - - private static void setupListenersForWebOrAPIOrCLIExecution(ArrayList webCukeArgs) { - webCukeArgs.add("--threads"); - webCukeArgs.add(String.valueOf(configsInteger.get(PARALLEL))); - webCukeArgs.add(PLUGIN); - webCukeArgs.add("com.znsio.teswiz.listener.CucumberPlatformScenarioListener"); - webCukeArgs.add(PLUGIN); - webCukeArgs.add("com.znsio.teswiz.listener.CucumberPlatformScenarioReporterListener"); + private static Collection setupCucumberListenersForExecution() { + ArrayList cukeArgs = new ArrayList<>(); + cukeArgs.add("--threads"); + cukeArgs.add(String.valueOf(configsInteger.get(PARALLEL))); + cukeArgs.add(PLUGIN); + cukeArgs.add("com.znsio.teswiz.listener.CucumberPlatformScenarioListener"); + cukeArgs.add(PLUGIN); + cukeArgs.add("com.znsio.teswiz.listener.CucumberPlatformScenarioReporterListener"); + return cukeArgs; } static Map initialiseApplitoolsConfiguration() { diff --git a/src/main/java/com/znsio/teswiz/runner/Visual.java b/src/main/java/com/znsio/teswiz/runner/Visual.java index c9c5f2d12..e44db1aa1 100644 --- a/src/main/java/com/znsio/teswiz/runner/Visual.java +++ b/src/main/java/com/znsio/teswiz/runner/Visual.java @@ -9,8 +9,8 @@ import com.applitools.eyes.visualgrid.model.RenderBrowserInfo; import com.applitools.eyes.visualgrid.model.ScreenOrientation; import com.applitools.eyes.visualgrid.services.VisualGridRunner; -import com.context.SessionContext; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.znsio.teswiz.entities.APPLITOOLS; diff --git a/src/main/java/com/znsio/teswiz/steps/Hooks.java b/src/main/java/com/znsio/teswiz/steps/Hooks.java index 47502adf3..add83b9aa 100644 --- a/src/main/java/com/znsio/teswiz/steps/Hooks.java +++ b/src/main/java/com/znsio/teswiz/steps/Hooks.java @@ -1,6 +1,6 @@ package com.znsio.teswiz.steps; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.TEST_CONTEXT; import com.znsio.teswiz.runner.Drivers; @@ -67,7 +67,6 @@ public void afterScenario(Scenario scenario) { private void startTheAsyncCommandLineExecutor() { if (Runner.isCLI()) { LOGGER.info("Start the AsyncCommandLineExecutor"); - testExecutionContext.addTestState(TEST_CONTEXT.CLI_COMMAND_NUMBER, 1); AsyncCommandLineExecutor asyncCommandLineExecutor = new AsyncCommandLineExecutor(); testExecutionContext.addTestState(TEST_CONTEXT.ASYNC_COMMAND_LINE_EXECUTOR, asyncCommandLineExecutor); } diff --git a/src/main/java/com/znsio/teswiz/steps/RunCukes.java b/src/main/java/com/znsio/teswiz/steps/RunCukes.java index c3d429428..31f519de7 100644 --- a/src/main/java/com/znsio/teswiz/steps/RunCukes.java +++ b/src/main/java/com/znsio/teswiz/steps/RunCukes.java @@ -1,7 +1,7 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import io.cucumber.java.After; import io.cucumber.java.Before; import io.cucumber.java.Scenario; diff --git a/src/main/java/com/znsio/teswiz/tools/OverriddenVariable.java b/src/main/java/com/znsio/teswiz/tools/OverriddenVariable.java new file mode 100644 index 000000000..6ab22e431 --- /dev/null +++ b/src/main/java/com/znsio/teswiz/tools/OverriddenVariable.java @@ -0,0 +1,41 @@ +package com.znsio.teswiz.tools; + +public class OverriddenVariable { + public static String getOverriddenStringValue(String key) { + return getValueFromEnvOrProperty(key); + } + + public static String getOverriddenStringValue(String key, String defaultValue) { + return (isKeyProvidedInEnvOrProperty(key)) + ? getValueFromEnvOrProperty(key) + : defaultValue; + } + + public static int getOverriddenIntValue(String key) { + return Integer.parseInt(getValueFromEnvOrProperty(key)); + } + + public static int getOverriddenIntValue(String key, int defaultValue) { + return isKeyProvidedInEnvOrProperty(key) + ? Integer.parseInt(getValueFromEnvOrProperty(key)) + : defaultValue; + } + + public static boolean getOverriddenBooleanValue(String key) { + return Boolean.parseBoolean(getValueFromEnvOrProperty(key)); + } + + public static boolean getOverriddenBooleanValue(String key, boolean defaultValue) { + return isKeyProvidedInEnvOrProperty(key) + ? Boolean.parseBoolean(getValueFromEnvOrProperty(key)) + : defaultValue; + } + + private static boolean isKeyProvidedInEnvOrProperty(String key) { + return (null != System.getenv(key)) || (null != System.getProperty(key)); + } + + private static String getValueFromEnvOrProperty(String key) { + return (null == System.getProperty(key)) ? System.getenv(key) : System.getProperty(key); + } +} diff --git a/src/main/java/com/znsio/teswiz/tools/Randomizer.java b/src/main/java/com/znsio/teswiz/tools/Randomizer.java index 5cbaab0f9..a51347320 100644 --- a/src/main/java/com/znsio/teswiz/tools/Randomizer.java +++ b/src/main/java/com/znsio/teswiz/tools/Randomizer.java @@ -8,26 +8,26 @@ public class Randomizer { private Randomizer() {} public static String randomize(int size) { - return RandomStringUtils.randomNumeric(size); + return RandomStringUtils.secureStrong().nextNumeric(size); } public static String randomize(String randomizeTestData) { String randomizedValue; try { Long.parseLong(randomizeTestData); - randomizedValue = "80" + RandomStringUtils.randomNumeric(8); + randomizedValue = "80" + RandomStringUtils.secureStrong().nextNumeric(8); } catch (NumberFormatException nfe) { - randomizedValue = "e2e_" + RandomStringUtils.randomAlphanumeric(10) + "@getnada.com"; + randomizedValue = "e2e_" + RandomStringUtils.secureStrong().nextAlphanumeric(10) + "@getnada.com"; } return randomizedValue; } public static String randomizeAlphaNumericString(int stringLength) { - return RandomStringUtils.randomAlphanumeric(stringLength); + return RandomStringUtils.secureStrong().nextAlphanumeric(stringLength); } public static String randomizeString(int stringLength) { - return RandomStringUtils.randomAlphabetic(stringLength); + return RandomStringUtils.secureStrong().nextAlphabetic(stringLength); } public static int getRandomNumberBetween(int min, int max) { diff --git a/src/main/java/com/znsio/teswiz/tools/ScreenShotManager.java b/src/main/java/com/znsio/teswiz/tools/ScreenShotManager.java index a9b1738e7..8ee771d36 100644 --- a/src/main/java/com/znsio/teswiz/tools/ScreenShotManager.java +++ b/src/main/java/com/znsio/teswiz/tools/ScreenShotManager.java @@ -1,7 +1,7 @@ package com.znsio.teswiz.tools; -import com.context.SessionContext; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.TEST_CONTEXT; import com.znsio.teswiz.runner.Runner; import org.apache.commons.io.FileUtils; diff --git a/src/main/java/com/znsio/teswiz/tools/cmd/AsyncCommandLineExecutor.java b/src/main/java/com/znsio/teswiz/tools/cmd/AsyncCommandLineExecutor.java index 34976b51f..7faa2af44 100644 --- a/src/main/java/com/znsio/teswiz/tools/cmd/AsyncCommandLineExecutor.java +++ b/src/main/java/com/znsio/teswiz/tools/cmd/AsyncCommandLineExecutor.java @@ -1,6 +1,6 @@ package com.znsio.teswiz.tools.cmd; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.TEST_CONTEXT; import com.znsio.teswiz.exceptions.CommandLineExecutorException; import com.znsio.teswiz.runner.Runner; @@ -35,6 +35,7 @@ public String getOutput() { public AsyncCommandLineExecutor() { long threadId = Thread.currentThread().getId(); this.context = Runner.getTestExecutionContext(threadId); + this.context.addTestState(TEST_CONTEXT.CLI_COMMAND_NUMBER, 1); String os = Runner.OS_NAME.toLowerCase(); ProcessBuilder processBuilder = os.contains("win") diff --git a/src/test/java/com/znsio/teswiz/PublicMethodsTest.java b/src/test/java/com/znsio/teswiz/PublicMethodsTest.java index c80dd8c75..0d8eddec1 100644 --- a/src/test/java/com/znsio/teswiz/PublicMethodsTest.java +++ b/src/test/java/com/znsio/teswiz/PublicMethodsTest.java @@ -1,6 +1,6 @@ package com.znsio.teswiz; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; diff --git a/src/test/java/com/znsio/teswiz/aspect/AspectJMethodLoggerTest.java b/src/test/java/com/znsio/teswiz/aspect/AspectJMethodLoggerTest.java index 79cc70348..cea7284d6 100644 --- a/src/test/java/com/znsio/teswiz/aspect/AspectJMethodLoggerTest.java +++ b/src/test/java/com/znsio/teswiz/aspect/AspectJMethodLoggerTest.java @@ -1,22 +1,24 @@ package com.znsio.teswiz.aspect; -import org.junit.jupiter.api.*; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.assertj.core.api.Assertions; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; -import java.io.*; -import java.util.*; - -import static org.junit.jupiter.api.Assertions.*; +import java.util.ArrayList; +import java.util.HashMap; class AspectJMethodLoggerTest { + private static final Logger LOGGER = LogManager.getLogger(AspectJMethodLoggerTest.class.getName()); private static final String className = AspectJMethodLoggerTest.class.getSimpleName(); private static final String LOG_DIR = "./target/testLogs"; private Object[] params; - @BeforeAll + @BeforeClass public static void setupBefore() { - System.setProperty("LOG_DIR", LOG_DIR); - new File(LOG_DIR).mkdirs(); + LOGGER.info("Using LOG_DIR: " + System.getProperty("LOG_DIR")); } @Test @@ -24,12 +26,9 @@ void validateLoggerWithNoArguments() { StackTraceElement stackTraceElement = new Throwable().getStackTrace()[0]; String methodName = stackTraceElement.getMethodName(); int lineNumber = stackTraceElement.getLineNumber(); - String enteringMethodPrefix = String.format("Entering method: '%s.%s:%d'", className, - methodName, lineNumber); + String enteringMethodPrefix = String.format("Entering method: '%s.%s:%d'", className, methodName, lineNumber); params = new Object[]{}; - assertEquals(enteringMethodPrefix, - AspectJMethodLoggers.generateBeforeMethodAspectJLogger(className, methodName, lineNumber, - params)); + Assertions.assertThat(enteringMethodPrefix).isEqualTo(AspectJMethodLoggers.generateBeforeMethodAspectJLogger(className, methodName, lineNumber, params)); } @Test @@ -37,11 +36,9 @@ void validateLoggerWithNullArguments() { StackTraceElement stackTraceElement = new Throwable().getStackTrace()[0]; String methodName = stackTraceElement.getMethodName(); int lineNumber = stackTraceElement.getLineNumber(); - String enteringMethodPrefix = String.format("Entering method: '%s.%s:%d'", className, - methodName, lineNumber); + String enteringMethodPrefix = String.format("Entering method: '%s.%s:%d'", className, methodName, lineNumber); params = new Object[]{null}; - assertEquals(String.format("%s%n\tParam-0: Value: \"null\"", enteringMethodPrefix), - AspectJMethodLoggers.generateBeforeMethodAspectJLogger(className, methodName, lineNumber, params)); + Assertions.assertThat(String.format("%s%n\tParam-0: Value: \"null\"", enteringMethodPrefix)).isEqualTo(AspectJMethodLoggers.generateBeforeMethodAspectJLogger(className, methodName, lineNumber, params)); } @Test @@ -49,12 +46,9 @@ void validateLoggerWithStringArguments() { StackTraceElement stackTraceElement = new Throwable().getStackTrace()[0]; String methodName = stackTraceElement.getMethodName(); int lineNumber = stackTraceElement.getLineNumber(); - String enteringMethodPrefix = String.format("Entering method: '%s.%s:%d'", className, - methodName, lineNumber); + String enteringMethodPrefix = String.format("Entering method: '%s.%s:%d'", className, methodName, lineNumber); params = new Object[]{"StringParam"}; - assertEquals(String.format("%s%n\tParam-0: Type: 'String', Value: \"StringParam\"", enteringMethodPrefix), - AspectJMethodLoggers.generateBeforeMethodAspectJLogger(className, methodName, - lineNumber, params)); + Assertions.assertThat(String.format("%s%n\tParam-0: Type: 'String', Value: \"StringParam\"", enteringMethodPrefix)).isEqualTo(AspectJMethodLoggers.generateBeforeMethodAspectJLogger(className, methodName, lineNumber, params)); } @Test @@ -62,12 +56,9 @@ void validateLoggerWithArrayArguments() { StackTraceElement stackTraceElement = new Throwable().getStackTrace()[0]; String methodName = stackTraceElement.getMethodName(); int lineNumber = stackTraceElement.getLineNumber(); - String enteringMethodPrefix = String.format("Entering method: '%s.%s:%d'", className, - methodName, lineNumber); + String enteringMethodPrefix = String.format("Entering method: '%s.%s:%d'", className, methodName, lineNumber); params = new Object[]{new int[]{1, 2, 3}}; - assertEquals(String.format("%s\n\tParam-0: Type: 'int[]', Value: \"[1, 2, 3]\"", enteringMethodPrefix), - AspectJMethodLoggers.generateBeforeMethodAspectJLogger(className, methodName, - lineNumber, params)); + Assertions.assertThat(String.format("%s\n\tParam-0: Type: 'int[]', Value: \"[1, 2, 3]\"", enteringMethodPrefix)).isEqualTo(AspectJMethodLoggers.generateBeforeMethodAspectJLogger(className, methodName, lineNumber, params)); } @Test @@ -75,8 +66,7 @@ void validateLoggerWithCollectionsArguments() { StackTraceElement stackTraceElement = new Throwable().getStackTrace()[0]; String methodName = stackTraceElement.getMethodName(); int lineNumber = stackTraceElement.getLineNumber(); - String enteringMethodPrefix = String.format("Entering method: '%s.%s:%d'", className, - methodName, lineNumber); + String enteringMethodPrefix = String.format("Entering method: '%s.%s:%d'", className, methodName, lineNumber); params = new Object[]{new ArrayList() {{ add("Array"); add("List"); @@ -84,9 +74,7 @@ void validateLoggerWithCollectionsArguments() { put("Hash", 1); put("Map", 2); }}}; - assertEquals(String.format("%s\n\tParam-0: Type: '', Value: \"[Array, List]\"\n\tParam-1: Type: '', Value: \"{Hash=1, Map=2}\"", enteringMethodPrefix), - AspectJMethodLoggers.generateBeforeMethodAspectJLogger(className, methodName, - lineNumber, params)); + Assertions.assertThat(String.format("%s\n\tParam-0: Type: '', Value: \"[Array, List]\"\n\tParam-1: Type: '', Value: \"{Hash=1, Map=2}\"", enteringMethodPrefix)).isEqualTo(AspectJMethodLoggers.generateBeforeMethodAspectJLogger(className, methodName, lineNumber, params)); } @Test @@ -94,26 +82,21 @@ void validateLoggerWithDifferentCombinationArguments() { StackTraceElement stackTraceElement = new Throwable().getStackTrace()[0]; String methodName = stackTraceElement.getMethodName(); int lineNumber = stackTraceElement.getLineNumber(); - String enteringMethodPrefix = String.format("Entering method: '%s.%s:%d'", className, - methodName, lineNumber); - params = new Object[]{null, "StringParam", 1, new String[]{"String", "Array"}, - new ArrayList() {{ - add("Array"); - add("List"); - }}, new HashMap() {{ + String enteringMethodPrefix = String.format("Entering method: '%s.%s:%d'", className, methodName, lineNumber); + params = new Object[]{null, "StringParam", 1, new String[]{"String", "Array"}, new ArrayList() {{ + add("Array"); + add("List"); + }}, new HashMap() {{ put("Hash", 1); put("Map", 2); }}}; - assertEquals(String.format("%s\n\tParam-0: Value: \"null\"\n\tParam-1: Type: 'String', Value: \"StringParam\"\n\tParam-2: Type: 'Integer', Value: \"1\"\n\tParam-3: Type: 'String[]', Value: \"[String, Array]\"\n\tParam-4: Type: '', Value: \"[Array, List]\"\n\tParam-5: Type: '', Value: \"{Hash=1, Map=2}\"", enteringMethodPrefix), - AspectJMethodLoggers.generateBeforeMethodAspectJLogger(className, methodName, - lineNumber, params)); + Assertions.assertThat(String.format("%s\n\tParam-0: Value: \"null\"\n\tParam-1: Type: 'String', Value: \"StringParam\"\n\tParam-2: Type: 'Integer', Value: \"1\"\n\tParam-3: Type: 'String[]', Value: \"[String, Array]\"\n\tParam-4: Type: '', Value: \"[Array, List]\"\n\tParam-5: Type: '', Value: \"{Hash=1, Map=2}\"", enteringMethodPrefix)).isEqualTo(AspectJMethodLoggers.generateBeforeMethodAspectJLogger(className, methodName, lineNumber, params)); } @Test void exitMethodLoggerValidation() { String methodName = new Throwable().getStackTrace()[0].getMethodName(); String exitMethodPrefix = String.format("Exiting method: '%s.%s'", className, methodName); - assertEquals(exitMethodPrefix, - AspectJMethodLoggers.generateAfterMethodAspectJLogger(className, methodName)); + Assertions.assertThat(exitMethodPrefix).isEqualTo(AspectJMethodLoggers.generateAfterMethodAspectJLogger(className, methodName)); } } diff --git a/src/test/java/com/znsio/teswiz/aspect/AspectLogging.java b/src/test/java/com/znsio/teswiz/aspect/AspectLogging.java index 6760b0abd..e116b3192 100644 --- a/src/test/java/com/znsio/teswiz/aspect/AspectLogging.java +++ b/src/test/java/com/znsio/teswiz/aspect/AspectLogging.java @@ -1,7 +1,7 @@ package com.znsio.teswiz.aspect; -import com.context.SessionContext; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/test/java/com/znsio/teswiz/businessLayer/ajio/HomeBL.java b/src/test/java/com/znsio/teswiz/businessLayer/ajio/HomeBL.java index 2bbe02e22..202e2a412 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/ajio/HomeBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/ajio/HomeBL.java @@ -1,13 +1,13 @@ package com.znsio.teswiz.businessLayer.ajio; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.ajio.HomeScreen; import com.znsio.teswiz.screen.ajio.SearchScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; import static org.assertj.core.api.Assertions.assertThat; @@ -39,9 +39,9 @@ public HomeBL() { public HomeBL openProduct(String product, String category, String gender) { assertThat(HomeScreen.get() - .goToMenu() - .selectProductFromCategory(product, category, gender) - .isProductListLoaded(product)) + .goToMenu() + .selectProductFromCategory(product, category, gender) + .isProductListLoaded(product)) .as("Selected Product list is not loaded") .isTrue(); return this; @@ -58,4 +58,4 @@ public SearchBL searchProduct(String productName) { assertThat(SearchScreen.get().getProductListingPageHeader().toLowerCase()).as("Product searched is not displayed").contains(productName.toLowerCase()); return new SearchBL(); } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/businessLayer/ajio/ProductBL.java b/src/test/java/com/znsio/teswiz/businessLayer/ajio/ProductBL.java index 9c60fbe8d..2d50e1e6c 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/ajio/ProductBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/ajio/ProductBL.java @@ -1,14 +1,14 @@ package com.znsio.teswiz.businessLayer.ajio; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.ajio.CartScreen; import com.znsio.teswiz.screen.ajio.ProductScreen; import com.znsio.teswiz.screen.ajio.SearchScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; import static org.assertj.core.api.Assertions.assertThat; @@ -39,8 +39,8 @@ public ProductBL() { public ProductBL selectTheFirstResultFromList() { assertThat(SearchScreen.get() - .selectProduct() - .isProductDetailsLoaded()) + .selectProduct() + .isProductDetailsLoaded()) .as("Product Details is not loaded") .isTrue(); return this; @@ -65,4 +65,4 @@ public ProductBL addItemToCart(String userPersona) { .isEqualTo(context.getTestState(userPersona + " ProductName")); return this; } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/businessLayer/ajio/SearchBL.java b/src/test/java/com/znsio/teswiz/businessLayer/ajio/SearchBL.java index a313c2ced..2e2241a20 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/ajio/SearchBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/ajio/SearchBL.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.businessLayer.ajio; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.ajio.CartScreen; import com.znsio.teswiz.screen.ajio.HomeScreen; import com.znsio.teswiz.screen.ajio.ProductScreen; import com.znsio.teswiz.screen.ajio.SearchScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; import java.util.Map; diff --git a/src/test/java/com/znsio/teswiz/businessLayer/autoscroll/AutoScrollBL.java b/src/test/java/com/znsio/teswiz/businessLayer/autoscroll/AutoScrollBL.java index 7f3b3026f..cdcb7faa3 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/autoscroll/AutoScrollBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/autoscroll/AutoScrollBL.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.businessLayer.autoscroll; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Direction; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.autoscroll.AutoScrollScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import static org.assertj.core.api.Assertions.assertThat; @@ -38,4 +38,4 @@ public AutoScrollBL verifyScrollInDynamicLayerFunctionality(Direction direction) .isTrue(); return this; } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/businessLayer/calculator/CalculatorBL.java b/src/test/java/com/znsio/teswiz/businessLayer/calculator/CalculatorBL.java index 02692d5cf..aab8fbb06 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/calculator/CalculatorBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/calculator/CalculatorBL.java @@ -1,9 +1,9 @@ package com.znsio.teswiz.businessLayer.calculator; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.ScreenShotScreen; import com.znsio.teswiz.screen.calculator.CalculatorScreen; import com.znsio.teswiz.screen.calculator.NewCalculatorScreen; @@ -50,6 +50,7 @@ public CalculatorBL selectNumber(String number) { CalculatorScreen.get().selectNumber(number); return this; } + public CalculatorBL selectNumberInNewCalculator(String number) { NewCalculatorScreen.get().selectNumber(number); return this; @@ -67,7 +68,7 @@ public CalculatorBL pressOperationInNewCalculator(String operation) { public CalculatorBL switchBackToCalculator() { LOGGER.info("Restart calculator"); - String[] packageName = new String[] {"adb shell am start com.android2.calculator3/com.android2.calculator3.Calculator"}; + String[] packageName = new String[]{"adb shell am start com.android2.calculator3/com.android2.calculator3.Calculator"}; CommandLineExecutor.execCommand(packageName); ScreenShotScreen.get().takeScreenshot(); return this; diff --git a/src/test/java/com/znsio/teswiz/businessLayer/confengine/ConfEngineBL.java b/src/test/java/com/znsio/teswiz/businessLayer/confengine/ConfEngineBL.java index 300d1944f..6f4b1c63b 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/confengine/ConfEngineBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/confengine/ConfEngineBL.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.businessLayer.confengine; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.confengine.ConfEngineLandingScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; public class ConfEngineBL { diff --git a/src/test/java/com/znsio/teswiz/businessLayer/cryptoAPI/CryptoAPIBL.java b/src/test/java/com/znsio/teswiz/businessLayer/cryptoAPI/CryptoAPIBL.java index 6865b31ac..275d6e862 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/cryptoAPI/CryptoAPIBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/cryptoAPI/CryptoAPIBL.java @@ -4,8 +4,8 @@ import com.znsio.teswiz.services.UnirestService; import kong.unirest.HttpResponse; import kong.unirest.JsonNode; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import java.util.Map; @@ -18,14 +18,14 @@ public class CryptoAPIBL { public HttpResponse getDataUsingCryptoSymbol(String symbol) { LOGGER.info("Getting crypto currency data for last 24-Hrs"); - HttpResponse jsonResponse= UnirestService.getHttpResponseWithQueryParameter(base_URL, "symbol", symbol); + HttpResponse jsonResponse = UnirestService.getHttpResponseWithQueryParameter(base_URL, "symbol", symbol); assertThat(jsonResponse.getStatus()).as("API status code incorrect!") .isEqualTo(200); return jsonResponse; } public CryptoAPIBL verifypriceChange(HttpResponse jsonResponse, int maxPriceChange) { - LOGGER.info("Verifying price change is less than "+maxPriceChange); + LOGGER.info("Verifying price change is less than " + maxPriceChange); double priceChange = Double.parseDouble(jsonResponse.getBody().getObject().getString("priceChange")); assertThat(priceChange) .as("Price change value more than expected maximum value!") @@ -34,7 +34,7 @@ public CryptoAPIBL verifypriceChange(HttpResponse jsonResponse, int ma } public CryptoAPIBL verifyPriceChangePercent(HttpResponse jsonResponse, int maxPriceChangePercent) { - LOGGER.info("Verifying price change percent is less than "+maxPriceChangePercent); + LOGGER.info("Verifying price change percent is less than " + maxPriceChangePercent); double priceChangePercent = Double.parseDouble(jsonResponse.getBody().getObject().getString("priceChangePercent")); assertThat(priceChangePercent) .as("Price change percent value more than expected maximum value!") diff --git a/src/test/java/com/znsio/teswiz/businessLayer/dineout/DineoutSearchBL.java b/src/test/java/com/znsio/teswiz/businessLayer/dineout/DineoutSearchBL.java index ac29193d6..a442c7ef7 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/dineout/DineoutSearchBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/dineout/DineoutSearchBL.java @@ -1,9 +1,9 @@ package com.znsio.teswiz.businessLayer.dineout; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.dineout.DineoutLandingScreen; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/test/java/com/znsio/teswiz/businessLayer/duckduckgo/DuckDuckGoBL.java b/src/test/java/com/znsio/teswiz/businessLayer/duckduckgo/DuckDuckGoBL.java index cfd4f0d6f..caa02d609 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/duckduckgo/DuckDuckGoBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/duckduckgo/DuckDuckGoBL.java @@ -1,6 +1,6 @@ package com.znsio.teswiz.businessLayer.duckduckgo; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Runner; diff --git a/src/test/java/com/znsio/teswiz/businessLayer/failing/FailingBL.java b/src/test/java/com/znsio/teswiz/businessLayer/failing/FailingBL.java index 6fe02c9fe..0118eb4c2 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/failing/FailingBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/failing/FailingBL.java @@ -1,6 +1,6 @@ package com.znsio.teswiz.businessLayer.failing; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Runner; diff --git a/src/test/java/com/znsio/teswiz/businessLayer/googlesearch/GoogleSearchBL.java b/src/test/java/com/znsio/teswiz/businessLayer/googlesearch/GoogleSearchBL.java index d5609c633..912abe3c1 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/googlesearch/GoogleSearchBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/googlesearch/GoogleSearchBL.java @@ -1,6 +1,6 @@ package com.znsio.teswiz.businessLayer.googlesearch; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Runner; @@ -31,4 +31,4 @@ public SearchResultsBL searchFor(String searchText) { assertThat(searchResults).as("Verifying google search results").allMatch(s -> s.toLowerCase().contains(searchText)); return new SearchResultsBL(SAMPLE_TEST_CONTEXT.ME, Runner.getPlatform()); } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/businessLayer/googlesearch/SearchResultsBL.java b/src/test/java/com/znsio/teswiz/businessLayer/googlesearch/SearchResultsBL.java index 4ed7d3a51..257d92bf0 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/googlesearch/SearchResultsBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/googlesearch/SearchResultsBL.java @@ -1,10 +1,10 @@ package com.znsio.teswiz.businessLayer.googlesearch; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.runner.Runner; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; public class SearchResultsBL { diff --git a/src/test/java/com/znsio/teswiz/businessLayer/heartbeat/HeartBeatBL.java b/src/test/java/com/znsio/teswiz/businessLayer/heartbeat/HeartBeatBL.java index 8a98e97bd..ca08899c5 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/heartbeat/HeartBeatBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/heartbeat/HeartBeatBL.java @@ -1,6 +1,6 @@ package com.znsio.teswiz.businessLayer.heartbeat; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.exceptions.InvalidTestDataException; import com.znsio.teswiz.runner.Runner; @@ -26,7 +26,7 @@ public HeartBeatBL() { public HeartBeatBL startHeatBeat(String userPersona) { LOGGER.info("Active thread count: " + Thread.activeCount()); HashMap heartbeatMap = getHeartbeatHashMap(); - if(null != heartbeatMap.get(userPersona.toLowerCase())) { + if (null != heartbeatMap.get(userPersona.toLowerCase())) { throw new InvalidTestDataException(String.format("HeartBeat already started for userPersona: '%s'", userPersona)); } HeartBeat currentUserHeartBeat = new HeartBeat(userPersona, "https://api.open-meteo.com/v1/forecast", 5); @@ -44,7 +44,7 @@ public HeartBeatBL startHeatBeat(String userPersona) { private HashMap getHeartbeatHashMap() { HashMap heartbeatMap = null; - if(null == context.getTestState(SAMPLE_TEST_CONTEXT.HEARTBEAT_MAP)) { + if (null == context.getTestState(SAMPLE_TEST_CONTEXT.HEARTBEAT_MAP)) { LOGGER.info("Initialising HeartBeat hashmap"); heartbeatMap = new HashMap<>(); context.addTestState(SAMPLE_TEST_CONTEXT.HEARTBEAT_MAP, heartbeatMap); @@ -59,7 +59,7 @@ public HeartBeatBL seeHeartBeatFor(String userPersona) { LOGGER.info("Active thread count: " + Thread.activeCount()); HashMap heartbeatMap = getHeartbeatHashMap(); HeartBeat heartBeat = heartbeatMap.get(userPersona.toLowerCase()); - if(null == heartBeat) { + if (null == heartBeat) { throw new InvalidTestDataException(String.format("HeartBeat not running for userPersona: '%s'", userPersona)); } int heartBeatCounter = heartBeat.getHeartBeatCounter(); diff --git a/src/test/java/com/znsio/teswiz/businessLayer/helloWorld/HelloWorldBL.java b/src/test/java/com/znsio/teswiz/businessLayer/helloWorld/HelloWorldBL.java index 45f93a760..f79512500 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/helloWorld/HelloWorldBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/helloWorld/HelloWorldBL.java @@ -1,13 +1,12 @@ package com.znsio.teswiz.businessLayer.helloWorld; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.screen.ScreenShotScreen; import com.znsio.teswiz.screen.helloWorld.HelloWorldScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; public class HelloWorldBL { diff --git a/src/test/java/com/znsio/teswiz/businessLayer/indigo/FlightResultsBL.java b/src/test/java/com/znsio/teswiz/businessLayer/indigo/FlightResultsBL.java index 6a28a9ecc..226975bbf 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/indigo/FlightResultsBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/indigo/FlightResultsBL.java @@ -1,11 +1,11 @@ package com.znsio.teswiz.businessLayer.indigo; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; -import org.apache.logging.log4j.Logger; +import com.znsio.teswiz.runner.Runner; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; public class FlightResultsBL { diff --git a/src/test/java/com/znsio/teswiz/businessLayer/indigo/GiftVoucherBL.java b/src/test/java/com/znsio/teswiz/businessLayer/indigo/GiftVoucherBL.java index 25a52c0e9..af53a3f32 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/indigo/GiftVoucherBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/indigo/GiftVoucherBL.java @@ -1,13 +1,13 @@ package com.znsio.teswiz.businessLayer.indigo; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.indigo.IndigoGiftVouchersScreen; import com.znsio.teswiz.screen.indigo.IndigoHomeScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; import static org.assertj.core.api.Assertions.assertThat; @@ -37,11 +37,11 @@ public GiftVoucherBL() { } private GiftVoucherBL selectWithoutPersonalise(String numberOfGiftVouchersToPurchase, - String denomination) { + String denomination) { IndigoGiftVouchersScreen indigoGiftVouchersScreen = IndigoGiftVouchersScreen.get() - .select(numberOfGiftVouchersToPurchase, - denomination) - .preview(); + .select(numberOfGiftVouchersToPurchase, + denomination) + .preview(); int totalPrice = indigoGiftVouchersScreen.getTotalPrice(); assertThat(totalPrice).as("Computed amount is incorrect").isEqualTo( Integer.parseInt(denomination) * Integer.parseInt(numberOfGiftVouchersToPurchase)); @@ -49,11 +49,11 @@ private GiftVoucherBL selectWithoutPersonalise(String numberOfGiftVouchersToPurc } public GiftVoucherBL selectGiftVoucher(String numberOfGiftVouchersToPurchase, - String denomination) { + String denomination) { IndigoGiftVouchersScreen indigoGiftVouchersScreen = IndigoHomeScreen.get() - .selectGiftVouchers() - .select(numberOfGiftVouchersToPurchase, - denomination); + .selectGiftVouchers() + .select(numberOfGiftVouchersToPurchase, + denomination); int totalPrice = indigoGiftVouchersScreen.getTotalPrice(); assertThat(totalPrice).as("Computed amount is incorrect").isEqualTo( Integer.parseInt(denomination) * Integer.parseInt(numberOfGiftVouchersToPurchase)); @@ -62,14 +62,14 @@ public GiftVoucherBL selectGiftVoucher(String numberOfGiftVouchersToPurchase, } public GiftVoucherBL selectGiftVoucherAndPersonalise(String numberOfGiftVouchersToPurchase, - String denomination, String forWhom, - String customMessage) { + String denomination, String forWhom, + String customMessage) { IndigoGiftVouchersScreen indigoGiftVouchersScreen = IndigoHomeScreen.get() - .selectGiftVouchers() - .select(numberOfGiftVouchersToPurchase, - denomination, - forWhom, - customMessage); + .selectGiftVouchers() + .select(numberOfGiftVouchersToPurchase, + denomination, + forWhom, + customMessage); int totalPrice = indigoGiftVouchersScreen.getTotalPrice(); assertThat(totalPrice).as("Computed amount is incorrect").isEqualTo( Integer.parseInt(denomination) * Integer.parseInt(numberOfGiftVouchersToPurchase)); diff --git a/src/test/java/com/znsio/teswiz/businessLayer/indigo/IndigoBL.java b/src/test/java/com/znsio/teswiz/businessLayer/indigo/IndigoBL.java index 8ebeba218..b663fc9e9 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/indigo/IndigoBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/indigo/IndigoBL.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.businessLayer.indigo; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.indigo.IndigoHomeScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; public class IndigoBL { @@ -34,10 +34,10 @@ public IndigoBL() { } public FlightResultsBL searchForTicket(String journeyType, String from, String destination, - String numberOfAdults) { + String numberOfAdults) { IndigoHomeScreen.get().selectJourneyType(journeyType) - .selectNumberOfAdultPassengers(Integer.parseInt(numberOfAdults)) - .selectFrom(from).selectTo(destination).searchFlightOptions(); + .selectNumberOfAdultPassengers(Integer.parseInt(numberOfAdults)) + .selectFrom(from).selectTo(destination).searchFlightOptions(); return new FlightResultsBL(); } } diff --git a/src/test/java/com/znsio/teswiz/businessLayer/interactiveCalculatorCLI/InteractiveCalculatorCLIBL.java b/src/test/java/com/znsio/teswiz/businessLayer/interactiveCalculatorCLI/InteractiveCalculatorCLIBL.java index 5ff5ce5d7..ca3e14c29 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/interactiveCalculatorCLI/InteractiveCalculatorCLIBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/interactiveCalculatorCLI/InteractiveCalculatorCLIBL.java @@ -1,6 +1,6 @@ package com.znsio.teswiz.businessLayer.interactiveCalculatorCLI; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.entities.TEST_CONTEXT; diff --git a/src/test/java/com/znsio/teswiz/businessLayer/jiocinema/JioCinemaBL.java b/src/test/java/com/znsio/teswiz/businessLayer/jiocinema/JioCinemaBL.java index 2c5e8da23..4d366837a 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/jiocinema/JioCinemaBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/jiocinema/JioCinemaBL.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.businessLayer.jiocinema; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Direction; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.jiocinema.JioCinemaScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; import static org.assertj.core.api.Assertions.assertThat; @@ -54,4 +54,4 @@ public JioCinemaBL verifyMovieNumberVisibleOnScreen(int movieNumberOnScreen) { .isTrue(); return this; } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/AuthBL.java b/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/AuthBL.java index 918b6bd31..613f78643 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/AuthBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/AuthBL.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.businessLayer.jiomeet; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.jiomeet.SignInScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; import java.util.Map; @@ -48,12 +48,12 @@ public LandingBL signIn(Map userDetails) { String lastName = String.valueOf(userDetails.get("lastName")); String expectedWelcomeMessageAndroid = "Hello " + firstName + " \n" + "what would you " + - "like to do?"; + "like to do?"; String expectedWelcomeMessageWeb = "Hello " + firstName + " " + lastName + ", what would " + - "you like to do?"; + "you like to do?"; String expectedWelcomeMessage = currentPlatform.equals(Platform.web) || currentPlatform.equals(Platform.electron) ? expectedWelcomeMessageWeb - : expectedWelcomeMessageAndroid; + : expectedWelcomeMessageAndroid; String signedInWelcomeMessage = SignInScreen.get().signIn(username, password) .getSignedInWelcomeMessage(); diff --git a/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/InAMeetingBL.java b/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/InAMeetingBL.java index 7f33b1551..c1308c8e2 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/InAMeetingBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/InAMeetingBL.java @@ -1,6 +1,6 @@ package com.znsio.teswiz.businessLayer.jiomeet; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Runner; diff --git a/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/JoinAMeetingBL.java b/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/JoinAMeetingBL.java index ad8c43a75..87f39e6c4 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/JoinAMeetingBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/JoinAMeetingBL.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.businessLayer.jiomeet; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.jiomeet.SignInScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; import static org.assertj.core.api.Assertions.assertThat; @@ -38,9 +38,9 @@ public JoinAMeetingBL() { public InAMeetingBL joinMeeting(String meetingId, String meetingPassword) { boolean hasMeetingStarted = SignInScreen.get().joinAMeeting(meetingId, meetingPassword, currentUserPersona) - .isMeetingStarted(); + .isMeetingStarted(); assertThat(hasMeetingStarted).as(currentUserPersona + " not yet joined the meeting") - .isTrue(); + .isTrue(); return new InAMeetingBL(); } } diff --git a/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/LandingBL.java b/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/LandingBL.java index 3168f75c7..a36050f63 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/LandingBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/jiomeet/LandingBL.java @@ -1,13 +1,13 @@ package com.znsio.teswiz.businessLayer.jiomeet; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.jiomeet.InAMeetingScreen; import com.znsio.teswiz.screen.jiomeet.LandingScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; import static org.assertj.core.api.Assertions.assertThat; diff --git a/src/test/java/com/znsio/teswiz/businessLayer/notepad/NotepadBL.java b/src/test/java/com/znsio/teswiz/businessLayer/notepad/NotepadBL.java index 7c3798a57..bf2895297 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/notepad/NotepadBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/notepad/NotepadBL.java @@ -1,13 +1,13 @@ package com.znsio.teswiz.businessLayer.notepad; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.ScreenShotScreen; import com.znsio.teswiz.screen.notepad.NotepadScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; public class NotepadBL { diff --git a/src/test/java/com/znsio/teswiz/businessLayer/pdfValidator/PDFValidatorBL.java b/src/test/java/com/znsio/teswiz/businessLayer/pdfValidator/PDFValidatorBL.java index c94b9c1f4..581350047 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/pdfValidator/PDFValidatorBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/pdfValidator/PDFValidatorBL.java @@ -2,9 +2,8 @@ import com.applitools.eyes.TestResults; import com.applitools.eyes.TestResultsStatus; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.entities.TEST_CONTEXT; import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.pdfValidator.PDFValidatorScreen; @@ -14,8 +13,6 @@ import java.util.Arrays; -import static org.assertj.core.api.Assertions.assertThat; - public class PDFValidatorBL { private static final Logger LOGGER = LogManager.getLogger(PDFValidatorBL.class.getName()); private final TestExecutionContext context; diff --git a/src/test/java/com/znsio/teswiz/businessLayer/restUser/JsonPlaceHolderBL.java b/src/test/java/com/znsio/teswiz/businessLayer/restUser/JsonPlaceHolderBL.java index c8fabebc1..fe485f58f 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/restUser/JsonPlaceHolderBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/restUser/JsonPlaceHolderBL.java @@ -6,9 +6,11 @@ import kong.unirest.HttpResponse; import kong.unirest.JsonNode; import kong.unirest.json.JSONObject; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import java.util.Map; + import static org.assertj.core.api.Assertions.assertThat; public class JsonPlaceHolderBL { @@ -20,7 +22,7 @@ public class JsonPlaceHolderBL { public JsonPlaceHolderBL createPost() { Object jsonBody = testData.get("postBody"); LOGGER.info("Creating a post"); - HttpResponse jsonResponse = UnirestService.postHttpRequest(base_URL,jsonBody); + HttpResponse jsonResponse = UnirestService.postHttpRequest(base_URL, jsonBody); assertThat(jsonResponse.getStatus()).as("Received API status code for POST method incorrect!") .isEqualTo(201); LOGGER.info("Verifying post is created successfully"); @@ -32,7 +34,7 @@ public JsonPlaceHolderBL createPost() { public JSONObject updatePost() { LOGGER.info("Updating a post"); Object jsonBody = testData.get("patchBody"); - HttpResponse jsonResponse = UnirestService.patchHttpRequest(base_URL+"/1", jsonBody); + HttpResponse jsonResponse = UnirestService.patchHttpRequest(base_URL + "/1", jsonBody); assertThat(jsonResponse.getStatus()).as("Received API status code for PATCH method incorrect!") .isEqualTo(200); return jsonResponse.getBody().getObject(); @@ -48,13 +50,13 @@ public JsonPlaceHolderBL verifyPostUpdatedSuccessfully(JSONObject jsonResponse) public int deletePost() { LOGGER.info("Verifying post is deleted successfully"); - HttpResponse jsonResponse = UnirestService.deleteHttpRequest(base_URL+"/1"); + HttpResponse jsonResponse = UnirestService.deleteHttpRequest(base_URL + "/1"); assertThat(jsonResponse.getStatus()).as("Received API status code for Delete method incorrect!") .isEqualTo(200); return jsonResponse.getStatus(); } - public JsonPlaceHolderBL verifyIfPostDeleted(int status){ + public JsonPlaceHolderBL verifyIfPostDeleted(int status) { assertThat(status).as("Received API status code for Delete method incorrect!") .isEqualTo(200); return this; diff --git a/src/test/java/com/znsio/teswiz/businessLayer/search/SearchBL.java b/src/test/java/com/znsio/teswiz/businessLayer/search/SearchBL.java index c5c0b1661..e17b5049a 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/search/SearchBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/search/SearchBL.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.businessLayer.search; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.ScreenShotScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; public class SearchBL { diff --git a/src/test/java/com/znsio/teswiz/businessLayer/theapp/AppBL.java b/src/test/java/com/znsio/teswiz/businessLayer/theapp/AppBL.java index c1e2234f3..2d3a55f22 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/theapp/AppBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/theapp/AppBL.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.businessLayer.theapp; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.ScreenShotScreen; import com.znsio.teswiz.screen.theapp.AppLaunchScreen; import com.znsio.teswiz.screen.theapp.LoginScreen; import com.znsio.teswiz.tools.cmd.CommandLineExecutor; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; public class AppBL { @@ -66,7 +66,7 @@ public AppBL goBack() { public AppBL stopTheAppAndLaunchItAgain() { forceStopTheApp(); LOGGER.info("Start theapp"); - String[] startTheApp = new String[] {"adb shell am start com.appiumpro.the_app/com.appiumpro.the_app.MainActivity"}; + String[] startTheApp = new String[]{"adb shell am start com.appiumpro.the_app/com.appiumpro.the_app.MainActivity"}; CommandLineExecutor.execCommand(startTheApp); ScreenShotScreen.get().takeScreenshot(); return this; @@ -74,7 +74,7 @@ public AppBL stopTheAppAndLaunchItAgain() { public AppBL forceStopTheApp() { LOGGER.info("ForceStop TheApp"); - String[] forceStopTheApp = new String[] {"adb shell am force-stop com.appiumpro.the_app"}; + String[] forceStopTheApp = new String[]{"adb shell am force-stop com.appiumpro.the_app"}; CommandLineExecutor.execCommand(forceStopTheApp); return this; } diff --git a/src/test/java/com/znsio/teswiz/businessLayer/theapp/ClipboardBL.java b/src/test/java/com/znsio/teswiz/businessLayer/theapp/ClipboardBL.java index 3f41a8c9a..c5edc4363 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/theapp/ClipboardBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/theapp/ClipboardBL.java @@ -1,13 +1,13 @@ package com.znsio.teswiz.businessLayer.theapp; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.theapp.AppLaunchScreen; import com.znsio.teswiz.screen.theapp.ClipboardDemoScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; import static org.assertj.core.api.Assertions.assertThat; @@ -42,7 +42,7 @@ public ClipboardBL saveContentInClipboard(String content) { public ClipboardBL verifyContentIsSaved(String contentExpectedInClipboard) { boolean isAddedContentExistingInClipboard = ClipboardDemoScreen.get() - .doesAddedContentExistInClipboard(); + .doesAddedContentExistInClipboard(); assertThat(isAddedContentExistingInClipboard).as( String.format("Content: '%s' is not added in the clipboard", contentExpectedInClipboard)).isTrue(); diff --git a/src/test/java/com/znsio/teswiz/businessLayer/theapp/EchoBL.java b/src/test/java/com/znsio/teswiz/businessLayer/theapp/EchoBL.java index 3809581cc..58f1fad81 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/theapp/EchoBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/theapp/EchoBL.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.businessLayer.theapp; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.theapp.AppLaunchScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; public class EchoBL { diff --git a/src/test/java/com/znsio/teswiz/businessLayer/theapp/FileUploadBL.java b/src/test/java/com/znsio/teswiz/businessLayer/theapp/FileUploadBL.java index b62ece20e..e32128854 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/theapp/FileUploadBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/theapp/FileUploadBL.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.businessLayer.theapp; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.theapp.FileUploadScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; import java.util.Map; @@ -49,7 +49,7 @@ public FileUploadBL uploadFile(Map file) { public FileUploadBL verifyFileUpload() { assertThat(FileUploadScreen.get().getFileUploadText()).as("File upload validation") - .contains("File Uploaded!"); + .contains("File Uploaded!"); return this; } diff --git a/src/test/java/com/znsio/teswiz/businessLayer/theapp/LoginBL.java b/src/test/java/com/znsio/teswiz/businessLayer/theapp/LoginBL.java index 3ded0e651..458fbdd60 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/theapp/LoginBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/theapp/LoginBL.java @@ -1,6 +1,6 @@ package com.znsio.teswiz.businessLayer.theapp; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.runner.Runner; import org.assertj.core.api.SoftAssertions; diff --git a/src/test/java/com/znsio/teswiz/businessLayer/vodqa/VodqaBL.java b/src/test/java/com/znsio/teswiz/businessLayer/vodqa/VodqaBL.java index 8aad1065d..5fcb60b8e 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/vodqa/VodqaBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/vodqa/VodqaBL.java @@ -1,14 +1,14 @@ package com.znsio.teswiz.businessLayer.vodqa; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.screen.vodqa.DragAndDropScreen; import com.znsio.teswiz.screen.vodqa.VodqaScreen; import com.znsio.teswiz.screen.vodqa.WebViewScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.SoftAssertions; import org.openqa.selenium.Dimension; @@ -81,7 +81,7 @@ public VodqaBL verifyUserMoveToNextPage(String pageHeading) { public VodqaBL enterAndVerifyLoginOptionUnderWebViewSection() { LOGGER.info("Entering into hacker news under webView section"); assertThat(VodqaScreen.get().enterIntoNewsWebViewSection() - .isUserOnNewsWebViewScreen()) + .isUserOnNewsWebViewScreen()) .as("User unable to navigate to news webview screen") .isTrue(); @@ -95,8 +95,8 @@ public VodqaBL enterAndVerifyLoginOptionUnderWebViewSection() { public VodqaBL enterIntoNativeViewSection() { LOGGER.info("Navigating into Native view section"); assertThat(WebViewScreen.get().navigateToSamplesList() - .enterIntoNativeViewSection() - .isUserOnNativeViewScreen()) + .enterIntoNativeViewSection() + .isUserOnNativeViewScreen()) .as("User Unable to navigate to native view section") .isTrue(); return this; @@ -110,7 +110,7 @@ public VodqaBL verifyAppWorksInBackground(int time) { } public VodqaBL isElementWithTextVisible(String elementText) { - boolean isScrollSuccessful= VodqaScreen.get().isElementWithTextVisible(elementText); + boolean isScrollSuccessful = VodqaScreen.get().isElementWithTextVisible(elementText); assertThat(isScrollSuccessful).as("Scroll was not successful, text is not visible").isTrue(); return this; } @@ -133,7 +133,7 @@ public VodqaBL isMessageDisplayedOnTheScreen(String displayedMessage) { public VodqaBL doubleTapOnAnElement() { assertThat(VodqaScreen.get().doubleTapOnElement() - .isDoubleTapSuccessful()) + .isDoubleTapSuccessful()) .as("Double tap on element failed") .isTrue(); return this; @@ -162,10 +162,10 @@ public VodqaBL pinchAndZoomOutOnAnElement() { assertThat(vodqaScreen.pinchAndZoomOutOnAnElement().isPinchAndZoomOutSuccessful(elementDimension)).as("Pinch and Zoom Out on an element failed").isTrue(); return this; } - + public VodqaBL performMultiTouchForBothSilders(float sliderValue) { VodqaScreen.get().multiTouchOnElements(); assertThat(VodqaScreen.get().getSliderValue()).as("Multi Touch failed as slider value is not equal").isEqualTo(sliderValue); return this; } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/businessLayer/weatherAPI/WeatherAPIBL.java b/src/test/java/com/znsio/teswiz/businessLayer/weatherAPI/WeatherAPIBL.java index 7165569ec..179aef128 100644 --- a/src/test/java/com/znsio/teswiz/businessLayer/weatherAPI/WeatherAPIBL.java +++ b/src/test/java/com/znsio/teswiz/businessLayer/weatherAPI/WeatherAPIBL.java @@ -5,10 +5,12 @@ import kong.unirest.HttpResponse; import kong.unirest.JsonNode; import kong.unirest.json.JSONObject; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import java.util.HashMap; import java.util.Map; + import static org.assertj.core.api.Assertions.assertThat; public class WeatherAPIBL { @@ -18,33 +20,33 @@ public class WeatherAPIBL { public JSONObject getCurrentWeatherJSON() { LOGGER.info("Getting current weather data for given location coordinates"); - HashMap queryString= new HashMap<>(){{ - put("latitude",testData.get("latitude").toString()); - put("longitude",testData.get("longitude").toString()); - put("current_weather",true); + HashMap queryString = new HashMap<>() {{ + put("latitude", testData.get("latitude").toString()); + put("longitude", testData.get("longitude").toString()); + put("current_weather", true); }}; - HttpResponse jsonResponse= UnirestService.getHttpResponseWithQueryMap(base_URL,queryString); + HttpResponse jsonResponse = UnirestService.getHttpResponseWithQueryMap(base_URL, queryString); assertThat(jsonResponse.getStatus()).as("API status code incorrect!") .isEqualTo(200); return jsonResponse.getBody().getObject().getJSONObject("current_weather"); } public WeatherAPIBL verifyCurrentTemperature(JSONObject jsonResponse, int lowerLimit, int upperLimit) { - LOGGER.info("Verifying weather is in range "+lowerLimit+" and "+upperLimit+" C"); + LOGGER.info("Verifying weather is in range " + lowerLimit + " and " + upperLimit + " C"); assertThat(((int) jsonResponse.getDouble("temperature"))).as("Temperature value incorrect!") - .isBetween(lowerLimit,upperLimit); + .isBetween(lowerLimit, upperLimit); return this; } public JSONObject getForecastForInvalidDays() { LOGGER.info("Getting temperature forecast"); - HashMap queryString= new HashMap<>(){{ - put("latitude",testData.get("latitude").toString()); - put("longitude",testData.get("longitude").toString()); - put("hourly",testData.get("hourly").toString()); - put("forecast_days",testData.get("days").toString()); + HashMap queryString = new HashMap<>() {{ + put("latitude", testData.get("latitude").toString()); + put("longitude", testData.get("longitude").toString()); + put("hourly", testData.get("hourly").toString()); + put("forecast_days", testData.get("days").toString()); }}; - HttpResponse jsonResponse= UnirestService.getHttpResponseWithQueryMap(base_URL,queryString); + HttpResponse jsonResponse = UnirestService.getHttpResponseWithQueryMap(base_URL, queryString); assertThat(jsonResponse.getStatus()).as("API status code incorrect!") .isEqualTo(400); return jsonResponse.getBody().getObject(); @@ -60,28 +62,28 @@ public WeatherAPIBL verifyErrorForInvalidForecastDays(JSONObject jsonObject, Str public JSONObject getCurrentWeatherJSON(String latitude, String longitude) { LOGGER.info("Getting current weather data for given location coordinates"); - HashMap queryString= new HashMap<>(){{ - put("latitude",latitude); - put("longitude",longitude); - put("current_weather",true); + HashMap queryString = new HashMap<>() {{ + put("latitude", latitude); + put("longitude", longitude); + put("current_weather", true); }}; - HttpResponse jsonResponse= UnirestService.getHttpResponseWithQueryMap(base_URL,queryString); + HttpResponse jsonResponse = UnirestService.getHttpResponseWithQueryMap(base_URL, queryString); assertThat(jsonResponse.getStatus()).as("API status code incorrect!") .isEqualTo(200); return jsonResponse.getBody().getObject().getJSONObject("current_weather"); } public WeatherAPIBL verifyCurrentWindSpeed(JSONObject jsonResponse, int lowerLimit, int upperLimit) { - LOGGER.info("Verifying wind speed is in range "+lowerLimit+" and "+upperLimit); + LOGGER.info("Verifying wind speed is in range " + lowerLimit + " and " + upperLimit); assertThat(((int) jsonResponse.getDouble("windspeed"))).as("Wind speed value incorrect!") - .isBetween(lowerLimit,upperLimit); + .isBetween(lowerLimit, upperLimit); return this; } public JSONObject getLocationCoordinatesFor(String city) { - LOGGER.info("Getting coordinates for city "+city); + LOGGER.info("Getting coordinates for city " + city); String geocode_url = testData.get("geocode_url").toString(); - HttpResponse jsonResponse= UnirestService.getHttpResponseWithQueryParameter(geocode_url, "q", city); + HttpResponse jsonResponse = UnirestService.getHttpResponseWithQueryParameter(geocode_url, "q", city); assertThat(jsonResponse.getStatus()).as("API status code incorrect!") .isEqualTo(200); return jsonResponse.getBody().getArray().getJSONObject(0); @@ -104,7 +106,7 @@ public String getLongitudeFromJSON(JSONObject jsonObject) { } public WeatherAPIBL verifyCurrentWindDirection(JSONObject jsonObject, int maxWindDirection) { - LOGGER.info("Verifying maximum wind direction is less than: "+maxWindDirection + " from response: " + jsonObject); + LOGGER.info("Verifying maximum wind direction is less than: " + maxWindDirection + " from response: " + jsonObject); assertThat((Integer) jsonObject.get("winddirection")) .as("Wind direction above maximum limit!").isLessThan(maxWindDirection); return this; diff --git a/src/test/java/com/znsio/teswiz/runner/AppPathTest.java b/src/test/java/com/znsio/teswiz/runner/AppPathTest.java index 84738896a..04e226db8 100644 --- a/src/test/java/com/znsio/teswiz/runner/AppPathTest.java +++ b/src/test/java/com/znsio/teswiz/runner/AppPathTest.java @@ -1,8 +1,11 @@ package com.znsio.teswiz.runner; import com.znsio.teswiz.exceptions.InvalidTestDataException; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.assertj.core.api.Assertions; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import java.io.File; import java.io.IOException; @@ -10,50 +13,60 @@ import java.nio.file.Path; import java.nio.file.Paths; -import static org.junit.jupiter.api.Assertions.*; - public class AppPathTest { - private static final String LOG_DIR = "./target/testLogs"; + + private static final Logger LOGGER = LogManager.getLogger(AppPathTest.class.getName()); private static final String directoryPath = System.getProperty("user.dir") + File.separator + "temp" + File.separator + "unitTests" + File.separator + "sampleApps"; private static final String fileName = "VodQA.apk"; private static final String expectedAppPath = directoryPath + File.separator + fileName; + private static final String appPathAsCorrectFilePath = expectedAppPath; private static final String appPathAsCorrectUrl = "https://github.com/anandbagmar/sampleAppsForNativeMobileAutomation/raw/main/VodQA.apk"; private static final String appPathAsIncorrectUrl = "https://github.com/anandbagmar/sampleAppsForNativeMobileAutomation/ra/main/VodQA.apk"; - private static final String appPathAsCorrectFilePath = expectedAppPath; private static final String appPathAsIncorrectFilePath = System.getProperty("user.dir") + File.separator + "temp" + File.separator + "unitTests" + File.separator + "smleApps" + File.separator + fileName; - @BeforeAll + @BeforeClass public static void setupBefore() { - System.setProperty("LOG_DIR", LOG_DIR); - new File(LOG_DIR).mkdirs(); + LOGGER.info("Using LOG_DIR: " + System.getProperty("LOG_DIR")); } @Test void givenIncorrectUrl_WhenDirectoryAndFileDoNotExist_ThenIOExceptionOccurWhileTryingToDownloadFile() { deleteDirectoryUsedForUnitTests(); - assertThrows(InvalidTestDataException.class, () -> DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsIncorrectUrl, directoryPath)); + Assertions.assertThatThrownBy(() -> { + DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsIncorrectUrl, directoryPath); + }) + .isInstanceOf(InvalidTestDataException.class) // Verify exception type + .hasMessage("URL is not accessible: " + appPathAsIncorrectUrl); } @Test void givenIncorrectUrl_WhenDirectoryExistAndFileDoNotExist_ThenIOExceptionOccurWhileTryingToDownloadFile() { createDirectoryUsedForUnitTests(); deleteFile(appPathAsCorrectFilePath); - assertThrows(InvalidTestDataException.class, () -> DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsIncorrectUrl, directoryPath)); + Assertions.assertThatThrownBy(() -> { + DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsIncorrectUrl, directoryPath); + }) + .isInstanceOf(InvalidTestDataException.class) + .hasMessage("URL is not accessible: " + appPathAsIncorrectUrl); } @Test void givenIncorrectUrl_WhenDirectoryAndFileBothExist_ThenFileIsReadable() { createDirectoryUsedForUnitTests(); DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsCorrectUrl, directoryPath); - assertThrows(InvalidTestDataException.class, () -> DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsIncorrectUrl, directoryPath)); + Assertions.assertThatThrownBy(() -> { + DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsIncorrectUrl, directoryPath); + }) + .isInstanceOf(InvalidTestDataException.class) + .hasMessage("URL is not accessible: " + appPathAsIncorrectUrl); } @Test void givenCorrectUrl_WhenDirectoryAndFileDoNotExist_ThenCreateDirectoryAndDownloadFile() { deleteDirectoryUsedForUnitTests(); String actualAppPath = DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsCorrectUrl, directoryPath); - assertEquals(expectedAppPath, actualAppPath); - assertTrue(new File(actualAppPath).canRead()); + Assertions.assertThat(expectedAppPath).isEqualTo(actualAppPath); + Assertions.assertThat(new File(actualAppPath).canRead()).isTrue(); } @Test @@ -61,50 +74,70 @@ void givenCorrectUrl_WhenDirectoryExistButFileDoNotExist_ThenDownloadFile() { createDirectoryUsedForUnitTests(); deleteFile(appPathAsCorrectFilePath); String actualAppPath = DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsCorrectUrl, directoryPath); - assertEquals(expectedAppPath, actualAppPath); - assertTrue(new File(actualAppPath).canRead()); + Assertions.assertThat(expectedAppPath).isEqualTo(actualAppPath); + Assertions.assertThat(new File(actualAppPath).canRead()).isTrue(); } @Test void givenCorrectUrl_WhenDirectoryAndFileAlreadyExist_ThenDoNotDownloadFile() { createDirectoryUsedForUnitTests(); DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsCorrectUrl, directoryPath); - assertTrue(new File(expectedAppPath).canRead()); + Assertions.assertThat(new File(expectedAppPath).canRead()).isTrue(); String actualAppPath = DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsCorrectUrl, directoryPath); - assertTrue(new File(actualAppPath).canRead()); - assertEquals(expectedAppPath, actualAppPath); + Assertions.assertThat(new File(actualAppPath).canRead()).isTrue(); + Assertions.assertThat(expectedAppPath).isEqualTo(actualAppPath); } @Test void givenIncorrectFilePath_WhenDirectoryAndFileDoNotExist_ThenFileIsNotReadable() { deleteDirectoryUsedForUnitTests(); - assertThrows(InvalidTestDataException.class, () -> DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsIncorrectFilePath, directoryPath)); + Assertions.assertThatThrownBy(() -> { + DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsIncorrectFilePath, directoryPath); + }) + .isInstanceOf(InvalidTestDataException.class) + .hasMessage(String.format("App file path '%s' provided in capabilities is incorrect", appPathAsIncorrectFilePath)); } @Test void givenIncorrectFilePath_WhenDirectoryExistButFileDoNotExist_ThenFileIsNotReadable() { createDirectoryUsedForUnitTests(); deleteFile(appPathAsCorrectFilePath); - assertThrows(InvalidTestDataException.class, () -> DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsIncorrectFilePath, directoryPath)); + Assertions.assertThatThrownBy(() -> { + DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsIncorrectFilePath, directoryPath); + }) + .isInstanceOf(InvalidTestDataException.class) + .hasMessage(String.format("App file path '%s' provided in capabilities is incorrect", appPathAsIncorrectFilePath)); } @Test void givenIncorrectFilePath_WhenDirectoryAndFileExist_ThenFileIsNotReadable() { createDirectoryUsedForUnitTests(); - assertThrows(InvalidTestDataException.class, () -> DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsIncorrectFilePath, directoryPath)); + Assertions.assertThatThrownBy(() -> { + DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsIncorrectFilePath, directoryPath); + }) + .isInstanceOf(InvalidTestDataException.class) + .hasMessage(String.format("App file path '%s' provided in capabilities is incorrect", appPathAsIncorrectFilePath)); } @Test void givenCorrectFilePath_WhenDirectoryAndFileDoNotExist_ThenFileIsNotReadable() { deleteDirectoryUsedForUnitTests(); - assertThrows(RuntimeException.class, () -> DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsCorrectFilePath, directoryPath)); + Assertions.assertThatThrownBy(() -> { + DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsCorrectFilePath, directoryPath); + }) + .isInstanceOf(RuntimeException.class) + .hasMessage(String.format("App file path '%s' provided in capabilities is incorrect", appPathAsCorrectFilePath)); } @Test void givenCorrectFilePath_WhenDirectoryExistButFileDoNotExist_ThenFileIsNotReadable() { createDirectoryUsedForUnitTests(); deleteFile(appPathAsCorrectFilePath); - assertThrows(RuntimeException.class, () -> DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsCorrectFilePath, directoryPath)); + Assertions.assertThatThrownBy(() -> { + DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsCorrectFilePath, directoryPath); + }) + .isInstanceOf(RuntimeException.class) + .hasMessage(String.format("App file path '%s' provided in capabilities is incorrect", appPathAsCorrectFilePath)); } @Test @@ -112,8 +145,8 @@ void givenCorrectFilePath_WhenDirectoryAndFileAlreadyExist_ThenFileIsReadable() createDirectoryUsedForUnitTests(); DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsCorrectUrl, directoryPath); String actualAppPath = DeviceSetup.downloadAppToDirectoryIfNeeded(appPathAsCorrectFilePath, directoryPath); - assertTrue(new File(actualAppPath).canRead()); - assertEquals(expectedAppPath, actualAppPath); + Assertions.assertThat(new File(actualAppPath).canRead()).isTrue(); + Assertions.assertThat(expectedAppPath).isEqualTo(actualAppPath); } private void deleteFile(String filePath) { diff --git a/src/test/java/com/znsio/teswiz/runner/BrowserStackDeviceFilterTest.java b/src/test/java/com/znsio/teswiz/runner/BrowserStackDeviceFilterTest.java index 01c40fdc2..9e550ed4c 100644 --- a/src/test/java/com/znsio/teswiz/runner/BrowserStackDeviceFilterTest.java +++ b/src/test/java/com/znsio/teswiz/runner/BrowserStackDeviceFilterTest.java @@ -3,9 +3,12 @@ import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.assertj.core.api.Assertions; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; import java.io.File; import java.io.FileNotFoundException; @@ -18,28 +21,25 @@ import java.util.List; import java.util.Map; -import static org.junit.jupiter.api.Assertions.assertEquals; - class BrowserStackDeviceFilterTest { - - List browserStackDevices; + private static final Logger LOGGER = LogManager.getLogger(BrowserStackDeviceFilterTest.class.getName()); private static final String LOG_DIR = "./target/testLogs"; - + List browserStackDevices; Method applyFilters; - @BeforeAll + @BeforeClass public static void setupBefore() { - System.setProperty("LOG_DIR", LOG_DIR); - new File(LOG_DIR).mkdirs(); + LOGGER.info("Using LOG_DIR: " + System.getProperty("LOG_DIR")); } - @BeforeEach + @BeforeMethod public void Setup() throws FileNotFoundException, NoSuchMethodException { String file = new File("").getAbsoluteFile() - .getAbsolutePath() + "/src/test/resources/devicesList.json"; + .getAbsolutePath() + "/src/test/resources/devicesList.json"; JsonReader reader = new JsonReader(new FileReader(file)); browserStackDevices = new Gson().fromJson(reader, - new TypeToken>() {}.getType()); + new TypeToken>() { + }.getType()); applyFilters = BrowserStackDeviceFilter.class.getDeclaredMethod("applyFilters", List.class, Map.class); @@ -48,91 +48,91 @@ public void Setup() throws FileNotFoundException, NoSuchMethodException { @Test void userCanGetDevicesAfterApplyingOSBasedFilter() throws InvocationTargetException, - IllegalAccessException { + IllegalAccessException { Map osBasedFilter = new HashMap<>(); osBasedFilter.put("Os", "android"); List osBasedDevices = (List) applyFilters.invoke( null, browserStackDevices, osBasedFilter); - assertEquals(118, osBasedDevices.size()); + Assertions.assertThat(118).isEqualTo(osBasedDevices.size()); osBasedFilter.replace("Os", "Android"); osBasedDevices = (List) applyFilters.invoke(null, browserStackDevices, osBasedFilter); - assertEquals(118, osBasedDevices.size()); + Assertions.assertThat(118).isEqualTo(osBasedDevices.size()); } @Test void userCanGetDevicesAfterApplyingOSVersionFilter() throws InvocationTargetException, - IllegalAccessException { + IllegalAccessException { Map osVersionFilter = new HashMap<>(); osVersionFilter.put("Os_version", "11.0"); List osVersionBasedDevices = (List) applyFilters.invoke( - null, browserStackDevices, osVersionFilter); + null, browserStackDevices, osVersionFilter); - assertEquals(23, osVersionBasedDevices.size()); + Assertions.assertThat(23).isEqualTo(osVersionBasedDevices.size()); osVersionFilter.replace("Os_version", "Big Sur"); osVersionBasedDevices = (List) applyFilters.invoke(null, browserStackDevices, osVersionFilter); - assertEquals(199, osVersionBasedDevices.size()); + Assertions.assertThat(199).isEqualTo(osVersionBasedDevices.size()); osVersionFilter.replace("Os_version", "big Sur"); osVersionBasedDevices = (List) applyFilters.invoke(null, browserStackDevices, osVersionFilter); - assertEquals(199, osVersionBasedDevices.size()); + Assertions.assertThat(199).isEqualTo(osVersionBasedDevices.size()); } @Test void userCanGetDevicesAfterApplyingBrowserFilter() throws InvocationTargetException, - IllegalAccessException { + IllegalAccessException { Map browserFilter = new HashMap<>(); browserFilter.put("Browser", "firefox"); List filteredDevices = (List) applyFilters.invoke( null, browserStackDevices, browserFilter); - assertEquals(1540, filteredDevices.size()); + Assertions.assertThat(1540).isEqualTo(filteredDevices.size()); browserFilter.replace("Browser", "Firefox"); filteredDevices = (List) applyFilters.invoke(null, browserStackDevices, browserFilter); - assertEquals(1540, filteredDevices.size()); + Assertions.assertThat(1540).isEqualTo(filteredDevices.size()); } @Test void userCanGetDeviceAfterApplyingDeviceNameFilter() throws InvocationTargetException, - IllegalAccessException, - IOException { + IllegalAccessException, + IOException { Map deviceNameFilter = new LinkedHashMap<>(); deviceNameFilter.put("Device", "samsung"); List filteredDevices = (List) applyFilters.invoke( null, browserStackDevices, deviceNameFilter); - assertEquals(77, filteredDevices.size()); + Assertions.assertThat(77).isEqualTo(filteredDevices.size()); deviceNameFilter.replace("Device", "Samsung"); filteredDevices = (List) applyFilters.invoke(null, browserStackDevices, deviceNameFilter); - assertEquals(77, filteredDevices.size()); + Assertions.assertThat(77).isEqualTo(filteredDevices.size()); } @Test void userCanGetDevicesAfterApplyingBrowserVersionFilter() throws InvocationTargetException, - IllegalAccessException { + IllegalAccessException { Map browserVersionFilter = new HashMap<>(); browserVersionFilter.put("Browser_version", "95.0"); List browserVersionFilteredDevices = (List) applyFilters.invoke( null, browserStackDevices, browserVersionFilter); - assertEquals(37, browserVersionFilteredDevices.size()); + Assertions.assertThat(37).isEqualTo(browserVersionFilteredDevices.size()); } @Test @@ -142,6 +142,6 @@ void userCanGetDevicesThatAreOnlyMobile() throws InvocationTargetException, Ille List mobileDevices = (List) applyFilters.invoke( null, browserStackDevices, mobileDeviceFilter); - assertEquals(193, mobileDevices.size()); + Assertions.assertThat(193).isEqualTo(mobileDevices.size()); } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/runner/BrowserStackImageInjectionTest.java b/src/test/java/com/znsio/teswiz/runner/BrowserStackImageInjectionTest.java index 4fcc2fee9..e7d73789d 100644 --- a/src/test/java/com/znsio/teswiz/runner/BrowserStackImageInjectionTest.java +++ b/src/test/java/com/znsio/teswiz/runner/BrowserStackImageInjectionTest.java @@ -1,12 +1,11 @@ package com.znsio.teswiz.runner; import io.appium.java_client.android.AndroidDriver; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; -import org.junit.jupiter.api.BeforeAll; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.remote.DesiredCapabilities; +import org.testng.annotations.BeforeClass; -import java.io.File; import java.net.MalformedURLException; import java.net.URL; @@ -23,10 +22,9 @@ class BrowserStackImageInjectionTest { static String authenticationKey = null; static String cloudName = null; - @BeforeAll - static void getSetup() { - System.setProperty("LOG_DIR", LOG_DIR); - new File(LOG_DIR).mkdirs(); + @BeforeClass + public static void setupBefore() { + LOGGER.info("Using LOG_DIR: " + System.getProperty("LOG_DIR")); authenticationUser = System.getenv("CLOUD_USERNAME"); authenticationKey = System.getenv("CLOUD_KEY"); @@ -41,13 +39,13 @@ static void getSetup() { new URL(String.format("https://%s:%s@hub-cloud.browserstack.com/wd/hub", authenticationUser, authenticationKey)), caps); - } catch(MalformedURLException e) { + } catch (MalformedURLException e) { throw new RuntimeException( String.format("Error starting Android driver: %s", e.getMessage()), e); } } -// @Test + // @Test void toVerifyUploadURLIsGettingGenerated() { String imageFile = System.getProperty( "user.dir") + "/src/test/resources/images/handbag.jpg"; @@ -57,4 +55,4 @@ void toVerifyUploadURLIsGettingGenerated() { "Injecting image to device failed").isNotNull(); } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/runner/RunnerTest.java b/src/test/java/com/znsio/teswiz/runner/RunnerTest.java index 9f4dc80d5..e655aecc7 100644 --- a/src/test/java/com/znsio/teswiz/runner/RunnerTest.java +++ b/src/test/java/com/znsio/teswiz/runner/RunnerTest.java @@ -1,7 +1,7 @@ package com.znsio.teswiz.runner; import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; +import org.testng.annotations.Test; class RunnerTest { @@ -11,6 +11,7 @@ void getStatusForPassingSuite_NoFailedScenarios_SomePassedScenarios() { byte status = Runner.getStatus(false, 10, 10, 100, 0); Assertions.assertThat(status).isEqualTo((byte) 0); } + @Test void getStatusForPassingSuiteWith_FailedScenarios_SomePassedScenarios() { byte status = Runner.getStatus(false, 10, 10, 100, 10); @@ -28,6 +29,7 @@ void getStatusForPassingSuiteNo_FailedScenarios_NoPassedScenarios() { byte status = Runner.getStatus(false, 10, 10, 0, 0); Assertions.assertThat(status).isEqualTo((byte) 0); } + @Test void getStatusForPassingSuiteWith_FailedScenarios_NoPassedScenarios() { byte status = Runner.getStatus(false, 10, 10, 0, 10); @@ -46,6 +48,7 @@ void getStatusForFailingSuite_NoPassedScenarios_SomeFailedScenarios() { byte status = Runner.getStatus(true, 10, 10, 0, 100); Assertions.assertThat(status).isEqualTo((byte) 0); } + @Test void getStatusForFailingSuiteWith_PassedScenarios_SomeFailedScenarios() { byte status = Runner.getStatus(true, 10, 10, 10, 100); @@ -63,6 +66,7 @@ void getStatusForFailingSuiteNo_PassedScenarios_NoFailedScenarios() { byte status = Runner.getStatus(true, 10, 10, 0, 0); Assertions.assertThat(status).isEqualTo((byte) 0); } + @Test void getStatusForFailingSuiteWith_PassedScenarios_NoFailedScenarios() { byte status = Runner.getStatus(true, 10, 10, 10, 0); diff --git a/src/test/java/com/znsio/teswiz/runner/SetupTest.java b/src/test/java/com/znsio/teswiz/runner/SetupTest.java index 8a60e50e6..302db9be2 100644 --- a/src/test/java/com/znsio/teswiz/runner/SetupTest.java +++ b/src/test/java/com/znsio/teswiz/runner/SetupTest.java @@ -1,26 +1,27 @@ package com.znsio.teswiz.runner; import com.znsio.teswiz.entities.APPLITOOLS; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; -import java.io.File; import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; class SetupTest { - private static final String LOG_DIR = "./target/testLogs"; + private static final Logger LOGGER = LogManager.getLogger(SetupTest.class.getName()); + private static final String configFilePath = "./configs/ajio/ajio_local_android_config.properties"; - @BeforeAll + @BeforeClass public static void setupBefore() { - System.setProperty("LOG_DIR", LOG_DIR); - new File(LOG_DIR).mkdirs(); + LOGGER.info("Using LOG_DIR: " + System.getProperty("LOG_DIR")); } - @BeforeEach + @BeforeMethod public void beforeMethod() { System.clearProperty(APPLITOOLS.PROXY_KEY); System.clearProperty(APPLITOOLS.PROXY_URL); @@ -142,4 +143,4 @@ void checkValidApplitoolsProxyKeyOverridingConfig() { proxyKey); assertThat(applitoolsConfiguration.get(APPLITOOLS.PROXY_URL)).as("Applitools Proxy url is invalid").isNotNull(); } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/runner/VisualTest.java b/src/test/java/com/znsio/teswiz/runner/VisualTest.java index 133054619..6282db969 100644 --- a/src/test/java/com/znsio/teswiz/runner/VisualTest.java +++ b/src/test/java/com/znsio/teswiz/runner/VisualTest.java @@ -7,8 +7,9 @@ import org.apache.pdfbox.io.RandomAccessReadBufferedFile; import org.apache.pdfbox.pdmodel.PDDocument; import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.testng.ITestContext; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import java.io.File; import java.io.IOException; @@ -16,15 +17,14 @@ import static org.assertj.core.api.Assertions.assertThat; class VisualTest { - private static final String LOG_DIR = Runner.USER_DIRECTORY + "/target/testLogs"; + private static final Logger LOGGER = LogManager.getLogger(VisualTest.class.getName()); private static String pdfFileName; private static File pdfFile; private static PDDocument pdfDocument; - @BeforeAll - public static void setupBefore() throws IOException { - System.setProperty("LOG_DIR", LOG_DIR); - new File(LOG_DIR).mkdirs(); + @BeforeClass + public static void setupBefore(ITestContext context) throws IOException { + LOGGER.info("Using LOG_DIR: " + System.getProperty("LOG_DIR")); pdfFileName = "src/test/resources/pdf/Teswiz.pdf"; pdfFile = new File(pdfFileName); diff --git a/src/test/java/com/znsio/teswiz/screen/ScreenShotScreen.java b/src/test/java/com/znsio/teswiz/screen/ScreenShotScreen.java index 7b34002ca..ee295c03e 100644 --- a/src/test/java/com/znsio/teswiz/screen/ScreenShotScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/ScreenShotScreen.java @@ -1,16 +1,16 @@ package com.znsio.teswiz.screen; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.ScreenShotScreenAndroid; import com.znsio.teswiz.screen.web.ScreenShotScreenWeb; import com.znsio.teswiz.screen.windows.ScreenShotScreenWindows; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class ScreenShotScreen { private static final String SCREEN_NAME = ScreenShotScreen.class.getSimpleName(); @@ -22,7 +22,7 @@ public static ScreenShotScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new ScreenShotScreenAndroid(driver, visually); case web: diff --git a/src/test/java/com/znsio/teswiz/screen/ajio/CartScreen.java b/src/test/java/com/znsio/teswiz/screen/ajio/CartScreen.java index 8ac8e7bc4..3d7bac410 100644 --- a/src/test/java/com/znsio/teswiz/screen/ajio/CartScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/ajio/CartScreen.java @@ -8,8 +8,8 @@ import com.znsio.teswiz.screen.android.ajio.CartScreenAndroid; import com.znsio.teswiz.screen.ios.ajio.CartScreenIOS; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class CartScreen { private static final String SCREEN_NAME = CartScreen.class.getSimpleName(); @@ -21,7 +21,7 @@ public static CartScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new CartScreenAndroid(driver, visually); case iOS: diff --git a/src/test/java/com/znsio/teswiz/screen/ajio/HomeScreen.java b/src/test/java/com/znsio/teswiz/screen/ajio/HomeScreen.java index 99205bcc2..313c9e134 100644 --- a/src/test/java/com/znsio/teswiz/screen/ajio/HomeScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/ajio/HomeScreen.java @@ -1,20 +1,18 @@ package com.znsio.teswiz.screen.ajio; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.ajio.HomeScreenAndroid; import com.znsio.teswiz.screen.ios.ajio.HomeScreenIOS; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import java.util.Map; -import static com.znsio.teswiz.entities.Platform.iOS; - public abstract class HomeScreen { private static final String SCREEN_NAME = HomeScreen.class.getSimpleName(); private static final Logger LOGGER = LogManager.getLogger(SCREEN_NAME); diff --git a/src/test/java/com/znsio/teswiz/screen/ajio/ProductScreen.java b/src/test/java/com/znsio/teswiz/screen/ajio/ProductScreen.java index ce16ec420..fb19061aa 100644 --- a/src/test/java/com/znsio/teswiz/screen/ajio/ProductScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/ajio/ProductScreen.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.screen.ajio; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.ajio.ProductScreenAndroid; import com.znsio.teswiz.screen.ios.ajio.ProductScreenIOS; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class ProductScreen { private static final String SCREEN_NAME = ProductScreen.class.getSimpleName(); diff --git a/src/test/java/com/znsio/teswiz/screen/ajio/SearchScreen.java b/src/test/java/com/znsio/teswiz/screen/ajio/SearchScreen.java index 0277c8227..9ccee3762 100644 --- a/src/test/java/com/znsio/teswiz/screen/ajio/SearchScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/ajio/SearchScreen.java @@ -8,8 +8,8 @@ import com.znsio.teswiz.screen.android.ajio.SearchScreenAndroid; import com.znsio.teswiz.screen.ios.ajio.SearchScreenIOS; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class SearchScreen { private static final String SCREEN_NAME = SearchScreen.class.getSimpleName(); diff --git a/src/test/java/com/znsio/teswiz/screen/android/ajio/CartScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/ajio/CartScreenAndroid.java index d095425c2..ef244dec7 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/ajio/CartScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/ajio/CartScreenAndroid.java @@ -3,8 +3,8 @@ import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.ajio.CartScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; diff --git a/src/test/java/com/znsio/teswiz/screen/android/ajio/HomeScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/ajio/HomeScreenAndroid.java index 85d58571d..ce66b1d8a 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/ajio/HomeScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/ajio/HomeScreenAndroid.java @@ -5,8 +5,8 @@ import com.znsio.teswiz.screen.ajio.HomeScreen; import com.znsio.teswiz.screen.ajio.ProductScreen; import com.znsio.teswiz.screen.ajio.SearchScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import java.util.Map; diff --git a/src/test/java/com/znsio/teswiz/screen/android/ajio/ProductScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/ajio/ProductScreenAndroid.java index be1e2e41d..f46bcf97c 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/ajio/ProductScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/ajio/ProductScreenAndroid.java @@ -1,14 +1,14 @@ package com.znsio.teswiz.screen.android.ajio; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.ajio.CartScreen; import com.znsio.teswiz.screen.ajio.ProductScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; diff --git a/src/test/java/com/znsio/teswiz/screen/android/ajio/SearchScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/ajio/SearchScreenAndroid.java index 872519523..6229952cc 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/ajio/SearchScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/ajio/SearchScreenAndroid.java @@ -4,8 +4,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.ajio.ProductScreen; import com.znsio.teswiz.screen.ajio.SearchScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -50,8 +50,9 @@ public ProductScreen selectProduct() { @Override public boolean isProductListLoaded(String product) { LOGGER.info(String.format("Verifying if %s list is loaded", product)); - if (!(driver.isElementPresent(byProductListTitleId))) + if (!(driver.isElementPresent(byProductListTitleId))) { driver.tapOnMiddleOfScreen(); + } String productLoaded = driver.waitTillElementIsVisible(byProductListTitleId).getText().trim(); LOGGER.info("Loaded product: " + productLoaded); return productLoaded.contains(product); diff --git a/src/test/java/com/znsio/teswiz/screen/android/autoscroll/AutoScrollScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/autoscroll/AutoScrollScreenAndroid.java index 515bce02f..03e9210cb 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/autoscroll/AutoScrollScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/autoscroll/AutoScrollScreenAndroid.java @@ -6,8 +6,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.autoscroll.AutoScrollScreen; import io.appium.java_client.AppiumBy; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -50,4 +50,4 @@ public boolean isScrollSuccessful() { visually.check(SCREEN_NAME, "contacts dropdown element view", Target.region(byContactsTextView)); return driver.findElement(byContactsTextView).isDisplayed(); } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/screen/android/calculator/CalculatorScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/calculator/CalculatorScreenAndroid.java index ea83be1cf..400ada51f 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/calculator/CalculatorScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/calculator/CalculatorScreenAndroid.java @@ -24,13 +24,13 @@ public CalculatorScreen handlePopupIfPresent() { visually.checkWindow(SCREEN_NAME, "Calculator launched"); boolean isUpgradeAppNotificationElement = driver.isElementPresent( By.id("android:id/button1")); - if(isUpgradeAppNotificationElement) { + if (isUpgradeAppNotificationElement) { driver.findElement(By.id("android:id/button1")).click(); waitFor(1); } boolean isClingElementPresent = driver.isElementPresent( By.id("com.android2.calculator3:id/cling_dismiss")); - if(isClingElementPresent) { + if (isClingElementPresent) { driver.findElementById("com.android2.calculator3:id/cling_dismiss").click(); waitFor(1); } @@ -48,7 +48,7 @@ public CalculatorScreen selectNumber(String number) { @Override public CalculatorScreen pressOperation(String operation) { String mappedOperation; - switch(operation.toLowerCase()) { + switch (operation.toLowerCase()) { case "plus": mappedOperation = "plus"; break; diff --git a/src/test/java/com/znsio/teswiz/screen/android/calculator/NewCalculatorScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/calculator/NewCalculatorScreenAndroid.java index 85c2af9f5..ed542dc22 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/calculator/NewCalculatorScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/calculator/NewCalculatorScreenAndroid.java @@ -28,7 +28,7 @@ public NewCalculatorScreen selectNumber(String number) { @Override public NewCalculatorScreen pressOperation(String operation) { String mappedOperation; - switch(operation.toLowerCase()) { + switch (operation.toLowerCase()) { case "plus": mappedOperation = "op_add"; break; diff --git a/src/test/java/com/znsio/teswiz/screen/android/confengine/ConfEngineLandingScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/confengine/ConfEngineLandingScreenAndroid.java index 1022b274a..6911d0668 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/confengine/ConfEngineLandingScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/confengine/ConfEngineLandingScreenAndroid.java @@ -4,8 +4,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.confengine.ConfEngineLandingScreen; import io.appium.java_client.AppiumDriver; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import java.util.Set; @@ -28,7 +28,7 @@ public ConfEngineLandingScreenAndroid(Driver driver, Visual visually) { public ConfEngineLandingScreen getListOfConferences() { visually.checkWindow(SCREEN_NAME, "Landing screen"); Set contextNames = ((AppiumDriver) driver.getInnerDriver()).getWindowHandles(); - for(String contextName : contextNames) { + for (String contextName : contextNames) { System.out.println(contextName); //prints out something like NATIVE_APP \n WEBVIEW_1 } ((AppiumDriver) driver.getInnerDriver()).switchTo().window(String.valueOf(contextNames.toArray()[1])); diff --git a/src/test/java/com/znsio/teswiz/screen/android/dineout/DineoutLandingScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/dineout/DineoutLandingScreenAndroid.java index 085994e35..66f9e1852 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/dineout/DineoutLandingScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/dineout/DineoutLandingScreenAndroid.java @@ -3,8 +3,8 @@ import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.dineout.DineoutLandingScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; @@ -28,7 +28,7 @@ public DineoutLandingScreen selectDefaultCity() { driver.waitTillElementIsPresent(By.id("com.dineout.book:id/skip_tv")).click(); driver.waitTillElementIsPresent(By.id("com.dineout.book:id/manual_location_txt")).click(); driver.waitTillElementIsPresent(By.id("com.dineout.book:id/et_search_location")) - .sendKeys("Mumbai"); + .sendKeys("Mumbai"); driver.waitTillElementIsPresent( By.id("com.dineout.book:id/textView_search_location_header")).click(); @@ -44,15 +44,15 @@ public DineoutLandingScreen selectDefaultCity() { "(@resource-id='com.dineout" + ".book:id/half_interstitial_image')]"), 10).click(); - } catch(NoSuchElementException e) { + } catch (NoSuchElementException e) { LOGGER.info("Did not get any popup banner"); } try { // update location, if exists driver.waitTillElementIsPresent(By.id("com.dineout.book:id/txt_update_now_cta"), 5) - .click(); - } catch(NoSuchElementException e) { + .click(); + } catch (NoSuchElementException e) { LOGGER.info("Did not get update location CTA"); } return this; @@ -62,10 +62,10 @@ public DineoutLandingScreen selectDefaultCity() { public DineoutLandingScreen selectCity(String city) { driver.waitTillElementIsPresent(By.id("com.dineout.book:id/search_text")).click(); driver.waitTillElementIsPresent(By.id("com.dineout.book:id/tv_rest_suggestions")) - .sendKeys("Mumbai"); + .sendKeys("Mumbai"); // select the region driver.waitTillElementIsPresent(By.xpath("//android.widget.TextView[@text='Location']")) - .click(); + .click(); // select first from the list driver.waitTillElementIsPresent(By.id("com.dineout.book:id/suggestion_layout")).click(); @@ -81,9 +81,9 @@ public DineoutLandingScreen searchCuisine(String cuisine) { suggestionsElement.sendKeys(cuisine); suggestionsElement.click(); driver.waitTillElementIsPresent(By.xpath("//android.widget.TextView[@text='Cuisine']")) - .click(); + .click(); driver.waitTillElementIsPresent(By.id("com.dineout.book:id/selected_state_container")) - .click(); + .click(); return this; } } diff --git a/src/test/java/com/znsio/teswiz/screen/android/duckduckgo/DuckDuckGoScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/duckduckgo/DuckDuckGoScreenAndroid.java index 096d09f59..14ac35a35 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/duckduckgo/DuckDuckGoScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/duckduckgo/DuckDuckGoScreenAndroid.java @@ -13,10 +13,10 @@ public class DuckDuckGoScreenAndroid extends DuckDuckGoScreen { - private final Driver driver; - private final Visual visually; private static final String SCREEN_NAME = DuckDuckGoScreenAndroid.class.getSimpleName(); private static final Logger LOGGER = LogManager.getLogger(SCREEN_NAME); + private final Driver driver; + private final Visual visually; private final By byPrimaryCtaId = AppiumBy.id("com.duckduckgo.mobile.android.debug:id/primaryCta"); private final By byCancelChangingDefaultBrowserId = AppiumBy.id("android:id/button2"); private By byGetDefaultTextFromWebViewId; diff --git a/src/test/java/com/znsio/teswiz/screen/android/googlesearch/GoogleSearchLandingScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/googlesearch/GoogleSearchLandingScreenAndroid.java index ea7e7c025..556d51900 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/googlesearch/GoogleSearchLandingScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/googlesearch/GoogleSearchLandingScreenAndroid.java @@ -1,13 +1,13 @@ package com.znsio.teswiz.screen.android.googlesearch; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.googlesearch.GoogleSearchLandingScreen; import com.znsio.teswiz.screen.googlesearch.GoogleSearchResultsScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -36,4 +36,4 @@ public GoogleSearchResultsScreen searchFor(String searchText) { driver.findElement(SEARCH_INPUT).sendKeys(searchText, Keys.ENTER); return GoogleSearchResultsScreen.get(); } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/screen/android/googlesearch/GoogleSearchResultsScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/googlesearch/GoogleSearchResultsScreenAndroid.java index 6aa90ba8e..55046cc7c 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/googlesearch/GoogleSearchResultsScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/googlesearch/GoogleSearchResultsScreenAndroid.java @@ -1,6 +1,6 @@ package com.znsio.teswiz.screen.android.googlesearch; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.runner.Visual; diff --git a/src/test/java/com/znsio/teswiz/screen/android/indigo/IndigoFlightSearchResultsScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/indigo/IndigoFlightSearchResultsScreenAndroid.java index 625f7c07c..be14cbd8f 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/indigo/IndigoFlightSearchResultsScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/indigo/IndigoFlightSearchResultsScreenAndroid.java @@ -3,8 +3,8 @@ import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.indigo.IndigoFlightSearchResultsScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class IndigoFlightSearchResultsScreenAndroid extends IndigoFlightSearchResultsScreen { diff --git a/src/test/java/com/znsio/teswiz/screen/android/indigo/IndigoGiftVouchersScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/indigo/IndigoGiftVouchersScreenAndroid.java index 9e9ba9cf8..ea51a54aa 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/indigo/IndigoGiftVouchersScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/indigo/IndigoGiftVouchersScreenAndroid.java @@ -5,8 +5,8 @@ import com.znsio.teswiz.screen.indigo.IndigoGiftVouchersScreen; import io.appium.java_client.AppiumDriver; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import java.util.Set; @@ -39,7 +39,7 @@ public IndigoGiftVouchersScreenAndroid(Driver driver, Visual visually) { @Override public IndigoGiftVouchersScreen select(String numberOfGiftVouchersToPurchase, - String denomination) { + String denomination) { throw new NotImplementedException( SCREEN_NAME + ":" + new Throwable().getStackTrace()[0].getMethodName() + NOT_YET_IMPLEMENTED); } @@ -52,8 +52,8 @@ public int getTotalPrice() { @Override public IndigoGiftVouchersScreen select(String numberOfGiftVouchersToPurchase, - String denomination, String forWhom, - String customMessage) { + String denomination, String forWhom, + String customMessage) { driver.findElement(bySelectDenominationDropdownXpath).click(); String denominationToSelectXpath = String.format(bySelectValueFromDropdown, denomination); driver.waitTillElementIsVisible(By.xpath(denominationToSelectXpath)).click(); diff --git a/src/test/java/com/znsio/teswiz/screen/android/indigo/IndigoHomeScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/indigo/IndigoHomeScreenAndroid.java index 88ea2979e..d96a4675b 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/indigo/IndigoHomeScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/indigo/IndigoHomeScreenAndroid.java @@ -6,8 +6,8 @@ import com.znsio.teswiz.screen.indigo.IndigoGiftVouchersScreen; import com.znsio.teswiz.screen.indigo.IndigoHomeScreen; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; diff --git a/src/test/java/com/znsio/teswiz/screen/android/jiocinema/JioCinemaScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/jiocinema/JioCinemaScreenAndroid.java index 171dc3b60..31b5f67ee 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/jiocinema/JioCinemaScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/jiocinema/JioCinemaScreenAndroid.java @@ -7,8 +7,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.jiocinema.JioCinemaScreen; import io.appium.java_client.AppiumBy; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -51,7 +51,7 @@ public boolean isMovieNumberVisibleOnScreen(int movieNumberOnScreen) { boolean isMovieVisibleOnScreen = driver.findElement( AppiumBy.xpath(String.format(visibleMovieNumberXpath, movieNumberOnScreen))).isDisplayed(); visually.check(SCREEN_NAME, String.format("movie number %s visible on screen", movieNumberOnScreen), - Target.region(AppiumBy.xpath(String.format(visibleMovieNumberXpath, movieNumberOnScreen)))); + Target.region(AppiumBy.xpath(String.format(visibleMovieNumberXpath, movieNumberOnScreen)))); return isMovieVisibleOnScreen; } @@ -63,4 +63,4 @@ public JioCinemaScreen swipeTrendingItem(Direction direction, int movieNumberOnS driver.horizontalSwipeWithGesture(movieTrending, direction); return this; } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/screen/android/jiomeet/InAMeetingScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/jiomeet/InAMeetingScreenAndroid.java index 5296eb65a..08456e543 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/jiomeet/InAMeetingScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/jiomeet/InAMeetingScreenAndroid.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.screen.android.jiomeet; +import com.znsio.teswiz.exceptions.jiomeet.InAMeetingException; import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; -import com.znsio.teswiz.exceptions.jiomeet.InAMeetingException; import com.znsio.teswiz.screen.jiomeet.InAMeetingScreen; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -41,7 +41,7 @@ public boolean isMeetingStarted() { enableInMeetingControls("isMeetingStarted"); driver.waitTillElementIsPresent(byMicStatusId); return true; - } catch(Exception e) { + } catch (Exception e) { return false; } } @@ -74,7 +74,7 @@ public InAMeetingScreen unmute() { enableInMeetingControls("unmute"); WebElement micStatus = driver.waitTillElementIsPresent(byMicStatusId); LOGGER.info("unmute- current mic status: " + micStatus.getText()); - if(micStatus.getText().equals("Mute")) { + if (micStatus.getText().equals("Mute")) { throw new InAMeetingException("Mic is already unmuted"); } else { micStatus.click(); @@ -90,7 +90,7 @@ public InAMeetingScreen mute() { enableInMeetingControls("mute"); WebElement micStatus = driver.waitTillElementIsPresent(byMicStatusId); LOGGER.info("mute- current mic status: " + micStatus.getText()); - if(micStatus.getText().equals("Unmute")) { + if (micStatus.getText().equals("Unmute")) { throw new InAMeetingException("Mic is already muted"); } else { micStatus.click(); @@ -111,12 +111,12 @@ private void enableInMeetingControls(String calledFrom) { "enableInMeetingControls: Called from: '%s': headers displayed?: '%s'", calledFrom, isTopHeaderDisplayed)); int retryAttempt = 0; - if(!isTopHeaderDisplayed) { + if (!isTopHeaderDisplayed) { do { int seconds = 1; LOGGER.info(String.format( "enableInMeetingControls: Called from: '%s', ': headers not displayed. " + - "Wait for '%d' sec and try again", + "Wait for '%d' sec and try again", calledFrom, seconds)); waitFor(seconds); retryAttempt++; @@ -124,10 +124,10 @@ private void enableInMeetingControls(String calledFrom) { isTopHeaderDisplayed = areInMeetingControlsDisplayed(); LOGGER.info(String.format( "enableInMeetingControls: Called from: '%s': retryAttempt: '%d' : are " + - "headers displayed now: '%s'", + "headers displayed now: '%s'", calledFrom, retryAttempt, isTopHeaderDisplayed)); - } while(!isTopHeaderDisplayed && retryAttempt < 8); - if(!isTopHeaderDisplayed) { + } while (!isTopHeaderDisplayed && retryAttempt < 8); + if (!isTopHeaderDisplayed) { throw new InAMeetingException( "Unable to see In Meeting Controls called from '" + calledFrom + "' in " + retryAttempt + " retry attempts"); } @@ -137,4 +137,4 @@ private void enableInMeetingControls(String calledFrom) { private boolean areInMeetingControlsDisplayed() { return driver.isElementPresent(byTopHeaderControlsPanelId); } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/screen/android/jiomeet/LandingScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/jiomeet/LandingScreenAndroid.java index dba21aac4..51668ff27 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/jiomeet/LandingScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/jiomeet/LandingScreenAndroid.java @@ -4,8 +4,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.jiomeet.InAMeetingScreen; import com.znsio.teswiz.screen.jiomeet.LandingScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import static com.znsio.teswiz.tools.Wait.waitFor; diff --git a/src/test/java/com/znsio/teswiz/screen/android/jiomeet/SignInScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/jiomeet/SignInScreenAndroid.java index 363d6ce25..0da8a11ee 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/jiomeet/SignInScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/jiomeet/SignInScreenAndroid.java @@ -5,8 +5,8 @@ import com.znsio.teswiz.screen.jiomeet.InAMeetingScreen; import com.znsio.teswiz.screen.jiomeet.LandingScreen; import com.znsio.teswiz.screen.jiomeet.SignInScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -45,13 +45,13 @@ public LandingScreen signIn(String username, String password) { @Override public InAMeetingScreen joinAMeeting(String meetingId, String meetingPassword, - String currentUserPersona) { + String currentUserPersona) { joinAMeeting().enterMeetingDetails(meetingId, meetingPassword, currentUserPersona); return InAMeetingScreen.get(); } private SignInScreenAndroid enterMeetingDetails(String meetingId, String meetingPassword, - String currentUserPersona) { + String currentUserPersona) { driver.waitTillElementIsPresent(byEnterMeetingId).sendKeys(meetingId); driver.waitTillElementIsPresent(byEnterMeetingPasswordId).sendKeys(meetingPassword); driver.waitTillElementIsPresent(byEnterDisplayNameId).sendKeys(currentUserPersona); diff --git a/src/test/java/com/znsio/teswiz/screen/android/theapp/AppLaunchScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/theapp/AppLaunchScreenAndroid.java index 33070804a..a6e3eedd0 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/theapp/AppLaunchScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/theapp/AppLaunchScreenAndroid.java @@ -7,8 +7,8 @@ import com.znsio.teswiz.screen.theapp.EchoScreen; import com.znsio.teswiz.screen.theapp.LoginScreen; import io.appium.java_client.AppiumBy; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; public class AppLaunchScreenAndroid diff --git a/src/test/java/com/znsio/teswiz/screen/android/theapp/ClipboardDemoScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/theapp/ClipboardDemoScreenAndroid.java index 3e6bfe123..8619ac47f 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/theapp/ClipboardDemoScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/theapp/ClipboardDemoScreenAndroid.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.screen.android.theapp; -import com.context.TestExecutionContext; -import com.znsio.teswiz.runner.Runner; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.runner.Driver; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.theapp.ClipboardDemoScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.WebElement; import static com.znsio.teswiz.tools.Wait.waitFor; diff --git a/src/test/java/com/znsio/teswiz/screen/android/vodqa/DragAndDropScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/vodqa/DragAndDropScreenAndroid.java index 7eb724f13..3f8d8b764 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/vodqa/DragAndDropScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/vodqa/DragAndDropScreenAndroid.java @@ -4,16 +4,16 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.vodqa.DragAndDropScreen; import io.appium.java_client.AppiumBy; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; public class DragAndDropScreenAndroid extends DragAndDropScreen { - private final Driver driver; - private final Visual visually; private static final String SCREEN_NAME = DragAndDropScreenAndroid.class.getSimpleName(); private static final Logger LOGGER = LogManager.getLogger(SCREEN_NAME); + private final Driver driver; + private final Visual visually; private final By byCircleDroppedAccessibilityId = AppiumBy.accessibilityId("success"); private final By byDraggableObjectAccessibilityId = AppiumBy.accessibilityId("dragMe"); private final By byDropZoneAccessibilityId = AppiumBy.accessibilityId("dropzone"); diff --git a/src/test/java/com/znsio/teswiz/screen/android/vodqa/NativeViewScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/vodqa/NativeViewScreenAndroid.java index dc457ef0e..c5844a22d 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/vodqa/NativeViewScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/vodqa/NativeViewScreenAndroid.java @@ -4,17 +4,16 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.vodqa.NativeViewScreen; import io.appium.java_client.AppiumBy; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; public class NativeViewScreenAndroid extends NativeViewScreen { - private final Driver driver; - private final Visual visually; private static final String SCREEN_NAME = NativeViewScreenAndroid.class.getSimpleName(); private static final Logger LOGGER = LogManager.getLogger(SCREEN_NAME); - private static final By byNativeViewScreenHeaderXpath = AppiumBy.xpath("//android.widget.TextView[@text = 'Native View Demo']"); + private final Driver driver; + private final Visual visually; public NativeViewScreenAndroid(Driver driver, Visual visually) { this.driver = driver; diff --git a/src/test/java/com/znsio/teswiz/screen/android/vodqa/VodqaScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/vodqa/VodqaScreenAndroid.java index a92a61eec..875ed2e98 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/vodqa/VodqaScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/vodqa/VodqaScreenAndroid.java @@ -10,18 +10,18 @@ import com.znsio.teswiz.screen.vodqa.WebViewScreen; import com.znsio.teswiz.tools.cmd.CommandLineExecutor; import io.appium.java_client.AppiumBy; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; import org.openqa.selenium.Point; import org.openqa.selenium.WebElement; public class VodqaScreenAndroid extends VodqaScreen { + private static final Logger LOGGER = LogManager.getLogger(VodqaScreenAndroid.class.getName()); private final Driver driver; private final Visual visually; private final String SCREEN_NAME = VodqaScreenAndroid.class.getSimpleName(); - private static final Logger LOGGER = LogManager.getLogger(VodqaScreenAndroid.class.getName()); private final By byLoginButton = AppiumBy.xpath("//android.view.ViewGroup[@content-desc='login']/android.widget.Button"); private final By byVerticalSwipeViewGroup = AppiumBy.xpath("//android.view.ViewGroup[@content-desc='verticalSwipe']"); private final By byCLanguageTextView = AppiumBy.xpath("//android.widget.TextView[@text=' C']"); @@ -44,13 +44,13 @@ public class VodqaScreenAndroid extends VodqaScreen { private final By byDoubleTapSuccessfulXpath = AppiumBy.xpath("//android.widget.TextView[@text='Double tap successful!']"); private final By byPhotoViewElementXpath = AppiumBy.xpath("//android.view.ViewGroup[@content-desc='photoView']"); private final By byImageElementXpath = AppiumBy.xpath("//android.view.ViewGroup[@content-desc='photo']/android.widget.ImageView"); - + private final By bySliderSectionXpath = AppiumBy.xpath("//android.view.ViewGroup[@content-desc='slider1']/android.view.ViewGroup"); private final By byFirstSliderElementId = AppiumBy.accessibilityId("slider"); private final By bySecondSliderElementId = AppiumBy.accessibilityId("slider1"); private final By bySliderValueXpath = AppiumBy.xpath("//android.view.ViewGroup/android.widget.TextView[2]"); - - + + public VodqaScreenAndroid(Driver driver, Visual visually) { this.driver = driver; this.visually = visually; @@ -128,7 +128,7 @@ public boolean isSwipeSuccessful(String elementText) { public VodqaScreen swipeByPassingPercentageAttributes(int atPercentScreenHeight, int fromPercentageWidth, int toPercentScreenWidth) { driver.waitTillElementIsPresent(AppiumBy.xpath(String.format(swipeViewXpath, "1"))); visually.check(SCREEN_NAME, "Carousel Tile before swipe by percentage Attributes", - Target.region(AppiumBy.xpath(String.format(swipeViewTileXpath, "1")))); + Target.region(AppiumBy.xpath(String.format(swipeViewTileXpath, "1")))); driver.swipeByPassingPercentageAttributes(atPercentScreenHeight, fromPercentageWidth, toPercentScreenWidth); return this; } @@ -260,18 +260,18 @@ public boolean isPinchAndZoomOutSuccessful(Dimension initialElementDimension) { public Dimension getImageElementDimension() { return driver.waitTillElementIsVisible(byImageElementXpath).getSize(); } - + @Override public VodqaScreen multiTouchOnElements() { LOGGER.info("Performing multi touch action in Slider Screen"); driver.waitTillElementIsVisible(bySliderSectionXpath).click(); - visually.check(SCREEN_NAME,"Slider Section Screen",Target.window()); + visually.check(SCREEN_NAME, "Slider Section Screen", Target.window()); WebElement firstSliderElement = driver.findElement(byFirstSliderElementId); WebElement secondSliderElement = driver.findElement(bySecondSliderElementId); driver.multiTouchOnElements(firstSliderElement, secondSliderElement); return this; } - + @Override public float getSliderValue() { float actualSliderValue = Float.parseFloat(driver.waitTillElementIsPresent(bySliderValueXpath).getText()); diff --git a/src/test/java/com/znsio/teswiz/screen/android/vodqa/WebViewScreenAndroid.java b/src/test/java/com/znsio/teswiz/screen/android/vodqa/WebViewScreenAndroid.java index 2a2031af6..ae257c217 100644 --- a/src/test/java/com/znsio/teswiz/screen/android/vodqa/WebViewScreenAndroid.java +++ b/src/test/java/com/znsio/teswiz/screen/android/vodqa/WebViewScreenAndroid.java @@ -5,20 +5,18 @@ import com.znsio.teswiz.screen.vodqa.VodqaScreen; import com.znsio.teswiz.screen.vodqa.WebViewScreen; import io.appium.java_client.AppiumBy; - -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; public class WebViewScreenAndroid extends WebViewScreen { - private final Driver driver; - private final Visual visually; private static final String SCREEN_NAME = WebViewScreenAndroid.class.getSimpleName(); private static final Logger LOGGER = LogManager.getLogger(SCREEN_NAME); - private static final By byWebViewScreenHeaderXpath = AppiumBy.xpath("//android.widget.TextView[@text = 'Webview']"); private static final By byLoginOptionWebviewXpath = By.xpath("//a[text()='login']"); private static final By byBackButtonXpath = AppiumBy.xpath("//android.widget.TextView[@text = 'Back']"); + private final Driver driver; + private final Visual visually; public WebViewScreenAndroid(Driver driver, Visual visually) { this.driver = driver; diff --git a/src/test/java/com/znsio/teswiz/screen/autoscroll/AutoScrollScreen.java b/src/test/java/com/znsio/teswiz/screen/autoscroll/AutoScrollScreen.java index 73fe45d06..374b07c4e 100644 --- a/src/test/java/com/znsio/teswiz/screen/autoscroll/AutoScrollScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/autoscroll/AutoScrollScreen.java @@ -8,8 +8,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.autoscroll.AutoScrollScreenAndroid; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class AutoScrollScreen { @@ -35,4 +35,4 @@ public static AutoScrollScreen get() { public abstract AutoScrollScreen scrollInDynamicLayer(Direction direction); public abstract boolean isScrollSuccessful(); -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/screen/calculator/CalculatorScreen.java b/src/test/java/com/znsio/teswiz/screen/calculator/CalculatorScreen.java index 93be56ba5..4fab73a4a 100644 --- a/src/test/java/com/znsio/teswiz/screen/calculator/CalculatorScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/calculator/CalculatorScreen.java @@ -1,14 +1,14 @@ package com.znsio.teswiz.screen.calculator; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.calculator.CalculatorScreenAndroid; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class CalculatorScreen { private static final String SCREEN_NAME = CalculatorScreen.class.getSimpleName(); @@ -20,7 +20,7 @@ public static CalculatorScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new CalculatorScreenAndroid(driver, visually); } diff --git a/src/test/java/com/znsio/teswiz/screen/calculator/NewCalculatorScreen.java b/src/test/java/com/znsio/teswiz/screen/calculator/NewCalculatorScreen.java index e9c9ffa5d..e3dd160ad 100644 --- a/src/test/java/com/znsio/teswiz/screen/calculator/NewCalculatorScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/calculator/NewCalculatorScreen.java @@ -7,8 +7,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.calculator.NewCalculatorScreenAndroid; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class NewCalculatorScreen { private static final String SCREEN_NAME = NewCalculatorScreen.class.getSimpleName(); @@ -20,7 +20,7 @@ public static NewCalculatorScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new NewCalculatorScreenAndroid(driver, visually); } diff --git a/src/test/java/com/znsio/teswiz/screen/confengine/ConfEngineLandingScreen.java b/src/test/java/com/znsio/teswiz/screen/confengine/ConfEngineLandingScreen.java index 8015b2d52..65fe84755 100644 --- a/src/test/java/com/znsio/teswiz/screen/confengine/ConfEngineLandingScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/confengine/ConfEngineLandingScreen.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.screen.confengine; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.confengine.ConfEngineLandingScreenAndroid; import com.znsio.teswiz.screen.web.confengine.ConfEngineLandingScreenWeb; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class ConfEngineLandingScreen { private static final String SCREEN_NAME = ConfEngineLandingScreen.class.getSimpleName(); @@ -21,7 +21,7 @@ public static ConfEngineLandingScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new ConfEngineLandingScreenAndroid(driver, visually); case web: diff --git a/src/test/java/com/znsio/teswiz/screen/dineout/DineoutLandingScreen.java b/src/test/java/com/znsio/teswiz/screen/dineout/DineoutLandingScreen.java index ae800ad0d..016e5ed9a 100644 --- a/src/test/java/com/znsio/teswiz/screen/dineout/DineoutLandingScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/dineout/DineoutLandingScreen.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.screen.dineout; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.dineout.DineoutLandingScreenAndroid; import com.znsio.teswiz.screen.web.dineout.DineoutLandingScreenWeb; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class DineoutLandingScreen { private static final String SCREEN_NAME = DineoutLandingScreen.class.getSimpleName(); @@ -21,7 +21,7 @@ public static DineoutLandingScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new DineoutLandingScreenAndroid(driver, visually); case web: diff --git a/src/test/java/com/znsio/teswiz/screen/duckduckgo/DuckDuckGoScreen.java b/src/test/java/com/znsio/teswiz/screen/duckduckgo/DuckDuckGoScreen.java index 9c0c58a96..7975c9f34 100644 --- a/src/test/java/com/znsio/teswiz/screen/duckduckgo/DuckDuckGoScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/duckduckgo/DuckDuckGoScreen.java @@ -20,7 +20,7 @@ public static DuckDuckGoScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new DuckDuckGoScreenAndroid(driver, visually); } diff --git a/src/test/java/com/znsio/teswiz/screen/googlesearch/GoogleSearchLandingScreen.java b/src/test/java/com/znsio/teswiz/screen/googlesearch/GoogleSearchLandingScreen.java index f2150f0df..fa7c75686 100644 --- a/src/test/java/com/znsio/teswiz/screen/googlesearch/GoogleSearchLandingScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/googlesearch/GoogleSearchLandingScreen.java @@ -8,8 +8,8 @@ import com.znsio.teswiz.screen.android.googlesearch.GoogleSearchLandingScreenAndroid; import com.znsio.teswiz.screen.web.googlesearch.GoogleSearchLandingScreenWeb; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class GoogleSearchLandingScreen { private static final String SCREEN_NAME = GoogleSearchLandingScreen.class.getSimpleName(); @@ -33,4 +33,4 @@ public static GoogleSearchLandingScreen get() { public abstract GoogleSearchResultsScreen searchFor(String searchText); -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/screen/googlesearch/GoogleSearchResultsScreen.java b/src/test/java/com/znsio/teswiz/screen/googlesearch/GoogleSearchResultsScreen.java index b449ae701..3156f5bcc 100644 --- a/src/test/java/com/znsio/teswiz/screen/googlesearch/GoogleSearchResultsScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/googlesearch/GoogleSearchResultsScreen.java @@ -8,8 +8,8 @@ import com.znsio.teswiz.screen.android.googlesearch.GoogleSearchResultsScreenAndroid; import com.znsio.teswiz.screen.web.googlesearch.GoogleSearchResultsScreenWeb; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import java.util.List; diff --git a/src/test/java/com/znsio/teswiz/screen/helloWorld/HelloWorldScreen.java b/src/test/java/com/znsio/teswiz/screen/helloWorld/HelloWorldScreen.java index bc31c3b16..012281357 100644 --- a/src/test/java/com/znsio/teswiz/screen/helloWorld/HelloWorldScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/helloWorld/HelloWorldScreen.java @@ -7,8 +7,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.ios.helloWorld.HelloWorldScreenIOS; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class HelloWorldScreen { private static final String SCREEN_NAME = HelloWorldScreen.class.getSimpleName(); @@ -20,7 +20,7 @@ public static HelloWorldScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case iOS: return new HelloWorldScreenIOS(driver, visually); } diff --git a/src/test/java/com/znsio/teswiz/screen/indigo/IndigoFlightSearchResultsScreen.java b/src/test/java/com/znsio/teswiz/screen/indigo/IndigoFlightSearchResultsScreen.java index 32e74c905..67c32e717 100644 --- a/src/test/java/com/znsio/teswiz/screen/indigo/IndigoFlightSearchResultsScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/indigo/IndigoFlightSearchResultsScreen.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.screen.indigo; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.indigo.IndigoFlightSearchResultsScreenAndroid; import com.znsio.teswiz.screen.web.indigo.IndigoFlightSearchResultsScreenWeb; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class IndigoFlightSearchResultsScreen { private static final String SCREEN_NAME = IndigoFlightSearchResultsScreen.class.getSimpleName(); @@ -21,7 +21,7 @@ public static IndigoFlightSearchResultsScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new IndigoFlightSearchResultsScreenAndroid(driver, visually); case web: diff --git a/src/test/java/com/znsio/teswiz/screen/indigo/IndigoGiftVouchersScreen.java b/src/test/java/com/znsio/teswiz/screen/indigo/IndigoGiftVouchersScreen.java index 68d3bd2ad..9e6273bea 100644 --- a/src/test/java/com/znsio/teswiz/screen/indigo/IndigoGiftVouchersScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/indigo/IndigoGiftVouchersScreen.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.screen.indigo; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.indigo.IndigoGiftVouchersScreenAndroid; import com.znsio.teswiz.screen.web.indigo.IndigoGiftVouchersScreenWeb; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class IndigoGiftVouchersScreen { private static final String SCREEN_NAME = IndigoGiftVouchersScreen.class.getSimpleName(); @@ -21,7 +21,7 @@ public static IndigoGiftVouchersScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new IndigoGiftVouchersScreenAndroid(driver, visually); case web: @@ -32,13 +32,13 @@ public static IndigoGiftVouchersScreen get() { } public abstract IndigoGiftVouchersScreen select(String numberOfGiftVouchersToPurchase, - String denomination); + String denomination); public abstract int getTotalPrice(); public abstract IndigoGiftVouchersScreen select(String numberOfGiftVouchersToPurchase, - String denomination, String forWhom, - String customMessage); + String denomination, String forWhom, + String customMessage); public abstract IndigoGiftVouchersScreen preview(); } diff --git a/src/test/java/com/znsio/teswiz/screen/indigo/IndigoHomeScreen.java b/src/test/java/com/znsio/teswiz/screen/indigo/IndigoHomeScreen.java index e4d99ff36..eaebbd148 100644 --- a/src/test/java/com/znsio/teswiz/screen/indigo/IndigoHomeScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/indigo/IndigoHomeScreen.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.screen.indigo; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.indigo.IndigoHomeScreenAndroid; import com.znsio.teswiz.screen.web.indigo.IndigoHomeScreenWeb; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class IndigoHomeScreen { private static final String SCREEN_NAME = IndigoHomeScreen.class.getSimpleName(); @@ -21,7 +21,7 @@ public static IndigoHomeScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new IndigoHomeScreenAndroid(driver, visually); case web: diff --git a/src/test/java/com/znsio/teswiz/screen/ios/ajio/CartScreenIOS.java b/src/test/java/com/znsio/teswiz/screen/ios/ajio/CartScreenIOS.java index 431597184..15173e5b3 100644 --- a/src/test/java/com/znsio/teswiz/screen/ios/ajio/CartScreenIOS.java +++ b/src/test/java/com/znsio/teswiz/screen/ios/ajio/CartScreenIOS.java @@ -4,8 +4,8 @@ import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.ajio.CartScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; diff --git a/src/test/java/com/znsio/teswiz/screen/ios/ajio/HomeScreenIOS.java b/src/test/java/com/znsio/teswiz/screen/ios/ajio/HomeScreenIOS.java index 49d327efd..88dd3948d 100644 --- a/src/test/java/com/znsio/teswiz/screen/ios/ajio/HomeScreenIOS.java +++ b/src/test/java/com/znsio/teswiz/screen/ios/ajio/HomeScreenIOS.java @@ -5,8 +5,8 @@ import com.znsio.teswiz.screen.ajio.HomeScreen; import com.znsio.teswiz.screen.ajio.ProductScreen; import com.znsio.teswiz.screen.ajio.SearchScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; diff --git a/src/test/java/com/znsio/teswiz/screen/ios/ajio/ProductScreenIOS.java b/src/test/java/com/znsio/teswiz/screen/ios/ajio/ProductScreenIOS.java index 5901e0add..5da1e9f8c 100644 --- a/src/test/java/com/znsio/teswiz/screen/ios/ajio/ProductScreenIOS.java +++ b/src/test/java/com/znsio/teswiz/screen/ios/ajio/ProductScreenIOS.java @@ -4,8 +4,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.ajio.CartScreen; import com.znsio.teswiz.screen.ajio.ProductScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; diff --git a/src/test/java/com/znsio/teswiz/screen/ios/ajio/SearchScreenIOS.java b/src/test/java/com/znsio/teswiz/screen/ios/ajio/SearchScreenIOS.java index 8ec3c7de8..0babe9d9c 100644 --- a/src/test/java/com/znsio/teswiz/screen/ios/ajio/SearchScreenIOS.java +++ b/src/test/java/com/znsio/teswiz/screen/ios/ajio/SearchScreenIOS.java @@ -4,8 +4,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.ajio.ProductScreen; import com.znsio.teswiz.screen.ajio.SearchScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; public class SearchScreenIOS diff --git a/src/test/java/com/znsio/teswiz/screen/ios/theapp/LoginScreenIOS.java b/src/test/java/com/znsio/teswiz/screen/ios/theapp/LoginScreenIOS.java index 1d17f428d..b57e11be5 100644 --- a/src/test/java/com/znsio/teswiz/screen/ios/theapp/LoginScreenIOS.java +++ b/src/test/java/com/znsio/teswiz/screen/ios/theapp/LoginScreenIOS.java @@ -14,10 +14,10 @@ public class LoginScreenIOS extends LoginScreen { - private final Driver driver; - private final Visual visually; private static final String SCREEN_NAME = LoginScreenIOS.class.getSimpleName(); private static final Logger LOGGER = LogManager.getLogger(SCREEN_NAME); + private final Driver driver; + private final Visual visually; private final By byUserNameXpath = AppiumBy.xpath("(//XCUIElementTypeOther[@name=\"username\"])[2]"); private final By byPasswordXpath = AppiumBy.xpath("(//XCUIElementTypeOther[@name=\"password\"])[2]"); private final By byOKButtonXpath = AppiumBy.xpath("(//*[@name=\"OK\"])"); diff --git a/src/test/java/com/znsio/teswiz/screen/jiocinema/JioCinemaScreen.java b/src/test/java/com/znsio/teswiz/screen/jiocinema/JioCinemaScreen.java index 5f4fd6edd..47bdde55b 100644 --- a/src/test/java/com/znsio/teswiz/screen/jiocinema/JioCinemaScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/jiocinema/JioCinemaScreen.java @@ -8,8 +8,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.jiocinema.JioCinemaScreenAndroid; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class JioCinemaScreen { private static final String SCREEN_NAME = JioCinemaScreen.class.getSimpleName(); @@ -39,4 +39,4 @@ public static JioCinemaScreen get() { public abstract JioCinemaScreen swipeTrendingItem(Direction direction, int movieNumberOnScreen); -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/screen/jiomeet/InAMeetingScreen.java b/src/test/java/com/znsio/teswiz/screen/jiomeet/InAMeetingScreen.java index 06685f933..5fd65d818 100644 --- a/src/test/java/com/znsio/teswiz/screen/jiomeet/InAMeetingScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/jiomeet/InAMeetingScreen.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.screen.jiomeet; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.jiomeet.InAMeetingScreenAndroid; import com.znsio.teswiz.screen.web.jiomeet.InAMeetingScreenWeb; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class InAMeetingScreen { private static final String SCREEN_NAME = InAMeetingScreen.class.getSimpleName(); diff --git a/src/test/java/com/znsio/teswiz/screen/jiomeet/LandingScreen.java b/src/test/java/com/znsio/teswiz/screen/jiomeet/LandingScreen.java index 245747725..534acd935 100644 --- a/src/test/java/com/znsio/teswiz/screen/jiomeet/LandingScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/jiomeet/LandingScreen.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.screen.jiomeet; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.jiomeet.LandingScreenAndroid; import com.znsio.teswiz.screen.web.jiomeet.LandingScreenWeb; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class LandingScreen { private static final String SCREEN_NAME = LandingScreen.class.getSimpleName(); diff --git a/src/test/java/com/znsio/teswiz/screen/jiomeet/SignInScreen.java b/src/test/java/com/znsio/teswiz/screen/jiomeet/SignInScreen.java index 28787557f..05a554dc4 100644 --- a/src/test/java/com/znsio/teswiz/screen/jiomeet/SignInScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/jiomeet/SignInScreen.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.screen.jiomeet; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.jiomeet.SignInScreenAndroid; import com.znsio.teswiz.screen.web.jiomeet.SignInScreenWeb; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class SignInScreen { private static final String SCREEN_NAME = SignInScreen.class.getSimpleName(); @@ -35,5 +35,5 @@ public static SignInScreen get() { public abstract LandingScreen signIn(String username, String password); public abstract InAMeetingScreen joinAMeeting(String meetingId, String meetingPassword, - String currentUserPersona); + String currentUserPersona); } diff --git a/src/test/java/com/znsio/teswiz/screen/notepad/NotepadScreen.java b/src/test/java/com/znsio/teswiz/screen/notepad/NotepadScreen.java index efd70d8e1..02ea4aff5 100644 --- a/src/test/java/com/znsio/teswiz/screen/notepad/NotepadScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/notepad/NotepadScreen.java @@ -7,8 +7,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.windows.notepad.NotepadScreenWindows; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class NotepadScreen { private static final String SCREEN_NAME = NotepadScreen.class.getSimpleName(); @@ -20,7 +20,7 @@ public static NotepadScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case windows: return new NotepadScreenWindows(driver, visually); } diff --git a/src/test/java/com/znsio/teswiz/screen/pdfValidator/PDFValidatorScreen.java b/src/test/java/com/znsio/teswiz/screen/pdfValidator/PDFValidatorScreen.java index 1f41367b2..ca65943e6 100644 --- a/src/test/java/com/znsio/teswiz/screen/pdfValidator/PDFValidatorScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/pdfValidator/PDFValidatorScreen.java @@ -36,7 +36,10 @@ public static PDFValidatorScreen get() { } public abstract TestResults validatePDF(); + public abstract TestResults validatePDF(int[] pageNumbers); + public abstract TestResults validatePDF(String pdfFileName); + public abstract TestResults validatePDF(String pdfFileName, int[] pageNumbers); } diff --git a/src/test/java/com/znsio/teswiz/screen/theapp/AppLaunchScreen.java b/src/test/java/com/znsio/teswiz/screen/theapp/AppLaunchScreen.java index ab1d43414..cc767caa4 100644 --- a/src/test/java/com/znsio/teswiz/screen/theapp/AppLaunchScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/theapp/AppLaunchScreen.java @@ -1,16 +1,16 @@ package com.znsio.teswiz.screen.theapp; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.theapp.AppLaunchScreenAndroid; import com.znsio.teswiz.screen.ios.theapp.AppLaunchScreenIOS; import com.znsio.teswiz.screen.web.theapp.AppLaunchScreenWeb; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class AppLaunchScreen { private static final String SCREEN_NAME = AppLaunchScreen.class.getSimpleName(); @@ -22,7 +22,7 @@ public static AppLaunchScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case web: return new AppLaunchScreenWeb(driver, visually); case android: diff --git a/src/test/java/com/znsio/teswiz/screen/theapp/ClipboardDemoScreen.java b/src/test/java/com/znsio/teswiz/screen/theapp/ClipboardDemoScreen.java index fbdde78b9..745f728c2 100644 --- a/src/test/java/com/znsio/teswiz/screen/theapp/ClipboardDemoScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/theapp/ClipboardDemoScreen.java @@ -1,14 +1,14 @@ package com.znsio.teswiz.screen.theapp; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.theapp.ClipboardDemoScreenAndroid; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class ClipboardDemoScreen { private static final String SCREEN_NAME = ClipboardDemoScreen.class.getSimpleName(); @@ -20,7 +20,7 @@ public static ClipboardDemoScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new ClipboardDemoScreenAndroid(driver, visually); } diff --git a/src/test/java/com/znsio/teswiz/screen/theapp/EchoScreen.java b/src/test/java/com/znsio/teswiz/screen/theapp/EchoScreen.java index 6fe6b46ab..6f2e6fb23 100644 --- a/src/test/java/com/znsio/teswiz/screen/theapp/EchoScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/theapp/EchoScreen.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.screen.theapp; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.theapp.EchoScreenAndroid; import com.znsio.teswiz.screen.web.theapp.EchoScreenWeb; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class EchoScreen { private static final String SCREEN_NAME = EchoScreen.class.getSimpleName(); @@ -21,7 +21,7 @@ public static EchoScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new EchoScreenAndroid(driver, visually); case web: diff --git a/src/test/java/com/znsio/teswiz/screen/theapp/FileUploadScreen.java b/src/test/java/com/znsio/teswiz/screen/theapp/FileUploadScreen.java index d1564a9ff..4117b7f98 100644 --- a/src/test/java/com/znsio/teswiz/screen/theapp/FileUploadScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/theapp/FileUploadScreen.java @@ -1,14 +1,14 @@ package com.znsio.teswiz.screen.theapp; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.web.theapp.FileUploadScreenWeb; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import java.util.Map; @@ -22,7 +22,7 @@ public static FileUploadScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case web: return new FileUploadScreenWeb(driver, visually); } diff --git a/src/test/java/com/znsio/teswiz/screen/theapp/LoginScreen.java b/src/test/java/com/znsio/teswiz/screen/theapp/LoginScreen.java index a707e26a5..ce00d0291 100644 --- a/src/test/java/com/znsio/teswiz/screen/theapp/LoginScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/theapp/LoginScreen.java @@ -1,16 +1,16 @@ package com.znsio.teswiz.screen.theapp; import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.theapp.LoginScreenAndroid; import com.znsio.teswiz.screen.ios.theapp.LoginScreenIOS; import com.znsio.teswiz.screen.web.theapp.LoginScreenWeb; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class LoginScreen { private static final String SCREEN_NAME = LoginScreen.class.getSimpleName(); @@ -22,7 +22,7 @@ public static LoginScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new LoginScreenAndroid(driver, visually); case web: diff --git a/src/test/java/com/znsio/teswiz/screen/vodqa/DragAndDropScreen.java b/src/test/java/com/znsio/teswiz/screen/vodqa/DragAndDropScreen.java index b2b461534..033590ae2 100644 --- a/src/test/java/com/znsio/teswiz/screen/vodqa/DragAndDropScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/vodqa/DragAndDropScreen.java @@ -7,8 +7,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.vodqa.DragAndDropScreenAndroid; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class DragAndDropScreen { @@ -30,5 +30,6 @@ public static DragAndDropScreen get() { } public abstract boolean isMessageVisible(); + public abstract DragAndDropScreen dragAndDropCircleObject(); } diff --git a/src/test/java/com/znsio/teswiz/screen/vodqa/NativeViewScreen.java b/src/test/java/com/znsio/teswiz/screen/vodqa/NativeViewScreen.java index dece6997a..55aac9302 100644 --- a/src/test/java/com/znsio/teswiz/screen/vodqa/NativeViewScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/vodqa/NativeViewScreen.java @@ -7,8 +7,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.vodqa.NativeViewScreenAndroid; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class NativeViewScreen { private static final String SCREEN_NAME = NativeViewScreen.class.getSimpleName(); @@ -20,7 +20,7 @@ public static NativeViewScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new NativeViewScreenAndroid(driver, visually); } diff --git a/src/test/java/com/znsio/teswiz/screen/vodqa/VodqaScreen.java b/src/test/java/com/znsio/teswiz/screen/vodqa/VodqaScreen.java index 9911ce7b4..a1a0002d8 100644 --- a/src/test/java/com/znsio/teswiz/screen/vodqa/VodqaScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/vodqa/VodqaScreen.java @@ -7,8 +7,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.vodqa.VodqaScreenAndroid; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.Dimension; public abstract class VodqaScreen { diff --git a/src/test/java/com/znsio/teswiz/screen/vodqa/WebViewScreen.java b/src/test/java/com/znsio/teswiz/screen/vodqa/WebViewScreen.java index 52a72d053..805fdd5ce 100644 --- a/src/test/java/com/znsio/teswiz/screen/vodqa/WebViewScreen.java +++ b/src/test/java/com/znsio/teswiz/screen/vodqa/WebViewScreen.java @@ -7,8 +7,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.android.vodqa.WebViewScreenAndroid; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class WebViewScreen { private static final String SCREEN_NAME = WebViewScreen.class.getSimpleName(); @@ -20,7 +20,7 @@ public static WebViewScreen get() { LOGGER.info(SCREEN_NAME + ": Driver type: " + driver.getType() + ": Platform: " + platform); Visual visually = Drivers.getVisualDriverForCurrentUser(Thread.currentThread().getId()); - switch(platform) { + switch (platform) { case android: return new WebViewScreenAndroid(driver, visually); } @@ -33,4 +33,4 @@ public static WebViewScreen get() { public abstract boolean isLoginOptionVisible(); public abstract VodqaScreen navigateToSamplesList(); -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/screen/web/confengine/ConfEngineLandingScreenWeb.java b/src/test/java/com/znsio/teswiz/screen/web/confengine/ConfEngineLandingScreenWeb.java index 9ecde6efa..d9f2aaede 100644 --- a/src/test/java/com/znsio/teswiz/screen/web/confengine/ConfEngineLandingScreenWeb.java +++ b/src/test/java/com/znsio/teswiz/screen/web/confengine/ConfEngineLandingScreenWeb.java @@ -4,8 +4,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.confengine.ConfEngineLandingScreen; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class ConfEngineLandingScreenWeb extends ConfEngineLandingScreen { diff --git a/src/test/java/com/znsio/teswiz/screen/web/dineout/DineoutLandingScreenWeb.java b/src/test/java/com/znsio/teswiz/screen/web/dineout/DineoutLandingScreenWeb.java index d9b6efb40..a029c03f6 100644 --- a/src/test/java/com/znsio/teswiz/screen/web/dineout/DineoutLandingScreenWeb.java +++ b/src/test/java/com/znsio/teswiz/screen/web/dineout/DineoutLandingScreenWeb.java @@ -4,8 +4,8 @@ import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.dineout.DineoutLandingScreen; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; diff --git a/src/test/java/com/znsio/teswiz/screen/web/googlesearch/GoogleSearchLandingScreenWeb.java b/src/test/java/com/znsio/teswiz/screen/web/googlesearch/GoogleSearchLandingScreenWeb.java index c15e581e1..648d835ea 100644 --- a/src/test/java/com/znsio/teswiz/screen/web/googlesearch/GoogleSearchLandingScreenWeb.java +++ b/src/test/java/com/znsio/teswiz/screen/web/googlesearch/GoogleSearchLandingScreenWeb.java @@ -1,13 +1,13 @@ package com.znsio.teswiz.screen.web.googlesearch; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.googlesearch.GoogleSearchLandingScreen; import com.znsio.teswiz.screen.googlesearch.GoogleSearchResultsScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.Keys; diff --git a/src/test/java/com/znsio/teswiz/screen/web/googlesearch/GoogleSearchResultsScreenWeb.java b/src/test/java/com/znsio/teswiz/screen/web/googlesearch/GoogleSearchResultsScreenWeb.java index 99d6f1a53..855ef8823 100644 --- a/src/test/java/com/znsio/teswiz/screen/web/googlesearch/GoogleSearchResultsScreenWeb.java +++ b/src/test/java/com/znsio/teswiz/screen/web/googlesearch/GoogleSearchResultsScreenWeb.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.screen.web.googlesearch; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.googlesearch.GoogleSearchResultsScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import java.util.List; diff --git a/src/test/java/com/znsio/teswiz/screen/web/indigo/IndigoFlightSearchResultsScreenWeb.java b/src/test/java/com/znsio/teswiz/screen/web/indigo/IndigoFlightSearchResultsScreenWeb.java index ca8e97b08..dff805fb9 100644 --- a/src/test/java/com/znsio/teswiz/screen/web/indigo/IndigoFlightSearchResultsScreenWeb.java +++ b/src/test/java/com/znsio/teswiz/screen/web/indigo/IndigoFlightSearchResultsScreenWeb.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.screen.web.indigo; -import com.context.TestExecutionContext; -import com.znsio.teswiz.runner.Runner; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.runner.Driver; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.indigo.IndigoFlightSearchResultsScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; diff --git a/src/test/java/com/znsio/teswiz/screen/web/indigo/IndigoGiftVouchersScreenWeb.java b/src/test/java/com/znsio/teswiz/screen/web/indigo/IndigoGiftVouchersScreenWeb.java index 800d1f1a9..00aa048b7 100644 --- a/src/test/java/com/znsio/teswiz/screen/web/indigo/IndigoGiftVouchersScreenWeb.java +++ b/src/test/java/com/znsio/teswiz/screen/web/indigo/IndigoGiftVouchersScreenWeb.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.screen.web.indigo; -import com.context.TestExecutionContext; -import com.znsio.teswiz.runner.Runner; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.runner.Driver; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.indigo.IndigoGiftVouchersScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; @@ -43,7 +43,7 @@ public IndigoGiftVouchersScreenWeb(Driver driver, Visual visually) { @Override public IndigoGiftVouchersScreen select(String numberOfGiftVouchersToPurchase, - String denomination) { + String denomination) { Select selectDenomination = new Select( driver.findElement(bySelectedVoucherValueDropdownId)); selectDenomination.selectByValue(denomination); @@ -62,8 +62,8 @@ public int getTotalPrice() { @Override public IndigoGiftVouchersScreen select(String numberOfGiftVouchersToPurchase, - String denomination, String forWhom, - String customMessage) { + String denomination, String forWhom, + String customMessage) { select(numberOfGiftVouchersToPurchase, denomination); driver.findElement(By.id("chkPersonal")).click(); WebElement forWhomElement = driver.findElement(byForNameId); diff --git a/src/test/java/com/znsio/teswiz/screen/web/indigo/IndigoHomeScreenWeb.java b/src/test/java/com/znsio/teswiz/screen/web/indigo/IndigoHomeScreenWeb.java index 0792104d7..24d90e6d0 100644 --- a/src/test/java/com/znsio/teswiz/screen/web/indigo/IndigoHomeScreenWeb.java +++ b/src/test/java/com/znsio/teswiz/screen/web/indigo/IndigoHomeScreenWeb.java @@ -1,14 +1,14 @@ package com.znsio.teswiz.screen.web.indigo; -import com.context.TestExecutionContext; -import com.znsio.teswiz.runner.Runner; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.runner.Driver; +import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.indigo.IndigoFlightSearchResultsScreen; import com.znsio.teswiz.screen.indigo.IndigoGiftVouchersScreen; import com.znsio.teswiz.screen.indigo.IndigoHomeScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; @@ -62,7 +62,7 @@ public IndigoHomeScreenWeb(Driver driver, Visual visually) { long threadId = Thread.currentThread().getId(); context = Runner.getTestExecutionContext(threadId); waitFor(2); - if(driver.isElementPresent(byCloseAcceptCookiesXpath)) { + if (driver.isElementPresent(byCloseAcceptCookiesXpath)) { driver.findElement(byCloseAcceptCookiesXpath).click(); } } @@ -94,15 +94,15 @@ public IndigoHomeScreen selectTo(String destination) { public IndigoHomeScreen selectNumberOfAdultPassengers(int numberOfAdultsToSelect) { driver.waitForClickabilityOf(bySelectedNumberOfPassengersXpath).click(); visually.checkWindow(SCREEN_NAME, "Pre-selected number of passengers"); - if(driver.isElementPresent(byCloseExtraSeatTooltipXpath)) { + if (driver.isElementPresent(byCloseExtraSeatTooltipXpath)) { driver.findElement(byCloseExtraSeatTooltipXpath).click(); } int numberOfAdultsSelected = getNumberOfAdultsSelected(); LOGGER.info("numberOfAdultsSelected: " + numberOfAdultsSelected); - if(numberOfAdultsToSelect == numberOfAdultsSelected) { + if (numberOfAdultsToSelect == numberOfAdultsSelected) { LOGGER.info( "Number of adults selected is already as expected: " + numberOfAdultsToSelect); - } else if(numberOfAdultsToSelect < numberOfAdultsSelected) { + } else if (numberOfAdultsToSelect < numberOfAdultsSelected) { decrementAdultPassengerSelection(numberOfAdultsToSelect, numberOfAdultsSelected); } else { incrementAdultPassengerSelection(numberOfAdultsToSelect, numberOfAdultsSelected); @@ -117,8 +117,8 @@ private int getNumberOfAdultsSelected() { } private IndigoHomeScreenWeb decrementAdultPassengerSelection(int numberOfAdultsToSelect, - int numberOfAdultsSelected) { - while(numberOfAdultsToSelect < numberOfAdultsSelected && numberOfAdultsSelected != 1) { + int numberOfAdultsSelected) { + while (numberOfAdultsToSelect < numberOfAdultsSelected && numberOfAdultsSelected != 1) { LOGGER.info("Decreasing adult passenger selected count"); driver.findElement(byDecreaseAdultPassengerCountXpath).click(); numberOfAdultsSelected--; @@ -127,8 +127,8 @@ private IndigoHomeScreenWeb decrementAdultPassengerSelection(int numberOfAdultsT } private IndigoHomeScreenWeb incrementAdultPassengerSelection(int numberOfAdultsToSelect, - int numberOfAdultsSelected) { - while(numberOfAdultsToSelect > numberOfAdultsSelected) { + int numberOfAdultsSelected) { + while (numberOfAdultsToSelect > numberOfAdultsSelected) { LOGGER.info("Increasing adult passenger selected count"); driver.findElement(byIncreaseAdultPassengerCountXpath).click(); numberOfAdultsSelected++; diff --git a/src/test/java/com/znsio/teswiz/screen/web/jiomeet/InAMeetingScreenWeb.java b/src/test/java/com/znsio/teswiz/screen/web/jiomeet/InAMeetingScreenWeb.java index eb5dae624..e84b1a52c 100644 --- a/src/test/java/com/znsio/teswiz/screen/web/jiomeet/InAMeetingScreenWeb.java +++ b/src/test/java/com/znsio/teswiz/screen/web/jiomeet/InAMeetingScreenWeb.java @@ -1,6 +1,6 @@ package com.znsio.teswiz.screen.web.jiomeet; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Runner; @@ -8,8 +8,8 @@ import com.znsio.teswiz.screen.jiomeet.InAMeetingScreen; import com.znsio.teswiz.tools.ReportPortalLogger; import org.apache.commons.lang3.NotImplementedException; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; @@ -57,12 +57,12 @@ public String getMeetingId() { js.executeScript("arguments[0].click()", infoIcon); visually.takeScreenshot(SCREEN_NAME, "getCurrentMeetingDetails"); String meetingId = (String) js.executeScript("return arguments[0].innerText", - driver.waitTillElementIsPresent(byCurrentMeetingNumberXpath)); + driver.waitTillElementIsPresent(byCurrentMeetingNumberXpath)); meetingId = meetingId.replaceAll("\\s", ""); String pin = (String) js.executeScript("return arguments[0].innerText", - driver.waitTillElementIsPresent(byCurrentMeetingPinXpath)); - String invitationLink = (String) js.executeScript("return arguments[0].innerText", - driver.waitTillElementIsPresent(byCurrentMeetingInvitationLinkXpath)); + driver.waitTillElementIsPresent(byCurrentMeetingPinXpath)); + String invitationLink = (String) js.executeScript("return arguments[0].innerText", + driver.waitTillElementIsPresent(byCurrentMeetingInvitationLinkXpath)); js.executeScript("arguments[0].click()", infoIcon);//to close the meeting info frame visually.takeScreenshot(SCREEN_NAME, "After closing meeting info icon"); LOGGER.info("On Web the meeting id: " + meetingId + " Password: " + pin); diff --git a/src/test/java/com/znsio/teswiz/screen/web/jiomeet/LandingScreenWeb.java b/src/test/java/com/znsio/teswiz/screen/web/jiomeet/LandingScreenWeb.java index c5ca6909c..d48602a4e 100644 --- a/src/test/java/com/znsio/teswiz/screen/web/jiomeet/LandingScreenWeb.java +++ b/src/test/java/com/znsio/teswiz/screen/web/jiomeet/LandingScreenWeb.java @@ -5,8 +5,8 @@ import com.znsio.teswiz.screen.android.jiomeet.LandingScreenAndroid; import com.znsio.teswiz.screen.jiomeet.InAMeetingScreen; import com.znsio.teswiz.screen.jiomeet.LandingScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -37,7 +37,7 @@ public String getSignedInWelcomeMessage() { visually.checkWindow(SCREEN_NAME, "get signedin welcome message"); String welcomeText = driver.waitTillElementIsPresent(byHeadingXpath).getText(); welcomeText += " " + driver.waitTillElementIsPresent(byWelcomeTextDescriptionXpath) - .getText(); + .getText(); return welcomeText; } diff --git a/src/test/java/com/znsio/teswiz/screen/web/jiomeet/SignInScreenWeb.java b/src/test/java/com/znsio/teswiz/screen/web/jiomeet/SignInScreenWeb.java index 85a6e4234..f05512f4f 100644 --- a/src/test/java/com/znsio/teswiz/screen/web/jiomeet/SignInScreenWeb.java +++ b/src/test/java/com/znsio/teswiz/screen/web/jiomeet/SignInScreenWeb.java @@ -6,8 +6,8 @@ import com.znsio.teswiz.screen.jiomeet.InAMeetingScreen; import com.znsio.teswiz.screen.jiomeet.LandingScreen; import com.znsio.teswiz.screen.jiomeet.SignInScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; @@ -64,7 +64,7 @@ public LandingScreen signIn(String username, String password) { @Override public InAMeetingScreen joinAMeeting(String meetingId, String meetingPassword, - String currentUserPersona) { + String currentUserPersona) { WebElement joinMeetingElement = driver.waitTillElementIsPresent(byJoinMeetingButtonId); visually.checkWindow(SCREEN_NAME, "Landing screen"); joinMeetingElement.click(); @@ -82,12 +82,12 @@ public InAMeetingScreen joinAMeeting(String meetingId, String meetingPassword, enterNameElement.sendKeys(currentUserPersona); visually.check(SCREEN_NAME, "After entering meeting details", - Target.window().strict().layout(byEnterPasswordId).layout(byNameId)); + Target.window().strict().layout(byEnterPasswordId).layout(byNameId)); visually.takeScreenshot(SCREEN_NAME, "Before clicking on Join button"); ((JavascriptExecutor) driver.getInnerDriver()).executeScript("arguments[0].click()", - driver.waitForClickabilityOf( - byJoinMeetingButtonXpath)); + driver.waitForClickabilityOf( + byJoinMeetingButtonXpath)); return this.waitForInAMeetingScreenToLoad(); } diff --git a/src/test/java/com/znsio/teswiz/screen/web/theapp/AppLaunchScreenWeb.java b/src/test/java/com/znsio/teswiz/screen/web/theapp/AppLaunchScreenWeb.java index 52d38bd99..6411d3385 100644 --- a/src/test/java/com/znsio/teswiz/screen/web/theapp/AppLaunchScreenWeb.java +++ b/src/test/java/com/znsio/teswiz/screen/web/theapp/AppLaunchScreenWeb.java @@ -6,8 +6,8 @@ import com.znsio.teswiz.screen.theapp.ClipboardDemoScreen; import com.znsio.teswiz.screen.theapp.EchoScreen; import com.znsio.teswiz.screen.theapp.LoginScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; public class AppLaunchScreenWeb diff --git a/src/test/java/com/znsio/teswiz/screen/web/theapp/EchoScreenWeb.java b/src/test/java/com/znsio/teswiz/screen/web/theapp/EchoScreenWeb.java index 96e88e986..be341b6e5 100644 --- a/src/test/java/com/znsio/teswiz/screen/web/theapp/EchoScreenWeb.java +++ b/src/test/java/com/znsio/teswiz/screen/web/theapp/EchoScreenWeb.java @@ -3,8 +3,8 @@ import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.theapp.EchoScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class EchoScreenWeb extends EchoScreen { diff --git a/src/test/java/com/znsio/teswiz/screen/web/theapp/FileUploadScreenWeb.java b/src/test/java/com/znsio/teswiz/screen/web/theapp/FileUploadScreenWeb.java index bab54e3cd..419113db3 100644 --- a/src/test/java/com/znsio/teswiz/screen/web/theapp/FileUploadScreenWeb.java +++ b/src/test/java/com/znsio/teswiz/screen/web/theapp/FileUploadScreenWeb.java @@ -3,8 +3,8 @@ import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.theapp.FileUploadScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; import java.util.Map; diff --git a/src/test/java/com/znsio/teswiz/screen/windows/notepad/NotepadScreenWindows.java b/src/test/java/com/znsio/teswiz/screen/windows/notepad/NotepadScreenWindows.java index 58044afc0..fe259e096 100644 --- a/src/test/java/com/znsio/teswiz/screen/windows/notepad/NotepadScreenWindows.java +++ b/src/test/java/com/znsio/teswiz/screen/windows/notepad/NotepadScreenWindows.java @@ -3,8 +3,8 @@ import com.znsio.teswiz.runner.Driver; import com.znsio.teswiz.runner.Visual; import com.znsio.teswiz.screen.notepad.NotepadScreen; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openqa.selenium.By; public class NotepadScreenWindows diff --git a/src/test/java/com/znsio/teswiz/steps/AjioSteps.java b/src/test/java/com/znsio/teswiz/steps/AjioSteps.java index 869af5d19..c6335be68 100644 --- a/src/test/java/com/znsio/teswiz/steps/AjioSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/AjioSteps.java @@ -1,20 +1,19 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.ajio.HomeBL; import com.znsio.teswiz.businessLayer.ajio.ProductBL; import com.znsio.teswiz.businessLayer.ajio.SearchBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; -import io.cucumber.java.en.And; +import com.znsio.teswiz.runner.Drivers; +import com.znsio.teswiz.runner.Runner; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class AjioSteps { private static final Logger LOGGER = LogManager.getLogger(AjioSteps.class.getName()); @@ -28,7 +27,7 @@ public AjioSteps() { @Given("I search for products using {string}") public void iSearchForProductsUsing(String searchtype) { LOGGER.info(System.out.printf("iSearchForProductsUsing:'%s' - Persona:'%s'", searchtype, - SAMPLE_TEST_CONTEXT.ME)); + SAMPLE_TEST_CONTEXT.ME)); Drivers.createDriverFor(SAMPLE_TEST_CONTEXT.ME, Runner.getPlatform(), context); new HomeBL().handlePopups(); new SearchBL().searchProduct(Runner.getTestDataAsMap(searchtype)); @@ -37,14 +36,14 @@ public void iSearchForProductsUsing(String searchtype) { @When("I add the product to the cart") public void iAddTheProductToTheCart() { LOGGER.info(System.out.printf("iAddTheProductToTheCart:- Persona:'%s'", - SAMPLE_TEST_CONTEXT.ME)); + SAMPLE_TEST_CONTEXT.ME)); new SearchBL().prepareCart(); } @Then("I should see the product in the cart") public void iShouldSeeTheProductInTheCart() { LOGGER.info(System.out.printf("iShouldSeeTheProductInTheCart:- Persona:'%s'", - SAMPLE_TEST_CONTEXT.ME)); + SAMPLE_TEST_CONTEXT.ME)); new SearchBL().verifyCart(); } diff --git a/src/test/java/com/znsio/teswiz/steps/AppLaunchSteps.java b/src/test/java/com/znsio/teswiz/steps/AppLaunchSteps.java index 9e972acba..66c0feb93 100644 --- a/src/test/java/com/znsio/teswiz/steps/AppLaunchSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/AppLaunchSteps.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.TEST_CONTEXT; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; import io.cucumber.java.en.And; import io.cucumber.java.en.Given; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.json.JSONObject; import java.util.Locale; @@ -27,7 +27,7 @@ public AppLaunchSteps() { public void startOn(String userPersona, String appName) { String[] appNameParts = appName.split("-"); appName = appNameParts[0].toLowerCase(Locale.ROOT) + "_" + Runner.getCloudName() - .toLowerCase(); + .toLowerCase(); String onPlatform = appNameParts[appNameParts.length - 1].toLowerCase(Locale.ROOT); LOGGER.info(System.out.printf("startOn - Persona:'%s', AppName: '%s', Platform: '%s'", userPersona, appName, onPlatform)); @@ -60,7 +60,7 @@ public void startsOn(String userPersona, String appName, String browserName) { */ private String evaluateBrowserType(String browserName) { String[] details = browserName.split("-"); - if(details.length == 1) { + if (details.length == 1) { //when user passes values like 'chrome', 'firefox', etc return browserName; } diff --git a/src/test/java/com/znsio/teswiz/steps/AutoScrollSteps.java b/src/test/java/com/znsio/teswiz/steps/AutoScrollSteps.java index fa7fb9a18..49f4345b3 100644 --- a/src/test/java/com/znsio/teswiz/steps/AutoScrollSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/AutoScrollSteps.java @@ -1,16 +1,16 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.autoscroll.AutoScrollBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Direction; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class AutoScrollSteps { private static final Logger LOGGER = LogManager.getLogger(AutoScrollSteps.class.getName()); @@ -32,4 +32,4 @@ public void iShouldBeAbleToScrollInDynamicLayer(String direction) { new AutoScrollBL(SAMPLE_TEST_CONTEXT.ME, Runner.getPlatform()) .verifyScrollInDynamicLayerFunctionality(Direction.valueOf(direction.toUpperCase())); } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/steps/CalculatorSteps.java b/src/test/java/com/znsio/teswiz/steps/CalculatorSteps.java index 56c710f17..edc0808ef 100644 --- a/src/test/java/com/znsio/teswiz/steps/CalculatorSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/CalculatorSteps.java @@ -1,18 +1,18 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.calculator.CalculatorBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; -import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Drivers; +import com.znsio.teswiz.runner.Runner; import io.cucumber.java.en.And; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import static com.znsio.teswiz.tools.Wait.waitFor; @@ -29,6 +29,7 @@ public CalculatorSteps() { public void iSelect(String number) { new CalculatorBL(SAMPLE_TEST_CONTEXT.ME, Runner.getPlatform()).selectNumber(number); } + @Given("I select {string} in the new calculator") public void iSelectInTheNewCalculator(String number) { new CalculatorBL(SAMPLE_TEST_CONTEXT.ME, Runner.getPlatform()).selectNumberInNewCalculator(number); @@ -74,7 +75,7 @@ public void iStartTheNewCalculator() { public void press(String userPersona, String action) { Platform onPlatform = Runner.getPlatformForUser(userPersona); new CalculatorBL(userPersona, onPlatform).pressOperation(action); - if(action.equalsIgnoreCase("equals")) { + if (action.equalsIgnoreCase("equals")) { waitFor(10); } } diff --git a/src/test/java/com/znsio/teswiz/steps/ConfEngineSteps.java b/src/test/java/com/znsio/teswiz/steps/ConfEngineSteps.java index c45debcb4..76dd34972 100644 --- a/src/test/java/com/znsio/teswiz/steps/ConfEngineSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/ConfEngineSteps.java @@ -1,14 +1,14 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.confengine.ConfEngineBL; -import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Drivers; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Drivers; +import com.znsio.teswiz.runner.Runner; import io.cucumber.java.en.Given; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class ConfEngineSteps { private static final Logger LOGGER = LogManager.getLogger(ConfEngineSteps.class.getName()); diff --git a/src/test/java/com/znsio/teswiz/steps/CryptoAPISteps.java b/src/test/java/com/znsio/teswiz/steps/CryptoAPISteps.java index ef0a14685..fb6e9b046 100644 --- a/src/test/java/com/znsio/teswiz/steps/CryptoAPISteps.java +++ b/src/test/java/com/znsio/teswiz/steps/CryptoAPISteps.java @@ -1,20 +1,20 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.cryptoAPI.CryptoAPIBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import kong.unirest.HttpResponse; import kong.unirest.JsonNode; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class CryptoAPISteps { - private HttpResponse jsonResponse; private static final Logger LOGGER = LogManager.getLogger(CryptoAPISteps.class.getName()); private final TestExecutionContext context; + private HttpResponse jsonResponse; public CryptoAPISteps() { context = SessionContext.getTestExecutionContext(Thread.currentThread().getId()); diff --git a/src/test/java/com/znsio/teswiz/steps/DineoutSteps.java b/src/test/java/com/znsio/teswiz/steps/DineoutSteps.java index e066f47b6..a02c812d7 100644 --- a/src/test/java/com/znsio/teswiz/steps/DineoutSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/DineoutSteps.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.dineout.DineoutSearchBL; -import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Drivers; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Drivers; +import com.znsio.teswiz.runner.Runner; import io.cucumber.java.en.Given; import io.cucumber.java.en.When; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class DineoutSteps { private static final Logger LOGGER = LogManager.getLogger(IndigoSteps.class.getName()); diff --git a/src/test/java/com/znsio/teswiz/steps/DuckDuckGoSteps.java b/src/test/java/com/znsio/teswiz/steps/DuckDuckGoSteps.java index ac770f97b..3d927f7c2 100644 --- a/src/test/java/com/znsio/teswiz/steps/DuckDuckGoSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/DuckDuckGoSteps.java @@ -1,8 +1,8 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.duckduckgo.DuckDuckGoBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; @@ -21,6 +21,7 @@ public DuckDuckGoSteps() { context = SessionContext.getTestExecutionContext(Thread.currentThread().getId()); LOGGER.info("context: " + context.getTestName()); } + @Given("I launch the duckduckgo browser") public void iLaunchTheDuckduckgoBrowser() { LOGGER.info( diff --git a/src/test/java/com/znsio/teswiz/steps/GoogleSearchSteps.java b/src/test/java/com/znsio/teswiz/steps/GoogleSearchSteps.java index cfd7967c9..e613d7d2f 100644 --- a/src/test/java/com/znsio/teswiz/steps/GoogleSearchSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/GoogleSearchSteps.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.googlesearch.GoogleSearchBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; import io.cucumber.java.en.Given; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import java.util.Locale; diff --git a/src/test/java/com/znsio/teswiz/steps/HealthCheckSteps.java b/src/test/java/com/znsio/teswiz/steps/HealthCheckSteps.java index 4b8059c93..a800f9c23 100644 --- a/src/test/java/com/znsio/teswiz/steps/HealthCheckSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/HealthCheckSteps.java @@ -1,7 +1,7 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.runner.Runner; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; diff --git a/src/test/java/com/znsio/teswiz/steps/HeartBeatSteps.java b/src/test/java/com/znsio/teswiz/steps/HeartBeatSteps.java index 285e5d4e4..39edf4cc5 100644 --- a/src/test/java/com/znsio/teswiz/steps/HeartBeatSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/HeartBeatSteps.java @@ -1,8 +1,8 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.heartbeat.HeartBeatBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import io.cucumber.java.en.And; import io.cucumber.java.en.When; import org.apache.logging.log4j.LogManager; diff --git a/src/test/java/com/znsio/teswiz/steps/HelloWorldSteps.java b/src/test/java/com/znsio/teswiz/steps/HelloWorldSteps.java index 8973289ac..34e6b935c 100644 --- a/src/test/java/com/znsio/teswiz/steps/HelloWorldSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/HelloWorldSteps.java @@ -1,18 +1,14 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.helloWorld.HelloWorldBL; -import com.znsio.teswiz.businessLayer.search.SearchBL; -import com.znsio.teswiz.entities.Platform; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; -import com.znsio.teswiz.entities.TEST_CONTEXT; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; import io.cucumber.java.en.Given; -import io.cucumber.java.en.When; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class HelloWorldSteps { private static final Logger LOGGER = LogManager.getLogger(HelloWorldSteps.class.getName()); diff --git a/src/test/java/com/znsio/teswiz/steps/IndigoSteps.java b/src/test/java/com/znsio/teswiz/steps/IndigoSteps.java index b0c3a66b6..9f835b354 100644 --- a/src/test/java/com/znsio/teswiz/steps/IndigoSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/IndigoSteps.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.indigo.GiftVoucherBL; import com.znsio.teswiz.businessLayer.indigo.IndigoBL; -import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Drivers; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Drivers; +import com.znsio.teswiz.runner.Runner; import io.cucumber.java.en.Given; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class IndigoSteps { private static final Logger LOGGER = LogManager.getLogger(IndigoSteps.class.getName()); @@ -22,7 +22,7 @@ public IndigoSteps() { @Given("I search for a {string} ticket from {string} to {string} for {string} adult passenger") public void iSearchForATicketFromToForPassenger(String journeyType, String from, - String destination, String numberOfAdults) { + String destination, String numberOfAdults) { LOGGER.info(System.out.printf("iSearchForATicketFromToForPassenger - Persona:'%s'", SAMPLE_TEST_CONTEXT.ME)); Drivers.createDriverFor(SAMPLE_TEST_CONTEXT.ME, Runner.getPlatform(), context); @@ -33,7 +33,7 @@ public void iSearchForATicketFromToForPassenger(String journeyType, String from, @Given("I want to purchase {string} gift voucher of INR {string}") public void iWantToPurchaseGiftVoucherOfINR(String numberOfGiftVouchersToPurchase, - String denomination) { + String denomination) { LOGGER.info(System.out.printf("iWantToPurchaseGiftVoucherOfINR - Persona:'%s'", SAMPLE_TEST_CONTEXT.ME)); Drivers.createDriverFor(SAMPLE_TEST_CONTEXT.ME, Runner.getPlatform(), context); diff --git a/src/test/java/com/znsio/teswiz/steps/InteractiveCalculatorCLISteps.java b/src/test/java/com/znsio/teswiz/steps/InteractiveCalculatorCLISteps.java index a68c72b28..b6d0ca496 100644 --- a/src/test/java/com/znsio/teswiz/steps/InteractiveCalculatorCLISteps.java +++ b/src/test/java/com/znsio/teswiz/steps/InteractiveCalculatorCLISteps.java @@ -1,8 +1,8 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.interactiveCalculatorCLI.InteractiveCalculatorCLIBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import io.cucumber.java.en.And; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; diff --git a/src/test/java/com/znsio/teswiz/steps/JioCinemaSteps.java b/src/test/java/com/znsio/teswiz/steps/JioCinemaSteps.java index 9d76e7511..e383ef2b3 100644 --- a/src/test/java/com/znsio/teswiz/steps/JioCinemaSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/JioCinemaSteps.java @@ -1,8 +1,8 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.jiocinema.JioCinemaBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Direction; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Drivers; @@ -10,8 +10,8 @@ import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class JioCinemaSteps { private static final Logger LOGGER = LogManager.getLogger(JioCinemaSteps.class.getName()); @@ -46,6 +46,6 @@ public void iAmAbleToViewNumberTrendingCinema(int movieNumberOnScreen) { @When("I swipe {string} trending no {int} on trending in india section") public void iSwipeTrendingNoOnTrendingInIndiaSection(String direction, int movieNumberOnScreen) { new JioCinemaBL(SAMPLE_TEST_CONTEXT.ME, Runner.getPlatform()) - .swipeMovieTrendingInIndiaSection(Direction.valueOf(direction.toUpperCase()),movieNumberOnScreen); + .swipeMovieTrendingInIndiaSection(Direction.valueOf(direction.toUpperCase()), movieNumberOnScreen); } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/steps/JioMeetSteps.java b/src/test/java/com/znsio/teswiz/steps/JioMeetSteps.java index 7defa7161..363738bf2 100644 --- a/src/test/java/com/znsio/teswiz/steps/JioMeetSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/JioMeetSteps.java @@ -1,11 +1,11 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.jiomeet.AuthBL; import com.znsio.teswiz.businessLayer.jiomeet.InAMeetingBL; import com.znsio.teswiz.businessLayer.jiomeet.JoinAMeetingBL; import com.znsio.teswiz.businessLayer.jiomeet.LandingBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.exceptions.InvalidTestDataException; @@ -75,7 +75,7 @@ public void joinsTheMeetingFrom(String userPersona, String fromPlatform) { @Given("{string} logs-in and starts an instant meeting in {string} on {string}") public void logsInAndStartsAnInstantMeetingInOn(String userPersona, String appName, - String platform) { + String platform) { appName = appName.toLowerCase(Locale.ROOT); Platform onPlatform = Platform.valueOf(platform); LOGGER.info(System.out.printf("startOn - Persona:'%s', AppName: '%s', Platform: '%s'", @@ -93,7 +93,7 @@ public void joinsTheMeetingFromOn(String userPersona, String appName, String pla LOGGER.info(System.out.printf("startOn - Persona:'%s', AppName: '%s', Platform: '%s'", userPersona, appName, onPlatform.name())); context.addTestState(userPersona, userPersona); - switch(onPlatform) { + switch (onPlatform) { case android: case iOS: case windows: diff --git a/src/test/java/com/znsio/teswiz/steps/JsonPlaceHolderSteps.java b/src/test/java/com/znsio/teswiz/steps/JsonPlaceHolderSteps.java index 8e2ae79a8..57c889995 100644 --- a/src/test/java/com/znsio/teswiz/steps/JsonPlaceHolderSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/JsonPlaceHolderSteps.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.restUser.JsonPlaceHolderBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import io.cucumber.java.en.And; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; import kong.unirest.json.JSONObject; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class JsonPlaceHolderSteps { private static final Logger LOGGER = LogManager.getLogger(WeatherAPISteps.class.getName()); @@ -21,11 +21,12 @@ public JsonPlaceHolderSteps() { context = SessionContext.getTestExecutionContext(Thread.currentThread().getId()); LOGGER.info("context: " + context.getTestName()); } - + @Given("I create a new post") public void iCreateAPost() { new JsonPlaceHolderBL().createPost(); } + @And("I modify title of the created post") public void iUpdateTitleOfThePost() { jsonObject = new JsonPlaceHolderBL().updatePost(); @@ -39,7 +40,7 @@ public void verifyTitleUpdated() { @When("I delete the modified post") public void iDeleteThePost() { - statusCode= new JsonPlaceHolderBL().deletePost(); + statusCode = new JsonPlaceHolderBL().deletePost(); } diff --git a/src/test/java/com/znsio/teswiz/steps/PDFSteps.java b/src/test/java/com/znsio/teswiz/steps/PDFSteps.java index 5ce6adf96..373b921dd 100644 --- a/src/test/java/com/znsio/teswiz/steps/PDFSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/PDFSteps.java @@ -1,9 +1,9 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.pdfValidator.PDFValidatorBL; import com.znsio.teswiz.businessLayer.theapp.AppBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Drivers; diff --git a/src/test/java/com/znsio/teswiz/steps/RunTestCukes.java b/src/test/java/com/znsio/teswiz/steps/RunTestCukes.java index 191cd86ec..82f990571 100644 --- a/src/test/java/com/znsio/teswiz/steps/RunTestCukes.java +++ b/src/test/java/com/znsio/teswiz/steps/RunTestCukes.java @@ -4,22 +4,20 @@ import com.applitools.eyes.selenium.Configuration; import com.applitools.eyes.visualgrid.model.DeviceName; import com.applitools.eyes.visualgrid.model.ScreenOrientation; -import com.context.SessionContext; -import com.context.TestExecutionContext; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.APPLITOOLS; -import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.entities.TEST_CONTEXT; import com.znsio.teswiz.runner.Runner; import com.znsio.teswiz.tools.HeartBeat; import com.znsio.teswiz.tools.ReportPortalLogger; -import com.znsio.teswiz.tools.cmd.AsyncCommandLineExecutor; import io.cucumber.java.After; import io.cucumber.java.Before; import io.cucumber.java.Scenario; import io.cucumber.testng.AbstractTestNGCucumberTests; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.assertj.core.api.Assertions; import org.testng.annotations.DataProvider; diff --git a/src/test/java/com/znsio/teswiz/steps/SearchSteps.java b/src/test/java/com/znsio/teswiz/steps/SearchSteps.java index fa5c616c6..3c01221b7 100644 --- a/src/test/java/com/znsio/teswiz/steps/SearchSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/SearchSteps.java @@ -1,13 +1,13 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.search.SearchBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.runner.Runner; import io.cucumber.java.en.When; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class SearchSteps { private static final Logger LOGGER = LogManager.getLogger(SearchSteps.class.getName()); diff --git a/src/test/java/com/znsio/teswiz/steps/TheAppSteps.java b/src/test/java/com/znsio/teswiz/steps/TheAppSteps.java index 9232e71ba..add028bee 100644 --- a/src/test/java/com/znsio/teswiz/steps/TheAppSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/TheAppSteps.java @@ -1,12 +1,12 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.heartbeat.HeartBeatBL; import com.znsio.teswiz.businessLayer.theapp.AppBL; import com.znsio.teswiz.businessLayer.theapp.ClipboardBL; import com.znsio.teswiz.businessLayer.theapp.EchoBL; import com.znsio.teswiz.businessLayer.theapp.FileUploadBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.Platform; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.entities.TEST_CONTEXT; @@ -50,7 +50,7 @@ public void iGoBack() { @Given("{string} login with invalid credentials - {string}, {string} on {string}") public void loginWithInvalidCredentialsOn(String userPersona, String username, String password, - String onPlatform) { + String onPlatform) { LOGGER.info(System.out.printf( "LoginWithInvalidCredentials - Persona:'%s', Username: '%s', Password:'%s', " + "Platform: '%s'", @@ -81,7 +81,7 @@ public void loginWithInvalidCredentials(String userPersona, String username, Str @When("{string} login again with invalid credentials - {string}, {string}") public void loginAgainWithInvalidCredentials(String userPersona, String username, - String password) { + String password) { Platform onPlatform = Runner.getPlatformForUser(userPersona); LOGGER.info(System.out.printf( "LoginWithInvalidCredentials - Persona:'%s', Username: '%s', Password:'%s', " + @@ -145,7 +145,7 @@ public void switchMyRoleTo(String currentUserPersona, String newUserPersona) { @Then("{string} can login again with invalid credentials - {string}, {string}") public void canLoginAgainWithInvalidCredentials(String userPersona, String username, - String password) { + String password) { LOGGER.info(System.out.printf( "'%s' canLoginAgainWithInvalidCredentials - Username: '%s', Password:'%s'", userPersona, username, password)); @@ -155,7 +155,7 @@ public void canLoginAgainWithInvalidCredentials(String userPersona, String usern @And("{string} login to TheApp with invalid credentials - {string}, " + "{string}") public void loginToTheAppWithInvalidCredentials(String userPersona, String username, - String password) { + String password) { LOGGER.info("Active thread count: " + Thread.activeCount()); LOGGER.info(System.out.printf( "'%s' loginToTheAppWithInvalidCredentials - Username: '%s', Password:'%s'", diff --git a/src/test/java/com/znsio/teswiz/steps/VodQASteps.java b/src/test/java/com/znsio/teswiz/steps/VodQASteps.java index 0d9c13669..75c3bad68 100644 --- a/src/test/java/com/znsio/teswiz/steps/VodQASteps.java +++ b/src/test/java/com/znsio/teswiz/steps/VodQASteps.java @@ -1,8 +1,8 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.vodqa.VodqaBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; import com.znsio.teswiz.runner.Drivers; import com.znsio.teswiz.runner.Runner; @@ -10,8 +10,8 @@ import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class VodQASteps { private static final Logger LOGGER = LogManager.getLogger(VodQASteps.class.getName()); @@ -118,7 +118,7 @@ public void iShouldBeAbleToPinchAndZoomInOnAnElement() { public void iShouldBeAbleToPinchAndZoomOutOnAnElement() { new VodqaBL().pinchAndZoomOutOnAnElement(); } - + @Then("I should be able set both sliders to value {float} by multi touch action") public void iShouldBeAbleSetBothSlidersToValueByMultiTouchAction(float setSliderValue) { new VodqaBL().performMultiTouchForBothSilders(setSliderValue); diff --git a/src/test/java/com/znsio/teswiz/steps/WeatherAPISteps.java b/src/test/java/com/znsio/teswiz/steps/WeatherAPISteps.java index 448f12ff8..407422193 100644 --- a/src/test/java/com/znsio/teswiz/steps/WeatherAPISteps.java +++ b/src/test/java/com/znsio/teswiz/steps/WeatherAPISteps.java @@ -1,19 +1,19 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.weatherAPI.WeatherAPIBL; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; import kong.unirest.json.JSONObject; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class WeatherAPISteps { - private JSONObject jsonObject; private static final Logger LOGGER = LogManager.getLogger(WeatherAPISteps.class.getName()); private final TestExecutionContext context; + private JSONObject jsonObject; private String latitude; private String longitude; diff --git a/src/test/java/com/znsio/teswiz/steps/WindowsSteps.java b/src/test/java/com/znsio/teswiz/steps/WindowsSteps.java index 560b9dc7d..8f3e2beab 100644 --- a/src/test/java/com/znsio/teswiz/steps/WindowsSteps.java +++ b/src/test/java/com/znsio/teswiz/steps/WindowsSteps.java @@ -1,15 +1,15 @@ package com.znsio.teswiz.steps; -import com.context.SessionContext; -import com.context.TestExecutionContext; import com.znsio.teswiz.businessLayer.notepad.NotepadBL; -import com.znsio.teswiz.runner.Runner; -import com.znsio.teswiz.runner.Drivers; +import com.znsio.teswiz.context.SessionContext; +import com.znsio.teswiz.context.TestExecutionContext; import com.znsio.teswiz.entities.SAMPLE_TEST_CONTEXT; +import com.znsio.teswiz.runner.Drivers; +import com.znsio.teswiz.runner.Runner; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class WindowsSteps { private static final Logger LOGGER = LogManager.getLogger(WindowsSteps.class.getName()); @@ -34,4 +34,4 @@ public void iShouldBeAbleToType(String message) { LOGGER.info("iShouldBeAbleToType"); new NotepadBL().typeMessage(message); } -} \ No newline at end of file +} diff --git a/src/test/java/com/znsio/teswiz/tools/JsonFileTest.java b/src/test/java/com/znsio/teswiz/tools/JsonFileTest.java index 1538489a7..bb81984a9 100644 --- a/src/test/java/com/znsio/teswiz/tools/JsonFileTest.java +++ b/src/test/java/com/znsio/teswiz/tools/JsonFileTest.java @@ -2,10 +2,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.io.File; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -13,11 +11,9 @@ class JsonFileTest { private static final Logger LOGGER = LogManager.getLogger(JsonFileTest.class.getName()); private static final String LOG_DIR = "./target/testLogs"; - @BeforeAll + @BeforeClass public static void setupBefore() { - LOGGER.info("Create LOG_DIR: " + LOG_DIR); - System.setProperty("LOG_DIR", LOG_DIR); - new File(LOG_DIR).mkdirs(); + LOGGER.info("Using LOG_DIR: " + System.getProperty("LOG_DIR")); } @Test diff --git a/src/test/java/com/znsio/teswiz/tools/YamlFileTest.java b/src/test/java/com/znsio/teswiz/tools/YamlFileTest.java index 4c955f6c1..899c74321 100644 --- a/src/test/java/com/znsio/teswiz/tools/YamlFileTest.java +++ b/src/test/java/com/znsio/teswiz/tools/YamlFileTest.java @@ -2,22 +2,18 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.io.File; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import static org.assertj.core.api.Assertions.assertThat; class YamlFileTest { private static final Logger LOGGER = LogManager.getLogger(YamlFileTest.class.getName()); - private static final String LOG_DIR = "./target/testLogs"; - @BeforeAll + + @BeforeClass public static void setupBefore() { - LOGGER.info("Create LOG_DIR: " + LOG_DIR); - System.setProperty("LOG_DIR", LOG_DIR); - new File(LOG_DIR).mkdirs(); + LOGGER.info("Using LOG_DIR: " + System.getProperty("LOG_DIR")); } @Test diff --git a/src/test/java/com/znsio/teswiz/tools/cmd/AsyncCommandLineExecutorTest.java b/src/test/java/com/znsio/teswiz/tools/cmd/AsyncCommandLineExecutorTest.java index 8228ff96c..36c3f3236 100644 --- a/src/test/java/com/znsio/teswiz/tools/cmd/AsyncCommandLineExecutorTest.java +++ b/src/test/java/com/znsio/teswiz/tools/cmd/AsyncCommandLineExecutorTest.java @@ -1,11 +1,10 @@ package com.znsio.teswiz.tools.cmd; +import com.znsio.teswiz.context.TestExecutionContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.io.File; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import static com.znsio.teswiz.runner.Runner.NOT_SET; import static org.assertj.core.api.Assertions.assertThat; @@ -13,24 +12,10 @@ class AsyncCommandLineExecutorTest { private static final Logger LOGGER = LogManager.getLogger(AsyncCommandLineExecutorTest.class.getName()); private static int commmandNumber = 1; - private static final String LOG_DIR = "./target/testLogs"; - @BeforeAll + @BeforeClass public static void setupBefore() { - LOGGER.info("Create LOG_DIR: " + LOG_DIR); - System.setProperty("LOG_DIR", LOG_DIR); - new File(LOG_DIR).mkdirs(); - } - - @Test - void asyncCLICalculatorTest() { - try { - AsyncCommandLineExecutor executor = new AsyncCommandLineExecutor(); - calculatorTest(executor); - executor.close(); - } catch (Exception e) { - e.printStackTrace(); - } + LOGGER.info("Using LOG_DIR: " + System.getProperty("LOG_DIR")); } private static String sendCommand(AsyncCommandLineExecutor executor, String command, int timeoutInSeconds) { @@ -128,4 +113,16 @@ private static void calculatorTest(AsyncCommandLineExecutor executor) { response = sendCommand(executor, command, timeoutInSeconds); assertThat(response).as("Output of command: '" + command + "' is incorrect").isEqualTo(expectedResponse); } + + @Test + public void asyncCLICalculatorTest() { + try { + new TestExecutionContext("asyncCLICalculatorTest"); + AsyncCommandLineExecutor executor = new AsyncCommandLineExecutor(); + calculatorTest(executor); + executor.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/src/test/resources/com/znsio/teswiz/features/cyptoAPI.feature b/src/test/resources/com/znsio/teswiz/features/cyptoAPI.feature index 4393bce69..9d0cf8bd0 100644 --- a/src/test/resources/com/znsio/teswiz/features/cyptoAPI.feature +++ b/src/test/resources/com/znsio/teswiz/features/cyptoAPI.feature @@ -7,11 +7,11 @@ Feature: Crypto-Currency data change Given I send GET request for crypto Then price change should be less than Examples: - | symbol | maxPriceChange | - | "LTCUSDT" | 75 | - | "ETHUSDT" | 200 | - | "BNBUSDT" | 55 | - | "XRPUSDT" | 80 | + | symbol | maxPriceChange | + | "LTCUSDT" | 75 | + | "ETHUSDT" | 200 | + | "BNBUSDT" | 55 | + | "XRPUSDT" | 80 | @priceChangePercentage Scenario: Validate price change percentage for BTC diff --git a/src/test/resources/com/znsio/teswiz/features/healthCheck.feature b/src/test/resources/com/znsio/teswiz/features/healthCheck.feature index d6097ca6f..ff98f265d 100644 --- a/src/test/resources/com/znsio/teswiz/features/healthCheck.feature +++ b/src/test/resources/com/znsio/teswiz/features/healthCheck.feature @@ -1,10 +1,10 @@ @api @healthcheck - Feature: Health check feature +Feature: Health check feature # CONFIG=./configs/api_local_config.properties TAG=healthcheck PLATFORM=api ./gradlew run - Scenario: Print username and current dir - Given I print my username - Then I see my current directory + Scenario: Print username and current dir + Given I print my username + Then I see my current directory - Scenario: Print current platform - Given I print the current platform + Scenario: Print current platform + Given I print the current platform diff --git a/src/test/resources/com/znsio/teswiz/features/jiomeet.feature b/src/test/resources/com/znsio/teswiz/features/jiomeet.feature index f28aa1631..843502a7d 100644 --- a/src/test/resources/com/znsio/teswiz/features/jiomeet.feature +++ b/src/test/resources/com/znsio/teswiz/features/jiomeet.feature @@ -51,8 +51,8 @@ Feature: In a meeting scenarios Then "Guest-2" should see the chat message on its chat window # CONFIG=./configs/jio/jiomeet_local_config.properties TAG="@jiomeet and @selectNotificationTest" PLATFORM=android ./gradlew run - @selectNotificationTest @android - Scenario: User should be able to view and open the JioMeet Meeting Notification - Given "Host" logs-in and starts an instant meeting in "jiomeetLatest" on "android" - When I open the JioMeet meeting notification from notification bar - Then I should be able to go back to Meeting + @selectNotificationTest @android + Scenario: User should be able to view and open the JioMeet Meeting Notification + Given "Host" logs-in and starts an instant meeting in "jiomeetLatest" on "android" + When I open the JioMeet meeting notification from notification bar + Then I should be able to go back to Meeting diff --git a/src/test/resources/com/znsio/teswiz/features/weatherAPI.feature b/src/test/resources/com/znsio/teswiz/features/weatherAPI.feature index 11eb4aeeb..975205f68 100644 --- a/src/test/resources/com/znsio/teswiz/features/weatherAPI.feature +++ b/src/test/resources/com/znsio/teswiz/features/weatherAPI.feature @@ -17,8 +17,8 @@ Feature: Weather data based on location Coordinates Given I send GET request with valid location coordinates and Then wind speed of that location should be in range 0 and 90 kmph Examples: - | latitude | longitude | city | - | "18.987807" | "72.836447" | Mumbai | - | "28.651952" | "77.231495" | Delhi | - | "22.562627" | "88.363044" | Kolkata | - | "13.084622" | "80.248357" | Chennai | + | latitude | longitude | city | + | "18.987807" | "72.836447" | Mumbai | + | "28.651952" | "77.231495" | Delhi | + | "22.562627" | "88.363044" | Kolkata | + | "13.084622" | "80.248357" | Chennai | diff --git a/src/test/resources/testData.json b/src/test/resources/testData.json index d9a1c49bf..8fd120d8e 100644 --- a/src/test/resources/testData.json +++ b/src/test/resources/testData.json @@ -12,7 +12,7 @@ "IMAGE_FILE_LOCATION": "/src/test/resources/images/handbag.jpg", "UPLOAD_IMAGE_LOCATION": "/sdcard/Images/handbag.jpg" }, - "Weather_API":{ + "Weather_API": { "url": "https://api.open-meteo.com/v1/forecast?", "geocode_url": "https://geocode.maps.co/search?", "latitude": "28.6139", @@ -20,10 +20,10 @@ "hourly": "temperature_2m", "days": "17" }, - "Crypto_API":{ + "Crypto_API": { "url": "https://data.binance.com/api/v3/ticker/24hr?" }, - "RestUser_API":{ + "RestUser_API": { "url": "https://jsonplaceholder.typicode.com/posts", "postBody": { "title": "Teswiz",