Skip to content

Instantly share code, notes, and snippets.

@hyperh
Created November 5, 2017 23:07
Show Gist options
  • Save hyperh/f5e940e94633b82090da47f88ca7e3f9 to your computer and use it in GitHub Desktop.
Save hyperh/f5e940e94633b82090da47f88ca7e3f9 to your computer and use it in GitHub Desktop.
import pytest
import os
from appium import webdriver
AWS = 'aws'
LOCAL = 'local'
def get_desired_capabilities(location=AWS):
if location == LOCAL:
return {
'app': os.path.expanduser(
'./android/app/build/outputs/apk/app-debug.apk'),
'platformName': 'Android',
'deviceName': 'Android Emulator'
}
else:
return {}
@pytest.fixture(scope="function")
def driver():
driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723/wd/hub',
desired_capabilities=get_desired_capabilities(
location=os.environ.get('LOCATION')
)
)
yield driver # Test code runs after this line
# Teardown
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment