ibalagurov / heisenbug_piter_2018_example

Demo of "one test for several platforms" approach: Web(Selenium) + iOS, Android(Appium) on Selene + Pytest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demo example for presentation [video]

target OS - Mac, so detailed install information provided only for it. What is it? Demo login test for "one test for several platforms" approach

What do you need? .app or/and .apk applications or/and web versions your application

Setup tools (if you don't have some of them)

  1. Install brew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Install Python 3.6+: brew install python3
  3. Install npm: brew install npm
  4. Install Appium server: npm install -g appium or look here
  5. For better debugging you can install Appium inspector
  6. Install Carthage: brew install carthage
  7. Install chrome browser (or use some other - look at driver configuration)
  8. Install xcode (for ios simulator)
  9. Install android studio or any android simulator
  10. Install Python dependencies: . ./scripts/install_deps.sh (Terminal from root project folder)
  11. I can miss something: you can try for example this

Customize for your application:

  1. Put ".app" or/and ".apk" into mobile app directory
  2. Add application names in config or environment variables:
    • export IOS_APP_NAME=my_app.app
    • export ANDROID_APP_NAME=my_app.apk
    • export LOGIN_PAGE_URL=https://my-app.com for web version
  3. Change locators for (there are some examples):
  4. Configure through env variables or configuration files:
    • export DEFAULT_LOGIN=admin
    • export DEFAULT_PASSWORD=1234
  5. If mobile app have environment choosing screen:

Customize for your environment:

  1. You also can configure devices, collecting browser logs and etc (through ANDROID_VERSION, ANDROID_DEVICE_NAME, IOS_VERSION, IOS_DEVICE_NAME variables)

Run tests:

  1. Run appium server appium for iOS or Android
  2. Choose platform export PLATFORM='WEB' or IOS or ANDROID
  3. Activate virtual environment with dependencies: pipenv shell
  4. Run tests python3 -m pytest tests/ui or just:
    • . ./scripts/run_ios_tests.sh
    • . ./scripts/run_android_tests.sh
    • . ./scripts/run_web_tests.sh

Useful links:

  1. Appium-python documentation
  2. Selene
  3. Pytest
  4. If you want to interact with some elements through pure selenium / appium look at commented method as example

About

Demo of "one test for several platforms" approach: Web(Selenium) + iOS, Android(Appium) on Selene + Pytest


Languages

Language:Python 94.4%Language:Shell 5.6%