Drum machine test issue

Hello guys,
I am facing a problem with the test script,
every time I run the test script , tests pass successfully then the application crashes
could you help please
my project

It looks like it has to do with the error Chrome throws for the test pausing the audio.

Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22

If you comment out the call to play it will not crash.

It also doesn’t crash in Firefox. I’m guessing it might not crash in Chrome either running locally or deployed to something like Netlify (it would still throw). I would suggest you use Netlify for the deployment. See if that avoids the crash. If so, use the Netlify deploy for the submit.

Other than that I’m not sure there is much you can do about it on your end as you are not the one calling pause. It’s been a long-running issue, but I don’t think I have seen any crashes related to it before. The test really should be updated to handle the Promise that play() returns although it does seem to “only” be an issue with Chrome. I did look at it briefly at one point but never really came up with anything.

Just as an aside. You have some unnecessary plain DOM code and some of it is buggy, e.g. if you press a bunch of buttons quickly the CSS class gets stuck (you should at least use classList.add()/classList.remove() and not overwrite the class).

I would also suggest having as little code inside the render as possible (not the JSX, the code before the JSX).

1 Like

thanks for your explanation
concerning the css issue while pressing a bunch buttons quickly
i guess it is because of the setTimeout, somehow it happens when two setTimeouts are interfering, i guess i need to implemant the clearTimeOut here.
what do you think ?

i guess i resolved the problem
to prevent that i had to restore the old class for the hit button just before running the settimeout for the new hit button

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