同步前端重构后的视觉测试基线(05-28-frontend-ux-redesign)

这个提交包含在:
2026-05-28 23:16:48 +08:00
父节点 8f38687186
当前提交 1f13dd9c80
共修改 6 个文件,包含 11 行新增和 11 行删除
+1 -1
查看文件
@@ -3,7 +3,7 @@ import { expect, type Locator, type Page } from "@playwright/test";
import { TEST_IDS } from "./testIds";
export async function openBackupModulesIfNeeded(page: Page) {
const summary = page.locator("summary").filter({ hasText: "备用模块" }).first();
const summary = page.locator("summary").filter({ hasText: "更多" }).first();
if (await summary.count()) {
const details = summary.locator("xpath=ancestor::details[1]");
const isOpen = await details.evaluate((node) => (node as HTMLDetailsElement).open);
@@ -36,7 +36,7 @@ export class AppShell {
}
async assertBackupModulesCollapsed() {
const summary = this.page.locator("summary").filter({ hasText: "备用模块" }).first();
const summary = this.page.locator("summary").filter({ hasText: "更多" }).first();
if (await summary.count()) {
const details = summary.locator("xpath=ancestor::details[1]");
await expect(details).not.toHaveAttribute("open", "");
+2 -2
查看文件
@@ -39,12 +39,12 @@ export async function assertMainNavVisible(page: Page) {
}
export async function assertBackupModulesCollapsed(page: Page) {
const summary = page.locator("summary").filter({ hasText: "备用模块" }).first();
const summary = page.locator("summary").filter({ hasText: "更多" }).first();
await expect(summary).toBeVisible();
const details = summary.locator("xpath=ancestor::details[1]");
const isOpen = await details.evaluate((node) => (node as HTMLDetailsElement).open);
expect(isOpen).toBe(false);
await expect(page.getByRole("link", { name: "采购申请" })).not.toBeVisible();
await expect(page.getByRole("link", { name: "差旅申请" })).not.toBeVisible();
}
export async function assertWecomBindingCardVisible(page: Page) {
+1 -1
查看文件
@@ -248,7 +248,7 @@ async function auditPage(page: Page, input: {
const sidebarLike = Array.from(document.querySelectorAll("aside, nav")).filter((element) => {
const rect = element.getBoundingClientRect();
const textContent = element.textContent ?? "";
return rect.width > 160 && textContent.includes("备用模块");
return rect.width > 160 && textContent.includes("更多");
}).length;
const clipped = Array.from(document.querySelectorAll("button,a,[role='button'],select,input,textarea,[data-testid]"))
.filter((element) => {
@@ -343,7 +343,7 @@ test.describe("R103 cross page UI consistency", () => {
await page.setViewportSize({ width: 1440, height: 960 });
await page.goto(`/purchase-requests?id=${purchaseId}`);
await expect(page.locator("header").filter({ hasText: "备用模块" }).getByText("采购申请")).toBeVisible();
await expect(page.locator("header").filter({ hasText: "业务" }).getByText("采购申请")).toBeVisible();
await expect(page.getByRole("heading", { name: "采购申请" })).toBeVisible();
await expect(page.getByText("/purchase-requests")).toHaveCount(0);
await expect(page.getByTestId("purchase-attachment-upload")).toHaveText("上传附件");
@@ -362,7 +362,7 @@ test.describe("R103 cross page UI consistency", () => {
await page.setViewportSize({ width: 1440, height: 960 });
await page.goto("/invoice-pool");
await expect(page.locator("header").filter({ hasText: "备用模块" }).getByText("票据中心")).toBeVisible();
await expect(page.locator("header").filter({ hasText: "财务" }).getByText("票据中心")).toBeVisible();
await expect(page.getByTestId("invoice-bind-reimbursement")).toContainText("草稿单 · 2026-05-06");
await expect(page.getByTestId("invoice-bind-reimbursement")).not.toContainText(reimbursementId);
await expect(page.getByText("/invoice-pool")).toHaveCount(0);
+4 -4
查看文件
@@ -310,7 +310,7 @@ test.describe("visual shell", () => {
await page.goto("/login");
await expect(page.getByText("海音达工作台").first()).toBeVisible();
await expect(page.getByRole("heading", { name: "登录工作台" })).toBeVisible();
await expect(page.getByRole("heading", { name: "海音达 OA" })).toBeVisible();
await expect(page.getByTestId("login-password-primary-panel")).toBeVisible();
await attachScreenshot(page, testInfo, "login-shell.png");
@@ -324,7 +324,7 @@ test.describe("visual shell", () => {
await expect(page.locator("aside")).toBeVisible();
await expect(page.getByTestId("topbar-profile-trigger")).toBeVisible();
await expect(page.locator("aside").getByRole("link", { name: "Portal", exact: true })).toBeVisible();
await expect(page.locator("summary").filter({ hasText: "备用模块" })).toBeVisible();
await expect(page.locator("summary").filter({ hasText: "更多" })).toBeVisible();
await attachScreenshot(page, testInfo, "app-shell.png");
});
@@ -334,8 +334,8 @@ test.describe("visual shell", () => {
await page.setViewportSize({ width: 1440, height: 1024 });
await loginVisualUser(page);
await expect(page.getByRole("heading", { name: "待处理" })).toBeVisible();
await expect(page.getByRole("heading", { name: "常用" })).toBeVisible();
await expect(page.getByRole("heading", { name: "今天先处理" })).toBeVisible();
await expect(page.getByRole("heading", { name: "常用动作" })).toBeVisible();
await expect(page.locator("summary").filter({ hasText: /角色重点|更多入口/ })).toBeVisible();
await attachScreenshot(page, testInfo, "pc-portal-wave1.png");