from grantflow.tests.demo_console_helpers import (
    assert_demo_console_tokens,
    demo_console_body,
)


def test_demo_console_page_loads():
    body = demo_console_body()
    assert "GrantFlow Reviewer Console" in body


def test_demo_console_exposes_generation_and_ingest_controls():
    body = demo_console_body()
    assert_demo_console_tokens(
        body,
        [
            "generatePresetSelect",
            "applyPresetBtn",
            "clearPresetContextBtn",
            "generatePresetReadinessPill",
            "generatePresetReadinessText",
            "generatePresetReadinessHint",
            "syncGenerateReadinessBtn",
            "Sync Readiness Now",
            "Missing doc_family:",
            "skipZeroReadinessWarningCheckbox",
            "grantflow_demo_zero_readiness_warning_prefs",
            "Don't ask again for this preset",
            "RAG Readiness (for selected preset)",
            "Generate anyway?",
            "strictPreflight",
            "Strict Preflight",
            "Preflight risk",
            "Strict preflight",
            "Grounded gate",
            "inputContextJson",
            "usaid_gov_ai_kazakhstan",
            "worldbank_public_sector_uzbekistan",
            "ingestPresetSelect",
            "applyIngestPresetBtn",
            "syncIngestDonorBtn",
            "ingestFileInput",
            "ingestMetadataJson",
            "ingestBtn",
            "ingestPresetGuidanceList",
            "ingestChecklistSummary",
            "ingestChecklistProgressList",
            "resetIngestChecklistBtn",
            "syncIngestChecklistServerBtn",
            "copyIngestInventoryJsonBtn",
            "downloadIngestInventoryJsonBtn",
            "downloadIngestInventoryCsvBtn",
            "ingestInventoryJson",
            "grantflow_demo_ingest_checklist_progress",
            "doc_family=",
            "/demo/presets",
            "/generate/presets",
            "/generate/from-preset",
            "/ingest/presets",
            "/ingest",
            "/ingest/inventory?",
            "/ingest/inventory/export?",
            "/status/${encodeURIComponent(jobId)}/metrics",
            "/status/${encodeURIComponent(jobId)}/quality",
            "/status/${encodeURIComponent(jobId)}/critic",
            "/status/${encodeURIComponent(jobId)}/export-payload",
            "/queue/worker-heartbeat",
            "/export",
        ],
    )
