test: add Playwright browser tests and document test loop
- add real browser test for overview and options pages - document engineering learnings in AGENTS.md - commit NiceGUI header layout fix - limit options initial expirations for faster first render
This commit is contained in:
31
tests/test_e2e_playwright.py
Normal file
31
tests/test_e2e_playwright.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from playwright.sync_api import Page, expect, sync_playwright
|
||||
|
||||
BASE_URL = "http://127.0.0.1:8000"
|
||||
ARTIFACTS = Path("tests/artifacts")
|
||||
ARTIFACTS.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
||||
def test_homepage_and_options_page_render() -> None:
|
||||
with sync_playwright() as p:
|
||||
browser = p.chromium.launch(headless=True)
|
||||
page = browser.new_page(viewport={"width": 1440, "height": 1000})
|
||||
|
||||
page.goto(BASE_URL, wait_until="networkidle", timeout=30000)
|
||||
expect(page).to_have_title("NiceGUI")
|
||||
expect(page.locator("text=Vault Dashboard").first).to_be_visible(timeout=10000)
|
||||
expect(page.locator("text=Overview").first).to_be_visible(timeout=10000)
|
||||
page.screenshot(path=str(ARTIFACTS / "overview.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)
|
||||
body_text = page.locator("body").inner_text(timeout=15000)
|
||||
assert "Server error" not in body_text
|
||||
assert "RuntimeError" not in body_text
|
||||
page.screenshot(path=str(ARTIFACTS / "options.png"), full_page=True)
|
||||
|
||||
browser.close()
|
||||
Reference in New Issue
Block a user