feat: complete frontend ui integrity followups
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled

This commit is contained in:
Frontend Developer
2026-07-05 14:09:49 +08:00
parent c7f1dd4d4c
commit 45e671966a
213 changed files with 13517 additions and 1344 deletions

View File

@@ -0,0 +1 @@
"""Sprint integration test package."""

View File

@@ -0,0 +1,49 @@
from __future__ import annotations
import importlib.util
import sys
from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parents[2]
REGRESSION_SCRIPT = PROJECT_ROOT / "scripts" / "sprint4_real_backend_regression.py"
def _load_regression_module():
spec = importlib.util.spec_from_file_location("sprint4_real_backend_regression", REGRESSION_SCRIPT)
assert spec is not None and spec.loader is not None
module = importlib.util.module_from_spec(spec)
sys.modules[spec.name] = module
spec.loader.exec_module(module)
return module
def test_t_b_27_real_backend_suite_covers_five_react_modules() -> None:
module = _load_regression_module()
checks = module.build_checks()
assert [check.module for check in checks] == ["share", "data-query", "review", "llm", "poster"]
assert all("/api/" in check.description for check in checks)
def test_t_c_44_poster_cli_docker_delivery_is_wired() -> None:
dockerfile = (PROJECT_ROOT / "Dockerfile.poster").read_text(encoding="utf-8")
compose = (PROJECT_ROOT / "docker-compose.yml").read_text(encoding="utf-8")
workflow = (PROJECT_ROOT / ".github" / "workflows" / "ci.yml").read_text(encoding="utf-8")
assert 'ENTRYPOINT ["python", "/app/scripts/gaokao-poster"]' in dockerfile
assert "gaokao-poster:" in compose
assert "dockerfile: Dockerfile.poster" in compose
assert "docker build -f Dockerfile.poster -t gaokao-poster-cli:test ." in workflow
def test_frontend_contract_gate_includes_sprint4_poster_status_path() -> None:
codegen_check = (PROJECT_ROOT / "apps" / "web" / "scripts" / "codegen-check.ts").read_text(encoding="utf-8")
generated_types = (PROJECT_ROOT / "apps" / "web" / "src" / "types" / "api-generated.d.ts").read_text(
encoding="utf-8",
)
assert "/api/poster/{job_id}/status" in generated_types
assert "/api/share-link/{code}/stats" in codegen_check
assert "/api/poster/generate" in codegen_check

View File

@@ -0,0 +1,37 @@
from __future__ import annotations
from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parents[1]
def test_poster_cli_dockerfile_targets_dedicated_cli_entrypoint() -> None:
dockerfile = (PROJECT_ROOT / "Dockerfile.poster").read_text(encoding="utf-8")
assert "FROM python:3.12-slim" in dockerfile
assert "fonts-noto-cjk" in dockerfile
assert "requirements-admin.txt" in dockerfile
assert "COPY data /app/data" in dockerfile
assert "COPY scripts/gaokao-poster /app/scripts/gaokao-poster" in dockerfile
assert 'ENTRYPOINT ["python", "/app/scripts/gaokao-poster"]' in dockerfile
assert 'CMD ["--help"]' in dockerfile
def test_compose_declares_poster_cli_service_profile() -> None:
compose = (PROJECT_ROOT / "docker-compose.yml").read_text(encoding="utf-8")
assert "gaokao-poster:" in compose
assert "dockerfile: Dockerfile.poster" in compose
assert "localhost/gaokao-volunteer-system-poster:latest" in compose
assert 'profiles: ["poster"]' in compose
assert "./reports:/work/reports" in compose
def test_ci_builds_poster_cli_docker_image() -> None:
workflow = (PROJECT_ROOT / ".github" / "workflows" / "ci.yml").read_text(encoding="utf-8")
assert "Validate Poster CLI Docker contract" in workflow
assert "tests/test_poster_cli_docker_contract.py" in workflow
assert "Build Poster CLI Docker image" in workflow
assert "docker build -f Dockerfile.poster -t gaokao-poster-cli:test ." in workflow