Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

feat(webkit): roll to r2255 (#39092)

Yury Semikhatsky0e23c4c0be1b
diff --git a/packages/playwright-core/browsers.json b/packages/playwright-core/browsers.json
index a55cb94732..88a94aa183 100644
--- a/packages/playwright-core/browsers.json
+++ b/packages/playwright-core/browsers.json
@@ -45,7 +45,7 @@
},
{
"name": "webkit",
- "revision": "2253",
+ "revision": "2255",
"installByDefault": true,
"revisionOverrides": {
"mac14": "2251",
diff --git a/tests/assets/webfont/README.md b/tests/assets/webfont/README.md
index 5bcee9ad4d..eb442a85e2 100644
--- a/tests/assets/webfont/README.md
+++ b/tests/assets/webfont/README.md
@@ -1,3 +1,17 @@
-This icon font was generated:
-- using SVG icons from https://github.com/primer/octicons
-- bundling icons into webfonts using https://github.com/fontello/fontello
+This font contains two glyphs — `+` (U+2B) and `-` (U+2D) — each rendered as a
+simple filled black rectangle. The simplicity makes screenshot tests insensitive
+to font-rendering/antialiasing differences across platforms.
+
+## Regenerating
+
+Install dependencies:
+
+```
+pip3 install fonttools brotli
+```
+
+Run `generate_font.py` to regenerate `iconfont.woff2`:
+
+```
+python3 tests/assets/webfont/generate_font.py
+```
diff --git a/tests/assets/webfont/generate_font.py b/tests/assets/webfont/generate_font.py
new file mode 100644
index 0000000000..dfed9e0047
--- /dev/null
+++ b/tests/assets/webfont/generate_font.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python3
+# Copyright (c) Microsoft Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+"""Generate iconfont.woff2 with simple rectangle glyphs for + (U+2B) and - (U+2D).
+
+Requirements: pip3 install fonttools brotli
+"""
+
+import os
+
+from fontTools.fontBuilder import FontBuilder
+from fontTools.pens.t2CharStringPen import T2CharStringPen
+
+fb = FontBuilder(1000, isTTF=False)
+fb.setupGlyphOrder([".notdef", "plus", "hyphen"])
+fb.setupCharacterMap({0x2B: "plus", 0x2D: "hyphen"})
+
+fb.setupHorizontalMetrics({
+ ".notdef": (1000, 0),
+ "plus": (1000, 100),
+ "hyphen": (1000, 100),
+})
+fb.setupHorizontalHeader(ascent=850, descent=-150)
+fb.setupNameTable({
+ "familyName": "pwtest-iconfont",
+ "styleName": "Regular",
+})
+fb.setupOS2(sTypoAscender=850, sTypoDescender=-150, sTypoLineGap=0,
+ usWinAscent=850, usWinDescent=150)
+fb.setupPost()
+
+charstrings = {}
+pen = T2CharStringPen(1000, None)
+charstrings[".notdef"] = pen.getCharString()
+
+for name in ["plus", "hyphen"]:
+ pen = T2CharStringPen(1000, None)
+ pen.moveTo((100, 0))
+ pen.lineTo((900, 0))
+ pen.lineTo((900, 700))
+ pen.lineTo((100, 700))
+ pen.closePath()
+ charstrings[name] = pen.getCharString()
+
+fb.setupCFF(
+ psName="pwtest-iconfont",
+ fontInfo={"version": "1.0"},
+ charStringsDict=charstrings,
+ privateDict={}
+)
+
+fb.font.flavor = "woff2"
+output_path = os.path.join(os.path.dirname(__file__), "iconfont.woff2")
+fb.font.save(output_path)
+print(f"Saved {output_path}")
diff --git a/tests/assets/webfont/iconfont.svg b/tests/assets/webfont/iconfont.svg
index 9d2a4ca9c2..ed143af565 100644
--- a/tests/assets/webfont/iconfont.svg
+++ b/tests/assets/webfont/iconfont.svg
@@ -6,9 +6,9 @@
<font id="fontello" horiz-adv-x="1000" >
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
<missing-glyph horiz-adv-x="1000" />
-<glyph glyph-name="plus" unicode="&#x2b;" d="M531 527a31 31 0 0 1-62 0v-146h-146a31 31 0 0 1 0-62h146v-146a31 31 0 0 1 62 0v146h146a31 31 0 0 1 0 62h-146v146z m-31 281c-253 0-458-205-458-458s205-458 458-458 458 205 458 458-205 458-458 458z m-396-458a396 396 0 1 0 792 0 396 396 0 0 0-792 0z" horiz-adv-x="1000" />
+<glyph glyph-name="plus" unicode="&#x2b;" d="M100 0h800v700h-800z" horiz-adv-x="1000" />
-<glyph glyph-name="minus" unicode="&#x2d;" d="M104 350a396 396 0 1 0 792 0 396 396 0 0 0-792 0z m396 458c-253 0-458-205-458-458s205-458 458-458 458 205 458 458-205 458-458 458z m260-489a31 31 0 0 1 0 62h-520a31 31 0 0 1 0-62h520z" horiz-adv-x="1000" />
+<glyph glyph-name="minus" unicode="&#x2d;" d="M100 0h800v700h-800z" horiz-adv-x="1000" />
</font>
</defs>
</svg>
diff --git a/tests/assets/webfont/iconfont.woff2 b/tests/assets/webfont/iconfont.woff2
index ceba03549a..ed1f4f34a4 100644
Binary files a/tests/assets/webfont/iconfont.woff2 and b/tests/assets/webfont/iconfont.woff2 differ
diff --git a/tests/components/ct-react-vite/src/assets/iconfont.woff2 b/tests/components/ct-react-vite/src/assets/iconfont.woff2
index ceba03549a..ed1f4f34a4 100644
Binary files a/tests/components/ct-react-vite/src/assets/iconfont.woff2 and b/tests/components/ct-react-vite/src/assets/iconfont.woff2 differ
diff --git a/tests/components/ct-react-vite/tests/route.spec.tsx b/tests/components/ct-react-vite/tests/route.spec.tsx
index 5e17d00dfc..4368a4d41e 100644
--- a/tests/components/ct-react-vite/tests/route.spec.tsx
+++ b/tests/components/ct-react-vite/tests/route.spec.tsx
@@ -11,7 +11,7 @@ test('should load font without routes', async ({ mount, page }) => {
const request = await promise;
const response = await request.response();
const body = await response!.body();
- expect(body.length).toBe(2656);
+ expect(body.length).toBe(348);
});
test('should load font with routes', async ({ mount, page }) => {
@@ -22,7 +22,7 @@ test('should load font with routes', async ({ mount, page }) => {
const request = await promise;
const response = await request.response();
const body = await response!.body();
- expect(body.length).toBe(2656);
+ expect(body.length).toBe(348);
});
test.describe('request handlers', () => {
diff --git a/tests/library/browsercontext-viewport-mobile.spec.ts b/tests/library/browsercontext-viewport-mobile.spec.ts
index 010da0417f..44b7598457 100644
--- a/tests/library/browsercontext-viewport-mobile.spec.ts
+++ b/tests/library/browsercontext-viewport-mobile.spec.ts
@@ -108,6 +108,20 @@ it.describe('mobile viewport', () => {
await context.close();
});
+ it('should preserve screen.orientation.type override after navigation', async ({ browser, server, browserName, isMac, macVersion }) => {
+ it.skip(browserName === 'webkit' && hostPlatform.startsWith('ubuntu20.04'), 'Ubuntu 20.04 is frozen');
+ it.skip(browserName === 'webkit' && hostPlatform.startsWith('debian11'), 'Debian 11 is frozen');
+ it.skip(browserName === 'webkit' && isMac && macVersion < 15, 'WebKit on macOS < 15 is frozen.');
+
+ const context = await browser.newContext({ viewport: { width: 300, height: 400 }, isMobile: true });
+ const page = await context.newPage();
+ await page.goto(server.PREFIX + '/mobile.html');
+ expect(await page.evaluate(() => window.screen.orientation.type)).toBe('portrait-primary');
+ await page.goto(server.CROSS_PROCESS_PREFIX + '/mobile.html');
+ expect(await page.evaluate(() => window.screen.orientation.type)).toBe('portrait-primary');
+ await context.close();
+ });
+
it('should fire orientationchange event', async ({ browser, server }) => {
const context = await browser.newContext({ viewport: { width: 300, height: 400 }, isMobile: true });
const page = await context.newPage();
diff --git a/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-bidi-chromium.png b/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-bidi-chromium.png
index 40aa6d483c..c92f11bebe 100644
Binary files a/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-bidi-chromium.png and b/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-bidi-chromium.png differ
diff --git a/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-chromium.png b/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-chromium.png
index 40aa6d483c..c92f11bebe 100644
Binary files a/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-chromium.png and b/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-chromium.png differ
diff --git a/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-firefox.png b/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-firefox.png
index 11c8e0f230..04f7a0d79d 100644
Binary files a/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-firefox.png and b/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-firefox.png differ
diff --git a/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-moz-firefox-nightly.png b/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-moz-firefox-nightly.png
index 11c8e0f230..04f7a0d79d 100644
Binary files a/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-moz-firefox-nightly.png and b/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-moz-firefox-nightly.png differ
diff --git a/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-webkit.png b/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-webkit.png
index 6b0c93238f..97442346a1 100644
Binary files a/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-webkit.png and b/tests/page/page-screenshot.spec.ts-snapshots/screenshot-web-font-webkit.png differ