From e670bcca1f51f01605e181eef6bd402fca9ff3c7 Mon Sep 17 00:00:00 2001 From: Aliaksej Mialeshka Date: Mon, 26 Feb 2024 19:52:45 +0100 Subject: [PATCH 1/3] [Breaking] Migrate to Java 11 +semver: breaking --- .github/workflows/release-maven-central.yml | 2 +- README.md | 7 +++- pom.xml | 37 ++++++++++++++----- .../apidemos/screens/AndroidScreen.java | 8 +++- .../samples/android/web/AndroidWebTest.java | 4 +- .../resources/settings.androidwebsession.json | 2 +- 6 files changed, 46 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release-maven-central.yml b/.github/workflows/release-maven-central.yml index 75fd3f3..ff3dca3 100644 --- a/.github/workflows/release-maven-central.yml +++ b/.github/workflows/release-maven-central.yml @@ -18,7 +18,7 @@ jobs: - name: Step 2 - Set up Maven Central Repository uses: actions/setup-java@v3 with: - java-version: "8" + java-version: "11" distribution: "adopt" server-id: ossrh server-username: MVN_CENTRAL_USERNAME diff --git a/README.md b/README.md index 02e2245..586623e 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,11 @@ Most of performed methods are logged using LOG4J, so you can easily see a histor We use interfaces where is possible, so you can implement your own version of target interface with no need to rewrite other classes. +> ### Breaking news! +> Starting from v5.0.0 onwards, this package requires Java 11 or higher, as Selenium and Appium have stopped support of Java 8. +> The last version available for Java 8 is [v4.1.1](https://github.com/aquality-automation/aquality-appium-mobile-java/releases/tag/v4.1.1) + + ### Quick start To start the project using aquality.appium.mobile framework, you can [download our template BDD project by this link.](https://github.com/aquality-automation/aquality-appium-mobile-java-template) @@ -26,7 +31,7 @@ Alternatively, you can follow the steps below: com.github.aquality-automation aquality-appium-mobile - 3.0.x + 5.0.x ``` diff --git a/pom.xml b/pom.xml index 2bba249..0af4a63 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ UTF-8 UTF-8 - 4.0.0-SNAPSHOT + 5.0.0-SNAPSHOT @@ -73,14 +73,14 @@ org.apache.maven.plugins maven-compiler-plugin - 8 - 8 + 11 + 11 org.jacoco jacoco-maven-plugin - 0.8.4 + 0.8.11 pre-unit-test @@ -125,6 +125,7 @@ org.apache.maven.plugins maven-source-plugin + 3.3.0 attach-sources @@ -137,6 +138,10 @@ org.apache.maven.plugins maven-javadoc-plugin + 3.6.3 + + 11 + attach-javadocs @@ -149,7 +154,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.1.0 sign-artifacts @@ -169,7 +174,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.8 + 1.6.13 true ossrh @@ -184,19 +189,33 @@ com.github.aquality-automation aquality-selenium-core - 3.1.1 + 4.0.0 io.appium java-client - 8.6.0 + 9.1.0 org.testng testng - 7.5.1 + 7.9.0 + test + + + + org.apache.commons + commons-lang3 + 3.14.0 + test + + + + commons-io + commons-io + 2.15.1 test diff --git a/src/test/java/samples/android/nativeapp/apidemos/screens/AndroidScreen.java b/src/test/java/samples/android/nativeapp/apidemos/screens/AndroidScreen.java index 67222ba..ff01d0c 100644 --- a/src/test/java/samples/android/nativeapp/apidemos/screens/AndroidScreen.java +++ b/src/test/java/samples/android/nativeapp/apidemos/screens/AndroidScreen.java @@ -6,6 +6,9 @@ import io.appium.java_client.android.AndroidDriver; import org.openqa.selenium.By; +import java.util.HashMap; +import java.util.Map; + public abstract class AndroidScreen extends Screen { protected AndroidScreen(By locator, String name) { @@ -17,6 +20,9 @@ protected void startActivity(Activity activity) { activity.getAppActivity(), activity.getAppPackage()); AndroidDriver driver = (AndroidDriver) AqualityServices.getApplication().getDriver(); - driver.startActivity(activity); + Map params = new HashMap<>(); + params.put("intent", activity.getAppPackage() + "/" + activity.getAppActivity()); + params.put("package", activity.getAppPackage()); + driver.executeScript("mobile: startActivity", params); } } diff --git a/src/test/java/samples/android/web/AndroidWebTest.java b/src/test/java/samples/android/web/AndroidWebTest.java index 1935499..f82ebd8 100644 --- a/src/test/java/samples/android/web/AndroidWebTest.java +++ b/src/test/java/samples/android/web/AndroidWebTest.java @@ -16,7 +16,9 @@ void setUp() { @AfterClass void tearDown() { - AqualityServices.getApplication().quit(); + if (AqualityServices.isApplicationStarted()) { + AqualityServices.getApplication().quit(); + } System.clearProperty("profile"); } } diff --git a/src/test/resources/settings.androidwebsession.json b/src/test/resources/settings.androidwebsession.json index af5d679..4435d99 100644 --- a/src/test/resources/settings.androidwebsession.json +++ b/src/test/resources/settings.androidwebsession.json @@ -37,7 +37,7 @@ "pollingInterval": 300 }, "logger": { - "language": "ru" + "language": "en" }, "elementCache": { "isEnabled": false From 4f46078e24c7da35b7ebec567817ce4464d0d58b Mon Sep 17 00:00:00 2001 From: Aliaksej Mialeshka Date: Mon, 26 Feb 2024 20:16:31 +0100 Subject: [PATCH 2/3] update pipeline java version --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f335983..0e8ae28 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -27,6 +27,7 @@ jobs: publishJUnitResults: true testResultsFiles: '**/surefire-reports/TEST-*.xml' javaHomeOption: 'JDKVersion' + jdkVersionOption: '11' mavenVersionOption: 'Default' mavenAuthenticateFeed: false effectivePomSkip: false @@ -120,6 +121,7 @@ jobs: publishJUnitResults: true testResultsFiles: '**/surefire-reports/TEST-*.xml' javaHomeOption: 'JDKVersion' + jdkVersionOption: '11' mavenVersionOption: 'Default' mavenAuthenticateFeed: false effectivePomSkip: false From d628a33a12f023858b53868d1de43d9e6dff5f35 Mon Sep 17 00:00:00 2001 From: Aliaksej Mialeshka Date: Mon, 26 Feb 2024 20:42:14 +0100 Subject: [PATCH 3/3] update waits in tests --- .../android/nativeapp/AndroidBasicInteractionsTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/samples/android/nativeapp/AndroidBasicInteractionsTest.java b/src/test/java/samples/android/nativeapp/AndroidBasicInteractionsTest.java index 8cea72f..5edd379 100644 --- a/src/test/java/samples/android/nativeapp/AndroidBasicInteractionsTest.java +++ b/src/test/java/samples/android/nativeapp/AndroidBasicInteractionsTest.java @@ -35,7 +35,7 @@ public void openCheckBoxesScreen() { private void openViewControlsScreen() { ViewControlsScreen screen = ApplicationActivity.VIEW_CONTROLS.open(); - Assert.assertTrue(screen.state().isDisplayed(), String.format("%s screen should be opened", screen.getName())); + Assert.assertTrue(screen.state().waitForDisplayed(), String.format("%s screen should be opened", screen.getName())); } @Override @@ -57,7 +57,7 @@ public void tearDown() { @Test public void testSendKeys() { InvokeSearchScreen searchScreen = ApplicationActivity.SEARCH.open(); - Assert.assertTrue(searchScreen.state().isDisplayed(), String.format("%s should be opened", searchScreen.getName())); + Assert.assertTrue(searchScreen.state().waitForDisplayed(), String.format("%s should be opened", searchScreen.getName())); String query = "Hello world!"; searchScreen.submitSearch(query); Assert.assertEquals(searchScreen.getSearchResult(), query, "Search result don't match to entered query"); @@ -67,7 +67,7 @@ public void testSendKeys() { public void testSaveAndCompareScreenDump() { InvokeSearchScreen searchScreen = ApplicationActivity.SEARCH.open(); - Assert.assertTrue(searchScreen.state().isDisplayed(), String.format("%s should be opened", searchScreen.getName())); + Assert.assertTrue(searchScreen.state().waitForDisplayed(), String.format("%s should be opened", searchScreen.getName())); final String customDumpName = String.format("my dump of %s", searchScreen.getName()); searchScreen.dump().save(customDumpName); Assert.assertEquals(searchScreen.dump().compare(customDumpName), 0, "Current screen should have no visual difference comparing to just saved dump"); @@ -114,7 +114,7 @@ public void testVerticalSwipeToElement() { @Test public void testHorizontalSwipeToElement() { ViewTabsScrollableScreen viewTabsScrollableScreen = ApplicationActivity.VIEW_TABS_SCROLLABLE.open(); - Assert.assertTrue(viewTabsScrollableScreen.state().isDisplayed(), + Assert.assertTrue(viewTabsScrollableScreen.state().waitForDisplayed(), String.format("%s screen should be opened", viewTabsScrollableScreen.getName())); viewTabsScrollableScreen.swipeTabWithLongPress(4, 1); viewTabsScrollableScreen.selectTab(7);