Skip to content

Commit 904dab0

Browse files
Merge pull request #39 from NativeScript/dtodorov/e2e-tests-root
Move e2e tests on root
2 parents 625cb0d + 79d511a commit 904dab0

File tree

13 files changed

+102
-94
lines changed

13 files changed

+102
-94
lines changed

.travis.yml

+43-51
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ matrix:
4444
before_script: pod repo update
4545
script:
4646
- cd src && npm run build
47-
- cd ../demo && npm i && tns build ios --bundle --env.uglify --copy-to "./outputs/demo.app"
47+
- cd ../demo && npm i && tns build ios --env.uglify --copy-to "./outputs/demo.app"
4848
- cd $IOS_PACKAGE_FOLDER_JS && zip -r $IOS_PACKAGE_JS demo.app
4949
- "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"
5050
- os: osx
@@ -58,7 +58,7 @@ matrix:
5858
before_script: pod repo update
5959
script:
6060
- cd src && npm run build
61-
- cd ../demo-vue && npm i && tns build ios --bundle --env.uglify --copy-to "./outputs/demovue.app"
61+
- cd ../demo-vue && npm i && tns build ios --env.uglify --copy-to "./outputs/demovue.app"
6262
- cd $IOS_PACKAGE_FOLDER_VUE && zip -r $IOS_PACKAGE_VUE demovue.app
6363
- "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"
6464
- os: osx
@@ -73,7 +73,7 @@ matrix:
7373
script:
7474
- cd src && npm run build && npm pack
7575
- cd ../demo-angular && tns plugin add ../src/*.tgz
76-
- npm i && tns build ios --bundle --env.uglify --env.aot --copy-to "./outputs/demoangular.app"
76+
- npm i && tns build ios --env.uglify --env.aot --copy-to "./outputs/demoangular.app"
7777
- cd $IOS_PACKAGE_FOLDER_NG && zip -r $IOS_PACKAGE_NG demoangular.app
7878
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $IOS_SAUCE_STORAGE/$IOS_PACKAGE_NG?overwrite=true --data-binary @$IOS_PACKAGE_FOLDER_NG/$IOS_PACKAGE_NG"
7979
- language: android
@@ -86,7 +86,7 @@ matrix:
8686
before_install: nvm install 10
8787
script:
8888
- cd src && npm run build
89-
- cd ../demo && npm i && tns build android --bundle --env.uglify --env.snapshot --copy-to "./outputs/app-debug.apk"
89+
- cd ../demo && npm i && tns build android --env.uglify --env.snapshot --copy-to "./outputs/app-debug.apk"
9090
- "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"
9191
- language: android
9292
os: linux
@@ -98,7 +98,7 @@ matrix:
9898
before_install: nvm install 10
9999
script:
100100
- cd src && npm run build
101-
- cd ../demo-vue && npm i && tns build android --bundle --env.uglify --copy-to "./outputs/app-debug.apk"
101+
- cd ../demo-vue && npm i && tns build android --env.uglify --copy-to "./outputs/app-debug.apk"
102102
- "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"
103103
- language: android
104104
os: linux
@@ -112,79 +112,71 @@ matrix:
112112
- cd src && npm run build
113113
- cd ../publish && sh pack.sh
114114
- cd ../demo-angular && tns plugin add ../publish/package/*.tgz
115-
- npm i && tns build android --bundle --env.uglify --env.snapshot --env.aot --copy-to "./outputs/app-debug.apk"
115+
- npm i && tns build android --env.uglify --env.snapshot --env.aot --copy-to "./outputs/app-debug.apk"
116116
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $ANDROID_SAUCE_STORAGE/$ANDROID_PACKAGE_NG?overwrite=true --data-binary @$ANDROID_PACKAGE_FOLDER_NG/app-debug.apk"
117-
- language: android
117+
- stage: "UI Tests"
118+
env:
119+
- Android="24"
120+
- Type="Angular"
121+
language: node_js
118122
os: linux
119-
dist: trusty
123+
node_js: "10"
124+
script:
125+
- npm i -g appium
126+
- cd tests && npm i
127+
- travis_wait travis_retry npm run e2e -- --runType android24 --sauceLab --appPath $ANDROID_PACKAGE_NG
128+
- os: linux
120129
env:
121-
- BuildAndroid="28"
130+
- Android="24"
122131
- Type="VanillaJS"
123-
124-
jdk: oraclejdk8
125-
before_install: nvm install 10
126-
script:
127-
- cd src && npm run build
128-
- cd ../demo && tns build android
129-
- language: android
132+
language: node_js
130133
os: linux
131-
dist: trusty
132-
env:
133-
- BuildAndroid="28"
134-
- Type="Angular"
135-
136-
jdk: oraclejdk8
137-
before_install: nvm install 10
134+
node_js: "10"
138135
script:
139-
- cd src && npm run build
140-
- cd ../demo-angular && tns build android
141-
- os: osx
136+
- npm i -g appium
137+
- cd tests && npm i
138+
- travis_wait travis_retry npm run e2e -- --runType android24 --sauceLab --appPath $ANDROID_PACKAGE_JS
139+
- os: linux
142140
env:
143-
- BuildiOS="12.0"
144-
- Xcode="10.0"
145-
- Type="VanillaJS"
146-
osx_image: xcode10.2
141+
- Android="24"
142+
- Type="VueJS"
147143
language: node_js
144+
os: linux
148145
node_js: "10"
149-
jdk: oraclejdk8
150-
before_script: pod repo update
151146
script:
152-
- cd src && npm run build
153-
- cd ../demo && tns build ios --bundle --env.uglify
154-
- os: osx
147+
- npm i -g appium
148+
- cd tests && npm i
149+
- travis_wait travis_retry npm run e2e -- --runType android24 --sauceLab --appPath $ANDROID_PACKAGE_VUE
150+
- os: linux
155151
env:
156-
- BuildiOS="12.0"
157-
- Xcode="10.0"
152+
- iOS="12.0"
158153
- Type="Angular"
159-
osx_image: xcode10.2
160154
language: node_js
161155
node_js: "10"
162-
jdk: oraclejdk8
163-
before_script: pod repo update
164156
script:
165-
- cd src && npm run build
166-
- cd ../demo-angular && tns build ios
167-
- stage: "UI Tests"
157+
- npm i -g appium
158+
- cd tests && npm i
159+
- travis_wait travis_retry npm run e2e -- --runType sim.iPhoneX --sauceLab --appPath $IOS_PACKAGE_NG
160+
- os: linux
168161
env:
169-
- Android="24"
170-
- Type="Angular"
162+
- iOS="12.0"
163+
- Type="VueJS"
171164
language: node_js
172-
os: linux
173165
node_js: "10"
174166
script:
175167
- npm i -g appium
176-
- cd demo-angular && npm i
177-
- travis_wait travis_retry npm run e2e -- --runType android24 --sauceLab --appPath $ANDROID_PACKAGE_NG
168+
- cd tests && npm i
169+
- travis_wait travis_retry npm run e2e -- --runType sim.iPhoneX --sauceLab --appPath $IOS_PACKAGE_VUE
178170
- os: linux
179171
env:
180172
- iOS="12.0"
181-
- Type="Angular"
173+
- Type="VanillaJS"
182174
language: node_js
183175
node_js: "10"
184176
script:
185177
- npm i -g appium
186-
- cd demo-angular && npm i
187-
- travis_wait travis_retry npm run e2e -- --runType sim.iPhoneX --sauceLab --appPath $IOS_PACKAGE_NG
178+
- cd tests && npm i
179+
- travis_wait travis_retry npm run e2e -- --runType sim.iPhoneX --sauceLab --appPath $IOS_PACKAGE_JS
188180

189181
android:
190182
components:

demo-angular/package.json

-7
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,7 @@
3838
"devDependencies": {
3939
"@angular/compiler-cli": "~8.0.0",
4040
"@ngtools/webpack": "~8.0.0",
41-
"@types/chai": "~4.1.7",
42-
"@types/mocha": "~5.2.5",
4341
"@types/node": "~10.12.18",
44-
"mocha": "~5.2.0",
45-
"mocha-junit-reporter": "~1.18.0",
46-
"mocha-multi": "~1.0.1",
47-
"mochawesome": "~3.1.1",
48-
"nativescript-dev-appium": "~5.2.0",
4942
"nativescript-dev-webpack": "~1.0.1",
5043
"tslint": "~5.11.0",
5144
"typescript": "~3.4.5"
File renamed without changes.
File renamed without changes.
File renamed without changes.

demo-angular/e2e/tests.e2e.ts renamed to tests/e2e/tests.e2e.ts

+38-36
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe("DateTimePicker", () => {
6161
});
6262

6363
it("Should verify demo title", async () => {
64-
const title = await driver.findElementByText("DateTimePicker Demo NG", SearchOptions.exact);
64+
const title = await driver.findElementByText("DateTimePicker Demo", SearchOptions.contains);
6565
expect(title).to.exist;
6666
});
6767

@@ -144,7 +144,7 @@ describe("DateTimePicker", () => {
144144
const dateString = day + "." + monthString + "." + year;
145145
console.log(dateString);
146146
const dateField = await driver.findElementByText(dateString);
147-
expect(dateString).to.exist;
147+
expect(dateField).to.exist;
148148
});
149149

150150
it("Should scroll to custom format and verify values", async () => {
@@ -244,8 +244,8 @@ describe("DateTimePicker", () => {
244244
let rejectBtn;
245245
if(driver.isAndroid){
246246
let buttons = await driver.findElementsByClassName("android.widget.Button");
247-
acceptBtn = buttons[5];
248-
rejectBtn = buttons[4];
247+
acceptBtn = buttons[buttons.length - 1];
248+
rejectBtn = buttons[buttons.length - 2];
249249
}
250250
else{
251251
acceptBtn = await driver.findElementByText("Bestätigen", SearchOptions.exact);
@@ -256,7 +256,7 @@ describe("DateTimePicker", () => {
256256
expect(rejectBtn).to.exist;
257257
expect(title).to.exist;
258258
await acceptBtn.click();
259-
const dateField = await driver.findElementByText(time);
259+
const dateField = await driver.findElementByText(time, SearchOptions.contains);
260260
expect(time).to.exist;
261261
});
262262

@@ -283,36 +283,38 @@ describe("DateTimePicker", () => {
283283
await customButtonsTitle.click();
284284
});
285285

286-
it("Should tap button to select date and verify button text", async () => {
287-
await scrollToElement(driver, "tap to select date and time", Direction.down);
288-
let dateButton = await driver.findElementByText("tap to select date", SearchOptions.contains);
289-
await dateButton.click();
290-
const date = await getPickerDate(driver);
291-
await clickOkBtn(driver);
292-
const pickerDate = new Date(date);
293-
let day = pickerDate.getDate();
294-
let dayString = day.toString();
295-
if(day < 10){
296-
dayString = "0" + day.toString();
297-
}
298-
let month = pickerDate.getMonth() + 1;
299-
let monthString = month.toString();
300-
if(month < 10){
301-
monthString = "0" + month.toString();
302-
}
303-
let year = pickerDate.getFullYear();
304-
const dateString = dayString + "." + monthString+ "." + year;
305-
console.log(dateString);
306-
const dateField = await driver.findElementByText(dateString);
307-
expect(dateString).to.exist;
308-
})
286+
if (process.env["Type"] === 'Angular'){
287+
it("Should tap button to select date and verify button text", async () => {
288+
await scrollToElement(driver, "tap to select date and time", Direction.down);
289+
let dateButton = await driver.findElementByText("tap to select date", SearchOptions.contains);
290+
await dateButton.click();
291+
const date = await getPickerDate(driver);
292+
await clickOkBtn(driver);
293+
const pickerDate = new Date(date);
294+
let day = pickerDate.getDate();
295+
let dayString = day.toString();
296+
if(day < 10){
297+
dayString = "0" + day.toString();
298+
}
299+
let month = pickerDate.getMonth() + 1;
300+
let monthString = month.toString();
301+
if(month < 10){
302+
monthString = "0" + month.toString();
303+
}
304+
let year = pickerDate.getFullYear();
305+
const dateString = dayString + "." + monthString+ "." + year;
306+
console.log(dateString);
307+
const dateField = await driver.findElementByText(dateString);
308+
expect(dateField).to.exist;
309+
})
309310

310-
it("Should tap button to select time and verify button text", async () => {
311-
let timeButton = await driver.findElementByText("tap to select time", SearchOptions.contains);
312-
await timeButton.click();
313-
const time = await getPickerTime(driver, 24);
314-
await clickOkBtn(driver);
315-
timeButton = await driver.findElementByText(time);
316-
expect(timeButton).to.exist;
317-
});
311+
it("Should tap button to select time and verify button text", async () => {
312+
let timeButton = await driver.findElementByText("tap to select time", SearchOptions.contains);
313+
await timeButton.click();
314+
const time = await getPickerTime(driver, 24);
315+
await clickOkBtn(driver);
316+
timeButton = await driver.findElementByText(time);
317+
expect(timeButton).to.exist;
318+
});
319+
}
318320
});
File renamed without changes.

tests/package.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"devDependencies": {
3+
"@types/chai": "^4.1.3",
4+
"@types/mocha": "^5.2.0",
5+
"@types/node": "^10.1.2",
6+
"babel-loader": "~8.0.0",
7+
"chai": "~4.1.2",
8+
"chai-as-promised": "~7.1.1",
9+
"karma": "^2.0.2",
10+
"karma-nativescript-launcher": "^0.4.0",
11+
"mocha": "^3.3.0",
12+
"mocha-junit-reporter": "^1.18.0",
13+
"mocha-multi": "^1.0.1",
14+
"mochawesome": "^3.1.1",
15+
"nativescript-dev-appium": "~5.2.0",
16+
"typescript": "~3.5.3"
17+
},
18+
"scripts": {
19+
"e2e": "tsc -p e2e && mocha --opts ./e2e/config/mocha.opts"
20+
}
21+
}

0 commit comments

Comments
 (0)