e2e: APK upload time limit increased
This commit is contained in:
parent
671aa67002
commit
e6a7c420a2
|
@ -7,7 +7,7 @@ from dataclasses import dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from http.client import RemoteDisconnected
|
from http.client import RemoteDisconnected
|
||||||
from os import environ
|
from os import environ
|
||||||
from time import sleep
|
import time
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from _pytest.runner import runtestprotocol
|
from _pytest.runner import runtestprotocol
|
||||||
|
@ -169,15 +169,19 @@ def _upload_time_limit(seconds):
|
||||||
signal.signal(signal.SIGALRM, signal_handler)
|
signal.signal(signal.SIGALRM, signal_handler)
|
||||||
signal.alarm(seconds)
|
signal.alarm(seconds)
|
||||||
try:
|
try:
|
||||||
|
start_time = time.time()
|
||||||
yield
|
yield
|
||||||
|
print("Apk upload took %s seconds" % round(time.time() - start_time))
|
||||||
finally:
|
finally:
|
||||||
signal.alarm(0)
|
signal.alarm(0)
|
||||||
|
|
||||||
|
|
||||||
class UploadApkException(Exception):
|
class UploadApkException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def _upload_and_check_response(apk_file_path):
|
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:
|
with open(apk_file_path, 'rb') as f:
|
||||||
resp = sauce.storage._session.request('post', '/v1/storage/upload', files={'payload': 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:
|
except KeyError:
|
||||||
raise UploadApkException("Error when uploading apk to Sauce storage, response:\n%s" % resp)
|
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):
|
def _upload_and_check_response_with_retries(apk_file_path, retries=3):
|
||||||
for _ in range(retries):
|
for _ in range(retries):
|
||||||
try:
|
try:
|
||||||
_upload_and_check_response(apk_file_path)
|
_upload_and_check_response(apk_file_path)
|
||||||
break
|
break
|
||||||
except (ConnectionError, RemoteDisconnected):
|
except (ConnectionError, RemoteDisconnected):
|
||||||
sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
|
|
||||||
def _download_apk(url):
|
def _download_apk(url):
|
||||||
# Absolute path adde to handle CI runs.
|
# Absolute path adde to handle CI runs.
|
||||||
|
@ -212,6 +218,7 @@ def _download_apk(url):
|
||||||
|
|
||||||
return apk_path
|
return apk_path
|
||||||
|
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
global option
|
global option
|
||||||
option = config.option
|
option = config.option
|
||||||
|
|
|
@ -155,17 +155,18 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
|
||||||
self.chat_2.set_reaction(url_message)
|
self.chat_2.set_reaction(url_message)
|
||||||
try:
|
try:
|
||||||
self.chat_1.chat_element_by_text(url_message).emojis_below_message().wait_for_element_text(1)
|
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.errors.append("Link message reaction is not shown for the sender")
|
||||||
|
|
||||||
self.home_2.just_fyi("Check 'Open in Status' option")
|
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)
|
self.chat_1.send_message(url_to_open)
|
||||||
chat_element = self.chat_2.chat_element_by_text(url_to_open)
|
chat_element = self.chat_2.chat_element_by_text(url_to_open)
|
||||||
if chat_element.is_element_displayed(120):
|
if chat_element.is_element_displayed(120):
|
||||||
chat_element.click_on_link_inside_message_body()
|
chat_element.click_on_link_inside_message_body()
|
||||||
web_view = self.chat_2.open_in_status_button.click()
|
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')
|
self.errors.append('URL was not opened from 1-1 chat')
|
||||||
else:
|
else:
|
||||||
self.errors.append("Message with URL was not received")
|
self.errors.append("Message with URL was not received")
|
||||||
|
|
Loading…
Reference in New Issue