Commit 5583cbd
committed
fix(test): prevent setTimeout race condition in appload event handler
The previous implementation had a setTimeout with 0ms that would always resolve
immediately, making the 'appload' event listener effectively useless. This could
cause tests to continue before the app was actually ready.
This fix:
- Adds a resolved flag to prevent double resolution
- Changes timeout from 0ms to 5000ms (reasonable fallback)
- Only resolves via timeout if the event hasn't fired
- Adds warning message when falling back to timeout
- Properly cleans up event listener in both paths1 parent 9d365e1 commit 5583cbd
1 file changed
+18
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
48 | 50 | | |
49 | | - | |
50 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
51 | 56 | | |
| 57 | + | |
52 | 58 | | |
53 | | - | |
54 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
55 | 69 | | |
56 | 70 | | |
57 | 71 | | |
| |||
0 commit comments