fix(firefox): report more console messages (including warnings) (#4005)

This commit is contained in:
Andrey Lushnikov 2019-02-13 23:22:45 -08:00 committed by GitHub
parent 0b40d04b99
commit 6350cf0892
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -80,7 +80,7 @@ class Page extends EventEmitter {
this._networkManager.setFrameManager(this._frameManager);
this._eventListeners = [
helper.addEventListener(this._session, 'Page.uncaughtError', this._onUncaughtError.bind(this)),
helper.addEventListener(this._session, 'Page.consoleAPICalled', this._onConsole.bind(this)),
helper.addEventListener(this._session, 'Page.console', this._onConsole.bind(this)),
helper.addEventListener(this._session, 'Page.dialogOpened', this._onDialogOpened.bind(this)),
helper.addEventListener(this._session, 'Browser.tabClosed', this._onClosed.bind(this)),
helper.addEventListener(this._frameManager, Events.FrameManager.Load, () => this.emit(Events.Page.Load)),

View File

@ -9,7 +9,7 @@
"node": ">=8.9.4"
},
"puppeteer": {
"firefox_revision": "4ba5b441257d5938d032d09fc09e45ea9d8f2e3a"
"firefox_revision": "fd017c27c17d0b4fa8bdea3ad40b88ca2addaeda"
},
"scripts": {
"install": "node install.js",

View File

@ -333,14 +333,17 @@ module.exports.addTests = function({testRunner, expect, headless, Errors, Device
]);
expect(message.text()).toBe('JSHandle@object');
});
it_fails_ffox('should trigger correct Log', async({page, server}) => {
it('should trigger correct Log', async({page, server}) => {
await page.goto('about:blank');
const [message] = await Promise.all([
waitEvent(page, 'console'),
page.evaluate(async url => fetch(url).catch(e => {}), server.EMPTY_PAGE)
]);
expect(message.text()).toContain('No \'Access-Control-Allow-Origin\'');
expect(message.type()).toEqual('error');
expect(message.text()).toContain('Access-Control-Allow-Origin');
if (CHROME)
expect(message.type()).toEqual('error');
else
expect(message.type()).toEqual('warn');
});
it_fails_ffox('should have location when fetch fails', async({page, server}) => {
await page.goto(server.EMPTY_PAGE);