feat: add local correlation filters and full recheck action
Deploy production / deploy (push) Successful in 54s
Deploy production / deploy (push) Successful in 54s
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
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();
|
||||
});
|
||||
@@ -0,0 +1,62 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("local correlation filters combine with tabs and survive saved views", async ({
|
||||
page,
|
||||
}) => {
|
||||
let params = new URLSearchParams();
|
||||
await page.route(/\/api\/v1\/alphas\?/, async (route) => {
|
||||
params = new URL(route.request().url()).searchParams;
|
||||
await route.fulfill({
|
||||
json: { items: [], total: 0, limit: 25, offset: 0 },
|
||||
});
|
||||
});
|
||||
await page.goto("/#alphas");
|
||||
await page.getByLabel("密码", { exact: true }).fill("browser-test-password");
|
||||
await page.getByRole("button", { name: "进入工作空间" }).click();
|
||||
const blocked = page.getByRole("tab", { name: "提交受阻", exact: true });
|
||||
await blocked.click();
|
||||
await expect.poll(() => params.get("submission_blocked")).toBe("true");
|
||||
expect(params.get("submission")).toBe("UNSUBMITTED");
|
||||
await page.getByRole("button", { name: "筛选 Alpha", exact: true }).click();
|
||||
await page
|
||||
.getByRole("textbox", { name: "搜索 Alpha", exact: true })
|
||||
.fill("candidate");
|
||||
await page
|
||||
.getByText("全部状态", { exact: true })
|
||||
.click();
|
||||
await page.getByRole("option", { name: /相关性偏高/ }).click();
|
||||
await page.getByText("更多筛选", { exact: true }).click();
|
||||
await page
|
||||
.getByRole("spinbutton", { name: "本地自相关 最小值", exact: true })
|
||||
.fill("0.7");
|
||||
await page
|
||||
.getByRole("spinbutton", { name: "本地自相关 最大值", exact: true })
|
||||
.fill("0.75");
|
||||
await page.getByRole("button", { name: "查询", exact: true }).click();
|
||||
await expect.poll(() => params.get("q")).toBe("candidate");
|
||||
expect(params.get("submission_blocked")).toBe("true");
|
||||
await page.getByRole("button", { name: "保存为新视图", exact: true }).click();
|
||||
await page
|
||||
.getByRole("textbox", { name: "视图名称", exact: true })
|
||||
.fill("相关性候选");
|
||||
await page.getByRole("button", { name: "保存视图", exact: true }).click();
|
||||
const saved = page.getByRole("tab", { name: "相关性候选" });
|
||||
await expect(saved).toBeVisible();
|
||||
await page.getByRole("tab", { name: "已提交", exact: true }).click();
|
||||
await expect.poll(() => params.get("submission")).toBe("SUBMITTED");
|
||||
expect(params.has("submission_blocked")).toBe(false);
|
||||
await saved.click();
|
||||
await expect.poll(() => params.get("submission_blocked")).toBe("true");
|
||||
expect(params.get("q")).toBe("candidate");
|
||||
expect(params.get("local_correlation_status")).toBe("high");
|
||||
expect(params.get("local_correlation_min")).toBe("0.7");
|
||||
expect(params.get("local_correlation_max")).toBe("0.75");
|
||||
await blocked.click();
|
||||
await page.getByRole("button", { name: "筛选 Alpha", exact: true }).click();
|
||||
await page.getByRole("button", { name: "重置", exact: true }).click();
|
||||
await expect.poll(() => params.has("q")).toBe(false);
|
||||
expect(params.get("submission_blocked")).toBe("true");
|
||||
expect(params.has("local_correlation_status")).toBe(false);
|
||||
expect(params.has("local_correlation_min")).toBe(false);
|
||||
await expect(blocked).toHaveAttribute("aria-selected", "true");
|
||||
});
|
||||
Reference in New Issue
Block a user