fix: "view all" link pointed at /history path (404); use ?history query
This commit is contained in:
1 parent
50d30a8d3f
commit
2752d49411
2 files changed
+11
-8
No files matched your search
+1
-1
@@ -111,7 +111,7 @@ function showHome() {
|
|||||||
head.append(el("h2", null, "Recently played"));
|
head.append(el("h2", null, "Recently played"));
|
||||||
if (history.length >= 5) {
|
if (history.length >= 5) {
|
||||||
const va = el("a", null, "view all \u2192");
|
const va = el("a", null, "view all \u2192");
|
||||||
va.href = BASE + "history";
|
va.href = BASE + "?history";
|
||||||
head.append(va);
|
head.append(va);
|
||||||
}
|
}
|
||||||
main.append(head);
|
main.append(head);
|
||||||
|
|||||||
+10
-7
@@ -115,10 +115,9 @@ async def _history_page_and_delete():
|
|||||||
op.open(urllib.request.Request(BASE + "/login",
|
op.open(urllib.request.Request(BASE + "/login",
|
||||||
data=json.dumps({"username": "erin", "password": "erinpw12345"}).encode(),
|
data=json.dumps({"username": "erin", "password": "erinpw12345"}).encode(),
|
||||||
headers={"Content-Type": "application/json"}, method="POST"))
|
headers={"Content-Type": "application/json"}, method="POST"))
|
||||||
for e in ({"title": "Hist A", "slug_id": "hist-a", "season_id": 1, "ep_id": 7,
|
for n in range(1, 6): # 5 entries: makes the home "view all" link render
|
||||||
"lang": "eng", "ep": 7, "pos": 5},
|
e = {"title": f"Hist {n}", "slug_id": f"hist-{n}", "season_id": n, "ep_id": n,
|
||||||
{"title": "Hist B", "slug_id": "hist-b", "season_id": 2, "ep_id": 9,
|
"lang": "eng", "ep": n, "pos": 5, "dur": 600}
|
||||||
"lang": "jpn", "ep": 9, "pos": 30, "dur": 600}):
|
|
||||||
op.open(urllib.request.Request(BASE + "/api/history",
|
op.open(urllib.request.Request(BASE + "/api/history",
|
||||||
data=json.dumps(e).encode(),
|
data=json.dumps(e).encode(),
|
||||||
headers={"Content-Type": "application/json"}, method="POST"))
|
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)))
|
page.on("pageerror", lambda e: errors.append(str(e)))
|
||||||
|
|
||||||
await _login(page, "erin", "erinpw12345")
|
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_selector(".card.hist", timeout=15000)
|
||||||
await page.wait_for_function(
|
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.click(".card.hist .del", force=True)
|
||||||
await page.wait_for_function(
|
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)
|
await page.wait_for_selector(".toast", timeout=5000)
|
||||||
assert not errors, errors
|
assert not errors, errors
|
||||||
await browser.close()
|
await browser.close()
|
||||||
|
|||||||
Reference in new issue
Block a user