e2e: APK upload time limit increased

This commit is contained in:
Yevheniia Berdnyk 2023-11-22 21:03:34 +02:00
parent 671aa67002
commit e6a7c420a2
No known key found for this signature in database
GPG Key ID: 0642C73C66214825
2 changed files with 14 additions and 6 deletions

View File

@ -7,7 +7,7 @@ from dataclasses import dataclass
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 _upload_time_limit(seconds):
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

View File

@ -155,17 +155,18 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
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("Lets 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")