1

I have a simple shiny consisting of 1 filter, 1 date and submit button. So if the user selects any value in filter, date and click on submit button, the results as displayed in table. At time, the table is not displayed and throws some error. But as a user we cannot check all possible combinations of Filter, date to check if the table is displayed or not. So i have a below code to check that. i am trying to run a for loop here but not able to execute. Can anyone please help me

app <- ShinyDriver$new(getwd())
new_value <- app$setInputs(ID = "AAA", Date = "2019-12-27", 
                           Submit = "click")
expect_error(new_value)
app$stop()

So there are actually 8 ID's in my dataset shown below and there are 2 dates. I need to check for all possible combination ID and dates if i am getting any error or not. So I am planning to write a for loop (written down)

df
ID          dates
AAA     2019-12-27  
BBB     2019-12-28
CCC     2019-12-27  
DDD    2019-12-28
EEE    2019-12-27  
FFF     2019-12-28
GGG     2019-12-27  
HHH     2019-12-28

For loop

app <- ShinyDriver$new(getwd())
new_value <- list()
for (i in length(df$ID)) {
  for (j in length(df$dates)) {
    new_value <- app$setInputs(Tic = df$ID[i], Date = df$dates[j], 
    Submit = "click")
  }
}
expect_error(new_value)
app$stop()
kjetil b halvorsen
  • 1,206
  • 2
  • 18
  • 28
imran p
  • 332
  • 2
  • 12
  • Can anyone help me in this please – imran p Feb 17 '20 at 12:46
  • 1
    Hi imran p. Please have a look [here on how to ask good questions](https://stackoverflow.com/help/how-to-ask) and add a [minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610). That way you can help others to help you! – dario Feb 17 '20 at 12:50
  • 1
    Well, you do any(duplicated(mydata)) . duplicated() tells you which rows are duplicated (i.e TRUE/FALSE) for every row. If you want to check if all are unique, then it should be all FALSE.. – StupidWolf Feb 17 '20 at 13:33

0 Answers0