B1-B8 建立项目级流程与QA门禁

这个提交包含在:
2026-05-09 01:57:05 +08:00
父节点 555e7b7e29
当前提交 485328426a
共修改 29 个文件,包含 1633 行新增和 102 行删除
@@ -1,8 +1,16 @@
import { devices, expect, test } from "@playwright/test";
import { createAuthenticatedApiClient, login, MANAGER } from "./helpers/auth";
import { createAuthenticatedApiClient, MANAGER, type E2EUser } from "./helpers/auth";
import { createSubmittedTravelRequestViaApi } from "./helpers/travel";
import { approveWorkflowTaskViaApi, waitForWorkflowTask } from "./helpers/workflow";
async function loginMobile(page: import("@playwright/test").Page, user: E2EUser) {
await page.goto("/login");
await page.getByTestId("login-identifier").fill(user.identifier);
await page.getByTestId("login-password").fill(user.password);
await page.getByTestId("login-submit").click();
await expect(page).toHaveURL(/\/mobile$/);
}
async function waitForWorkflowTaskCache(page: import("@playwright/test").Page, taskId: string) {
await expect
.poll(
@@ -56,7 +64,7 @@ test("E2E 移动审批:deep link 分流 + 离线草稿重放", async ({ page }
entityType: "travel_request",
});
await login(page, MANAGER);
await loginMobile(page, MANAGER);
await page.goto(`/workflow/tasks/${task.id}`);
await expect(page).toHaveURL(new RegExp(`/mobile/approvals\\?taskId=${task.id}`));
await expect(page.getByTestId("mobile-approvals-detail")).toBeVisible({ timeout: 30_000 });
@@ -67,12 +75,12 @@ test("E2E 移动审批:deep link 分流 + 离线草稿重放", async ({ page }
await expect(page.getByText("当前离线")).toBeVisible();
await expect(page.getByTestId("mobile-approvals-approve")).toBeEnabled({ timeout: 15_000 });
await page.getByTestId("mobile-approvals-approve").click();
await expect(page.getByTestId("mobile-approvals-queue")).toContainText("待处理 1 项");
await expect(page.getByTestId("mobile-approvals-queue")).toContainText("待同步 1");
await expect(page.getByTestId("mobile-approvals-queue")).toContainText("通过");
await page.context().setOffline(false);
await page.evaluate(() => window.dispatchEvent(new Event("online")));
await expect(page.getByTestId("mobile-approvals-queue")).toContainText("无待处理项", { timeout: 30_000 });
await expect(page.getByTestId("mobile-approvals-queue")).toContainText("无草稿", { timeout: 30_000 });
await expect(page.getByRole("main").getByText(/草稿同步完成:成功 1,失败 0,冲突 0/)).toBeVisible({ timeout: 30_000 });
} finally {
await Promise.all([created.client.dispose(), managerApi.dispose()]);
@@ -92,7 +100,7 @@ test("E2E 移动审批:离线草稿冲突态可见", async ({ page }) => {
entityType: "travel_request",
});
await login(page, MANAGER);
await loginMobile(page, MANAGER);
await page.goto(`/workflow/tasks/${task.id}`);
await expect(page).toHaveURL(new RegExp(`/mobile/approvals\\?taskId=${task.id}`));
await expect(page.getByTestId("mobile-approvals-detail")).toBeVisible({ timeout: 30_000 });
@@ -103,7 +111,7 @@ test("E2E 移动审批:离线草稿冲突态可见", async ({ page }) => {
await expect(page.getByTestId("mobile-approvals-reject")).toBeEnabled({ timeout: 15_000 });
await page.getByTestId("mobile-approvals-comment").fill("离线驳回意见:请补充差旅安排说明");
await page.getByTestId("mobile-approvals-reject").click();
await expect(page.getByTestId("mobile-approvals-queue")).toContainText("待处理 1 项");
await expect(page.getByTestId("mobile-approvals-queue")).toContainText("待同步 1");
await expect(page.getByTestId("mobile-approvals-queue")).toContainText("驳回");
await approveWorkflowTaskViaApi(managerApi.api, task.id);