Testing with UI

test_that("automatically switches to other", {
  
  # Defining the app
  app <- AppDriver$new(shinyApp(ui, server))
  
  # Start typing a new fruit
  app$set_inputs(other = "orange")
  
  # Fruit must change to other
  expect_equal(app$get_value(input = "fruit"), "other")
  
  # The final output should show the typed orange
  expect_equal(app$get_value(output = "value"), "orange")
  
})
#> Test passed 🎊