Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(webkit): support utf-8 characters in postData, bump to 1407 (#4744)
Yury Semikhatsky3219057ab03a
diff --git a/browsers.json b/browsers.jsonindex 7049991743..109610b52d 100644--- a/browsers.json+++ b/browsers.json@@ -13,7 +13,7 @@},{"name": "webkit",- "revision": "1402",+ "revision": "1407","download": true}]diff --git a/src/server/webkit/protocol.ts b/src/server/webkit/protocol.tsindex 90c2202749..807888f829 100644--- a/src/server/webkit/protocol.ts+++ b/src/server/webkit/protocol.ts@@ -865,6 +865,44 @@ export module Protocol {*/sourceURL?: string;}+ /**+ * A representation of WebCore::Font. Conceptually this is backed by either a font file on disk or from the network.+ */+ export interface Font {+ /**+ * The display name defined by the font.+ */+ displayName: string;+ /**+ * The variation axes defined by the font.+ */+ variationAxes: FontVariationAxis[];+ }+ /**+ * A single variation axis associated with a Font.+ */+ export interface FontVariationAxis {+ /**+ * The name, generally human-readable, of the variation axis. Some axes may not provide a human-readable name distiguishable from the tag. This field is ommited when there is no name, or the name matches the tag exactly.+ */+ name?: string;+ /**+ * The four character tag for the variation axis.+ */+ tag: string;+ /**+ * The minimum value that will affect the axis.+ */+ minimumValue: number;+ /**+ * The maximum value that will affect the axis.+ */+ maximumValue: number;+ /**+ * The value that is used for the axis when it is not otherwise controlled.+ */+ defaultValue: number;+ }/*** Fires whenever a MediaQuery result changes (for example, after a browser window has been resized.) The current implementation considers only viewport-dependent media features.@@ -965,6 +1003,18 @@ export module Protocol {*/computedStyle: CSSComputedStyleProperty[];}+ /**+ * Returns the primary font of the computed font cascade for a DOM node identified by <code>nodeId</code>.+ */+ export type getFontDataForNodeParameters = {+ nodeId: DOM.NodeId;+ }+ export type getFontDataForNodeReturnValue = {+ /**+ * Computed primary font for the specified DOM node.+ */+ primaryFont: Font;+ }/*** Returns metainfo entries for all known stylesheets.*/@@ -8492,6 +8542,7 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the"CSS.getMatchedStylesForNode": CSS.getMatchedStylesForNodeParameters;"CSS.getInlineStylesForNode": CSS.getInlineStylesForNodeParameters;"CSS.getComputedStyleForNode": CSS.getComputedStyleForNodeParameters;+ "CSS.getFontDataForNode": CSS.getFontDataForNodeParameters;"CSS.getAllStyleSheets": CSS.getAllStyleSheetsParameters;"CSS.getStyleSheet": CSS.getStyleSheetParameters;"CSS.getStyleSheetText": CSS.getStyleSheetTextParameters;@@ -8776,6 +8827,7 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the"CSS.getMatchedStylesForNode": CSS.getMatchedStylesForNodeReturnValue;"CSS.getInlineStylesForNode": CSS.getInlineStylesForNodeReturnValue;"CSS.getComputedStyleForNode": CSS.getComputedStyleForNodeReturnValue;+ "CSS.getFontDataForNode": CSS.getFontDataForNodeReturnValue;"CSS.getAllStyleSheets": CSS.getAllStyleSheetsReturnValue;"CSS.getStyleSheet": CSS.getStyleSheetReturnValue;"CSS.getStyleSheetText": CSS.getStyleSheetTextReturnValue;diff --git a/src/server/webkit/wkInterceptableRequest.ts b/src/server/webkit/wkInterceptableRequest.tsindex c66aef8218..302fd3f3eb 100644--- a/src/server/webkit/wkInterceptableRequest.ts+++ b/src/server/webkit/wkInterceptableRequest.ts@@ -58,7 +58,7 @@ export class WKInterceptableRequest implements network.RouteDelegate {this._timestamp = event.timestamp;this._wallTime = event.walltime * 1000;if (event.request.postData)- postDataBuffer = Buffer.from(event.request.postData, 'binary');+ postDataBuffer = Buffer.from(event.request.postData, 'base64');this.request = new network.Request(allowInterception ? this : null, frame, redirectedFrom, documentId, event.request.url,resourceType, event.request.method, postDataBuffer, headersObjectToArray(event.request.headers));this._interceptedPromise = new Promise(f => this._interceptedCallback = f);diff --git a/test/page-wait-for-request.spec.ts b/test/page-wait-for-request.spec.tsindex a0e8d7003f..01248edc81 100644--- a/test/page-wait-for-request.spec.ts+++ b/test/page-wait-for-request.spec.ts@@ -95,3 +95,21 @@ it('should work with url match regular expression from a different context', asy]);expect(request.url()).toBe(server.PREFIX + '/digits/1.png');});++it('should return correct postData buffer for utf-8 body', async ({page, server}) => {+ await page.goto(server.EMPTY_PAGE);+ const value = 'baẞ';+ const [request] = await Promise.all([+ page.waitForRequest('**'),+ page.evaluate(({url, value}) => {+ const request = new Request(url, {+ method: 'POST',+ body: JSON.stringify(value),+ });+ request.headers.set('content-type', 'application/json;charset=UTF-8');+ return fetch(request);+ }, {url: server.PREFIX + '/title.html', value})+ ]);+ expect(request.postDataBuffer().equals(Buffer.from(JSON.stringify(value), 'utf-8'))).toBe(true);+ expect(request.postDataJSON()).toBe(value);+});