diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml index e0c906c4d8885..00040c5d40ddf 100644 --- a/.github/workflows/ci-python.yml +++ b/.github/workflows/ci-python.yml @@ -100,8 +100,6 @@ jobs: fail-fast: false matrix: include: - - browser: safari - os: macos - browser: chrome os: ubuntu - browser: edge @@ -116,3 +114,21 @@ jobs: run: | bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:common-${{ matrix.browser }}-bidi bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-${{ matrix.browser }} + + safari-tests: + name: Browser Tests + needs: build + uses: ./.github/workflows/bazel.yml + strategy: + fail-fast: false + matrix: + include: + - browser: safari + os: macos + 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 //py:test-${{ matrix.browser }} diff --git a/py/requirements.txt b/py/requirements.txt index 5f4dc4d646d0b..ab36a657d16d1 100644 --- a/py/requirements.txt +++ b/py/requirements.txt @@ -3,6 +3,7 @@ attrs==23.2.0 certifi==2023.11.17 cffi==1.16.0 cryptography==42.0.8 +secretstorage==3.3.3 debugpy==1.8.7 filetype==1.2.0 h11==0.14.0 diff --git a/py/requirements_lock.txt b/py/requirements_lock.txt index 2da2d212d25cf..4b1abe117b69f 100644 --- a/py/requirements_lock.txt +++ b/py/requirements_lock.txt @@ -208,6 +208,7 @@ cryptography==42.0.8 \ # via # -r py/requirements.txt # pyopenssl + # secretstorage debugpy==1.8.7 \ --hash=sha256:11ad72eb9ddb436afb8337891a986302e14944f0f755fd94e90d0d71e9100bba \ --hash=sha256:171899588bcd412151e593bd40d9907133a7622cd6ecdbdb75f89d1551df13c2 \ @@ -288,6 +289,10 @@ jaraco-classes==3.3.0 \ --hash=sha256:10afa92b6743f25c0cf5f37c6bb6e18e2c5bb84a16527ccfc0040ea377e7aaeb \ --hash=sha256:c063dd08e89217cee02c8d5e5ec560f2c8ce6cdc2fcdc2e68f7b2e5547ed3621 # via keyring +jeepney==0.8.0 \ + --hash=sha256:5efe48d255973902f6badc3ce55e2aa6c5c3b3bc642059ef3a91247bcfcc5806 \ + --hash=sha256:c0a454ad016ca575060802ee4d590dd912e35c122fa04e70306de3d076cce755 + # via secretstorage keyring==24.3.0 \ --hash=sha256:4446d35d636e6a10b8bce7caa66913dd9eca5fd222ca03a3d42c38608ac30836 \ --hash=sha256:e730ecffd309658a08ee82535a3b5ec4b4c8669a9be11efb66249d8e0aeb9a25 @@ -512,6 +517,10 @@ rich==13.7.0 \ --hash=sha256:5cb5123b5cf9ee70584244246816e9114227e0b98ad9176eede6ad54bf5403fa \ --hash=sha256:6da14c108c4866ee9520bbffa71f6fe3962e193b7da68720583850cd4548e235 # via twine +secretstorage==3.3.3 \ + --hash=sha256:2403533ef369eca6d2ba81718576c5e0f564d5cca1b58f73a8b23e7d4eeebd77 \ + --hash=sha256:f356e6628222568e3af06f2eba8df495efa13b3b63081dafd4f7d9a7b7bc9f99 + # via -r py/requirements.txt sniffio==1.3.1 \ --hash=sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2 \ --hash=sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc diff --git a/py/selenium/webdriver/remote/webdriver.py b/py/selenium/webdriver/remote/webdriver.py index c2dc89551d6ba..eace710c20310 100644 --- a/py/selenium/webdriver/remote/webdriver.py +++ b/py/selenium/webdriver/remote/webdriver.py @@ -1057,6 +1057,12 @@ def start_devtools(self): raise WebDriverException("Unable to find url to connect to from capabilities") devtools = cdp.import_devtools(version) + if self.caps["browserName"].lower() == "firefox": + warnings.warn( + "CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi.", + DeprecationWarning, + stacklevel=2, + ) self._websocket_connection = WebSocketConnection(ws_url) targets = self._websocket_connection.execute(devtools.target.get_targets()) target_id = targets[0].target_id diff --git a/py/test/selenium/webdriver/common/devtools_tests.py b/py/test/selenium/webdriver/common/devtools_tests.py index b4b3bcbce361a..de194cddbcddf 100644 --- a/py/test/selenium/webdriver/common/devtools_tests.py +++ b/py/test/selenium/webdriver/common/devtools_tests.py @@ -21,9 +21,18 @@ @pytest.mark.xfail_safari def test_check_console_messages(driver, pages): - devtools, connection = driver.start_devtools() + with pytest.warns(None) as record: + devtools, connection = driver.start_devtools() console_api_calls = [] + if driver.caps["browserName"].lower() == "firefox": + assert ( + record[0].message.args[0] + == "CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi." + ) + else: + assert len(record) == 0 + connection.execute(devtools.runtime.enable()) connection.on(devtools.runtime.ConsoleAPICalled, console_api_calls.append) driver.execute_script("console.log('I love cheese')") diff --git a/py/test/selenium/webdriver/firefox/firefox_service_tests.py b/py/test/selenium/webdriver/firefox/firefox_service_tests.py index 2a57d0341acee..509a138d375d5 100644 --- a/py/test/selenium/webdriver/firefox/firefox_service_tests.py +++ b/py/test/selenium/webdriver/firefox/firefox_service_tests.py @@ -27,7 +27,9 @@ def test_log_output_as_filename() -> None: log_file = "geckodriver.log" service = Service(log_output=log_file) try: - driver = Firefox(service=service) + with pytest.warns(None) as record: + driver = Firefox(service=service) + assert len(record) == 0 with open(log_file) as fp: assert "geckodriver\tINFO\tListening" in fp.readline() finally: diff --git a/py/test/selenium/webdriver/remote/remote_firefox_profile_tests.py b/py/test/selenium/webdriver/remote/remote_firefox_profile_tests.py index 70f756e91726f..6d5c1d0cb54df 100644 --- a/py/test/selenium/webdriver/remote/remote_firefox_profile_tests.py +++ b/py/test/selenium/webdriver/remote/remote_firefox_profile_tests.py @@ -22,7 +22,9 @@ @pytest.fixture def driver(options): - driver = webdriver.Remote(options=options) + with pytest.warns(None) as record: + driver = webdriver.Remote(options=options) + assert len(record) == 0 yield driver driver.quit()