feat: Playwright browser wrapper with compact snapshot
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import pytest
|
||||
|
||||
playwright = pytest.importorskip("playwright.sync_api")
|
||||
|
||||
from auto_reverse.browser import Browser # noqa: E402
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def browser():
|
||||
try:
|
||||
b = Browser(proxy_port=None, headless=True)
|
||||
b.start()
|
||||
except Exception as exc: # browser binary missing, etc.
|
||||
pytest.skip(f"browser unavailable: {exc}")
|
||||
yield b
|
||||
b.stop()
|
||||
|
||||
|
||||
def test_navigate_and_snapshot(browser, fixture_site):
|
||||
browser.navigate(fixture_site + "/")
|
||||
snap = browser.snapshot()
|
||||
assert snap["url"].endswith("/")
|
||||
assert "title" in snap
|
||||
Reference in New Issue
Block a user