feat: add scoped alpha sync and local self-correlation
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import { readFile } from "node:fs/promises";
|
||||
|
||||
test("account → full sync → research → resync → PnL → filtered export → logout", async ({
|
||||
test("account → scoped sync → research → resync → PnL → filtered export → logout", async ({
|
||||
page,
|
||||
}) => {
|
||||
const failures: string[] = [];
|
||||
@@ -48,7 +48,29 @@ test("account → full sync → research → resync → PnL → filtered export
|
||||
await expect(simulation).toContainText("10,000(本地设定)");
|
||||
await expect(simulation).toContainText("9,997");
|
||||
await page.getByRole("button", { name: "Alpha 管理", exact: true }).click();
|
||||
await page.getByRole("button", { name: "同步平台数据" }).click();
|
||||
await expect(
|
||||
page.getByRole("tab", { name: "待提交", exact: true }),
|
||||
).toHaveAttribute("aria-selected", "true");
|
||||
await expect(
|
||||
page.getByRole("button", { name: "全量同步已提交" }),
|
||||
).toHaveCount(0);
|
||||
await page.getByRole("button", { name: "按天同步", exact: true }).click();
|
||||
await page.getByLabel("同步开始日期").fill("2025-01-01");
|
||||
await page.getByLabel("同步结束日期").fill("2025-01-01");
|
||||
await page.getByRole("button", { name: "开始同步", exact: true }).click();
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
(
|
||||
await (
|
||||
await page.request.get("/api/v1/alphas?submission=UNSUBMITTED")
|
||||
).json()
|
||||
).total,
|
||||
)
|
||||
.toBe(413);
|
||||
await page.keyboard.press("Escape");
|
||||
await page.getByRole("tab", { name: "已提交", exact: true }).click();
|
||||
await page.getByRole("button", { name: "全量同步已提交" }).click();
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
@@ -58,6 +80,7 @@ test("account → full sync → research → resync → PnL → filtered export
|
||||
.toBe(620);
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(page.locator(".job-panel")).not.toBeVisible();
|
||||
await page.getByRole("tab", { name: "待提交", exact: true }).click();
|
||||
await expect(page.locator(".library-stats strong").first()).toHaveText("620");
|
||||
await page.screenshot({
|
||||
path: "../output/playwright/alpha-library.png",
|
||||
@@ -134,8 +157,9 @@ test("account → full sync → research → resync → PnL → filtered export
|
||||
const download = await downloading;
|
||||
const contents = await readFile((await download.path())!, "utf-8");
|
||||
expect(contents).toContain("TEST0619");
|
||||
expect(contents).toContain("TEST0000");
|
||||
expect((contents.match(/TEST\d{4}/g) ?? []).length).toBe(620);
|
||||
expect(contents).toContain("TEST0001");
|
||||
expect(contents).not.toContain("TEST0000");
|
||||
expect((contents.match(/TEST\d{4}/g) ?? []).length).toBe(413);
|
||||
await page.getByRole("button", { name: "退出登录" }).click();
|
||||
await expect(
|
||||
page.getByRole("heading", { name: "登录研究工作空间" }),
|
||||
@@ -172,6 +196,15 @@ test("batch tags, column visibility, server pagination and saved preferences", a
|
||||
headers,
|
||||
data: { kind: "full_sync" },
|
||||
});
|
||||
await page.request.post("/api/v1/sync-jobs", {
|
||||
headers,
|
||||
data: {
|
||||
kind: "daily_sync",
|
||||
submission: "UNSUBMITTED",
|
||||
date_from: "2025-01-01",
|
||||
date_to: "2025-01-01",
|
||||
},
|
||||
});
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
@@ -182,7 +215,7 @@ test("batch tags, column visibility, server pagination and saved preferences", a
|
||||
}
|
||||
await page.getByRole("textbox", { name: "搜索 Alpha" }).fill("TEST006");
|
||||
await page.getByRole("button", { name: "查询", exact: true }).click();
|
||||
await expect(page.locator(".alpha-link")).toHaveCount(10);
|
||||
await expect(page.locator(".alpha-link")).toHaveCount(6);
|
||||
const selectAll = page.getByRole("checkbox", { name: "Select all rows" });
|
||||
await selectAll.focus();
|
||||
await selectAll.press("Space");
|
||||
@@ -204,7 +237,7 @@ test("batch tags, column visibility, server pagination and saved preferences", a
|
||||
).json()
|
||||
).total,
|
||||
)
|
||||
.toBe(10);
|
||||
.toBe(6);
|
||||
await page.getByRole("button", { name: "显示列设置" }).click();
|
||||
await page
|
||||
.locator(".columns-picker")
|
||||
|
||||
Reference in New Issue
Block a user