import re from pathlib import Path ROOT = Path(__file__).resolve().parents[2] def test_action_page_letter_builder(): """act.html: a two-minute letter into the official record, no coordination.""" page = (ROOT / "act.html").read_text() # Wizard inputs assert 'id="act-name"' in page assert 'id="act-role"' in page assert 'id="act-reason"' in page assert 'id="act-personal"' in page # Three verified recipients assert "publicutilities@gov.mb.ca" in page assert "mla" in page.lower() and "councillor" in page.lower() # Riding and ward dropdowns do the work; roster is real and dated assert 'id="act-mla-select"' in page assert "Agassiz" in page and "Wolseley" in page assert "450 Broadway" in page assert 'id="act-council-select"' in page # The stake sentence in the letter carries no bracket tag assert "E, illustrative" not in page # Handoff paths assert "mailto:" in page assert "window.print" in page assert "Copy letter" in page # Registry-backed household stake, honestly fenced assert "518,054" in page or "518,000" in page assert "chip-e" in page # PD discipline: docket must be verified before filing lowered = page.lower() assert "docket" in lowered assert ("verify" in lowered) or ("confirm" in lowered) # Petition funnel is retired; letters and interveners remain assert "petition.html" not in page assert "citizen petition" not in page.lower() assert "signature sheet" not in page.lower() # Runner-up: intervener starter kit assert "ntervener" in page assert "Rules of Practice" in page # Privacy stance and ledger guard assert "leaves this page" in page assert "895 MW" not in page def test_landing_offers_take_action(): html = (ROOT / "index.html").read_text() assert "./act.html" in html assert "Take Action" in html assert "petition.html" not in html assert "Sign the petition" not in html def test_action_page_embeds_share_kit(): """STEP 1 Share on act.html mounts SEShare; Write / Go further remain.""" page = (ROOT / "act.html").read_text() assert (ROOT / "assets" / "js" / "se-share.js").is_file() assert (ROOT / "assets" / "css" / "se-share.css").is_file() assert re.search(r'href="\./assets/css/se-share\.css(\?v=[0-9a-f]+)?"', page) assert re.search(r'src="\./assets/js/se-share\.js(\?v=[0-9a-f]+)?"', page) assert "data-se-share" in page assert "STEP 1" in page and "Share" in page assert "STEP 2" in page and "Write" in page assert "STEP 3" in page and "Go further" in page ladder = page.split('class="ladder"', 1)[1].split("", 1)[0] assert 'id="share"' in ladder assert "js-share-sms" in ladder or 'data-se-share-channel="sms"' in ladder assert "js-share-wa" in ladder or 'data-se-share-channel="wa"' in ladder or 'data-se-share-channel="whatsapp"' in ladder