appDriver ignores enableBookmarking argument

Open
#379 2 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
r
Domain
testing-qa

Research direction

Start with the AppDriver$new(app) example and compare its get_url() behavior with running the app directly. Inspect how appDriver handles the app's enableBookmarking = "url" option. Done when the driver-launched app exposes bookmarkButton under the same option, with a regression test for this case.

Written by the indexing model from the issue text.

Description

I'm trying to test an app which displays button conditionally depending whether bookmarkStore option is set or not.

library(shiny)

# bookmarkable shiny app
ui <- fluidPage(
  textInput("text", "Text", ""),
  uiOutput("bookmark_button")
)

server <- function(input, output, session) {
  shiny_option <- getShinyOption("bookmarkStore", "disabled")
  print(shiny_option)
  output$bookmark_button <- renderUI({
    if (shiny_option != "disabled") {
      bookmarkButton("Bookmark")
    } else {
      NULL
    }
  })
}

app <- shinyApp(ui, server, enableBookmarking = "url")
  1. The app run normally displays bookmarkButton
app

image

  1. The app run through appDriver doesn't display a button
remdr <- shinytest2::AppDriver$new(app)
browseURL(remdr$get_url())

image


Question:

  • how to force appDriver to use enableBookmarking?
Dominant language
R
Stars
123
Forks
23
Avg merge
3h 13m
Merged PRs (30d)
12

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rstudio/shinytest2

All issues in rstudio/shinytest2

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.