fix(core): flaky quick search test (#11833)

This commit is contained in:
pengx17
2025-04-21 04:14:29 +00:00
parent 1146f4d5a9
commit 535b5ff7c2
+6 -2
View File
@@ -464,6 +464,8 @@ test('can use @ to open quick search to search for doc and insert into canvas',
const url = page.url(); const url = page.url();
const docTitle = await page.getByTestId('title-edit-button').innerText();
await clickNewPageButton(page); await clickNewPageButton(page);
await clickEdgelessModeButton(page); await clickEdgelessModeButton(page);
await page.locator('affine-edgeless-root').press('@'); await page.locator('affine-edgeless-root').press('@');
@@ -475,7 +477,9 @@ test('can use @ to open quick search to search for doc and insert into canvas',
await insertInputText(page, url); await insertInputText(page, url);
// expect the default page to be selected // expect the default page to be selected
await expect(page.locator('[cmdk-group-items] [cmdk-item]')).toHaveCount(5); await expect(
page.locator('[cmdk-group-items] [cmdk-item][data-selected="true"]')
).toContainText(docTitle);
// press enter to insert the page to canvas // press enter to insert the page to canvas
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
@@ -484,7 +488,7 @@ test('can use @ to open quick search to search for doc and insert into canvas',
).toBeVisible(); ).toBeVisible();
await expect( await expect(
page.locator('.affine-embed-linked-doc-content-title') page.locator('.affine-embed-linked-doc-content-title')
).toContainText('Getting Started'); ).toContainText(docTitle);
// focus on the note block // focus on the note block
await page.waitForTimeout(500); await page.waitForTimeout(500);