32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
"""Phase 3 gate, the WebApp: every page loads from the new API. The platform runs as in
|
|
production (API, Dagster), loaded with the synthetic CaCu hospital and the messy site;
|
|
Playwright drives the real pages against it (WebApp/e2e)."""
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from test_conectar import ok, run
|
|
|
|
from conftest import put_concept_map
|
|
|
|
ROOT = Path(__file__).parents[2]
|
|
HOSPITAL = ROOT / "tests" / "fixtures" / "hospital"
|
|
PIPELINE = ROOT / "tests" / "fixtures" / "pipelines" / "hospital_cacu.json"
|
|
|
|
|
|
@pytest.mark.webapp
|
|
@pytest.mark.parametrize("platform", ["sqlite"], indirect=True) # pages read one API either way
|
|
def test_every_page_loads_from_the_api(api, platform, messy_site):
|
|
hospital = json.loads(PIPELINE.read_text().replace("{hospital}", str(HOSPITAL)))
|
|
put_concept_map(api, "hospital_cacu")
|
|
ok(api.put("/ingest/pipelines/cacu", json=hospital))
|
|
run(api, "cacu")
|
|
put_concept_map(api, "messy_site")
|
|
ok(api.put("/ingest/pipelines/site", json=json.loads(messy_site.drawn)))
|
|
run(api, "site")
|
|
subprocess.run(["npx", "playwright", "test"], cwd=ROOT / "WebApp", check=True,
|
|
env={**os.environ, "API_URL": str(api.base_url).rstrip("/")}) # fmt: skip
|