Recent changes in shinytest package (1.3.0.9001) include great features, as testing widgets that lack the direct input binding such as plotly or DT widgets), which are of interest for me.
For simplification, to compare stable (1.3.0) and newest version I gave it a go with the snapshot tool and performed the same set of actions on the selected app. The test application I have selected contains two simple r selectInputs
, r renderPlotly
and r dataTableOutput
to enable me new features testing. As expected snapshot tool recorded properly the values in the generated test script and .json files for previously not seen objects with the argument r allowInputNoBinding_ = TRUE
.
Generated test script
app <- ShinyDriver$new("../")
app$snapshotInit("test-inputs")
## Whole app
app$setInputs(`.clientValue-plotly_click-barplot` = "null", allowInputNoBinding_ = TRUE)
app$snapshot()
## After choosing assay - X
app$setInputs(assay = "X")
app$snapshot()
## After clicking last barplot for A
app$setInputs(`.clientValue-plotly_hover-barplot` = "[{\"curveNumber\":5,\"pointNumber\":0,\"x\":\"A\",\"y\":8}]", allowInputNoBinding_ = TRUE)
app$setInputs(`.clientValue-plotly_click-barplot` = "[{\"curveNumber\":5,\"pointNumber\":0,\"x\":\"A\",\"y\":8}]", allowInputNoBinding_ = TRUE)
app$setInputs(list_table_rows_current = c(1, 2, 3, 4, 5, 6, 7, 8), allowInputNoBinding_ = TRUE)
app$setInputs(list_table_rows_all = c(1, 2, 3, 4, 5, 6, 7, 8), allowInputNoBinding_ = TRUE)
app$setInputs(`.clientValue-plotly_hover-barplot` = character(0), allowInputNoBinding_ = TRUE)
app$snapshot()`
However, when I tried to incorporate the functionality without snapshot tool and instead with custom scripts I encountered not expected outcome. Using r setInputs()
, similarly as stated above, did not change the values properly. By checking modified input with r getValue()
I got empty string, instead of expected value. Identical operation done in version 1.3.0 gives expected value - "X".
app <- ShinyDriver$new("../")
app$setInputs(assay = "X")
app$getValue("assay")
[1] ""
Does anybody encounter a similar problem? The question is whether such behavior is expected and easy to explain? It would be highly appreciated if you could point me in the right direction with this, as the new features look very promising for me.
Cheers