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;
|
const { test } = pwt;
|
||||||
|
|
||||||
test('pass', async ({ page }) => {
|
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');
|
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 });
|
}, { workers: 1 });
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue