重构报销详情证据与动作区(reimbursement-detail-evidence-actions)

这个提交包含在:
2026-05-30 03:29:07 +08:00
父节点 65a8f64b92
当前提交 cb03f2b63d
共修改 9 个文件,包含 434 行新增和 446 行删除
@@ -10,42 +10,10 @@ import {
logout,
MANAGER,
} from "./helpers/auth";
import { ensureFeatureFlagOn } from "./helpers/featureFlags";
import { openNavLink } from "./helpers/navigation";
import { TEST_IDS } from "./helpers/testIds";
type FeatureFlagItem = {
flagKey: string;
overrideMode: "inherit" | "force_on" | "force_off";
rolloutType: "global" | "department_allowlist";
departmentIds: string[];
note: string;
version: number;
effectiveEnabled: boolean;
};
async function ensureFeatureFlagOn(api: Awaited<ReturnType<typeof createAuthenticatedApiClient>>["api"], flagKey: string) {
const list = await apiGetData<{ items: FeatureFlagItem[] }>(api, "/api/system/feature-flags");
const item = list.items.find((flag) => flag.flagKey === flagKey);
if (!item) {
throw new Error(`Missing feature flag: ${flagKey}`);
}
if (item.overrideMode === "force_on" && item.effectiveEnabled) {
return;
}
const response = await api.put(`/api/system/feature-flags/${flagKey}`, {
data: {
overrideMode: "force_on",
rolloutType: "global",
departmentIds: [],
note: "playwright reimbursement payment batch flow",
expectedVersion: item.version,
},
});
if (!response.ok()) {
throw new Error(`Failed to enable feature flag ${flagKey}: ${response.status()} ${await response.text()}`);
}
}
test("E2E 报销支付批次主链路:提交 -> 审批 -> 创建批次 -> 复核 -> 执行 -> 下游收口", async ({
page,
reimbursementDetail,
@@ -59,8 +27,8 @@ test("E2E 报销支付批次主链路:提交 -> 审批 -> 创建批次 -> 复
const paymentDate = new Date().toISOString().slice(0, 10);
try {
await ensureFeatureFlagOn(adminApi.api, "payment_batch_v1");
await ensureFeatureFlagOn(adminApi.api, "erp_sync");
await ensureFeatureFlagOn(adminApi.api, "payment_batch_v1", "playwright reimbursement payment batch flow");
await ensureFeatureFlagOn(adminApi.api, "erp_sync", "playwright reimbursement payment batch flow");
await login(page, EMPLOYEE);
@@ -220,6 +188,8 @@ test("E2E 报销支付批次主链路:提交 -> 审批 -> 创建批次 -> 复
expect(reimbursementAfterPayment.status).toBe("paid");
await expect(page.getByText("已支付", { exact: true }).first()).toBeVisible({ timeout: 30_000 });
await expect(page.getByTestId("reimbursement-payment-status")).toContainText("已付款");
await expect(page.getByTestId(TEST_IDS.reimbursement.pay)).toHaveCount(0);
await expect(page.getByText("执行支付")).toHaveCount(0);
const paymentAudit = await apiGetData<{
items: Array<{ action: string; targetId: string | null; extra: Record<string, unknown> }>;