Skip to content

Commit

Permalink
[py] marked some element finding tests to xfail in safari (#12500)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepsuryaprasad committed Aug 8, 2023
1 parent b89fb5e commit d556045
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions py/test/selenium/webdriver/common/driver_element_finding_tests.py
Expand Up @@ -192,6 +192,7 @@ def test_should_not_be_able_to_locate_by_tag_name_multiple_elements_that_do_not_

@pytest.mark.xfail_firefox(reason="https://github.com/mozilla/geckodriver/issues/2007")
@pytest.mark.xfail_remote(reason="https://github.com/mozilla/geckodriver/issues/2007")
@pytest.mark.xfail_safari(reason="unlike chrome, safari raises NoSuchElementException")
def test_finding_asingle_element_by_empty_tag_name_should_throw(driver, pages):
pages.load("formPage.html")
with pytest.raises(InvalidSelectorException):
Expand All @@ -200,6 +201,7 @@ def test_finding_asingle_element_by_empty_tag_name_should_throw(driver, pages):

@pytest.mark.xfail_firefox(reason="https://github.com/mozilla/geckodriver/issues/2007")
@pytest.mark.xfail_remote(reason="https://github.com/mozilla/geckodriver/issues/2007")
@pytest.mark.xfail_safari(reason="unlike chrome, safari returns an empty list")
def test_finding_multiple_elements_by_empty_tag_name_should_throw(driver, pages):
pages.load("formPage.html")
with pytest.raises(InvalidSelectorException):
Expand Down Expand Up @@ -273,13 +275,15 @@ def test_should_not_find_element_by_class_when_the_name_queried_is_shorter_than_
driver.find_element(By.CLASS_NAME, "name_B")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_finding_asingle_element_by_empty_class_name_should_throw(driver, pages):
pages.load("xhtmlTest.html")
msg = r"\/errors#invalid-selector-exception"
with pytest.raises(InvalidSelectorException, match=msg):
driver.find_element(By.CLASS_NAME, "")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_finding_multiple_elements_by_empty_class_name_should_throw(driver, pages):
pages.load("xhtmlTest.html")
with pytest.raises(InvalidSelectorException):
Expand All @@ -292,12 +296,14 @@ def test_finding_asingle_element_by_compound_class_name_should_throw(driver, pag
driver.find_element(By.CLASS_NAME, "a b")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_finding_asingle_element_by_invalid_class_name_should_throw(driver, pages):
pages.load("xhtmlTest.html")
with pytest.raises(InvalidSelectorException):
driver.find_element(By.CLASS_NAME, "!@#$%^&*")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_finding_multiple_elements_by_invalid_class_name_should_throw(driver, pages):
pages.load("xhtmlTest.html")
with pytest.raises(InvalidSelectorException):
Expand Down Expand Up @@ -380,6 +386,7 @@ def test_should_throw_an_exception_when_there_is_no_link_to_click(driver, pages)
driver.find_element(By.XPATH, "//a[@id='Not here']")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_should_throw_invalid_selector_exception_when_xpath_is_syntactically_invalid_in_driver_find_element(
driver, pages
):
Expand All @@ -388,6 +395,7 @@ def test_should_throw_invalid_selector_exception_when_xpath_is_syntactically_inv
driver.find_element(By.XPATH, "this][isnot][valid")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_should_throw_invalid_selector_exception_when_xpath_is_syntactically_invalid_in_driver_find_elements(
driver, pages
):
Expand All @@ -396,6 +404,7 @@ def test_should_throw_invalid_selector_exception_when_xpath_is_syntactically_inv
driver.find_elements(By.XPATH, "this][isnot][valid")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_should_throw_invalid_selector_exception_when_xpath_is_syntactically_invalid_in_element_find_element(
driver, pages
):
Expand All @@ -405,6 +414,7 @@ def test_should_throw_invalid_selector_exception_when_xpath_is_syntactically_inv
body.find_element(By.XPATH, "this][isnot][valid")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_should_throw_invalid_selector_exception_when_xpath_is_syntactically_invalid_in_element_find_elements(
driver, pages
):
Expand All @@ -414,25 +424,29 @@ def test_should_throw_invalid_selector_exception_when_xpath_is_syntactically_inv
body.find_elements(By.XPATH, "this][isnot][valid")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_should_throw_invalid_selector_exception_when_xpath_returns_wrong_type_in_driver_find_element(driver, pages):
pages.load("formPage.html")
with pytest.raises(InvalidSelectorException):
driver.find_element(By.XPATH, "count(//input)")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_should_throw_invalid_selector_exception_when_xpath_returns_wrong_type_in_driver_find_elements(driver, pages):
pages.load("formPage.html")
with pytest.raises(InvalidSelectorException):
driver.find_elements(By.XPATH, "count(//input)")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_should_throw_invalid_selector_exception_when_xpath_returns_wrong_type_in_element_find_element(driver, pages):
pages.load("formPage.html")
body = driver.find_element(By.TAG_NAME, "body")
with pytest.raises(InvalidSelectorException):
body.find_element(By.XPATH, "count(//input)")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_should_throw_invalid_selector_exception_when_xpath_returns_wrong_type_in_element_find_elements(driver, pages):
pages.load("formPage.html")
body = driver.find_element(By.TAG_NAME, "body")
Expand Down Expand Up @@ -504,24 +518,28 @@ def test_should_not_find_elements_by_css_selector_when_there_is_no_such_element(
assert len(elements) == 0


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_finding_asingle_element_by_empty_css_selector_should_throw(driver, pages):
pages.load("xhtmlTest.html")
with pytest.raises(InvalidSelectorException):
driver.find_element(By.CSS_SELECTOR, "")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_finding_multiple_elements_by_empty_css_selector_should_throw(driver, pages):
pages.load("xhtmlTest.html")
with pytest.raises(InvalidSelectorException):
driver.find_elements(By.CSS_SELECTOR, "")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_finding_asingle_element_by_invalid_css_selector_should_throw(driver, pages):
pages.load("xhtmlTest.html")
with pytest.raises(InvalidSelectorException):
driver.find_element(By.CSS_SELECTOR, "//a/b/c[@id='1']")


@pytest.mark.xfail_safari(reason="unlike chrome, safari raises TimeoutException")
def test_finding_multiple_elements_by_invalid_css_selector_should_throw(driver, pages):
pages.load("xhtmlTest.html")
with pytest.raises(InvalidSelectorException):
Expand Down

0 comments on commit d556045

Please sign in to comment.