Prompt
why is Safari breaking my browser tests
Latest observation
Oct 26, 2026
OpenAI APIWeb search: off
Safari often breaks browser tests because it’s usually the most standards-strict and least forgiving browser in common test setups. The exact cause depends on your stack, but the usual culprits are:
Common reasons
-
JavaScript differences
- Safari can be stricter about syntax and behavior.
- Newer JS features may not be supported the same way as Chrome/Firefox unless transpiled correctly.
-
DOM/API gaps or quirks
- Some APIs behave differently or aren’t fully implemented.
- Examples:
ResizeObserver,IntersectionObserver,PointerEvent,Clipboard,Fullscreen,WebRTC, etc.
-
Timing/race conditions
- Safari’s rendering and event loop timing can differ, exposing flaky tests.
- Tests that assume synchronous DOM updates often fail.
-
CSS/layout differences
- Safari handles flexbox, grid, sticky positioning, overflow, and font metrics slightly differently.
- Visual or click-target tests can fail because elements are positioned differently.
-
WebDriver / automation issues
- Safari’s automation support can be less predictable than Chrome’s.
safaridriverand WebKit automation sometimes behave differently with focus, scrolling, file uploads, dialogs, and windows/tabs.
-
Security restrictions
- Safari may block things like third-party cookies, storage access, autoplay, or cross-origin interactions more aggressively.
-
Test assumptions
- Tests written against Chromium behavior may accidentally rely on non-standard behavior.
What to check first
-
Look at the exact failure
- JS error?
- Element not found?
- Click intercepted?
- Assertion mismatch?
- Timeout?
-
Run the test in isolation
- If it only fails in Safari, it’s often timing or browser-specific behavior.
-
Check browser support targets
- Make sure your transpilation/polyfills cover Safari versions you test against.
-
Update test helpers
- Add explicit waits for DOM updates, animation completion, network idle, etc.
-
Compare Safari versions
- Sometimes it’s only broken in one version of Safari/WebKit.
Typical fixes
- Replace brittle selectors or click logic with more robust waits.
- Avoid assuming order or exact pixel positions.
- Use
awaitconsistently and wait for UI state changes. - Polyfill missing features where needed.
- Use browser-specific workarounds only when necessary.
- Prefer Playwright’s built-in auto-waiting if you’re using it, but still verify Safari/WebKit compatibility.
If you want, paste:
- the failing test
- the error message
- your test framework
- Safari version / WebKit target
and I can help pinpoint the likely cause.