From bae3721e04564ffea7b47721363a0aba43ce0e11 Mon Sep 17 00:00:00 2001 From: Henrik Skupin Date: Thu, 30 May 2024 11:31:47 +0200 Subject: [PATCH] ci: enable more Firefox tests that are now passing and fix others (#12502) --- .../src/node/FirefoxLauncher.ts | 2 +- test/TestExpectations.json | 29 +++---------------- test/src/launcher.spec.ts | 18 +++++++----- test/src/network.spec.ts | 2 +- 4 files changed, 17 insertions(+), 34 deletions(-) diff --git a/packages/puppeteer-core/src/node/FirefoxLauncher.ts b/packages/puppeteer-core/src/node/FirefoxLauncher.ts index 1af09192ec7..1df8a9d8c92 100644 --- a/packages/puppeteer-core/src/node/FirefoxLauncher.ts +++ b/packages/puppeteer-core/src/node/FirefoxLauncher.ts @@ -120,7 +120,7 @@ export class FirefoxLauncher extends ProductLauncher { if (profileArgIndex !== -1) { userDataDir = firefoxArguments[profileArgIndex + 1]; - if (!userDataDir || !fs.existsSync(userDataDir)) { + if (!userDataDir) { throw new Error(`Firefox profile not found at '${userDataDir}'`); } diff --git a/test/TestExpectations.json b/test/TestExpectations.json index 15242ce49fb..2790b5bcb49 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -460,13 +460,6 @@ "expectations": ["SKIP"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, - { - "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch userDataDir argument with non-existent dir", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["firefox"], - "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, { "testIdPattern": "[mouse.spec] Mouse should not throw if buttons are pressed twice", "platforms": ["darwin", "linux", "win32"], @@ -2503,14 +2496,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, - { - "testIdPattern": "[network.spec] network Network Events Page.Events.RequestFailed", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["FAIL"], - "comment": "Test expects slightly different error message consider changing" + "comment": "Fetch.enable not supported with CDP" }, { "testIdPattern": "[network.spec] network Network Events Page.Events.RequestFinished", @@ -3299,7 +3285,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], "expectations": ["SKIP"], - "comment": "TODO: Test relies on chrome-only error code (Firefox currently outputs NS_ERROR_ABORT)" + "comment": "TODO: BiDi does not support custom errors - https://github.com/w3c/webdriver-bidi/issues/508" }, { "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should cache if cache enabled", @@ -3308,19 +3294,12 @@ "expectations": ["SKIP"], "comment": "TODO: Needs support for enabling cache in BiDi without CDP https://github.com/w3c/webdriver-bidi/issues/582" }, - { - "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should cooperatively continue by priority", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["SKIP"], - "comment": "TODO: Needs full support for continueRequest in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1850680" - }, { "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should cooperatively respond by priority", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], "expectations": ["SKIP"], - "comment": "TODO: Needs full support for continueRequest in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1850680" + "comment": "TODO: Needs support for arguments in network.provideResponse in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1853882" }, { "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should intercept", @@ -3438,7 +3417,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], "expectations": ["SKIP"], - "comment": "TODO: Test relies on chrome-only error code (Firefox currently outputs NS_ERROR_ABORT)" + "comment": "TODO: BiDi does not support custom errors - https://github.com/w3c/webdriver-bidi/issues/508" }, { "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should cache if cache enabled", diff --git a/test/src/launcher.spec.ts b/test/src/launcher.spec.ts index 3c26ab61433..dfbe16e0ee7 100644 --- a/test/src/launcher.spec.ts +++ b/test/src/launcher.spec.ts @@ -976,19 +976,23 @@ describe('Launcher specs', function () { try { const events: string[] = []; - browser.on('targetcreated', () => { - events.push('CREATED'); + browser.on('targetcreated', target => { + events.push('CREATED: ' + target.url()); }); - browser.on('targetchanged', () => { - events.push('CHANGED'); + browser.on('targetchanged', target => { + events.push('CHANGED: ' + target.url()); }); - browser.on('targetdestroyed', () => { - events.push('DESTROYED'); + browser.on('targetdestroyed', target => { + events.push('DESTROYED: ' + target.url()); }); const page = await browser.newPage(); await page.goto(server.EMPTY_PAGE); await page.close(); - expect(events).toEqual(['CREATED', 'CHANGED', 'DESTROYED']); + expect(events).toEqual([ + 'CREATED: about:blank', + `CHANGED: ${server.EMPTY_PAGE}`, + `DESTROYED: ${server.EMPTY_PAGE}`, + ]); } finally { await close(); } diff --git a/test/src/network.spec.ts b/test/src/network.spec.ts index 9ed6c3bfaf9..32e670ac0a6 100644 --- a/test/src/network.spec.ts +++ b/test/src/network.spec.ts @@ -555,7 +555,7 @@ describe('network', function () { if (isChrome) { expect(failedRequest.failure()!.errorText).toBe('net::ERR_FAILED'); } else { - expect(failedRequest.failure()!.errorText).toBe('NS_ERROR_FAILURE'); + expect(failedRequest.failure()!.errorText).toBe('NS_ERROR_ABORT'); } }); it('Page.Events.RequestFinished', async () => {