Stream reader results and navigate with cursors [skip ci]

This commit is contained in:
2026-11-07 17:27:31 +08:00
parent b5b1994993
commit ae4a505d70
10 changed files with 149 additions and 46 deletions
+7 -4
View File
@@ -21,14 +21,14 @@ test("sample index has working pagination and returns to the same list", async (
const first = await page.locator(".paper-row h3").first().innerText();
await page.screenshot({ path: info.outputPath("home.png"), fullPage: true });
await page.getByRole("link", { name: "下一页" }).click();
await expect(page).toHaveURL(/page=2/);
await expect(page).toHaveURL(/cursor=/);
await expect(page.locator(".paper-row h3").first()).not.toHaveText(first);
await page.getByRole("link", { name: "上一页" }).click();
await expect(page.locator(".paper-row h3").first()).toHaveText(first);
await page.goto("/?page=999999");
await expect(page).toHaveURL(/page=3/);
await page.getByRole("link", { name: "下一页" }).click();
await page.getByRole("link", { name: "下一页" }).click();
await expect(page.locator(".paper-row")).toHaveCount(4);
await expect(page.getByRole("navigation", { name: "论文分页" })).toContainText("3 / 3");
await expect(page.getByRole("navigation", { name: "论文分页" })).toContainText("本页 4 篇");
await expect(page.getByRole("link", { name: "下一页" })).toHaveCount(0);
});
@@ -38,10 +38,13 @@ test("search, empty results, author scope and category filters work", async ({ p
await page.getByRole("button", { name: "搜索论文", exact: true }).click();
await expect(page.getByRole("heading", { name: "没有找到符合条件的论文" })).toBeVisible();
await page.getByRole("link", { name: "查看全部论文" }).click();
await expect(page.getByRole("textbox", {name:"搜索论文",exact:true})).toHaveValue("");
await expect(page.locator(".paper-row")).toHaveCount(8);
const author = snapshot.papers[0].authors[0];
await page.getByRole("combobox", { name: "搜索范围", exact: true }).selectOption("author");
await page.getByRole("textbox", { name: "搜索论文", exact: true }).fill(author);
await page.getByRole("button", { name: "搜索论文", exact: true }).click();
await expect(page).toHaveURL(/searchIn=author/);
await expect(page.locator(".paper-row").first()).toContainText(author);
await page.getByRole("link", { name: "清除筛选" }).click();
const topic = snapshot.papers[0].topics[0];