fix: R27-5 R27-6 收口本地回归基线与E2E适配
这个提交包含在:
@@ -0,0 +1,24 @@
|
||||
import { expect, type Locator, type Page } from "@playwright/test";
|
||||
|
||||
export async function openBackupModulesIfNeeded(page: Page) {
|
||||
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);
|
||||
if (!isOpen) {
|
||||
await summary.click();
|
||||
await expect(details).toHaveAttribute("open", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function openNavLink(page: Page, name: string | RegExp): Promise<Locator> {
|
||||
const link = page.getByRole("link", { name }).first();
|
||||
if (await link.isVisible().catch(() => false)) {
|
||||
return link;
|
||||
}
|
||||
|
||||
await openBackupModulesIfNeeded(page);
|
||||
await expect(link).toBeVisible();
|
||||
return link;
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户