kantord/LibreLingo

Cypress: disable sounds effects

Open

#753 opened on Oct 4, 2020

 (10 comments) (2 reactions) (1 assignee)Python (259 forks)github user discovery
feature_requestgood first issuewontfix

Repository metrics

Stars
 (2,629 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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!

Contributor guide