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

This commit is contained in:
Max Schmitt 2021-11-29 22:20:46 +01:00 committed by GitHub
parent 0df73d2f8e
commit e6ef3e3680
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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',
]);
});