e2e: nightly fixes

This commit is contained in:
Yevheniia Berdnyk 2023-07-04 20:26:05 +03:00
parent c2c79cc1ac
commit 8978e92042
No known key found for this signature in database
GPG Key ID: 0642C73C66214825
4 changed files with 36 additions and 32 deletions

View File

@ -12,7 +12,7 @@ from support.appium_container import AppiumContainer
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()
# from tests.conftest import sauce
# for _ in range(60):
@ -26,7 +26,7 @@ async def start_threads(quantity: int, func: type, returns: dict, *args):
returns[k] = await returns[k]
break
except MaxRetryError:
print("MaxRetryError when creating a driver")
print("MaxRetryError when creating a driver for %s" % test_name)
time.sleep(10)
return returns

View File

@ -299,7 +299,8 @@ def create_shared_drivers(quantity):
capabilities = {'maxDuration': 3600}
print('SC Executor: %s' % executor_sauce_lab)
try:
drivers = loop.run_until_complete(start_threads(quantity,
drivers = loop.run_until_complete(start_threads(test_suite_data.current_test.name,
quantity,
Driver,
drivers,
executor_sauce_lab,
@ -310,7 +311,7 @@ def create_shared_drivers(quantity):
if len(drivers) < quantity:
test_suite_data.current_test.testruns[-1].error = "Not all %s drivers are created" % quantity
return drivers, loop
except MaxRetryError as e:
except (MaxRetryError, AttributeError) as e:
test_suite_data.current_test.testruns[-1].error += "%s" % e.reason
raise e
@ -394,31 +395,34 @@ class SauceSharedMultipleDeviceTestCase(AbstractTestCase):
from tests.conftest import sauce
requests_session = requests.Session()
requests_session.auth = (sauce_username, sauce_access_key)
if cls.drivers:
for _, driver in cls.drivers.items():
session_id = driver.session_id
try:
sauce.jobs.update_job(username=sauce_username, job_id=session_id, name=cls.__name__)
except (RemoteDisconnected, SauceException):
pass
try:
driver.quit()
except WebDriverException:
pass
url = 'https://api.%s/rest/v1/%s/jobs/%s/assets/%s' % (apibase, sauce_username, session_id, "log.json")
try:
WebDriverWait(driver, 60, 2).until(lambda _: requests_session.get(url).status_code == 200)
commands = requests_session.get(url).json()
for command in commands:
try:
if command['message'].startswith("Started "):
for test in test_suite_data.tests:
if command['message'] == "Started %s" % test.name:
test.testruns[-1].first_commands[session_id] = commands.index(command) + 1
except KeyError:
continue
except (RemoteDisconnected, requests.exceptions.ConnectionError):
pass
try:
cls.drivers
except AttributeError:
pass
for _, driver in cls.drivers.items():
session_id = driver.session_id
try:
sauce.jobs.update_job(username=sauce_username, job_id=session_id, name=cls.__name__)
except (RemoteDisconnected, SauceException):
pass
try:
driver.quit()
except WebDriverException:
pass
url = 'https://api.%s/rest/v1/%s/jobs/%s/assets/%s' % (apibase, sauce_username, session_id, "log.json")
try:
WebDriverWait(driver, 60, 2).until(lambda _: requests_session.get(url).status_code == 200)
commands = requests_session.get(url).json()
for command in commands:
try:
if command['message'].startswith("Started "):
for test in test_suite_data.tests:
if command['message'] == "Started %s" % test.name:
test.testruns[-1].first_commands[session_id] = commands.index(command) + 1
except KeyError:
continue
except (RemoteDisconnected, requests.exceptions.ConnectionError):
pass
if cls.loop:
cls.loop.close()
for test in test_suite_data.tests:

View File

@ -1285,8 +1285,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.home_2.just_fyi('Device2 checks "Sending" status when sending message from offline')
self.chat_2.send_message(message_1)
chat_element = self.chat_2.chat_element_by_text(message_1)
status = chat_element.status
status = self.chat_2.chat_element_by_text(message_1).status
if not (status == 'Sending' or status == 'Sent'):
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')
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:
self.errors.append('%s after back up online!' % e.msg)
self.errors.verify_no_errors()

View File

@ -399,6 +399,7 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
if not pytest_config_global['pr_number']:
self.home.just_fyi("Perform back up")
self.home.click_system_back_button_until_element_is_shown()
self.home.profile_button.click()
profile.sync_settings_button.click()
profile.backup_settings_button.click()