25 + 5 clock not passing final audio test

On the final test for the Audio of the app the following test fails:

  1. The audio element with id of “beep” must stop playing and be rewound to the beginning when the element with the id of “reset” is clicked.
    Audio element was not stopped when reset was clicked.: expected false to be true
    AssertionError: Audio element was not stopped when reset was clicked.: expected false to be true
    at o. (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:531:15281)
    at o.e (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:401:182)
    at Reflect.get ()
    at Object.e [as get] (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:68:1382)
    at n.isTrue (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:556:1222)
    at n. (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:581:184436)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:575:265533
    at Kb.run (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:575:265828)
    at CC.runTest (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:575:280794)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:575:281730

I have so far tried switching to React 17 and switching browsers, but no luck the test still fails. When I test it for myself it appears to work so I am confused what’s going wrong.

The code can be found in the repo below:
https://github.com/YourFBIAgent/reactjs-25-5-clock

Thanks to all who gave this a read.

is it live somewhere? maybe in codepen or repl? thanks and happy learning :slight_smile:

Thank you for the reply, but I managed to fix it by using the code below instead of the useRef approach I was doing when the issue was happening

document.getElementById('beep').pause();
document.getElementById('beep').currentTime = 0;

I don’t know why this passes the tests and the useRef doesn’t, but it’s a fix.

If you still wanna see the live thing it can be found on the link below
https://yourfbiagent.github.io/reactjs-25-5-clock/

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.