Rhandsontable dropdown functionality breaks in Shinytest2 browser (JS permissions policy violation)

Open
#416 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, r
Domain
testing-qa

Research direction

Start with the minimal example in app.r and reproduce it with use_shinytest2() and record_test(). Inspect the Shinytest2 browser console alongside the dropdown interaction, focusing on the unload permissions warning and DataCloneError from postMessage. Done means dropdown options can be selected and closed during recording without these errors.

Written by the indexing model from the issue text.

Description

Hi, thanks as ever for the great package. I don't know how I managed without it.

I'm now trying to use Rhandsontable with dropdown options in a Shiny app (R 4.5.1, Shiny 1.11.0, Rhandsontable 0.3.8, Shinytest2 0.4.1). The table works fine in Chrome and Firefox, but when I try to record a test in the Shinytest2 browser session the dropdown cell fills stop working: specifically, I can open them, but not select an option or close them. I see there have been issues in Shinytest (not 2) about Rhandsontable cell validation failing, but nothing about dropdowns (though perhaps it's the same issue at root)?

I put together a minimal reprex:

library(shiny)
library(rhandsontable)

ui <- fluidPage(rHandsontableOutput("hot_table"))

server <- function(input, output, session) {
  output$hot_table <- renderRHandsontable({
    df <- data.frame(Status = "Active")
    rhandsontable(df, height = 300) %>%
      hot_col("Status", type = "dropdown", source = c("Active", "Inactive"))
  })
}

shinyApp(ui, server)

When I run use_shinytest2(); record_test() and then check the console in the Shinytest2 browser, I get the following error messages:

content.js:212 [Violation] Permissions policy violation: unload is not allowed in this document.
(anonymous) @ content.js:212Understand this error
VM98:130 Uncaught DataCloneError: Failed to execute 'postMessage' on 'Window': function customRenderer(instance, TD, row, col, prop, value, cellProperties) {
  if (['date', 'handsontable'...<omitted>...
       } could not be cloned.
at sendMessageToParent (eval at <anonymous> (shiny-testmode.ts:9:21), <anonymous>:130:21)
at sendInputEventToParent (eval at <anonymous> (shiny-testmode.ts:9:21), <anonymous>:134:9)
at HTMLDocument.eval (eval at <anonymous> (shiny-testmode.ts:9:21), <anonymous>:57:9)
at HTMLDocument.dispatch (jquery.js:5145:27)
at v.handle (jquery.js:4949:28)
at Object.trigger (jquery.js:8629:12)
at HTMLDocument.<anonymous> (jquery.js:8707:17)
at ce.each (jquery.js:383:19)
at ce.fn.init.each (jquery.js:205:17)
at ce.fn.init.trigger (jquery.js:8706:15)

Any insight into workarounds? It's by no means essential, but shinytest2 is so useful that I'd love to be able to get it to work with Rhandsontable.

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.