Skip to content

Commit 1bc5e33

Browse files
Merge pull request #150 from NativeScript/dtodorov/add-vuejs-in-travis-ci
Add vuejs builds and UI tests in travis.ci
2 parents 04df826 + fa114d0 commit 1bc5e33

File tree

4 files changed

+153
-36
lines changed

4 files changed

+153
-36
lines changed

.travis.yml

Lines changed: 120 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ branches:
33
- master
44
env:
55
global:
6-
- ANDROID_PACKAGE='facebook-debug.apk'
7-
- ANDROID_PACKAGE_FOLDER=$TRAVIS_BUILD_DIR/demo/platforms/android/app/build/outputs/apk/debug
8-
- ANDROID_SAUCE_STORAGE="https://saucelabs.com/rest/v1/storage/$SAUCE_USER/$ANDROID_PACKAGE?overwrite=true"
9-
- IOS_PACKAGE='demo.zip'
10-
- IOS_PACKAGE_FOLDER=$TRAVIS_BUILD_DIR/demo/platforms/ios/build/emulator
11-
- IOS_SAUCE_STORAGE="https://saucelabs.com/rest/v1/storage/$SAUCE_USER/$IOS_PACKAGE?overwrite=true"
6+
- ANDROID_PACKAGE_JS='facebook-debug-js.apk'
7+
- ANDROID_PACKAGE_VUE='facebook-debug-vue.apk'
8+
- ANDROID_PACKAGE_FOLDER_JS=$TRAVIS_BUILD_DIR/demo/platforms/android/app/build/outputs/apk/debug
9+
- ANDROID_PACKAGE_FOLDER_VUE=$TRAVIS_BUILD_DIR/demo-vue/platforms/android/app/build/outputs/apk/debug
10+
- ANDROID_SAUCE_STORAGE="https://saucelabs.com/rest/v1/storage/$SAUCE_USER"
11+
- IOS_PACKAGE_JS='facebook-demo-js.zip'
12+
- IOS_PACKAGE_VUE='facebook-demo-vue.zip'
13+
- IOS_PACKAGE_FOLDER_JS=$TRAVIS_BUILD_DIR/demo/platforms/ios/build/emulator
14+
- IOS_PACKAGE_FOLDER_VUE=$TRAVIS_BUILD_DIR/demo-vue/platforms/ios/build/emulator
15+
- IOS_SAUCE_STORAGE="https://saucelabs.com/rest/v1/storage/$SAUCE_USER"
1216

1317
matrix:
1418
include:
@@ -21,62 +25,162 @@ matrix:
2125
os: osx
2226
env:
2327
- WebpackiOS="12.0"
28+
- Type="VanillaJS"
2429
osx_image: xcode10.0
2530
language: node_js
2631
node_js: "8"
2732
jdk: oraclejdk8
2833
before_script: pod repo update
29-
script: cd src && npm run build.iosOnly && cd ../demo && npm i && tns build ios --env.uglify && cd ../demo-angular && npm i && tns build ios --env.uglify --env.aot
34+
script:
35+
- cd src && npm run build.iosOnly
36+
- cd ../demo && npm i && tns build ios --bundle --env.uglify
37+
- os: osx
38+
env:
39+
- WebpackiOS="12.0"
40+
- Type="VueJS"
41+
osx_image: xcode10.0
42+
language: node_js
43+
node_js: "8"
44+
jdk: oraclejdk8
45+
before_script: pod repo update
46+
script:
47+
- cd src && npm run build.iosOnly
48+
- cd ../demo-vue && npm i && tns build ios --bundle --env.uglify
49+
- cd $IOS_PACKAGE_FOLDER_VUE && zip -r $IOS_PACKAGE_VUE demovue.app
50+
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $IOS_SAUCE_STORAGE/$IOS_PACKAGE_VUE?overwrite=true --data-binary @$IOS_PACKAGE_FOLDER_VUE/$IOS_PACKAGE_VUE"
51+
- os: osx
52+
env:
53+
- WebpackiOS="12.0"
54+
- Type="Angular"
55+
osx_image: xcode10.0
56+
language: node_js
57+
node_js: "8"
58+
jdk: oraclejdk8
59+
before_script: pod repo update
60+
script:
61+
- cd src && npm run build.iosOnly && npm pack
62+
- cd ../demo-angular && tns plugin add ../src/*.tgz
63+
- npm i && tns build ios --bundle --env.uglify --env.aot
64+
- language: android
65+
os: linux
66+
env:
67+
- WebpackAndroid="28"
68+
- Type="VanillaJS"
69+
jdk: oraclejdk8
70+
before_install: nvm install 8
71+
script:
72+
- cd src && npm run build
73+
- cd ../demo && npm i && tns build android --bundle --env.uglify --env.snapshot
74+
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $ANDROID_SAUCE_STORAGE/$ANDROID_PACKAGE_JS?overwrite=true --data-binary @$ANDROID_PACKAGE_FOLDER_JS/app-debug.apk"
75+
- language: android
76+
os: linux
77+
env:
78+
- WebpackAndroid="28"
79+
- Type="VueJS"
80+
jdk: oraclejdk8
81+
before_install: nvm install 8
82+
script:
83+
- cd src && npm run build
84+
- cd ../demo-vue && npm i && tns build android --bundle --env.uglify
85+
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $ANDROID_SAUCE_STORAGE/$ANDROID_PACKAGE_VUE?overwrite=true --data-binary @$ANDROID_PACKAGE_FOLDER_VUE/app-debug.apk"
3086
- language: android
3187
os: linux
3288
env:
3389
- WebpackAndroid="28"
90+
- Type="Angular"
3491
jdk: oraclejdk8
3592
before_install: nvm install 8
3693
script:
37-
- cd src && npm run build && cd ../demo && npm i && tns build android --env.uglify --env.snapshot
38-
- cd ../demo-angular && npm i && tns build android --env.uglify --env.snapshot --env.aot
94+
- cd src && npm run build
95+
- cd ../publish && sh pack.sh
96+
- cd ../demo-angular && tns plugin add ../publish/package/*.tgz
97+
- npm i && tns build android --bundle --env.uglify --env.snapshot --env.aot
3998
- language: android
4099
env:
41100
- BuildAndroid="28"
101+
- Type="VanillaJS"
42102
os: linux
43103
jdk: oraclejdk8
44104
before_install: nvm install 8.11.4
45105
script:
46-
- cd demo && npm run ci.android.build && cd ../demo-angular && npm run ci.android.build
47-
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $ANDROID_SAUCE_STORAGE --data-binary @$ANDROID_PACKAGE_FOLDER/app-debug.apk"
106+
- cd demo && npm run ci.android.build
107+
- language: android
108+
env:
109+
- BuildAndroid="28"
110+
- Type="Angular"
111+
os: linux
112+
jdk: oraclejdk8
113+
before_install: nvm install 8.11.4
114+
script:
115+
- cd demo-angular && npm run ci.android.build
116+
- os: osx
117+
env:
118+
- BuildiOS="12.0"
119+
- Xcode="10.0"
120+
- Type="VanillaJS"
121+
osx_image: xcode10.0
122+
language: node_js
123+
node_js: "8"
124+
jdk: oraclejdk8
125+
before_script: pod repo update
126+
script:
127+
- cd demo && npm run ci.ios.build
128+
- cd $IOS_PACKAGE_FOLDER_JS && zip -r $IOS_PACKAGE_JS demo.app
129+
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $IOS_SAUCE_STORAGE/$IOS_PACKAGE_JS?overwrite=true --data-binary @$IOS_PACKAGE_FOLDER_JS/$IOS_PACKAGE_JS"
48130
- os: osx
49131
env:
50132
- BuildiOS="12.0"
51133
- Xcode="10.0"
134+
- Type="Angular"
52135
osx_image: xcode10.0
53136
language: node_js
54137
node_js: "8"
55138
jdk: oraclejdk8
56139
before_script: pod repo update
57140
script:
58-
- cd demo && npm run ci.ios.build && cd ../demo-angular && npm run ci.ios.build
59-
- cd $IOS_PACKAGE_FOLDER && zip -r $IOS_PACKAGE demo.app
60-
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $IOS_SAUCE_STORAGE --data-binary @$IOS_PACKAGE_FOLDER/$IOS_PACKAGE"
141+
- cd demo-angular && npm run ci.ios.build
61142
- stage: "UI Tests"
62143
env:
63144
- Android="24"
145+
- Type="VanillaJS"
64146
language: node_js
65147
os: linux
66148
node_js: "8"
67149
script:
68150
- npm i -g appium
69151
- cd demo && npm i
70-
- travis_retry npm run e2e -- --runType android24 --sauceLab --reuseDevice --appPath $ANDROID_PACKAGE
152+
- travis_wait travis_retry npm run e2e -- --runType android24 --sauceLab --appPath $ANDROID_PACKAGE_JS
153+
- os: linux
154+
env:
155+
- Android="24"
156+
- Type="VueJS"
157+
language: node_js
158+
os: linux
159+
node_js: "8"
160+
script:
161+
- npm i -g appium
162+
- cd demo-vue && npm i
163+
- travis_wait travis_retry npm run e2e -- --runType android24 --sauceLab --appPath $ANDROID_PACKAGE_VUE
71164
- os: linux
72165
env:
73166
- iOS="12.0"
167+
- Type="VanillaJS"
74168
language: node_js
75169
node_js: "8"
76170
script:
77171
- npm i -g appium
78172
- cd demo && npm i
79-
- travis_wait travis_retry npm run e2e -- --runType sim12iPhoneX --sauceLab --reuseDevice --appPath $IOS_PACKAGE
173+
- travis_wait travis_retry npm run e2e -- --runType sim12iPhoneX --sauceLab --appPath $IOS_PACKAGE_JS
174+
- os: linux
175+
env:
176+
- iOS="12.0"
177+
- Type="VueJS"
178+
language: node_js
179+
node_js: "8"
180+
script:
181+
- npm i -g appium
182+
- cd demo-vue && npm i
183+
- travis_wait travis_retry npm run e2e -- --runType sim12iPhoneX --sauceLab --appPath $IOS_PACKAGE_VUE
80184

81185
android:
82186
components:

demo-vue/e2e/config/appium.capabilities.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@
1616
"android24": {
1717
"platformName": "Android",
1818
"platformVersion": "7.0",
19-
"deviceName": "Android_GoogleAPI_Emulator",
19+
"deviceName": "Android GoogleAPI Emulator",
2020
"appiumVersion": "1.9.1",
21-
"noReset": true
21+
"noReset": true,
22+
"lt": 60000,
23+
"newCommandTimeout": 720,
24+
"appium-version": "1.9.1",
25+
"fullReset": false,
26+
"idleTimeout": 120,
27+
"automationName": "Appium"
2228
},
2329
"android25": {
2430
"platformName": "Android",
@@ -36,10 +42,16 @@
3642
},
3743
"sim12iPhoneX": {
3844
"platformName": "iOS",
39-
"platformVersion": "12.1",
45+
"platformVersion": "12.0",
4046
"deviceName": "iPhone X",
4147
"appium-version": "1.9.1",
42-
"app": ""
48+
"app": "",
49+
"noReset": true,
50+
"fullReset": false,
51+
"density": 3,
52+
"offsetPixels": 87,
53+
"idleTimeout": 120,
54+
"automationName": "Appium"
4355
},
4456
"sim103iPhone6": {
4557
"browserName": "",

demo-vue/e2e/test.e2e.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe("Facebook tests", async function () {
3535

3636
it("should log in via custom button", async function () {
3737
if (isAndroid) {
38-
var userNameLabelElement = "[@text='Nativescript User']";
38+
var userNameLabelElement = "Nativescript User";
3939
} else {
4040
var userNameLabelElement = "[@name='Nativescript User']";
4141
}
@@ -44,12 +44,13 @@ describe("Facebook tests", async function () {
4444
await facebookButton.click();
4545

4646
if (isAndroid) {
47-
const allFields = await driver.findElementsByClassName(driver.locators.getElementByName("textfield"));
47+
await driver.wait(1000);
48+
const allFields = await driver.findElementsByClassName("android.widget.EditText");
4849
const wd = driver.wd();
4950
const action = new wd.TouchAction(driver.driver);
5051
action
51-
.press({ x: 52, y: 499 })
52-
.moveTo({ x: -2, y: -294 })
52+
.press({ x: 380, y: 720 })
53+
.moveTo({ x: 380, y: 410 })
5354
.release();
5455
await action.perform();
5556
await driver.wait(1000);
@@ -73,19 +74,16 @@ describe("Facebook tests", async function () {
7374
if (isAndroid) {
7475
const logInButton = await driver.findElementByClassName(driver.locators.button);
7576
await logInButton.click();
76-
const continueButton = await driver.findElementByText("Continue");
77-
await continueButton.click();
77+
await driver.wait(500);
7878
} else {
7979
const logInButton = await driver.findElementByText("Log In");
8080
await logInButton.click();
81-
const continueButton = await driver.findElementByText("Continue");
82-
await continueButton.click();
8381
}
84-
const userNameLabel = await driver.findElementByXPath(
85-
"//" + driver.locators.getElementByName("label") + userNameLabelElement
86-
);
87-
const userName = await userNameLabel.text();
88-
expect(userName).to.equal(USER_NAME, "Not logged with the same user");
82+
const continueButton = await driver.findElementByText("Continue", SearchOptions.exact);
83+
await continueButton.click();
84+
await driver.wait(1000);
85+
const userNameLabel = await driver.findElementByText("Nativescript User", SearchOptions.contains);
86+
expect(userNameLabel).to.exist;
8987
});
9088

9189
it("should log out via custom button", async function () {
@@ -102,6 +100,9 @@ describe("Facebook tests", async function () {
102100
const allFields = await driver.findElementsByClassName(driver.locators.getElementByName("textfield"));
103101
await allFields[1].sendKeys(PASSWORD);
104102
await allFields[0].sendKeys(USERNAME);
103+
try {
104+
await driver.driver.hideDeviceKeyboard("Done");
105+
} catch (error) { }
105106
const logInButton = await driver.findElementByClassName(driver.locators.button);
106107
await logInButton.click();
107108
} else {

demo-vue/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
"tns-core-modules": "~5.1.0"
1919
},
2020
"devDependencies": {
21+
"@babel/core": "~7.1.0",
22+
"@babel/preset-env": "~7.1.0",
2123
"@types/chai": "^4.1.3",
2224
"@types/mocha": "^5.2.0",
2325
"@types/node": "^10.1.2",
24-
"@babel/core": "~7.1.0",
25-
"@babel/preset-env": "~7.1.0",
26+
"babel-loader": "~8.0.0",
2627
"chai": "~4.1.2",
2728
"chai-as-promised": "~7.1.1",
2829
"karma": "^2.0.2",
2930
"karma-nativescript-launcher": "^0.4.0",
3031
"mocha": "~5.2.0",
31-
"babel-loader": "~8.0.0",
3232
"nativescript-dev-appium": "^4.0.9",
3333
"nativescript-dev-typescript": "~0.7.0",
3434
"nativescript-dev-webpack": "~0.19.0",

0 commit comments

Comments
 (0)