50 lines
1.9 KiB
TypeScript
50 lines
1.9 KiB
TypeScript
|
|
import { expect, test } from "@playwright/test";
|
||
|
|
|
||
|
|
test("recheck button precedes daily sync and submits an unrestricted job", async ({
|
||
|
|
page,
|
||
|
|
}) => {
|
||
|
|
let requestBody: unknown;
|
||
|
|
await page.route(/\/api\/v1\/sync-jobs$/, async (route) => {
|
||
|
|
if (route.request().method() !== "POST") return route.continue();
|
||
|
|
requestBody = route.request().postDataJSON();
|
||
|
|
await route.fulfill({
|
||
|
|
status: 202,
|
||
|
|
json: {
|
||
|
|
id: "recheck-test",
|
||
|
|
kind: "self_correlation_recheck",
|
||
|
|
status: "completed",
|
||
|
|
total: 0,
|
||
|
|
processed: 0,
|
||
|
|
failed: 0,
|
||
|
|
payload: { alpha_ids: [] },
|
||
|
|
checkpoint: {},
|
||
|
|
created_at: new Date().toISOString(),
|
||
|
|
updated_at: new Date().toISOString(),
|
||
|
|
},
|
||
|
|
});
|
||
|
|
});
|
||
|
|
await page.goto("/#alphas");
|
||
|
|
await page.getByLabel("密码", { exact: true }).fill("browser-test-password");
|
||
|
|
await page.getByRole("button", { name: "进入工作空间" }).click();
|
||
|
|
await page.getByRole("tab", { name: "提交受阻", exact: true }).click();
|
||
|
|
await page.getByRole("button", { name: "筛选 Alpha", exact: true }).click();
|
||
|
|
await page
|
||
|
|
.getByRole("textbox", { name: "搜索 Alpha", exact: true })
|
||
|
|
.fill("only-this-page");
|
||
|
|
await page.getByRole("button", { name: "查询", exact: true }).click();
|
||
|
|
const recheck = page.getByRole("button", { name: "重检自相关", exact: true });
|
||
|
|
const daily = page.getByRole("button", { name: "按天同步", exact: true });
|
||
|
|
await expect(recheck).toBeEnabled();
|
||
|
|
const left = (await recheck.boundingBox())!;
|
||
|
|
const right = (await daily.boundingBox())!;
|
||
|
|
expect(left.x + left.width).toBeLessThanOrEqual(right.x);
|
||
|
|
expect(Math.abs(left.y - right.y)).toBeLessThan(3);
|
||
|
|
await recheck.click();
|
||
|
|
await expect
|
||
|
|
.poll(() => requestBody)
|
||
|
|
.toEqual({ kind: "self_correlation_recheck", alpha_ids: [] });
|
||
|
|
await expect(
|
||
|
|
page.getByText("没有预检通过或检查通过的 Alpha,无需重检"),
|
||
|
|
).toBeVisible();
|
||
|
|
});
|