Add native-style menus, search and presentation controls, typography resources, and Xmind import/export styling support. Bundle canvas styles for preview and production, show marquee borders and selection fills, and align editor density with the project UI. Include interaction regression coverage and client comparison notes.
36 lines
1.7 KiB
TypeScript
36 lines
1.7 KiB
TypeScript
import type { Page } from "@playwright/test";
|
|
|
|
export async function clickXmindSheet(page: Page, label: string) {
|
|
const tab = page.getByRole("tablist", { name: "工作表" }).getByRole("button", { name: label, exact: true });
|
|
const box = await tab.boundingBox();
|
|
if (!box) throw new Error(`工作表不可见:${label}`);
|
|
// The local Next.js indicator can overlap the center of a short first tab.
|
|
await tab.click({ position: { x: box.width - 6, y: box.height / 2 } });
|
|
}
|
|
|
|
export async function clickXmindAction(page: Page, label: string) {
|
|
const menus: Record<string,string> = {
|
|
备注:"插入",链接:"插入",标签:"插入",主题:"插入",文本:"插入",图片:"插入",
|
|
撤销:"文件与编辑",重做:"文件与编辑",保存:"文件与编辑",导入:"文件与编辑",云文件:"文件与编辑",
|
|
"查找与替换":"文件与编辑",
|
|
放大:"缩放",缩小:"缩放",适应画布:"缩放",
|
|
重命名当前画布:"画布操作",复制当前画布:"画布操作",删除当前画布:"画布操作",
|
|
};
|
|
const menu = menus[label];
|
|
if (menu) {
|
|
const trigger = page.getByRole("button",{name:menu,exact:true});
|
|
if (await trigger.getAttribute("aria-expanded") !== "true") await trigger.click();
|
|
await page.getByRole("menuitem",{name:label,exact:false}).click();
|
|
} else await page.getByRole("button",{name:label,exact:true}).click();
|
|
}
|
|
|
|
export async function openXmindStructures(page: Page) {
|
|
const trigger = page.getByRole("button",{name:"选择结构",exact:true});
|
|
if (await trigger.getAttribute("aria-expanded") !== "true") await trigger.click();
|
|
}
|
|
|
|
export async function chooseXmindLayout(page: Page, label: string) {
|
|
await openXmindStructures(page);
|
|
await page.getByRole("button",{name:label,exact:true}).click();
|
|
}
|