diff --git a/.gitignore b/.gitignore index 6216e79..49730fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ +.DS_Store .idea/ +.vscode npm-debug.log package-lock.json node_modules platforms/ app/tns_modules/ +e2e/reports +test-results.xml \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 34a3d2b..a1c83c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,9 +53,9 @@ matrix: - "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $ANDROID_SAUCE_STORAGE --data-binary @$ANDROID_PACKAGE_FOLDER/$ANDROID_PACKAGE" - os: osx env: - - BuildiOS="10.3" - - Xcode="8.3" - osx_image: xcode8.3 + - BuildiOS="11" + - Xcode="9.3" + osx_image: xcode9.3 language: node_js node_js: "8" jdk: oraclejdk8 @@ -73,17 +73,15 @@ matrix: script: - npm install -g appium - npm install - - appium & - - travis_retry npm run appium -- --runType=android23 --sauceLab=true --appPath=$ANDROID_PACKAGE + - travis_retry npm run ci.android --appPath $ANDROID_PACKAGE - npm run deploy - os: linux env: - - iOS="10" + - iOS="11" language: node_js node_js: "8" script: - npm install -g appium - npm install - - appium & - - travis_wait travis_retry npm run appium -- --runType=ios-simulator103iPhone6 --sauceLab=true --appPath=$IOS_PACKAGE + - travis_wait travis_retry npm run e2e.ios --appPath $IOS_PACKAGE - npm run deploy \ No newline at end of file diff --git a/app/elements/components/ActivityIndicator.js b/app/elements/components/ActivityIndicator.js index 24685a4..f4200a8 100644 --- a/app/elements/components/ActivityIndicator.js +++ b/app/elements/components/ActivityIndicator.js @@ -1,7 +1,7 @@ module.exports = { template: ` - + ` }; \ No newline at end of file diff --git a/app/elements/components/DatePicker.js b/app/elements/components/DatePicker.js index 92e7bba..b6bc844 100644 --- a/app/elements/components/DatePicker.js +++ b/app/elements/components/DatePicker.js @@ -1,7 +1,7 @@ module.exports = { template: ` - + ` }; \ No newline at end of file diff --git a/app/elements/components/Image.js b/app/elements/components/Image.js index 0636d83..3e8a31c 100644 --- a/app/elements/components/Image.js +++ b/app/elements/components/Image.js @@ -1,7 +1,7 @@ module.exports = { template: ` - + ` }; \ No newline at end of file diff --git a/screenshots/.gitkeep b/e2e/.gitkeep similarity index 100% rename from screenshots/.gitkeep rename to e2e/.gitkeep diff --git a/appium.capabilities.json b/e2e/config/appium.capabilities.json similarity index 63% rename from appium.capabilities.json rename to e2e/config/appium.capabilities.json index b9206ed..3473484 100644 --- a/appium.capabilities.json +++ b/e2e/config/appium.capabilities.json @@ -13,5 +13,15 @@ "deviceName": "iPhone Simulator", "bundleId": "org.nativescript.nativescriptvueuitests", "app": "" + }, + "sim.iPhone8.iOS11.3": { + "platformName": "iOS", + "platformVersion": "11.3", + "deviceName": "iPhone 8", + "appiumVersion": "1.8.1", + "bundleId": "org.nativescript.nativescriptvueuitests", + "noReset": true, + "fullReset": false, + "app": "" } } \ No newline at end of file diff --git a/e2e/config/mocha.opts b/e2e/config/mocha.opts new file mode 100644 index 0000000..ad112ca --- /dev/null +++ b/e2e/config/mocha.opts @@ -0,0 +1,4 @@ +--timeout 800000 +--recursive e2e +--reporter mocha-multi +--reporter-options spec=-,mocha-junit-reporter=test-results.xml \ No newline at end of file diff --git a/e2e/resources/.gitkeep b/e2e/resources/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/screenshots/android23/ActionDialog.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/ActionDialog.png similarity index 100% rename from screenshots/android23/ActionDialog.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/ActionDialog.png diff --git a/screenshots/android23/ActivityIndicator.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/ActivityIndicator.png similarity index 100% rename from screenshots/android23/ActivityIndicator.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/ActivityIndicator.png diff --git a/screenshots/android23/AlertDialog.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/AlertDialog.png similarity index 100% rename from screenshots/android23/AlertDialog.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/AlertDialog.png diff --git a/screenshots/android23/Button.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/Button.png similarity index 100% rename from screenshots/android23/Button.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/Button.png diff --git a/screenshots/android23/ConfirmDialog.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/ConfirmDialog.png similarity index 100% rename from screenshots/android23/ConfirmDialog.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/ConfirmDialog.png diff --git a/screenshots/android23/DatePicker.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/DatePicker.png similarity index 100% rename from screenshots/android23/DatePicker.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/DatePicker.png diff --git a/screenshots/android23/HtmlView.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/HtmlView.png similarity index 100% rename from screenshots/android23/HtmlView.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/HtmlView.png diff --git a/screenshots/android23/Image.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/Image.png similarity index 100% rename from screenshots/android23/Image.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/Image.png diff --git a/screenshots/android23/Label.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/Label.png similarity index 100% rename from screenshots/android23/Label.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/Label.png diff --git a/screenshots/android23/ListPicker.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/ListPicker.png similarity index 100% rename from screenshots/android23/ListPicker.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/ListPicker.png diff --git a/screenshots/android23/ListView.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/ListView.png similarity index 100% rename from screenshots/android23/ListView.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/ListView.png diff --git a/screenshots/android23/LoginDialog.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/LoginDialog.png similarity index 100% rename from screenshots/android23/LoginDialog.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/LoginDialog.png diff --git a/screenshots/android23/Progress.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/Progress.png similarity index 100% rename from screenshots/android23/Progress.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/Progress.png diff --git a/screenshots/android23/PromptDialog.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/PromptDialog.png similarity index 100% rename from screenshots/android23/PromptDialog.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/PromptDialog.png diff --git a/screenshots/android23/ScrollView.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/ScrollView.png similarity index 100% rename from screenshots/android23/ScrollView.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/ScrollView.png diff --git a/screenshots/android23/SearchBar.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/SearchBar.png similarity index 100% rename from screenshots/android23/SearchBar.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/SearchBar.png diff --git a/screenshots/android23/SegmentedBar.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/SegmentedBar.png similarity index 100% rename from screenshots/android23/SegmentedBar.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/SegmentedBar.png diff --git a/screenshots/android23/Slider.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/Slider.png similarity index 100% rename from screenshots/android23/Slider.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/Slider.png diff --git a/screenshots/android23/Switch.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/Switch.png similarity index 100% rename from screenshots/android23/Switch.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/Switch.png diff --git a/screenshots/android23/TabView.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/TabView.png similarity index 100% rename from screenshots/android23/TabView.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/TabView.png diff --git a/screenshots/android23/TextField.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/TextField.png similarity index 100% rename from screenshots/android23/TextField.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/TextField.png diff --git a/screenshots/android23/TextView.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/TextView.png similarity index 100% rename from screenshots/android23/TextView.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/TextView.png diff --git a/screenshots/android23/TimePicker.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/TimePicker.png similarity index 100% rename from screenshots/android23/TimePicker.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/TimePicker.png diff --git a/screenshots/android23/WebView.png b/e2e/resources/images/nativescriptvueuitests/Android Emulator/WebView.png similarity index 100% rename from screenshots/android23/WebView.png rename to e2e/resources/images/nativescriptvueuitests/Android Emulator/WebView.png diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/ActionDialog.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/ActionDialog.png new file mode 100644 index 0000000..16627b1 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/ActionDialog.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/ActivityIndicator.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/ActivityIndicator.png new file mode 100644 index 0000000..2e087af Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/ActivityIndicator.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/AlertDialog.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/AlertDialog.png new file mode 100644 index 0000000..77ac0cc Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/AlertDialog.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/Button.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/Button.png new file mode 100644 index 0000000..ca121d3 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/Button.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/ConfirmDialog.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/ConfirmDialog.png new file mode 100644 index 0000000..3dee0a0 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/ConfirmDialog.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/DatePicker.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/DatePicker.png new file mode 100644 index 0000000..37e2103 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/DatePicker.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/HtmlView.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/HtmlView.png new file mode 100644 index 0000000..b286e49 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/HtmlView.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/Image.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/Image.png new file mode 100644 index 0000000..ef16540 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/Image.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/Label.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/Label.png new file mode 100644 index 0000000..ec039ba Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/Label.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/ListPicker.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/ListPicker.png new file mode 100644 index 0000000..c8e8549 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/ListPicker.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/ListView.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/ListView.png new file mode 100644 index 0000000..c1e64e5 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/ListView.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/LoginDialog.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/LoginDialog.png new file mode 100644 index 0000000..a4255c8 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/LoginDialog.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/Progress.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/Progress.png new file mode 100644 index 0000000..9ea68c3 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/Progress.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/PromptDialog.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/PromptDialog.png new file mode 100644 index 0000000..221fc01 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/PromptDialog.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/ScrollView.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/ScrollView.png new file mode 100644 index 0000000..b7e37f4 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/ScrollView.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/SearchBar.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/SearchBar.png new file mode 100644 index 0000000..3e7c608 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/SearchBar.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/SegmentedBar.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/SegmentedBar.png new file mode 100644 index 0000000..8a80bea Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/SegmentedBar.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/Slider.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/Slider.png new file mode 100644 index 0000000..42b1cd7 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/Slider.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/Switch.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/Switch.png new file mode 100644 index 0000000..15880ce Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/Switch.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/TabView.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/TabView.png new file mode 100644 index 0000000..0a1b1ba Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/TabView.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/TextField.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/TextField.png new file mode 100644 index 0000000..51c3941 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/TextField.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/TextView.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/TextView.png new file mode 100644 index 0000000..f368864 Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/TextView.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/TimePicker.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/TimePicker.png new file mode 100644 index 0000000..cfc233b Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/TimePicker.png differ diff --git a/e2e/resources/images/nativescriptvueuitests/iPhone 8/WebView.png b/e2e/resources/images/nativescriptvueuitests/iPhone 8/WebView.png new file mode 100644 index 0000000..9923a5a Binary files /dev/null and b/e2e/resources/images/nativescriptvueuitests/iPhone 8/WebView.png differ diff --git a/screenshots/ios-simulator103iPhone6/ActionDialog.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/ActionDialog.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/ActionDialog.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/ActionDialog.png diff --git a/screenshots/ios-simulator103iPhone6/ActivityIndicator.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/ActivityIndicator.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/ActivityIndicator.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/ActivityIndicator.png diff --git a/screenshots/ios-simulator103iPhone6/AlertDialog.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/AlertDialog.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/AlertDialog.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/AlertDialog.png diff --git a/screenshots/ios-simulator103iPhone6/Button.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/Button.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/Button.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/Button.png diff --git a/screenshots/ios-simulator103iPhone6/ConfirmDialog.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/ConfirmDialog.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/ConfirmDialog.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/ConfirmDialog.png diff --git a/screenshots/ios-simulator103iPhone6/DatePicker.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/DatePicker.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/DatePicker.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/DatePicker.png diff --git a/screenshots/ios-simulator103iPhone6/HtmlView.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/HtmlView.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/HtmlView.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/HtmlView.png diff --git a/screenshots/ios-simulator103iPhone6/Image.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/Image.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/Image.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/Image.png diff --git a/screenshots/ios-simulator103iPhone6/Label.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/Label.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/Label.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/Label.png diff --git a/screenshots/ios-simulator103iPhone6/ListPicker.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/ListPicker.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/ListPicker.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/ListPicker.png diff --git a/screenshots/ios-simulator103iPhone6/ListView.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/ListView.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/ListView.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/ListView.png diff --git a/screenshots/ios-simulator103iPhone6/LoginDialog.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/LoginDialog.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/LoginDialog.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/LoginDialog.png diff --git a/screenshots/ios-simulator103iPhone6/Progress.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/Progress.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/Progress.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/Progress.png diff --git a/screenshots/ios-simulator103iPhone6/PromptDialog.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/PromptDialog.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/PromptDialog.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/PromptDialog.png diff --git a/screenshots/ios-simulator103iPhone6/ScrollView.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/ScrollView.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/ScrollView.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/ScrollView.png diff --git a/screenshots/ios-simulator103iPhone6/SearchBar.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/SearchBar.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/SearchBar.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/SearchBar.png diff --git a/screenshots/ios-simulator103iPhone6/SegmentedBar.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/SegmentedBar.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/SegmentedBar.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/SegmentedBar.png diff --git a/screenshots/ios-simulator103iPhone6/Slider.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/Slider.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/Slider.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/Slider.png diff --git a/screenshots/ios-simulator103iPhone6/Switch.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/Switch.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/Switch.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/Switch.png diff --git a/screenshots/ios-simulator103iPhone6/TabView.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/TabView.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/TabView.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/TabView.png diff --git a/screenshots/ios-simulator103iPhone6/TextField.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/TextField.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/TextField.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/TextField.png diff --git a/screenshots/ios-simulator103iPhone6/TextView.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/TextView.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/TextView.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/TextView.png diff --git a/screenshots/ios-simulator103iPhone6/TimePicker.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/TimePicker.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/TimePicker.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/TimePicker.png diff --git a/screenshots/ios-simulator103iPhone6/WebView.png b/e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/WebView.png similarity index 100% rename from screenshots/ios-simulator103iPhone6/WebView.png rename to e2e/resources/images/nativescriptvueuitests/ios-simulator103iPhone6/WebView.png diff --git a/e2e/setup.js b/e2e/setup.js new file mode 100644 index 0000000..b4d91e3 --- /dev/null +++ b/e2e/setup.js @@ -0,0 +1,10 @@ +const nsAppium = require("nativescript-dev-appium"); + +// In case you need the server to started programatically +// before("start server", async () => { +// await nsAppium.startServer(); +// }); + +// after("stop server", async () => { +// await nsAppium.stopServer(); +// }); diff --git a/e2e/smoke.tests.js b/e2e/smoke.tests.js new file mode 100644 index 0000000..1fdd77e --- /dev/null +++ b/e2e/smoke.tests.js @@ -0,0 +1,91 @@ +const assert = require("chai").assert; +const nsAppium = require("nativescript-dev-appium"); + +let driver; +before("create driver", async () => { + driver = await nsAppium.createDriver(); +}); + +afterEach(`navigate back to main page after test`, async () => { + await driver.navBack(); +}); + +after('quit driver', async () => { + await driver.quit(); + console.log('Buh-Bye...'); +}); + +describe("components", async () => { + const components = [ + 'ActivityIndicator', + 'Button', + 'DatePicker', + 'HtmlView', + 'Image', + 'Label', + 'ListPicker', + 'ListView', + 'Progress', + 'ScrollView', + 'SearchBar', + 'SegmentedBar', + 'Slider', + 'Switch', + 'TabView', + 'TextField', + 'TextView', + 'TimePicker', + 'WebView', + ]; + + for (let component of components) { + it(`load ${component}`, async () => { + await loadComponent(component); + + const result = await driver.compareScreen(component, 10, 0.1); + assert.isTrue(result, "Image comparisson has failed!"); + + if (component === 'SearchBar' && driver.isAndroid) { + await driver.navBack(); + } + }); + }; +}); + +describe("dialogs", async () => { + const dialogs = [ + 'ActionDialog', + 'AlertDialog', + 'ConfirmDialog', + 'LoginDialog', + 'PromptDialog', + ]; + + for (let dialog of dialogs) { + it(`load ${dialog}`, async () => { + await loadComponent(dialog); + + const result = await driver.compareScreen(dialog, 10, 0.1); + + if (driver.isIOS) { + const button = dialog === "ActionDialog" ? "cancel" : "OK"; + const dialogItem = await driver.findElementByTextIfExists(button, nsAppium.SearchOptions.contains); + if (dialogItem) { + await dialogItem.click(); + } else { + console.error(`Could not find ${button} to dismiss the dialog!`); + } + } else { + await driver.navBack(); + } + assert.isTrue(result, "Image comparisson has failed!"); + }); + }; +}); + + +const loadComponent = async (component) => { + const listItem = await driver.findElementByText(component); + await listItem.click(); + await driver.findElementByTextIfExists(component, nsAppium.SearchOptions.contains); +}; diff --git a/generate-screenshots.js b/generate-screenshots.js deleted file mode 100644 index 50eb837..0000000 --- a/generate-screenshots.js +++ /dev/null @@ -1,104 +0,0 @@ -const argv = require('yargs').argv; -const AppiumDriver = require('nativescript-dev-appium').AppiumDriver; -const fs = require('fs'); - -const components = [ - 'ActivityIndicator', - 'Button', - 'DatePicker', - 'HtmlView', - 'Image', - 'Label', - 'ListPicker', - 'ListView', - 'Progress', - 'ScrollView', - 'SearchBar', - 'SegmentedBar', - 'Slider', - 'Switch', - 'TabView', - 'TextField', - 'TextView', - 'TimePicker', - 'WebView', - 'ActionDialog', - 'AlertDialog', - 'ConfirmDialog', - 'LoginDialog', - 'PromptDialog', -]; - -const makeDir = (path) => { - if (!fs.existsSync(path)) { - fs.mkdirSync(path); - } -}; - -(async function () { - makeDir('screenshots'); - makeDir(`screenshots/${argv.runType}`); - - AppiumDriver.createAppiumDriver(4723, { - isSauceLab: argv.sauceLab || false, - runType: argv.runType, - appPath: argv.appPath, //'nativescriptvueuitests-debug.apk', - appiumCaps: require('./appium.capabilities.json')[argv.runType], - verbose: argv.verbose || false, - }) - .then(driver => run(driver)) - .then(() => console.log('Buh-Bye...')) - .catch((err) => console.log(err)); -})(); - -const run = async (driver) => { - for (let component of components) { - await screenshotComponent(driver, component) - } - await driver.quit(); -}; - -const screenshotComponent = async (driver, component) => { - console.log(`[${argv.runType}] >>>>> ${component} >>>>>`); - - const isIOS = argv.runType.toLowerCase().indexOf("ios") > -1; - - let listItem; - if (isIOS) { - listItem = await driver.findElementByText(component); - } else { - listItem = await driver.findElementByXPath(`//*[contains(@text,'${component}')]`); - } - - await listItem.tap(); - - await driver._driver.sleep(1000); - - if (component === 'HtmlView' || component === 'WebView') { - await driver._driver.sleep(4000); - } - - await driver.takeScreenshot(`screenshots/${argv.runType}/${component}.png`); - - if (component.includes('Dialog')) { - if (isIOS) { - await driver._driver.sleep(1000); - const button = component === "ActionDialog" ? "cancel" : "OK"; - const dialogItem = await driver.findElementByText(button, 1); // 1 = 'contains' - if (dialogItem) { - dialogItem.tap(); - await driver._driver.sleep(1500); - } else { - console.log("Could not find button to dismiss the dialog!"); - } - } else { - await driver.navBack(); - } - } - - await driver.navBack(); - - if (component === 'SearchBar' && argv.runType.toLowerCase().indexOf('android') > -1) { - await driver.navBack(); - } -}; \ No newline at end of file diff --git a/package.json b/package.json index 9025378..1810645 100644 --- a/package.json +++ b/package.json @@ -6,34 +6,33 @@ "nativescript": { "id": "org.nativescript.nativescriptvueuitests", "tns-ios": { - "version": "3.4.1" + "version": "4.2.0" }, "tns-android": { - "version": "3.4.1" + "version": "4.2.0" } }, "dependencies": { - "appium": "^1.7.1", - "nativescript-dev-appium": "^3.1.0-2017-10-6-1", "nativescript-vue": "^1.0.0", - "tns-core-modules": "~3.4.0", - "yargs": "^9.0.1" + "tns-core-modules": "~4.2.0" }, "scripts": { - "appium": "node generate-screenshots.js", "android.build": "tns build android", - "android.screenshots": "npm run appium -- --runType=android23", - "ci.android.screenshots": "npm run appium -- --runType=android23 --sauceLab=true", - "ci.ios.screenshots": "npm run appium -- --runType=ios-simulator103iPhone6", + "ios.build": "tns build ios", "deploy": "bash deploy.sh", "e2e": "mocha --opts ./e2e/config/mocha.opts", - "ios.build": "tns build ios", - "ios.screenshots": "npm run appium -- --runType=ios-simulator103iPhone6" + "e2e.android": "npm run e2e -- --runType android23 --reuseDevice", + "e2e.ios": "npm run e2e -- --runType sim.iPhone8.iOS11.3 --reuseDevice", + "ci.android": "npm run e2e.android --sauceLab", + "ci.ios": "npm run e2e.ios --sauceLab" }, "devDependencies": { "babel-traverse": "6.26.0", "babel-types": "6.26.0", "babylon": "6.18.0", - "lazy": "1.0.11" + "lazy": "1.0.11", + "nativescript-dev-appium": "^4.0.5", + "chai": "^4.1.2", + "mocha": "^5.2.0" } -} +} \ No newline at end of file