-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
295bb0a
commit 8173847
Showing
5 changed files
with
878 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,271 @@ | ||
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="2" skipped="0" tests="6" time="137.570" timestamp="2023-10-30T07:00:03.539825" hostname="d19c7bd068e2"><testcase classname="test_public_mip.TestPublicMIP" name="test_login_and_accept_terms[https://hbpmip.link/]" time="9.839" /><testcase classname="test_public_mip.TestPublicMIP" name="test_data[https://hbpmip.link/]" time="20.175" /><testcase classname="test_qa_federation.TestMIPQAFederation" name="test_login_and_accept_terms[https://qa.hbpmip.link/]" time="31.954" /><testcase classname="test_qa_federation.TestMIPQAFederation" name="test_data[https://qa.hbpmip.link/]" time="24.134"><failure message="selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"#default-synth_mh_wk4"} (Session info: headless chrome=118.0.5993.88); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception Stacktrace: #0 0x55d20b3c9fb3 <unknown> #1 0x55d20b09d4a7 <unknown> #2 0x55d20b0e4dd6 <unknown> #3 0x55d20b0e4ec1 <unknown> #4 0x55d20b122354 <unknown> #5 0x55d20b10696d <unknown> #6 0x55d20b11fc02 <unknown> #7 0x55d20b106713 <unknown> #8 0x55d20b0d918b <unknown> #9 0x55d20b0d9f7e <unknown> #10 0x55d20b38f8d8 <unknown> #11 0x55d20b393800 <unknown> #12 0x55d20b39dcfc <unknown> #13 0x55d20b394418 <unknown> #14 0x55d20b36142f <unknown> #15 0x55d20b3b84e8 <unknown> #16 0x55d20b3b86b4 <unknown> #17 0x55d20b3c9143 <unknown> #18 0x7fdd101d7044 <unknown>">self = <test_qa_federation.TestMIPQAFederation object at 0x7f7baa7e9670> | ||
|
||
def test_data(self): | ||
"""Integration tests (data) of the MIP QA Federation.""" | ||
> super().test_data() | ||
|
||
test_qa_federation.py:24: | ||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | ||
basetest.py:94: in test_data | ||
default_synth_mh_wk4 = selenium_driver.find_element( | ||
/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:739: in find_element | ||
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"] | ||
/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:345: in execute | ||
self.error_handler.check_response(response) | ||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | ||
|
||
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f7bab572c40> | ||
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...\\n#16 0x55d20b3b86b4 \\u003Cunknown>\\n#17 0x55d20b3c9143 \\u003Cunknown>\\n#18 0x7fdd101d7044 \\u003Cunknown>\\n"}}'} | ||
|
||
def check_response(self, response: Dict[str, Any]) -> None: | ||
"""Checks that a JSON response from the WebDriver does not have an | ||
error. | ||
|
||
:Args: | ||
- response - The JSON response from the WebDriver server as a dictionary | ||
object. | ||
|
||
:Raises: If the response contains an error message. | ||
""" | ||
status = response.get("status", None) | ||
if not status or status == ErrorCode.SUCCESS: | ||
return | ||
value = None | ||
message = response.get("message", "") | ||
screen: str = response.get("screen", "") | ||
stacktrace = None | ||
if isinstance(status, int): | ||
value_json = response.get("value", None) | ||
if value_json and isinstance(value_json, str): | ||
import json | ||
|
||
try: | ||
value = json.loads(value_json) | ||
if len(value) == 1: | ||
value = value["value"] | ||
status = value.get("error", None) | ||
if not status: | ||
status = value.get("status", ErrorCode.UNKNOWN_ERROR) | ||
message = value.get("value") or value.get("message") | ||
if not isinstance(message, str): | ||
value = message | ||
message = message.get("message") | ||
else: | ||
message = value.get("message", None) | ||
except ValueError: | ||
pass | ||
|
||
exception_class: Type[WebDriverException] | ||
e = ErrorCode() | ||
error_codes = [item for item in dir(e) if not item.startswith("__")] | ||
for error_code in error_codes: | ||
error_info = getattr(ErrorCode, error_code) | ||
if isinstance(error_info, list) and status in error_info: | ||
exception_class = getattr(ExceptionMapping, error_code, WebDriverException) | ||
break | ||
else: | ||
exception_class = WebDriverException | ||
|
||
if not value: | ||
value = response["value"] | ||
if isinstance(value, str): | ||
raise exception_class(value) | ||
if message == "" and "message" in value: | ||
message = value["message"] | ||
|
||
screen = None # type: ignore[assignment] | ||
if "screen" in value: | ||
screen = value["screen"] | ||
|
||
stacktrace = None | ||
st_value = value.get("stackTrace") or value.get("stacktrace") | ||
if st_value: | ||
if isinstance(st_value, str): | ||
stacktrace = st_value.split("\n") | ||
else: | ||
stacktrace = [] | ||
try: | ||
for frame in st_value: | ||
line = frame.get("lineNumber", "") | ||
file = frame.get("fileName", "<anonymous>") | ||
if line: | ||
file = f"{file}:{line}" | ||
meth = frame.get("methodName", "<anonymous>") | ||
if "className" in frame: | ||
meth = f"{frame['className']}.{meth}" | ||
msg = " at %s (%s)" | ||
msg = msg % (meth, file) | ||
stacktrace.append(msg) | ||
except TypeError: | ||
pass | ||
if exception_class == UnexpectedAlertPresentException: | ||
alert_text = None | ||
if "data" in value: | ||
alert_text = value["data"].get("text") | ||
elif "alert" in value: | ||
alert_text = value["alert"].get("text") | ||
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here | ||
> raise exception_class(message, screen, stacktrace) | ||
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"#default-synth_mh_wk4"} | ||
E (Session info: headless chrome=118.0.5993.88); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception | ||
E Stacktrace: | ||
E #0 0x55d20b3c9fb3 <unknown> | ||
E #1 0x55d20b09d4a7 <unknown> | ||
E #2 0x55d20b0e4dd6 <unknown> | ||
E #3 0x55d20b0e4ec1 <unknown> | ||
E #4 0x55d20b122354 <unknown> | ||
E #5 0x55d20b10696d <unknown> | ||
E #6 0x55d20b11fc02 <unknown> | ||
E #7 0x55d20b106713 <unknown> | ||
E #8 0x55d20b0d918b <unknown> | ||
E #9 0x55d20b0d9f7e <unknown> | ||
E #10 0x55d20b38f8d8 <unknown> | ||
E #11 0x55d20b393800 <unknown> | ||
E #12 0x55d20b39dcfc <unknown> | ||
E #13 0x55d20b394418 <unknown> | ||
E #14 0x55d20b36142f <unknown> | ||
E #15 0x55d20b3b84e8 <unknown> | ||
E #16 0x55d20b3b86b4 <unknown> | ||
E #17 0x55d20b3c9143 <unknown> | ||
E #18 0x7fdd101d7044 <unknown> | ||
|
||
/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py:229: NoSuchElementException</failure></testcase><testcase classname="test_stroke_federation.TestStrokeMIP" name="test_login_and_accept_terms[https://stroke.hbpmip.link/]" time="27.104" /><testcase classname="test_stroke_federation.TestStrokeMIP" name="test_data[https://stroke.hbpmip.link/]" time="23.175"><failure message="selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"#default-unibas"} (Session info: headless chrome=118.0.5993.88); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception Stacktrace: #0 0x55b113c98fb3 <unknown> #1 0x55b11396c4a7 <unknown> #2 0x55b1139b3dd6 <unknown> #3 0x55b1139b3ec1 <unknown> #4 0x55b1139f1354 <unknown> #5 0x55b1139d596d <unknown> #6 0x55b1139eec02 <unknown> #7 0x55b1139d5713 <unknown> #8 0x55b1139a818b <unknown> #9 0x55b1139a8f7e <unknown> #10 0x55b113c5e8d8 <unknown> #11 0x55b113c62800 <unknown> #12 0x55b113c6ccfc <unknown> #13 0x55b113c63418 <unknown> #14 0x55b113c3042f <unknown> #15 0x55b113c874e8 <unknown> #16 0x55b113c876b4 <unknown> #17 0x55b113c98143 <unknown> #18 0x7f8419c8d044 <unknown>">self = <test_stroke_federation.TestStrokeMIP object at 0x7f7bab81e820> | ||
|
||
def test_data(self): | ||
"""Integration tests (data) of the Stroke (FERES) MIP.""" | ||
selenium_driver = self.driver | ||
|
||
# 1. Click 'Datasets' | ||
datasets = selenium_driver.find_element(By.CSS_SELECTOR, "#dropdown-basic") | ||
datasets.click() | ||
|
||
# 2. Disable and enable again 'default-unibas' | ||
time.sleep(3) | ||
> default_unibas_wk = selenium_driver.find_element( | ||
By.CSS_SELECTOR, "#default-unibas" | ||
) | ||
|
||
test_stroke_federation.py:38: | ||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | ||
/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:739: in find_element | ||
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"] | ||
/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:345: in execute | ||
self.error_handler.check_response(response) | ||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | ||
|
||
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f7bab5d3700> | ||
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...\\n#16 0x55b113c876b4 \\u003Cunknown>\\n#17 0x55b113c98143 \\u003Cunknown>\\n#18 0x7f8419c8d044 \\u003Cunknown>\\n"}}'} | ||
|
||
def check_response(self, response: Dict[str, Any]) -> None: | ||
"""Checks that a JSON response from the WebDriver does not have an | ||
error. | ||
|
||
:Args: | ||
- response - The JSON response from the WebDriver server as a dictionary | ||
object. | ||
|
||
:Raises: If the response contains an error message. | ||
""" | ||
status = response.get("status", None) | ||
if not status or status == ErrorCode.SUCCESS: | ||
return | ||
value = None | ||
message = response.get("message", "") | ||
screen: str = response.get("screen", "") | ||
stacktrace = None | ||
if isinstance(status, int): | ||
value_json = response.get("value", None) | ||
if value_json and isinstance(value_json, str): | ||
import json | ||
|
||
try: | ||
value = json.loads(value_json) | ||
if len(value) == 1: | ||
value = value["value"] | ||
status = value.get("error", None) | ||
if not status: | ||
status = value.get("status", ErrorCode.UNKNOWN_ERROR) | ||
message = value.get("value") or value.get("message") | ||
if not isinstance(message, str): | ||
value = message | ||
message = message.get("message") | ||
else: | ||
message = value.get("message", None) | ||
except ValueError: | ||
pass | ||
|
||
exception_class: Type[WebDriverException] | ||
e = ErrorCode() | ||
error_codes = [item for item in dir(e) if not item.startswith("__")] | ||
for error_code in error_codes: | ||
error_info = getattr(ErrorCode, error_code) | ||
if isinstance(error_info, list) and status in error_info: | ||
exception_class = getattr(ExceptionMapping, error_code, WebDriverException) | ||
break | ||
else: | ||
exception_class = WebDriverException | ||
|
||
if not value: | ||
value = response["value"] | ||
if isinstance(value, str): | ||
raise exception_class(value) | ||
if message == "" and "message" in value: | ||
message = value["message"] | ||
|
||
screen = None # type: ignore[assignment] | ||
if "screen" in value: | ||
screen = value["screen"] | ||
|
||
stacktrace = None | ||
st_value = value.get("stackTrace") or value.get("stacktrace") | ||
if st_value: | ||
if isinstance(st_value, str): | ||
stacktrace = st_value.split("\n") | ||
else: | ||
stacktrace = [] | ||
try: | ||
for frame in st_value: | ||
line = frame.get("lineNumber", "") | ||
file = frame.get("fileName", "<anonymous>") | ||
if line: | ||
file = f"{file}:{line}" | ||
meth = frame.get("methodName", "<anonymous>") | ||
if "className" in frame: | ||
meth = f"{frame['className']}.{meth}" | ||
msg = " at %s (%s)" | ||
msg = msg % (meth, file) | ||
stacktrace.append(msg) | ||
except TypeError: | ||
pass | ||
if exception_class == UnexpectedAlertPresentException: | ||
alert_text = None | ||
if "data" in value: | ||
alert_text = value["data"].get("text") | ||
elif "alert" in value: | ||
alert_text = value["alert"].get("text") | ||
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here | ||
> raise exception_class(message, screen, stacktrace) | ||
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"#default-unibas"} | ||
E (Session info: headless chrome=118.0.5993.88); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception | ||
E Stacktrace: | ||
E #0 0x55b113c98fb3 <unknown> | ||
E #1 0x55b11396c4a7 <unknown> | ||
E #2 0x55b1139b3dd6 <unknown> | ||
E #3 0x55b1139b3ec1 <unknown> | ||
E #4 0x55b1139f1354 <unknown> | ||
E #5 0x55b1139d596d <unknown> | ||
E #6 0x55b1139eec02 <unknown> | ||
E #7 0x55b1139d5713 <unknown> | ||
E #8 0x55b1139a818b <unknown> | ||
E #9 0x55b1139a8f7e <unknown> | ||
E #10 0x55b113c5e8d8 <unknown> | ||
E #11 0x55b113c62800 <unknown> | ||
E #12 0x55b113c6ccfc <unknown> | ||
E #13 0x55b113c63418 <unknown> | ||
E #14 0x55b113c3042f <unknown> | ||
E #15 0x55b113c874e8 <unknown> | ||
E #16 0x55b113c876b4 <unknown> | ||
E #17 0x55b113c98143 <unknown> | ||
E #18 0x7f8419c8d044 <unknown> | ||
|
||
/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py:229: NoSuchElementException</failure></testcase></testsuite></testsuites> |
Oops, something went wrong.