项目作者: Goraved

项目描述 :
Simple appium framework for the mobile automation tests
高级语言: Python
项目地址: git://github.com/Goraved/Typhon-Mobile.git
创建时间: 2019-12-14T19:33:38Z
项目社区:https://github.com/Goraved/Typhon-Mobile

开源协议:

下载


Typhon mobile tests (iOS/Android)

Automation tests for the mobile apps base on Python + Appium + BrowserStack

IMPORTANT!

Note! It’s just a template of mobile project with empty variables and test. To make it work need to specify all needed fields, tests, screen, locators and configs.

Setup

Brave yourself and read small instruction below.
I do not guarantee that you will understand something cause there are a lot of pitfalls with XCode and Appium versions. At first, make sure that you have a Developer provision profile and account from the app you gonna test. Then you need all the latest versions of:

  • XCode;
  • Android Studio;
  • Appium;
  • MacOS;
  • iOS;
    After that open WebDriverAgent project using XCode and add sign all WebDriverAgent in this project with your dev profile. And set the target version needed to your app.

Good luck!

Instruction:

Setup dev environment

Mobile tests project which supports iOS and Android using Appium.

This project is Python based, so you will need Python to work with it.
For reports generation Allure is used. Install it as well.

  1. brew install python3
  2. brew install Allure

In Terminal from the main project, folder do the following

  1. Setup the local virtual env python3 -m virtualenv venv
  2. Install all the requirements
    1. source venv/bin/activate
    2. pip install -r requirements.txt
    3. deactivate

Also, you can run the next script:

  1. sh scripts/venv.sh

Install Appium

  1. brew install node || apt-get install nodejs # get node.js
  2. npm install -g appium # get appium
  3. npm install wd # get appium client

Also the desktop version - https://github.com/appium/appium-desktop/releases

Android

  • Install JAVA
    1. brew cask install java
  • Install android sdk
  • Set correct Android path link:
    1. nano ~/.bash_profile
    1. export ANDROID_HOME=/YOUR_PATH_TO/android-sdk
    2. export PATH=$ANDROID_HOME/platform-tools:$PATH
    3. export PATH=$ANDROID_HOME/tools:$PATH
  • RESTART MAC!
  • Create emulator
    1. sdkmanager "system-images;android-28;google_apis;x86"
    2. avdmanager create avd -n test_emu -k "system-images;android-28;google_apis;x86" --device "pixel_xl"
    3. avdmanager list avd
    4. emulator -avd test_emu

    iOS

    It can be automated only on Mac.
    1. brew install libimobiledevice
    2. brew install ios-deploy
  1. Install Xcode
  2. Get the dev permissions to the iOS developer group
  3. Use guide to setup WebAgentRunner in the Xcode http://appium.io/docs/en/drivers/ios-xcuitest-real-devices/

Launch Mobile tests

Go to scripts dir. Execute the following script

  1. execute_tests.sh

Examples of capabilities

Android

  1. {
  2. "platformName": "android",
  3. "deviceName": "Pixel 2",
  4. "app": "test.apk",
  5. "autoGrantPermissions": true,
  6. "appPackage": "com.test.test.QA",
  7. "appActivity": "com.test.test.activities.TestLauncherActivity"
  8. }

iOS

  1. {
  2. "platformName": "iOS",
  3. "platformVersion": "13.3",
  4. "deviceName": "iPhone 7",
  5. "app": "test.ipa",
  6. "udid": "auto",
  7. "xcodeOrgId": "123123",
  8. "xcodeSigningId": "iPhone Developer",
  9. "autoAcceptAlerts": false,
  10. "noReset": true,
  11. "automationName": "XCUITest",
  12. "waitForQuiescence": false,
  13. "useNewWDA": true
  14. }

Required environment variables for the local run

KEY VALUE Desc
DEVICE pixel_device Key of devices from mobile_framework/mobile/devices.py
app_path test.apk; ABS path to the application
PLATFORM android android or ios

You can easily setup those variables using PyCharm: Run/Debug Configurations -> Edit Configurations -> Templates -> Python tests -> pytest -> Environment -> Environment variables

ADVISES!

  1. Try to use Appium Desktop cause it would be faster for you and you could easily setup correct desired capabilities;
  1. Creating a Test Automation Framework using Appium with Python
  2. Appium XCUITest Driver Real Device Setup

kill appium nodes

/usr/bin/killall -KILL node