Files
ppr-ng/tests/e2e/test_public_ppr_submission.py
2026-06-20 10:43:08 -04:00

39 lines
1.3 KiB
Python

import os
from datetime import datetime
from playwright.sync_api import expect
BASE_URL = os.getenv("E2E_BASE_URL", "http://localhost:8082").rstrip("/")
def app_url(path):
return f"{BASE_URL}/{path.lstrip('/')}"
def test_public_ppr_form_submits_successfully(page):
unique_registration = f"GE{datetime.utcnow().strftime('%H%M')}"
page.goto(app_url("/ppr.html"))
page.locator("#ac_reg").fill(unique_registration)
page.locator("#ac_type").fill("PA28")
page.locator("#ac_call").fill(unique_registration)
page.locator("#captain").fill("E2E Test Pilot")
page.locator("#in_from").fill("EGLL")
page.locator("#eta-date").fill("2026-06-21")
page.locator("#eta-time").select_option("10:00")
page.locator("#pob_in").fill("2")
page.locator("#fuel").select_option("100LL")
page.locator("#out_to").fill("EGFF")
page.locator("#etd-date").fill("2026-06-21")
page.locator("#etd-time").select_option("12:00")
page.locator("#pob_out").fill("2")
page.locator("#phone").fill("0123456789")
page.locator("#notes").fill("Submitted by Playwright e2e")
page.get_by_role("button", name="Submit PPR Request").click()
expect(page.locator("#success-message")).to_be_visible()
expect(page.locator("#success-message")).to_contain_text("PPR Request Submitted")