Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

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

Yury Semikhatskyd05044f366f4
diff --git a/tests/page/workers.spec.ts b/tests/page/workers.spec.ts
index 3d6f5d3e6c..a9f88a0a9a 100644
--- a/tests/page/workers.spec.ts
+++ b/tests/page/workers.spec.ts
@@ -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');
+});