Commit 5814ba4
Add two potential fixes for flaky interactions tests (#8093)
This PR includes 2 potential fixes to our interactions tests, which have
been flaky (for example
[here](https://github.com/mapbox/mapbox-sdk/actions/runs/19340074549/job/55401597566?pr=7250)).
1. Added layoutIfNeeded() before camera setup
Potential root cause: iOS doesn't immediately layout subviews when added
to the view hierarchy. Without forcing layout, the MapView's bounds
weren't finalized, causing `map.point(for: coordinate)` to return
incorrect screen coordinates. This
made taps miss their intended features.
Fix: `rootView.layoutIfNeeded()` forces a layout pass before setting the
camera, ensuring coordinate-to-screen-point
conversions are accurate.
2. Moved observer setup before `map.load()`
Potential root cause: Since the test style is inline JSON (not a network
fetch), it could load synchronously. Attaching the
onMapLoaded observer after calling `load()` created a race condition
where the event might fire before the observer
was ready.
Fix: Moved `map.onMapLoaded.observeNext { }` before `map.load()`,
guaranteeing we capture the event.
cc @mapbox/maps-ios
GitOrigin-RevId: ff6ace82571c77e2b1d2e0fdf675f4e248c61e2e1 parent 8ab7f80 commit 5814ba4
File tree
2 files changed
+22
-8
lines changed- Tests/MapboxMapsTests/Foundation
2 files changed
+22
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
17 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
18 | 26 | | |
19 | 27 | | |
20 | 28 | | |
21 | | - | |
22 | | - | |
| 29 | + | |
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
17 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
18 | 26 | | |
19 | 27 | | |
20 | 28 | | |
21 | | - | |
22 | | - | |
| 29 | + | |
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
| |||
0 commit comments