Add native task metadata, working-day calendar settings, dependency scheduling and rich note editing. Support complete-sheet PNG export with resolution and transparency controls, preserve XMind extensions and update browser regressions.
36 lines
1.8 KiB
TypeScript
36 lines
1.8 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 === "备注" ? "笔记" : 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();
|
|
}
|