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

@@ -85,8 +85,8 @@ test.describe('login first', () => {
{
await clickSideBarSettingButton(page);
const locator = page.getByTestId('user-info-card');
expect(locator.getByText(user.email)).toBeTruthy();
expect(locator.getByText(user.name)).toBeTruthy();
await expect(locator.getByText(user.email)).toBeVisible();
await expect(locator.getByText(user.name)).toBeVisible();
await locator.click({
delay: 50,
});
@@ -103,8 +103,8 @@ test.describe('login first', () => {
{
await clickSideBarSettingButton(page);
const locator = page.getByTestId('user-info-card');
expect(locator.getByText(user.email)).toBeTruthy();
expect(locator.getByText(newName)).toBeTruthy();
await expect(locator.getByText(user.email)).toBeVisible();
await expect(locator.getByText(newName)).toBeVisible();
}
});
});

View File

@@ -68,7 +68,7 @@ test('can enable share page', async ({ page, browser }) => {
await waitForEditorLoad(page2);
const title = getBlockSuiteEditorTitle(page2);
await expect(title).toContainText('TEST TITLE');
expect(page2.locator('affine-paragraph').first()).toContainText(
await expect(page2.locator('affine-paragraph').first()).toContainText(
'TEST CONTENT'
);
}
@@ -174,7 +174,7 @@ test('append paragraph should be disabled in shared mode', async ({
}
expect(error).toBeNull();
expect(await paragraph.count()).toBe(numParagraphs);
await expect(paragraph).toHaveCount(numParagraphs);
}
});
@@ -217,7 +217,7 @@ test('share page with default edgeless', async ({ page, browser }) => {
await expect(page.locator('affine-edgeless-root')).toBeVisible({
timeout: 1000,
});
expect(page2.locator('affine-paragraph').first()).toContainText(
await expect(page2.locator('affine-paragraph').first()).toContainText(
'TEST CONTENT'
);
}

View File

@@ -93,11 +93,11 @@ test('should have pagination in member list', async ({ page }) => {
// Click left arrow to back to first page
await navigationItems[0].click();
await page.waitForTimeout(500);
expect(await page.locator('[data-testid="member-item"]').count()).toBe(8);
await expect(page.locator('[data-testid="member-item"]')).toHaveCount(8);
// Click right arrow to second page
await navigationItems[3].click();
await page.waitForTimeout(500);
expect(await page.locator('[data-testid="member-item"]').count()).toBe(3);
await expect(page.locator('[data-testid="member-item"]')).toHaveCount(3);
});
test('should transform local favorites data', async ({ page }) => {