Skip to content

Commit 8596164

Browse files
test: update e2e tests to be compatible with nativescript-dev-appium plugin
* Update tests to be compatible with latest version of ns-dev-appium plugin * Update hooks and caps * Debug config for vs code * Fix typo. * Update capabilities * Update package.json * Update setting.json * Bump version of nativescript-dev-appium to next * chore: Update travis.yaml * Include appium capabilites for e2e command * Echo folder where the tests are executing. * List files * List all folders in e2e * Include images for android19 * Update tsconfigs for all e2e tests to use es6. Workarounded nativescript-dev-appium instalation for travis. * Update travis * chore: Update travis.yaml * update: include new android config for travis * update: android build tools for travis * fix: emulator name in .travis.yml * update: bump android build tools version * chore: list all folders in ANDROID_HOME * chore: list tools/bin folder * chore: list all emulators * chore: require new sdktools * chore: exclude e2e tests
1 parent b874a53 commit 8596164

29 files changed

+273
-318
lines changed

.travis.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,24 @@ env:
22
global:
33
- NODE_VERSION=6.11.1
44
- EMULATOR_API_LEVEL=19
5-
- ANDROID_VERSION=23
6-
- ANDROID_BUILD_TOOLS_VERSION=23.0.1
5+
- ANDROID_VERSION=25
6+
- ANDROID_BUILD_TOOLS_VERSION=25.0.2
77
- ANDROID_ABI=armeabi-v7a
8-
- ANDROID_TAG=google_apis
9-
- APPIUM_VERSION=1.6.5
8+
- APPIUM_VERSION=1.7.0
9+
- EMULATOR_NAME=test
1010
language: android
1111
jdk:
1212
- oraclejdk8
1313
android:
1414
components:
15-
- platform-tools
1615
- tools
16+
- platform-tools
1717
- build-tools-$ANDROID_BUILD_TOOLS_VERSION
1818
- android-$ANDROID_VERSION
1919
- android-$EMULATOR_API_LEVEL
20+
- extra-android-support
2021
- extra-android-m2repository
21-
- sys-img-armeabi-v7a-android-$EMULATOR_API_LEVEL
22+
- sys-img-$ANDROID_ABI-android-$EMULATOR_API_LEVEL
2223
before_cache:
2324
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
2425
cache:
@@ -28,6 +29,7 @@ cache:
2829
install:
2930
- nvm install $NODE_VERSION
3031
- npm install -g typings
32+
- echo y | $ANDROID_HOME/tools/android update sdk --filter tools --all --no-ui
3133
- wget -O ./nativescript.tgz "https://s3.amazonaws.com/nativescript-ci/build_result/nativescript.tgz"
3234
- npm install -g nativescript.tgz --ignore-scripts
3335
- tns usage-reporting disable
@@ -37,12 +39,10 @@ install:
3739
- npm run tslint
3840
- cd ../tests
3941
- npm install
40-
- npm i appium@$APPIUM_VERSION
4142
before_script:
42-
- echo no | android create avd --force -n test -t android-$EMULATOR_API_LEVEL --abi $ANDROID_ABI
43-
- emulator -memory 1024 -avd test -no-audio -no-window &
43+
- echo no | android create avd --force -n $EMULATOR_NAME -t android-$EMULATOR_API_LEVEL --abi $ANDROID_ABI -c 12M
44+
- emulator -avd $EMULATOR_NAME -no-skin -no-audio -no-window &
4445
- android-wait-for-emulator
4546
script:
4647
- tns build android
4748
- android-wait-for-emulator
48-
- npm run appium --runtype=android19 --appium=$APPIUM_VERSION

e2e/renderer/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ hooks
55
app/**/*.js
66
e2e/**/*.js
77
test-results.xml
8+
e2e/reports
89

e2e/renderer/.vscode/launch.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "launch",
7+
"name": "Mocha Tests",
8+
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
9+
"args": [
10+
"-u",
11+
"tdd",
12+
"--timeout",
13+
"999999",
14+
"--colors",
15+
"--reuseDevice",
16+
"--runType",
17+
"sim.iPhone7.iOS110",
18+
"${workspaceRoot}/e2e"
19+
],
20+
"internalConsoleOptions": "openOnSessionStart"
21+
}
22+
]
23+
}

e2e/renderer/.vscode/settings.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"typescript.check.tscVersion": false,
3+
"window.zoomLevel": 0,
4+
"workbench.iconTheme": "vscode-icons",
5+
"vsicons.dontShowNewVersionMessage": true,
6+
"workbench.colorTheme": "Default Light+",
7+
"files.exclude": {
8+
"**/.git": true,
9+
"**/.svn": true,
10+
"**/.hg": true,
11+
"**/CVS": true,
12+
"**/.DS_Store": true,
13+
"**/*.js": true,
14+
"**/*.map": true,
15+
"node_modules": true,
16+
"hooks": true,
17+
"platforms": true
18+
}
19+
}

e2e/renderer/e2e/action-bar.e2e-spec.ts

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,40 @@ import {
22
AppiumDriver,
33
createDriver,
44
SearchOptions,
5-
elementHelper,
5+
UIElement
66
} from "nativescript-dev-appium";
77

88
import { isOnTheLeft } from "./helpers/location";
9-
import { DriverWrapper, ExtendedUIElement } from "./helpers/appium-elements";
109

1110
describe("Action Bar scenario", () => {
1211
let driver: AppiumDriver;
13-
let driverWrapper: DriverWrapper;
1412

1513
describe("dynamically add/remove ActionItems", async () => {
16-
let firstActionItem: ExtendedUIElement;
17-
let secondActionItem: ExtendedUIElement;
18-
let toggleFirstButton: ExtendedUIElement;
19-
let toggleSecondButton: ExtendedUIElement;
14+
let firstActionItem: UIElement;
15+
let secondActionItem: UIElement;
16+
let toggleFirstButton: UIElement;
17+
let toggleSecondButton: UIElement;
2018

2119
before(async () => {
2220
driver = await createDriver();
23-
driverWrapper = new DriverWrapper(driver);
24-
});
25-
26-
after(async () => {
27-
await driver.quit();
28-
console.log("Driver quits!");
21+
await driver.driver.resetApp();
2922
});
3023

3124
it("should navigate to page", async () => {
3225
const navigationButton =
33-
await driverWrapper.findElementByText("ActionBar dynamic", SearchOptions.exact);
26+
await driver.findElementByText("ActionBar dynamic", SearchOptions.exact);
3427
await navigationButton.click();
3528

3629
const actionBar =
37-
await driverWrapper.findElementByText("Action Bar Dynamic Items", SearchOptions.exact);
30+
await driver.findElementByText("Action Bar Dynamic Items", SearchOptions.exact);
3831
});
3932

4033
it("should find elements", async () => {
41-
firstActionItem = await driverWrapper.findElementByText("one");
42-
secondActionItem = await driverWrapper.findElementByText("two");
34+
firstActionItem = await driver.findElementByText("one");
35+
secondActionItem = await driver.findElementByText("two");
4336

44-
toggleFirstButton = await driverWrapper.findElementByText("toggle 1");
45-
toggleSecondButton = await driverWrapper.findElementByText("toggle 2");
37+
toggleFirstButton = await driver.findElementByText("toggle 1");
38+
toggleSecondButton = await driver.findElementByText("toggle 2");
4639
});
4740

4841
it("should initially render the action items in the correct order", async () => {
@@ -54,7 +47,7 @@ describe("Action Bar scenario", () => {
5447
await toggleFirst();
5548

5649
try {
57-
await driverWrapper.findElementByText("one", SearchOptions.exact);
50+
await driver.findElementByText("one", SearchOptions.exact);
5851
} catch (e) {
5952
done();
6053
}
@@ -71,7 +64,7 @@ describe("Action Bar scenario", () => {
7164
await toggleSecond();
7265

7366
try {
74-
await driverWrapper.findElementByText("two", SearchOptions.exact);
67+
await driver.findElementByText("two", SearchOptions.exact);
7568
} catch (e) {
7669
done();
7770
}
@@ -98,48 +91,41 @@ describe("Action Bar scenario", () => {
9891
};
9992

10093
const toggleFirst = async () => {
101-
toggleFirstButton = await toggleFirstButton.refetch();
10294
await toggleFirstButton.click();
10395
};
10496

10597
const toggleSecond = async () => {
106-
toggleSecondButton = await toggleSecondButton.refetch();
10798
await toggleSecondButton.click();
10899
};
109100

110101
});
111102

112103
describe("Action Bar extension with dynamic ActionItem", async () => {
113-
let toggleButton: ExtendedUIElement;
114-
let conditional: ExtendedUIElement;
104+
let toggleButton: UIElement;
105+
let conditional: UIElement;
115106

116107
before(async () => {
117108
driver = await createDriver();
118-
driverWrapper = new DriverWrapper(driver);
119-
});
120-
121-
after(async () => {
122-
await driver.quit();
123-
console.log("Driver quits!");
109+
await driver.driver.resetApp();
124110
});
125111

126112
it("should navigate to page", async () => {
127113
const navigationButton =
128-
await driverWrapper.findElementByText("ActionBarExtension", SearchOptions.exact);
114+
await driver.findElementByText("ActionBarExtension", SearchOptions.exact);
129115
await navigationButton.click();
130116
});
131117

132118
it("should find elements", async () => {
133-
toggleButton = await driverWrapper.findElementByText("toggle");
134-
conditional = await driverWrapper.findElementByText("conditional");
119+
toggleButton = await driver.findElementByText("toggle");
120+
conditional = await driver.findElementByText("conditional");
135121
});
136122

137123
it("should detach conditional action item when its condition is false", done => {
138124
(async () => {
139125
await toggle();
140126

141127
try {
142-
await driverWrapper.findElementByText("conditional", SearchOptions.exact);
128+
await driver.findElementByText("conditional", SearchOptions.exact);
143129
} catch (e) {
144130
done();
145131
}
@@ -156,7 +142,6 @@ describe("Action Bar scenario", () => {
156142
};
157143

158144
const toggle = async () => {
159-
toggleButton = await toggleButton.refetch();
160145
await toggleButton.click();
161146
};
162147
});
Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,100 @@
11
{
22
"nexus5": {
33
"browserName": "",
4-
"appium-version": "1.6.5",
54
"platformName": "Android",
65
"platformVersion": "6.0",
76
"deviceName": "device",
87
"udid": "077e4a47003b7698",
9-
"-lt": 60000,
10-
"automationName": "Appium",
118
"appActivity": "com.tns.NativeScriptActivity",
129
"app": ""
1310
},
1411
"android19": {
15-
"browserName": "",
16-
"appium-version": "1.6.5",
1712
"platformName": "Android",
1813
"platformVersion": "4.4",
1914
"deviceName": "Emulator-Api19-Default",
2015
"avd": "Emulator-Api19-Default",
21-
"-lt": 60000,
22-
"automationName": "Appium",
16+
"lt": 60000,
2317
"appActivity": "com.tns.NativeScriptActivity",
2418
"newCommandTimeout": 720,
2519
"noReset": false,
26-
"fullReset": true,
20+
"fullReset": false,
2721
"app": ""
2822
},
2923
"android21": {
30-
"browserName": "",
31-
"appium-version": "1.6.5",
3224
"platformName": "Android",
3325
"platformVersion": "5.0",
3426
"deviceName": "Emulator-Api21-Default",
3527
"avd": "Emulator-Api21-Default",
36-
"-lt": 60000,
37-
"automationName": "Appium",
28+
"lt": 60000,
3829
"appActivity": "com.tns.NativeScriptActivity",
3930
"newCommandTimeout": 720,
4031
"noReset": false,
41-
"fullReset": true,
32+
"fullReset": false,
4233
"app": ""
4334
},
4435
"android23": {
45-
"browserName": "",
46-
"appium-version": "1.6.5",
4736
"platformName": "Android",
4837
"platformVersion": "6.0",
4938
"deviceName": "Emulator-Api23-Default",
5039
"avd": "Emulator-Api23-Default",
51-
"-lt": 60000,
52-
"automationName": "Appium",
40+
"lt": 60000,
5341
"appActivity": "com.tns.NativeScriptActivity",
5442
"newCommandTimeout": 720,
5543
"noReset": false,
56-
"fullReset": true,
44+
"fullReset": false,
5745
"app": ""
5846
},
5947
"android24": {
60-
"browserName": "",
61-
"appium-version": "1.6.5",
6248
"platformName": "Android",
6349
"platformVersion": "7.0",
6450
"deviceName": "Emulator-Api24-Default",
6551
"avd": "Emulator-Api24-Default",
66-
"-lt": 60000,
52+
"lt": 60000,
53+
"appActivity": "com.tns.NativeScriptActivity",
54+
"newCommandTimeout": 720,
55+
"noReset": false,
56+
"fullReset": false,
57+
"app": ""
58+
},
59+
"android25": {
60+
"platformName": "Android",
61+
"platformVersion": "7.1",
62+
"deviceName": "Emulator-Api25-Google",
63+
"avd": "Emulator-Api25-Google",
64+
"lt": 60000,
65+
"appActivity": "com.tns.NativeScriptActivity",
66+
"newCommandTimeout": 720,
67+
"noReset": false,
68+
"fullReset": false,
69+
"app": ""
70+
},
71+
"android26": {
72+
"platformName": "Android",
73+
"platformVersion": "8.0",
74+
"deviceName": "Emulator-Api26-Google",
75+
"avd": "Emulator-Api26-Google",
76+
"lt": 60000,
6777
"automationName": "UIAutomator2",
6878
"appActivity": "com.tns.NativeScriptActivity",
6979
"newCommandTimeout": 720,
7080
"noReset": false,
71-
"fullReset": true,
81+
"fullReset": false,
7282
"app": ""
7383
},
7484
"sim.iPhone7.iOS100": {
75-
"browserName": "",
76-
"appium-version": "1.6.5",
7785
"platformName": "iOS",
7886
"platformVersion": "10.0",
7987
"deviceName": "iPhone 7 100",
80-
"noReset": true,
88+
"noReset": false,
89+
"fullReset": false,
90+
"app": ""
91+
},
92+
"sim.iPhone7.iOS110": {
93+
"platformName": "iOS",
94+
"platformVersion": "11.0",
95+
"deviceName": "iPhone 7 110",
96+
"noReset": false,
8197
"fullReset": false,
8298
"app": ""
8399
}
84-
}
100+
}

e2e/renderer/e2e/config/mocha.opts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
--timeout 80000
1+
--timeout 140000
22
--recursive e2e
33
--reporter mocha-multi
44
--reporter-options spec=-,mocha-junit-reporter=test-results.xml

0 commit comments

Comments
 (0)