Prerequisites:
- NodeJS 10 or 12
- NativeScript 6.5.0 or newer
- follow the CLI full setup guide for your operating system
Run the following command:
npm install
To be able to build an IPA file for deployment on real iOS devices, run the following command:
npm run setup.ios.real
Then copy the file .env.default.template
as .env.default
and fill out the missing environment variables in the section # iOS Real Device Build
.
To be able to run the E2E tests locally, you need to have Appium installed and running before running any of the testing commands below.
To install Appium globally using npm, run the following command:
npm i -g appium@latest
Now you should be able to run Appium like this:
appium
To be able to run the E2E tests on Sauce Labs, a few environment variables need to be set.
To do that, copy the file .env.default.template
as .env.default
and fill out the missing environment variables in the section # E2E Tests on Sauce Labs
.
To run anything iOS related, a macOS machine must be used. Everything considering Android runs on Windows, Mac or Linux.
To preview the app on a real device using NativeScript's preview app, run the following command:
npm run preview
To run the app on the Android Emulator, run the following command:
npm run run.android
To run the app on the iOS Simulator, run the following command:
npm run run.ios
To build the app as an .apk file, run the following command:
npm run build.android
You will then be able to find the built file in the following path:
build/wdio-mobile-utils-demo.apk
To build the app as an .app file to install on an iOS Simulator, run the following command:
npm run build.ios.sim
You will then be able to find the built file in the following path:
build/wdio-mobile-utils-demo.app
To build the app as an .ipa file to install on a real iOS device, run the following command:
npm run build.ios.real
You will then be able to find the built file in the following path:
build/wdio-mobile-utils-demo.ipa
To run the E2E tests using WebdriverIO, run the following commands depending on the type.
Make sure to check the corresponding config files inside /e2e/config/
and match the deviceName
and platformVersion
you use.
If you want to run the tests locally on an Emulator, make sure it is running before running any of the following commands!
npm run e2e.android.run # Runs the test locally
npm run e2e.android.debug # Runs the test locally in debug mode
npm run e2e.android.sauce # Runs the test on Sauce Labs RDC
npm run e2e.ios.sim.install # Runs the test locally and installs the app
npm run e2e.ios.sim.run # Runs the test locally using the already installed app
npm run e2e.ios.sim.debug # Runs the test locally using the already installed app in debug mode
npm run e2e.ios.sim.sauce # Runs the test on Sauce Labs Virtual Cloud
To run E2E tests on real iOS devices locally, remember after connecting the device to your Mac to enable the following in the settings of the device:
- Developer ->
Enable UI Automation
- Safari -> Advanced ->
Web Inspector
andRemote Automation
npm run e2e.ios.real.install # Runs the test locally and installs the app
npm run e2e.ios.real.run # Runs the test locally using the already installed app
npm run e2e.ios.real.debug # Runs the test locally using the already installed app in debug mode
npm run e2e.ios.real.sauce # Runs the test on Sauce Labs RDC
To run the tests on both Android and iOS at the same time in parallel, run one the following commands.
If you want to run the tests locally on an Android Emulator, make sure it is running before running any of the following commands!
npm run e2e.multiplatform.run # Runs the test locally on Android Emulator and iOS Simulator
npm run e2e.multiplatform.debug # Runs the test locally on Android Emulator and iOS Simulator in debug mode
npm run e2e.multiplatform.sauce # Runs the test on Sauce Labs RDC on both Android and iOS
To install or update iOS developer certificates using fastlane, run the following command:
npm run dev.build.ios.real.setup
To upload the built app to Sauce Labs, use the following commands depending on the type.
npm run e2e.android.upload.sauce
npm run e2e.ios.real.upload.sauce
npm run e2e.ios.sim.upload.sauce
To build a release, create a git tag on the master branch with the version number (in the format x.y.z) and push it. Travis CI will then take care of the rest and publish a release on GitHub releases.
Example:
git tag 1.0.0
git push --tags