phetsims / utterance-queue

Alerting library powered by aria-live
MIT License
0 stars 2 forks source link

Potential issue with stepTimer in UtteranceQueueTests #51

Closed jessegreenberg closed 2 years ago

jessegreenberg commented 2 years ago

The stepTimer emits in before() like

    // step the timer, because utteranceQueue runs on timer
    intervalID = setInterval( () => { // eslint-disable-line bad-sim-text
      stepTimer.emit( timerInterval ); // step timer in seconds
    }, timerInterval * 1000 );

No matter how much time actually passes in the interval, we emit that timeInterval time as elapsed. I think this may be causing inconsistent test results. Usually when I run the tests as they are on master they pass, but every once in a while some fail.

jessegreenberg commented 2 years ago

From #50

jessegreenberg commented 2 years ago

I changed these to emit the elapsed time since the list time stepTimer has emitted and so far tests have not failed for me like they did before. This is noticeably more consistent for me on Firefox where I saw elapsed time swing from 16-48 ms in between each call of the window.setInterval callback.

@zepumph just want to make sure you are OK with this change?

zepumph commented 2 years ago

Looks really, really great. Good bug fix. Thanks!