fix: top align mobile content

This commit is contained in:
Codex
2026-05-04 16:34:51 +00:00
parent 7e4dce47cd
commit 3adce947cf
5 changed files with 63 additions and 10 deletions
+14
View File
@@ -279,6 +279,19 @@ async function frontendCheck(config: UniDeskConfig, urls: PublicUrls, checks: E2
}
const mobileRailMax = Math.max(...mobileRailHeights);
const mobileRailMin = Math.min(...mobileRailHeights);
await page.getByRole("button", { name: /任务调度/ }).click();
await page.getByRole("button", { name: /待处理任务/ }).click();
await page.waitForSelector('[data-testid="pending-task-page"]', { timeout: 5000 });
const mobileContentMetrics = await page.locator('[data-testid="pending-task-page"]').evaluate((element) => {
const pageTop = element.getBoundingClientRect().top;
const empty = element.querySelector(".empty-state");
const emptyBox = empty?.getBoundingClientRect();
const emptyStrong = empty?.querySelector("strong")?.getBoundingClientRect();
return {
pageTop: Math.round(pageTop),
emptyTextOffset: emptyBox && emptyStrong ? Math.round(emptyStrong.top - emptyBox.top) : 0,
};
});
await page.setViewportSize({ width: 1440, height: 920 });
await page.getByRole("button", { name: /运行总览/ }).click();
await page.getByRole("button", { name: /态势总览/ }).click();
@@ -320,6 +333,7 @@ async function frontendCheck(config: UniDeskConfig, urls: PublicUrls, checks: E2
const dockerText = await page.locator('[data-testid="docker-status-page"]').innerText({ timeout: 5000 });
addCheck(checks, "frontend:login-provider-visible", bodyText.includes(config.providerGateway.id) && bodyText.includes(config.providerGateway.name) && bodyText.includes("核心在线"), { screenshotPath });
addCheck(checks, "frontend:mobile-nav-fixed-height", mobileRailMax - mobileRailMin <= 1 && mobileRailMax <= 44, { mobileRailHeights });
addCheck(checks, "frontend:mobile-content-top-aligned", mobileContentMetrics.pageTop <= 190 && mobileContentMetrics.emptyTextOffset <= 14, { mobileContentMetrics });
addCheck(checks, "frontend:pending-task-drilldown", pendingTaskText.includes("待处理任务") && (pendingTaskText.includes("当前无待处理任务") || (pendingTaskText.includes("Provider") && pendingTaskText.includes("已等待"))), { pendingTaskPreview: pendingTaskText.slice(0, 600) });
addCheck(checks, "frontend:no-naked-json-before-click", rawBlocksBefore === 0 && !nakedJsonText, { rawBlocksBefore, nakedJsonText });
addCheck(checks, "frontend:raw-json-explicit-button", rawText.includes('"providerId"') && rawText.includes(config.providerGateway.id), { rawTextPreview: rawText.slice(0, 400) });