Skip to content

Commit

Permalink
e2e: APK upload time limit increased
Browse files Browse the repository at this point in the history
  • Loading branch information
yevh-berdnyk committed Nov 23, 2023
1 parent 671aa67 commit e6a7c42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
13 changes: 10 additions & 3 deletions test/appium/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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})

Expand All @@ -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.
Expand All @@ -212,6 +218,7 @@ def _download_apk(url):

return apk_path


def pytest_configure(config):
global option
option = config.option
Expand Down
7 changes: 4 additions & 3 deletions test/appium/tests/critical/chats/test_1_1_public_chats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit e6a7c42

Please sign in to comment.