R31-1 R31-4: 收口详情页工作台化与 E2E 契约
这个提交包含在:
@@ -0,0 +1,45 @@
|
||||
import { expect, type Page } from "@playwright/test";
|
||||
|
||||
import { openBackupModulesIfNeeded, openNavLink, openProfileSettings } from "../navigation";
|
||||
import { TEST_IDS } from "../testIds";
|
||||
|
||||
export class AppShell {
|
||||
readonly page: Page;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
get sidebar() {
|
||||
return this.page.locator("nav").first();
|
||||
}
|
||||
|
||||
get topbarProfileTrigger() {
|
||||
return this.page.getByTestId(TEST_IDS.topbar.profileTrigger).first();
|
||||
}
|
||||
|
||||
async navigate(name: string | RegExp) {
|
||||
return openNavLink(this.page, name);
|
||||
}
|
||||
|
||||
async openBackupModules() {
|
||||
return openBackupModulesIfNeeded(this.page);
|
||||
}
|
||||
|
||||
async openProfile(userDisplayName?: string) {
|
||||
return openProfileSettings(this.page, userDisplayName);
|
||||
}
|
||||
|
||||
async assertMainNavVisible() {
|
||||
await expect(this.page.getByRole("link", { name: "工作台" }).or(this.page.getByRole("link", { name: "Portal" })).first()).toBeVisible();
|
||||
await expect(this.page.getByRole("link", { name: /项目/ }).first()).toBeVisible();
|
||||
}
|
||||
|
||||
async assertBackupModulesCollapsed() {
|
||||
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", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户