diff --git a/README.md b/README.md index d8f6a9d29f..e059791a22 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 🎭 Playwright -[![npm version](https://img.shields.io/npm/v/playwright.svg?style=flat)](https://www.npmjs.com/package/playwright) [![Join Slack](https://img.shields.io/badge/join-slack-infomational)](https://aka.ms/playwright-slack) [![Chromium version](https://img.shields.io/badge/chromium-91.0.4469.0-blue.svg?logo=google-chrome)](https://www.chromium.org/Home) [![Firefox version](https://img.shields.io/badge/firefox-89.0b6-blue.svg?logo=mozilla-firefox)](https://www.mozilla.org/en-US/firefox/new/) [![WebKit version](https://img.shields.io/badge/webkit-14.2-blue.svg?logo=safari)](https://webkit.org/) +[![npm version](https://img.shields.io/npm/v/playwright.svg?style=flat)](https://www.npmjs.com/package/playwright) [![Join Slack](https://img.shields.io/badge/join-slack-infomational)](https://aka.ms/playwright-slack) [![Chromium version](https://img.shields.io/badge/chromium-92.0.4498.0-blue.svg?logo=google-chrome)](https://www.chromium.org/Home) [![Firefox version](https://img.shields.io/badge/firefox-89.0b6-blue.svg?logo=mozilla-firefox)](https://www.mozilla.org/en-US/firefox/new/) [![WebKit version](https://img.shields.io/badge/webkit-14.2-blue.svg?logo=safari)](https://webkit.org/) ## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright/) @@ -8,7 +8,7 @@ Playwright is a Node.js library to automate [Chromium](https://www.chromium.org/ | | Linux | macOS | Windows | | :--- | :---: | :---: | :---: | -| Chromium 91.0.4469.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Chromium 92.0.4498.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | | WebKit 14.2 | :white_check_mark: | :white_check_mark: | :white_check_mark: | | Firefox 89.0b6 | :white_check_mark: | :white_check_mark: | :white_check_mark: | diff --git a/browsers.json b/browsers.json index 339397aa8c..ef45630df5 100644 --- a/browsers.json +++ b/browsers.json @@ -3,7 +3,7 @@ "browsers": [ { "name": "chromium", - "revision": "869727", + "revision": "878941", "installByDefault": true }, { diff --git a/src/server/chromium/protocol.ts b/src/server/chromium/protocol.ts index ffdf8d77fc..ebff262c3e 100644 --- a/src/server/chromium/protocol.ts +++ b/src/server/chromium/protocol.ts @@ -811,7 +811,7 @@ some CSP errors in the future. export type SharedArrayBufferIssueType = "TransferIssue"|"CreationIssue"; /** * Details for a issue arising from an SAB being instantiated in, or -transfered to a context that is not cross-origin isolated. +transferred to a context that is not cross-origin isolated. */ export interface SharedArrayBufferIssueDetails { sourceCodeLocation: SourceCodeLocation; @@ -858,12 +858,24 @@ CORS RFC1918 enforcement. resourceIPAddressSpace?: Network.IPAddressSpace; clientSecurityState?: Network.ClientSecurityState; } + export type AttributionReportingIssueType = "PermissionPolicyDisabled"|"InvalidAttributionSourceEventId"|"InvalidAttributionData"|"AttributionSourceUntrustworthyOrigin"|"AttributionUntrustworthyOrigin"; + /** + * Details for issues around "Attribution Reporting API" usage. +Explainer: https://github.com/WICG/conversion-measurement-api + */ + export interface AttributionReportingIssueDetails { + violationType: AttributionReportingIssueType; + frame?: AffectedFrame; + request?: AffectedRequest; + violatingNodeId?: DOM.BackendNodeId; + invalidParameter?: string; + } /** * A unique identifier for the type of issue. Each type may use one of the optional fields in InspectorIssueDetails to convey more specific information about the kind of issue. */ - export type InspectorIssueCode = "SameSiteCookieIssue"|"MixedContentIssue"|"BlockedByResponseIssue"|"HeavyAdIssue"|"ContentSecurityPolicyIssue"|"SharedArrayBufferIssue"|"TrustedWebActivityIssue"|"LowTextContrastIssue"|"CorsIssue"; + export type InspectorIssueCode = "SameSiteCookieIssue"|"MixedContentIssue"|"BlockedByResponseIssue"|"HeavyAdIssue"|"ContentSecurityPolicyIssue"|"SharedArrayBufferIssue"|"TrustedWebActivityIssue"|"LowTextContrastIssue"|"CorsIssue"|"AttributionReportingIssue"; /** * This struct holds a list of optional fields with additional information specific to the kind of issue. When adding a new issue code, please also @@ -879,6 +891,7 @@ add a new optional field to this type. twaQualityEnforcementDetails?: TrustedWebActivityIssueDetails; lowTextContrastIssueDetails?: LowTextContrastIssueDetails; corsIssueDetails?: CorsIssueDetails; + attributionReportingIssueDetails?: AttributionReportingIssueDetails; } /** * An inspector issue reported from the back-end. @@ -1163,6 +1176,48 @@ Note that userVisibleOnly = true is the only currently supported type. buckets: Bucket[]; } + /** + * Fired when page is about to start a download. + */ + export type downloadWillBeginPayload = { + /** + * Id of the frame that caused the download to begin. + */ + frameId: Page.FrameId; + /** + * Global unique identifier of the download. + */ + guid: string; + /** + * URL of the resource being downloaded. + */ + url: string; + /** + * Suggested file name of the resource (the actual name of the file saved on disk may differ). + */ + suggestedFilename: string; + } + /** + * Fired when download makes progress. Last call has |done| == true. + */ + export type downloadProgressPayload = { + /** + * Global unique identifier of the download. + */ + guid: string; + /** + * Total expected bytes to download. + */ + totalBytes: number; + /** + * Total bytes received. + */ + receivedBytes: number; + /** + * Download status. + */ + state: "inProgress"|"completed"|"canceled"; + } /** * Set permission settings for given origin. @@ -1229,10 +1284,14 @@ their dowmload guids. */ browserContextId?: BrowserContextID; /** - * The default path to save downloaded files to. This is requred if behavior is set to 'allow' + * The default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'. */ downloadPath?: string; + /** + * Whether to emit download events (defaults to false). + */ + eventsEnabled?: boolean; } export type setDownloadBehaviorReturnValue = { } @@ -2737,7 +2796,9 @@ fire DOM events for nodes known to the client. */ pseudoElements?: Node[]; /** - * Import document for the HTMLImport links. + * Deprecated, as the HTML Imports API has been removed (crbug.com/937746). +This property used to return the imported document for the HTMLImport links. +The property is always undefined now. */ importedDocument?: Node; /** @@ -2943,11 +3004,11 @@ fire DOM events for nodes known to the client. nodeId: NodeId; } /** - * Called when distrubution is changed. + * Called when distribution is changed. */ export type distributedNodesUpdatedPayload = { /** - * Insertion point where distrubuted nodes were updated. + * Insertion point where distributed nodes were updated. */ insertionPointId: NodeId; /** @@ -4442,6 +4503,14 @@ captureSnapshot was true. * The client rect of nodes. Only available when includeDOMRects is set to true */ clientRects?: Rectangle[]; + /** + * The list of background colors that are blended with colors of overlapping elements. + */ + blendedBackgroundColors?: StringIndex[]; + /** + * The list of computed text opacities. + */ + textColorOpacities?: number[]; } /** * Table of details of the post layout rendered text positions. The exact layout should not be regarded as @@ -4540,6 +4609,18 @@ flattened. * Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot */ includeDOMRects?: boolean; + /** + * Whether to include blended background colors in the snapshot (default: false). +Blended background color is achieved by blending background colors of all elements +that overlap with the current element. + */ + includeBlendedBackgroundColors?: boolean; + /** + * Whether to include text color opacity in the snapshot (default: false). +An element might have the opacity property set that affects the text color of the element. +The final text color opacity is computed based on the opacity of all overlapping elements. + */ + includeTextColorOpacities?: boolean; } export type captureSnapshotReturnValue = { /** @@ -4808,7 +4889,7 @@ Missing optional values will be filled in by the target with what it would norma /** * Enum of image types that can be disabled. */ - export type DisabledImageType = "avif"|"webp"; + export type DisabledImageType = "avif"|"jxl"|"webp"; /** * Notification sent after the virtual time budget for the current VirtualTimePolicy has run out. @@ -4827,14 +4908,14 @@ Missing optional values will be filled in by the target with what it would norma result: boolean; } /** - * Clears the overriden device metrics. + * Clears the overridden device metrics. */ export type clearDeviceMetricsOverrideParameters = { } export type clearDeviceMetricsOverrideReturnValue = { } /** - * Clears the overriden Geolocation Position and Error. + * Clears the overridden Geolocation Position and Error. */ export type clearGeolocationOverrideParameters = { } @@ -5112,7 +5193,7 @@ Note any previous deferred policy change is superseded. */ waitForNavigation?: boolean; /** - * If set, base::Time::Now will be overriden to initially return this value. + * If set, base::Time::Now will be overridden to initially return this value. */ initialVirtualTime?: Network.TimeSinceEpoch; } @@ -5288,7 +5369,7 @@ display. Reported for diagnostic uses, may be removed in the future. */ export module IO { /** - * This is either obtained from another method or specifed as `blob:<uuid>` where + * This is either obtained from another method or specified as `blob:<uuid>` where `<uuid>` is an UUID of a Blob. */ export type StreamHandle = string; @@ -5333,7 +5414,7 @@ following the last read). Some types of streams may only support sequential read */ data: string; /** - * Set if the end-of-file condition occured while reading. + * Set if the end-of-file condition occurred while reading. */ eof: boolean; } @@ -5749,6 +5830,13 @@ text, HTML markup or any other data. dragOperationsMask: number; } + /** + * Emitted only when `Input.setInterceptDrags` is enabled. Use this data with `Input.dispatchDragEvent` to +restore normal drag and drop behavior. + */ + export type dragInterceptedPayload = { + data: DragData; + } /** * Dispatches a drag event into the page. @@ -6018,6 +6106,15 @@ one by one. } export type setIgnoreInputEventsReturnValue = { } + /** + * Prevents default drag and drop behavior and instead emits `Input.dragIntercepted` events. +Drag and drop behavior can be directly controlled via `Input.dispatchDragEvent`. + */ + export type setInterceptDragsParameters = { + enabled: boolean; + } + export type setInterceptDragsReturnValue = { + } /** * Synthesizes a pinch gesture over a time period by issuing appropriate touch events. */ @@ -7477,8 +7574,8 @@ sent. Response will intercept after the response is received. */ export interface RequestPattern { /** - * Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is -backslash. Omitting is equivalent to "*". + * Wildcards (`'*'` -> zero or more, `'?'` -> exactly one) are allowed. Escape character is +backslash. Omitting is equivalent to `"*"`. */ urlPattern?: string; /** @@ -7486,7 +7583,7 @@ backslash. Omitting is equivalent to "*". */ resourceType?: ResourceType; /** - * Stage at wich to begin intercepting requests. Default is Request. + * Stage at which to begin intercepting requests. Default is Request. */ interceptionStage?: InterceptionStage; } @@ -9490,7 +9587,7 @@ Backend then generates 'inspectNodeRequested' event upon element selection. * All Permissions Policy features. This enum should match the one defined in renderer/core/feature_policy/feature_policy_features.json5. */ - export type PermissionsPolicyFeature = "accelerometer"|"ambient-light-sensor"|"autoplay"|"camera"|"ch-dpr"|"ch-device-memory"|"ch-downlink"|"ch-ect"|"ch-lang"|"ch-rtt"|"ch-ua"|"ch-ua-arch"|"ch-ua-platform"|"ch-ua-model"|"ch-ua-mobile"|"ch-ua-full-version"|"ch-ua-platform-version"|"ch-viewport-width"|"ch-width"|"clipboard-read"|"clipboard-write"|"conversion-measurement"|"cross-origin-isolated"|"display-capture"|"document-domain"|"encrypted-media"|"execution-while-out-of-viewport"|"execution-while-not-rendered"|"focus-without-user-activation"|"fullscreen"|"frobulate"|"gamepad"|"geolocation"|"gyroscope"|"hid"|"idle-detection"|"interest-cohort"|"magnetometer"|"microphone"|"midi"|"otp-credentials"|"payment"|"picture-in-picture"|"publickey-credentials-get"|"screen-wake-lock"|"serial"|"storage-access-api"|"sync-xhr"|"trust-token-redemption"|"usb"|"vertical-scroll"|"web-share"|"xr-spatial-tracking"; + export type PermissionsPolicyFeature = "accelerometer"|"ambient-light-sensor"|"autoplay"|"camera"|"ch-dpr"|"ch-device-memory"|"ch-downlink"|"ch-ect"|"ch-lang"|"ch-rtt"|"ch-ua"|"ch-ua-arch"|"ch-ua-platform"|"ch-ua-model"|"ch-ua-mobile"|"ch-ua-full-version"|"ch-ua-platform-version"|"ch-viewport-width"|"ch-width"|"clipboard-read"|"clipboard-write"|"conversion-measurement"|"cross-origin-isolated"|"display-capture"|"document-domain"|"encrypted-media"|"execution-while-out-of-viewport"|"execution-while-not-rendered"|"focus-without-user-activation"|"fullscreen"|"frobulate"|"gamepad"|"geolocation"|"gyroscope"|"hid"|"idle-detection"|"interest-cohort"|"magnetometer"|"microphone"|"midi"|"otp-credentials"|"payment"|"picture-in-picture"|"publickey-credentials-get"|"screen-wake-lock"|"serial"|"shared-autofill"|"storage-access-api"|"sync-xhr"|"trust-token-redemption"|"usb"|"vertical-scroll"|"web-share"|"xr-spatial-tracking"; /** * Reason for a permissions policy feature to be disabled. */ @@ -9903,6 +10000,10 @@ Example URLs: http://www.google.com/file.html -> "google.com" */ eager?: boolean; } + /** + * The type of a frameNavigated event. + */ + export type NavigationType = "Navigation"|"BackForwardCacheRestore"; export type domContentEventFiredPayload = { timestamp: Network.MonotonicTime; @@ -9968,6 +10069,7 @@ Example URLs: http://www.google.com/file.html -> "google.com" * Frame object. */ frame: Frame; + type: NavigationType; } /** * Fired when opening document to write to. @@ -10043,6 +10145,7 @@ guaranteed to start. } /** * Fired when page is about to start a download. +Deprecated. Use Browser.downloadWillBegin instead. */ export type downloadWillBeginPayload = { /** @@ -10064,6 +10167,7 @@ guaranteed to start. } /** * Fired when download makes progress. Last call has |done| == true. +Deprecated. Use Browser.downloadProgress instead. */ export type downloadProgressPayload = { /** @@ -10148,6 +10252,22 @@ the page execution. Execution can be resumed via calling Page.handleJavaScriptDi name: string; timestamp: Network.MonotonicTime; } + /** + * Fired for failed bfcache history navigations if BackForwardCache feature is enabled. Do +not assume any ordering with the Page.frameNavigated event. This event is fired only for +main-frame history navigation where the document changes (non-same-document navigations), +when bfcache navigation fails. + */ + export type backForwardCacheNotUsedPayload = { + /** + * The loader id for the associated navgation. + */ + loaderId: Network.LoaderId; + /** + * The frame id of the associated frame. + */ + frameId: FrameId; + } export type loadEventFiredPayload = { timestamp: Network.MonotonicTime; } @@ -10247,6 +10367,11 @@ This world name will be used as the ExecutionContextDescription::name when the c event is emitted. */ worldName?: string; + /** + * Specifies whether command line API should be available to the script, defaults +to false. + */ + includeCommandLineAPI?: boolean; } export type addScriptToEvaluateOnNewDocumentReturnValue = { /** @@ -10309,7 +10434,7 @@ iframes, shadow DOM, external resources, and element-inline styles. data: string; } /** - * Clears the overriden device metrics. + * Clears the overridden device metrics. */ export type clearDeviceMetricsOverrideParameters = { } @@ -10323,7 +10448,7 @@ iframes, shadow DOM, external resources, and element-inline styles. export type clearDeviceOrientationOverrideReturnValue = { } /** - * Clears the overriden Geolocation Position and Error. + * Clears the overridden Geolocation Position and Error. */ export type clearGeolocationOverrideParameters = { } @@ -10904,7 +11029,7 @@ available (otherwise deny). */ behavior: "deny"|"allow"|"default"; /** - * The default path to save downloaded files to. This is requred if behavior is set to 'allow' + * The default path to save downloaded files to. This is required if behavior is set to 'allow' */ downloadPath?: string; } @@ -11872,7 +11997,7 @@ Tokens from that issuer. origin: string; /** * The quota size (in bytes) to override the original quota with. -If this is called multiple times, the overriden quota will be equal to +If this is called multiple times, the overridden quota will be equal to the quotaSize provided in the final call. If this is called without specifying a quotaSize, the quota will be reset to the default value for the specified origin. If this is called multiple times with different @@ -12801,8 +12926,8 @@ body is received. export type RequestStage = "Request"|"Response"; export interface RequestPattern { /** - * Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is -backslash. Omitting is equivalent to "*". + * Wildcards (`'*'` -> zero or more, `'?'` -> exactly one) are allowed. Escape character is +backslash. Omitting is equivalent to `"*"`. */ urlPattern?: string; /** @@ -12810,7 +12935,7 @@ backslash. Omitting is equivalent to "*". */ resourceType?: Network.ResourceType; /** - * Stage at wich to begin intercepting requests. Default is Request. + * Stage at which to begin intercepting requests. Default is Request. */ requestStage?: RequestStage; } @@ -13144,7 +13269,7 @@ https://webaudio.github.io/web-audio-api/ */ currentTime: number; /** - * The time spent on rendering graph divided by render qunatum duration, + * The time spent on rendering graph divided by render quantum duration, and multiplied by 100. 100 means the audio renderer reached the full capacity and glitch may occur. */ @@ -13365,6 +13490,12 @@ https://w3c.github.io/webauthn#largeBlob Defaults to false. */ hasLargeBlob?: boolean; + /** + * If set to true, the authenticator will support the credBlob extension. +https://fidoalliance.org/specs/fido-v2.1-rd-20201208/fido-client-to-authenticator-protocol-v2.1-rd-20201208.html#sctn-credBlob-extension +Defaults to false. + */ + hasCredBlob?: boolean; /** * If set to true, tests of user presence will succeed immediately. Otherwise, they will not be resolved. Defaults to true. @@ -13595,8 +13726,8 @@ congestion. If batched, events must ALWAYS be in chronological order. errors: PlayerError[]; } /** - * Called whenever a player is created, or when a new agent joins and recieves -a list of active players. If an agent is restored, it will recieve the full + * Called whenever a player is created, or when a new agent joins and receives +a list of active players. If an agent is restored, it will receive the full list of player ids and all events again. */ export type playersCreatedPayload = { @@ -14750,6 +14881,10 @@ when the tracking is stopped. */ reportProgress?: boolean; treatGlobalObjectsAsRoots?: boolean; + /** + * If true, numerical values are included in the snapshot + */ + captureNumericValue?: boolean; } export type stopTrackingHeapObjectsReturnValue = { } @@ -14762,6 +14897,10 @@ when the tracking is stopped. * If true, a raw snapshot without artifical roots will be generated */ treatGlobalObjectsAsRoots?: boolean; + /** + * If true, numerical values are included in the snapshot + */ + captureNumericValue?: boolean; } export type takeHeapSnapshotReturnValue = { } @@ -16110,6 +16249,9 @@ Each binding function call produces Runtime.bindingCalled notification. execution context. If omitted and `executionContextName` is not set, the binding is exposed to all execution contexts of the target. This parameter is mutually exclusive with `executionContextName`. +Deprecated in favor of `executionContextName` due to an unclear use case +and bugs in implementation (crbug.com/1169639). `executionContextId` will be +removed in the future. */ executionContextId?: ExecutionContextId; /** @@ -16175,6 +16317,8 @@ unsubscribes current runtime agent from Runtime.bindingCalled notifications. "Audits.issueAdded": Audits.issueAddedPayload; "BackgroundService.recordingStateChanged": BackgroundService.recordingStateChangedPayload; "BackgroundService.backgroundServiceEventReceived": BackgroundService.backgroundServiceEventReceivedPayload; + "Browser.downloadWillBegin": Browser.downloadWillBeginPayload; + "Browser.downloadProgress": Browser.downloadProgressPayload; "CSS.fontsUpdated": CSS.fontsUpdatedPayload; "CSS.mediaQueryResultChanged": CSS.mediaQueryResultChangedPayload; "CSS.styleSheetAdded": CSS.styleSheetAddedPayload; @@ -16203,6 +16347,7 @@ unsubscribes current runtime agent from Runtime.bindingCalled notifications. "Database.addDatabase": Database.addDatabasePayload; "Emulation.virtualTimeBudgetExpired": Emulation.virtualTimeBudgetExpiredPayload; "HeadlessExperimental.needsBeginFramesChanged": HeadlessExperimental.needsBeginFramesChangedPayload; + "Input.dragIntercepted": Input.dragInterceptedPayload; "Inspector.detached": Inspector.detachedPayload; "Inspector.targetCrashed": Inspector.targetCrashedPayload; "Inspector.targetReloadedAfterCrash": Inspector.targetReloadedAfterCrashPayload; @@ -16255,6 +16400,7 @@ unsubscribes current runtime agent from Runtime.bindingCalled notifications. "Page.javascriptDialogClosed": Page.javascriptDialogClosedPayload; "Page.javascriptDialogOpening": Page.javascriptDialogOpeningPayload; "Page.lifecycleEvent": Page.lifecycleEventPayload; + "Page.backForwardCacheNotUsed": Page.backForwardCacheNotUsedPayload; "Page.loadEventFired": Page.loadEventFiredPayload; "Page.navigatedWithinDocument": Page.navigatedWithinDocumentPayload; "Page.screencastFrame": Page.screencastFramePayload; @@ -16528,6 +16674,7 @@ unsubscribes current runtime agent from Runtime.bindingCalled notifications. "Input.dispatchTouchEvent": Input.dispatchTouchEventParameters; "Input.emulateTouchFromMouseEvent": Input.emulateTouchFromMouseEventParameters; "Input.setIgnoreInputEvents": Input.setIgnoreInputEventsParameters; + "Input.setInterceptDrags": Input.setInterceptDragsParameters; "Input.synthesizePinchGesture": Input.synthesizePinchGestureParameters; "Input.synthesizeScrollGesture": Input.synthesizeScrollGestureParameters; "Input.synthesizeTapGesture": Input.synthesizeTapGestureParameters; @@ -17044,6 +17191,7 @@ unsubscribes current runtime agent from Runtime.bindingCalled notifications. "Input.dispatchTouchEvent": Input.dispatchTouchEventReturnValue; "Input.emulateTouchFromMouseEvent": Input.emulateTouchFromMouseEventReturnValue; "Input.setIgnoreInputEvents": Input.setIgnoreInputEventsReturnValue; + "Input.setInterceptDrags": Input.setInterceptDragsReturnValue; "Input.synthesizePinchGesture": Input.synthesizePinchGestureReturnValue; "Input.synthesizeScrollGesture": Input.synthesizeScrollGestureReturnValue; "Input.synthesizeTapGesture": Input.synthesizeTapGestureReturnValue; diff --git a/tests/page-in-context.spec.ts b/tests/page-in-context.spec.ts index 3491944dea..f114093e9e 100644 --- a/tests/page-in-context.spec.ts +++ b/tests/page-in-context.spec.ts @@ -16,7 +16,7 @@ */ import { browserTest as it, expect } from './config/browserTest'; -import { attachFrame } from './config/utils'; +import { attachFrame, chromiumVersionLessThan } from './config/utils'; it('should not be visible in context.pages', async ({contextFactory}) => { const context = await contextFactory(); @@ -79,7 +79,7 @@ it('should click the button with deviceScaleFactor set', async ({browser, server await context.close(); }); -it('should click the button with offset with page scale', async ({browser, server, isWebKit, isChromium, headful, browserName}) => { +it('should click the button with offset with page scale', async ({browser, server, isWebKit, isChromium, headful, browserName, browserVersion}) => { it.skip(browserName === 'firefox'); const context = await browser.newContext({ viewport: { width: 400, height: 400 }, isMobile: true }); @@ -99,6 +99,9 @@ it('should click the button with offset with page scale', async ({browser, serve } else if (isChromium && !headful) { // Headless Chromium rounds down during css -> dip -> css conversion. expected = { x: 27, y: 18 }; + } else if (isChromium && headful && !chromiumVersionLessThan(browserVersion, '92.0.4498.0')) { + // New headed Chromium rounds down during css -> dip -> css conversion as well. + expected = { x: 27, y: 18 }; } expect(round(await page.evaluate('pageX'))).toBe(expected.x); expect(round(await page.evaluate('pageY'))).toBe(expected.y); diff --git a/types/protocol.d.ts b/types/protocol.d.ts index ffdf8d77fc..ebff262c3e 100644 --- a/types/protocol.d.ts +++ b/types/protocol.d.ts @@ -811,7 +811,7 @@ some CSP errors in the future. export type SharedArrayBufferIssueType = "TransferIssue"|"CreationIssue"; /** * Details for a issue arising from an SAB being instantiated in, or -transfered to a context that is not cross-origin isolated. +transferred to a context that is not cross-origin isolated. */ export interface SharedArrayBufferIssueDetails { sourceCodeLocation: SourceCodeLocation; @@ -858,12 +858,24 @@ CORS RFC1918 enforcement. resourceIPAddressSpace?: Network.IPAddressSpace; clientSecurityState?: Network.ClientSecurityState; } + export type AttributionReportingIssueType = "PermissionPolicyDisabled"|"InvalidAttributionSourceEventId"|"InvalidAttributionData"|"AttributionSourceUntrustworthyOrigin"|"AttributionUntrustworthyOrigin"; + /** + * Details for issues around "Attribution Reporting API" usage. +Explainer: https://github.com/WICG/conversion-measurement-api + */ + export interface AttributionReportingIssueDetails { + violationType: AttributionReportingIssueType; + frame?: AffectedFrame; + request?: AffectedRequest; + violatingNodeId?: DOM.BackendNodeId; + invalidParameter?: string; + } /** * A unique identifier for the type of issue. Each type may use one of the optional fields in InspectorIssueDetails to convey more specific information about the kind of issue. */ - export type InspectorIssueCode = "SameSiteCookieIssue"|"MixedContentIssue"|"BlockedByResponseIssue"|"HeavyAdIssue"|"ContentSecurityPolicyIssue"|"SharedArrayBufferIssue"|"TrustedWebActivityIssue"|"LowTextContrastIssue"|"CorsIssue"; + export type InspectorIssueCode = "SameSiteCookieIssue"|"MixedContentIssue"|"BlockedByResponseIssue"|"HeavyAdIssue"|"ContentSecurityPolicyIssue"|"SharedArrayBufferIssue"|"TrustedWebActivityIssue"|"LowTextContrastIssue"|"CorsIssue"|"AttributionReportingIssue"; /** * This struct holds a list of optional fields with additional information specific to the kind of issue. When adding a new issue code, please also @@ -879,6 +891,7 @@ add a new optional field to this type. twaQualityEnforcementDetails?: TrustedWebActivityIssueDetails; lowTextContrastIssueDetails?: LowTextContrastIssueDetails; corsIssueDetails?: CorsIssueDetails; + attributionReportingIssueDetails?: AttributionReportingIssueDetails; } /** * An inspector issue reported from the back-end. @@ -1163,6 +1176,48 @@ Note that userVisibleOnly = true is the only currently supported type. buckets: Bucket[]; } + /** + * Fired when page is about to start a download. + */ + export type downloadWillBeginPayload = { + /** + * Id of the frame that caused the download to begin. + */ + frameId: Page.FrameId; + /** + * Global unique identifier of the download. + */ + guid: string; + /** + * URL of the resource being downloaded. + */ + url: string; + /** + * Suggested file name of the resource (the actual name of the file saved on disk may differ). + */ + suggestedFilename: string; + } + /** + * Fired when download makes progress. Last call has |done| == true. + */ + export type downloadProgressPayload = { + /** + * Global unique identifier of the download. + */ + guid: string; + /** + * Total expected bytes to download. + */ + totalBytes: number; + /** + * Total bytes received. + */ + receivedBytes: number; + /** + * Download status. + */ + state: "inProgress"|"completed"|"canceled"; + } /** * Set permission settings for given origin. @@ -1229,10 +1284,14 @@ their dowmload guids. */ browserContextId?: BrowserContextID; /** - * The default path to save downloaded files to. This is requred if behavior is set to 'allow' + * The default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'. */ downloadPath?: string; + /** + * Whether to emit download events (defaults to false). + */ + eventsEnabled?: boolean; } export type setDownloadBehaviorReturnValue = { } @@ -2737,7 +2796,9 @@ fire DOM events for nodes known to the client. */ pseudoElements?: Node[]; /** - * Import document for the HTMLImport links. + * Deprecated, as the HTML Imports API has been removed (crbug.com/937746). +This property used to return the imported document for the HTMLImport links. +The property is always undefined now. */ importedDocument?: Node; /** @@ -2943,11 +3004,11 @@ fire DOM events for nodes known to the client. nodeId: NodeId; } /** - * Called when distrubution is changed. + * Called when distribution is changed. */ export type distributedNodesUpdatedPayload = { /** - * Insertion point where distrubuted nodes were updated. + * Insertion point where distributed nodes were updated. */ insertionPointId: NodeId; /** @@ -4442,6 +4503,14 @@ captureSnapshot was true. * The client rect of nodes. Only available when includeDOMRects is set to true */ clientRects?: Rectangle[]; + /** + * The list of background colors that are blended with colors of overlapping elements. + */ + blendedBackgroundColors?: StringIndex[]; + /** + * The list of computed text opacities. + */ + textColorOpacities?: number[]; } /** * Table of details of the post layout rendered text positions. The exact layout should not be regarded as @@ -4540,6 +4609,18 @@ flattened. * Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot */ includeDOMRects?: boolean; + /** + * Whether to include blended background colors in the snapshot (default: false). +Blended background color is achieved by blending background colors of all elements +that overlap with the current element. + */ + includeBlendedBackgroundColors?: boolean; + /** + * Whether to include text color opacity in the snapshot (default: false). +An element might have the opacity property set that affects the text color of the element. +The final text color opacity is computed based on the opacity of all overlapping elements. + */ + includeTextColorOpacities?: boolean; } export type captureSnapshotReturnValue = { /** @@ -4808,7 +4889,7 @@ Missing optional values will be filled in by the target with what it would norma /** * Enum of image types that can be disabled. */ - export type DisabledImageType = "avif"|"webp"; + export type DisabledImageType = "avif"|"jxl"|"webp"; /** * Notification sent after the virtual time budget for the current VirtualTimePolicy has run out. @@ -4827,14 +4908,14 @@ Missing optional values will be filled in by the target with what it would norma result: boolean; } /** - * Clears the overriden device metrics. + * Clears the overridden device metrics. */ export type clearDeviceMetricsOverrideParameters = { } export type clearDeviceMetricsOverrideReturnValue = { } /** - * Clears the overriden Geolocation Position and Error. + * Clears the overridden Geolocation Position and Error. */ export type clearGeolocationOverrideParameters = { } @@ -5112,7 +5193,7 @@ Note any previous deferred policy change is superseded. */ waitForNavigation?: boolean; /** - * If set, base::Time::Now will be overriden to initially return this value. + * If set, base::Time::Now will be overridden to initially return this value. */ initialVirtualTime?: Network.TimeSinceEpoch; } @@ -5288,7 +5369,7 @@ display. Reported for diagnostic uses, may be removed in the future. */ export module IO { /** - * This is either obtained from another method or specifed as `blob:<uuid>` where + * This is either obtained from another method or specified as `blob:<uuid>` where `<uuid>` is an UUID of a Blob. */ export type StreamHandle = string; @@ -5333,7 +5414,7 @@ following the last read). Some types of streams may only support sequential read */ data: string; /** - * Set if the end-of-file condition occured while reading. + * Set if the end-of-file condition occurred while reading. */ eof: boolean; } @@ -5749,6 +5830,13 @@ text, HTML markup or any other data. dragOperationsMask: number; } + /** + * Emitted only when `Input.setInterceptDrags` is enabled. Use this data with `Input.dispatchDragEvent` to +restore normal drag and drop behavior. + */ + export type dragInterceptedPayload = { + data: DragData; + } /** * Dispatches a drag event into the page. @@ -6018,6 +6106,15 @@ one by one. } export type setIgnoreInputEventsReturnValue = { } + /** + * Prevents default drag and drop behavior and instead emits `Input.dragIntercepted` events. +Drag and drop behavior can be directly controlled via `Input.dispatchDragEvent`. + */ + export type setInterceptDragsParameters = { + enabled: boolean; + } + export type setInterceptDragsReturnValue = { + } /** * Synthesizes a pinch gesture over a time period by issuing appropriate touch events. */ @@ -7477,8 +7574,8 @@ sent. Response will intercept after the response is received. */ export interface RequestPattern { /** - * Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is -backslash. Omitting is equivalent to "*". + * Wildcards (`'*'` -> zero or more, `'?'` -> exactly one) are allowed. Escape character is +backslash. Omitting is equivalent to `"*"`. */ urlPattern?: string; /** @@ -7486,7 +7583,7 @@ backslash. Omitting is equivalent to "*". */ resourceType?: ResourceType; /** - * Stage at wich to begin intercepting requests. Default is Request. + * Stage at which to begin intercepting requests. Default is Request. */ interceptionStage?: InterceptionStage; } @@ -9490,7 +9587,7 @@ Backend then generates 'inspectNodeRequested' event upon element selection. * All Permissions Policy features. This enum should match the one defined in renderer/core/feature_policy/feature_policy_features.json5. */ - export type PermissionsPolicyFeature = "accelerometer"|"ambient-light-sensor"|"autoplay"|"camera"|"ch-dpr"|"ch-device-memory"|"ch-downlink"|"ch-ect"|"ch-lang"|"ch-rtt"|"ch-ua"|"ch-ua-arch"|"ch-ua-platform"|"ch-ua-model"|"ch-ua-mobile"|"ch-ua-full-version"|"ch-ua-platform-version"|"ch-viewport-width"|"ch-width"|"clipboard-read"|"clipboard-write"|"conversion-measurement"|"cross-origin-isolated"|"display-capture"|"document-domain"|"encrypted-media"|"execution-while-out-of-viewport"|"execution-while-not-rendered"|"focus-without-user-activation"|"fullscreen"|"frobulate"|"gamepad"|"geolocation"|"gyroscope"|"hid"|"idle-detection"|"interest-cohort"|"magnetometer"|"microphone"|"midi"|"otp-credentials"|"payment"|"picture-in-picture"|"publickey-credentials-get"|"screen-wake-lock"|"serial"|"storage-access-api"|"sync-xhr"|"trust-token-redemption"|"usb"|"vertical-scroll"|"web-share"|"xr-spatial-tracking"; + export type PermissionsPolicyFeature = "accelerometer"|"ambient-light-sensor"|"autoplay"|"camera"|"ch-dpr"|"ch-device-memory"|"ch-downlink"|"ch-ect"|"ch-lang"|"ch-rtt"|"ch-ua"|"ch-ua-arch"|"ch-ua-platform"|"ch-ua-model"|"ch-ua-mobile"|"ch-ua-full-version"|"ch-ua-platform-version"|"ch-viewport-width"|"ch-width"|"clipboard-read"|"clipboard-write"|"conversion-measurement"|"cross-origin-isolated"|"display-capture"|"document-domain"|"encrypted-media"|"execution-while-out-of-viewport"|"execution-while-not-rendered"|"focus-without-user-activation"|"fullscreen"|"frobulate"|"gamepad"|"geolocation"|"gyroscope"|"hid"|"idle-detection"|"interest-cohort"|"magnetometer"|"microphone"|"midi"|"otp-credentials"|"payment"|"picture-in-picture"|"publickey-credentials-get"|"screen-wake-lock"|"serial"|"shared-autofill"|"storage-access-api"|"sync-xhr"|"trust-token-redemption"|"usb"|"vertical-scroll"|"web-share"|"xr-spatial-tracking"; /** * Reason for a permissions policy feature to be disabled. */ @@ -9903,6 +10000,10 @@ Example URLs: http://www.google.com/file.html -> "google.com" */ eager?: boolean; } + /** + * The type of a frameNavigated event. + */ + export type NavigationType = "Navigation"|"BackForwardCacheRestore"; export type domContentEventFiredPayload = { timestamp: Network.MonotonicTime; @@ -9968,6 +10069,7 @@ Example URLs: http://www.google.com/file.html -> "google.com" * Frame object. */ frame: Frame; + type: NavigationType; } /** * Fired when opening document to write to. @@ -10043,6 +10145,7 @@ guaranteed to start. } /** * Fired when page is about to start a download. +Deprecated. Use Browser.downloadWillBegin instead. */ export type downloadWillBeginPayload = { /** @@ -10064,6 +10167,7 @@ guaranteed to start. } /** * Fired when download makes progress. Last call has |done| == true. +Deprecated. Use Browser.downloadProgress instead. */ export type downloadProgressPayload = { /** @@ -10148,6 +10252,22 @@ the page execution. Execution can be resumed via calling Page.handleJavaScriptDi name: string; timestamp: Network.MonotonicTime; } + /** + * Fired for failed bfcache history navigations if BackForwardCache feature is enabled. Do +not assume any ordering with the Page.frameNavigated event. This event is fired only for +main-frame history navigation where the document changes (non-same-document navigations), +when bfcache navigation fails. + */ + export type backForwardCacheNotUsedPayload = { + /** + * The loader id for the associated navgation. + */ + loaderId: Network.LoaderId; + /** + * The frame id of the associated frame. + */ + frameId: FrameId; + } export type loadEventFiredPayload = { timestamp: Network.MonotonicTime; } @@ -10247,6 +10367,11 @@ This world name will be used as the ExecutionContextDescription::name when the c event is emitted. */ worldName?: string; + /** + * Specifies whether command line API should be available to the script, defaults +to false. + */ + includeCommandLineAPI?: boolean; } export type addScriptToEvaluateOnNewDocumentReturnValue = { /** @@ -10309,7 +10434,7 @@ iframes, shadow DOM, external resources, and element-inline styles. data: string; } /** - * Clears the overriden device metrics. + * Clears the overridden device metrics. */ export type clearDeviceMetricsOverrideParameters = { } @@ -10323,7 +10448,7 @@ iframes, shadow DOM, external resources, and element-inline styles. export type clearDeviceOrientationOverrideReturnValue = { } /** - * Clears the overriden Geolocation Position and Error. + * Clears the overridden Geolocation Position and Error. */ export type clearGeolocationOverrideParameters = { } @@ -10904,7 +11029,7 @@ available (otherwise deny). */ behavior: "deny"|"allow"|"default"; /** - * The default path to save downloaded files to. This is requred if behavior is set to 'allow' + * The default path to save downloaded files to. This is required if behavior is set to 'allow' */ downloadPath?: string; } @@ -11872,7 +11997,7 @@ Tokens from that issuer. origin: string; /** * The quota size (in bytes) to override the original quota with. -If this is called multiple times, the overriden quota will be equal to +If this is called multiple times, the overridden quota will be equal to the quotaSize provided in the final call. If this is called without specifying a quotaSize, the quota will be reset to the default value for the specified origin. If this is called multiple times with different @@ -12801,8 +12926,8 @@ body is received. export type RequestStage = "Request"|"Response"; export interface RequestPattern { /** - * Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is -backslash. Omitting is equivalent to "*". + * Wildcards (`'*'` -> zero or more, `'?'` -> exactly one) are allowed. Escape character is +backslash. Omitting is equivalent to `"*"`. */ urlPattern?: string; /** @@ -12810,7 +12935,7 @@ backslash. Omitting is equivalent to "*". */ resourceType?: Network.ResourceType; /** - * Stage at wich to begin intercepting requests. Default is Request. + * Stage at which to begin intercepting requests. Default is Request. */ requestStage?: RequestStage; } @@ -13144,7 +13269,7 @@ https://webaudio.github.io/web-audio-api/ */ currentTime: number; /** - * The time spent on rendering graph divided by render qunatum duration, + * The time spent on rendering graph divided by render quantum duration, and multiplied by 100. 100 means the audio renderer reached the full capacity and glitch may occur. */ @@ -13365,6 +13490,12 @@ https://w3c.github.io/webauthn#largeBlob Defaults to false. */ hasLargeBlob?: boolean; + /** + * If set to true, the authenticator will support the credBlob extension. +https://fidoalliance.org/specs/fido-v2.1-rd-20201208/fido-client-to-authenticator-protocol-v2.1-rd-20201208.html#sctn-credBlob-extension +Defaults to false. + */ + hasCredBlob?: boolean; /** * If set to true, tests of user presence will succeed immediately. Otherwise, they will not be resolved. Defaults to true. @@ -13595,8 +13726,8 @@ congestion. If batched, events must ALWAYS be in chronological order. errors: PlayerError[]; } /** - * Called whenever a player is created, or when a new agent joins and recieves -a list of active players. If an agent is restored, it will recieve the full + * Called whenever a player is created, or when a new agent joins and receives +a list of active players. If an agent is restored, it will receive the full list of player ids and all events again. */ export type playersCreatedPayload = { @@ -14750,6 +14881,10 @@ when the tracking is stopped. */ reportProgress?: boolean; treatGlobalObjectsAsRoots?: boolean; + /** + * If true, numerical values are included in the snapshot + */ + captureNumericValue?: boolean; } export type stopTrackingHeapObjectsReturnValue = { } @@ -14762,6 +14897,10 @@ when the tracking is stopped. * If true, a raw snapshot without artifical roots will be generated */ treatGlobalObjectsAsRoots?: boolean; + /** + * If true, numerical values are included in the snapshot + */ + captureNumericValue?: boolean; } export type takeHeapSnapshotReturnValue = { } @@ -16110,6 +16249,9 @@ Each binding function call produces Runtime.bindingCalled notification. execution context. If omitted and `executionContextName` is not set, the binding is exposed to all execution contexts of the target. This parameter is mutually exclusive with `executionContextName`. +Deprecated in favor of `executionContextName` due to an unclear use case +and bugs in implementation (crbug.com/1169639). `executionContextId` will be +removed in the future. */ executionContextId?: ExecutionContextId; /** @@ -16175,6 +16317,8 @@ unsubscribes current runtime agent from Runtime.bindingCalled notifications. "Audits.issueAdded": Audits.issueAddedPayload; "BackgroundService.recordingStateChanged": BackgroundService.recordingStateChangedPayload; "BackgroundService.backgroundServiceEventReceived": BackgroundService.backgroundServiceEventReceivedPayload; + "Browser.downloadWillBegin": Browser.downloadWillBeginPayload; + "Browser.downloadProgress": Browser.downloadProgressPayload; "CSS.fontsUpdated": CSS.fontsUpdatedPayload; "CSS.mediaQueryResultChanged": CSS.mediaQueryResultChangedPayload; "CSS.styleSheetAdded": CSS.styleSheetAddedPayload; @@ -16203,6 +16347,7 @@ unsubscribes current runtime agent from Runtime.bindingCalled notifications. "Database.addDatabase": Database.addDatabasePayload; "Emulation.virtualTimeBudgetExpired": Emulation.virtualTimeBudgetExpiredPayload; "HeadlessExperimental.needsBeginFramesChanged": HeadlessExperimental.needsBeginFramesChangedPayload; + "Input.dragIntercepted": Input.dragInterceptedPayload; "Inspector.detached": Inspector.detachedPayload; "Inspector.targetCrashed": Inspector.targetCrashedPayload; "Inspector.targetReloadedAfterCrash": Inspector.targetReloadedAfterCrashPayload; @@ -16255,6 +16400,7 @@ unsubscribes current runtime agent from Runtime.bindingCalled notifications. "Page.javascriptDialogClosed": Page.javascriptDialogClosedPayload; "Page.javascriptDialogOpening": Page.javascriptDialogOpeningPayload; "Page.lifecycleEvent": Page.lifecycleEventPayload; + "Page.backForwardCacheNotUsed": Page.backForwardCacheNotUsedPayload; "Page.loadEventFired": Page.loadEventFiredPayload; "Page.navigatedWithinDocument": Page.navigatedWithinDocumentPayload; "Page.screencastFrame": Page.screencastFramePayload; @@ -16528,6 +16674,7 @@ unsubscribes current runtime agent from Runtime.bindingCalled notifications. "Input.dispatchTouchEvent": Input.dispatchTouchEventParameters; "Input.emulateTouchFromMouseEvent": Input.emulateTouchFromMouseEventParameters; "Input.setIgnoreInputEvents": Input.setIgnoreInputEventsParameters; + "Input.setInterceptDrags": Input.setInterceptDragsParameters; "Input.synthesizePinchGesture": Input.synthesizePinchGestureParameters; "Input.synthesizeScrollGesture": Input.synthesizeScrollGestureParameters; "Input.synthesizeTapGesture": Input.synthesizeTapGestureParameters; @@ -17044,6 +17191,7 @@ unsubscribes current runtime agent from Runtime.bindingCalled notifications. "Input.dispatchTouchEvent": Input.dispatchTouchEventReturnValue; "Input.emulateTouchFromMouseEvent": Input.emulateTouchFromMouseEventReturnValue; "Input.setIgnoreInputEvents": Input.setIgnoreInputEventsReturnValue; + "Input.setInterceptDrags": Input.setInterceptDragsReturnValue; "Input.synthesizePinchGesture": Input.synthesizePinchGestureReturnValue; "Input.synthesizeScrollGesture": Input.synthesizeScrollGestureReturnValue; "Input.synthesizeTapGesture": Input.synthesizeTapGestureReturnValue;