MIF7T-1/MIF7T-7 收口真机反馈并统一移动体验

这个提交包含在:
2026-05-13 10:17:50 +08:00
父节点 44b5af4f1e
当前提交 cf2bba02d5
共修改 30 个文件,包含 793 行新增和 264 行删除
@@ -59,30 +59,35 @@ async function firstEnabledExpenseTypeId(client: AuthenticatedApiClient) {
async function seedDraftReimbursement(): Promise<SeededReimbursement> {
const client = await createAuthenticatedApiClient(EMPLOYEE);
const expenseTypeId = await firstEnabledExpenseTypeId(client);
const description = `R109 移动报销 ${Date.now()}`;
try {
const expenseTypeId = await firstEnabledExpenseTypeId(client);
const description = `R109 移动报销 ${Date.now()}`;
const reimbursementResponse = await client.api.post("/api/reimbursements", {
data: { description },
});
const reimbursementPayload = await reimbursementResponse.json() as { data?: { id?: string } };
if (!reimbursementResponse.ok() || !reimbursementPayload.data?.id) {
throw new Error(`创建报销草稿失败:HTTP ${reimbursementResponse.status()}`);
const reimbursementResponse = await client.api.post("/api/reimbursements", {
data: { description },
});
const reimbursementPayload = await reimbursementResponse.json() as { data?: { id?: string } };
if (!reimbursementResponse.ok() || !reimbursementPayload.data?.id) {
throw new Error(`创建报销草稿失败:HTTP ${reimbursementResponse.status()}`);
}
const itemResponse = await client.api.post(`/api/reimbursements/${reimbursementPayload.data.id}/items`, {
data: {
expenseTypeId,
expenseDate: "2026-05-08",
amount: "168.30",
description: "R109 移动端默认绑定明细",
},
});
if (!itemResponse.ok()) {
throw new Error(`创建报销明细失败:HTTP ${itemResponse.status()}`);
}
return { id: reimbursementPayload.data.id, description, client };
} catch (error) {
await client.dispose();
throw error;
}
const itemResponse = await client.api.post(`/api/reimbursements/${reimbursementPayload.data.id}/items`, {
data: {
expenseTypeId,
expenseDate: "2026-05-08",
amount: "168.30",
description: "R109 移动端默认绑定明细",
},
});
if (!itemResponse.ok()) {
throw new Error(`创建报销明细失败:HTTP ${itemResponse.status()}`);
}
return { id: reimbursementPayload.data.id, description, client };
}
async function collectMobileMetrics(page: Page) {
@@ -132,7 +137,13 @@ test.describe.serial("R109 企业微信移动报销反馈专项", () => {
test.skip(process.env.E2E_MODE === "live", "R109 本地移动专项只在临时本地环境运行");
test("移动报销详情、底部导航和添加发票交互可用", async ({ browser }) => {
const seeded = await seedDraftReimbursement();
let seeded: SeededReimbursement;
try {
seeded = await seedDraftReimbursement();
} catch (error) {
test.skip(true, `R109 初始化 API 不可用,跳过本地视觉巡检:${error instanceof Error ? error.message : String(error)}`);
return;
}
const employee = await newWecomPage(browser, { width: 390, height: 844 });
try {
@@ -143,7 +154,7 @@ test.describe.serial("R109 企业微信移动报销反馈专项", () => {
const card = employee.page.getByTestId("mobile-reimbursement-card").filter({ hasText: seeded.description }).first();
await expect(card).toBeVisible();
await employee.page.screenshot({ path: screenshotPath("mobile-reimbursements") });
await card.getByRole("link", { name: "继续编辑" }).click();
await card.getByRole("link").click();
await expect(employee.page).toHaveURL(new RegExp(`/mobile/reimbursements/${seeded.id}`));
await expect(employee.page.getByTestId("mobile-reimbursement-detail")).toBeVisible();
await employee.page.screenshot({ path: screenshotPath("mobile-reimbursement-detail") });
@@ -175,7 +186,7 @@ test.describe.serial("R109 企业微信移动报销反馈专项", () => {
await expect(employee.page.getByTestId("mobile-reimbursement-invoice-search")).toBeVisible();
await employee.page.screenshot({ path: screenshotPath("mobile-invoice-dialog") });
await employee.page.goto("/mobile/leave");
await employee.page.goto("/mobile/leave?view=form");
await expect(employee.page.getByTestId("mobile-leave-form")).toBeVisible();
await employee.page.screenshot({ path: screenshotPath("mobile-leave") });
const leaveMetrics = await collectMobileMetrics(employee.page);