NEW 279149
[WebDriver] imported/selenium/py/test/selenium/webdriver/common/alerts_tests.py::test_unexpected_alert_present_exception_contains_alert_text is failing due to wrong assertion
https://bugs.webkit.org/show_bug.cgi?id=279149
Summary [WebDriver] imported/selenium/py/test/selenium/webdriver/common/alerts_tests....
Lauro Moura
Reported 2024-09-04 15:09:00 PDT
imported/selenium/py/test/selenium/webdriver/common/alerts_tests.py::test_unexpected_alert_present_exception_contains_alert_text Failure: driver = <selenium.webdriver.wpewebkit.webdriver.WebDriver (session="a336c4c1-4064-4f3c-a609-92f13071df7a")>, pages = <conftest.pages.<locals>.Pages object at 0x7acb0d4fc610> @pytest.mark.xfail_firefox(reason="https://bugzilla.mozilla.org/show_bug.cgi?id=1279211") @pytest.mark.xfail_remote(reason="https://bugzilla.mozilla.org/show_bug.cgi?id=1279211") @pytest.mark.xfail_chrome @pytest.mark.xfail_edge def test_unexpected_alert_present_exception_contains_alert_text(driver, pages): pages.load("alerts.html") driver.find_element(by=By.ID, value="alert").click() alert = _wait_for_alert(driver) value = alert.text with pytest.raises(UnexpectedAlertPresentException) as e: pages.load("simpleTest.html") assert value == e.value.alert_text > assert f"Alert Text: {value}" in str(e) E AssertionError: assert 'Alert Text: cheese' in '<ExceptionInfo UnexpectedAlertPresentException() tblen=5>' E + where '<ExceptionInfo UnexpectedAlertPresentException() tblen=5>' = str(<ExceptionInfo UnexpectedAlertPresentException() tblen=5>) The failure happens because `pytest.raises` wraps `UnexpectedAlertPresentException` in a `ExceptionInfo` object. As such, the assertion should compare to `str(e.value)` instead to `str(e)`. This should be fixed upstream and imported back to WebKit.
Attachments
Radar WebKit Bug Importer
Comment 1 2024-09-11 15:11:31 PDT
Note You need to log in before you can comment on or make changes to this bug.