Files
VasanthandClaude Opus 5.5 344718007e Share page-check helpers in tests/page_check_common.py
MODES, TEST_FILL, FAKE_BRIDGE, the stub loader, the page opener and the no-AI case list now live in one place; sample_data and push move to tests/conftest.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 15:52:35 +05:30

28 lines
849 B
Python

"""Shared by the page checks: one headless Chromium for the whole run
(Playwright's sync API allows only one instance per process), and the fixtures
that don't depend on which page is under test."""
import pytest
from page_check_common import WIRED, push_to
from playwright.sync_api import sync_playwright
@pytest.fixture(scope="session")
def browser():
with sync_playwright() as p:
b = p.chromium.launch()
yield b
b.close()
@pytest.fixture
def sample_data():
"""Use on cases that need the page's own sample data; they skip on a bot-wired page."""
if WIRED:
pytest.skip("page is wired to a bot, so it has no sample data")
@pytest.fixture
def push(page):
"""push(event, data): send one contract envelope to the page, as the bot would."""
return lambda event, data: push_to(page, event, data)