mirror of
https://github.com/appium/appium.git
synced 2026-10-28 20:31:51 +08:00
Update python sample code (#12681)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user