daattali / shinyjs

💡 Easily improve the user experience of your Shiny apps in seconds
https://deanattali.com/shinyjs
Other
734 stars 119 forks source link

shinyjs causes shinytest failures with GHA #234

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hi,

I am using shinytest for snapshot testing with Github Actions and it appears that even with setting a seed as in:

app <- ShinyDriver$new("../../", seed = 1234, loadTimeout = 1e+05)
app$snapshotInit("snapshot-test")

shinyjs still produces random values that causes the testing to fail as in:

diff ..//tests/shinytest/snapshot-test-expected/007.json ..//tests/shinytest/snapshot-test-current/007.json
2909,2913c2909,2913
<     "shinyjs-delay-4ac6fe66f2f8aefeb77a555bf450afc4": 2000,
<     "shinyjs-delay-86d18bfb84d15b3526a65b789c485780": 2000,
<     "shinyjs-delay-a3d06c36aed8f8461e10dae5ad18e8b4": 2000,
<     "shinyjs-delay-de700603a22c56de2a5f3e1df9cf7123": 2000,
<     "shinyjs-delay-f4edd519c5b94e020a2ebe1e6c9dd870": 2000,
---
>     "shinyjs-delay-7275149e29f086fdd8897f848eb2dd19": 2000,
>     "shinyjs-delay-90088e3b3a8fede253688fbae30814c1": 2000,
>     "shinyjs-delay-a6b1a7b8773c22b422808a87b6c799d9": 2000,
>     "shinyjs-delay-ac1d05fa074ce9cf22cb010484be1341": 2000,
>     "shinyjs-delay-f77a6ee078ebf90a19ffc855cfb94d83": 2000,

am i missing something or is there a workaround?

Thank you

daattali commented 3 years ago

That makes sense, as the current time is used for hashing to make it extremely unlikely to have collisions. Can you set to ignore specific inputs with a regex?

daattali commented 1 year ago

This has been raised to shinytest2 https://github.com/rstudio/shinytest2/issues/300