"""Seam 1 page check for the Run tab: run_tab.html filled with a test config, opened with the fake Qt bridge, driven through window.__pyMsg. Every case runs in light, dark and narrow. PAGE_CHECK_RUN_TAB_HTML: check a generated page instead (its config must already be filled).""" import json import os from pathlib import Path import pytest from page_check_common import FAKE_BRIDGE, MODES, open_page ROOT = Path(__file__).resolve().parents[2] TEMPLATE = ROOT / "skills" / "rpa-run-tab" / "templates" / "run_tab.html" CFG = {"title": "Test Bot", "sub": "Page check", "input": True, "inputHint": "Test workbook", "sample": True, "darkKey": "test_dark", "checkpoints": [{"name": "Sign in", "max": 300}, {"name": "Process rows", "max": 0}, {"name": "Finish up", "max": 120}]} def _url(tmp, cfg): if os.environ.get("PAGE_CHECK_RUN_TAB_HTML"): return Path(os.environ["PAGE_CHECK_RUN_TAB_HTML"]).resolve().as_uri() out = tmp / f"run_tab_{cfg['input']}.html" out.write_text(TEMPLATE.read_text(encoding="utf-8").replace("%%CONFIG%%", json.dumps(cfg)), encoding="utf-8") return out.as_uri() @pytest.fixture(scope="session") def page_url(tmp_path_factory): return _url(tmp_path_factory.mktemp("run_tab"), CFG) @pytest.fixture(scope="session") def no_input_url(tmp_path_factory): return _url(tmp_path_factory.mktemp("run_tab_noinput"), {**CFG, "input": False, "sample": False}) @pytest.fixture(params=list(MODES)) def page(request, browser, page_url): yield from open_page(browser, page_url, request.param, FAKE_BRIDGE) @pytest.fixture(params=list(MODES)) def no_input_page(request, browser, no_input_url): yield from open_page(browser, no_input_url, request.param, FAKE_BRIDGE)