mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
test(core): edgeless shape e2e (#11446)
### TL;DR Add Edgeless shape ai e2e tests. ### What Changed - Add Edgeless shape make it real e2e - Add Edgeless shape generate image e2e - Fix Edgeless generate headings e2e
This commit is contained in:
@@ -160,6 +160,33 @@ export class EditorUtils {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static async createShape(page: Page, text: string) {
|
||||
// Create shape
|
||||
await page.keyboard.press('s');
|
||||
await page.mouse.click(400, 400);
|
||||
|
||||
const id = await page.evaluate(() => {
|
||||
const edgelessBlock = document.querySelector(
|
||||
'affine-edgeless-root'
|
||||
) as EdgelessRootBlockComponent;
|
||||
if (!edgelessBlock) {
|
||||
throw new Error('edgeless block not found');
|
||||
}
|
||||
const shapes = edgelessBlock.gfx.gfxElements.filter(
|
||||
(el: GfxModel) => 'type' in el && el.type === 'shape'
|
||||
);
|
||||
|
||||
return shapes[shapes.length - 1].id;
|
||||
});
|
||||
|
||||
// Insert text inside shape
|
||||
await page.mouse.dblclick(400, 400);
|
||||
await page.keyboard.insertText(text);
|
||||
// Prevent the shape from being dragged
|
||||
await page.mouse.click(500, 500);
|
||||
return id;
|
||||
}
|
||||
|
||||
public static async getMindMapNode(
|
||||
page: Page,
|
||||
mindmapId: string,
|
||||
|
||||
Reference in New Issue
Block a user