refactor: remove optional patchright backend

Patchright scored identically to plain Playwright on reCAPTCHA v3 (the
binary handles stealth at C++ level) while breaking proxy auth and
add_init_script (#27). Removed the backend param, CLOAKBROWSER_BACKEND
env var, the patchright extra, and the two backend-specific tests.
Stock Playwright is now the only backend.
This commit is contained in:
CloakHQ
2026-06-20 21:50:22 +02:00
parent 776630e08b
commit d67c21abbe
9 changed files with 58 additions and 135 deletions
+24 -1
View File
@@ -1,10 +1,33 @@
"""Basic launch tests for cloakbrowser."""
import pytest
from cloakbrowser import launch, launch_async, binary_info
from cloakbrowser import (
launch,
launch_async,
launch_context,
launch_persistent_context,
binary_info,
)
from cloakbrowser.config import get_chromium_version
@pytest.mark.parametrize("env", [None, "patchright"])
def test_removed_backend_kwarg_raises(env, monkeypatch):
"""The removed `backend` parameter raises a clear TypeError before any
launch side effects, regardless of the (also removed) CLOAKBROWSER_BACKEND
env var. Guards the patchright removal."""
if env is None:
monkeypatch.delenv("CLOAKBROWSER_BACKEND", raising=False)
else:
monkeypatch.setenv("CLOAKBROWSER_BACKEND", env)
with pytest.raises(TypeError, match="backend"):
launch(backend="patchright")
with pytest.raises(TypeError, match="backend"):
launch_context(backend="patchright")
with pytest.raises(TypeError, match="backend"):
launch_persistent_context("/tmp/cloakbrowser-test-profile", backend="patchright")
def test_binary_info():
"""binary_info() returns expected structure."""
info = binary_info()