From 1c25126d0b3a8768fb79ea28567780294af23800 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Sun, 3 Nov 2024 20:10:51 +0700 Subject: [PATCH] [py] Enable all test-safari Signed-off-by: Viet Nguyen Duc --- .github/workflows/ci-python.yml | 2 +- py/test/selenium/webdriver/common/alerts_tests.py | 1 + .../selenium/webdriver/common/api_example_tests.py | 1 + .../common/executing_async_javascript_tests.py | 1 + .../selenium/webdriver/common/interactions_tests.py | 4 ++++ .../common/interactions_with_device_tests.py | 4 ++++ .../webdriver/common/position_and_size_tests.py | 2 ++ .../webdriver/common/selenium_manager_tests.py | 11 ++++++++--- .../webdriver/common/w3c_interaction_tests.py | 2 ++ .../selenium/webdriver/common/webdriverwait_tests.py | 2 ++ .../webdriver/common/window_switching_tests.py | 1 + 11 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml index cebe68597d0630..39e199aba52d85 100644 --- a/.github/workflows/ci-python.yml +++ b/.github/workflows/ci-python.yml @@ -97,4 +97,4 @@ jobs: os: macos cache-key: py-safari run: | - bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-safari-test/selenium/webdriver/safari/launcher_tests.py + bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-safari diff --git a/py/test/selenium/webdriver/common/alerts_tests.py b/py/test/selenium/webdriver/common/alerts_tests.py index ea37e0e3d53712..9479df88fadf57 100644 --- a/py/test/selenium/webdriver/common/alerts_tests.py +++ b/py/test/selenium/webdriver/common/alerts_tests.py @@ -294,6 +294,7 @@ def test_alert_should_not_allow_additional_commands_if_dismissed(driver, pages): @pytest.mark.xfail_remote(reason="https://bugzilla.mozilla.org/show_bug.cgi?id=1279211") @pytest.mark.xfail_chrome @pytest.mark.xfail_edge +@pytest.mark.xfail_safari def test_unexpected_alert_present_exception_contains_alert_text(driver, pages): pages.load("alerts.html") driver.find_element(by=By.ID, value="alert").click() diff --git a/py/test/selenium/webdriver/common/api_example_tests.py b/py/test/selenium/webdriver/common/api_example_tests.py index 7b8a4cedee3d82..40b3d2b7a2f019 100644 --- a/py/test/selenium/webdriver/common/api_example_tests.py +++ b/py/test/selenium/webdriver/common/api_example_tests.py @@ -240,6 +240,7 @@ def test_is_element_displayed(driver, pages): @pytest.mark.xfail_chrome +@pytest.mark.xfail_safari def test_move_window_position(driver, pages): pages.load("blank.html") loc = driver.get_window_position() diff --git a/py/test/selenium/webdriver/common/executing_async_javascript_tests.py b/py/test/selenium/webdriver/common/executing_async_javascript_tests.py index 9ca2477e70b1fc..16d7beefa6dc36 100644 --- a/py/test/selenium/webdriver/common/executing_async_javascript_tests.py +++ b/py/test/selenium/webdriver/common/executing_async_javascript_tests.py @@ -152,6 +152,7 @@ def test_should_catch_errors_when_executing_initial_script(driver, pages): driver.execute_async_script("throw Error('you should catch this!');") +@pytest.mark.xfail_safari def test_should_be_able_to_execute_asynchronous_scripts(driver, pages): pages.load("ajaxy_page.html") diff --git a/py/test/selenium/webdriver/common/interactions_tests.py b/py/test/selenium/webdriver/common/interactions_tests.py index 8c2ad03fc8d6f6..7ffe0e9dc4e0b1 100644 --- a/py/test/selenium/webdriver/common/interactions_tests.py +++ b/py/test/selenium/webdriver/common/interactions_tests.py @@ -253,6 +253,7 @@ def test_can_pause(driver, pages): @pytest.mark.xfail_firefox @pytest.mark.xfail_remote +@pytest.mark.xfail_safari def test_can_scroll_to_element(driver, pages): pages.load("scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html") iframe = driver.find_element(By.TAG_NAME, "iframe") @@ -266,6 +267,7 @@ def test_can_scroll_to_element(driver, pages): @pytest.mark.xfail_firefox @pytest.mark.xfail_remote +@pytest.mark.xfail_safari def test_can_scroll_from_element_by_amount(driver, pages): pages.load("scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html") iframe = driver.find_element(By.TAG_NAME, "iframe") @@ -280,6 +282,7 @@ def test_can_scroll_from_element_by_amount(driver, pages): @pytest.mark.xfail_firefox @pytest.mark.xfail_remote +@pytest.mark.xfail_safari def test_can_scroll_from_element_with_offset_by_amount(driver, pages): pages.load("scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html") footer = driver.find_element(By.TAG_NAME, "footer") @@ -314,6 +317,7 @@ def test_can_scroll_from_viewport_by_amount(driver, pages): assert _in_viewport(driver, footer) +@pytest.mark.xfail_safari def test_can_scroll_from_viewport_with_offset_by_amount(driver, pages): pages.load("scrolling_tests/frame_with_nested_scrolling_frame.html") scroll_origin = ScrollOrigin.from_viewport(10, 10) diff --git a/py/test/selenium/webdriver/common/interactions_with_device_tests.py b/py/test/selenium/webdriver/common/interactions_with_device_tests.py index 926b93c641e442..f82f3967a0776c 100644 --- a/py/test/selenium/webdriver/common/interactions_with_device_tests.py +++ b/py/test/selenium/webdriver/common/interactions_with_device_tests.py @@ -247,6 +247,7 @@ def test_can_pause_with_pointer(driver, pages): @pytest.mark.xfail_firefox @pytest.mark.xfail_remote +@pytest.mark.xfail_safari def test_can_scroll_to_element_with_wheel(driver, pages): pages.load("scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html") iframe = driver.find_element(By.TAG_NAME, "iframe") @@ -262,6 +263,7 @@ def test_can_scroll_to_element_with_wheel(driver, pages): @pytest.mark.xfail_firefox @pytest.mark.xfail_remote +@pytest.mark.xfail_safari def test_can_scroll_from_element_by_amount_with_wheel(driver, pages): pages.load("scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html") iframe = driver.find_element(By.TAG_NAME, "iframe") @@ -278,6 +280,7 @@ def test_can_scroll_from_element_by_amount_with_wheel(driver, pages): @pytest.mark.xfail_firefox @pytest.mark.xfail_remote +@pytest.mark.xfail_safari def test_can_scroll_from_element_with_offset_by_amount_with_wheel(driver, pages): pages.load("scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html") footer = driver.find_element(By.TAG_NAME, "footer") @@ -320,6 +323,7 @@ def test_can_scroll_from_viewport_by_amount_with_wheel(driver, pages): @pytest.mark.xfail_firefox +@pytest.mark.xfail_safari def test_can_scroll_from_viewport_with_offset_by_amount_with_wheel(driver, pages): pages.load("scrolling_tests/frame_with_nested_scrolling_frame.html") scroll_origin = ScrollOrigin.from_viewport(10, 10) diff --git a/py/test/selenium/webdriver/common/position_and_size_tests.py b/py/test/selenium/webdriver/common/position_and_size_tests.py index a438c0f5e0c882..081c51358a5173 100644 --- a/py/test/selenium/webdriver/common/position_and_size_tests.py +++ b/py/test/selenium/webdriver/common/position_and_size_tests.py @@ -53,6 +53,7 @@ def test_should_get_coordinates_of_an_invisible_element(driver, pages): _check_location(element.location, x=0, y=0) +@pytest.mark.xfail_safari def test_should_scroll_page_and_get_coordinates_of_an_element_that_is_out_of_view_port(driver, pages): pages.load("coordinates_tests/page_with_element_out_of_view.html") element = driver.find_element(By.ID, "box") @@ -89,6 +90,7 @@ def test_should_get_coordinates_of_an_element_in_anested_frame(driver, pages): _check_location(element.location, x=10, y=10) +@pytest.mark.xfail_safari def test_should_get_coordinates_of_an_element_with_fixed_position(driver, pages): pages.load("coordinates_tests/page_with_fixed_element.html") element = driver.find_element(By.ID, "fixed") diff --git a/py/test/selenium/webdriver/common/selenium_manager_tests.py b/py/test/selenium/webdriver/common/selenium_manager_tests.py index 8692644cee0c46..2fcc57d1ec358d 100644 --- a/py/test/selenium/webdriver/common/selenium_manager_tests.py +++ b/py/test/selenium/webdriver/common/selenium_manager_tests.py @@ -20,6 +20,7 @@ from unittest import mock import pytest +import platform import selenium from selenium.common.exceptions import WebDriverException @@ -59,10 +60,14 @@ def test_uses_windows(monkeypatch): def test_uses_linux(monkeypatch): monkeypatch.setattr(sys, "platform", "linux") - binary = SeleniumManager()._get_binary() - project_root = Path(selenium.__file__).parent.parent - assert binary == project_root.joinpath("selenium/webdriver/common/linux/selenium-manager") + if platform.machine() == "arm64": + with pytest.raises(WebDriverException, match="Unsupported platform/architecture combination: linux/arm64"): + SeleniumManager()._get_binary() + else: + binary = SeleniumManager()._get_binary() + project_root = Path(selenium.__file__).parent.parent + assert binary == project_root.joinpath("selenium/webdriver/common/linux/selenium-manager") def test_uses_mac(monkeypatch): diff --git a/py/test/selenium/webdriver/common/w3c_interaction_tests.py b/py/test/selenium/webdriver/common/w3c_interaction_tests.py index d0a00ac26a2d47..5376265ede3bb6 100644 --- a/py/test/selenium/webdriver/common/w3c_interaction_tests.py +++ b/py/test/selenium/webdriver/common/w3c_interaction_tests.py @@ -176,6 +176,7 @@ def test_dragging_element_with_mouse_fires_events(driver, pages): @pytest.mark.xfail_firefox @pytest.mark.xfail_remote +@pytest.mark.xfail_safari def test_pen_pointer_properties(driver, pages): pages.load("pointerActionsPage.html") @@ -223,6 +224,7 @@ def test_pen_pointer_properties(driver, pages): @pytest.mark.xfail_firefox @pytest.mark.xfail_remote +@pytest.mark.xfail_safari def test_touch_pointer_properties(driver, pages): pages.load("pointerActionsPage.html") pointerArea = driver.find_element(By.CSS_SELECTOR, "#pointerArea") diff --git a/py/test/selenium/webdriver/common/webdriverwait_tests.py b/py/test/selenium/webdriver/common/webdriverwait_tests.py index 14019d185e8b01..318f20c81d3924 100644 --- a/py/test/selenium/webdriver/common/webdriverwait_tests.py +++ b/py/test/selenium/webdriver/common/webdriverwait_tests.py @@ -35,6 +35,7 @@ def throw_sere(driver): @pytest.mark.xfail_chrome(reason="https://bugs.chromium.org/p/chromedriver/issues/detail?id=4743") @pytest.mark.xfail_edge(reason="https://bugs.chromium.org/p/chromedriver/issues/detail?id=4743") +@pytest.mark.xfail_safari def test_should_fail_with_invalid_selector_exception(driver, pages): pages.load("dynamic.html") with pytest.raises(InvalidSelectorException): @@ -283,6 +284,7 @@ def test_expected_condition_element_to_be_clickable(driver, pages): assert element.is_displayed() is False +@pytest.mark.xfail_safari def test_expected_condition_staleness_of(driver, pages): pages.load("dynamicallyModifiedPage.html") element = driver.find_element(By.ID, "element-to-remove") diff --git a/py/test/selenium/webdriver/common/window_switching_tests.py b/py/test/selenium/webdriver/common/window_switching_tests.py index 1e2359cd52b365..2883ab2c55f695 100644 --- a/py/test/selenium/webdriver/common/window_switching_tests.py +++ b/py/test/selenium/webdriver/common/window_switching_tests.py @@ -130,6 +130,7 @@ def test_should_throw_no_such_window_exception_on_any_element_operation_if_awind element.text +@pytest.mark.xfail_safari def test_clicking_on_abutton_that_closes_an_open_window_does_not_cause_the_browser_to_hang(driver, pages): pages.load("xhtmlTest.html") current = driver.current_window_handle