test(core): add missing await for expect (#11900)

This commit is contained in:
L-Sun
2025-04-23 04:55:18 +00:00
parent b1aecfc1c4
commit 9baef237f2
20 changed files with 93 additions and 105 deletions

View File

@@ -70,7 +70,7 @@ test.describe('AIChatWith/Network', () => {
20000
);
const { message } = await utils.chatPanel.getLatestAssistantMessage(page);
expect(await message.locator('affine-footnote-node').count()).toBe(0);
await expect(message.locator('affine-footnote-node')).toHaveCount(0);
});
test('should disable network search when chating with image', async ({

View File

@@ -37,7 +37,7 @@ test.describe('AIChatWith/tags', () => {
const { content, message } =
await utils.chatPanel.getLatestAssistantMessage(page);
expect(content).toMatch(/TagAAaa.*cat/);
expect(await message.locator('affine-footnote-node').count()).toBe(1);
await expect(message.locator('affine-footnote-node')).toHaveCount(1);
}).toPass();
});
@@ -67,7 +67,7 @@ test.describe('AIChatWith/tags', () => {
await utils.chatPanel.getLatestAssistantMessage(page);
expect(content).toMatch(/TagEEee.*cat/);
expect(content).toMatch(/TagFFff.*dog/);
expect(await message.locator('affine-footnote-node').count()).toBe(2);
await expect(message.locator('affine-footnote-node')).toHaveCount(2);
}).toPass();
});
});

View File

@@ -31,7 +31,7 @@ test.describe('AIInsertion/SaveAsDoc', () => {
const { actions, content } =
await utils.chatPanel.getLatestAssistantMessage(page);
await actions.saveAsDoc();
await page.getByText('New doc created');
await page.getByText('New doc created').waitFor({ state: 'visible' });
// Verify the ai block is created
const editorContent = await utils.editor.getEditorContent(page);
@@ -63,7 +63,7 @@ test.describe('AIInsertion/SaveAsDoc', () => {
const { actions, content } =
await utils.chatPanel.getLatestAssistantMessage(page);
await actions.saveAsDoc();
await page.getByText('New doc created');
await page.getByText('New doc created').waitFor({ state: 'visible' });
// Switch to page mode
await utils.editor.isPageMode(page);