Skip to content

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

test: add console.info/debug tests (#10577)

Max Schmitte6ef3e3680d8
diff --git a/tests/page/page-event-console.spec.ts b/tests/page/page-event-console.spec.ts
index b41373805d..4e0ecde42a 100644
--- a/tests/page/page-event-console.spec.ts
+++ b/tests/page/page-event-console.spec.ts
@@ -64,10 +64,16 @@ it('should work for different console API calls', async ({ page }) => {
console.dir('calling console.dir');
console.warn('calling console.warn');
console.error('calling console.error');
+ console.info('calling console.info');
+ console.debug('calling console.debug');
console.log(Promise.resolve('should not wait until resolved!'));
});
+ // WebKit uses console.debug() to report binding calls, make sure they don't get reported.
+ await page.exposeBinding('foobar', async (_, value) => page.evaluate(value => console.log(value), value));
+ await page.evaluate(() => window['foobar']('Using bindings'));
+
expect(messages.map(msg => msg.type())).toEqual([
- 'timeEnd', 'trace', 'dir', 'warning', 'error', 'log'
+ 'timeEnd', 'trace', 'dir', 'warning', 'error', 'info', 'debug', 'log', 'log'
]);
expect(messages[0].text()).toContain('calling console.time');
expect(messages.slice(1).map(msg => msg.text())).toEqual([
@@ -75,7 +81,10 @@ it('should work for different console API calls', async ({ page }) => {
'calling console.dir',
'calling console.warn',
'calling console.error',
+ 'calling console.info',
+ 'calling console.debug',
'Promise',
+ 'Using bindings',
]);
});