Saul-Mirone
2025-03-27 05:27:59 +00:00
parent 5f5c27fbdf
commit d9d5aa407a
12 changed files with 90 additions and 45 deletions

View File

@@ -127,6 +127,7 @@ test(
await activeNoteInEdgeless(page, ids.noteId);
await waitForInlineEditorStateUpdated(page);
await focusRichText(page);
await selectAllByKeyboard(page);
await copyByKeyboard(page);
await pressArrowRight(page);

View File

@@ -5,7 +5,6 @@ import { expect } from '@playwright/test';
import {
captureHistory,
copyByKeyboard,
dragBetweenCoords,
dragOverTitle,
enterPlaygroundRoom,
focusRichText,
@@ -20,15 +19,18 @@ import {
mockParseDocUrlService,
pasteByKeyboard,
pasteContent,
pressArrowRight,
pressEnter,
pressShiftTab,
pressTab,
resetHistory,
selectAllByKeyboard,
setInlineRangeInSelectedRichText,
setSelection,
SHORT_KEY,
type,
undoByClick,
undoByKeyboard,
waitNextFrame,
} from '../utils/actions/index.js';
import {
@@ -106,15 +108,15 @@ test(scoped`split block when paste`, async ({ page }) => {
`,
};
await type(page, 'abc');
await captureHistory(page);
await setInlineRangeInSelectedRichText(page, 1, 1);
await captureHistory(page);
await pasteContent(page, clipData);
await waitNextFrame(page);
await assertRichTexts(page, ['atext', 'h1c']);
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['abc']);
await type(page, 'aa');
@@ -132,11 +134,12 @@ test(scoped`split block when paste`, async ({ page }) => {
if (!bottomRight789) {
throw new Error('bottomRight789 is not found');
}
await dragBetweenCoords(page, topLeft123, bottomRight789);
await selectAllByKeyboard(page);
await pressArrowRight(page);
await pressEnter(page);
// FIXME see https://github.com/toeverything/blocksuite/pull/878
// await pasteContent(page, clipData);
// await assertRichTexts(page, ['aaa', 'bbc', 'text', 'h1']);
await pasteContent(page, clipData);
await assertRichTexts(page, ['aaa', 'bbc', 'text', 'h1']);
});
test(scoped`copy clipItems format`, async ({ page }) => {

View File

@@ -481,6 +481,7 @@ test(scoped`copy when text note active in edgeless`, async ({ page }) => {
await activeNoteInEdgeless(page, ids.noteId);
await waitForInlineEditorStateUpdated(page);
await focusRichText(page);
await setInlineRangeInSelectedRichText(page, 0, 4);
await copyByKeyboard(page);
await pressArrowRight(page);

View File

@@ -288,6 +288,7 @@ test('link bar should not be appear when the range is collapsed', async ({
await pressCreateLinkShortCut(page);
await expect(linkPopoverLocator).toBeVisible();
await focusRichText(page); // click to cancel the link popover
await focusRichTextEnd(page);
await pressEnter(page);
// create auto line-break in span element

View File

@@ -37,9 +37,9 @@ test('markdown shortcut', async ({ page }) => {
await waitNextFrame(page);
[id] = await getCursorBlockIdAndHeight(page);
await assertBlockType(page, id, 'todo');
await undoByClick(page);
await undoByKeyboard(page);
await assertText(page, '[] ');
await undoByClick(page);
await undoByKeyboard(page);
//FIXME: it just failed in playwright
await focusRichText(page);
await assertRichTexts(page, ['']);
@@ -49,9 +49,9 @@ test('markdown shortcut', async ({ page }) => {
await waitNextFrame(page);
[id] = await getCursorBlockIdAndHeight(page);
await assertBlockType(page, id, 'todo');
await undoByClick(page);
await undoByKeyboard(page);
await assertText(page, '[ ] ');
await undoByClick(page);
await undoByKeyboard(page);
//FIXME: it just failed in playwright
await focusRichText(page);
await assertRichTexts(page, ['']);
@@ -61,9 +61,9 @@ test('markdown shortcut', async ({ page }) => {
await waitNextFrame(page);
[id] = await getCursorBlockIdAndHeight(page);
await assertBlockType(page, id, 'todo');
await undoByClick(page);
await undoByKeyboard(page);
await assertText(page, '[x] ');
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['']);
await waitNextFrame(page);
@@ -71,9 +71,9 @@ test('markdown shortcut', async ({ page }) => {
await waitNextFrame(page);
[id] = await getCursorBlockIdAndHeight(page);
await assertBlockType(page, id, 'bulleted');
await undoByClick(page);
await undoByKeyboard(page);
await assertText(page, '* ');
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['']);
await waitNextFrame(page);
@@ -81,9 +81,9 @@ test('markdown shortcut', async ({ page }) => {
await waitNextFrame(page);
[id] = await getCursorBlockIdAndHeight(page);
await assertBlockType(page, id, 'bulleted');
await undoByClick(page);
await undoByKeyboard(page);
await assertText(page, '- ');
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['']);
await waitNextFrame(page);
@@ -91,9 +91,9 @@ test('markdown shortcut', async ({ page }) => {
await waitNextFrame(page);
[id] = await getCursorBlockIdAndHeight(page);
await assertBlockType(page, id, 'numbered');
await undoByClick(page);
await undoByKeyboard(page);
await assertText(page, '1. ');
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['']);
await waitNextFrame(page);
@@ -101,9 +101,9 @@ test('markdown shortcut', async ({ page }) => {
await waitNextFrame(page);
[id] = await getCursorBlockIdAndHeight(page);
await assertBlockType(page, id, 'numbered');
await undoByClick(page);
await undoByKeyboard(page);
await assertText(page, '20. ');
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['']);
await waitNextFrame(page);
@@ -111,9 +111,9 @@ test('markdown shortcut', async ({ page }) => {
await waitNextFrame(page);
[id] = await getCursorBlockIdAndHeight(page);
await assertBlockType(page, id, 'h1');
await undoByClick(page);
await undoByKeyboard(page);
await assertText(page, '# ');
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['']);
await waitNextFrame(page);
@@ -121,9 +121,9 @@ test('markdown shortcut', async ({ page }) => {
await waitNextFrame(page);
[id] = await getCursorBlockIdAndHeight(page);
await assertBlockType(page, id, 'h2');
await undoByClick(page);
await undoByKeyboard(page);
await assertText(page, '## ');
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['']);
await waitNextFrame(page);
@@ -131,9 +131,9 @@ test('markdown shortcut', async ({ page }) => {
await waitNextFrame(page);
[id] = await getCursorBlockIdAndHeight(page);
await assertBlockType(page, id, 'h3');
await undoByClick(page);
await undoByKeyboard(page);
await assertText(page, '### ');
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['']);
await waitNextFrame(page);
@@ -141,9 +141,9 @@ test('markdown shortcut', async ({ page }) => {
await waitNextFrame(page);
[id] = await getCursorBlockIdAndHeight(page);
await assertBlockType(page, id, 'h4');
await undoByClick(page);
await undoByKeyboard(page);
await assertText(page, '#### ');
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['']);
await waitNextFrame(page);
@@ -151,9 +151,9 @@ test('markdown shortcut', async ({ page }) => {
await waitNextFrame(page);
[id] = await getCursorBlockIdAndHeight(page);
await assertBlockType(page, id, 'h5');
await undoByClick(page);
await undoByKeyboard(page);
await assertText(page, '##### ');
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['']);
await waitNextFrame(page);
@@ -161,9 +161,9 @@ test('markdown shortcut', async ({ page }) => {
await waitNextFrame(page);
[id] = await getCursorBlockIdAndHeight(page);
await assertBlockType(page, id, 'h6');
await undoByClick(page);
await undoByKeyboard(page);
await assertText(page, '###### ');
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['']);
await waitNextFrame(page);
@@ -171,17 +171,17 @@ test('markdown shortcut', async ({ page }) => {
await waitNextFrame(page);
[id] = await getCursorBlockIdAndHeight(page);
await assertBlockType(page, id, 'quote');
await undoByClick(page);
await undoByKeyboard(page);
await assertText(page, '> ');
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['']);
// testing various horizontal dividers
await waitNextFrame(page);
await type(page, '--- ');
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['--- ']);
await undoByClick(page);
await undoByKeyboard(page);
await assertRichTexts(page, ['']);
await waitNextFrame(page);