feat(BT-003A): add event comparison page

This commit is contained in:
Bu5hm4nn
2026-03-24 19:20:35 +01:00
parent 68cb2aa51a
commit ff4e565ee6
8 changed files with 672 additions and 43 deletions

View File

@@ -44,6 +44,33 @@ def test_homepage_and_options_page_render() -> None:
assert "RuntimeError" not in rerun_text
assert "Server error" not in rerun_text
page.goto(f"{BASE_URL}/event-comparison", wait_until="networkidle", timeout=30000)
expect(page.locator("text=Event Comparison").first).to_be_visible(timeout=15000)
expect(page.locator("text=Comparison Form").first).to_be_visible(timeout=15000)
expect(page.locator("text=Ranked Results").first).to_be_visible(timeout=15000)
expect(page.locator("text=Scenario Metadata").first).to_be_visible(timeout=15000)
expect(page.locator("text=Portfolio Value Paths").first).to_be_visible(timeout=15000)
event_text = page.locator("body").inner_text(timeout=15000)
assert "GLD January 2024 Selloff" in event_text
assert "Protective Put ATM" in event_text
assert "Baseline series shows the unhedged collateral value path" in event_text
assert "Hedged margin call days" in event_text
assert "Templates compared" in event_text and "4" in event_text
assert "RuntimeError" not in event_text
assert "Server error" not in event_text
assert "Traceback" not in event_text
page.get_by_label("Event preset").click()
page.get_by_text("GLD January 2024 Drawdown", exact=True).click()
page.get_by_role("button", name="Run comparison").click()
expect(page.locator("text=GLD January 2024 Drawdown").first).to_be_visible(timeout=15000)
rerun_event_text = page.locator("body").inner_text(timeout=15000)
assert "Laddered Puts 33/33/33 ATM + 95% + 90%" in rerun_event_text
assert "Templates compared" in rerun_event_text and "3" in rerun_event_text
assert "RuntimeError" not in rerun_event_text
assert "Server error" not in rerun_event_text
page.screenshot(path=str(ARTIFACTS / "event-comparison.png"), full_page=True)
page.goto(f"{BASE_URL}/options", wait_until="domcontentloaded", timeout=30000)
expect(page.locator("text=Options Chain").first).to_be_visible(timeout=15000)
expect(page.locator("text=Filters").first).to_be_visible(timeout=15000)