Hello everyone,
I am working in an application that makes use of the onRestore function for the bookmarking feature in Shiny (Shiny - Advanced bookmarking).
I was wondering if there is any known way to combine the testing tools shinytest and the testserver to test that the restoring is working properly.
For example:
ses <- MockShinySession$new()
# Prepare a session object so bookmarking takes place
# Test that the bookmarking was done properly
testServer(
my_server_function,
{ test_equal(bar, foo) },
session = ses
)
Following the tests in shiny repo I have tried the following:
ses <- MockShinySession$new()
ses$RestoreContext <- shiny:::RestoreContext$new('?_inputs_&my_input="A"')
testServer(
my_server_function,
{ test_equal(...) },
session = ses
)
But, of course, it seems to be a bit more complicated than than that
I have also thought (although the testserver approach is preferred) to test this using shinytest, but I can't find a way to specify a url when you create the shinydriver, is there a way to do so?
For example, run the driver but on '127.0.0.1:999/?inputs&my_input="A"'
Thanks a lot for your help!