This folder contains examples for using image injection on real devices for:
NOTE: this feature is NOT supported for emulators and simulators!!
The examples in this repository use environment variables, make sure you've added the following
# For Sauce Labs Emulators/Simulators/Real devices
export SAUCE_USERNAME=********
export SAUCE_ACCESS_KEY=*******
The demo app that has been used for all these tests can be found here. Be aware of the fact that and iOS simulator uses a different build then a iOS real device. So please check the file you download.
The advice is to download the files to an
appsfolder in the root of this folder.
Make sure that when you downloaded the files from the releases page, that you rename the apps to the following:
Android-MyDemoAppRN.{#.#.#}.build-{####}.apk=>Android.MyDemoAppRN.apkiOS-Real-Device-MyRNDemoApp.{#.#.#}-{####}.ipa=>iOS.MyDemoAppRN.ipaiOS-Simulator-MyRNDemoApp.{#.#.#}-{####}.zip=>iOS.MyDemoAppRN.zip
If you don't do that then the scripts can't find the apps!
If you want to use Android emulators, Android real devices, iOS simulators or iOS real devices in the Sauce Labs platform, you need to upload the apps to the Sauce Storage.
Execute the following steps to manually upload the apps:
- Login to the Sauce Labs platform
- Go to LIVE > Mobile App
- Click on App Upload and OR select the folder, OR drag the apps to the screen to upload them
You can find a script to upload them to, OR the US, OR EU DC in this-file. You can push the files to the
storage by doing the following from the folder appium-app-examples:
cd src/test/java/com/helpers/
push_apps_to_storage.sh
If you want to run the tests on Sauce Labs real devices then you can run the Android test with
// If using the US DC
mvn clean test -Dtest=ImageInjectionAndroidTest -Dregion=us
// If using the EU DC
mvn clean test -Dtest=ImageInjectionAndroidTest -Dregion=eu
The tests will be executed on a Samsung Galaxy 12.
NOTE: Make sure you are in the folder
appium-app-exampleswhen you execute this command
If you want to run the tests on Sauce Labs real devices then you can run the iOS test with
// If using the US DC
mvn clean test -Dtest=ImageInjectionIosTest -Dregion=us
// If using the EU DC
mvn clean test -Dtest=ImageInjectionIosTest -Dregion=eu
The tests will be executed on an iPhone 14.
NOTE: Make sure you are in the folder
appium-app-exampleswhen you execute this command
Huge thanks to Wim Selles. He develops and maintains the Sauce Labs demo-js repository. The js repo inspired the examples in this repository. Thanks my friend.