Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f3538756a |
@@ -18,7 +18,7 @@ from selenium.webdriver.support.wait import WebDriverWait
|
|||||||
from urllib3.exceptions import MaxRetryError, ProtocolError
|
from urllib3.exceptions import MaxRetryError, ProtocolError
|
||||||
|
|
||||||
from support.api.network_api import NetworkApi
|
from support.api.network_api import NetworkApi
|
||||||
from tests import test_suite_data, start_threads, appium_container, pytest_config_global, transl
|
from tests import test_suite_data, start_threads, appium_container, pytest_config_global, transl, run_in_parallel
|
||||||
from tests.conftest import sauce_username, sauce_access_key, apibase, github_report, run_name
|
from tests.conftest import sauce_username, sauce_access_key, apibase, github_report, run_name
|
||||||
|
|
||||||
executor_sauce_lab = 'https://%s:%s@ondemand.%s:443/wd/hub' % (sauce_username, sauce_access_key, apibase)
|
executor_sauce_lab = 'https://%s:%s@ondemand.%s:443/wd/hub' % (sauce_username, sauce_access_key, apibase)
|
||||||
@@ -60,14 +60,11 @@ def add_local_devices_to_capabilities():
|
|||||||
return updated_capabilities
|
return updated_capabilities
|
||||||
|
|
||||||
|
|
||||||
def get_capabilities_sauce_lab():
|
def get_common_capabilities():
|
||||||
caps = dict()
|
caps = dict()
|
||||||
caps['platformName'] = 'Android'
|
caps['platformName'] = 'Android'
|
||||||
caps['idleTimeout'] = 1000
|
caps['idleTimeout'] = 1000
|
||||||
caps['appium:app'] = 'sauce-storage:' + test_suite_data.apk_name
|
|
||||||
caps['appium:deviceName'] = 'Android GoogleAPI Emulator'
|
|
||||||
caps['appium:deviceOrientation'] = 'portrait'
|
caps['appium:deviceOrientation'] = 'portrait'
|
||||||
caps['appium:platformVersion'] = '14.0'
|
|
||||||
caps['appium:automationName'] = 'UiAutomator2'
|
caps['appium:automationName'] = 'UiAutomator2'
|
||||||
caps['appium:newCommandTimeout'] = 600
|
caps['appium:newCommandTimeout'] = 600
|
||||||
caps['appium:idleTimeout'] = 1000
|
caps['appium:idleTimeout'] = 1000
|
||||||
@@ -81,7 +78,6 @@ def get_capabilities_sauce_lab():
|
|||||||
caps['appium:enforceXPath1'] = True
|
caps['appium:enforceXPath1'] = True
|
||||||
caps['enforceXPath1'] = True
|
caps['enforceXPath1'] = True
|
||||||
caps['sauce:options'] = dict()
|
caps['sauce:options'] = dict()
|
||||||
caps['sauce:options']['appiumVersion'] = '2.0.0'
|
|
||||||
caps['sauce:options']['username'] = sauce_username
|
caps['sauce:options']['username'] = sauce_username
|
||||||
caps['sauce:options']['accessKey'] = sauce_access_key
|
caps['sauce:options']['accessKey'] = sauce_access_key
|
||||||
caps['sauce:options']['build'] = run_name
|
caps['sauce:options']['build'] = run_name
|
||||||
@@ -89,6 +85,15 @@ def get_capabilities_sauce_lab():
|
|||||||
caps['sauce:options']['maxDuration'] = 3600
|
caps['sauce:options']['maxDuration'] = 3600
|
||||||
caps['sauce:options']['idleTimeout'] = 1000
|
caps['sauce:options']['idleTimeout'] = 1000
|
||||||
caps['sauce:options']['android.gpu.mode'] = 'hardware'
|
caps['sauce:options']['android.gpu.mode'] = 'hardware'
|
||||||
|
return caps
|
||||||
|
|
||||||
|
|
||||||
|
def get_capabilities_sauce_lab():
|
||||||
|
caps = get_common_capabilities()
|
||||||
|
caps['appium:app'] = 'sauce-storage:' + test_suite_data.apk_name
|
||||||
|
caps['appium:deviceName'] = 'Android GoogleAPI Emulator'
|
||||||
|
caps['appium:platformVersion'] = '14.0'
|
||||||
|
caps['sauce:options']['appiumVersion'] = '2.0.0'
|
||||||
|
|
||||||
options = AppiumOptions()
|
options = AppiumOptions()
|
||||||
options.load_capabilities(caps)
|
options.load_capabilities(caps)
|
||||||
@@ -96,10 +101,17 @@ def get_capabilities_sauce_lab():
|
|||||||
return options
|
return options
|
||||||
|
|
||||||
|
|
||||||
# def update_capabilities_sauce_lab(new_capabilities: dict):
|
def get_capabilities_real_device():
|
||||||
# caps = get_capabilities_sauce_lab().copy()
|
caps = get_common_capabilities()
|
||||||
# caps.update(new_capabilities)
|
caps['appium:app'] = 'sauce-storage:' + pytest_config_global['apk_real_device']
|
||||||
# return caps
|
caps['appium:deviceName'] = pytest_config_global['real_device_name']
|
||||||
|
caps['appium:platformVersion'] = '14'
|
||||||
|
caps['sauce:options']['appiumVersion'] = 'latest'
|
||||||
|
|
||||||
|
options = AppiumOptions()
|
||||||
|
options.load_capabilities(caps)
|
||||||
|
|
||||||
|
return options
|
||||||
|
|
||||||
|
|
||||||
def get_app_path():
|
def get_app_path():
|
||||||
@@ -306,12 +318,23 @@ def create_shared_drivers(quantity):
|
|||||||
asyncio.set_event_loop(loop)
|
asyncio.set_event_loop(loop)
|
||||||
print('SC Executor: %s' % executor_sauce_lab)
|
print('SC Executor: %s' % executor_sauce_lab)
|
||||||
try:
|
try:
|
||||||
drivers = loop.run_until_complete(start_threads(test_suite_data.current_test.name,
|
if pytest_config_global['apk_real_device']:
|
||||||
quantity,
|
commands = [
|
||||||
Driver,
|
(Driver, {'command_executor': executor_sauce_lab, 'options': get_capabilities_real_device()}),
|
||||||
drivers,
|
]
|
||||||
command_executor=executor_sauce_lab,
|
if quantity > 1:
|
||||||
options=get_capabilities_sauce_lab()))
|
for i in range(quantity - 1):
|
||||||
|
commands.append(
|
||||||
|
(Driver, {'command_executor': executor_sauce_lab, 'options': get_capabilities_sauce_lab()})
|
||||||
|
)
|
||||||
|
drivers = loop.run_until_complete(run_in_parallel((tuple(commands))))
|
||||||
|
else:
|
||||||
|
drivers = loop.run_until_complete(start_threads(test_suite_data.current_test.name,
|
||||||
|
quantity,
|
||||||
|
Driver,
|
||||||
|
drivers,
|
||||||
|
command_executor=executor_sauce_lab,
|
||||||
|
options=get_capabilities_sauce_lab()))
|
||||||
if len(drivers) < quantity:
|
if len(drivers) < quantity:
|
||||||
test_suite_data.current_test.testruns[-1].error = "Not all %s drivers are created" % quantity
|
test_suite_data.current_test.testruns[-1].error = "Not all %s drivers are created" % quantity
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ def pytest_addoption(parser):
|
|||||||
help='Android device platform version')
|
help='Android device platform version')
|
||||||
parser.addoption('--log_steps',
|
parser.addoption('--log_steps',
|
||||||
action='store',
|
action='store',
|
||||||
default=False,
|
default=True,
|
||||||
help='Display each test step in terminal as plain text: True/False')
|
help='Display each test step in terminal as plain text: True/False')
|
||||||
parser.addoption('--pr_number',
|
parser.addoption('--pr_number',
|
||||||
action='store',
|
action='store',
|
||||||
@@ -75,6 +75,16 @@ def pytest_addoption(parser):
|
|||||||
default=None,
|
default=None,
|
||||||
help='Url or local path to apk for upgrade')
|
help='Url or local path to apk for upgrade')
|
||||||
|
|
||||||
|
# running on real devices
|
||||||
|
parser.addoption('--apk_real_device',
|
||||||
|
action='store',
|
||||||
|
default=None,
|
||||||
|
help='Url or local path to apk to be run on real device')
|
||||||
|
parser.addoption('--real_device_name',
|
||||||
|
action='store',
|
||||||
|
default='Samsung Galaxy S.*',
|
||||||
|
help='Real device name or name pattern')
|
||||||
|
|
||||||
# chat bot
|
# chat bot
|
||||||
|
|
||||||
parser.addoption('--messages_number',
|
parser.addoption('--messages_number',
|
||||||
|
|||||||
@@ -579,6 +579,7 @@ class HomeView(BaseView):
|
|||||||
def get_link_to_profile(self):
|
def get_link_to_profile(self):
|
||||||
self.show_qr_code_button.click()
|
self.show_qr_code_button.click()
|
||||||
self.link_to_profile_button.click()
|
self.link_to_profile_button.click()
|
||||||
|
self.sharing_text_native.wait_for_visibility_of_element()
|
||||||
link_to_profile = self.sharing_text_native.text
|
link_to_profile = self.sharing_text_native.text
|
||||||
self.click_system_back_button()
|
self.click_system_back_button()
|
||||||
return link_to_profile
|
return link_to_profile
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import os
|
|||||||
|
|
||||||
from selenium.common.exceptions import NoSuchElementException
|
from selenium.common.exceptions import NoSuchElementException
|
||||||
|
|
||||||
from tests import common_password, appium_root_project_path
|
from tests import common_password, appium_root_project_path, pytest_config_global
|
||||||
from tests.base_test_case import get_app_path
|
from tests.base_test_case import get_app_path
|
||||||
from views.base_element import Button, EditBox, Text
|
from views.base_element import Button, EditBox, Text
|
||||||
from views.base_view import BaseView
|
from views.base_view import BaseView
|
||||||
@@ -244,8 +244,8 @@ class SignInView(BaseView):
|
|||||||
self.generate_keys_button.click_until_presence_of_element(self.profile_title_input)
|
self.generate_keys_button.click_until_presence_of_element(self.profile_title_input)
|
||||||
self.set_profile(username)
|
self.set_profile(username)
|
||||||
self.set_password(password)
|
self.set_password(password)
|
||||||
# if self.enable_biometric_maybe_later_button.is_element_displayed(10):
|
if pytest_config_global['apk_real_device']:
|
||||||
# self.enable_biometric_maybe_later_button.click()
|
self.enable_biometric_maybe_later_button.wait_and_click()
|
||||||
# self.next_button.click_until_absense_of_element(self.element_by_translation_id("intro-wizard-title2"))
|
# self.next_button.click_until_absense_of_element(self.element_by_translation_id("intro-wizard-title2"))
|
||||||
# if keycard:
|
# if keycard:
|
||||||
# keycard_flow = self.keycard_storage_button.click()
|
# keycard_flow = self.keycard_storage_button.click()
|
||||||
|
|||||||
Reference in New Issue
Block a user