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>
This commit is contained in:
1 parent
7ad73c1fda
commit
344718007e
8 files changed
+125
-189
No files matched your search
+17
-2
@@ -1,6 +1,8 @@
|
||||
"""Shared by both page checks: one headless Chromium for the whole run
|
||||
(Playwright's sync API allows only one instance per process)."""
|
||||
"""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
|
||||
|
||||
|
||||
@@ -10,3 +12,16 @@ def browser():
|
||||
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)
|
||||
Reference in new issue
Block a user