e2e: nightly fixes
This commit is contained in:
parent
c2c79cc1ac
commit
8978e92042
|
@ -12,7 +12,7 @@ from support.appium_container import AppiumContainer
|
||||||
from support.test_data import TestSuiteData
|
from support.test_data import TestSuiteData
|
||||||
|
|
||||||
|
|
||||||
async def start_threads(quantity: int, func: type, returns: dict, *args):
|
async def start_threads(test_name: str, quantity: int, func: type, returns: dict, *args):
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
# from tests.conftest import sauce
|
# from tests.conftest import sauce
|
||||||
# for _ in range(60):
|
# for _ in range(60):
|
||||||
|
@ -26,7 +26,7 @@ async def start_threads(quantity: int, func: type, returns: dict, *args):
|
||||||
returns[k] = await returns[k]
|
returns[k] = await returns[k]
|
||||||
break
|
break
|
||||||
except MaxRetryError:
|
except MaxRetryError:
|
||||||
print("MaxRetryError when creating a driver")
|
print("MaxRetryError when creating a driver for %s" % test_name)
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
return returns
|
return returns
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,8 @@ def create_shared_drivers(quantity):
|
||||||
capabilities = {'maxDuration': 3600}
|
capabilities = {'maxDuration': 3600}
|
||||||
print('SC Executor: %s' % executor_sauce_lab)
|
print('SC Executor: %s' % executor_sauce_lab)
|
||||||
try:
|
try:
|
||||||
drivers = loop.run_until_complete(start_threads(quantity,
|
drivers = loop.run_until_complete(start_threads(test_suite_data.current_test.name,
|
||||||
|
quantity,
|
||||||
Driver,
|
Driver,
|
||||||
drivers,
|
drivers,
|
||||||
executor_sauce_lab,
|
executor_sauce_lab,
|
||||||
|
@ -310,7 +311,7 @@ def create_shared_drivers(quantity):
|
||||||
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
|
||||||
return drivers, loop
|
return drivers, loop
|
||||||
except MaxRetryError as e:
|
except (MaxRetryError, AttributeError) as e:
|
||||||
test_suite_data.current_test.testruns[-1].error += "%s" % e.reason
|
test_suite_data.current_test.testruns[-1].error += "%s" % e.reason
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
@ -394,31 +395,34 @@ class SauceSharedMultipleDeviceTestCase(AbstractTestCase):
|
||||||
from tests.conftest import sauce
|
from tests.conftest import sauce
|
||||||
requests_session = requests.Session()
|
requests_session = requests.Session()
|
||||||
requests_session.auth = (sauce_username, sauce_access_key)
|
requests_session.auth = (sauce_username, sauce_access_key)
|
||||||
if cls.drivers:
|
try:
|
||||||
for _, driver in cls.drivers.items():
|
cls.drivers
|
||||||
session_id = driver.session_id
|
except AttributeError:
|
||||||
try:
|
pass
|
||||||
sauce.jobs.update_job(username=sauce_username, job_id=session_id, name=cls.__name__)
|
for _, driver in cls.drivers.items():
|
||||||
except (RemoteDisconnected, SauceException):
|
session_id = driver.session_id
|
||||||
pass
|
try:
|
||||||
try:
|
sauce.jobs.update_job(username=sauce_username, job_id=session_id, name=cls.__name__)
|
||||||
driver.quit()
|
except (RemoteDisconnected, SauceException):
|
||||||
except WebDriverException:
|
pass
|
||||||
pass
|
try:
|
||||||
url = 'https://api.%s/rest/v1/%s/jobs/%s/assets/%s' % (apibase, sauce_username, session_id, "log.json")
|
driver.quit()
|
||||||
try:
|
except WebDriverException:
|
||||||
WebDriverWait(driver, 60, 2).until(lambda _: requests_session.get(url).status_code == 200)
|
pass
|
||||||
commands = requests_session.get(url).json()
|
url = 'https://api.%s/rest/v1/%s/jobs/%s/assets/%s' % (apibase, sauce_username, session_id, "log.json")
|
||||||
for command in commands:
|
try:
|
||||||
try:
|
WebDriverWait(driver, 60, 2).until(lambda _: requests_session.get(url).status_code == 200)
|
||||||
if command['message'].startswith("Started "):
|
commands = requests_session.get(url).json()
|
||||||
for test in test_suite_data.tests:
|
for command in commands:
|
||||||
if command['message'] == "Started %s" % test.name:
|
try:
|
||||||
test.testruns[-1].first_commands[session_id] = commands.index(command) + 1
|
if command['message'].startswith("Started "):
|
||||||
except KeyError:
|
for test in test_suite_data.tests:
|
||||||
continue
|
if command['message'] == "Started %s" % test.name:
|
||||||
except (RemoteDisconnected, requests.exceptions.ConnectionError):
|
test.testruns[-1].first_commands[session_id] = commands.index(command) + 1
|
||||||
pass
|
except KeyError:
|
||||||
|
continue
|
||||||
|
except (RemoteDisconnected, requests.exceptions.ConnectionError):
|
||||||
|
pass
|
||||||
if cls.loop:
|
if cls.loop:
|
||||||
cls.loop.close()
|
cls.loop.close()
|
||||||
for test in test_suite_data.tests:
|
for test in test_suite_data.tests:
|
||||||
|
|
|
@ -1285,8 +1285,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
|
||||||
|
|
||||||
self.home_2.just_fyi('Device2 checks "Sending" status when sending message from offline')
|
self.home_2.just_fyi('Device2 checks "Sending" status when sending message from offline')
|
||||||
self.chat_2.send_message(message_1)
|
self.chat_2.send_message(message_1)
|
||||||
chat_element = self.chat_2.chat_element_by_text(message_1)
|
status = self.chat_2.chat_element_by_text(message_1).status
|
||||||
status = chat_element.status
|
|
||||||
if not (status == 'Sending' or status == 'Sent'):
|
if not (status == 'Sending' or status == 'Sent'):
|
||||||
self.errors.append('Message status is not "Sending", it is "%s"!' % status)
|
self.errors.append('Message status is not "Sending", it is "%s"!' % status)
|
||||||
|
|
||||||
|
@ -1304,7 +1303,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
|
||||||
|
|
||||||
self.home_2.just_fyi('Device1 goes back online and checks that 1-1 chat will be fetched')
|
self.home_2.just_fyi('Device1 goes back online and checks that 1-1 chat will be fetched')
|
||||||
try:
|
try:
|
||||||
chat_element.wait_for_status_to_be(expected_status='Delivered', timeout=120)
|
self.chat_2.chat_element_by_text(message_1).wait_for_status_to_be(expected_status='Delivered', timeout=120)
|
||||||
except TimeoutException as e:
|
except TimeoutException as e:
|
||||||
self.errors.append('%s after back up online!' % e.msg)
|
self.errors.append('%s after back up online!' % e.msg)
|
||||||
self.errors.verify_no_errors()
|
self.errors.verify_no_errors()
|
||||||
|
|
|
@ -399,6 +399,7 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
|
||||||
|
|
||||||
if not pytest_config_global['pr_number']:
|
if not pytest_config_global['pr_number']:
|
||||||
self.home.just_fyi("Perform back up")
|
self.home.just_fyi("Perform back up")
|
||||||
|
self.home.click_system_back_button_until_element_is_shown()
|
||||||
self.home.profile_button.click()
|
self.home.profile_button.click()
|
||||||
profile.sync_settings_button.click()
|
profile.sync_settings_button.click()
|
||||||
profile.backup_settings_button.click()
|
profile.backup_settings_button.click()
|
||||||
|
|
Loading…
Reference in New Issue