From 6e2d0002b7b2b9f1b9cbf5f0fac9a4731cb49c1e Mon Sep 17 00:00:00 2001 From: Henrik Skupin Date: Wed, 4 Mar 2020 13:29:52 +0100 Subject: [PATCH 1/2] Don't use expect within Promises (#5466) If a call to expect fails within a Promise it will not be resolved, and causing the test to crash. The patch aligns the code similar to what is used by all the other tests. --- test/dialog.spec.js | 14 ++++++++++---- test/navigation.spec.js | 12 +++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/test/dialog.spec.js b/test/dialog.spec.js index 36393474d2300..126ebec14589d 100644 --- a/test/dialog.spec.js +++ b/test/dialog.spec.js @@ -25,16 +25,22 @@ const { describe('Page.Events.Dialog', function () { setupTestBrowserHooks(); setupTestPageAndContextHooks(); + it('should fire', async () => { const { page } = getTestState(); - page.on('dialog', (dialog) => { - expect(dialog.type()).toBe('alert'); - expect(dialog.defaultValue()).toBe(''); - expect(dialog.message()).toBe('yo'); + const onDialog = sinon.stub().callsFake((dialog) => { dialog.accept(); }); + page.on('dialog', onDialog); + await page.evaluate(() => alert('yo')); + + expect(onDialog.callCount).toEqual(1); + const dialog = onDialog.firstCall.args[0]; + expect(dialog.type()).toBe('alert'); + expect(dialog.defaultValue()).toBe(''); + expect(dialog.message()).toBe('yo'); }); itFailsFirefox('should allow accepting prompts', async () => { diff --git a/test/navigation.spec.js b/test/navigation.spec.js index 694f34a20a66d..0feb39e76fb91 100644 --- a/test/navigation.spec.js +++ b/test/navigation.spec.js @@ -163,15 +163,21 @@ describe('navigation', function () { // Make sure that network events do not emit 'undefined'. // @see https://crbug.com/750469 - page.on('request', (request) => expect(request).toBeTruthy()); - page.on('requestfinished', (request) => expect(request).toBeTruthy()); - page.on('requestfailed', (request) => expect(request).toBeTruthy()); + const requests = []; + page.on('request', (request) => requests.push('request')); + page.on('requestfinished', (request) => requests.push('requestfinished')); + page.on('requestfailed', (request) => requests.push('requestfailed')); + let error = null; await page .goto(httpsServer.EMPTY_PAGE) .catch((error_) => (error = error_)); if (isChrome) expect(error.message).toContain(EXPECTED_SSL_CERT_MESSAGE); else expect(error.message).toContain('SSL_ERROR_UNKNOWN'); + + expect(requests.length).toBe(2); + expect(requests[0]).toBe('request'); + expect(requests[1]).toBe('requestfailed'); }); itFailsFirefox( 'should fail when navigating to bad SSL after redirects', From e0857d7c816080b0e35512f455ab266b8a8e9d95 Mon Sep 17 00:00:00 2001 From: Henrik Skupin Date: Mon, 25 May 2020 10:08:13 +0200 Subject: [PATCH 2/2] Update protocol definition. --- src/protocol.d.ts | 29941 ++++++++++++++++++++++---------------------- 1 file changed, 14971 insertions(+), 14970 deletions(-) diff --git a/src/protocol.d.ts b/src/protocol.d.ts index 19070743375f4..e14a1d62992ba 100644 --- a/src/protocol.d.ts +++ b/src/protocol.d.ts @@ -1,9276 +1,9276 @@ // This is generated from /utils/protocol-types-generator/index.js -type binary = string; + type binary = string; declare module Protocol { - export module Accessibility { - /** - * Unique accessibility node identifier. - */ - export type AXNodeId = string; - /** - * Enum of possible property types. - */ - export type AXValueType = "boolean"|"tristate"|"booleanOrUndefined"|"idref"|"idrefList"|"integer"|"node"|"nodeList"|"number"|"string"|"computedString"|"token"|"tokenList"|"domRelation"|"role"|"internalRole"|"valueUndefined"; - /** - * Enum of possible property sources. - */ - export type AXValueSourceType = "attribute"|"implicit"|"style"|"contents"|"placeholder"|"relatedElement"; - /** - * Enum of possible native property sources (as a subtype of a particular AXValueSourceType). - */ - export type AXValueNativeSourceType = "figcaption"|"label"|"labelfor"|"labelwrapped"|"legend"|"tablecaption"|"title"|"other"; - /** - * A single source for a computed AX property. - */ - export interface AXValueSource { - /** - * What type of source this is. - */ - type: AXValueSourceType; - /** - * The value of this property source. - */ - value?: AXValue; - /** - * The name of the relevant attribute, if any. - */ - attribute?: string; - /** - * The value of the relevant attribute, if any. - */ - attributeValue?: AXValue; - /** - * Whether this source is superseded by a higher priority source. - */ - superseded?: boolean; - /** - * The native markup source for this value, e.g. a