Prompt
My end-to-end tests fail only in Safari and I can't figure out why
Latest observation
Safari-only end-to-end failures are usually one of a few classes of issues: timing, browser API differences, stricter standards behavior, or flaky test assumptions. Here’s a practical way to narrow it down quickly.
Common Safari-specific causes
1. Timing / async differences
Safari can be slower or behave slightly differently with:
- navigation completion
- DOM updates
- animations/transitions
- network requests finishing
- focus/blur events
What to check
- Tests relying on arbitrary
wait(500)or similar - Assertions immediately after clicks without waiting for the UI state
- Race conditions hidden by faster browsers
Fix
- Wait on explicit conditions, not time
- Prefer:
- element visible/hidden
- text appears/disappears
- request completes
- route changes
- spinner disappears
2. Unsupported or partially supported browser features
Safari may lag on or differ in:
IntersectionObserverResizeObservercrypto.randomUUIDURLparsing edge casesIntlformatting differences- Clipboard APIs
input[type="date"],datetime-local- newer JS syntax if transpilation is incomplete
What to check
- Any test or app code using a browser API that’s not polyfilled
- Build/transpile targets for Safari
- Whether the test environment matches production Safari behavior
3. Strictness around events and user interactions
Safari can be pickier about what counts as a “real” user gesture.
Examples:
- opening popups
- clipboard access
- file pickers
- autoplay/media
- some focus/selection behaviors
If your E2E tool simulates clicks, Safari may require the element to be fully interactable.
4. CSS/layout differences
Safari often exposes layout assumptions:
- flexbox sizing quirks
- sticky positioning
- overflow/scroll container behavior
position: fixedinside transformed parents- viewport height issues on macOS/iOS Safari
- text rendering causing different element dimensions
What to check
- Click targets obscured or shifted
- Elements offscreen or covered by overlays
- Assertions on exact pixel values or element sizes
5. Form/input behavior differences
Safari can differ in:
changevsinputevent timing- autofill
- controlled inputs
- date/time inputs
- file input handling
- IME/composition events
If your test types into inputs, verify the app listens to the correct event.
6. WebKit-specific bugs
If you’re using Safari via WebKit, there may be actual engine bugs. Sometimes the app is fine and only the test runner/browser combo triggers the issue.
Fast debugging checklist
A. Isolate the failing step
Find the exact line where Safari diverges:
- before click?
- after click?
- after navigation?
- after data loads?
Add logging or screenshots around each step.
B. Compare DOM state
On failure, inspect:
- element exists?
- visible?
- enabled?
- covered by overlay?
- text updated?
- route changed?
C. Check console and network
Safari may show:
- JS errors
- failed requests
- CORS issues
- blocked cookies/storage access
D. Run the same test manually in Safari
Use Safari DevTools and watch:
- network waterfall
- console
- element state
E. Make the test more deterministic
- Replace sleeps with waits for conditions
- Avoid exact timing assertions
- Avoid relying on animation completion without waiting
- Disable animations in tests if possible
Very common Safari/E2E gotchas
- Click intercepted by overlay: Safari computes hit-testing differently
- Element not scrolled into view: test tool thinks it is, Safari doesn’t
- Focus not moving as expected: keyboard interactions fail
- Text input not committed: tests assume
typetriggers everything - Cookie/storage issues: third-party or SameSite differences
- Cross-origin iframe restrictions: more strict than other browsers
- Empty
href="#"/ anchor navigation quirks display: contents: can cause interaction/accessibility issues
What I’d do first
- Re-run only the Safari failure with verbose logging
- Add screenshots on every major step
- Replace all fixed waits with condition-based waits
- Check for unsupported APIs or browser-only branches
- Inspect whether the failing element is:
- visible
- clickable
- not overlapped
- Compare Safari’s console/network output to Chrome/Firefox
If you want, I can help you pinpoint it
If you paste:
- the failing test code
- the exact Safari error/trace
- your E2E framework (Playwright/Cypress/WebdriverIO/etc.)
- whether it’s desktop Safari or iOS Safari
…I can help narrow it to the most likely cause and suggest a concrete fix.