Commit f0ec83e
fix: use useLayoutEffect for test event listener to prevent Cypress race condition
Root cause: useEffect registers the test:targetClick listener after the browser
paints, creating a race where Cypress finds the target-sphere DOM element and
dispatches events before the listener is ready.
Fix: switch to useLayoutEffect (runs before paint) so the listener is always
registered by the time any Cypress test can dispatch events.
Also add cy.wait(100) after event dispatch in screenshots.cy.ts, consistent
with the pattern in gameplay.cy.ts, to give React time to process state updates.
Agent-Logs-Url: https://github.com/Hack23/game/sessions/cc45c339-eb55-475b-8b72-29b9fab0ce47
Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>1 parent a18c1f6 commit f0ec83e
2 files changed
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
| |||
0 commit comments