diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index 017ab6fa92eea..2c0a7811ef875 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -126,6 +126,8 @@ jobs: with: bazelisk-cache: true bazelrc: common --color=yes + # Workaround for long path issues: https://github.com/bazelbuild/bazel/pull/22532 + output-base: ${{ inputs.os == 'windows' && 'D://b' || '' }} cache-version: 2 disk-cache: ${{ inputs.cache-key }} external-cache: | diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml index 96c5182b71740..8cbff243e0962 100644 --- a/.github/workflows/ci-python.yml +++ b/.github/workflows/ci-python.yml @@ -99,18 +99,13 @@ 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 }} 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 }}-bidi - bazel test --local_test_jobs 1 --flaky_test_attempts 3 --pin_browsers=true //py:test-${{ matrix.browser }} + bazel test --local_test_jobs 1 --flaky_test_attempts 3 --pin_browsers=true //py:common-${{ matrix.browser }}-bidi //py:test-${{ matrix.browser }} safari-tests: name: Browser Tests @@ -128,5 +123,4 @@ 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 }} + bazel test --local_test_jobs 1 --flaky_test_attempts 3 --pin_browsers=true //py:common-${{ matrix.browser }} //py:test-${{ matrix.browser }} diff --git a/py/test/selenium/webdriver/common/selenium_manager_tests.py b/py/test/selenium/webdriver/common/selenium_manager_tests.py index 9195badf0ed21..5a70faab1e499 100644 --- a/py/test/selenium/webdriver/common/selenium_manager_tests.py +++ b/py/test/selenium/webdriver/common/selenium_manager_tests.py @@ -14,8 +14,8 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. + import json -import platform import sys from pathlib import Path from unittest import mock @@ -43,12 +43,13 @@ def test_gets_results(monkeypatch): def test_uses_environment_variable(monkeypatch): - monkeypatch.setenv("SE_MANAGER_PATH", "/path/to/manager") + sm_path = r"\path\to\manager" if sys.platform.startswith("win") else "path/to/manager" + monkeypatch.setenv("SE_MANAGER_PATH", sm_path) monkeypatch.setattr(Path, "is_file", lambda _: True) binary = SeleniumManager()._get_binary() - assert str(binary) == "/path/to/manager" + assert str(binary) == sm_path def test_uses_windows(monkeypatch): @@ -61,14 +62,19 @@ def test_uses_windows(monkeypatch): def test_uses_linux(monkeypatch): monkeypatch.setattr(sys, "platform", "linux") + monkeypatch.setattr("platform.machine", lambda: "x86_64") + + 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_linux_arm64(monkeypatch): + monkeypatch.setattr(sys, "platform", "linux") + monkeypatch.setattr("platform.machine", lambda: "arm64") - 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") + with pytest.raises(WebDriverException, match="Unsupported platform/architecture combination: linux/arm64"): + SeleniumManager()._get_binary() def test_uses_mac(monkeypatch): @@ -97,11 +103,12 @@ def test_errors_if_invalid_os(monkeypatch): def test_error_if_invalid_env_path(monkeypatch): - monkeypatch.setenv("SE_MANAGER_PATH", "/path/to/manager") + sm_path = r"\path\to\manager" if sys.platform.startswith("win") else "path/to/manager" + monkeypatch.setenv("SE_MANAGER_PATH", sm_path) with pytest.raises(WebDriverException) as excinfo: SeleniumManager()._get_binary() - assert "Unable to obtain working Selenium Manager binary; /path/to/manager" in str(excinfo.value) + assert f"Unable to obtain working Selenium Manager binary; {sm_path}" in str(excinfo.value) def test_run_successful():