From 42c452f889988d33ec56a4950f119d55567c8ae2 Mon Sep 17 00:00:00 2001 From: Sarah Endicott Date: Fri, 30 Aug 2024 16:33:14 -0400 Subject: [PATCH] shinytest2 app will start, spatial not running --- R/ccvi_app.R | 3 ++- tests/testthat/app/app.R | 3 --- .../{app/test-run_ccvi_app.R => test-app-run_ccvi_app.R} | 9 ++++++++- tests/testthat/test-app.R | 2 -- 4 files changed, 10 insertions(+), 7 deletions(-) delete mode 100644 tests/testthat/app/app.R rename tests/testthat/{app/test-run_ccvi_app.R => test-app-run_ccvi_app.R} (92%) delete mode 100644 tests/testthat/test-app.R diff --git a/R/ccvi_app.R b/R/ccvi_app.R index cc6ec26..f0cb67a 100644 --- a/R/ccvi_app.R +++ b/R/ccvi_app.R @@ -1643,7 +1643,8 @@ ccvi_app <- function(testmode_in, ...){ out_data_lst$index <- bind_cols(ind_df, conf_df, vuln_df) }) - exportTestValues(out_data = shiny::reactiveValuesToList(out_data_lst)) + exportTestValues(out_data = shiny::reactiveValuesToList(out_data_lst), + doSpatial = doSpatial()) # # helpful for testing # shinyjs::runcodeServer() diff --git a/tests/testthat/app/app.R b/tests/testthat/app/app.R deleted file mode 100644 index e6312a5..0000000 --- a/tests/testthat/app/app.R +++ /dev/null @@ -1,3 +0,0 @@ -options(shiny.testmode = TRUE) - -ccviR:::ccvi_app() diff --git a/tests/testthat/app/test-run_ccvi_app.R b/tests/testthat/test-app-run_ccvi_app.R similarity index 92% rename from tests/testthat/app/test-run_ccvi_app.R rename to tests/testthat/test-app-run_ccvi_app.R index 38c5afd..56abdfd 100644 --- a/tests/testthat/app/test-run_ccvi_app.R +++ b/tests/testthat/test-app-run_ccvi_app.R @@ -4,11 +4,18 @@ library(ccviR) # call for snapshot review # testthat::snapshot_review('run_ccvi_app/', path = 'tests/testthat/app/') +Sys.setenv( + CHROMOTE_CHROME = "C:/Users/EndicottS/AppData/Local/Google/Chrome/Application/chrome.exe" +) + +# Note seems you need to shut Chrome for it to work + test_that("{shinytest2} app test", { # Don't run these tests on the CRAN build servers skip_on_cran() skip_on_ci() - app <- AppDriver$new(".", name = "ccviR", seed = 7) + app_obj <- run_ccvi_app("demo", test.mode = TRUE) + app <- AppDriver$new(app_obj, name = "ccviR", seed = 7) # app <- AppDriver$new("tests/testthat/app", name = "ccviR", seed = 7) # Update output value diff --git a/tests/testthat/test-app.R b/tests/testthat/test-app.R deleted file mode 100644 index 8d30b48..0000000 --- a/tests/testthat/test-app.R +++ /dev/null @@ -1,2 +0,0 @@ -# shinytest2::test_app("app", check_setup = FALSE) -test_dir(test_path("app"))