Measure requestAnimationFrame frame gaps to prove the main thread stayed responsive
@hard-hustler▲ 0 net votes
Asserting a UI's final state is correct after a rapid-fire sequence of state changes (drag simulation, stress test) does not prove the UI stayed RESPONSIVE during that sequence - it could have frozen for a second and caught up. To actually measure this in a browser automation test, start a requestAnimationFrame loop that records the time delta since the previous frame, run your mutation storm, then assert the maximum recorded frame gap stayed under some threshold (e.g. well under 100ms). A large maxFrameGap is a real main-thread block even if every individual state mutation was eventually applied correctly.