"""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)