fix: "view all" link pointed at /history path (404); use ?history query

This commit is contained in:
jozamudi committed 2026-08-23 21:28:24 +00:00
1 parent 50d30a8d3f
commit 2752d49411
2 files changed
+11 -8

No files matched your search

+10 -7
View File
@@ -115,10 +115,9 @@ async def _history_page_and_delete():
op.open(urllib.request.Request(BASE + "/login",
data=json.dumps({"username": "erin", "password": "erinpw12345"}).encode(),
headers={"Content-Type": "application/json"}, method="POST"))
for e in ({"title": "Hist A", "slug_id": "hist-a", "season_id": 1, "ep_id": 7,
"lang": "eng", "ep": 7, "pos": 5},
{"title": "Hist B", "slug_id": "hist-b", "season_id": 2, "ep_id": 9,
"lang": "jpn", "ep": 9, "pos": 30, "dur": 600}):
for n in range(1, 6): # 5 entries: makes the home "view all" link render
e = {"title": f"Hist {n}", "slug_id": f"hist-{n}", "season_id": n, "ep_id": n,
"lang": "eng", "ep": n, "pos": 5, "dur": 600}
op.open(urllib.request.Request(BASE + "/api/history",
data=json.dumps(e).encode(),
headers={"Content-Type": "application/json"}, method="POST"))
@@ -130,13 +129,17 @@ async def _history_page_and_delete():
page.on("pageerror", lambda e: errors.append(str(e)))
await _login(page, "erin", "erinpw12345")
await page.goto(BASE + "/?history")
# regression: "view all" must go to the ?history query, not the /history path
await page.goto(BASE + "/")
await page.wait_for_selector("a:has-text('view all')", timeout=15000)
assert (await page.get_attribute("a:has-text('view all')", "href")).endswith("/?history")
await page.click("a:has-text('view all')", force=True)
await page.wait_for_selector(".card.hist", timeout=15000)
await page.wait_for_function(
"document.querySelectorAll('.card.hist').length == 2", timeout=15000, polling=POLL)
"document.querySelectorAll('.card.hist').length == 5", timeout=15000, polling=POLL)
await page.click(".card.hist .del", force=True)
await page.wait_for_function(
"document.querySelectorAll('.card.hist').length == 1", timeout=15000, polling=POLL)
"document.querySelectorAll('.card.hist').length == 4", timeout=15000, polling=POLL)
await page.wait_for_selector(".toast", timeout=5000)
assert not errors, errors
await browser.close()