mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-24 09:52:49 +08:00
feat: bump more deps (#14079)
This commit is contained in:
@@ -251,92 +251,90 @@ test('should sync selected-blocks to session-manager when clicking drag handle',
|
||||
await assertRichTexts(page, ['456', '789']);
|
||||
});
|
||||
|
||||
test.fixme(
|
||||
'should be able to drag & drop multiple blocks',
|
||||
async ({ page }) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyParagraphState(page);
|
||||
await initThreeParagraphs(page);
|
||||
await assertRichTexts(page, ['123', '456', '789']);
|
||||
test.fixme('should be able to drag & drop multiple blocks', async ({
|
||||
page,
|
||||
}) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyParagraphState(page);
|
||||
await initThreeParagraphs(page);
|
||||
await assertRichTexts(page, ['123', '456', '789']);
|
||||
|
||||
await dragBetweenIndices(
|
||||
page,
|
||||
[0, 0],
|
||||
[1, 3],
|
||||
{ x: -60, y: 0 },
|
||||
{ x: 80, y: 0 },
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
await dragBetweenIndices(
|
||||
page,
|
||||
[0, 0],
|
||||
[1, 3],
|
||||
{ x: -60, y: 0 },
|
||||
{ x: 80, y: 0 },
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
|
||||
const blockSelections = page
|
||||
.locator('affine-block-selection')
|
||||
.locator('visible=true');
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
const blockSelections = page
|
||||
.locator('affine-block-selection')
|
||||
.locator('visible=true');
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
|
||||
await dragHandleFromBlockToBlockBottomById(page, '2', '4', true);
|
||||
await expect(page.locator('.affine-drop-indicator')).toBeHidden();
|
||||
await dragHandleFromBlockToBlockBottomById(page, '2', '4', true);
|
||||
await expect(page.locator('.affine-drop-indicator')).toBeHidden();
|
||||
|
||||
await assertRichTexts(page, ['789', '123', '456']);
|
||||
await assertRichTexts(page, ['789', '123', '456']);
|
||||
|
||||
// Selection is still 2 after drop
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
}
|
||||
);
|
||||
// Selection is still 2 after drop
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
});
|
||||
|
||||
test.fixme(
|
||||
'should be able to drag & drop multiple blocks to nested block',
|
||||
async ({ page }, testInfo) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyParagraphState(page);
|
||||
test.fixme('should be able to drag & drop multiple blocks to nested block', async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyParagraphState(page);
|
||||
|
||||
await focusRichText(page);
|
||||
await type(page, '-');
|
||||
await page.keyboard.press('Space', { delay: 50 });
|
||||
await type(page, 'A');
|
||||
await pressEnter(page);
|
||||
await type(page, 'B');
|
||||
await pressEnter(page);
|
||||
await type(page, 'C');
|
||||
await pressEnter(page);
|
||||
await pressTab(page);
|
||||
await type(page, 'D');
|
||||
await pressEnter(page);
|
||||
await type(page, 'E');
|
||||
await pressEnter(page);
|
||||
await pressTab(page);
|
||||
await type(page, 'F');
|
||||
await pressEnter(page);
|
||||
await type(page, 'G');
|
||||
await focusRichText(page);
|
||||
await type(page, '-');
|
||||
await page.keyboard.press('Space', { delay: 50 });
|
||||
await type(page, 'A');
|
||||
await pressEnter(page);
|
||||
await type(page, 'B');
|
||||
await pressEnter(page);
|
||||
await type(page, 'C');
|
||||
await pressEnter(page);
|
||||
await pressTab(page);
|
||||
await type(page, 'D');
|
||||
await pressEnter(page);
|
||||
await type(page, 'E');
|
||||
await pressEnter(page);
|
||||
await pressTab(page);
|
||||
await type(page, 'F');
|
||||
await pressEnter(page);
|
||||
await type(page, 'G');
|
||||
|
||||
expect(await getPageSnapshot(page, true)).toMatchSnapshot(
|
||||
`${testInfo.title}_init.json`
|
||||
);
|
||||
expect(await getPageSnapshot(page, true)).toMatchSnapshot(
|
||||
`${testInfo.title}_init.json`
|
||||
);
|
||||
|
||||
await dragBetweenIndices(
|
||||
page,
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
{ x: -80, y: 0 },
|
||||
{ x: 80, y: 0 },
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
await dragBetweenIndices(
|
||||
page,
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
{ x: -80, y: 0 },
|
||||
{ x: 80, y: 0 },
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
|
||||
const blockSelections = page
|
||||
.locator('affine-block-selection')
|
||||
.locator('visible=true');
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
const blockSelections = page
|
||||
.locator('affine-block-selection')
|
||||
.locator('visible=true');
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
|
||||
await dragHandleFromBlockToBlockBottomById(page, '3', '8');
|
||||
await dragHandleFromBlockToBlockBottomById(page, '3', '8');
|
||||
|
||||
expect(await getPageSnapshot(page, true)).toMatchSnapshot(
|
||||
`${testInfo.title}_finial.json`
|
||||
);
|
||||
}
|
||||
);
|
||||
expect(await getPageSnapshot(page, true)).toMatchSnapshot(
|
||||
`${testInfo.title}_finial.json`
|
||||
);
|
||||
});
|
||||
|
||||
test('should blur rich-text first on starting block selection', async ({
|
||||
page,
|
||||
@@ -415,57 +413,56 @@ test.fixme('should create preview when dragging', async ({ page }) => {
|
||||
);
|
||||
});
|
||||
|
||||
test.fixme(
|
||||
'should drag and drop blocks under block-level selection',
|
||||
async ({ page }) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyParagraphState(page);
|
||||
await initThreeParagraphs(page);
|
||||
await assertRichTexts(page, ['123', '456', '789']);
|
||||
test.fixme('should drag and drop blocks under block-level selection', async ({
|
||||
page,
|
||||
}) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyParagraphState(page);
|
||||
await initThreeParagraphs(page);
|
||||
await assertRichTexts(page, ['123', '456', '789']);
|
||||
|
||||
await dragBetweenIndices(
|
||||
page,
|
||||
[0, 0],
|
||||
[1, 3],
|
||||
{ x: -60, y: 0 },
|
||||
{ x: 80, y: 0 },
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
|
||||
const blockSelections = page
|
||||
.locator('affine-block-selection')
|
||||
.locator('visible=true');
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
|
||||
const editorHost = getEditorHostLocator(page);
|
||||
const editors = editorHost.locator('rich-text');
|
||||
const editorRect0 = await editors.nth(0).boundingBox();
|
||||
const editorRect2 = await editors.nth(2).boundingBox();
|
||||
if (!editorRect0 || !editorRect2) {
|
||||
throw new Error();
|
||||
await dragBetweenIndices(
|
||||
page,
|
||||
[0, 0],
|
||||
[1, 3],
|
||||
{ x: -60, y: 0 },
|
||||
{ x: 80, y: 0 },
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
|
||||
await dragBetweenCoords(
|
||||
page,
|
||||
{
|
||||
x: editorRect0.x - 10,
|
||||
y: editorRect0.y + editorRect0.height / 2,
|
||||
},
|
||||
{
|
||||
x: editorRect2.x + 10,
|
||||
y: editorRect2.y + editorRect2.height / 2 + 10,
|
||||
},
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
const blockSelections = page
|
||||
.locator('affine-block-selection')
|
||||
.locator('visible=true');
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
|
||||
await assertRichTexts(page, ['789', '123', '456']);
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
const editorHost = getEditorHostLocator(page);
|
||||
const editors = editorHost.locator('rich-text');
|
||||
const editorRect0 = await editors.nth(0).boundingBox();
|
||||
const editorRect2 = await editors.nth(2).boundingBox();
|
||||
if (!editorRect0 || !editorRect2) {
|
||||
throw new Error();
|
||||
}
|
||||
);
|
||||
|
||||
await dragBetweenCoords(
|
||||
page,
|
||||
{
|
||||
x: editorRect0.x - 10,
|
||||
y: editorRect0.y + editorRect0.height / 2,
|
||||
},
|
||||
{
|
||||
x: editorRect2.x + 10,
|
||||
y: editorRect2.y + editorRect2.height / 2 + 10,
|
||||
},
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
|
||||
await assertRichTexts(page, ['789', '123', '456']);
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
});
|
||||
|
||||
test('should trigger click event on editor container when clicking on blocks under block-level selection', async ({
|
||||
page,
|
||||
@@ -555,174 +552,172 @@ test('should get to selected block when dragging unselected block', async ({
|
||||
// await assertRichTexts(page, ['456', '123']);
|
||||
});
|
||||
|
||||
test.fixme(
|
||||
'should clear the currently selected block when clicked again',
|
||||
async ({ page }) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyParagraphState(page);
|
||||
await focusRichText(page);
|
||||
await type(page, '123');
|
||||
await pressEnter(page);
|
||||
await type(page, '456');
|
||||
await assertRichTexts(page, ['123', '456']);
|
||||
test.fixme('should clear the currently selected block when clicked again', async ({
|
||||
page,
|
||||
}) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyParagraphState(page);
|
||||
await focusRichText(page);
|
||||
await type(page, '123');
|
||||
await pressEnter(page);
|
||||
await type(page, '456');
|
||||
await assertRichTexts(page, ['123', '456']);
|
||||
|
||||
const editorHost = getEditorHostLocator(page);
|
||||
const editors = editorHost.locator('rich-text');
|
||||
const editorRect0 = await editors.nth(0).boundingBox();
|
||||
const editorRect1 = await editors.nth(1).boundingBox();
|
||||
const editorHost = getEditorHostLocator(page);
|
||||
const editors = editorHost.locator('rich-text');
|
||||
const editorRect0 = await editors.nth(0).boundingBox();
|
||||
const editorRect1 = await editors.nth(1).boundingBox();
|
||||
|
||||
if (!editorRect0 || !editorRect1) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
await page.mouse.move(
|
||||
editorRect1.x + 5,
|
||||
editorRect1.y + editorRect1.height / 2
|
||||
);
|
||||
|
||||
await page.mouse.move(
|
||||
editorRect1.x - 10,
|
||||
editorRect1.y + editorRect1.height / 2
|
||||
);
|
||||
await page.mouse.down();
|
||||
await page.mouse.up();
|
||||
|
||||
const blockSelections = page
|
||||
.locator('affine-block-selection')
|
||||
.locator('visible=true');
|
||||
await expect(blockSelections).toHaveCount(1);
|
||||
|
||||
let selectedBlockRect = await blockSelections.nth(0).boundingBox();
|
||||
|
||||
if (!selectedBlockRect) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
expect(editorRect1).toEqual(selectedBlockRect);
|
||||
|
||||
await page.mouse.move(
|
||||
editorRect0.x - 10,
|
||||
editorRect0.y + editorRect0.height / 2
|
||||
);
|
||||
await page.mouse.down();
|
||||
await page.mouse.up();
|
||||
|
||||
await expect(blockSelections).toHaveCount(1);
|
||||
|
||||
selectedBlockRect = await blockSelections.nth(0).boundingBox();
|
||||
|
||||
if (!selectedBlockRect) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
expect(editorRect0).toEqual(selectedBlockRect);
|
||||
if (!editorRect0 || !editorRect1) {
|
||||
throw new Error();
|
||||
}
|
||||
);
|
||||
|
||||
test.fixme(
|
||||
'should support moving blocks from multiple notes',
|
||||
async ({ page }) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await page.evaluate(() => {
|
||||
const { doc } = window;
|
||||
await page.mouse.move(
|
||||
editorRect1.x + 5,
|
||||
editorRect1.y + editorRect1.height / 2
|
||||
);
|
||||
|
||||
const rootId = doc.addBlock('affine:page', {
|
||||
title: new window.$blocksuite.store.Text(),
|
||||
});
|
||||
doc.addBlock('affine:surface', {}, rootId);
|
||||
await page.mouse.move(
|
||||
editorRect1.x - 10,
|
||||
editorRect1.y + editorRect1.height / 2
|
||||
);
|
||||
await page.mouse.down();
|
||||
await page.mouse.up();
|
||||
|
||||
['123', '456', '789', '987', '654', '321'].forEach(text => {
|
||||
const noteId = doc.addBlock('affine:note', {}, rootId);
|
||||
doc.addBlock(
|
||||
'affine:paragraph',
|
||||
{
|
||||
text: new window.$blocksuite.store.Text(text),
|
||||
},
|
||||
noteId
|
||||
);
|
||||
});
|
||||
const blockSelections = page
|
||||
.locator('affine-block-selection')
|
||||
.locator('visible=true');
|
||||
await expect(blockSelections).toHaveCount(1);
|
||||
|
||||
doc.resetHistory();
|
||||
let selectedBlockRect = await blockSelections.nth(0).boundingBox();
|
||||
|
||||
if (!selectedBlockRect) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
expect(editorRect1).toEqual(selectedBlockRect);
|
||||
|
||||
await page.mouse.move(
|
||||
editorRect0.x - 10,
|
||||
editorRect0.y + editorRect0.height / 2
|
||||
);
|
||||
await page.mouse.down();
|
||||
await page.mouse.up();
|
||||
|
||||
await expect(blockSelections).toHaveCount(1);
|
||||
|
||||
selectedBlockRect = await blockSelections.nth(0).boundingBox();
|
||||
|
||||
if (!selectedBlockRect) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
expect(editorRect0).toEqual(selectedBlockRect);
|
||||
});
|
||||
|
||||
test.fixme('should support moving blocks from multiple notes', async ({
|
||||
page,
|
||||
}) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await page.evaluate(() => {
|
||||
const { doc } = window;
|
||||
|
||||
const rootId = doc.addBlock('affine:page', {
|
||||
title: new window.$blocksuite.store.Text(),
|
||||
});
|
||||
doc.addBlock('affine:surface', {}, rootId);
|
||||
|
||||
['123', '456', '789', '987', '654', '321'].forEach(text => {
|
||||
const noteId = doc.addBlock('affine:note', {}, rootId);
|
||||
doc.addBlock(
|
||||
'affine:paragraph',
|
||||
{
|
||||
text: new window.$blocksuite.store.Text(text),
|
||||
},
|
||||
noteId
|
||||
);
|
||||
});
|
||||
|
||||
await dragBetweenIndices(
|
||||
page,
|
||||
[1, 0],
|
||||
[2, 3],
|
||||
{ x: -60, y: 0 },
|
||||
{ x: 80, y: 0 },
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
doc.resetHistory();
|
||||
});
|
||||
|
||||
const blockSelections = page
|
||||
.locator('affine-block-selection')
|
||||
.locator('visible=true');
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
|
||||
const editorHost = getEditorHostLocator(page);
|
||||
const editors = editorHost.locator('rich-text');
|
||||
const editorRect1 = await editors.nth(1).boundingBox();
|
||||
const editorRect3 = await editors.nth(3).boundingBox();
|
||||
if (!editorRect1 || !editorRect3) {
|
||||
throw new Error();
|
||||
await dragBetweenIndices(
|
||||
page,
|
||||
[1, 0],
|
||||
[2, 3],
|
||||
{ x: -60, y: 0 },
|
||||
{ x: 80, y: 0 },
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
|
||||
await dragBetweenCoords(
|
||||
page,
|
||||
{
|
||||
x: editorRect1.x - 10,
|
||||
y: editorRect1.y + editorRect1.height / 2,
|
||||
},
|
||||
{
|
||||
x: editorRect3.x + 10,
|
||||
y: editorRect3.y + editorRect3.height / 2 + 10,
|
||||
},
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
const blockSelections = page
|
||||
.locator('affine-block-selection')
|
||||
.locator('visible=true');
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
|
||||
await assertRichTexts(page, ['123', '987', '456', '789', '654', '321']);
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
|
||||
await dragBetweenIndices(
|
||||
page,
|
||||
[5, 0],
|
||||
[4, 3],
|
||||
{ x: -60, y: 0 },
|
||||
{ x: 80, y: 0 },
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
|
||||
const editorRect0 = await editors.nth(0).boundingBox();
|
||||
const editorRect5 = await editors.nth(5).boundingBox();
|
||||
if (!editorRect0 || !editorRect5) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
await dragBetweenCoords(
|
||||
page,
|
||||
{
|
||||
x: editorRect5.x - 10,
|
||||
y: editorRect5.y + editorRect5.height / 2,
|
||||
},
|
||||
{
|
||||
x: editorRect0.x + 10,
|
||||
y: editorRect0.y + editorRect0.height / 2 - 5,
|
||||
},
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
|
||||
await assertRichTexts(page, ['654', '321', '123', '987', '456', '789']);
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
const editorHost = getEditorHostLocator(page);
|
||||
const editors = editorHost.locator('rich-text');
|
||||
const editorRect1 = await editors.nth(1).boundingBox();
|
||||
const editorRect3 = await editors.nth(3).boundingBox();
|
||||
if (!editorRect1 || !editorRect3) {
|
||||
throw new Error();
|
||||
}
|
||||
);
|
||||
|
||||
await dragBetweenCoords(
|
||||
page,
|
||||
{
|
||||
x: editorRect1.x - 10,
|
||||
y: editorRect1.y + editorRect1.height / 2,
|
||||
},
|
||||
{
|
||||
x: editorRect3.x + 10,
|
||||
y: editorRect3.y + editorRect3.height / 2 + 10,
|
||||
},
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
|
||||
await assertRichTexts(page, ['123', '987', '456', '789', '654', '321']);
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
|
||||
await dragBetweenIndices(
|
||||
page,
|
||||
[5, 0],
|
||||
[4, 3],
|
||||
{ x: -60, y: 0 },
|
||||
{ x: 80, y: 0 },
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
|
||||
const editorRect0 = await editors.nth(0).boundingBox();
|
||||
const editorRect5 = await editors.nth(5).boundingBox();
|
||||
if (!editorRect0 || !editorRect5) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
await dragBetweenCoords(
|
||||
page,
|
||||
{
|
||||
x: editorRect5.x - 10,
|
||||
y: editorRect5.y + editorRect5.height / 2,
|
||||
},
|
||||
{
|
||||
x: editorRect0.x + 10,
|
||||
y: editorRect0.y + editorRect0.height / 2 - 5,
|
||||
},
|
||||
{
|
||||
steps: 50,
|
||||
}
|
||||
);
|
||||
|
||||
await assertRichTexts(page, ['654', '321', '123', '987', '456', '789']);
|
||||
await expect(blockSelections).toHaveCount(2);
|
||||
});
|
||||
|
||||
test('drag handle should show on right block when scroll viewport', async ({
|
||||
page,
|
||||
|
||||
@@ -379,69 +379,68 @@ test('when no visible note block, clicking in page mode will auto add a new note
|
||||
expect(note).not.toBeNull();
|
||||
});
|
||||
|
||||
test.fixme(
|
||||
'Click at empty note should add a paragraph block',
|
||||
async ({ page }) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyEdgelessState(page);
|
||||
await focusRichText(page);
|
||||
await type(page, '123');
|
||||
await assertRichTexts(page, ['123']);
|
||||
test.fixme('Click at empty note should add a paragraph block', async ({
|
||||
page,
|
||||
}) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyEdgelessState(page);
|
||||
await focusRichText(page);
|
||||
await type(page, '123');
|
||||
await assertRichTexts(page, ['123']);
|
||||
|
||||
await switchEditorMode(page);
|
||||
await switchEditorMode(page);
|
||||
|
||||
// Drag paragraph out of note block
|
||||
const paragraphBlock = await page
|
||||
.locator(`[data-block-id="3"]`)
|
||||
.boundingBox();
|
||||
if (!paragraphBlock) {
|
||||
throw new Error('paragraphBlock is not found');
|
||||
}
|
||||
await page.mouse.dblclick(paragraphBlock.x, paragraphBlock.y);
|
||||
await waitNextFrame(page);
|
||||
await page.mouse.move(
|
||||
paragraphBlock.x + paragraphBlock.width / 2,
|
||||
paragraphBlock.y + paragraphBlock.height / 2
|
||||
);
|
||||
await waitNextFrame(page);
|
||||
const handle = await page
|
||||
.locator('.affine-drag-handle-container')
|
||||
.boundingBox();
|
||||
if (!handle) {
|
||||
throw new Error('handle is not found');
|
||||
}
|
||||
await page.mouse.move(
|
||||
handle.x + handle.width / 2,
|
||||
handle.y + handle.height / 2,
|
||||
{ steps: 10 }
|
||||
);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(100, 200, { steps: 30 });
|
||||
await page.mouse.up();
|
||||
|
||||
// There should be two note blocks and one paragraph block
|
||||
await assertRichTexts(page, ['123']);
|
||||
await assertBlockCount(page, 'edgeless-note', 2);
|
||||
await assertBlockCount(page, 'paragraph', 1);
|
||||
|
||||
// Click at empty note block to add a paragraph block
|
||||
const emptyNote = await page.locator(`[data-block-id="2"]`).boundingBox();
|
||||
if (!emptyNote) {
|
||||
throw new Error('emptyNote is not found');
|
||||
}
|
||||
await page.mouse.click(
|
||||
emptyNote.x + emptyNote.width / 2,
|
||||
emptyNote.y + emptyNote.height / 2
|
||||
);
|
||||
await waitNextFrame(page, 300);
|
||||
await type(page, '456');
|
||||
await waitNextFrame(page, 400);
|
||||
|
||||
await page.mouse.click(100, 100);
|
||||
await waitNextFrame(page, 400);
|
||||
await assertBlockCount(page, 'paragraph', 2);
|
||||
// Drag paragraph out of note block
|
||||
const paragraphBlock = await page
|
||||
.locator(`[data-block-id="3"]`)
|
||||
.boundingBox();
|
||||
if (!paragraphBlock) {
|
||||
throw new Error('paragraphBlock is not found');
|
||||
}
|
||||
);
|
||||
await page.mouse.dblclick(paragraphBlock.x, paragraphBlock.y);
|
||||
await waitNextFrame(page);
|
||||
await page.mouse.move(
|
||||
paragraphBlock.x + paragraphBlock.width / 2,
|
||||
paragraphBlock.y + paragraphBlock.height / 2
|
||||
);
|
||||
await waitNextFrame(page);
|
||||
const handle = await page
|
||||
.locator('.affine-drag-handle-container')
|
||||
.boundingBox();
|
||||
if (!handle) {
|
||||
throw new Error('handle is not found');
|
||||
}
|
||||
await page.mouse.move(
|
||||
handle.x + handle.width / 2,
|
||||
handle.y + handle.height / 2,
|
||||
{ steps: 10 }
|
||||
);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(100, 200, { steps: 30 });
|
||||
await page.mouse.up();
|
||||
|
||||
// There should be two note blocks and one paragraph block
|
||||
await assertRichTexts(page, ['123']);
|
||||
await assertBlockCount(page, 'edgeless-note', 2);
|
||||
await assertBlockCount(page, 'paragraph', 1);
|
||||
|
||||
// Click at empty note block to add a paragraph block
|
||||
const emptyNote = await page.locator(`[data-block-id="2"]`).boundingBox();
|
||||
if (!emptyNote) {
|
||||
throw new Error('emptyNote is not found');
|
||||
}
|
||||
await page.mouse.click(
|
||||
emptyNote.x + emptyNote.width / 2,
|
||||
emptyNote.y + emptyNote.height / 2
|
||||
);
|
||||
await waitNextFrame(page, 300);
|
||||
await type(page, '456');
|
||||
await waitNextFrame(page, 400);
|
||||
|
||||
await page.mouse.click(100, 100);
|
||||
await waitNextFrame(page, 400);
|
||||
await assertBlockCount(page, 'paragraph', 2);
|
||||
});
|
||||
|
||||
test('Should focus at closest text block when note collapse', async ({
|
||||
page,
|
||||
|
||||
@@ -690,22 +690,21 @@ test.describe('shape hit test', () => {
|
||||
|
||||
// FIXME(@flrande): This is broken by recent changes
|
||||
// In Playwright, we can't add text in shape hollow area
|
||||
test.fixme(
|
||||
'using text tool to add text in shape hollow area',
|
||||
async ({ page }) => {
|
||||
await addTransparentRect(page, rect.start, rect.end);
|
||||
await page.mouse.click(rect.start.x - 20, rect.start.y - 20);
|
||||
await assertEdgelessNonSelectedRect(page);
|
||||
test.fixme('using text tool to add text in shape hollow area', async ({
|
||||
page,
|
||||
}) => {
|
||||
await addTransparentRect(page, rect.start, rect.end);
|
||||
await page.mouse.click(rect.start.x - 20, rect.start.y - 20);
|
||||
await assertEdgelessNonSelectedRect(page);
|
||||
|
||||
await assertEdgelessTool(page, 'default');
|
||||
await setEdgelessTool(page, 'text');
|
||||
await page.mouse.click(rect.start.x + 50, rect.start.y + 50);
|
||||
await waitNextFrame(page);
|
||||
await assertEdgelessTool(page, 'default');
|
||||
await setEdgelessTool(page, 'text');
|
||||
await page.mouse.click(rect.start.x + 50, rect.start.y + 50);
|
||||
await waitNextFrame(page);
|
||||
|
||||
await type(page, 'hello');
|
||||
await assertEdgelessCanvasText(page, 'hello');
|
||||
}
|
||||
);
|
||||
await type(page, 'hello');
|
||||
await assertEdgelessCanvasText(page, 'hello');
|
||||
});
|
||||
|
||||
test('should enter edit mode when double-clicking a text area in a shape with a transparent background', async ({
|
||||
page,
|
||||
|
||||
@@ -23,58 +23,57 @@ test.describe('Embed synced doc in edgeless mode', () => {
|
||||
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' },
|
||||
]);
|
||||
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' },
|
||||
]);
|
||||
|
||||
await switchEditorMode(page);
|
||||
await switchEditorMode(page);
|
||||
|
||||
// Double click on note to enter edit status
|
||||
const noteBlock = page.locator('affine-edgeless-note');
|
||||
await noteBlock.dblclick();
|
||||
// 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
|
||||
);
|
||||
// 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
|
||||
);
|
||||
});
|
||||
|
||||
test('new edgeless embed synced doc should fit in height', async ({
|
||||
page,
|
||||
|
||||
@@ -1010,63 +1010,62 @@ test.describe.skip('Customize linked doc title and description', () => {
|
||||
});
|
||||
|
||||
// Embed View
|
||||
test.fixme(
|
||||
'should automatically switch to card view and set a custom title and description on edgeless',
|
||||
async ({ page }) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyEdgelessState(page);
|
||||
await focusRichText(page);
|
||||
await createAndConvertToEmbedLinkedDoc(page);
|
||||
test.fixme('should automatically switch to card view and set a custom title and description on edgeless', async ({
|
||||
page,
|
||||
}) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyEdgelessState(page);
|
||||
await focusRichText(page);
|
||||
await createAndConvertToEmbedLinkedDoc(page);
|
||||
|
||||
await switchEditorMode(page);
|
||||
await page.mouse.dblclick(450, 450);
|
||||
await switchEditorMode(page);
|
||||
await page.mouse.dblclick(450, 450);
|
||||
|
||||
await dragBlockToPoint(page, '9', { x: 200, y: 200 });
|
||||
await dragBlockToPoint(page, '9', { x: 200, y: 200 });
|
||||
|
||||
await waitNextFrame(page);
|
||||
await waitNextFrame(page);
|
||||
|
||||
const toolbar = page.locator('editor-toolbar');
|
||||
await toolbar.getByRole('button', { name: 'Switch view' }).click();
|
||||
await toolbar.getByRole('button', { name: 'Embed view' }).click();
|
||||
const toolbar = page.locator('editor-toolbar');
|
||||
await toolbar.getByRole('button', { name: 'Switch view' }).click();
|
||||
await toolbar.getByRole('button', { name: 'Embed view' }).click();
|
||||
|
||||
await waitNextFrame(page);
|
||||
await waitNextFrame(page);
|
||||
|
||||
await toolbar.getByRole('button', { name: 'Edit' }).click();
|
||||
await toolbar.getByRole('button', { name: 'Edit' }).click();
|
||||
|
||||
await waitNextFrame(page);
|
||||
const editModal = page.locator('embed-card-edit-modal');
|
||||
const saveButton = editModal.getByRole('button', { name: 'Save' });
|
||||
await waitNextFrame(page);
|
||||
const editModal = page.locator('embed-card-edit-modal');
|
||||
const saveButton = editModal.getByRole('button', { name: 'Save' });
|
||||
|
||||
// title alias
|
||||
await type(page, 'page0-title0');
|
||||
await page.keyboard.press('Tab');
|
||||
// description alias
|
||||
await type(page, 'This is a new description');
|
||||
// title alias
|
||||
await type(page, 'page0-title0');
|
||||
await page.keyboard.press('Tab');
|
||||
// description alias
|
||||
await type(page, 'This is a new description');
|
||||
|
||||
// saves aliases
|
||||
await saveButton.click();
|
||||
// saves aliases
|
||||
await saveButton.click();
|
||||
|
||||
await waitNextFrame(page);
|
||||
await waitNextFrame(page);
|
||||
|
||||
const syncedDocBlock = page.locator(
|
||||
'affine-embed-edgeless-synced-doc-block'
|
||||
);
|
||||
const syncedDocBlock = page.locator(
|
||||
'affine-embed-edgeless-synced-doc-block'
|
||||
);
|
||||
|
||||
await expect(syncedDocBlock).toBeHidden();
|
||||
await expect(syncedDocBlock).toBeHidden();
|
||||
|
||||
const linkedDocBlock = page.locator(
|
||||
'affine-embed-edgeless-linked-doc-block'
|
||||
);
|
||||
const linkedDocBlock = page.locator(
|
||||
'affine-embed-edgeless-linked-doc-block'
|
||||
);
|
||||
|
||||
await expect(linkedDocBlock).toBeVisible();
|
||||
await expect(linkedDocBlock).toBeVisible();
|
||||
|
||||
const linkedDocBlockTitle = linkedDocBlock.locator(
|
||||
'.affine-embed-linked-doc-content-title-text'
|
||||
);
|
||||
await expect(linkedDocBlockTitle).toHaveText('page0-title0');
|
||||
await expect(
|
||||
linkedDocBlock.locator('.affine-embed-linked-doc-content-note.alias')
|
||||
).toHaveText('This is a new description');
|
||||
}
|
||||
);
|
||||
const linkedDocBlockTitle = linkedDocBlock.locator(
|
||||
'.affine-embed-linked-doc-content-title-text'
|
||||
);
|
||||
await expect(linkedDocBlockTitle).toHaveText('page0-title0');
|
||||
await expect(
|
||||
linkedDocBlock.locator('.affine-embed-linked-doc-content-note.alias')
|
||||
).toHaveText('This is a new description');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user