For loop to check all possible combination

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()

would this work ?

app <- ShinyDriver$new(getwd())
new_value <- list()
for (i in length(df$ID)) {
  for (j in length(df$dates)) {
    expect_error(app$setInputs(Tic = df$ID[i], Date = df$dates[j], Submit = "click"))
  }
}
app$stop()

Thanks for the comment. Actually I tried this. The issue is the app$setInputs(Tic = df$ID[i], Date = df$dates[j], Submit = "click") is only checking for last combination. I mean this value HHH 2019-12-28. For the rest of the combination it is not checking

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.