EarthSystemDiagnostics / cpt-picarr

MIT License
1 stars 0 forks source link

UI testing #44

Closed twollnik closed 5 years ago

twollnik commented 5 years ago

At the moment, bugs occur frequently and can be introduced easily because there is no comprehensive UI testing with shinytest. I suggest adding one shinytest-file per page.

twollnik commented 5 years ago

Can shinytest be used for our app?

Upon trying to record a test with shinytest I got the following error:

Warning: Error in eval: object 'ShinyDriver' not found
  61: eval
  60: eval
  59: match.arg
  48: app$getDebugLog
  47: <observer> [/home/tom/R/x86_64-pc-linux-gnu-library/3.4/shinytest/recorder/app.R#399]
   4: shiny::runApp
   1: shinytest::recordTest

Looking at the docs for ShinyDriver I found the following piece of information:

Currently it [ShinyDriver] supports apps that are defined in a single app.R file, or in a server.R and ui.R pair.

It is unclear whether or not this applies to our app. We use modules and helper files, however we also have a file app.R that brings all the application logic together.

Looking further I found this issue where someone is encountering issues when trying to use shinytest with modules. The maintainers did not answer whether shinytest can work with modules.

I also found this blog post that makes it seem like shinytest and modules can be used together. In the blog post they use a different directory structure (app.R in inst/app/; modules in R/). Maybe using the different directory structure can solve our issue.

Conclusion

It is unclear if we can use shinytest for UI testing. Changing the directory structure may help. We can also open an issue and ask for help from the maintainers.

twollnik commented 5 years ago

Update: I opened an issue in the shinytest repository (https://github.com/rstudio/shinytest/issues/283)

twollnik commented 5 years ago

@thomas-muench I have not received an answer from the shinytest maintainers, yet. It will be difficult to find the time to experiment with ui testing to try and somehow make it work in the limited time we have left. Therefore I would suggest to not do any ui testing. Quite a few functions are already being tested with testthat, we will have to rely on manual testing to make sure the UI works. Is that fine with you or would you prefer to take the time and try to get shinytest to work?

thomas-muench commented 5 years ago

I am fine with no doing any UI testing now.