Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,12 @@
# Project Specific
######################
/target/www/**
/src/test/javascript/coverage/
/src/test/javascript/PhantomJS*/
/test-output/

example_usage/lib/test-output/
example_usage/lib/ExtentReport.html
example_usage/lib/codeless_test-0.0.3-SNAPSHOT-jar-with-dependencies.jar
example_usage/lib/codeless-jar-with-dependencies.jar

######################
# Node
######################
/node/
node_tmp/
node_modules/
npm-debug.log.*

######################
# SASS
######################
.sass-cache/

######################
# Eclipse
Expand Down
16 changes: 16 additions & 0 deletions CHANGLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

## 0.2.0 (Feb 14, 2022)

### Added
* [copy_sources] add script into pom.xml to copy to example_usage\lib from executable_with_all_dependency.jar
* [copy_sources] add script into pom.xml to copy to example_usage\lib\web_drivers from codeless_test\web_driver

### Changed
* [example_usage] run bat/sh uses identical jar file(codeless-jar-with-dependencies.jar)
* [main] uses maven 3.8.1
* [test] web_drivers update, uses guava 31.0.1, common-lang3 3.12.0, extentsreport 5.0.8
* [core] uses slf4j 1.7.35, restassured 4.5.0, jackson 2.13.1, poi 4.1.2, assertj 3.22.0, commons-csv 1.9.0, swagger-parser 1.0.56, ooxml-schema 1.4, Selenium4

### Removed
* [example_usage] remove web_drivers folder
* [example_usage] remove *.jar as duplicates

## 0.1.0 (Jan 10, 2022)

### Changed
Expand Down
24 changes: 9 additions & 15 deletions codeless_core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@
<properties>
<testng.version>7.5</testng.version>
<junit.version>4.13.2</junit.version>
<selenium.version>3.141.59</selenium.version>
<selenium.version>4.1.2</selenium.version>
<appiumclient.version>7.6.0</appiumclient.version>
<sl4j.version>1.7.25</sl4j.version>
<restassured.version>4.4.0</restassured.version>
<jackson.version>2.11.0</jackson.version>
<poi.version>3.17</poi.version>
<sl4j.version>1.7.35</sl4j.version>
<restassured.version>4.5.0</restassured.version>
<jackson.version>2.13.1</jackson.version>
<poi.version>4.1.2</poi.version>
</properties>

<dependencies>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.11.1</version>
<version>3.22.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.4</version>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
Expand All @@ -47,11 +47,6 @@
<artifactId>mockito-core</artifactId>
<version>2.23.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
Expand Down Expand Up @@ -129,7 +124,7 @@
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-parser</artifactId>
<version>1.0.37</version>
<version>1.0.56</version>
</dependency>

<!-- ons-lang/commons-lang -->
Expand Down Expand Up @@ -158,7 +153,7 @@
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.3</version>
<version>1.4</version>
</dependency>

<!-- logging -->
Expand All @@ -172,7 +167,6 @@
<artifactId>slf4j-log4j12</artifactId>
<version>${sl4j.version}</version>
</dependency>

</dependencies>

<build>
Expand Down
10 changes: 5 additions & 5 deletions codeless_test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
<version>3.12.0</version>
</dependency>

<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>5.0.8</version>
</dependency>

<!-- Wiremock for Unit Tests -->
Expand All @@ -66,7 +66,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>[24.1.1,)</version>
<version>[31.0.1,)</version>
</dependency>
</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.io.IOException;

import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;

Expand All @@ -43,7 +42,7 @@ public static Workbook readExcelFile(String resource, boolean addClassPath) {
}
try {
return WorkbookFactory.create(workbookFile);
} catch (EncryptedDocumentException | InvalidFormatException | IOException e) {
} catch (EncryptedDocumentException | IOException e) {
e.printStackTrace();
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@

import java.util.HashMap;

import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.ExtentTest;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.markuputils.MarkupHelper;
import com.aventstack.extentreports.reporter.ExtentSparkReporter;
//import com.relevantcodes.extentreports.ExtentReports;
//import com.relevantcodes.extentreports.ExtentTest;
import com.aventstack.extentreports.reporter.configuration.Theme;

/**
* The Class ExtentTestManager.
Expand All @@ -42,8 +47,14 @@ public class ExtentTestManager {
public synchronized static ExtentReports getReporter() {
if (extent == null) {
// Set HTML reporting file location
extent = new ExtentReports(System.getProperty("user.dir") + "/ExtentReport.html", true);

extent = new ExtentReports();
ExtentSparkReporter spark = new ExtentSparkReporter(System.getProperty("user.dir") + "/ExtentReport.html");
spark.config().setTheme(Theme.STANDARD);
//spark.config().setTimeStampFormat("MM/dd/yyyy HH:mm:ss");
spark.config().setReportName("Codeless Report");
spark.config().setEncoding("UTF-8");
spark.config().setTimelineEnabled(true);
extent.attachReporter(spark);
}
return extent;
}
Expand All @@ -57,7 +68,7 @@ public synchronized static ExtentReports getReporter() {
*/
public static synchronized ExtentTest startTest(String testName, String desc) {
try {
ExtentTest test = extent.startTest(testName, desc);
ExtentTest test = extent.createTest(testName, desc);
extentTestMap.put((int) (long) (Thread.currentThread().getId()), test);
return test;
} catch (Exception e) {
Expand All @@ -80,7 +91,8 @@ public static synchronized ExtentTest getTest() {
* End test.
*/
public static synchronized void endTest() {
extent.endTest((ExtentTest) extentTestMap.get((int) (long) (Thread.currentThread().getId())));
//extent..endTest((ExtentTest) extentTestMap.get((int) (long) (Thread.currentThread().getId())));
//getTest().info(MarkupHelper.createUnorderedList(extentTestMap).getMarkup());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.aventstack.extentreports.MediaEntityBuilder;
import com.aventstack.extentreports.Status;
import com.aventstack.extentreports.markuputils.MarkupHelper;
import com.google.common.base.Optional;
import com.relevantcodes.extentreports.LogStatus;
//import com.relevantcodes.extentreports.LogStatus;
import com.tmobile.ct.codeless.core.Result;
import com.tmobile.ct.codeless.core.Step;
import com.tmobile.ct.codeless.service.Call;
Expand Down Expand Up @@ -61,37 +64,37 @@ public static void reporter(Step step) throws Exception {

private static void logServiceStepResult(Step step) {

LogStatus status = logStepResult(step);
Status status = logStepResult(step);
Map<String, String> testConfig = step.getTest().getConfig();
if (testConfig.containsKey(Config.LOGGING_DETAILS_ENABLED)) {
loggingEnabled = Boolean
.parseBoolean((String)testConfig.get(Config.LOGGING_DETAILS_ENABLED));
}
if (loggingEnabled) {
ServiceCallDTO serviceCall = ServiceLogFilter.filter((ServiceCall) step);
ExtentTestManager.getTest().log(status, step.getName(), getDOMResult(serviceCall));
ExtentTestManager.getTest().log(status, getDOMResult(serviceCall));
} else {
ExtentTestManager.getTest().log(status, step.getName(), "");
ExtentTestManager.getTest().log(status, step.getName());
}
}

private static void logUiStepResult(UiStep step) throws Exception {

String screenshotPath = "";
LogStatus status = logStepResult(step);
Status status = logStepResult(step);
if (step.getTest().getConfig().containsKey(Config.TEST_SCREENSHOT_POLICY)) {
String screenShotPolicy = Optional
.fromNullable((String)step.getTest().getConfig().get(Config.TEST_SCREENSHOT_POLICY))
.or(Config.EMPTY);

String actionName = step.getAction().getClass().getSimpleName();

if (!actionName.equalsIgnoreCase("close") && status != LogStatus.SKIP) {
if (!actionName.equalsIgnoreCase("close") && status != Status.SKIP) {

if (screenShotPolicy.equalsIgnoreCase(Config.ALL_STEPS)) {
screenshotPath = WebDriverFactory.getScreenhot(step.getTest().getWebDriver(), step.getName());
step.setScreenShotPath(screenshotPath);
} else if (screenShotPolicy.equalsIgnoreCase(Config.FAILURE_ONLY) && status == LogStatus.FAIL) {
} else if (screenShotPolicy.equalsIgnoreCase(Config.FAILURE_ONLY) && status == Status.FAIL) {
screenshotPath = WebDriverFactory.getScreenhot(step.getTest().getWebDriver(), step.getName());
step.setScreenShotPath(screenshotPath);
}
Expand All @@ -100,9 +103,9 @@ private static void logUiStepResult(UiStep step) throws Exception {

if (StringUtils.isNotBlank(screenshotPath)) {
ExtentTestManager.getTest().log(status, step.getName(),
ExtentTestManager.getTest().addBase64ScreenShot(screenshotPath));
MediaEntityBuilder.createScreenCaptureFromPath(screenshotPath).build());
} else {
ExtentTestManager.getTest().log(status, step.getName(), "");
ExtentTestManager.getTest().log(status, step.getName());
}
}

Expand All @@ -124,19 +127,19 @@ private static String getDOMResult(ServiceCallDTO serviceCall) {

}

private static LogStatus logStepResult(Step step) {
private static Status logStepResult(Step step) {
return step instanceof Call ? getLog(((Call) step).getResult()) : getLog(((UiStepImpl) step).getResult());

}

private static LogStatus getLog(Result result) {
private static Status getLog(Result result) {
switch (result) {
case PASS:
return LogStatus.PASS;
return Status.PASS;
case FAIL:
return LogStatus.FAIL;
return Status.FAIL;
case SKIP:
return LogStatus.SKIP;
return Status.SKIP;
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void executeTest(Test test) throws Exception {
});

try {
ExtentTestManager.getTest().setDescription(test.getName());
ExtentTestManager.getTest().createNode(test.getName());
Integer stepOrder = 1;

// execute steps
Expand Down
1 change: 1 addition & 0 deletions codeless_test/src/main/resources/extent.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extent.reporter.spark.start=true
Binary file modified codeless_test/src/test/resources/suites/test_google.xlsx
Binary file not shown.
Binary file modified codeless_test/web_drivers/mac/chromedriver
Binary file not shown.
Binary file modified codeless_test/web_drivers/mac/geckodriver
Binary file not shown.
Binary file modified codeless_test/web_drivers/mac/msedgedriver
Binary file not shown.
Binary file modified codeless_test/web_drivers/windows/chromedriver.exe
Binary file not shown.
Binary file modified codeless_test/web_drivers/windows/geckodriver.exe
Binary file not shown.
Binary file modified codeless_test/web_drivers/windows/msedgedriver.exe
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,28 @@
public enum SupportedPlatform {

/** The iPhone. */
iPhone(DesiredCapabilities.iphone(), RemoteWebDriver.class),
iPhone(new DesiredCapabilities(), RemoteWebDriver.class),

/** The iPad. */
iPad(DesiredCapabilities.ipad(), RemoteWebDriver.class),
iPad(new DesiredCapabilities(), RemoteWebDriver.class),

/** The android. */
android(DesiredCapabilities.android(), RemoteWebDriver.class),
android(new DesiredCapabilities(), RemoteWebDriver.class),

/** The chrome. */
chrome(DesiredCapabilities.chrome(), RemoteWebDriver.class),
chrome(new DesiredCapabilities(), RemoteWebDriver.class),

/** The firefox. */
firefox(DesiredCapabilities.firefox(), RemoteWebDriver.class),
firefox(new DesiredCapabilities(), RemoteWebDriver.class),

/** The edge. */
edge(DesiredCapabilities.edge(), RemoteWebDriver.class),
edge(new DesiredCapabilities(), RemoteWebDriver.class),

/** The opera blink. */
opera(DesiredCapabilities.operaBlink(),RemoteWebDriver.class),
opera(new DesiredCapabilities(),RemoteWebDriver.class),

/** The safari. */
safari(DesiredCapabilities.safari(), RemoteWebDriver.class),
safari(new DesiredCapabilities(), RemoteWebDriver.class),

/** The default remote. */
defaultRemote(new DesiredCapabilities(), RemoteWebDriver.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.net.URL;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -232,8 +233,8 @@ private String getWebDriverPath(String webDriverPath) {
private void initWebDriver(WebDriver driver) {
try {
driver.manage().window().maximize();
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
driver.manage().timeouts().setScriptTimeout(30, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(30));
driver.manage().timeouts().scriptTimeout(Duration.ofSeconds(30));
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.internal.Locatable;
import org.openqa.selenium.internal.WrapsElement;
import org.openqa.selenium.interactions.Locatable;
import org.openqa.selenium.WrapsElement;
import org.openqa.selenium.support.pagefactory.ElementLocator;
import org.openqa.selenium.support.pagefactory.internal.LocatingElementHandler;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void itShouldExecuteAction() {
options.addArguments("--headless", "--disable-gpu", "--window-size=1920,1200", "--ignore-certificate-errors");
driver = new ChromeDriver(options);
when(test.getWebDriver()).thenReturn(driver);
driver.get("D:\\Code\\CTA\\edp-workspace\\etp_codeless_ui\\src\\test\\resources\\test_website\\login.html");
driver.get("https://www.atitesting.com/login");

step.run();

Expand Down
Loading