Skip to content

Commit 032229f

Browse files
fix: provide mandatory automation name for Android (#242)
* release: cut the 6.0.0 release * fix: provide support for 'UiAutomator1' and set mandatory automation name * set default ios automation name XCUITest
1 parent e0cd6e5 commit 032229f

File tree

5 files changed

+41
-5
lines changed

5 files changed

+41
-5
lines changed

Diff for: CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
<a name="6.0.0"></a>
2+
# [6.0.0](https://github.com/NativeScript/nativescript-dev-appium/compare/5.3.0...6.0.0) (2019-08-08)
3+
4+
5+
### Bug Fixes
6+
7+
* typos ([65c6aa3](https://github.com/NativeScript/nativescript-dev-appium/commit/65c6aa3))
8+
* **image-helper:** increase image name ([#237](https://github.com/NativeScript/nativescript-dev-appium/issues/237)) ([c075af8](https://github.com/NativeScript/nativescript-dev-appium/commit/c075af8))
9+
10+
11+
### Features
12+
13+
* image-helper ([#236](https://github.com/NativeScript/nativescript-dev-appium/issues/236)) ([0d2c9fd](https://github.com/NativeScript/nativescript-dev-appium/commit/0d2c9fd))
14+
* resolve symlinked storages ([#235](https://github.com/NativeScript/nativescript-dev-appium/issues/235)) ([ef270c9](https://github.com/NativeScript/nativescript-dev-appium/commit/ef270c9))
15+
16+
17+
118
<a name="5.3.0"></a>
219
# [5.3.0](https://github.com/NativeScript/nativescript-dev-appium/compare/v5.2.0...v5.3.0) (2019-06-10)
320

Diff for: lib/automation-name.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export declare enum AutomationName {
22
UiAutomator2 = "UIAutomator2",
3+
UiAutomator1 = "UIAutomator1",
34
Appium = "Appium",
45
XCUITest = "XCUITest"
56
}

Diff for: lib/automation-name.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export enum AutomationName {
22
UiAutomator2 = "UIAutomator2",
3+
UiAutomator1 = "UIAutomator1",
34
Appium = "Appium",
45
XCUITest = "XCUITest",
56
}

Diff for: lib/ns-capabilities.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export declare class NsCapabilities implements INsCapabilities {
7777
shouldSetFullResetOption(): void;
7878
private setAutomationName;
7979
tryGetAndroidApiLevel(): number;
80+
tryGetIOSApiLevel(): number;
8081
private resolveApplication;
8182
private checkMandatoryCapabilities;
8283
private throwExceptions;

Diff for: lib/ns-capabilities.ts

+21-5
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,25 @@ export class NsCapabilities implements INsCapabilities {
309309
this.automationName = AutomationName.Appium; break;
310310
case AutomationName.XCUITest.toString().toLowerCase():
311311
this.automationName = AutomationName.XCUITest; break;
312+
case AutomationName.UiAutomator1.toString().toLowerCase():
313+
this.automationName = AutomationName.UiAutomator1; break;
312314
}
313315
} else {
316+
const apiLevel = this.tryGetApiLevel();
314317
if (this.isAndroid) {
315-
if (this.tryGetAndroidApiLevel() >= 6 || (this.appiumCaps["apiLevel"] && +this.appiumCaps["apiLevel"]) >= 23) {
318+
if ((apiLevel >= 6 && apiLevel <= 17)
319+
|| apiLevel >= 23) {
316320
this.automationName = AutomationName.UiAutomator2;
321+
} else {
322+
this.automationName = AutomationName.UiAutomator1;
323+
}
324+
}
325+
326+
if (this.isIOS) {
327+
if (apiLevel < 10) {
328+
logWarn("Provide automationName")
329+
} else {
330+
this.automationName = AutomationName.XCUITest;
317331
}
318332
}
319333
}
@@ -327,13 +341,15 @@ export class NsCapabilities implements INsCapabilities {
327341
}
328342
}
329343

330-
tryGetAndroidApiLevel() {
344+
tryGetApiLevel() {
331345
try {
332-
if (this.appiumCaps["platformVersion"]) {
333-
const apiLevel = this.appiumCaps["platformVersion"].split(".").splice(0, 2).join('.');
334-
return +apiLevel;
346+
const apiLevel = this.appiumCaps["platformVersion"] || this.appiumCaps["apiLevel"];
347+
if (this.isAndroid && apiLevel) {
348+
return apiLevel.split(".").splice(0, 2).join('.');
335349
}
350+
return apiLevel;
336351
} catch (error) { }
352+
337353
return undefined;
338354
}
339355

0 commit comments

Comments
 (0)