Skip to content

Commit 02b1a35

Browse files
authored
Updated dependencies; Resolved appium conflicts. (#57)
* Updated dependencies; Resolved appium conflicts: - MobileBy. (is deprecated) changed to AppiumBy.; - By.tagName changed to By.xpath in case of 'tagName' strategy not supported by appium; - DesiredCapabilities changed to WindowsOptions; - RemoteWebDriver changed to WindowsDriver; - CachedWebElementTests, WebElementTests, CachedElementStateProviderTests, DefaultElementStateProviderTests, WaitForObjectTests moved to single-thread test in TestSuite.xml
1 parent 7a94aae commit 02b1a35

File tree

6 files changed

+73
-32
lines changed

6 files changed

+73
-32
lines changed

azure-pipelines.yml

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,51 @@ jobs:
4444
displayName: Run tests
4545

4646
steps:
47+
- task: NodeTool@0
48+
displayName: 'Install Node.js'
49+
inputs:
50+
versionSpec: '16.x'
51+
52+
- task: CmdLine@2
53+
displayName: 'Install Appium'
54+
inputs:
55+
script: |
56+
echo "Installing Appium"
57+
npm install -g appium@next
58+
appium --version
59+
echo "Appium installed"
60+
61+
- task: CmdLine@2
62+
displayName: 'Install and Run Appium doctor'
63+
inputs:
64+
script: |
65+
echo "Installing and Running Appium doctor"
66+
npm install -g [email protected]
67+
npm install -g [email protected]
68+
appium-doctor
69+
echo "Appium doctor installed and executed"
70+
71+
- task: CmdLine@2
72+
displayName: 'Install Appium Windows Driver'
73+
inputs:
74+
script: |
75+
echo "Installing Appium Windows Driver"
76+
appium driver install windows
77+
appium driver list
78+
echo "Appium Windows Driver installed"
79+
80+
- task: CmdLine@2
81+
displayName: 'Start Appium server'
82+
inputs:
83+
script: |
84+
start cmd.exe @cmd /k "appium"
85+
echo "Appium server started"
86+
4787
- task: ScreenResolutionUtility@1
4888
displayName: 'Set optimal screen resolution'
4989
inputs:
5090
displaySettings: 'optimal'
5191

52-
- task: Windows Application Driver@0
53-
displayName: 'Start WinAppDriver'
54-
inputs:
55-
OperationType: 'Start'
56-
5792
- task: Maven@3
5893
displayName: 'Run tests'
5994
inputs:
@@ -65,8 +100,3 @@ jobs:
65100
publishJUnitResults: true
66101
testResultsFiles: '**/surefire-reports/TEST-*.xml'
67102
goals: 'clean test -Dprofile=local'
68-
69-
- task: Windows Application Driver@0
70-
displayName: 'Stop WinAppDriver'
71-
inputs:
72-
OperationType: 'Stop'

pom.xml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.github.aquality-automation</groupId>
88
<artifactId>aquality-selenium-core</artifactId>
9-
<version>1.2.1</version>
9+
<version>2.0.0</version>
1010

1111
<packaging>jar</packaging>
1212
<name>Aquality Selenium Core</name>
@@ -72,6 +72,14 @@
7272
<id>runets</id>
7373
<name>Kiril Runets</name>
7474
</developer>
75+
<developer>
76+
<id>d2kravchenko</id>
77+
<name>Dmitry Kravchenko</name>
78+
</developer>
79+
<developer>
80+
<id>aPavar</id>
81+
<name>Andrey Pavar</name>
82+
</developer>
7583
</developers>
7684

7785
<dependencies>
@@ -95,7 +103,7 @@
95103
<dependency>
96104
<groupId>com.google.inject</groupId>
97105
<artifactId>guice</artifactId>
98-
<version>4.2.2</version>
106+
<version>5.0.1</version>
99107
<exclusions>
100108
<exclusion>
101109
<groupId>com.google.guava</groupId>
@@ -106,23 +114,23 @@
106114
<dependency>
107115
<groupId>com.fasterxml.jackson.core</groupId>
108116
<artifactId>jackson-databind</artifactId>
109-
<version>2.10.2</version>
117+
<version>2.13.0</version>
110118
</dependency>
111119
<dependency>
112120
<groupId>org.seleniumhq.selenium</groupId>
113121
<artifactId>selenium-java</artifactId>
114-
<version>3.141.59</version>
122+
<version>4.1.0</version>
115123
</dependency>
116124
<dependency>
117125
<groupId>io.github.bonigarcia</groupId>
118126
<artifactId>webdrivermanager</artifactId>
119-
<version>3.4.0</version>
127+
<version>5.0.2</version>
120128
<scope>test</scope>
121129
</dependency>
122130
<dependency>
123131
<groupId>io.appium</groupId>
124132
<artifactId>java-client</artifactId>
125-
<version>7.2.0</version>
133+
<version>8.0.0-beta</version>
126134
<scope>test</scope>
127135
</dependency>
128136
<dependency>

src/test/java/tests/applications/windowsApp/CalculatorWindow.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package tests.applications.windowsApp;
22

33
import aquality.selenium.core.elements.ElementState;
4-
import io.appium.java_client.MobileBy;
4+
import io.appium.java_client.AppiumBy;
55
import org.openqa.selenium.By;
66
import tests.elements.factory.CustomElement;
77

@@ -10,7 +10,7 @@ private CalculatorWindow(){
1010
}
1111

1212
public static By getWindowLocator() {
13-
return By.tagName("Window");
13+
return By.xpath("//Window");
1414
}
1515

1616
public static CustomElement getWindowLabel() {
@@ -53,15 +53,15 @@ public static By getDottedXPathLocator() {
5353
return By.xpath("//*[@Name='=']/parent::Window");
5454
}
5555

56-
public static By getTagNameLocator() {
57-
return By.tagName("Button");
56+
public static By getTagXpathLocator() {
57+
return By.xpath("//Button");
5858
}
5959

6060
public static By getResultsLabelLoc() {
61-
return MobileBy.AccessibilityId("48");
61+
return AppiumBy.accessibilityId("48");
6262
}
6363

6464
public static CustomElement getLeftValueTextBox() {
65-
return new CustomElement(MobileBy.xpath("//*[@AutomationId='50']"), "Left value", ElementState.DISPLAYED);
65+
return new CustomElement(AppiumBy.xpath("//*[@AutomationId='50']"), "Left value", ElementState.DISPLAYED);
6666
}
6767
}

src/test/java/tests/applications/windowsApp/WindowsApplication.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
import aquality.selenium.core.applications.IApplication;
44
import io.appium.java_client.windows.WindowsDriver;
5-
import io.appium.java_client.windows.WindowsElement;
6-
import org.openqa.selenium.remote.DesiredCapabilities;
5+
import io.appium.java_client.windows.options.WindowsOptions;
76
import org.openqa.selenium.remote.RemoteWebDriver;
87

98
import java.net.URL;
@@ -12,12 +11,12 @@
1211

1312
public class WindowsApplication implements IApplication {
1413
private long implicitWaitSeconds;
15-
private final RemoteWebDriver driver;
14+
private final WindowsDriver driver;
1615

1716
WindowsApplication(long implicitWaitSeconds, String appPath, URL serviceUrl) {
18-
DesiredCapabilities capabilities = new DesiredCapabilities();
19-
capabilities.setCapability("app", appPath);
20-
driver = new WindowsDriver<WindowsElement>(serviceUrl, capabilities);
17+
WindowsOptions options = new WindowsOptions();
18+
options.setApp(appPath);
19+
driver = new WindowsDriver(serviceUrl, options);
2120
setImplicitWaitTimeout(Duration.ofSeconds(implicitWaitSeconds));
2221
}
2322

src/test/java/tests/elements/factory/IFindElementsTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ default void testShouldBePossibleToWorkWithElementsFoundBySpecificLocator(By loc
6565
default Object[] getSupportedLocators() {
6666
List<By> locators = new ArrayList<>();
6767
locators.add(CalculatorWindow.getDottedXPathLocator());
68-
locators.add(CalculatorWindow.getTagNameLocator());
68+
locators.add(CalculatorWindow.getTagXpathLocator());
6969
locators.add(CalculatorWindow.getRelativeXPathLocator());
7070
return locators.toArray();
7171
}

src/test/resources/TestSuite.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@
1212
<class name="tests.utilities.ElementActionRetrierTests"/>
1313
<class name="tests.utilities.ActionRetrierTests"/>
1414
<class name="tests.waitings.WaitForTests"/>
15-
<class name="tests.waitings.WaitForObjectTests"/>
1615
<class name="tests.waitings.WaitForTrueTests"/>
17-
<class name="tests.elements.DefaultElementStateProviderTests"/>
18-
<class name="tests.elements.CachedElementStateProviderTests"/>
16+
</classes>
17+
</test>
18+
<test name="Single-thread tests" parallel="none">
19+
<classes>
1920
<class name="tests.elements.CachedWebElementTests"/>
2021
<class name="tests.elements.WebElementTests"/>
22+
<class name="tests.elements.CachedElementStateProviderTests"/>
23+
<class name="tests.elements.DefaultElementStateProviderTests"/>
24+
<class name="tests.waitings.WaitForObjectTests"/>
2125
</classes>
2226
</test>
2327
<test name="Use cases tests" parallel="methods" thread-count="10">

0 commit comments

Comments
 (0)