LP6 完善请假采购体验与审批说明

这个提交包含在:
2026-05-12 13:02:00 +08:00
父节点 21887ce28a
当前提交 3d1e4c43f6
共修改 14 个文件,包含 502 行新增和 39 行删除
+40 -1
查看文件
@@ -89,6 +89,7 @@ test("E2E 请假编辑:草稿保存后保留原单并可继续提交", async (
const draftRow = page.getByRole("row").filter({ hasText: startDate }).first();
await expect(draftRow).toContainText("草稿", { timeout: 30_000 });
await expect(draftRow).toContainText("草稿可继续编辑", { timeout: 30_000 });
const updateResponsePromise = page.waitForResponse((response) => {
return response.request().method() === "PATCH" && new URL(response.url()).pathname === `/api/leave-requests/${leaveId}` && response.ok();
@@ -110,6 +111,7 @@ test("E2E 请假编辑:草稿保存后保留原单并可继续提交", async (
await submitLeave(employeeClient.api, leaveId);
await page.goto("/leave-requests");
await expect(updatedRow).toContainText("审批中", { timeout: 30_000 });
await expect(updatedRow).toContainText("当前节点", { timeout: 30_000 });
} finally {
await employeeClient.dispose();
}
@@ -157,9 +159,46 @@ test("E2E 请假主链路:草稿 → 提交 → 撤回 + 提交 → 审批", a
await login(page, EMPLOYEE);
await page.goto("/leave-requests");
await expect(page.getByRole("row").filter({ hasText: secondDate }).first()).toContainText("已通过", { timeout: 30_000 });
const approvedRow = page.getByRole("row").filter({ hasText: secondDate }).first();
await expect(approvedRow).toContainText("已通过", { timeout: 30_000 });
await expect(approvedRow).toContainText("已通过,系统会按请假结果更新额度和团队状态", { timeout: 30_000 });
await expect(page.getByRole("row").filter({ hasText: firstDate }).first()).toContainText("草稿", { timeout: 30_000 });
} finally {
await employeeClient.dispose();
}
});
test("E2E 请假退回说明:审批退回后员工可看到处理意见", async ({ page, workflowDetail }) => {
const employeeClient = await createAuthenticatedApiClient(EMPLOYEE);
const baseOffset = uniqueFutureOffset(5200);
const leaveDate = formatDate(baseOffset);
const returnComment = `请补充外出交接安排 ${Date.now()}`;
try {
await login(page, EMPLOYEE);
await (await openNavLink(page, "请假")).click();
await expect(page.getByRole("heading", { name: "请假申请" })).toBeVisible();
const leaveId = await createLeaveDraft(page, leaveDate, leaveDate, `Playwright 退回请假 ${Date.now()}`);
const submitResult = await submitLeave(employeeClient.api, leaveId);
await logout(page, EMPLOYEE.name);
await login(page, MANAGER);
await page.goto(`/workflow/tasks/${submitResult.currentTaskId}`);
await workflowDetail.assertLoaded();
await workflowDetail.returnTask(returnComment);
await expect(workflowDetail.summary).toContainText(/状态:(已处理|completed|已完成)/);
await logout(page, MANAGER.name);
await login(page, EMPLOYEE);
await page.goto("/leave-requests");
const returnedRow = page.getByRole("row").filter({ hasText: leaveDate }).first();
await expect(returnedRow).toContainText("草稿", { timeout: 30_000 });
await expect(returnedRow).toContainText("审批已退回", { timeout: 30_000 });
await expect(returnedRow).toContainText(returnComment, { timeout: 30_000 });
} finally {
await employeeClient.dispose();
}
});
@@ -61,6 +61,7 @@ test("E2E 采购主链路:员工提单→经理审批→财务归档", async (
await itemDescriptionInputs.first().fill("Playwright Laptop");
await page.locator('[data-testid^="purchase-item-quantity-"]:visible').first().fill("2");
await page.locator('[data-testid^="purchase-item-unit-price-"]:visible').first().fill("100");
await expect(page.getByTestId("purchase-budget-hint")).toContainText("未匹配预算池");
const submitResponsePromise = page.waitForResponse(
(response) =>
@@ -78,6 +79,7 @@ test("E2E 采购主链路:员工提单→经理审批→财务归档", async (
};
const currentTaskId = submitPayload.data.currentTaskId;
await expect(page.getByTestId("purchase-detail-status")).toHaveText("审批中", { timeout: 30_000 });
await expect(page.getByTestId("purchase-status-hint")).toContainText("当前节点", { timeout: 30_000 });
requestNo = (await page.getByRole("heading", { level: 3 }).filter({ hasText: /^CG-/ }).first().textContent())?.trim() ?? "";
expect(requestNo).toMatch(/^CG-/);
@@ -103,6 +105,8 @@ test("E2E 采购主链路:员工提单→经理审批→财务归档", async (
await purchaseRow.click();
await expect(page.getByTestId("purchase-archive-po-no")).toBeVisible();
await expect(page.getByTestId("purchase-status-hint")).toContainText("已通过", { timeout: 30_000 });
await expect(page.getByTestId("purchase-approval-history")).toContainText("通过", { timeout: 30_000 });
await page.getByTestId("purchase-archive-po-no").fill("PO-E2E-001");
await page.getByTestId("purchase-archive-contract-no").fill("CT-E2E-001");
await page.getByTestId("purchase-archive-save").click();