test: console messages are dispatched when page has workers (#16066)

This commit is contained in:
Yury Semikhatsky 2022-07-29 16:58:25 -07:00 committed by GitHub
parent d33455dcca
commit d05044f366
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -173,3 +173,18 @@ it('should report network activity on worker creation', async function({ page, s
expect(response.request()).toBe(request);
expect(response.ok()).toBe(true);
});
it('should dispatch console messages when page has workers', async function({ page, browserName, server }) {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/15550' });
it.fixme(browserName === 'firefox');
await page.goto(server.EMPTY_PAGE);
await Promise.all([
page.waitForEvent('worker'),
page.evaluate(() => new Worker(URL.createObjectURL(new Blob(['const x = 1;'], { type: 'application/javascript' }))))
]);
const [message] = await Promise.all([
page.waitForEvent('console'),
page.evaluate(() => console.log('foo'))
]);
expect(message.text()).toBe('foo');
});