test(editor): move tests of toc to affine (#9833)

This commit is contained in:
L-Sun
2025-01-21 13:34:59 +00:00
parent 24fce7a708
commit 16d4430ec9
11 changed files with 595 additions and 728 deletions

View File

@@ -25,9 +25,11 @@ export const withCtrlOrMeta = async (page: Page, fn: () => Promise<void>) => {
await keyUpCtrlOrMeta(page);
};
export async function pressEnter(page: Page) {
export async function pressEnter(page: Page, count = 1) {
// avoid flaky test by simulate real user input
await page.keyboard.press('Enter', { delay: 50 });
for (let i = 0; i < count; i++) {
await page.keyboard.press('Enter', { delay: 50 });
}
}
export async function pressTab(page: Page) {
@@ -46,6 +48,12 @@ export async function pressShiftEnter(page: Page) {
await page.keyboard.up('Shift');
}
export async function pressBackspace(page: Page, count = 1) {
for (let i = 0; i < count; i++) {
await page.keyboard.press('Backspace', { delay: 50 });
}
}
export async function copyByKeyboard(page: Page) {
await keyDownCtrlOrMeta(page);
await page.keyboard.press('c', { delay: 50 });