OAFRONT6 完成前三项前端成熟化收口
这个提交包含在:
@@ -81,6 +81,41 @@ function screenshotPath(fileName: string) {
|
||||
return path.join(SCREENSHOT_DIR, `${fileName}.png`);
|
||||
}
|
||||
|
||||
async function installStableVisualCapture(page: Page) {
|
||||
await page.addInitScript(() => {
|
||||
const style = document.createElement("style");
|
||||
style.setAttribute("data-testid", "mobile-visual-stability-style");
|
||||
style.textContent = `
|
||||
*, *::before, *::after {
|
||||
animation-delay: 0ms !important;
|
||||
animation-duration: 0.001ms !important;
|
||||
animation-iteration-count: 1 !important;
|
||||
scroll-behavior: auto !important;
|
||||
transition-delay: 0ms !important;
|
||||
transition-duration: 0ms !important;
|
||||
}
|
||||
`;
|
||||
document.documentElement.appendChild(style);
|
||||
});
|
||||
}
|
||||
|
||||
async function waitForStableMobileVisual(page: Page) {
|
||||
await page.locator(".hyb-mobile-shell").waitFor({ state: "visible", timeout: 10_000 });
|
||||
await page.evaluate(async () => {
|
||||
await document.fonts?.ready;
|
||||
});
|
||||
await page.waitForFunction(() => {
|
||||
const shell = document.querySelector(".hyb-mobile-shell");
|
||||
if (!shell) {
|
||||
return false;
|
||||
}
|
||||
const style = window.getComputedStyle(shell);
|
||||
const rect = shell.getBoundingClientRect();
|
||||
return style.opacity === "1" && rect.width > 0 && rect.height > 0;
|
||||
});
|
||||
await page.waitForTimeout(100);
|
||||
}
|
||||
|
||||
function reimbursementListItem() {
|
||||
return {
|
||||
id: "mud6-reimbursement",
|
||||
@@ -536,6 +571,7 @@ async function collectMetrics(page: Page) {
|
||||
}
|
||||
|
||||
async function expectUnifiedMobilePage(page: Page, label: string, screenshotName: string, options: { deep: boolean }) {
|
||||
await waitForStableMobileVisual(page);
|
||||
await page.screenshot({ path: screenshotPath(screenshotName), fullPage: true });
|
||||
const metrics = await collectMetrics(page);
|
||||
expect(metrics.shellScoped, `${label} mobile shell scope`).toBe(true);
|
||||
@@ -583,6 +619,7 @@ test.describe("MUD6 专用移动页面统一设计", () => {
|
||||
});
|
||||
|
||||
test("所有专用 /mobile 页面复用统一槽位、卡片和底部导航体系", async ({ page }) => {
|
||||
await installStableVisualCapture(page);
|
||||
await mockApis(page);
|
||||
await login(page);
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户