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>
28 lines
849 B
Python
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)
|