mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: expect(locator).toHaveCount should wait (#8901)
This commit is contained in:
parent
478a7bcc90
commit
6c41ad3329
@ -23,9 +23,15 @@ test('should support toHaveCount', async ({ runInlineTest }) => {
|
||||
const { test } = pwt;
|
||||
|
||||
test('pass', async ({ page }) => {
|
||||
await page.setContent('<select><option>One</option><option>Two</option></select>');
|
||||
await page.setContent('<select><option>One</option></select>');
|
||||
const locator = page.locator('option');
|
||||
await expect(locator).toHaveCount(2);
|
||||
let done = false;
|
||||
const promise = expect(locator).toHaveCount(2).then(() => { done = true; });
|
||||
await page.waitForTimeout(1000);
|
||||
expect(done).toBe(false);
|
||||
await page.setContent('<select><option>One</option><option>Two</option></select>');
|
||||
await promise;
|
||||
expect(done).toBe(true);
|
||||
});
|
||||
`,
|
||||
}, { workers: 1 });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user