kantord/LibreLingo

Cypress: disable sounds effects

开放

#753 创建于 2020年10月4日

 (10 条评论) (2 个反应) (1 位负责人)Python (258 个派生)github user discovery
feature_requestgood first issuewontfix

仓库指标

星标
 (2,630 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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!

贡献者指南