Skip to content

Commit 66a498e

Browse files
author
Zdravko
authored
Merge pull request #296 from NativeScript/zbranzov/add-ui-tests
Add ui tests
2 parents db18ec5 + 4c81863 commit 66a498e

File tree

13 files changed

+2074
-33
lines changed

13 files changed

+2074
-33
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ npm-debug.log
33

44
*.js.map
55
app/**/*.js
6+
e2e/**/*.js
7+
e2e/reports/
68
hooks/
79
lib/
810
node_modules/
911
platforms/
1012
tmp/
1113
typings/
12-
report/
14+
report/
15+
test-results.xml

.travis.yml

+65-22
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,74 @@
11
env:
2-
global:
3-
- NODE_VERSION=6.9.4
2+
global:
3+
- ANDROID_PACKAGE='groceries-debug.apk'
4+
- ANDROID_PACKAGE_FOLDER=$TRAVIS_BUILD_DIR/platforms/android/app/build/outputs/apk
5+
- ANDROID_SAUCE_STORAGE="https://saucelabs.com/rest/v1/storage/$SAUCE_USER/$ANDROID_PACKAGE?overwrite=true"
6+
- IOS_PACKAGE='sampleGroceries.zip'
7+
- IOS_APP_NAME='sampleGroceries.app'
8+
- IOS_PACKAGE_FOLDER=$TRAVIS_BUILD_DIR/platforms/ios/build/emulator
9+
- IOS_SAUCE_STORAGE="https://saucelabs.com/rest/v1/storage/$SAUCE_USER/$IOS_PACKAGE?overwrite=true"
410

5-
language: android
6-
7-
jdk: oraclejdk8
11+
branches:
12+
only:
13+
- master
14+
matrix:
15+
include:
16+
- stage: "Lint"
17+
language: node_js
18+
os: linux
19+
node_js: "6"
20+
install: true
21+
script: npm i && npm run tslint
22+
- stage: "Build"
23+
os: osx
24+
env:
25+
- BuildiOS="11"
26+
- Xcode="9.2"
27+
osx_image: xcode9.2
28+
language: node_js
29+
node_js: "6"
30+
jdk: oraclejdk8
31+
script:
32+
- tns build ios
33+
- cd $IOS_PACKAGE_FOLDER && zip -r $IOS_PACKAGE $IOS_APP_NAME
34+
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $IOS_SAUCE_STORAGE --data-binary @$IOS_PACKAGE_FOLDER/$IOS_PACKAGE"
35+
- language: android
36+
env:
37+
- BuildAndroid="26"
38+
os: linux
39+
jdk: oraclejdk8
40+
before_install: nvm install 6.10.3
41+
script:
42+
- tns build android
43+
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $ANDROID_SAUCE_STORAGE --data-binary @$ANDROID_PACKAGE_FOLDER/$ANDROID_PACKAGE"
44+
- stage: "UI Tests"
45+
env:
46+
- AndroidEmulator="23"
47+
language: node_js
48+
os: linux
49+
node_js: "6"
50+
script:
51+
- npm i -g appium
52+
- npm i
53+
- travis_retry npm run e2e -- --runType android23 --sauceLab --reuseDevice --appPath $ANDROID_PACKAGE
54+
- os: linux
55+
env:
56+
- iOS="11"
57+
language: node_js
58+
node_js: "6"
59+
script:
60+
- npm i -g appium
61+
- npm i
62+
- travis_wait travis_retry npm run e2e -- --runType sim.iPhone6.iOS100 --sauceLab --reuseDevice --appPath $IOS_PACKAGE
863

964
android:
1065
components:
66+
- tools
1167
- platform-tools
12-
- build-tools-23.0.1
68+
- build-tools-26.0.1
69+
- android-26
1370
- android-23
1471
- extra-android-m2repository
15-
- sys-img-armeabi-v7a-android-19
1672

1773
before_cache:
1874
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
@@ -24,19 +80,6 @@ cache:
2480
- $HOME/.gradle/wrapper/
2581

2682
install:
27-
- nvm install $NODE_VERSION
28-
- wget -O ./nativescript.tgz "https://s3.amazonaws.com/nativescript-ci/build_result/nativescript.tgz"
29-
- npm install -g nativescript.tgz --ignore-scripts
83+
- echo no | npm install -g nativescript
3084
- tns usage-reporting disable
31-
- tns error-reporting disable
32-
- npm install
33-
34-
# before_script:
35-
# - echo no | android create avd --force -n test -t android-19 -b armeabi-v7a
36-
# - emulator -avd test -no-audio -no-window &
37-
# - android-wait-for-emulator
38-
39-
script:
40-
- npm run tslint
41-
- tns build android
42-
# - tns test android --emulator --justlaunch
85+
- tns error-reporting disable

app/groceries/grocery-list/item-status.pipe.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Grocery } from "../shared";
88
export class ItemStatusPipe implements PipeTransform {
99
value: Array<Grocery> = [];
1010
transform(items: Array<Grocery>, deleted: boolean) {
11-
if (items && items.length) {
11+
if (items instanceof Array) {
1212
this.value = items.filter((grocery: Grocery) => {
1313
return grocery.deleted === deleted;
1414
});

e2e/config/appium.capabilities.json

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{
2+
"android19": {
3+
"platformName": "Android",
4+
"platformVersion": "4.4",
5+
"deviceName": "Emulator-Api19-Default",
6+
"avd": "Emulator-Api19-Default",
7+
"lt": 60000,
8+
"appActivity": "com.tns.NativeScriptActivity",
9+
"newCommandTimeout": 720,
10+
"noReset": true,
11+
"fullReset": false,
12+
"app": ""
13+
},
14+
"android21": {
15+
"platformName": "Android",
16+
"platformVersion": "5.0",
17+
"deviceName": "Emulator-Api21-Default",
18+
"avd": "Emulator-Api21-Default",
19+
"lt": 60000,
20+
"appActivity": "com.tns.NativeScriptActivity",
21+
"newCommandTimeout": 720,
22+
"noReset": true,
23+
"fullReset": false,
24+
"app": ""
25+
},
26+
"android23": {
27+
"platformName": "Android",
28+
"platformVersion": "6.0",
29+
"deviceName": "Android Emulator",
30+
"appium-version": "1.7.1",
31+
"noReset": true,
32+
"resetKeyboard": true,
33+
"app": ""
34+
},
35+
"android24": {
36+
"platformName": "Android",
37+
"platformVersion": "7.0",
38+
"deviceName": "Emulator-Api24-Default",
39+
"avd": "Emulator-Api24-Default",
40+
"lt": 60000,
41+
"appActivity": "com.tns.NativeScriptActivity",
42+
"newCommandTimeout": 720,
43+
"noReset": true,
44+
"fullReset": false,
45+
"app": ""
46+
},
47+
"android25": {
48+
"platformName": "Android",
49+
"platformVersion": "7.1",
50+
"deviceName": "Emulator-Api25-Google",
51+
"avd": "Emulator-Api25-Google",
52+
"lt": 60000,
53+
"appActivity": "com.tns.NativeScriptActivity",
54+
"newCommandTimeout": 720,
55+
"noReset": true,
56+
"fullReset": false,
57+
"app": ""
58+
},
59+
"android26": {
60+
"platformName": "Android",
61+
"platformVersion": "8.0",
62+
"deviceName": "Emulator-Api26-Google",
63+
"avd": "Emulator-Api26-Google",
64+
"lt": 60000,
65+
"appActivity": "com.tns.NativeScriptActivity",
66+
"newCommandTimeout": 720,
67+
"noReset": true,
68+
"fullReset": false,
69+
"app": ""
70+
},
71+
"sim.iPhone6.iOS100": {
72+
"platformName": "iOS",
73+
"platformVersion": "10.0",
74+
"deviceName": "iPhone 6",
75+
"noReset": true,
76+
"fullReset": false,
77+
"app": "",
78+
"density": 2,
79+
"offsetPixels": 33
80+
},
81+
"sim.iPhone8.iOS110": {
82+
"platformName": "iOS",
83+
"platformVersion": "11.0",
84+
"deviceName": "iPhone 8 110",
85+
"noReset": true,
86+
"fullReset": false,
87+
"app": ""
88+
},
89+
"sim.iPhoneX.iOS110": {
90+
"platformName": "iOS",
91+
"platformVersion": "11.0",
92+
"deviceName": "iPhone X",
93+
"noReset": true,
94+
"fullReset": false,
95+
"app": ""
96+
},
97+
"android23.local": {
98+
"platformName": "Android",
99+
"platformVersion": "6.0",
100+
"deviceName": "Emulator-Api23-Default",
101+
"noReset": true,
102+
"appium-version": "1.7.1"
103+
}
104+
}

e2e/config/mocha.opts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--timeout 1000000
2+
--recursive e2e
3+
--reporter mocha-multi
4+
--reporter-options spec=-,mocha-junit-reporter=test-results.xml

0 commit comments

Comments
 (0)