Skip to content

Commit 20e37e2

Browse files
update to latest java client (AppiumTestDistribution#985)
* updates w.r.t latest java client * switch to appium2 * Revert "switch to appium2" This reverts commit 8255593. * make checkstyle happy * bump node version in CI * install appium2 * install windows driver * remove windows ci run * fix simulator version for test * fix platform condition * remove ios logs * extend ADB timeout Co-authored-by: saikrishna321 <saikrishna321@yahoo.com>
1 parent dbef9be commit 20e37e2

18 files changed

Lines changed: 106 additions & 93 deletions

azure-pipelines.yml

Lines changed: 59 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
jobs:
77
- job: CheckStyle
88
pool:
9-
vmImage: "macos-10.15"
9+
vmImage: "macos-latest"
1010

1111
steps:
1212
- task: NodeTool@0
1313
inputs:
14-
versionSpec: "12.18.1"
14+
versionSpec: "17.5.0"
1515

1616
- script: |
1717
mvn clean install -Dmaven.test.skip=true -Dgpg.skip
@@ -20,21 +20,23 @@ jobs:
2020
2121
- job: Distribute
2222
pool:
23-
vmImage: "macos-10.15"
23+
vmImage: "macos-latest"
2424

2525
steps:
2626
- task: NodeTool@0
2727
inputs:
28-
versionSpec: "12.18.1"
28+
versionSpec: "17.5.0"
2929
- script: |
3030
brew outdated xctool || brew upgrade xctool
3131
xcrun simctl list
3232
displayName: "iOS Sim Versions"
3333
3434
- script: |
3535
node -v
36-
npm install -g appium
36+
npm install -g appium@next
3737
appium -v
38+
appium driver install uiautomator2
39+
appium driver install xcuitest
3840
displayName: "Install Appium"
3941
4042
- bash: |
@@ -63,20 +65,22 @@ jobs:
6365
6466
- job: Parallel
6567
pool:
66-
vmImage: "macos-10.15"
68+
vmImage: "macos-latest"
6769

6870
steps:
6971
- task: NodeTool@0
7072
inputs:
71-
versionSpec: "12.18.1"
73+
versionSpec: "17.5.0"
7274
- script: |
7375
brew outdated xctool || brew upgrade xctool
7476
xcrun simctl list
7577
displayName: "iOS Sim Versions"
7678
7779
- script: |
7880
node -v
79-
npm install -g appium
81+
npm install -g appium@next
82+
appium driver install uiautomator2
83+
appium driver install xcuitest
8084
appium -v
8185
displayName: "Install Appium"
8286
@@ -106,12 +110,12 @@ jobs:
106110
107111
- job: SauceLabs
108112
pool:
109-
vmImage: "macos-10.15"
113+
vmImage: "macos-latest"
110114

111115
steps:
112116
- task: NodeTool@0
113117
inputs:
114-
versionSpec: "12.18.1"
118+
versionSpec: "17.5.0"
115119

116120
- script: |
117121
Platform='both' CLOUD_USER=$(user_sauce) CLOUD_KEY=$(pass_sauce) CONFIG_FILE='./configs/sauce_config.properties' mvn clean -Dtest=Runner test -Dcheckstyle.skip
@@ -120,59 +124,61 @@ jobs:
120124
121125
- job: SauceLabs_iOS
122126
pool:
123-
vmImage: "macos-10.15"
127+
vmImage: "macos-latest"
124128

125129
steps:
126130
- task: NodeTool@0
127131
inputs:
128-
versionSpec: "12.18.1"
132+
versionSpec: "17.5.0"
129133

130134
- script: |
131135
Platform='iOS' CLOUD_USER=$(user_sauce) CLOUD_KEY=$(pass_sauce) CONFIG_FILE='./configs/sauce_config.properties' mvn clean -Dtest=Runner test -Dcheckstyle.skip
132136
133137
displayName: "Run Test on Sauce on iOS and Android"
134138
135-
- job: Windows
136-
pool:
137-
vmImage: "windows-latest"
138-
139-
steps:
140-
- task: NodeTool@0
141-
inputs:
142-
versionSpec: "12.18.1"
143-
144-
- script: |
145-
node -v
146-
npm install -g appium
147-
appium -v
148-
displayName: "Install Appium"
149-
150-
- script: |
151-
mvn clean -Dtest=WindowsRunner test -Dcheckstyle.skip -DPlatform="windows"
152-
displayName: "Run windows app"
153-
154-
- job: Windows_Cucumber
155-
pool:
156-
vmImage: "windows-latest"
157-
158-
variables:
159-
- name: CONFIG_FILE
160-
value: "./configs/windowsCucumberConfig.properties"
161-
162-
steps:
163-
- task: NodeTool@0
164-
inputs:
165-
versionSpec: "12.18.1"
166-
167-
- script: |
168-
node -v
169-
npm install -g appium
170-
appium -v
171-
displayName: "Install Appium"
172-
173-
- script: |
174-
mvn clean -Dtest=WindowsRunCukes test -Dcheckstyle.skip
175-
displayName: "Run windows app - Cucumber"
139+
# - job: Windows
140+
# pool:
141+
# vmImage: "windows-latest"
142+
#
143+
# steps:
144+
# - task: NodeTool@0
145+
# inputs:
146+
# versionSpec: "17.5.0"
147+
#
148+
# - script: |
149+
# node -v
150+
# npm install -g appium@next
151+
# appium -v
152+
# appium driver install windows
153+
# displayName: "Install Appium"
154+
#
155+
# - script: |
156+
# mvn clean -Dtest=WindowsRunner test -Dcheckstyle.skip -DPlatform="windows"
157+
# displayName: "Run windows app"
158+
#
159+
# - job: Windows_Cucumber
160+
# pool:
161+
# vmImage: "windows-latest"
162+
#
163+
# variables:
164+
# - name: CONFIG_FILE
165+
# value: "./configs/windowsCucumberConfig.properties"
166+
#
167+
# steps:
168+
# - task: NodeTool@0
169+
# inputs:
170+
# versionSpec: "17.5.0"
171+
#
172+
# - script: |
173+
# node -v
174+
# npm install -g appium@next
175+
# appium -v
176+
# appium driver install windows
177+
# displayName: "Install Appium"
178+
#
179+
# - script: |
180+
# mvn clean -Dtest=WindowsRunCukes test -Dcheckstyle.skip
181+
# displayName: "Run windows app - Cucumber"
176182

177183
# - job: Genymotion
178184
# pool:

caps/browserstack.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"project": "ATD",
55
"app": {
66
"local": "https://github.com/shridharkalagi/AppiumSample/raw/master/VodQA.apk",
7-
"cloud": "bs://9fc49eb030bbf201001e71bc7b283ce2ba1db4a7"
7+
"cloud": "bs://b82b336385049a9aab8ae3f994ee01e7645282ac"
88
},
99
"noSign": true
1010
},

caps/capabilities.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"platformVersion": "7.0",
55
"automationName": "UiAutomator2",
66
"uiautomator2ServerInstallTimeout": 50000,
7-
"adbExecTimeout": 60000,
7+
"adbExecTimeout": 120000,
88
"app": {
99
"local": "https://github.com/shridharkalagi/AppiumSample/raw/master/VodQA.apk"
1010
},
@@ -25,20 +25,19 @@
2525
"simpleIsVisibleCheck": true,
2626
"wdaStartupRetries": 10,
2727
"wdaStartupRetryInterval": 100,
28-
"maxTypingFrequency": 10,
29-
"showIOSLog":true
28+
"maxTypingFrequency": 10
3029
},
3130
"hostMachines": [
3231
{
3332
"machineIP": "127.0.0.1",
3433
"simulators": [
3534
{
3635
"deviceName": "iPhone 11",
37-
"OS": "14.0"
36+
"OS": "15.2"
3837
},
3938
{
4039
"deviceName": "iPhone 8",
41-
"OS": "14.0"
40+
"OS": "15.2"
4241
}
4342
]
4443
}

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<dependency>
7070
<groupId>io.appium</groupId>
7171
<artifactId>java-client</artifactId>
72-
<version>7.4.1</version>
72+
<version>8.2.0</version>
7373
</dependency>
7474
<dependency>
7575
<groupId>com.epam.reportportal</groupId>
@@ -172,7 +172,7 @@
172172
<dependency>
173173
<groupId>org.projectlombok</groupId>
174174
<artifactId>lombok</artifactId>
175-
<version>1.18.16</version>
175+
<version>1.18.20</version>
176176
<scope>provided</scope>
177177
</dependency>
178178
<dependency>

src/main/java/com/appium/device/HostMachineDeviceManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ private void bootIOSSimulators(String ip,
155155
JSONObject hostMachineJson,
156156
List<Device> devices) {
157157
if ((platform.equalsIgnoreCase("iOS")
158+
|| platform.equalsIgnoreCase("both")
158159
&& capabilities.isSimulatorAppPresentInCapsJson()
159160
&& hostMachineJson.has("simulators"))
160161
&& !capabilities.getCapabilityObjectFromKey("iOS")

src/main/java/com/appium/manager/AppiumDriverManager.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import com.appium.entities.MobilePlatform;
55
import com.appium.utils.CommandPrompt;
66
import io.appium.java_client.AppiumDriver;
7-
import io.appium.java_client.MobileElement;
87
import io.appium.java_client.android.AndroidDriver;
98
import io.appium.java_client.ios.IOSDriver;
109
import io.appium.java_client.windows.WindowsDriver;
@@ -41,7 +40,7 @@ protected static void setDriver(AppiumDriver driver) {
4140
}
4241

4342

44-
private AppiumDriver<MobileElement> initialiseDriver(DesiredCapabilities desiredCapabilities)
43+
private AppiumDriver initialiseDriver(DesiredCapabilities desiredCapabilities)
4544
throws Exception {
4645
LOGGER.info("Initialise Driver with Capabilities: ");
4746
desiredCapabilities.getCapabilityNames().forEach(
@@ -74,7 +73,7 @@ private AppiumDriver createAppiumDriver(DesiredCapabilities desiredCapabilities,
7473
LOGGER.info("Session Created for "
7574
+ AppiumDeviceManager.getMobilePlatform().name()
7675
+ "\n\tSession Id: " + currentDriverSession.getSessionId()
77-
+ "\n\tUDID: " + currentDriverSession.getSessionDetail("udid"));
76+
+ "\n\tUDID: " + currentDriverSession.getCapabilities().getCapability("udid"));
7877
return currentDriverSession;
7978
}
8079

@@ -87,24 +86,24 @@ private String getRemoteWDHubIP() throws Exception {
8786
}
8887

8988

90-
private AppiumDriver<MobileElement> startAppiumDriverInstance(
89+
private AppiumDriver startAppiumDriverInstance(
9190
Optional<DesiredCapabilities> desiredCapabilities)
9291
throws Exception {
9392
LOGGER.info("startAppiumDriverInstance");
94-
AppiumDriver<MobileElement> currentDriverSession =
93+
AppiumDriver currentDriverSession =
9594
initialiseDriver(desiredCapabilities.get());
9695
AppiumDriverManager.setDriver(currentDriverSession);
9796
return currentDriverSession;
9897
}
9998

10099
// Should be used by Cucumber as well
101-
public AppiumDriver<MobileElement> startAppiumDriverInstance(String testMethodName)
100+
public AppiumDriver startAppiumDriverInstance(String testMethodName)
102101
throws Exception {
103102
return startAppiumDriverInstance(testMethodName, CAPS.get());
104103
}
105104

106105
// Should be used by Cucumber as well
107-
public AppiumDriver<MobileElement> startAppiumDriverInstance(String testMethodName,
106+
public AppiumDriver startAppiumDriverInstance(String testMethodName,
108107
String capabilityFilePath)
109108
throws Exception {
110109
LOGGER.info(String.format("startAppiumDriverInstance for %s using capability file: %s",
@@ -145,7 +144,7 @@ public void stopAppiumDriver() throws Exception {
145144
&& AppiumDriverManager.getDriver().getSessionId() != null) {
146145
LOGGER.info("Session Deleting ---- "
147146
+ AppiumDriverManager.getDriver().getSessionId() + "---"
148-
+ AppiumDriverManager.getDriver().getSessionDetail("udid"));
147+
+ AppiumDriverManager.getDriver().getCapabilities().getCapability("udid"));
149148
AppiumDriverManager.getDriver().quit();
150149
}
151150
}

src/main/java/com/appium/manager/AppiumParallelMethodTestListener.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ public void beforeInvocation(IInvokedMethod iInvokedMethod, ITestResult iTestRes
9999
currentMethods.set(iInvokedMethod.getTestMethod());
100100
SkipIf annotation = iInvokedMethod.getTestMethod().getConstructorOrMethod().getMethod()
101101
.getAnnotation(SkipIf.class);
102-
if (annotation != null && AppiumDriverManager.getDriver().getPlatformName()
103-
.equalsIgnoreCase(annotation.platform())) {
102+
if (annotation != null && AppiumDriverManager.getDriver().getCapabilities()
103+
.getCapability("platformName")
104+
.toString().equalsIgnoreCase(annotation.platform())) {
104105
if (atdHost.isPresent() && atdPort.isPresent()) {
105106
HashMap<String, String> logs = new HashMap<>();
106107
String url = "http://" + atdHost.get() + ":" + atdPort.get() + "/testresults";

src/main/java/com/appium/manager/AppiumParallelTestListener.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ public void beforeInvocation(IInvokedMethod iInvokedMethod, ITestResult testResu
6464
currentMethods.set(iInvokedMethod.getTestMethod());
6565
SkipIf annotation = iInvokedMethod.getTestMethod().getConstructorOrMethod().getMethod()
6666
.getAnnotation(SkipIf.class);
67-
if (annotation != null && AppiumDriverManager.getDriver().getPlatformName()
68-
.equalsIgnoreCase(annotation.platform())) {
67+
if (annotation != null && AppiumDriverManager.getDriver().getCapabilities()
68+
.getCapability("platformName")
69+
.toString().equalsIgnoreCase(annotation.platform())) {
6970
throw new SkipException("Skipped because property was set to :::"
7071
+ annotation.platform());
7172
}

src/main/java/com/appium/manager/TestLogger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected void startLogging(ITestResult iTestResult)
5454
if (isNativeAndroid()) {
5555
String udid = AppiumDeviceManager.getAppiumDevice().getDevice().getUdid();
5656
List<LogEntry> logcat = AppiumDriverManager.getDriver().manage()
57-
.logs().get("logcat").filter(Level.ALL);
57+
.logs().get("logcat").getAll();
5858
logEntries.set(logcat);
5959
logFile = new File(System.getProperty("user.dir") + FileLocations.ADB_LOGS_DIRECTORY
6060
+ udid + "__" + methodName + ".txt");

src/main/java/com/appium/utils/Api.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public String uploadMultiPartFile(File filePath, String hostMachine) throws Exce
4848
MediaType MEDIA_TYPE_PNG = MediaType.parse("multipart/form-data");
4949
RequestBody requestBody = new MultipartBody.Builder().setType(MultipartBody.FORM)
5050
.addFormDataPart("uploaded_file", filePath.getName(),
51-
RequestBody.create(MEDIA_TYPE_PNG, filePath))
51+
RequestBody.create(filePath, MEDIA_TYPE_PNG))
5252
.build();
5353
Request request = new Request.Builder().url("http://" + hostMachine
5454
+ ":" + getRemoteAppiumManagerPort(hostMachine) + "/artifacts/upload")

0 commit comments

Comments
 (0)