mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-19 07:17:00 +08:00
test(editor): move tests of toc to affine (#9833)
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user