From e59ec2de62d4290955e1f6ddf6222cd9aeb68e43 Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Mon, 21 Aug 2023 19:19:59 -0500 Subject: [PATCH] test: fix flaky title insert (#3884) (cherry picked from commit b5afbe385f4921cea50d2682d363629054995fbb) --- tests/affine-local/e2e/quick-search.spec.ts | 23 +++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/affine-local/e2e/quick-search.spec.ts b/tests/affine-local/e2e/quick-search.spec.ts index 0548bef0bb..6aa8eba55e 100644 --- a/tests/affine-local/e2e/quick-search.spec.ts +++ b/tests/affine-local/e2e/quick-search.spec.ts @@ -179,7 +179,7 @@ test('Not show navigation path if page is not a subpage or current page is not i expect(await page.getByTestId('navigation-path').count()).toBe(0); }); -test('Assert the recent browse pages are on the recent list', async ({ +test('assert the recent browse pages are on the recent list', async ({ page, }) => { await openHomePage(page); @@ -187,20 +187,35 @@ test('Assert the recent browse pages are on the recent list', async ({ // create first page await newPage(page); - await page.keyboard.insertText('sgtokidoki'); + { + const title = getBlockSuiteEditorTitle(page); + await title.type('sgtokidoki', { + delay: 50, + }); + } await page.waitForTimeout(200); // create second page await openQuickSearchByShortcut(page); const addNewPage = page.getByTestId('quick-search-add-new-page'); await addNewPage.click(); - await page.keyboard.insertText('theliquidhorse'); + { + const title = getBlockSuiteEditorTitle(page); + await title.type('theliquidhorse', { + delay: 50, + }); + } await page.waitForTimeout(200); // create thrid page await openQuickSearchByShortcut(page); await addNewPage.click(); - await page.keyboard.insertText('battlekot'); + { + const title = getBlockSuiteEditorTitle(page); + await title.type('battlekot', { + delay: 50, + }); + } await page.waitForTimeout(200); await openQuickSearchByShortcut(page);