diff --git a/.travis.yml b/.travis.yml index 5f0fb51..936bbb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ matrix: - stage: "Lint" language: node_js os: linux - node_js: "8" + node_js: "10" script: cd src && npm run ci.tslint && cd ../demo && npm run ci.tslint && cd ../demo-angular && npm run ci.tslint - stage: "WebPack and Build" os: osx @@ -32,7 +32,7 @@ matrix: - Type="VanillaJS" osx_image: xcode10.0 language: node_js - node_js: "8" + node_js: "10" jdk: oraclejdk8 before_script: pod repo update script: @@ -46,7 +46,7 @@ matrix: - Type="VueJS" osx_image: xcode10.0 language: node_js - node_js: "8" + node_js: "10" jdk: oraclejdk8 before_script: pod repo update script: @@ -60,7 +60,7 @@ matrix: - Type="Angular" osx_image: xcode10.0 language: node_js - node_js: "8" + node_js: "10" jdk: oraclejdk8 before_script: pod repo update script: @@ -69,54 +69,61 @@ matrix: - npm i && tns build ios --bundle --env.uglify --env.aot - language: android os: linux + dist: trusty env: - WebpackAndroid="28" - Type="VanillaJS" jdk: oraclejdk8 - before_install: nvm install 8 + before_install: nvm install 10 script: - cd src && npm run build - cd ../demo && npm i && tns build android --bundle --env.uglify --env.snapshot --copy-to "./outputs/app-debug.apk" - "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" - language: android os: linux + dist: trusty env: - WebpackAndroid="28" - Type="VueJS" jdk: oraclejdk8 - before_install: nvm install 8 + before_install: nvm install 10 script: - cd src && npm run build - cd ../demo-vue && npm i && tns build android --bundle --env.uglify --copy-to "./outputs/app-debug.apk" - "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" - language: android os: linux + dist: trusty env: - WebpackAndroid="28" - Type="Angular" jdk: oraclejdk8 - before_install: nvm install 8 + before_install: nvm install 10 script: - cd src && npm run build - cd ../publish && sh pack.sh - cd ../demo-angular && tns plugin add ../publish/package/*.tgz - npm i && tns build android --bundle --env.uglify --env.snapshot --env.aot - language: android + os: linux + dist: trusty env: - BuildAndroid="28" - Type="VanillaJS" - os: linux + jdk: oraclejdk8 - before_install: nvm install 8.11.4 + before_install: nvm install 10 script: - cd demo && npm run ci.android.build - language: android + os: linux + dist: trusty env: - BuildAndroid="28" - Type="Angular" - os: linux + jdk: oraclejdk8 - before_install: nvm install 8.11.4 + before_install: nvm install 10 script: - cd demo-angular && npm run ci.android.build - os: osx @@ -126,7 +133,7 @@ matrix: - Type="VanillaJS" osx_image: xcode10.0 language: node_js - node_js: "8" + node_js: "10" jdk: oraclejdk8 before_script: pod repo update script: @@ -139,7 +146,7 @@ matrix: - Type="Angular" osx_image: xcode10.0 language: node_js - node_js: "8" + node_js: "10" jdk: oraclejdk8 before_script: pod repo update script: @@ -150,38 +157,38 @@ matrix: - Type="VanillaJS" language: node_js os: linux - node_js: "8" + node_js: "10" script: - npm i -g appium - cd demo && npm i - - travis_wait travis_retry npm run e2e -- --runType android23 --sauceLab --appPath $ANDROID_PACKAGE_JS + - travis_wait travis_retry npm run e2e -- --runType android24 --sauceLab --appPath $ANDROID_PACKAGE_JS - os: linux env: - Android="24" - Type="VueJS" language: node_js os: linux - node_js: "8" + node_js: "10" script: - npm i -g appium - cd demo-vue && npm i - - travis_wait travis_retry npm run e2e -- --runType android23 --sauceLab --appPath $ANDROID_PACKAGE_VUE + - travis_wait travis_retry npm run e2e -- --runType android24 --sauceLab --appPath $ANDROID_PACKAGE_VUE - os: linux env: - iOS="12.0" - Type="VanillaJS" language: node_js - node_js: "8" + node_js: "10" script: - npm i -g appium - cd demo && npm i - - travis_wait travis_retry npm run e2e -- --runType sim11iPhone6 --sauceLab --appPath $IOS_PACKAGE_JS + - travis_wait travis_retry npm run e2e -- --runType sim12iPhoneX --sauceLab --appPath $IOS_PACKAGE_JS - os: linux env: - iOS="12.0" - Type="VueJS" language: node_js - node_js: "8" + node_js: "10" script: - npm i -g appium - cd demo-vue && npm i diff --git a/demo-angular/app/package.json b/demo-angular/app/package.json index a8a1e03..83cac3e 100644 --- a/demo-angular/app/package.json +++ b/demo-angular/app/package.json @@ -3,7 +3,5 @@ "v8Flags": "--expose_gc", "requireModules": ["nativescript-imagepicker"] }, - "main": "main.js", - "name": "tns-template-hello-world", - "version": "3.1.0" + "main": "main.js" } diff --git a/demo-angular/package.json b/demo-angular/package.json index 2d40c91..932d4c6 100644 --- a/demo-angular/package.json +++ b/demo-angular/package.json @@ -2,28 +2,29 @@ "nativescript": { "id": "org.nativescript.imagepickerdemoangular", "tns-ios": { - "version": "5.3.0" + "version": "5.4.0" }, "tns-android": { - "version": "5.3.0" + "version": "5.4.0" } }, "dependencies": { - "@angular/common": "~7.2.0", - "@angular/compiler": "~7.2.0", - "@angular/core": "~7.2.0", - "@angular/forms": "~7.2.0", - "@angular/http": "~7.2.0", - "@angular/platform-browser": "~7.2.0", - "@angular/platform-browser-dynamic": "~7.2.0", - "@angular/router": "~7.2.0", - "nativescript-angular": "~7.2.0", + "@angular/common": "~8.0.0", + "@angular/compiler": "~8.0.0", + "@angular/core": "~8.0.0", + "@angular/forms": "~8.0.0", + "@angular/http": "8.0.0-beta.10", + "@angular/platform-browser": "~8.0.0", + "@angular/platform-browser-dynamic": "~8.0.0", + "@angular/router": "~8.0.0", + "nativescript-angular": "~8.0.0", "nativescript-imagepicker": "../src", "nativescript-theme-core": "^1.0.4", "nativescript-unit-test-runner": "^0.3.4", "reflect-metadata": "~0.1.8", "rxjs": "^6.3.3", - "tns-core-modules": "^5.0.0" + "tns-core-modules": "^5.0.0", + "typescript": "~3.4.5" }, "devDependencies": { "jasmine-core": "^2.5.2", @@ -31,8 +32,8 @@ "karma-jasmine": "^1.0.2", "karma-nativescript-launcher": "^0.4.0", "nativescript-css-loader": "~0.26.0", - "nativescript-dev-typescript": "~0.9.0", - "nativescript-dev-webpack": "~0.21.0", + "nativescript-dev-typescript": "~0.10.0", + "nativescript-dev-webpack": "~0.24.0", "tns-platform-declarations": "^5.0.0", "tslint": "~5.11.0", "zone.js": "^0.8.4" diff --git a/demo-vue/.gitignore b/demo-vue/.gitignore index 0cdaa5c..a9e686d 100644 --- a/demo-vue/.gitignore +++ b/demo-vue/.gitignore @@ -6,7 +6,6 @@ platforms/ # NativeScript Template *.js.map -!webpack.config.js *.css # Logs diff --git a/demo-vue/e2e/config/appium.capabilities.json b/demo-vue/e2e/config/appium.capabilities.json index d425a34..b611563 100644 --- a/demo-vue/e2e/config/appium.capabilities.json +++ b/demo-vue/e2e/config/appium.capabilities.json @@ -24,13 +24,17 @@ "platformName": "Android", "platformVersion": "7.0", "deviceName": "Android GoogleAPI Emulator", - "appium-version": "1.9.1", + "appiumVersion": "1.9.1", "noReset": true, - "lt": 60000, - "newCommandTimeout": 720, - "fullReset": false, - "idleTimeout": 120, - "automationName": "Appium" + "app": "" + }, + "android24.local": { + "platformName": "Android", + "platformVersion": "7.0", + "deviceName": "Emulator-Api24-Default", + "avd": "Emulator-Api24-Default", + "appiumVersion": "1.9.1", + "noReset": true }, "sim11iPhone6": { "platformName": "iOS", diff --git a/demo-vue/e2e/test.e2e.ts b/demo-vue/e2e/test.e2e.ts index b57e8a2..fe990a5 100644 --- a/demo-vue/e2e/test.e2e.ts +++ b/demo-vue/e2e/test.e2e.ts @@ -63,6 +63,8 @@ describe("Imagepicker", async function () { if (isSauceRun && imagesFolder) { await imagesFolder.click(); + let dcimFolder = await driver.findElementByText("DCIM", SearchOptions.contains); + await dcimFolder.click(); imagesFolder = await driver.findElementByClassName(driver.locators.image); await imagesFolder.click(); } diff --git a/demo-vue/package.json b/demo-vue/package.json index cb47180..33fc1f5 100644 --- a/demo-vue/package.json +++ b/demo-vue/package.json @@ -2,16 +2,16 @@ "nativescript": { "id": "org.nativescript.demovue", "tns-android": { - "version": "5.3.0" + "version": "5.4.0" }, "tns-ios": { - "version": "5.3.0" + "version": "5.4.0" } }, "dependencies": { "nativescript-imagepicker": "../src", "nativescript-theme-core": "~1.0.4", - "nativescript-vue": "^2.0.0", + "nativescript-vue": "~2.2.0", "tns-core-modules": "^5.0.0" }, "devDependencies": { @@ -27,10 +27,10 @@ "mocha-junit-reporter": "^1.18.0", "mocha-multi": "^1.0.1", "mochawesome": "^3.1.1", - "nativescript-dev-appium": "^4.0.9", - "nativescript-dev-webpack": "~0.21.0", - "nativescript-dev-typescript": "~0.9.0", - "nativescript-vue-template-compiler": "^2.0.0", + "nativescript-dev-appium": "~5.2.0", + "nativescript-dev-webpack": "~0.24.0", + "nativescript-dev-typescript": "~0.10.0", + "nativescript-vue-template-compiler": "~2.2.0", "node-sass": "~4.9.0", "vue-loader": "~15.4.0" }, diff --git a/demo-vue/webpack.config.js b/demo-vue/webpack.config.js deleted file mode 100644 index 0880900..0000000 --- a/demo-vue/webpack.config.js +++ /dev/null @@ -1,266 +0,0 @@ -const { relative, resolve, sep } = require("path"); - -const webpack = require("webpack"); -const CleanWebpackPlugin = require("clean-webpack-plugin"); -const CopyWebpackPlugin = require("copy-webpack-plugin"); -const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); -const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); - -const VueLoaderPlugin = require('vue-loader/lib/plugin'); -const NsVueTemplateCompiler = require("nativescript-vue-template-compiler"); - -const nsWebpack = require("nativescript-dev-webpack"); -const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target"); -const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin"); - -module.exports = env => { - // Add your custom Activities, Services and other android app components here. - const appComponents = [ - "tns-core-modules/ui/frame", - "tns-core-modules/ui/frame/activity", - ]; - - const platform = env && (env.android && "android" || env.ios && "ios"); - if (!platform) { - throw new Error("You need to provide a target platform!"); - } - - const platforms = ["ios", "android"]; - const projectRoot = __dirname; - - // Default destination inside platforms//... - const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot)); - const appResourcesPlatformDir = platform === "android" ? "Android" : "iOS"; - - const { - // The 'appPath' and 'appResourcesPath' values are fetched from - // the nsconfig.json configuration file - // when bundling with `tns run android|ios --bundle`. - appPath = "app", - appResourcesPath = "app/App_Resources", - - // You can provide the following flags when running 'tns run android|ios' - snapshot, // --env.snapshot - production, // --env.production - report, // --env.report - hmr, // --env.hmr - } = env; - - const externals = (env.externals || []).map((e) => { // --env.externals - return new RegExp(e + ".*"); - }); - - const mode = production ? "production" : "development" - - const appFullPath = resolve(projectRoot, appPath); - const appResourcesFullPath = resolve(projectRoot, appResourcesPath); - - const entryModule = nsWebpack.getEntryModule(appFullPath); - const entryPath = `.${sep}${entryModule}.js`; - console.log(`Bundling application for entryPath ${entryPath}...`); - - const config = { - mode: mode, - context: appFullPath, - externals, - watchOptions: { - ignored: [ - appResourcesFullPath, - // Don't watch hidden files - "**/.*", - ], - }, - target: nativescriptTarget, - // target: nativeScriptVueTarget, - entry: { - bundle: entryPath, - }, - output: { - pathinfo: false, - path: dist, - libraryTarget: "commonjs2", - filename: "[name].js", - globalObject: "global", - }, - resolve: { - extensions: [".vue", ".js", ".scss", ".css"], - // Resolve {N} system modules from tns-core-modules - modules: [ - resolve(__dirname, "node_modules/tns-core-modules"), - resolve(__dirname, "node_modules"), - "node_modules/tns-core-modules", - "node_modules", - ], - alias: { - '~': appFullPath, - '@': appFullPath, - 'vue': 'nativescript-vue' - }, - // don't resolve symlinks to symlinked modules - symlinks: false, - }, - resolveLoader: { - // don't resolve symlinks to symlinked loaders - symlinks: false, - }, - node: { - // Disable node shims that conflict with NativeScript - "http": false, - "timers": false, - "setImmediate": false, - "fs": "empty", - "__dirname": false, - }, - devtool: "none", - optimization: { - splitChunks: { - cacheGroups: { - vendor: { - name: "vendor", - chunks: "all", - test: (module) => { - const moduleName = module.nameForCondition ? module.nameForCondition() : ''; - return /[\\/]node_modules[\\/]/.test(moduleName) || - appComponents.some(comp => comp === moduleName); - - }, - enforce: true, - }, - }, - }, - minimize: Boolean(production), - minimizer: [ - new UglifyJsPlugin({ - parallel: true, - cache: true, - uglifyOptions: { - output: { - comments: false, - }, - compress: { - // The Android SBG has problems parsing the output - // when these options are enabled - 'collapse_vars': platform !== "android", - sequences: platform !== "android", - }, - }, - }), - ], - }, - module: { - rules: [{ - test: new RegExp(entryPath), - use: [ - // Require all Android app components - platform === "android" && { - loader: "nativescript-dev-webpack/android-app-components-loader", - options: { modules: appComponents }, - }, - - { - loader: "nativescript-dev-webpack/bundle-config-loader", - options: { - registerPages: true, // applicable only for non-angular apps - loadCss: !snapshot, // load the application css if in debug mode - }, - }, - ].filter(loader => Boolean(loader)), - }, - { - test: /\.css$/, - use: [ - 'nativescript-dev-webpack/style-hot-loader', - 'nativescript-dev-webpack/apply-css-loader.js', - { loader: "css-loader", options: { minimize: false, url: false } }, - ], - }, - { - test: /\.scss$/, - use: [ - 'nativescript-dev-webpack/style-hot-loader', - 'nativescript-dev-webpack/apply-css-loader.js', - { loader: "css-loader", options: { minimize: false, url: false } }, - "sass-loader", - ], - }, - { - test: /\.js$/, - loader: 'babel-loader', - }, - { - test: /\.vue$/, - loader: "vue-loader", - options: { - compiler: NsVueTemplateCompiler, - }, - }, - ], - }, - plugins: [ - // ... Vue Loader plugin omitted - // make sure to include the plugin! - new VueLoaderPlugin(), - // Define useful constants like TNS_WEBPACK - new webpack.DefinePlugin({ - "global.TNS_WEBPACK": "true", - "TNS_ENV": JSON.stringify(mode) - }), - // Remove all files from the out dir. - new CleanWebpackPlugin([`${dist}/**/*`]), - // Copy native app resources to out dir. - new CopyWebpackPlugin([{ - from: `${appResourcesFullPath}/${appResourcesPlatformDir}`, - to: `${dist}/App_Resources/${appResourcesPlatformDir}`, - context: projectRoot, - }]), - // Copy assets to out dir. Add your own globs as needed. - new CopyWebpackPlugin([ - { from: { glob: "fonts/**" } }, - { from: { glob: "**/*.+(jpg|png)" } }, - { from: { glob: "assets/**/*" } }, - ], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }), - // Generate a bundle starter script and activate it in package.json - new nsWebpack.GenerateBundleStarterPlugin([ - "./vendor", - "./bundle", - ]), - // For instructions on how to set up workers with webpack - // check out https://github.com/nativescript/worker-loader - new NativeScriptWorkerPlugin(), - new nsWebpack.PlatformFSPlugin({ - platform, - platforms, - }), - // Does IPC communication with the {N} CLI to notify events when running in watch mode. - new nsWebpack.WatchStateLoggerPlugin(), - ], - }; - - if (report) { - // Generate report files for bundles content - config.plugins.push(new BundleAnalyzerPlugin({ - analyzerMode: "static", - openAnalyzer: false, - generateStatsFile: true, - reportFilename: resolve(projectRoot, "report", `report.html`), - statsFilename: resolve(projectRoot, "report", `stats.json`), - })); - } - - if (snapshot) { - config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({ - chunk: "vendor", - requireModules: [ - "tns-core-modules/bundle-entry-points", - ], - projectRoot, - webpackConfig: config, - })); - } - - if (hmr) { - config.plugins.push(new webpack.HotModuleReplacementPlugin()); - } - - return config; -}; \ No newline at end of file diff --git a/demo/app/package.json b/demo/app/package.json index 84c391d..3a445f7 100644 --- a/demo/app/package.json +++ b/demo/app/package.json @@ -3,7 +3,5 @@ "v8Flags": "--expose_gc", "requireModules": ["nativescript-imagepicker"] }, - "main": "app.js", - "name": "tns-template-hello-world", - "version": "3.1.0" + "main": "app.js" } diff --git a/demo/e2e/config/appium.capabilities.json b/demo/e2e/config/appium.capabilities.json index 0d81c9b..1333fc5 100644 --- a/demo/e2e/config/appium.capabilities.json +++ b/demo/e2e/config/appium.capabilities.json @@ -2,8 +2,8 @@ "android23.local": { "platformName": "Android", "platformVersion": "6.0", - "deviceName": "Emulator_Api23_Default", - "avd": "Emulator_Api23_Default", + "deviceName": "Emulator-Api23-Default", + "avd": "Emulator-Api23-Default", "noReset": true }, "android23": { @@ -13,6 +13,22 @@ "appium-version": "1.7.1", "noReset": true }, + "android24": { + "platformName": "Android", + "platformVersion": "7.0", + "deviceName": "Android GoogleAPI Emulator", + "appiumVersion": "1.9.1", + "noReset": true, + "app": "" + }, + "android24.local": { + "platformName": "Android", + "platformVersion": "7.0", + "deviceName": "Emulator-Api24-Default", + "avd": "Emulator-Api24-Default", + "appiumVersion": "1.9.1", + "noReset": true + }, "android25": { "platformName": "Android", "platformVersion": "7.1", @@ -41,5 +57,18 @@ "deviceName": "iPhone 6", "appium-version": "1.7.1", "app": "" + }, + "sim12iPhoneX":{ + "platformName": "iOS", + "platformVersion": "12.0", + "deviceName": "iPhone X", + "appium-version": "1.9.1", + "app": "", + "noReset": true, + "fullReset": false, + "density": 3, + "offsetPixels": 87, + "idleTimeout": 120, + "automationName": "Appium" } } \ No newline at end of file diff --git a/demo/e2e/test.e2e.ts b/demo/e2e/test.e2e.ts index a43b27c..5a56a2d 100644 --- a/demo/e2e/test.e2e.ts +++ b/demo/e2e/test.e2e.ts @@ -64,16 +64,19 @@ describe("Imagepicker", async function () { if (isSauceRun && imagesFolder) { await imagesFolder.click(); + let dcimFolder = await driver.findElementByText("DCIM", SearchOptions.contains); + await dcimFolder.click(); imagesFolder = await driver.findElementByClassName(driver.locators.image); await imagesFolder.click(); } } else { - const cameraRollFolder = await driver.findElementByText(imagesFolderNameIos); + const cameraRollFolder = await driver.findElementByAccessibilityId(imagesFolderNameIos); await cameraRollFolder.click(); } - const pickedImage = await driver.findElementByClassName(driver.locators.image); - await pickedImage.click(); + const imageLocator = isAndroid ? "android.widget.ImageView" : "XCUIElementTypeCell"; + const image = await driver.findElementByClassName(imageLocator); + await image.tap(); pickSingleButton = await driver.findElementByText(pickSingleButtonText, SearchOptions.contains); expect(pickSingleButton).to.exist; @@ -96,12 +99,12 @@ describe("Imagepicker", async function () { await cameraRollFolder.click(); } - const allImages = await driver.findElementsByClassName(driver.locators.image); - if (isAndroid) { - await allImages[8].hold(); // third image - await allImages[4].click(); // second image + const allImages = await driver.findElementsByClassName("android.widget.ImageView"); + await allImages[5].hold(); // second Image + await allImages[2].click(); // first image } else { + const allImages = await driver.findElementsByClassName("XCUIElementTypeCell"); await allImages[0].click(); // first image await allImages[1].click(); // second image } diff --git a/demo/package.json b/demo/package.json index e5ff501..d323891 100644 --- a/demo/package.json +++ b/demo/package.json @@ -2,10 +2,10 @@ "nativescript": { "id": "org.nativescript.imagepickerdemo", "tns-android": { - "version": "5.3.0" + "version": "5.4.0" }, "tns-ios": { - "version": "5.3.0" + "version": "5.4.0" } }, "dependencies": { @@ -29,9 +29,9 @@ "mocha-multi": "^1.0.1", "mochawesome": "^3.1.1", "nativescript-css-loader": "~0.26.0", - "nativescript-dev-appium": "4.0.9", - "nativescript-dev-typescript": "~0.9.0", - "nativescript-dev-webpack": "~0.21.0", + "nativescript-dev-appium": "~5.2.0", + "nativescript-dev-typescript": "~0.10.0", + "nativescript-dev-webpack": "~0.24.0", "tns-platform-declarations": "^5.0.0", "tslint": "~5.11.0" }, diff --git a/src/package.json b/src/package.json index 714b04f..18428d4 100644 --- a/src/package.json +++ b/src/package.json @@ -48,7 +48,7 @@ "devDependencies": { "tns-core-modules": "^5.0.0", "tns-platform-declarations": "^5.0.0", - "typescript": "~3.1.6", + "typescript": "~3.4.5", "tslint": "~5.11.0" }, "dependencies": {