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

这个提交包含在:
2026-05-13 10:17:50 +08:00
父节点 44b5af4f1e
当前提交 cf2bba02d5
共修改 30 个文件,包含 793 行新增和 264 行删除
@@ -393,10 +393,10 @@ async function collectRenderingMetrics(page: Page) {
!(badgeRect!.right <= iconRect!.left || badgeRect!.left >= iconRect!.right || badgeRect!.bottom <= iconRect!.top || badgeRect!.top >= iconRect!.bottom),
};
});
const actionItems = ["approvals", "capture", "reimbursements", "me"].map((key) => {
const element = document.querySelector(`[data-testid='mobile-action-${key}']`);
const icon = document.querySelector(`[data-testid='mobile-action-${key}-icon'] svg`);
const label = document.querySelector(`[data-testid='mobile-action-${key}-label']`);
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 icon = element.querySelector(`[data-testid='mobile-action-${key}-icon'] svg`);
const label = element.querySelector(`[data-testid='mobile-action-${key}-label']`);
const rect = element?.getBoundingClientRect();
const iconRect = icon?.getBoundingClientRect();
const labelRect = label?.getBoundingClientRect();
@@ -510,9 +510,11 @@ async function exerciseMobileRendering(page: Page, key: string, label: string) {
await page.goto("/mobile");
await expect(page.getByTestId("mobile-action-grid")).toBeVisible();
const homeMetrics = await expectRenderingStable(page, label, `${key}-mobile-home`);
expect(homeMetrics.actionItems.length, `${label} action count`).toBe(4);
expect(homeMetrics.actionItems.length, `${label} action count`).toBeGreaterThanOrEqual(2);
const bottomTabLabels = new Set(["首页", "审批", "进度", "报销", "我的"]);
for (const action of homeMetrics.actionItems) {
expect(action.visible, `${label} ${action.key} action visible`).toBe(true);
expect(bottomTabLabels.has(action.key), `${label} ${action.key} not bottom tab key`).toBe(false);
expect(action.width, `${label} ${action.key} action width`).toBeGreaterThanOrEqual(44);
expect(action.height, `${label} ${action.key} action height`).toBeGreaterThanOrEqual(44);
expect(action.iconVisible, `${label} ${action.key} action svg visible`).toBe(true);