This is the the project for creating and managing the IOS application automated tests
These instructions will get you up and running with Appium for IOS and the automation framework.
- Have brew installed: https://brew.sh/
- Install Node in Terminal:
$ brew install node
- Have Xcode installed through the Mac's app store.
- Make sure you have an Apple Developer account (preferably provided by DevOps).
- A real IOS device with the IOS app installed - iPhone 8 Plus
- Make sure the IOS device has "Enable UI Automation" switched on
Settings > Developer > Enable UI Automation
- Download and install Appium Desktop Client https://github.com/appium/appium-desktop/releases/
- Install appium server
$ npm install -g appium
(you can install specific version with [email protected] (e.g $ npm install -g [email protected])
- Install carthage
$ brew install carthage
- Install libimobiledevice
$ brew install libimobiledevice
- Install ios-deploy
Using brew:
$ brew install libimobiledevice
Using npm:
$ npm install -g ios-deploy
- Retrieve the directory where Appium server is installed on step 2. To set up the appium desktop jump to step 8.
$ which appium
/path/to/appium
- Go to the appium path
$ cd <path/to/appium>
- Go to Appium-desktop path (Only for Appium desktop)
$ cd //Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/
- Create WebDriverAgent bundle
$ mkdir -p Resources/WebDriverAgent.bundle
- Run script to fetch dependencies:
$ ./Scripts/bootstrap.sh -d
- Open the finder in the current directory
$ open .
-
Open WebDriverAgent.xcodeproj with Xcode
-
Make sure to add the IOS developer account to Xcode
Xcode > Preferences... > Accounts
Click "+" > Apple ID > Continue > add the account - ONLY IF THE REQUIRED ACCOUNT IS NOT LISTED
- Sign WebDriverAgentLib and WebDriverAgentRunner:
Target WebDriverAgentLib > General
1. Check Automatically manage signing
2. Select Team
3. Go to Build Settings and edit the "Product Bundle Identifier" add a custom name between facebook and WebDriverAgentLib (e.g. com.facebook.randomTEXT123.WebDriverAgentLibe)
4. Go back to General to see if everything is ok
5. Repeat steps 1-3 for WebDriverAgentRunner (use the same bundle identifier)
-
Connect the IOS device to the Mac and keep it unlocked
-
Go back to the Terminal and get the device udid:
$ idevice_id -l
udid will be displayed
- Copy udid and run
$ xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=<udid>' test
- The build will fail. Go to the IOS device and trust the developer account
Settings > General > Device Management > the developer account used > trust
-
Re-run step 17, wait until the script stops on Set-up
-
Interrupt the terminal (Ctrl + c)
- For server: Open Terminal -> $ appium
- For desktop: Open appium-desktop client
Please set up the following prepush git hook in .git/hooks/pre-push
#!/bin/sh
npm run prepush && git log -p | scanrepo
Please install and run the following securiy programs as part of your testing process:
https://github.com/awslabs/git-secrets
- After installing, do a one-time set up with
git secrets --register-aws
. Run withgit secrets --scan
.
https://github.com/UKHomeOffice/repo-security-scanner
- After installing, run with
git log -p | scanrepo
.
These will be run as part of prepush so please make sure you set up the git hook above so you don't accidentally introduce any new security vulnerabilities.
In the project structure create the file: cvs-auto-svc/src/main/resources/conf/environment.properties
(Do NOT add it to Git versioning !) The file should contain:
type=localBrowserstack
browserstack.username=<browserstack_username>
browserstack.password=<browserstack_password>
browserstack.hostname=hub-cloud.browserstack.com
browserstack.os.version=12
browserstack.device=iPhone 8 Plus
browserstack.local=false
browserstack.real.mobile=true
browserstack.app=bs://<browserstack_app_id>
browserstack.appium.version=1.18.0
browserstack.video.enabled=true
browserstack.timezone=UTC
browserstack.idle.timeout=150
browserstack.network.logs=true
browserstack.project.name=local
browserstack.build.name=local
browserstack.gpsLocation=51.5074,0.1278
app.token.url.v2=https://login.microsoftonline.com/<azure_app_id>/oauth2/v2.0/token
app.client.id.v2=<azure_client_id>
app.client.secret.v2=<azure_client_secret>
app.username=<app_username>
app.password=<app_userpass>
app.token.url=https://login.microsoftonline.com/<azure_app_id>/oauth2/token
app.client.id=<azure_client_id>
base.path.url=<test_environment_url>
waitForQuiescence=true
local.name=<your_name>
automationName=XCUITest
parallel.consumers=1
app.users=<app_username><staff_id><password>
- browserstack_app_id can be obtain via: DEVELOP_DISPLAY_BROWSERSTACK_ID or FEATURE_DISPLAY_BROWSERSTACK_ID Jenkins jobs
- azure_app_id and azure_client_id are provided by the devOps team
- app.users contains the value for the testerStaffId. This is based on the spike which concluded that it will require 3 API calls to get the testerStaffId while generating the Bearer Token and authenticating the API calls. It is not possible to run the tests without this value and have an impact on the regression suite
Running can be triggered from IntelliJ or via mvn command in the terminal
In Jenkins tests may be executed against either a branch or develop:
Execution is triggered via "Build with Parameters" job with the options to select the test group from the 'MVN_TAG' dropdown.
A full data reseed and the number of parallel threads are also optional
- Teodor Cosmin Alexandru - @teoAlexandru
- Laurentiu George Vasile - @lgvasile
- Bogdan Catalin Florea - @bflorea
- Dragos Panzaru - @dpanzaru
- Deepika Singh - @deepikasingh