Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/java 11 upgrade #41

Merged
merged 12 commits into from
Aug 14, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Build with Maven
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/run-smoke-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Run Web Smoke Tests

on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Select an Environment?
options:
- test
- stage
- prod
color:
type: choice
description: Select a Color?
options:
- yellow
- green
- blue

jobs:

run:
name: run
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Start Selenoid Server
uses: Xotabu4/selenoid-github-action@v2

- name: Run Tests
run: mvn -B clean install -Psmoke-web -Dcolor=${{github.event.inputs.color}} -Dtest.env=${{github.event.inputs.environment}} -Drunners=5 -Dskip-profile=true

- name: Get Allure history
uses: actions/checkout@v2
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages

- name: Allure Report action from marketplace
uses: simple-elf/allure-report-action@master
if: always()
id: allure-report
with:
allure_results: target/allure-results
gh_pages: gh-pages
allure_report: allure-report
allure_history: allure-history

- name: Deploy report to Github Pages
if: always()
uses: peaceiris/actions-gh-pages@v2
env:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: allure-history
45 changes: 24 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.pacificwebconsulting.core</groupId>
<artifactId>core-microservice</artifactId>
<version>2.0.115-SNAPSHOT</version>
<version>3.0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Core Automation Microservice</name>
<description>Central automated test execution framework</description>
Expand Down Expand Up @@ -43,7 +43,7 @@
</snapshotRepository>
</distributionManagement>
<properties>
<appium.version>7.3.0</appium.version>
<appium.version>8.5.1</appium.version>
<assertion-microservice.version>1.0.5</assertion-microservice.version>
<automate-client-java.version>0.4</automate-client-java.version>
<browsermob-core.version>2.1.5</browsermob-core.version>
Expand All @@ -57,18 +57,18 @@
<ios-server.version>0.6.2</ios-server.version>
<jackson.json.version>2.10.0.pr1</jackson.json.version>
<jacoco.version>0.7.5.201505241946</jacoco.version>
<java_code.version>1.8</java_code.version>
<java.version>11</java.version>
<javatuples.version>1.2</javatuples.version>
<jsoup.version>1.15.3</jsoup.version>
<junit.version>4.13.1</junit.version>
<junit.version>4.13.2</junit.version>
<logging-microservice.version>1.0.9</logging-microservice.version>
<lombok.version>1.18.4</lombok.version>
<maven-clean-plugin.version>2.4.1</maven-clean-plugin.version>
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
<maven-jar-plugin.version>2.4</maven-jar-plugin.version>
<maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version>
<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
<maven-release-plugin.version>2.3.2</maven-release-plugin.version>
<maven-resources-plugin.version>2.7</maven-resources-plugin.version>
<maven-scm-plugin.version>1.8.1</maven-scm-plugin.version>
Expand All @@ -81,18 +81,18 @@
<netty-all.version>4.1.72.Final</netty-all.version>
<opera.version>1.5</opera.version>
<poi-ooxml.version>3.15</poi-ooxml.version>
<procyon.version>0.5.28</procyon.version>
<procyon.version>0.6.0</procyon.version>
<restassured.version>2.9.0</restassured.version>
<saucelabs-java.version>2.1.23</saucelabs-java.version>
<saucelabs.version>1.0.35</saucelabs.version>
<selenium-devtools.version>4.9.1</selenium-devtools.version>
<selenium-devtools.artifactId>v112</selenium-devtools.artifactId>
<selenium-devtools.version>4.10.0</selenium-devtools.version>
<selenium.version>4.5.2</selenium.version>
<skip.plugins>false</skip.plugins>
<sortpom-maven-plugin.version>2.6.0</sortpom-maven-plugin.version>
<spring-mongodb.version>1.2.0.RELEASE</spring-mongodb.version>
<spring.version>5.1.0.RELEASE</spring.version>
<surefire-junit47.version>2.12</surefire-junit47.version>
<surefire.junit.version>2.18.1</surefire.junit.version>
<surefire-plugin.version>2.19.1</surefire-plugin.version>
<testng.version>6.9.8</testng.version>
<versions-maven-plugin.version>2.1</versions-maven-plugin.version>
<visual.version>0.10</visual.version>
Expand Down Expand Up @@ -255,7 +255,7 @@
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-devtools-v113</artifactId>
<artifactId>selenium-devtools-${selenium-devtools.artifactId}</artifactId>
<version>${selenium-devtools.version}</version>
</dependency>
<dependency>
Expand Down Expand Up @@ -416,10 +416,15 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java_code.version}</source>
<target>${java_code.version}</target>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down Expand Up @@ -544,14 +549,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${surefire.junit.version}</version>
</dependency>
</dependencies>
<version>${surefire-plugin.version}</version>
<configuration>
<forkCount>3</forkCount>
<reuseForks>true</reuseForks>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.pwc.core.framework.data.SmSessionKey;
import com.pwc.core.framework.listeners.MicroserviceTestListener;
import com.pwc.core.framework.util.PropertiesUtils;
import io.appium.java_client.MobileElement;
import org.apache.commons.lang3.StringUtils;
import org.javatuples.Pair;
import org.junit.experimental.categories.Category;
Expand Down Expand Up @@ -240,7 +239,7 @@ protected long webAction(final String elementIdentifier, final Object attributeV
* data. Typically a button click.
*
* @param elementIdentifier unique identifier for an mobile element
* @return tuple with MobileElement and time in milliseconds for action
* @return tuple with WebElement and time in milliseconds for action
*/
protected Pair mobileAction(final String elementIdentifier) {

Expand All @@ -253,7 +252,7 @@ protected Pair mobileAction(final String elementIdentifier) {
*
* @param elementIdentifier unique identifier for an mobile element
* @param gesture gesture to use
* @return tuple with MobileElement and time in milliseconds for action
* @return tuple with WebElement and time in milliseconds for action
*/
protected Pair mobileAction(final String elementIdentifier, final MobileGesture gesture) {

Expand All @@ -266,7 +265,7 @@ protected Pair mobileAction(final String elementIdentifier, final MobileGesture
* @param elementIdentifier unique identifier for an mobile element
* @param gesture gesture to use
* @param parameters gesture parameters to leverage
* @return tuple with MobileElement and response time in milliseconds for user action
* @return tuple with WebElement and response time in milliseconds for user action
*/
protected Pair mobileAction(final String elementIdentifier, MobileGesture gesture, final Object parameters) {

Expand All @@ -275,7 +274,7 @@ protected Pair mobileAction(final String elementIdentifier, MobileGesture gestur
mobileEventController = (MobileEventController) ctx.getBean("mobileEventController");
mobileEventController.initiateDevice();
}
MobileElement mobileElement = mobileEventController.getMobileEventService().findMobileElement(elementIdentifier);
WebElement mobileElement = mobileEventController.getMobileEventService().findMobileElement(elementIdentifier);
if (mobileElement != null) {
duration = mobileEventController.mobileAction(mobileElement, gesture, parameters);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.pwc.core.framework.FrameworkConstants;
import com.pwc.logging.helper.LoggerHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.SuffixFileFilter;
import org.apache.commons.io.filefilter.TrueFileFilter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
import com.pwc.core.framework.processors.mobile.ViewActivityProcessor;
import com.pwc.core.framework.service.MobileEventService;
import com.pwc.core.framework.util.GridUtils;
import io.appium.java_client.MobileElement;
import io.appium.java_client.remote.MobileCapabilityType;
import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -156,8 +155,6 @@ protected void setDefaultDesiredCapabilities() {

capabilities.setCapability(FrameworkConstants.TIME_ZONE_CAPABILITY, GridUtils.initTimeZone());
capabilities.setCapability(FrameworkConstants.SCREEN_RESOLUTION_CAPABILITY, GridUtils.initBrowserResolution());
capabilities.setCapability(CapabilityType.TAKES_SCREENSHOT, true);
capabilities.setCapability(CapabilityType.SUPPORTS_JAVASCRIPT, true);
capabilities.setCapability(FrameworkConstants.SCRIPT_NAME_CAPABILITY, getReadableTestName());

}
Expand All @@ -170,25 +167,16 @@ protected void setDefaultDesiredCapabilities() {
*/
public MicroserviceMobileDriver getIOSDriver() throws Exception {

LOG("starting iOS driver");
LOG("Starting iOS device driver");
if (StringUtils.isNotEmpty(experitestAccesskey)) {
capabilities.setCapability("accessKey", experitestAccesskey);
capabilities.setCapability("testName", this.currentTestName);
}
if (gridEnabled) {
if (this.remoteMobileDriver == null) {
// IOSDriver iosDriver = new IOSDriver(new URL(gridUrl), capabilities);
// iosDriver.findElementByIosNsPredicate("type == 'XCUIElementTypeStaticText' and name == 'General'");

if (null == this.remoteMobileDriver) {
MicroserviceRemoteMobileDriver microserviceRemoteMobileDriver = new MicroserviceRemoteMobileDriver(new URL(gridUrl), capabilities);
microserviceRemoteMobileDriver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
return microserviceRemoteMobileDriver;

//This works!!!
// MicroserviceRemoteMobileDriver microserviceRemoteMobileDriver = new MicroserviceRemoteMobileDriver(new URL(gridUrl), capabilities);
// microserviceRemoteMobileDriver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
// MobileElement element = (MobileElement) microserviceRemoteMobileDriver.findElementByIosNsPredicate("type == 'XCUIElementTypeStaticText' and name == 'General'");
// System.out.println();
}
} else {
if (this.remoteMobileDriver == null) {
Expand All @@ -205,7 +193,7 @@ public MicroserviceMobileDriver getIOSDriver() throws Exception {
* @param mobileElementValue DOM element value to alter
* @return time in milliseconds for Mouse-specific web event to execute
*/
public long mobileAction(final MobileElement mobileElement, final Object mobileElementValue) {
public long mobileAction(final WebElement mobileElement, final Object mobileElementValue) {

if (TapActivityProcessor.applies(mobileElement)) {
StopWatch stopWatch = new StopWatch();
Expand All @@ -229,7 +217,7 @@ public long mobileAction(final MobileElement mobileElement, final Object mobileE
* @param parameters mobile gesture parameters
* @return time in milliseconds for Mouse-specific web event to execute
*/
public long mobileAction(final MobileElement mobileElement, final MobileGesture gesture, final Object parameters) {
public long mobileAction(final WebElement mobileElement, final MobileGesture gesture, final Object parameters) {

if (GestureActivityProcessor.applies(gesture)) {
StopWatch stopWatch = new StopWatch();
Expand Down Expand Up @@ -270,7 +258,7 @@ private void constructTestName() {
public void closeApp() {

try {
this.remoteMobileDriver.closeApp();
//this.remoteMobileDriver.closeApp();
} catch (Exception e) {
e.getMessage();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ public void rotate(DeviceRotation deviceRotation) {
public DeviceRotation rotation() {
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
/**
* Common driver to talk to encapsulate all the different Appium Drivers we can use (iOS, Android, etc...)
*/
public interface MicroserviceMobileDriver extends org.openqa.selenium.internal.FindsByXPath, io.appium.java_client.InteractsWithApps, io.appium.java_client.InteractsWithFiles,
io.appium.java_client.FindsByAccessibilityId, io.appium.java_client.FindsByAndroidUIAutomator, io.appium.java_client.FindsByIosClassChain,
io.appium.java_client.FindsByWindowsAutomation, io.appium.java_client.FindsByIosNSPredicate {
public interface MicroserviceMobileDriver extends org.openqa.selenium.WebDriver, org.openqa.selenium.JavascriptExecutor, org.openqa.selenium.HasCapabilities {
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ public void onFinish(ITestContext testContext) {
LOG(true, StringUtils.repeat("\n", 2));
LOG(true, StringUtils.repeat("-", 100));
LOG(true, "TEST EXECUTION COMPLETE");
LOG(true, "%s--Executed in Environment: %s", testContext.getName(), System.getProperty(FrameworkConstants.AUTOMATION_TEST_ENVIRONMENT).toUpperCase());
if (StringUtils.isNotEmpty(System.getProperty(FrameworkConstants.AUTOMATION_TEST_ENVIRONMENT))) {
LOG(true, "%s--Executed in Environment: %s", testContext.getName(), System.getProperty(FrameworkConstants.AUTOMATION_TEST_ENVIRONMENT).toUpperCase());
}
LOG(true, "%s--Executed on Date/Time: %s", testContext.getName(), LoggerHelper.getDateTime(FrameworkConstants.DATETIME_LOGGER_DATETIME_PATTER, FrameworkConstants.SYSTEM_DEFAULT_TIMEZONE, 0));
LOG(true, StringUtils.repeat("-", 100));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.pwc.core.framework.processors.mobile.gestures.TouchAndHoldImpl;
import com.pwc.core.framework.processors.mobile.gestures.TwoFingerTap;
import com.pwc.core.framework.processors.mobile.gestures.TwoFingerTapImpl;
import io.appium.java_client.MobileElement;
import org.openqa.selenium.WebElement;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -43,7 +43,7 @@ public static boolean applies(MobileGesture gesture) {
|| TwoFingerTapImpl.applies(gesture);
}

public Map buildParameters(MobileElement mobileElement, MobileGesture gesture, Object customParameters) {
public Map buildParameters(WebElement mobileElement, MobileGesture gesture, Object customParameters) {

Map params = new HashMap();
if (TapImpl.applies(gesture)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.pwc.core.framework.processors.mobile.elements.XCUIElementTypeButtonImpl;
import com.pwc.core.framework.processors.mobile.elements.XCUIElementTypeCellImpl;
import com.pwc.core.framework.processors.mobile.elements.XCUIElementTypeStaticTextImpl;
import io.appium.java_client.MobileElement;
import org.openqa.selenium.WebElement;

public class KeypadActivityProcessor {

Expand All @@ -16,11 +16,11 @@ public static KeypadActivityProcessor getInstance() {
return instance;
}

public static boolean applies(MobileElement mobileElement) {
public static boolean applies(WebElement mobileElement) {
return XCUIElementTypeCellImpl.applies(mobileElement) || XCUIElementTypeStaticTextImpl.applies(mobileElement) || XCUIElementTypeButtonImpl.applies(mobileElement);
}

public void mobileAction(MobileElement mobileElement, Object value) {
public void mobileAction(WebElement mobileElement, Object value) {

if (XCUIElementTypeCellImpl.applies(mobileElement)) {
XCUIElementTypeCellImpl element = new XCUIElementTypeCellImpl();
Expand Down
Loading
Loading