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

[Breaking] Migrate to Java 11 +semver: breaking #38

Merged
merged 3 commits into from
Feb 26, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/release-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -26,7 +31,7 @@ Alternatively, you can follow the steps below:
<dependency>
<groupId>com.github.aquality-automation</groupId>
<artifactId>aquality-appium-mobile</artifactId>
<version>3.0.x</version>
<version>5.0.x</version>
</dependency>
```

Expand Down
2 changes: 2 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '11'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
Expand Down Expand Up @@ -120,6 +121,7 @@ jobs:
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '11'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
Expand Down
37 changes: 28 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<properties>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>4.0.0-SNAPSHOT</revision>
<revision>5.0.0-SNAPSHOT</revision>
</properties>

<distributionManagement>
Expand Down Expand Up @@ -73,14 +73,14 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>
<version>0.8.11</version>
<executions>
<execution>
<id>pre-unit-test</id>
Expand Down Expand Up @@ -125,6 +125,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -137,6 +138,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<configuration>
<source>11</source>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -149,7 +154,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.1.0</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -169,7 +174,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand All @@ -184,19 +189,33 @@
<dependency>
<groupId>com.github.aquality-automation</groupId>
<artifactId>aquality-selenium-core</artifactId>
<version>3.1.1</version>
<version>4.0.0</version>
</dependency>

<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>8.6.0</version>
<version>9.1.0</version>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.5.1</version>
<version>7.9.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.14.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.15.1</version>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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");
Expand All @@ -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");
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -17,6 +20,9 @@ protected void startActivity(Activity activity) {
activity.getAppActivity(),
activity.getAppPackage());
AndroidDriver driver = (AndroidDriver) AqualityServices.getApplication().getDriver();
driver.startActivity(activity);
Map<String, Object> params = new HashMap<>();
params.put("intent", activity.getAppPackage() + "/" + activity.getAppActivity());
params.put("package", activity.getAppPackage());
driver.executeScript("mobile: startActivity", params);
}
}
4 changes: 3 additions & 1 deletion src/test/java/samples/android/web/AndroidWebTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ void setUp() {

@AfterClass
void tearDown() {
AqualityServices.getApplication().quit();
if (AqualityServices.isApplicationStarted()) {
AqualityServices.getApplication().quit();
}
System.clearProperty("profile");
}
}
2 changes: 1 addition & 1 deletion src/test/resources/settings.androidwebsession.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"pollingInterval": 300
},
"logger": {
"language": "ru"
"language": "en"
},
"elementCache": {
"isEnabled": false
Expand Down
Loading