rstudio / shinytest

Automated testing for shiny apps
https://rstudio.github.io/shinytest/
Other
225 stars 55 forks source link

expected != current because of DT #414

Closed stla closed 2 years ago

stla commented 2 years ago

Hello,

I'm surprised I don't find a similar issue. I ran 'shinytest' on an app containing some DT::datatable, and I get differences:

shinytest001

It looks like DT generates some objects with random keys. How to deal with this problem?

stla commented 2 years ago

Ah no, I think I understand. This is this code;

    output[["data_rawData"]] <- renderUI({
      ## raw data
      rawData <- LoadedDataExperiment()
      dat <- rawData[["data"]][["Fluorescence"]]

      mytable <- lapply(seq_along(dat), function(i){
        tagList(
          tags$b(names(dat)[i]),
          renderDT(
            datatable(
              dat[[i]],
              rownames = FALSE,
              options = list(
                "dom" = "ltip",
                "ordering" = FALSE,
                "scrollX" = TRUE
              )
            )
          ),

There are some renderDT which are not assigned to an output, hence the random id. I think I can use elementId here. Will try.

stla commented 2 years ago

Nope. elementId is ignored. I have to do some outputs.