Files
AFFiNE-Mirror/tests/blocksuite/e2e/embed-synced-doc/edgeless.spec.ts
T
L-Sun 61ce1123ae refactor(editor): split synced-doc-block tests to serveral files (#11845)
This PR splits `synced-doc-block.spec.ts` into multiple files for better organization.
2025-04-21 08:54:04 +00:00

67 lines
2.2 KiB
TypeScript

import { expect } from '@playwright/test';
import { switchEditorMode } from '../utils/actions/edgeless.js';
import { enterPlaygroundRoom, waitNextFrame } from '../utils/actions/misc.js';
import { test } from '../utils/playwright.js';
import { initEmbedSyncedDocState } from './utils.js';
test.describe('Embed synced doc', () => {
test.beforeEach(async ({ page }) => {
await enterPlaygroundRoom(page);
});
test.fixme(
'drag embed synced doc to whiteboard should fit in height',
async ({ page }) => {
await initEmbedSyncedDocState(page, [
{ title: 'Root Doc', content: 'hello root doc' },
{ title: 'Page 1', content: 'hello page 1' },
]);
// Switch to edgeless mode
await switchEditorMode(page);
// Double click on note to enter edit status
const noteBlock = page.locator('affine-edgeless-note');
await noteBlock.dblclick();
// Drag the embed synced doc to whiteboard
const embedSyncedBlockInNote = page.locator(
'affine-embed-synced-doc-block'
);
const embedSyncedBoxInNote = await embedSyncedBlockInNote.boundingBox();
if (!embedSyncedBoxInNote) {
throw new Error('embedSyncedBoxInNote is not found');
}
const height = embedSyncedBoxInNote.height;
await page.mouse.move(
embedSyncedBoxInNote.x - 10,
embedSyncedBoxInNote.y - 100
);
await page.mouse.move(
embedSyncedBoxInNote.x - 10,
embedSyncedBoxInNote.y + 10
);
await waitNextFrame(page);
await page.mouse.down();
await page.mouse.move(100, 200, { steps: 30 });
await page.mouse.up();
// Check the height of the embed synced doc portal, it should be the same as the embed synced doc in note
const EmbedSyncedDocBlockInCanvas = page.locator(
'affine-embed-edgeless-synced-doc-block'
);
const EmbedSyncedDocBlockBoxInCanvas =
await EmbedSyncedDocBlockInCanvas.boundingBox();
const border = 1;
if (!EmbedSyncedDocBlockBoxInCanvas) {
throw new Error('EmbedSyncedDocBlockBoxInCanvas is not found');
}
expect(EmbedSyncedDocBlockBoxInCanvas.height).toBeCloseTo(
height + 2 * border,
1
);
}
);
});