How to use shinytest to test whether a download was successful (but not compare the downloaded file)

Hi Everyone,

Is there a way to use ShinyDriver$snapshotDownload in the shinytest package (or another method) to test whether or not the download is successful? I don't need a comparison of differences in the downloaded data/rmarkdown pdf file (and the rmarkdown file throws an error with shinytest comparisons anyway...).

I just want to test is whether any changes to the app cause the downloadHander to fails.

Apologies in advance if there's a clear solution - I didn't see anything in rstudio community and I can't find much documentation for shinytest (especially with regard to downloads).

1 Like

A hack-ish solution to this seems to be to use testthat to test whether the length of the app$snapshotDownload() output (a raw vector of a long length) is greater than a small value (like 100).

I used the format from mastering-shiny: Chapter 21 Testing | Mastering Shiny and included the following line in my short test.

There are probabl ymore elegant ways...

testthat::expect_gt(length(app$snapshotDownload("download")), 100)

This topic was automatically closed 54 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.