diff --git a/package-lock.json b/package-lock.json index 81af0ad6..ccf98e5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3041,18 +3041,6 @@ "node": ">=10" } }, - "node_modules/chromium-bidi": { - "version": "0.4.31", - "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.31.tgz", - "integrity": "sha512-OtvEg2JMRQrHsmLx4FV3u1Hf9waYxB5PmL+yM0HkFpc9H2x3TMbUqS+GP2/fC4399hzOO+EQF8uVU43By9ILag==", - "dependencies": { - "mitt": "3.0.1", - "urlpattern-polyfill": "9.0.0" - }, - "peerDependencies": { - "devtools-protocol": "*" - } - }, "node_modules/ci-info": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", @@ -11792,7 +11780,7 @@ "license": "Apache-2.0", "dependencies": { "@puppeteer/browsers": "1.7.1", - "chromium-bidi": "0.4.31", + "chromium-bidi": "0.4.32", "cross-fetch": "4.0.0", "debug": "4.3.4", "devtools-protocol": "0.0.1191157", @@ -11813,6 +11801,18 @@ "dev": true, "license": "MIT" }, + "packages/puppeteer-core/node_modules/chromium-bidi": { + "version": "0.4.32", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.32.tgz", + "integrity": "sha512-RJnw0PW3sNdx1WclINVfVVx8JUH+tWTHZNpnEzlcM+Qgvf40dUH34U7gJq+cc/0LE+rbPxeT6ldqWrCbUf4jeg==", + "dependencies": { + "mitt": "3.0.1", + "urlpattern-polyfill": "9.0.0" + }, + "peerDependencies": { + "devtools-protocol": "*" + } + }, "packages/puppeteer-core/node_modules/rxjs": { "version": "7.8.1", "dev": true, diff --git a/packages/puppeteer-core/package.json b/packages/puppeteer-core/package.json index f3410fdd..894a8eb2 100644 --- a/packages/puppeteer-core/package.json +++ b/packages/puppeteer-core/package.json @@ -118,7 +118,7 @@ "license": "Apache-2.0", "dependencies": { "@puppeteer/browsers": "1.7.1", - "chromium-bidi": "0.4.31", + "chromium-bidi": "0.4.32", "cross-fetch": "4.0.0", "debug": "4.3.4", "devtools-protocol": "0.0.1191157", diff --git a/packages/puppeteer-core/src/bidi/BidiOverCdp.ts b/packages/puppeteer-core/src/bidi/BidiOverCdp.ts index 57367c41..0a5274ca 100644 --- a/packages/puppeteer-core/src/bidi/BidiOverCdp.ts +++ b/packages/puppeteer-core/src/bidi/BidiOverCdp.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as BidiMapper from 'chromium-bidi/lib/cjs/bidiMapper/bidiMapper.js'; +import * as BidiMapper from 'chromium-bidi/lib/cjs/bidiMapper/BidiMapper.js'; import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js'; import type {ProtocolMapping} from 'devtools-protocol/types/protocol-mapping.js'; diff --git a/packages/puppeteer-core/src/bidi/Page.ts b/packages/puppeteer-core/src/bidi/Page.ts index c1833550..fb232194 100644 --- a/packages/puppeteer-core/src/bidi/Page.ts +++ b/packages/puppeteer-core/src/bidi/Page.ts @@ -677,7 +677,7 @@ export class BidiPage extends Page { ...(quality === undefined ? {} : {quality: quality / 100}), }, clip: clip && { - type: 'viewport', + type: 'box', ...clip, }, }); diff --git a/packages/puppeteer-core/src/cdp/Accessibility.ts b/packages/puppeteer-core/src/cdp/Accessibility.ts index eeb03c68..bd7382a1 100644 --- a/packages/puppeteer-core/src/cdp/Accessibility.ts +++ b/packages/puppeteer-core/src/cdp/Accessibility.ts @@ -303,7 +303,12 @@ class AXNode { #isTextOnlyObject(): boolean { const role = this.#role; - return role === 'LineBreak' || role === 'text' || role === 'InlineTextBox'; + return ( + role === 'LineBreak' || + role === 'text' || + role === 'InlineTextBox' || + role === 'StaticText' + ); } #hasFocusableChild(): boolean { diff --git a/packages/puppeteer-core/src/common/WaitTask.ts b/packages/puppeteer-core/src/common/WaitTask.ts index 8845b493..604f3156 100644 --- a/packages/puppeteer-core/src/common/WaitTask.ts +++ b/packages/puppeteer-core/src/common/WaitTask.ts @@ -221,7 +221,13 @@ export class WaitTask { // We could have tried to evaluate in a context which was already // destroyed. - if (error.message.includes('Cannot find context with specified id')) { + if ( + error.message.includes('Cannot find context with specified id') || + // Firefox BiDi Error, update one https://github.com/w3c/webdriver-bidi/issues/540 is resolved + error.message.includes( + "destroyed before query 'MessageHandlerFrameParent:sendCommand'" + ) + ) { return; } diff --git a/test/TestExpectations.json b/test/TestExpectations.json index f9d39463..b06287b7 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -2261,6 +2261,12 @@ "parameters": ["cdp", "firefox"], "expectations": ["FAIL", "PASS"] }, + { + "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch should take fullPage screenshots when defaultViewport is null", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"] + }, { "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch should work with no default arguments", "platforms": ["darwin", "linux", "win32"], @@ -3485,16 +3491,58 @@ "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL"] }, + { + "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should scroll element into view", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"] + }, + { + "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should take into account padding and border", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"] + }, + { + "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should work", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"] + }, { "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should work for an element with an offset", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], "expectations": ["FAIL"] }, + { + "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should work for an element with an offset", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"] + }, + { + "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should work for an element with fractional dimensions", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"] + }, + { + "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should work with a null viewport", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"] + }, + { + "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should work with a rotated element", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["cdp", "firefox"], + "expectations": ["FAIL"] + }, { "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should work with a rotated element", "platforms": ["darwin", "linux", "win32"], - "parameters": ["cdp", "firefox"], + "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL"] }, { @@ -3509,6 +3557,18 @@ "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL"] }, + { + "testIdPattern": "[screenshot.spec] Screenshots Page.screenshot should run in parallel", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"] + }, + { + "testIdPattern": "[screenshot.spec] Screenshots Page.screenshot should run in parallel in multiple pages", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"] + }, { "testIdPattern": "[screenshot.spec] Screenshots Page.screenshot should take fullPage screenshots", "platforms": ["darwin", "linux", "win32"], @@ -3521,6 +3581,12 @@ "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL"] }, + { + "testIdPattern": "[screenshot.spec] Screenshots Page.screenshot should work with odd clip size on Retina displays", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"] + }, { "testIdPattern": "[stacktrace.spec] Stack trace should work for none error objects", "platforms": ["darwin", "linux", "win32"], diff --git a/test/src/accessibility.spec.ts b/test/src/accessibility.spec.ts index 145da9fe..703a9f6d 100644 --- a/test/src/accessibility.spec.ts +++ b/test/src/accessibility.spec.ts @@ -114,7 +114,7 @@ describe('Accessibility', function () { }, ], }; - expect(await page.accessibility.snapshot()).toEqual(golden); + expect(await page.accessibility.snapshot()).toMatchObject(golden); }); it('should report uninteresting nodes', async () => { const {page, isFirefox} = await getTestState(); @@ -158,7 +158,7 @@ describe('Accessibility', function () { findFocusedNode( await page.accessibility.snapshot({interestingOnly: false}) ) - ).toEqual(golden); + ).toMatchObject(golden); }); it('get snapshots while the tree is re-calculated', async () => { // see https://github.com/puppeteer/puppeteer/issues/9404 @@ -346,7 +346,7 @@ describe('Accessibility', function () { const snapshot = await page.accessibility.snapshot(); assert(snapshot); assert(snapshot.children); - expect(snapshot.children[0]).toEqual(golden); + expect(snapshot.children[0]).toMatchObject(golden); }); it('rich text editable fields with role should have children', async () => { const {page, isFirefox} = await getTestState(); @@ -383,7 +383,7 @@ describe('Accessibility', function () { const snapshot = await page.accessibility.snapshot(); assert(snapshot); assert(snapshot.children); - expect(snapshot.children[0]).toEqual(golden); + expect(snapshot.children[0]).toMatchObject(golden); }); // Firefox does not support contenteditable="plaintext-only". @@ -545,7 +545,7 @@ describe('Accessibility', function () { root: div, interestingOnly: false, }) - ).toEqual({ + ).toMatchObject({ role: 'generic', name: '', children: [