Keep research search recoverable and isolate browser checks [skip ci]
This commit is contained in:
@@ -25,6 +25,11 @@ test("sample index has working pagination and returns to the same list", async (
|
||||
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 expect(page.locator(".paper-row")).toHaveCount(4);
|
||||
await expect(page.getByRole("navigation", { name: "论文分页" })).toContainText("3 / 3");
|
||||
await expect(page.getByRole("link", { name: "下一页" })).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("search, empty results, author scope and category filters work", async ({ page }) => {
|
||||
@@ -34,7 +39,7 @@ test("search, empty results, author scope and category filters work", async ({ p
|
||||
await expect(page.getByRole("heading", { name: "没有找到符合条件的论文" })).toBeVisible();
|
||||
await page.getByRole("link", { name: "查看全部论文" }).click();
|
||||
const author = snapshot.papers[0].authors[0];
|
||||
await page.getByLabel("搜索范围").selectOption("author");
|
||||
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.locator(".paper-row").first()).toContainText(author);
|
||||
@@ -45,7 +50,7 @@ test("search, empty results, author scope and category filters work", async ({ p
|
||||
for (const row of await page.locator(".paper-meta").all()) await expect(row).toContainText(topic);
|
||||
});
|
||||
|
||||
test("article preserves original abstract and offers citation copying", async ({ page }, info) => {
|
||||
test("article preserves original abstract and offers citation copying", async ({ page, baseURL }, info) => {
|
||||
const paper = snapshot.papers[0];
|
||||
await page.goto(`/papers/${paper.id}`);
|
||||
await expect(page.getByRole("heading", { level: 1 })).toHaveText(paper.title);
|
||||
@@ -57,7 +62,7 @@ test("article preserves original abstract and offers citation copying", async ({
|
||||
await expect(page.getByRole("link", { name: "登录", exact: true })).toBeVisible();
|
||||
await page.screenshot({ path: info.outputPath("article.png"), fullPage: true });
|
||||
await page.getByRole("link", { name: "返回论文索引" }).click();
|
||||
await expect(page).toHaveURL("http://localhost:17322/");
|
||||
await expect(page).toHaveURL(new URL("/", baseURL).href);
|
||||
});
|
||||
|
||||
test("all reading themes apply and persist through a reload", async ({ page }) => {
|
||||
|
||||
Reference in New Issue
Block a user