Automation Tool: Appium
Automation Framework: Robot Framework
Appium Setup (macOS)
Common Setup For Android And iOS
Create a .bash_profile if not yet exist
command: touch ~/.bash_profile
Install Homebrew. Please find Homebrew and follow the instructions on this website:https://brew.sh/
command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Execute the following command to update .bash_profile for homebrew path
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/<yourusername>/.bash_profile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/<yourusername>/.bash_profile
eval "$(/opt/homebrew/bin/brew shellenv)"
Install Carthage (a dependency manager). To do this, open the Terminal window and run the following command:
brew install carthage
Install Node.js and NPM. To do this, run this command:
brew install node
Install Java
Download the JDK from this website:https://www.oracle.com/java/technologies/javase-downloads.html
Run the dowloaded installer and follow the instructions you will see on screen
Run the following command in the Terminal:
/usr/libexec/java_home --v
This will output a string like
/Library/Java/JavaVirtualMachines/jdk-18.0.2.1.jdk/Contents/Home
. This is the location of the JDK on your computer. Copy this value.Open your .bash_profile file in an editor and add the following two lines to it:
export JAVA_HOME="copied-path-to-JDK-directory"
export PATH=$JAVA_HOME/bin:$PATHSave the changes.
Restart the Terminal to grab the new .bash_profile settings.
Install Appium
Install Appium Desktop. You can download the installer from this website:https://github.com/appium/appium-desktop/releases
We also recommend that you install the Appium Doctor in addition to Appium. It will help you fix issues with Appium and Android settings easier. To install the Doctor, run the following command in the Terminal:
npm install -g appium-doctor
Additional Installation For Android
1. Install AndroidStudio
Download the installation package from the following website:https://developer.android.com/studio/
Run the installer and follow the instructions you will see on the screen.
When installing, make sure to select the Android Virtual Device component.
2. Configure AndroidStudio and Android SDKs
Start AndroidStudio.
In the Welcome dialog box, select Configure > SDK Manager. This will open the SDK Manager dialog box:
On the SDK Platforms tab, select the SDKs that you will need for testing.
Switch to the SDK Tools tab and make sure the following tools are selected there:
Android SDK Build-tools (Select the latest available version.)
Android SDK Platform-Tools
Intel x86 Emulator Accelerator (HAXM installer)
Copy the value of the Android SDK Location box at the top of the SDK Manager dialog. We will need this value later:
Now you need to specify the path to Android SDKs in the
ANDROID_HOME
environment variable. To do this, open the bash_profile in an editor and add the following lines to it:export ANDROID_HOME="copied-Android-SDK-location"
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-toolsRestart the Terminal to get changes made to your .bash_profile. Run the following command to ensure it does not cause an error:
$ adb devices
(Optional) You can also run Appium Doctor to see if anything else requires configuring before you start testing:
$ appium-doctor
Additional Installation For iOS
1. Install Xcode and Xcode command-line tools
Download Xcode:https://developer.apple.com/xcode/
Run the installer and follow the instructions you will see on the screen.
To install Xcode command-line tools, run the following command in the Terminal:
xcode-select --install
2. Update WebDriverAgent To Latest Version (Workaround step)
Issue: Xcode build the WebDriverAgentRunner is current failing (Original error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 70)
Fix: Update WebDriverAgent manually
Download latest version of WebDriverAgent: https://github.com/appium/WebDriverAgent/releases
Extract the downloaded and copy all the files from extracted folder
Paste and replace all files on the Appium webdriveragent folder installation
Navigate to Appium installation folder and show package content
Navigate to /Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent
Paste and replace all files on the appium-webdriveragent folder
3. Build WebDriverAgent On Xcode
WebDriverAgent is a WebDriver version for iOS. It serves for controlling iOS devices and apps remotely. You can find it in the appium-webdriveragent folder.
Open the WebDriverAgent.xcodeproj with Xcode
Update the Signing and Capabilities For WebDriverAgentRunner And IntegrationApp
Build the WebDriverAgent. It should not have any errors
Plugin the iOS device and should be detected then select it for target device
Build the WebDriverAgentRunner
The build should not have errors
4. Install WebDriverAgent On The Device
WebDriverAgent is a WebDriver version for iOS. It serves for controlling iOS devices and apps remotely.
Get the device ID
Run command to show device ID: ios-deploy -c
Install the webdriveragent
Open a terminal on the appium-webdriver folder (path: /Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent)
Run command to install webdriveragent on the target device by device ID:
xcodebuild build-for-testing test-without-building -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=00008110-001A59CC1EC0401E'
Note that the 1st build TEST EXECUTE FAILED. To fix this we need to allow the webdriveragent developer app to open on the device
Trust/Allow the webdriveragent to run on the device
Go to Settings > General > VPN & Device Management > Apple Development
Run again the command this should install and open the webdriveragent app on the device
xcodebuild build-for-testing test-without-building -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=00008110-001A59CC1EC0401E'
(Optional) Run the Appium Doctor to check if everything is configured properly.
Robot Framework Setup (macOS)
1. Install Python
2. Install Robot Framework
$ pip3 install robotframework
3. Install Robot Framework Libraries
$ pip3 install robotframework-appiumlibrary
$ pip3 install robotframework-seleniumlibrary
$ pip3 install robotframework-requests
$ pip3 install robotframework-jsonlibrary
Running The Tests
Pre-requisite:
1. Already onboarded an account on the device under test and enable the developer option mode on the device.
2. Update the phone number on the arg_file.robot for android or arg_file_ios.robot for iOS
Go to script folder
cd app/app_safi/system_test/src/safi-app
Run Appium server
appium
Open another terminal then run test
For Android
robot -A ./ui/arg_file.robot -i ALKANSAFEUNLOCKED .
For iOS
robot -A ./ui/arg_file_ios.robot -i ALKANSAFEUNLOCKED .
Test Results Logs
Attachments:
image-20230120-074123.png (image/png)
REC-20230120153038.mp4 (video/mp4)
image-20230120-071951.png (image/png)
image-20230120-070517.png (image/png)
image-20230120-070049.png (image/png)
image-20230120-052327.png (image/png)
image-20230120-052241.png (image/png)
image-20230120-052208.png (image/png)
image-20230120-052135.png (image/png)
image-20230120-052037.png (image/png)
image-20230120-051724.png (image/png)
image-20230120-051048.png (image/png)
image-20230120-050822.png (image/png)
image-20230120-050624.png (image/png)
image-20230120-050022.png (image/png)
image-20230120-045015.png (image/png)
image-20230120-044152.png (image/png)
image-20230120-044135.png (image/png)
image-20230120-043731.png (image/png)
image-20230120-043038.png (image/png)
image-20230120-042447.png (image/png)
image-20230120-014417.png (image/png)
image-20230119-075119.png (image/png)
image-20230119-071800.png (image/png)
image-20230119-071145.png (image/png)
image-20230119-065809.png (image/png)