Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
31 changes: 19 additions & 12 deletions py/test/selenium/webdriver/common/selenium_manager_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -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():
Expand Down