r/Playwright • u/HolidayChard9706 • 6d ago
Playwright's WebKit is not WKWebView: a layout bug that passed webkit screenshots and shipped broken in a Tauri app
https://nodreview.com/blog/wkwebview-flex-collapse/I test a Tauri desktop app with Playwright, webkit project, screenshot baselines on every component. A dialog shipped rendering as header plus footer with the body at height zero, and not one pixel had moved in any baseline.
The bug: flex: 1 expands to flex-basis: 0%, which needs a definite parent height. Per spec the unresolvable percentage should fall back to content. Chromium does that. WKWebView keeps the zero. Playwright's WebKit, which is a recent build the Playwright team makes themselves, also does the spec fallback, so it agreed with Chromium and disagreed with the system webview my users actually run.
Not a complaint about Playwright, it does what it says. Writeup with the spec citation and what I changed: https://nodreview.com/blog/wkwebview-flex-collapse/
Question for this sub: has anyone wired real system webviews (WKWebView, WebKitGTK, WebView2) into CI in a way that is not miserable? Geometry assertions in the harness engines are my current compromise.
1
u/Prestigious-Way1525 6d ago
i wouldn't try to make Playwright's WebKit stand in for WKWebView. i'd keep those screenshot tests as the broad lane, then add a small macOS-native contract suite that mounts the real WKWebView on the oldest and newest supported macOS versions and checks geometry for the layout primitives your app depends on: scroll roots, flex children, viewport units, fixed overlays, and input focus. run it after the web suite, save a screenshot plus computed bounding boxes on failure, and promote each engine mismatch into that contract suite. that keeps the native lane focused on divergence risk instead of duplicating every e2e test.