Fix for connection error
This commit is contained in:
parent
f2277371f0
commit
ad9b712bff
|
@ -5,7 +5,7 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
from http.client import RemoteDisconnected
|
from http.client import RemoteDisconnected
|
||||||
from re import findall
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import requests
|
import requests
|
||||||
|
@ -23,13 +23,13 @@ from tests import test_suite_data, start_threads, appium_container, pytest_confi
|
||||||
from tests import transl
|
from tests import transl
|
||||||
from tests.conftest import apibase
|
from tests.conftest import apibase
|
||||||
|
|
||||||
|
|
||||||
executor_sauce_lab = 'https://%s:%s@ondemand.%s:443/wd/hub' % (sauce_username, sauce_access_key, apibase)
|
executor_sauce_lab = 'https://%s:%s@ondemand.%s:443/wd/hub' % (sauce_username, sauce_access_key, apibase)
|
||||||
|
|
||||||
executor_local = 'http://localhost:4723/wd/hub'
|
executor_local = 'http://localhost:4723/wd/hub'
|
||||||
|
|
||||||
implicit_wait = 5
|
implicit_wait = 5
|
||||||
|
|
||||||
|
|
||||||
def get_capabilities_local():
|
def get_capabilities_local():
|
||||||
desired_caps = dict()
|
desired_caps = dict()
|
||||||
if pytest_config_global['docker']:
|
if pytest_config_global['docker']:
|
||||||
|
@ -105,7 +105,7 @@ class AbstractTestCase:
|
||||||
def app_path(self):
|
def app_path(self):
|
||||||
app_folder = 'im.status.ethereum'
|
app_folder = 'im.status.ethereum'
|
||||||
apk = pytest_config_global['apk']
|
apk = pytest_config_global['apk']
|
||||||
if findall(r'pr\d\d\d\d\d', apk) or findall(r'\d\d\d\d\d.apk', apk):
|
if re.findall(r'pr\d\d\d\d\d', apk) or re.findall(r'\d\d\d\d\d.apk', apk):
|
||||||
app_folder += '.pr'
|
app_folder += '.pr'
|
||||||
app_path = '/storage/emulated/0/Android/data/%s/files/Download/' % app_folder
|
app_path = '/storage/emulated/0/Android/data/%s/files/Download/' % app_folder
|
||||||
return app_path
|
return app_path
|
||||||
|
@ -129,21 +129,23 @@ class AbstractTestCase:
|
||||||
network_api = NetworkApi()
|
network_api = NetworkApi()
|
||||||
github_report = GithubHtmlReport()
|
github_report = GithubHtmlReport()
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def is_alert_present(driver):
|
|
||||||
try:
|
|
||||||
return driver.find_element(MobileBy.ID, 'android:id/message')
|
|
||||||
except NoSuchElementException:
|
|
||||||
return False
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_alert_text(driver):
|
def get_alert_text(driver):
|
||||||
|
try:
|
||||||
return driver.find_element(MobileBy.ID, 'android:id/message').text
|
return driver.find_element(MobileBy.ID, 'android:id/message').text
|
||||||
|
except NoSuchElementException:
|
||||||
|
return None
|
||||||
|
|
||||||
def add_alert_text_to_report(self, driver):
|
def add_alert_text_to_report(self, driver):
|
||||||
if self.is_alert_present(driver):
|
try:
|
||||||
test_suite_data.current_test.testruns[-1].error += "; also Unexpected Alert is shown: '%s'" \
|
alert_text = self.get_alert_text(driver)
|
||||||
% self.get_alert_text(driver)
|
if alert_text:
|
||||||
|
test_suite_data.current_test.testruns[-1].error = "%s; also Unexpected Alert is shown: '%s'" % (
|
||||||
|
test_suite_data.current_test.testruns[-1].error, alert_text
|
||||||
|
)
|
||||||
|
except RemoteDisconnected:
|
||||||
|
test_suite_data.current_test.testruns[-1].error = "%s; \n RemoteDisconnected" % \
|
||||||
|
test_suite_data.current_test.testruns[-1].error
|
||||||
|
|
||||||
def pull_geth(self, driver):
|
def pull_geth(self, driver):
|
||||||
result = ""
|
result = ""
|
||||||
|
@ -393,7 +395,8 @@ class SauceSharedMultipleDeviceTestCase(AbstractTestCase):
|
||||||
except WebDriverException:
|
except WebDriverException:
|
||||||
pass
|
pass
|
||||||
if option.datacenter == 'eu-central-1':
|
if option.datacenter == 'eu-central-1':
|
||||||
url = 'https://eu-central-1.saucelabs.com/rest/v1/%s/jobs/%s/assets/%s' % (sauce_username, session_id, "log.json")
|
url = 'https://eu-central-1.saucelabs.com/rest/v1/%s/jobs/%s/assets/%s' % (
|
||||||
|
sauce_username, session_id, "log.json")
|
||||||
else:
|
else:
|
||||||
url = sauce.jobs.get_job_asset_url(username=sauce_username, job_id=session_id, filename="log.json")
|
url = sauce.jobs.get_job_asset_url(username=sauce_username, job_id=session_id, filename="log.json")
|
||||||
WebDriverWait(driver, 60, 2).until(lambda _: requests_session.get(url).status_code == 200)
|
WebDriverWait(driver, 60, 2).until(lambda _: requests_session.get(url).status_code == 200)
|
||||||
|
|
|
@ -9,7 +9,7 @@ import urllib.request
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from _pytest.runner import runtestprotocol
|
from _pytest.runner import runtestprotocol
|
||||||
|
from requests.exceptions import ConnectionError as c_er
|
||||||
import tests
|
import tests
|
||||||
from support.device_stats_db import DeviceStatsDB
|
from support.device_stats_db import DeviceStatsDB
|
||||||
from support.test_rerun import should_rerun_test
|
from support.test_rerun import should_rerun_test
|
||||||
|
@ -329,7 +329,7 @@ def update_sauce_jobs(test_name, job_ids, passed):
|
||||||
for job_id in job_ids.keys():
|
for job_id in job_ids.keys():
|
||||||
try:
|
try:
|
||||||
sauce.jobs.update_job(username=sauce_username, job_id=job_id, name=test_name, passed=passed)
|
sauce.jobs.update_job(username=sauce_username, job_id=job_id, name=test_name, passed=passed)
|
||||||
except (RemoteDisconnected, SauceException):
|
except (RemoteDisconnected, SauceException, c_er):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ class TestDeeplinkChatProfileOneDevice(MultipleSharedDeviceTestCase):
|
||||||
self.home.ens_banner_close_button.click_if_shown()
|
self.home.ens_banner_close_button.click_if_shown()
|
||||||
|
|
||||||
@marks.testrail_id(702244)
|
@marks.testrail_id(702244)
|
||||||
def test_deep_link_with_invalid_user_public_key_own_profile_key(self):
|
def test_deep_link_with_invalid_user_public_key_own_profile_key_old(self):
|
||||||
self.drivers[0].close_app()
|
self.drivers[0].close_app()
|
||||||
|
|
||||||
self.sign_in.just_fyi('Check that no error when opening invalid deep link')
|
self.sign_in.just_fyi('Check that no error when opening invalid deep link')
|
||||||
|
|
Loading…
Reference in New Issue