Shiny Bookmarking with shinytest or testserver

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 :slight_smile:

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!

1 Like

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.