From e6a7c420a2d93228ebfc213eca3842f60e61d1ca Mon Sep 17 00:00:00 2001 From: Yevheniia Berdnyk Date: Wed, 22 Nov 2023 21:03:34 +0200 Subject: [PATCH] e2e: APK upload time limit increased --- test/appium/tests/conftest.py | 13 ++++++++++--- .../tests/critical/chats/test_1_1_public_chats.py | 7 ++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/test/appium/tests/conftest.py b/test/appium/tests/conftest.py index 23598023da1..74082291a7a 100644 --- a/test/appium/tests/conftest.py +++ b/test/appium/tests/conftest.py @@ -7,7 +7,7 @@ from datetime import datetime from http.client import RemoteDisconnected from os import environ -from time import sleep +import time import pytest from _pytest.runner import runtestprotocol @@ -169,15 +169,19 @@ def signal_handler(signum, frame): signal.signal(signal.SIGALRM, signal_handler) signal.alarm(seconds) try: + start_time = time.time() yield + print("Apk upload took %s seconds" % round(time.time() - start_time)) finally: signal.alarm(0) + class UploadApkException(Exception): pass + def _upload_and_check_response(apk_file_path): - with _upload_time_limit(600): + with _upload_time_limit(1000): with open(apk_file_path, 'rb') as f: resp = sauce.storage._session.request('post', '/v1/storage/upload', files={'payload': f}) @@ -187,13 +191,15 @@ def _upload_and_check_response(apk_file_path): except KeyError: raise UploadApkException("Error when uploading apk to Sauce storage, response:\n%s" % resp) + def _upload_and_check_response_with_retries(apk_file_path, retries=3): for _ in range(retries): try: _upload_and_check_response(apk_file_path) break except (ConnectionError, RemoteDisconnected): - sleep(10) + time.sleep(10) + def _download_apk(url): # Absolute path adde to handle CI runs. @@ -212,6 +218,7 @@ def _download_apk(url): return apk_path + def pytest_configure(config): global option option = config.option diff --git a/test/appium/tests/critical/chats/test_1_1_public_chats.py b/test/appium/tests/critical/chats/test_1_1_public_chats.py index e163bba8e52..5bc306b9656 100644 --- a/test/appium/tests/critical/chats/test_1_1_public_chats.py +++ b/test/appium/tests/critical/chats/test_1_1_public_chats.py @@ -155,17 +155,18 @@ def test_1_1_chat_emoji_send_reply_and_open_link(self): self.chat_2.set_reaction(url_message) try: self.chat_1.chat_element_by_text(url_message).emojis_below_message().wait_for_element_text(1) - except Failed: + except (Failed, NoSuchElementException): self.errors.append("Link message reaction is not shown for the sender") self.home_2.just_fyi("Check 'Open in Status' option") - url_to_open = 'http://status.app' + # url_to_open = 'http://status.app' + url_to_open = 'https://github.com/' self.chat_1.send_message(url_to_open) chat_element = self.chat_2.chat_element_by_text(url_to_open) if chat_element.is_element_displayed(120): chat_element.click_on_link_inside_message_body() web_view = self.chat_2.open_in_status_button.click() - if not web_view.element_by_text('Make the jump to web3').is_element_displayed(60): + if not web_view.element_by_text("Let’s build from here").is_element_displayed(60): self.errors.append('URL was not opened from 1-1 chat') else: self.errors.append("Message with URL was not received")