fix: R27-5 R27-6 收口本地回归基线与E2E适配

这个提交包含在:
2026-03-22 21:13:03 +08:00
父节点 312200ec1b
当前提交 15d0473c0b
共修改 8 个文件,包含 148 行新增和 18 行删除
+24
查看文件
@@ -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;
}