20 lines
772 B
TypeScript
20 lines
772 B
TypeScript
import { expect, test } from "playwright/test";
|
|
|
|
test("map notice is centered in the mobile viewport", async ({ page }) => {
|
|
await page.setViewportSize({ width: 375, height: 812 });
|
|
await page.goto("/", { waitUntil: "domcontentloaded" });
|
|
|
|
await page.getByRole("button", { name: "打开用户菜单" }).click();
|
|
await page.getByRole("menuitem", { name: /查看运行状态/ }).click();
|
|
|
|
const notice = page.locator('[role="status"]').filter({ hasText: "数据状态" }).first();
|
|
await expect(notice).toBeVisible();
|
|
|
|
const box = await notice.boundingBox();
|
|
expect(box).not.toBeNull();
|
|
|
|
const leftInset = Math.round(box!.x);
|
|
const rightInset = Math.round(375 - box!.x - box!.width);
|
|
expect(Math.abs(leftInset - rightInset)).toBeLessThanOrEqual(1);
|
|
});
|