diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml index 173cf2fa64613..96c5182b71740 100644 --- a/.github/workflows/ci-python.yml +++ b/.github/workflows/ci-python.yml @@ -54,6 +54,22 @@ jobs: env: TOXENV: mypy + unit-tests: + name: Unit Tests + needs: build + uses: ./.github/workflows/bazel.yml + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu + - os: macos + with: + name: Unit Tests (${{ matrix.os }}) + os: ${{ matrix.os }} + cache-key: python-unit-test-${{ matrix.os }} + run: bazel test //py:unit + remote-tests: name: Remote Tests needs: build @@ -83,6 +99,10 @@ jobs: os: ubuntu - browser: firefox os: ubuntu + - browser: chrome + os: windows + - browser: edge + os: windows with: name: Integration Tests (${{ matrix.browser }}, ${{ matrix.os }}) browser: ${{ matrix.browser }} @@ -108,4 +128,5 @@ jobs: os: ${{ matrix.os }} cache-key: py-browser-${{ matrix.browser }} run: | + bazel test --local_test_jobs 1 --flaky_test_attempts 3 --pin_browsers=true //py:common-${{ matrix.browser }} bazel test --local_test_jobs 1 --flaky_test_attempts 3 --pin_browsers=true //py:test-${{ matrix.browser }} diff --git a/py/selenium/types.py b/py/selenium/types.py index fdec985bd16ab..08ea194c49a8c 100644 --- a/py/selenium/types.py +++ b/py/selenium/types.py @@ -14,6 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. + """Selenium type definitions.""" from collections.abc import Iterable diff --git a/py/test/selenium/webdriver/chrome/chrome_service_tests.py b/py/test/selenium/webdriver/chrome/chrome_service_tests.py index fc110921cfd1d..53d4241f9fd1b 100644 --- a/py/test/selenium/webdriver/chrome/chrome_service_tests.py +++ b/py/test/selenium/webdriver/chrome/chrome_service_tests.py @@ -17,6 +17,7 @@ import os import subprocess +import sys import time from unittest.mock import patch @@ -107,6 +108,9 @@ def test_log_output_null_default(driver, capfd) -> None: driver.quit() +@pytest.mark.xfail( + sys.platform == "win32", reason="chromedriver doesn't return an error on windows if you use an invalid profile path" +) @pytest.mark.no_driver_after_test def test_driver_is_stopped_if_browser_cant_start(clean_driver, clean_options, driver_executable) -> None: clean_options.add_argument("--user-data-dir=/no/such/location") diff --git a/py/test/selenium/webdriver/edge/edge_service_tests.py b/py/test/selenium/webdriver/edge/edge_service_tests.py index af449b3ddfbb7..37f4da68c453f 100644 --- a/py/test/selenium/webdriver/edge/edge_service_tests.py +++ b/py/test/selenium/webdriver/edge/edge_service_tests.py @@ -17,6 +17,7 @@ import os import subprocess +import sys import time from unittest.mock import patch @@ -107,6 +108,9 @@ def test_log_output_null_default(driver, capfd) -> None: driver.quit() +@pytest.mark.xfail( + sys.platform == "win32", reason="edgedriver doesn't return an error on windows if you use an invalid profile path" +) @pytest.mark.no_driver_after_test def test_driver_is_stopped_if_browser_cant_start(clean_driver, clean_options, clean_service, driver_executable) -> None: clean_options.add_argument("--user-data-dir=/no/such/location") diff --git a/py/test/unit/selenium/webdriver/remote/remote_connection_tests.py b/py/test/unit/selenium/webdriver/remote/remote_connection_tests.py index e2efccde7221f..eb68796f3172c 100644 --- a/py/test/unit/selenium/webdriver/remote/remote_connection_tests.py +++ b/py/test/unit/selenium/webdriver/remote/remote_connection_tests.py @@ -65,7 +65,7 @@ def test_get_remote_connection_headers_defaults(): assert headers.get("Accept") == "application/json" assert headers.get("Content-Type") == "application/json;charset=UTF-8" assert headers.get("User-Agent").startswith(f"selenium/{__version__} (python ") - assert headers.get("User-Agent").split(" ")[-1] in {"windows)", "mac)", "linux)", "mac", "windows", "linux"} + assert headers.get("User-Agent").split(" ")[-1].rstrip(")") in ("win32", "windows", "mac", "linux") def test_get_remote_connection_headers_adds_auth_header_if_pass(recwarn): diff --git a/py/test/unit/selenium/webdriver/virtual_authenticator/virtual_authenticator_options_tests.py b/py/test/unit/selenium/webdriver/virtual_authenticator/virtual_authenticator_options_tests.py index 30b93b559aeef..dacb9587b4880 100644 --- a/py/test/unit/selenium/webdriver/virtual_authenticator/virtual_authenticator_options_tests.py +++ b/py/test/unit/selenium/webdriver/virtual_authenticator/virtual_authenticator_options_tests.py @@ -15,6 +15,7 @@ # specific language governing permissions and limitations # under the License. + import pytest from selenium.webdriver.common.virtual_authenticator import VirtualAuthenticatorOptions