Update python sample code (#12681)

This commit is contained in:
Isaac A. Murchie
2019-05-23 09:37:40 -04:00
committed by GitHub
parent 240810d028
commit eb4ddafc36
15 changed files with 215 additions and 147 deletions
@@ -1,9 +1,10 @@
import pytest
import os
import textwrap
import copy
from appium import webdriver
from helpers import take_screenhot_and_logcat, ANDROID_APP_PATH, EXECUTOR
from helpers import report_to_sauce, take_screenshot_and_logcat, ANDROID_BASE_CAPS, EXECUTOR
class TestAndroidBasicInteractions():
@@ -14,20 +15,19 @@ class TestAndroidBasicInteractions():
@pytest.fixture(scope='function')
def driver(self, request, device_logger):
calling_request = request._pyfuncitem.name
caps = copy.copy(ANDROID_BASE_CAPS)
caps['name'] = calling_request
caps['appActivity'] = self.SEARCH_ACTIVITY
driver = webdriver.Remote(
command_executor=EXECUTOR,
desired_capabilities={
'app': ANDROID_APP_PATH,
'platformName': 'Android',
'automationName': 'UIAutomator2',
'platformVersion': os.getenv('ANDROID_PLATFORM_VERSION') or '7.1',
'deviceName': os.getenv('ANDROID_DEVICE_VERSION') or 'Android',
'appActivity': self.SEARCH_ACTIVITY
}
desired_capabilities=caps
)
def fin():
take_screenhot_and_logcat(driver, device_logger, calling_request)
report_to_sauce(driver.session_id)
take_screenshot_and_logcat(driver, device_logger, calling_request)
driver.quit()
request.addfinalizer(fin)