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

这个提交包含在:
2026-05-13 10:17:50 +08:00
父节点 44b5af4f1e
当前提交 cf2bba02d5
共修改 30 个文件,包含 793 行新增和 264 行删除
@@ -442,10 +442,10 @@ async function collectMetrics(page: Page) {
hitWithin: Boolean(element && hit instanceof Element && hit.closest(`[data-testid='mobile-nav-${key}']`) === element),
};
});
const actionItems = ["approvals", "capture", "reimbursements", "me", "leave"].map((key) => {
const element = document.querySelector(`[data-testid='mobile-action-${key}']`);
const label = document.querySelector(`[data-testid='mobile-action-${key}-label']`);
const icon = document.querySelector(`[data-testid='mobile-action-${key}-icon']`);
const actionItems = Array.from(document.querySelectorAll<HTMLElement>("[data-testid^='mobile-action-'].mobile-icon-action")).map((element) => {
const key = element.getAttribute("data-testid")?.replace(/^mobile-action-/, "") ?? "";
const label = element.querySelector(`[data-testid='mobile-action-${key}-label']`);
const icon = element.querySelector(`[data-testid='mobile-action-${key}-icon']`);
const rect = element?.getBoundingClientRect();
const labelRect = label?.getBoundingClientRect();
const iconRect = icon?.getBoundingClientRect();
@@ -480,7 +480,7 @@ async function collectMetrics(page: Page) {
iconRect!.top >= rect!.top - 1 &&
iconRect!.bottom <= rect!.bottom + 1,
};
}).filter((item) => item.visible);
});
const stickyActions = document.querySelector("[data-testid='mobile-reimbursement-sticky-actions']");
const stickyRect = stickyActions?.getBoundingClientRect();
const stickyButtons = [
@@ -537,8 +537,10 @@ test.describe("R6 移动响应式体系", () => {
await page.goto("/mobile");
await expect(page.getByTestId("mobile-action-grid")).toBeVisible();
const homeMetrics = await expectMobilePageStable(page, device.label, `${device.key}-mobile-home`);
expect(homeMetrics.actionItems.length, `${device.label} home action count`).toBeGreaterThanOrEqual(4);
expect(homeMetrics.actionItems.length, `${device.label} home action count`).toBeGreaterThanOrEqual(2);
const bottomTabTexts = new Set(["首页", "审批", "进度", "报销", "我的"]);
for (const action of homeMetrics.actionItems) {
expect(bottomTabTexts.has(action.text), `${device.label} ${action.text} not duplicate bottom tab`).toBe(false);
expect(action.width, `${device.label} ${action.text} action width`).toBeGreaterThanOrEqual(44);
expect(action.height, `${device.label} ${action.text} action height`).toBeGreaterThanOrEqual(44);
expect(action.labelWhiteSpace, `${device.label} ${action.text} label nowrap`).toBe("nowrap");
@@ -571,7 +573,7 @@ test.describe("R6 移动响应式体系", () => {
await expect(page.getByTestId("mobile-capture-file")).toBeVisible();
await expectMobilePageStable(page, device.label, `${device.key}-mobile-capture`);
await page.goto("/mobile/leave");
await page.goto("/mobile/leave?view=form");
await expect(page.getByTestId("mobile-leave-form")).toBeVisible();
await expectMobilePageStable(page, device.label, `${device.key}-mobile-leave`);