kantord/LibreLingo

Cypress: disable sounds effects

Aperta

#753 aperta il 4 ott 2020

 (10 commenti) (2 reazioni) (1 assegnatario)Python (259 fork)github user discovery
feature_requestgood first issuewontfix

Metriche repository

Star
 (2629 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Cypress tests interact with parts of the application where sounds effects are made. This is distracting when working with the tests locally. (i. e. yarn web cy:open or yarn web cy:run)

howler is used project-wide to implement sound effects, here's one example:

https://github.com/kantord/LibreLingo/blob/c89466d7560eb3338b95d4c2cdb7fe02d1b51af4/workspaces/web/src/media/voice.js#L1-L9

The task is to make sure that the sound effects are not played when running from Cypress. The easiest way to detect that a code is running from Cypress is using window.isCypress.

Ideally, this solution would not involve having to check in each place where sound is played. Instead, this logic should be implemented in one place, and simply re-used in all the other places. This can be done, for example, by subclassing howler, or whatever solution that seems fit!

Guida contributor