Testing paramaterized shiny flexdashboard apps with shinytest

Is it possible to test parameterized shiny flexdashboard documents via Shinytest?

I have a flexdashboard Rmarkdown document in a package. This dashboard is exposed to end users via a package function that wraps rmarkdown::run(), passing parameters via the render_args argument that point to the correct directories for this dashboard to read. I can't find a way via ShinyDriver to set these parameters as the app is launched. Without passing the correct data file source directories, the dashboard will fail to render and launch, so ShinyDriver never gets instantiated properly.

Is there a way to pass parameters to such a shiny-powered flexdashboard? I'd love to get testing working for this document!

From the shinytest website, this seems possible with some conditions:
https://rstudio.github.io/shinytest/articles/shinytest.html#interactive-r-markdown-documents

Also from the github repo, we can find the PR for this feature:

There is an example in the repo

It is just some hints that I hope can help.

Thanks for info. Unfortunately, running app$setInputs() is insufficient for my dashboard. My Flexdashboard has a parameter on the location for it's data files which has to be valid for the dashboard to knit. Without the ability to specify the render_args parameter, the ShinyDriver$new() call will fail, as the dashboard will never launch.

It sounds like ShinyTest can't currently handle this use case. I'll open an issue on the shinytest repo to track this as a feature request.

2 Likes

For reference, the issue is

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.