From 8a980e1a894d801aa458d763317a70d9f232b4fb Mon Sep 17 00:00:00 2001 From: m7pr Date: Mon, 22 Apr 2024 12:24:56 +0200 Subject: [PATCH 01/18] setup for tm_a_gee tests --- tests/testthat/test-shinytest2-tm_a_gee.R | 258 +--------------------- 1 file changed, 11 insertions(+), 247 deletions(-) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index 04cd396559..95a0e81da8 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -1,4 +1,5 @@ app_driver_tm_a_gee <- function() { + data <- teal.data::teal_data() data <- within(data, { library(dplyr) @@ -32,263 +33,26 @@ app_driver_tm_a_gee <- function() { choices = teal.transform::value_choices(data[["ADQS"]], "PARAMCD", "PARAM"), selected = "FKSI-FWB" ), - cov_var = teal.transform::choices_selected(c("BASE", "AGE", "SEX", "BASE:AVISIT"), NULL), - conf_level = teal.transform::choices_selected(c(0.95, 0.9, 0.8, -1), 0.95, keep_order = TRUE) + cov_var = teal.transform::choices_selected(c("BASE", "AGE", "SEX", "BASE:AVISIT"), NULL) ) ) } -testthat::test_that("e2e - tm_a_gee: Module initializes in teal without errors and produces table output.", { - skip_if_too_deep(5) - - app_driver <- app_driver_tm_a_gee() - app_driver$expect_no_shiny_error() - app_driver$expect_no_validation_error() - testthat::expect_true(app_driver$is_visible(app_driver$active_module_element("table-table-with-settings"))) - app_driver$stop() -}) - -testthat::test_that( - "e2e - tm_a_gee: Starts with specified label, id_var, arm_var, visit_var, paramcd, cov_var, - conf_level and conf_struct.", - { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - - testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), - "GEE" - ) - - testthat::expect_equal( - app_driver$get_active_module_input("aval_var-dataset_ADQS_singleextract-select"), - "AVALBIN" - ) - - testthat::expect_equal( - app_driver$get_active_module_input("id_var-dataset_ADQS_singleextract-select"), - "USUBJID" - ) - - testthat::expect_equal( - app_driver$get_active_module_input("arm_var-dataset_ADSL_singleextract-select"), - "ARM" - ) - - testthat::expect_equal( - app_driver$get_active_module_input("visit_var-dataset_ADQS_singleextract-select"), - "AVISIT" - ) - testthat::expect_equal( - app_driver$get_active_module_input("paramcd-dataset_ADQS_singleextract-filter1-vals"), - "FKSI-FWB" - ) - - testthat::expect_equal( - app_driver$get_active_module_input("cov_var-dataset_ADQS_singleextract-select"), - NULL - ) - - testthat::expect_equal(app_driver$get_active_module_input("conf_level"), "0.95") - - testthat::expect_equal(app_driver$get_active_module_input("cor_struct"), "unstructured") - - radio_buttons <- app_driver$active_module_element_text("output_table") - testthat::expect_match( - radio_buttons, - "Output Type.*LS means.*Covariance.*Coefficients", - fixed = FALSE - ) - app_driver$stop() - } -) - -testthat::test_that("e2e - tm_a_gee: Selection of id_var changes the table and does not throw validation errors.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("id_var-dataset_ADQS_singleextract-select", "SUBJID") - testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) - app_driver$expect_no_validation_error() - app_driver$stop() -}) - -testthat::test_that("e2e - tm_a_gee: Deselection of id_var throws validation error.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - app_driver$set_active_module_input("id_var-dataset_ADQS_singleextract-select", character(0)) - testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) - app_driver$expect_validation_error() - testthat::expect_equal( - app_driver$active_module_element_text("id_var-dataset_ADQS_singleextract-select_input > div > span"), - "A Subject identifier is required" - ) - app_driver$stop() -}) - -testthat::test_that("e2e - tm_a_gee: Change in arm_var changes the table and does not throw validation errors.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - - table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("arm_var-dataset_ADSL_singleextract-select", "ARMCD") - testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) - app_driver$expect_no_validation_error() - app_driver$stop() -}) - -testthat::test_that("e2e - tm_a_gee: Deselection of arm_var throws validation error.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - app_driver$set_active_module_input("arm_var-dataset_ADSL_singleextract-select", character(0)) - testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) - app_driver$expect_validation_error() - testthat::expect_equal( - app_driver$active_module_element_text("arm_var-dataset_ADSL_singleextract-select_input > div > span"), - "A treatment variable is required" - ) - app_driver$stop() -}) - - -testthat::test_that("e2e - tm_a_gee: Selection of visit_var changes the table and does not throw validation errors.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("visit_var-dataset_ADQS_singleextract-select", "AVISITN") - testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) - app_driver$expect_no_validation_error() - app_driver$stop() -}) - -testthat::test_that("e2e - tm_a_gee: Deselection of visit_var throws validation error.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - app_driver$set_active_module_input("visit_var-dataset_ADQS_singleextract-select", character(0)) - testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) - app_driver$expect_validation_error() - testthat::expect_equal( - app_driver$active_module_element_text("visit_var-dataset_ADQS_singleextract-select_input > div > span"), - "A visit variable is required" - ) - app_driver$stop() -}) - -testthat::test_that("e2e - tm_a_gee: Selection of paramcd changes the table and does not throw validation errors.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("paramcd-dataset_ADQS_singleextract-filter1-vals", "BFIALL") - testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) - app_driver$expect_no_validation_error() - app_driver$stop() -}) - -testthat::test_that("e2e - tm_a_gee: Deselection of paramcd throws validation error.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - app_driver$set_active_module_input("paramcd-dataset_ADQS_singleextract-filter1-vals", character(0)) - testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) - app_driver$expect_validation_error() - testthat::expect_equal( - app_driver$active_module_element_text("paramcd-dataset_ADQS_singleextract-filter1-vals_input > div > span"), - "An endpoint is required" - ) - app_driver$stop() -}) - -testthat::test_that("e2e - tm_a_gee: Selection of cov_var changes the table and does not throw validation errors.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("cov_var-dataset_ADQS_singleextract-select", "BASE") - testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) - app_driver$expect_no_validation_error() - app_driver$stop() -}) - -testthat::test_that("e2e - tm_a_gee: Deselection of cov_var throws validation error.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - app_driver$set_active_module_input("cov_var-dataset_ADQS_singleextract-select", character(0)) - testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) - app_driver$expect_validation_error() - testthat::expect_equal( - app_driver$active_module_element_text("cov_var-dataset_ADQS_singleextract-select_input > div > span"), - "An endpoint is required" +# returns base 64 encoded image +plot_output <- function(app_driver) { + app_driver$get_attr( + app_driver$active_module_element("myplot-plot_main > img"), + "src" ) - app_driver$stop() -}) - -testthat::test_that("e2e - tm_a_gee: Selection of conf_level changes the table and does not throw validation errors.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("conf_level", 0.90) - testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) - app_driver$expect_no_validation_error() - app_driver$stop() -}) +} -testthat::test_that("e2e - tm_a_gee: Selection of conf_level out of [0,1] range throws validation error.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("conf_level", -1) - testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) - app_driver$expect_validation_error() - testthat::expect_equal( - app_driver$active_module_element_text("conf_level_input > div > span"), - "Confidence level must be between 0 and 1" - ) - app_driver$stop() -}) -testthat::test_that("e2e - tm_a_gee: Deselection of conf_level throws validation error.", { +testthat::test_that("e2e - tm_a_gee: example gee module initializes in teal without errors and produces table output", { skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - app_driver$set_active_module_input("conf_level", character(0)) - testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) - app_driver$expect_validation_error() - testthat::expect_equal( - app_driver$active_module_element_text("conf_level_input > div > span"), - "Please choose a confidence level" - ) - app_driver$stop() -}) - -testthat::test_that("e2e - tm_a_gee: Selection of cor_struct changes the table and does not throw validation errors.", { - skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("cor_struct", "auto-regressive") - testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) + app_driver$expect_no_shiny_error() app_driver$expect_no_validation_error() - app_driver$stop() -}) - -testthat::test_that("e2e - tm_a_gee: Deselection of cor_struct throws validation error.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - app_driver$set_active_module_input("cor_struct", character(0)) - testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) - # TO BE FIXED - there is no error displayed - app_driver$expect_validation_error() - testthat::expect_equal( - app_driver$active_module_element_text("cov_struct_input > div > span"), - "Please choose a correlation structure" - ) - app_driver$stop() + testthat::expect_true(app_driver$is_visible(app_driver$active_module_element("table-table-with-settings"))) }) - -testthat::test_that("e2e - tm_a_gee: Selection of output_table changes the table and doesn't throw validation error.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("output_table", "t_gee_cov") - testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) - app_driver$expect_no_validation_error() - app_driver$stop() -}) From 6d291faa60e44f6eea358229e649f54af2e317e1 Mon Sep 17 00:00:00 2001 From: m7pr Date: Mon, 22 Apr 2024 12:39:54 +0200 Subject: [PATCH 02/18] input tests --- tests/testthat/test-shinytest2-tm_a_gee.R | 47 ++++++++++++++++++----- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index 95a0e81da8..964fae62eb 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -38,15 +38,6 @@ app_driver_tm_a_gee <- function() { ) } -# returns base 64 encoded image -plot_output <- function(app_driver) { - app_driver$get_attr( - app_driver$active_module_element("myplot-plot_main > img"), - "src" - ) -} - - testthat::test_that("e2e - tm_a_gee: example gee module initializes in teal without errors and produces table output", { skip_if_too_deep(5) @@ -56,3 +47,41 @@ testthat::test_that("e2e - tm_a_gee: example gee module initializes in teal with testthat::expect_true(app_driver$is_visible(app_driver$active_module_element("table-table-with-settings"))) }) +testthat::test_that("e2e - tm_a_gee: starts with specified label, id_var, arm_var, visit_var, paramcd and cov_var", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + + testthat::expect_equal( + app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + "GEE" + ) + + testthat::expect_equal( + app_driver$get_active_module_input("aval_var-dataset_ADQS_singleextract-select"), + "AVALBIN" + ) + + testthat::expect_equal( + app_driver$get_active_module_input("id_var-dataset_ADQS_singleextract-select"), + "USUBJID" + ) + + testthat::expect_equal( + app_driver$get_active_module_input("arm_var-dataset_ADSL_singleextract-select"), + "ARM" + ) + + testthat::expect_equal( + app_driver$get_active_module_input("visit_var-dataset_ADQS_singleextract-select"), + "AVISIT" + ) + testthat::expect_equal( + app_driver$get_active_module_input("paramcd-dataset_ADQS_singleextract-filter1-vals"), + "FKSI-FWB" + ) + + testthat::expect_equal( + app_driver$get_active_module_input("cov_var-dataset_ADQS_singleextract-select"), + NULL + ) +}) From c040894c86a3fc6e6ca1ad3f6d6c89d61310202f Mon Sep 17 00:00:00 2001 From: m7pr Date: Mon, 22 Apr 2024 13:02:23 +0200 Subject: [PATCH 03/18] tests for tables content --- tests/testthat/helper-TealAppDriver.R | 12 ++++++------ tests/testthat/test-shinytest2-tm_a_gee.R | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/tests/testthat/helper-TealAppDriver.R b/tests/testthat/helper-TealAppDriver.R index ec11c05462..90f730f5ed 100644 --- a/tests/testthat/helper-TealAppDriver.R +++ b/tests/testthat/helper-TealAppDriver.R @@ -24,10 +24,10 @@ init_teal_app_driver <- function(...) { ) } -# returns base 64 encoded image -active_module_pws_output <- function(app_driver) { - app_driver$get_attr( - app_driver$active_module_element("myplot-plot_main > img"), - "src" - ) +# Returns data.frame with table output +active_module_tws_output <- function(element = "table-table-with-settings", app_driver, which = 1) { + app_driver$active_module_element(element) %>% + app_driver$get_html_rvest() %>% + rvest::html_table(fill = TRUE) %>% + .[[which]] } diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index 964fae62eb..57f5b3368a 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -85,3 +85,19 @@ testthat::test_that("e2e - tm_a_gee: starts with specified label, id_var, arm_va NULL ) }) + +testthat::test_that("e2e - tm_a_gee: change in arm_var changes the table and does not throw validation errors", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + + table_before <- active_module_tws_output(app_driver) + app_driver$set_active_module_input("arm_var-dataset_ADSL_singleextract-select", "ARMCD") + testthat::expect_false( + identical( + table_before, + active_module_tws_output(app_driver) + ) + ) + app_driver$expect_no_validation_error() + app_driver$stop() +}) From 6cf72f6fb54cf0dd576f23352211f21d48457e05 Mon Sep 17 00:00:00 2001 From: m7pr Date: Mon, 22 Apr 2024 13:44:17 +0200 Subject: [PATCH 04/18] tests for more input params --- tests/testthat/helper-TealAppDriver.R | 11 +- tests/testthat/test-shinytest2-tm_a_gee.R | 127 ++++++++++++++++++++++ 2 files changed, 135 insertions(+), 3 deletions(-) diff --git a/tests/testthat/helper-TealAppDriver.R b/tests/testthat/helper-TealAppDriver.R index 90f730f5ed..e845882d44 100644 --- a/tests/testthat/helper-TealAppDriver.R +++ b/tests/testthat/helper-TealAppDriver.R @@ -25,9 +25,14 @@ init_teal_app_driver <- function(...) { } # Returns data.frame with table output -active_module_tws_output <- function(element = "table-table-with-settings", app_driver, which = 1) { +active_module_tws_output <- function(app_driver, element = "table-table-with-settings", which = 1) { app_driver$active_module_element(element) %>% app_driver$get_html_rvest() %>% - rvest::html_table(fill = TRUE) %>% - .[[which]] + rvest::html_table(fill = TRUE) %>% { + if (identical(., list())) { + . + } else { + .[[which]] + } + } } diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index 57f5b3368a..7cafea773c 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -86,6 +86,34 @@ testthat::test_that("e2e - tm_a_gee: starts with specified label, id_var, arm_va ) }) +testthat::test_that("e2e - tm_a_gee: selection of id_var changes the table and does not throw validation errors", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + table_before <- active_module_tws_output(app_driver) + app_driver$set_active_module_input("id_var-dataset_ADQS_singleextract-select", "SUBJID") + testthat::expect_false( + identical( + table_before, + active_module_tws_output(app_driver) + ) + ) + app_driver$expect_no_validation_error() + app_driver$stop() +}) + +testthat::test_that("e2e - tm_a_gee: deselection of id_var throws validation error", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + app_driver$set_active_module_input("id_var-dataset_ADQS_singleextract-select", character(0)) + testthat::expect_identical(active_module_tws_output(app_driver), list()) + app_driver$expect_validation_error() + testthat::expect_equal( + app_driver$active_module_element_text("id_var-dataset_ADQS_singleextract-select_input > div > span"), + "A Subject identifier is required" + ) + app_driver$stop() +}) + testthat::test_that("e2e - tm_a_gee: change in arm_var changes the table and does not throw validation errors", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() @@ -101,3 +129,102 @@ testthat::test_that("e2e - tm_a_gee: change in arm_var changes the table and doe app_driver$expect_no_validation_error() app_driver$stop() }) + +testthat::test_that("e2e - tm_a_gee: deselection of arm_var throws validation error", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + app_driver$set_active_module_input("arm_var-dataset_ADSL_singleextract-select", character(0)) + testthat::expect_identical(active_module_tws_output(app_driver), list()) + app_driver$expect_validation_error() + testthat::expect_equal( + app_driver$active_module_element_text("arm_var-dataset_ADSL_singleextract-select_input > div > span"), + "A treatment variable is required" + ) + app_driver$stop() +}) + + +testthat::test_that("e2e - tm_a_gee: selection of visit_var changes the table and does not throw validation errors", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + table_before <- active_module_tws_output(app_driver) + app_driver$set_active_module_input("visit_var-dataset_ADQS_singleextract-select", "AVISITN") + testthat::expect_false( + identical( + table_before, + active_module_tws_output(app_driver) + ) + ) + app_driver$expect_no_validation_error() + app_driver$stop() +}) + +testthat::test_that("e2e - tm_a_gee: deselection of visit_var throws validation error", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + app_driver$set_active_module_input("visit_var-dataset_ADQS_singleextract-select", character(0)) + testthat::expect_identical(active_module_tws_output(app_driver), list()) + app_driver$expect_validation_error() + testthat::expect_equal( + app_driver$active_module_element_text("visit_var-dataset_ADQS_singleextract-select_input > div > span"), + "A visit variable is required" + ) + app_driver$stop() +}) + +testthat::test_that("e2e - tm_a_gee: selection of paramcd changes the table and does not throw validation errors", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + table_before <- active_module_tws_output(app_driver) + app_driver$set_active_module_input("paramcd-dataset_ADQS_singleextract-filter1-vals", "BFIALL") + testthat::expect_false( + identical( + table_before, + active_module_tws_output(app_driver) + ) + ) + app_driver$expect_no_validation_error() + app_driver$stop() +}) + +testthat::test_that("e2e - tm_a_gee: deselection of paramcd throws validation error", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + app_driver$set_active_module_input("paramcd-dataset_ADQS_singleextract-filter1-vals", character(0)) + testthat::expect_identical(active_module_tws_output(app_driver), list()) + app_driver$expect_validation_error() + testthat::expect_equal( + app_driver$active_module_element_text("paramcd-dataset_ADQS_singleextract-filter1-vals_input > div > span"), + "An endpoint is required" + ) + app_driver$stop() +}) + +testthat::test_that("e2e - tm_a_gee: selection of cov_var changes the table and does not throw validation errors", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + table_before <- active_module_tws_output(app_driver) + app_driver$set_active_module_input("cov_var-dataset_ADQS_singleextract-select", "BASE") + testthat::expect_false( + identical( + table_before, + active_module_tws_output(app_driver) + ) + ) + app_driver$expect_no_validation_error() + app_driver$stop() +}) + +testthat::test_that("e2e - tm_a_gee: deselection of cov_var throws validation error", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + app_driver$set_active_module_input("cov_var-dataset_ADQS_singleextract-select", character(0)) + testthat::expect_identical(active_module_tws_output(app_driver), list()) + app_driver$expect_validation_error() + testthat::expect_equal( + app_driver$active_module_element_text("cov_var-dataset_ADQS_singleextract-select_input > div > span"), + "An endpoint is required" + ) + app_driver$stop() +}) + From 1bbc53a2e8d7cc189b7d8998061996d55dc6cb10 Mon Sep 17 00:00:00 2001 From: m7pr Date: Mon, 22 Apr 2024 14:03:57 +0200 Subject: [PATCH 05/18] remaining tests cof last 3 widgets --- tests/testthat/test-shinytest2-tm_a_gee.R | 47 +++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index 7cafea773c..e8ad344352 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -84,6 +84,24 @@ testthat::test_that("e2e - tm_a_gee: starts with specified label, id_var, arm_va app_driver$get_active_module_input("cov_var-dataset_ADQS_singleextract-select"), NULL ) + + testthat::expect_equal( + app_driver$get_active_module_input("conf_level"), + "0.95" + ) + + testthat::expect_equal( + app_driver$get_active_module_input("cor_struct"), + "unstructured" + ) + + radio_buttons <- app_driver$active_module_element_text("output_table") + testthat::expect_match( + radio_buttons, + "Output Type.*LS means.*Covariance.*Coefficients", + fixed = FALSE + ) + }) testthat::test_that("e2e - tm_a_gee: selection of id_var changes the table and does not throw validation errors", { @@ -228,3 +246,32 @@ testthat::test_that("e2e - tm_a_gee: deselection of cov_var throws validation er app_driver$stop() }) +testthat::test_that("e2e - tm_g_ci: selection of conf_level changes the table and does not throw validation errors", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_g_ci() + table_before <- active_module_tws_output(app_driver) + app_driver$set_active_module_input("conf_level", 0.90) + testthat::expect_false(identical(table_before, active_module_tws_output(app_driver))) + app_driver$expect_no_validation_error() + app_driver$stop() +}) + +testthat::test_that("e2e - tm_g_ci: selection of cor_struct changes the table and does not throw validation errors", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_g_ci() + table_before <- active_module_tws_output(app_driver) + app_driver$set_active_module_input("cor_struct", "auto-regressive") + testthat::expect_false(identical(table_before, active_module_tws_output(app_driver))) + app_driver$expect_no_validation_error() + app_driver$stop() +}) + +testthat::test_that("e2e - tm_g_ci: selection of output_table changes the table and does not throw validation errors", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_g_ci() + table_before <- active_module_tws_output(app_driver) + app_driver$set_active_module_input("output_table", "t_gee_cov") + testthat::expect_false(identical(table_before, active_module_tws_output(app_driver))) + app_driver$expect_no_validation_error() + app_driver$stop() +}) From a98e36067f30c1e46f9d9bee18868e77342aaaaa Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Tue, 23 Apr 2024 13:35:33 +0200 Subject: [PATCH 06/18] Update tests/testthat/test-shinytest2-tm_a_gee.R Co-authored-by: kartikeya kirar Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com> --- tests/testthat/test-shinytest2-tm_a_gee.R | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index e8ad344352..1840945cc8 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -45,6 +45,7 @@ testthat::test_that("e2e - tm_a_gee: example gee module initializes in teal with app_driver$expect_no_shiny_error() app_driver$expect_no_validation_error() testthat::expect_true(app_driver$is_visible(app_driver$active_module_element("table-table-with-settings"))) + app_driver$stop() }) testthat::test_that("e2e - tm_a_gee: starts with specified label, id_var, arm_var, visit_var, paramcd and cov_var", { From c03f916ed58450040f5a5b1a3038977449b19bdc Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 23 Apr 2024 15:22:52 +0200 Subject: [PATCH 07/18] @gogonzo comments + typos --- tests/testthat/test-shinytest2-tm_a_gee.R | 58 ++++++++++++++++++++--- 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index 1840945cc8..d09f2dca5c 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -33,7 +33,8 @@ app_driver_tm_a_gee <- function() { choices = teal.transform::value_choices(data[["ADQS"]], "PARAMCD", "PARAM"), selected = "FKSI-FWB" ), - cov_var = teal.transform::choices_selected(c("BASE", "AGE", "SEX", "BASE:AVISIT"), NULL) + cov_var = teal.transform::choices_selected(c("BASE", "AGE", "SEX", "BASE:AVISIT"), NULL), + conf_level = teal.transform::choices_selected(c(0.95, 0.9, 0.8, -1), 0.95, keep_order = TRUE) ) ) } @@ -247,9 +248,9 @@ testthat::test_that("e2e - tm_a_gee: deselection of cov_var throws validation er app_driver$stop() }) -testthat::test_that("e2e - tm_g_ci: selection of conf_level changes the table and does not throw validation errors", { +testthat::test_that("e2e - tm_a_gee: selection of conf_level changes the table and does not throw validation errors", { skip_if_too_deep(5) - app_driver <- app_driver_tm_g_ci() + app_driver <- app_driver_tm_a_gee() table_before <- active_module_tws_output(app_driver) app_driver$set_active_module_input("conf_level", 0.90) testthat::expect_false(identical(table_before, active_module_tws_output(app_driver))) @@ -257,9 +258,37 @@ testthat::test_that("e2e - tm_g_ci: selection of conf_level changes the table an app_driver$stop() }) -testthat::test_that("e2e - tm_g_ci: selection of cor_struct changes the table and does not throw validation errors", { +testthat::test_that("e2e - tm_a_gee: selection of conf_level out of [0,1] range throws validation error", { skip_if_too_deep(5) - app_driver <- app_driver_tm_g_ci() + app_driver <- app_driver_tm_a_gee() + table_before <- active_module_tws_output(app_driver) + app_driver$set_active_module_input("conf_level", -1) + testthat::expect_identical(active_module_tws_output(app_driver), list()) + app_driver$expect_validation_error() + testthat::expect_equal( + app_driver$active_module_element_text("conf_level_input > div > span"), + "Confidence level must be between 0 and 1" + ) + app_driver$stop() +}) + +testthat::test_that("e2e - tm_a_gee: deselection of conf_level throws validation error", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + app_driver$set_active_module_input("conf_level", character(0)) + testthat::expect_identical(active_module_tws_output(app_driver), list()) + app_driver$expect_validation_error() + testthat::expect_equal( + app_driver$active_module_element_text("conf_level_input > div > span"), + "Please choose a confidence level" + ) + app_driver$stop() +}) + + +testthat::test_that("e2e - tm_a_gee: selection of cor_struct changes the table and does not throw validation errors", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() table_before <- active_module_tws_output(app_driver) app_driver$set_active_module_input("cor_struct", "auto-regressive") testthat::expect_false(identical(table_before, active_module_tws_output(app_driver))) @@ -267,9 +296,24 @@ testthat::test_that("e2e - tm_g_ci: selection of cor_struct changes the table an app_driver$stop() }) -testthat::test_that("e2e - tm_g_ci: selection of output_table changes the table and does not throw validation errors", { +testthat::test_that("e2e - tm_a_gee: deselection of cor_struct throws validation error", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + app_driver$set_active_module_input("cor_struct", character(0)) + testthat::expect_identical(active_module_tws_output(app_driver), list()) + # TO BE FIXED - there is no error displayed + app_driver$expect_validation_error() + testthat::expect_equal( + app_driver$active_module_element_text("cov_struct_input > div > span"), + "Please choose a correlation structure" + ) + app_driver$stop() +}) + + +testthat::test_that("e2e - tm_a_gee: selection of output_table changes the table and does not throw validation errors", { skip_if_too_deep(5) - app_driver <- app_driver_tm_g_ci() + app_driver <- app_driver_tm_a_gee() table_before <- active_module_tws_output(app_driver) app_driver$set_active_module_input("output_table", "t_gee_cov") testthat::expect_false(identical(table_before, active_module_tws_output(app_driver))) From 54a794f25d273b90d170f64d89a264d2b75cb99e Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 24 Apr 2024 11:15:38 +0200 Subject: [PATCH 08/18] cleanup test names --- tests/testthat/test-shinytest2-tm_a_gee.R | 36 +++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index d09f2dca5c..948eaed1a9 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -39,7 +39,7 @@ app_driver_tm_a_gee <- function() { ) } -testthat::test_that("e2e - tm_a_gee: example gee module initializes in teal without errors and produces table output", { +testthat::test_that("e2e - tm_a_gee: Module initializes in teal without errors and produces table output.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() @@ -49,7 +49,7 @@ testthat::test_that("e2e - tm_a_gee: example gee module initializes in teal with app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: starts with specified label, id_var, arm_var, visit_var, paramcd and cov_var", { +testthat::test_that("e2e - tm_a_gee: Starts with specified label, id_var, arm_var, visit_var, paramcd and cov_var.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() @@ -106,7 +106,7 @@ testthat::test_that("e2e - tm_a_gee: starts with specified label, id_var, arm_va }) -testthat::test_that("e2e - tm_a_gee: selection of id_var changes the table and does not throw validation errors", { +testthat::test_that("e2e - tm_a_gee: Selection of id_var changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() table_before <- active_module_tws_output(app_driver) @@ -121,7 +121,7 @@ testthat::test_that("e2e - tm_a_gee: selection of id_var changes the table and d app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: deselection of id_var throws validation error", { +testthat::test_that("e2e - tm_a_gee: Deselection of id_var throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("id_var-dataset_ADQS_singleextract-select", character(0)) @@ -134,7 +134,7 @@ testthat::test_that("e2e - tm_a_gee: deselection of id_var throws validation err app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: change in arm_var changes the table and does not throw validation errors", { +testthat::test_that("e2e - tm_a_gee: Change in arm_var changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() @@ -150,7 +150,7 @@ testthat::test_that("e2e - tm_a_gee: change in arm_var changes the table and doe app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: deselection of arm_var throws validation error", { +testthat::test_that("e2e - tm_a_gee: Deselection of arm_var throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("arm_var-dataset_ADSL_singleextract-select", character(0)) @@ -164,7 +164,7 @@ testthat::test_that("e2e - tm_a_gee: deselection of arm_var throws validation er }) -testthat::test_that("e2e - tm_a_gee: selection of visit_var changes the table and does not throw validation errors", { +testthat::test_that("e2e - tm_a_gee: Selection of visit_var changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() table_before <- active_module_tws_output(app_driver) @@ -179,7 +179,7 @@ testthat::test_that("e2e - tm_a_gee: selection of visit_var changes the table an app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: deselection of visit_var throws validation error", { +testthat::test_that("e2e - tm_a_gee: Deselection of visit_var throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("visit_var-dataset_ADQS_singleextract-select", character(0)) @@ -192,7 +192,7 @@ testthat::test_that("e2e - tm_a_gee: deselection of visit_var throws validation app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: selection of paramcd changes the table and does not throw validation errors", { +testthat::test_that("e2e - tm_a_gee: Selection of paramcd changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() table_before <- active_module_tws_output(app_driver) @@ -207,7 +207,7 @@ testthat::test_that("e2e - tm_a_gee: selection of paramcd changes the table and app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: deselection of paramcd throws validation error", { +testthat::test_that("e2e - tm_a_gee: Deselection of paramcd throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("paramcd-dataset_ADQS_singleextract-filter1-vals", character(0)) @@ -220,7 +220,7 @@ testthat::test_that("e2e - tm_a_gee: deselection of paramcd throws validation er app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: selection of cov_var changes the table and does not throw validation errors", { +testthat::test_that("e2e - tm_a_gee: Selection of cov_var changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() table_before <- active_module_tws_output(app_driver) @@ -235,7 +235,7 @@ testthat::test_that("e2e - tm_a_gee: selection of cov_var changes the table and app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: deselection of cov_var throws validation error", { +testthat::test_that("e2e - tm_a_gee: Deselection of cov_var throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("cov_var-dataset_ADQS_singleextract-select", character(0)) @@ -248,7 +248,7 @@ testthat::test_that("e2e - tm_a_gee: deselection of cov_var throws validation er app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: selection of conf_level changes the table and does not throw validation errors", { +testthat::test_that("e2e - tm_a_gee: Selection of conf_level changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() table_before <- active_module_tws_output(app_driver) @@ -258,7 +258,7 @@ testthat::test_that("e2e - tm_a_gee: selection of conf_level changes the table a app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: selection of conf_level out of [0,1] range throws validation error", { +testthat::test_that("e2e - tm_a_gee: Selection of conf_level out of [0,1] range throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() table_before <- active_module_tws_output(app_driver) @@ -272,7 +272,7 @@ testthat::test_that("e2e - tm_a_gee: selection of conf_level out of [0,1] range app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: deselection of conf_level throws validation error", { +testthat::test_that("e2e - tm_a_gee: Deselection of conf_level throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("conf_level", character(0)) @@ -286,7 +286,7 @@ testthat::test_that("e2e - tm_a_gee: deselection of conf_level throws validation }) -testthat::test_that("e2e - tm_a_gee: selection of cor_struct changes the table and does not throw validation errors", { +testthat::test_that("e2e - tm_a_gee: Selection of cor_struct changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() table_before <- active_module_tws_output(app_driver) @@ -296,7 +296,7 @@ testthat::test_that("e2e - tm_a_gee: selection of cor_struct changes the table a app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: deselection of cor_struct throws validation error", { +testthat::test_that("e2e - tm_a_gee: Deselection of cor_struct throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("cor_struct", character(0)) @@ -311,7 +311,7 @@ testthat::test_that("e2e - tm_a_gee: deselection of cor_struct throws validation }) -testthat::test_that("e2e - tm_a_gee: selection of output_table changes the table and does not throw validation errors", { +testthat::test_that("e2e - tm_a_gee: Selection of output_table changes the table and doesn't throw validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() table_before <- active_module_tws_output(app_driver) From 72f874bd105a44aaf5feba3eac52b630fd1a8253 Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Wed, 24 Apr 2024 11:21:33 +0200 Subject: [PATCH 09/18] Update tests/testthat/test-shinytest2-tm_a_gee.R Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com> --- tests/testthat/test-shinytest2-tm_a_gee.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index 948eaed1a9..b161687ffc 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -49,7 +49,7 @@ testthat::test_that("e2e - tm_a_gee: Module initializes in teal without errors a app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: Starts with specified label, id_var, arm_var, visit_var, paramcd and cov_var.", { +testthat::test_that("e2e - tm_a_gee: Starts with specified label, id_var, arm_var, visit_var, paramcd, cov_var, conf_level and conf_struct.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() From 4ce6801b5c9f8d193ffc4aa13f29914528593837 Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Wed, 24 Apr 2024 11:32:23 +0200 Subject: [PATCH 10/18] Update tests/testthat/test-shinytest2-tm_a_gee.R Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com> --- tests/testthat/test-shinytest2-tm_a_gee.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index b161687ffc..146adfe488 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -103,7 +103,7 @@ testthat::test_that("e2e - tm_a_gee: Starts with specified label, id_var, arm_va "Output Type.*LS means.*Covariance.*Coefficients", fixed = FALSE ) - + app_driver$stop() }) testthat::test_that("e2e - tm_a_gee: Selection of id_var changes the table and does not throw validation errors.", { From 7b40b9dc23e288db268d0f2a2a11e06c8a603dff Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 24 Apr 2024 11:41:53 +0200 Subject: [PATCH 11/18] use get_active_module_tws_output --- tests/testthat/helper-TealAppDriver.R | 13 ---- tests/testthat/test-shinytest2-tm_a_gee.R | 75 ++++++++--------------- 2 files changed, 25 insertions(+), 63 deletions(-) diff --git a/tests/testthat/helper-TealAppDriver.R b/tests/testthat/helper-TealAppDriver.R index e845882d44..b28850e396 100644 --- a/tests/testthat/helper-TealAppDriver.R +++ b/tests/testthat/helper-TealAppDriver.R @@ -23,16 +23,3 @@ init_teal_app_driver <- function(...) { .package = "teal" ) } - -# Returns data.frame with table output -active_module_tws_output <- function(app_driver, element = "table-table-with-settings", which = 1) { - app_driver$active_module_element(element) %>% - app_driver$get_html_rvest() %>% - rvest::html_table(fill = TRUE) %>% { - if (identical(., list())) { - . - } else { - .[[which]] - } - } -} diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index 146adfe488..787d86cf60 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -109,14 +109,9 @@ testthat::test_that("e2e - tm_a_gee: Starts with specified label, id_var, arm_va testthat::test_that("e2e - tm_a_gee: Selection of id_var changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - table_before <- active_module_tws_output(app_driver) + table_before <- app_driver$get_active_module_tws_output("table") app_driver$set_active_module_input("id_var-dataset_ADQS_singleextract-select", "SUBJID") - testthat::expect_false( - identical( - table_before, - active_module_tws_output(app_driver) - ) - ) + testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) app_driver$expect_no_validation_error() app_driver$stop() }) @@ -125,7 +120,7 @@ testthat::test_that("e2e - tm_a_gee: Deselection of id_var throws validation err skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("id_var-dataset_ADQS_singleextract-select", character(0)) - testthat::expect_identical(active_module_tws_output(app_driver), list()) + testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) app_driver$expect_validation_error() testthat::expect_equal( app_driver$active_module_element_text("id_var-dataset_ADQS_singleextract-select_input > div > span"), @@ -138,14 +133,9 @@ testthat::test_that("e2e - tm_a_gee: Change in arm_var changes the table and doe skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - table_before <- active_module_tws_output(app_driver) + table_before <- app_driver$get_active_module_tws_output("table") app_driver$set_active_module_input("arm_var-dataset_ADSL_singleextract-select", "ARMCD") - testthat::expect_false( - identical( - table_before, - active_module_tws_output(app_driver) - ) - ) + testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) app_driver$expect_no_validation_error() app_driver$stop() }) @@ -154,7 +144,7 @@ testthat::test_that("e2e - tm_a_gee: Deselection of arm_var throws validation er skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("arm_var-dataset_ADSL_singleextract-select", character(0)) - testthat::expect_identical(active_module_tws_output(app_driver), list()) + testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) app_driver$expect_validation_error() testthat::expect_equal( app_driver$active_module_element_text("arm_var-dataset_ADSL_singleextract-select_input > div > span"), @@ -167,14 +157,9 @@ testthat::test_that("e2e - tm_a_gee: Deselection of arm_var throws validation er testthat::test_that("e2e - tm_a_gee: Selection of visit_var changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - table_before <- active_module_tws_output(app_driver) + table_before <- app_driver$get_active_module_tws_output("table") app_driver$set_active_module_input("visit_var-dataset_ADQS_singleextract-select", "AVISITN") - testthat::expect_false( - identical( - table_before, - active_module_tws_output(app_driver) - ) - ) + testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) app_driver$expect_no_validation_error() app_driver$stop() }) @@ -183,7 +168,7 @@ testthat::test_that("e2e - tm_a_gee: Deselection of visit_var throws validation skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("visit_var-dataset_ADQS_singleextract-select", character(0)) - testthat::expect_identical(active_module_tws_output(app_driver), list()) + testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) app_driver$expect_validation_error() testthat::expect_equal( app_driver$active_module_element_text("visit_var-dataset_ADQS_singleextract-select_input > div > span"), @@ -195,14 +180,9 @@ testthat::test_that("e2e - tm_a_gee: Deselection of visit_var throws validation testthat::test_that("e2e - tm_a_gee: Selection of paramcd changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - table_before <- active_module_tws_output(app_driver) + table_before <- app_driver$get_active_module_tws_output("table") app_driver$set_active_module_input("paramcd-dataset_ADQS_singleextract-filter1-vals", "BFIALL") - testthat::expect_false( - identical( - table_before, - active_module_tws_output(app_driver) - ) - ) + testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) app_driver$expect_no_validation_error() app_driver$stop() }) @@ -211,7 +191,7 @@ testthat::test_that("e2e - tm_a_gee: Deselection of paramcd throws validation er skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("paramcd-dataset_ADQS_singleextract-filter1-vals", character(0)) - testthat::expect_identical(active_module_tws_output(app_driver), list()) + testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) app_driver$expect_validation_error() testthat::expect_equal( app_driver$active_module_element_text("paramcd-dataset_ADQS_singleextract-filter1-vals_input > div > span"), @@ -223,14 +203,9 @@ testthat::test_that("e2e - tm_a_gee: Deselection of paramcd throws validation er testthat::test_that("e2e - tm_a_gee: Selection of cov_var changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - table_before <- active_module_tws_output(app_driver) + table_before <- app_driver$get_active_module_tws_output("table") app_driver$set_active_module_input("cov_var-dataset_ADQS_singleextract-select", "BASE") - testthat::expect_false( - identical( - table_before, - active_module_tws_output(app_driver) - ) - ) + testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) app_driver$expect_no_validation_error() app_driver$stop() }) @@ -239,7 +214,7 @@ testthat::test_that("e2e - tm_a_gee: Deselection of cov_var throws validation er skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("cov_var-dataset_ADQS_singleextract-select", character(0)) - testthat::expect_identical(active_module_tws_output(app_driver), list()) + testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) app_driver$expect_validation_error() testthat::expect_equal( app_driver$active_module_element_text("cov_var-dataset_ADQS_singleextract-select_input > div > span"), @@ -251,9 +226,9 @@ testthat::test_that("e2e - tm_a_gee: Deselection of cov_var throws validation er testthat::test_that("e2e - tm_a_gee: Selection of conf_level changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - table_before <- active_module_tws_output(app_driver) + table_before <- app_driver$get_active_module_tws_output("table") app_driver$set_active_module_input("conf_level", 0.90) - testthat::expect_false(identical(table_before, active_module_tws_output(app_driver))) + testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) app_driver$expect_no_validation_error() app_driver$stop() }) @@ -261,9 +236,9 @@ testthat::test_that("e2e - tm_a_gee: Selection of conf_level changes the table a testthat::test_that("e2e - tm_a_gee: Selection of conf_level out of [0,1] range throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - table_before <- active_module_tws_output(app_driver) + table_before <- app_driver$get_active_module_tws_output("table") app_driver$set_active_module_input("conf_level", -1) - testthat::expect_identical(active_module_tws_output(app_driver), list()) + testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) app_driver$expect_validation_error() testthat::expect_equal( app_driver$active_module_element_text("conf_level_input > div > span"), @@ -276,7 +251,7 @@ testthat::test_that("e2e - tm_a_gee: Deselection of conf_level throws validation skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("conf_level", character(0)) - testthat::expect_identical(active_module_tws_output(app_driver), list()) + testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) app_driver$expect_validation_error() testthat::expect_equal( app_driver$active_module_element_text("conf_level_input > div > span"), @@ -289,9 +264,9 @@ testthat::test_that("e2e - tm_a_gee: Deselection of conf_level throws validation testthat::test_that("e2e - tm_a_gee: Selection of cor_struct changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - table_before <- active_module_tws_output(app_driver) + table_before <- app_driver$get_active_module_tws_output("table") app_driver$set_active_module_input("cor_struct", "auto-regressive") - testthat::expect_false(identical(table_before, active_module_tws_output(app_driver))) + testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) app_driver$expect_no_validation_error() app_driver$stop() }) @@ -300,7 +275,7 @@ testthat::test_that("e2e - tm_a_gee: Deselection of cor_struct throws validation skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("cor_struct", character(0)) - testthat::expect_identical(active_module_tws_output(app_driver), list()) + testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) # TO BE FIXED - there is no error displayed app_driver$expect_validation_error() testthat::expect_equal( @@ -314,9 +289,9 @@ testthat::test_that("e2e - tm_a_gee: Deselection of cor_struct throws validation testthat::test_that("e2e - tm_a_gee: Selection of output_table changes the table and doesn't throw validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - table_before <- active_module_tws_output(app_driver) + table_before <- app_driver$get_active_module_tws_output("table") app_driver$set_active_module_input("output_table", "t_gee_cov") - testthat::expect_false(identical(table_before, active_module_tws_output(app_driver))) + testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) app_driver$expect_no_validation_error() app_driver$stop() }) From 80c73ceaa5426b9f754028d6ee5bbf6dd38bd267 Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 24 Apr 2024 11:49:28 +0200 Subject: [PATCH 12/18] shorten tests --- tests/testthat/test-shinytest2-tm_a_gee.R | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index 787d86cf60..48936bbe9a 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -87,15 +87,9 @@ testthat::test_that("e2e - tm_a_gee: Starts with specified label, id_var, arm_va NULL ) - testthat::expect_equal( - app_driver$get_active_module_input("conf_level"), - "0.95" - ) + testthat::expect_equal(app_driver$get_active_module_input("conf_level"), "0.95") - testthat::expect_equal( - app_driver$get_active_module_input("cor_struct"), - "unstructured" - ) + testthat::expect_equal(app_driver$get_active_module_input("cor_struct"), "unstructured" ) radio_buttons <- app_driver$active_module_element_text("output_table") testthat::expect_match( From d981309b11a09944550cf91fe4ae0817c05a50f3 Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 24 Apr 2024 12:20:46 +0200 Subject: [PATCH 13/18] fix lintr --- tests/testthat/test-shinytest2-tm_a_gee.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index 48936bbe9a..3b5f2a6351 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -49,7 +49,10 @@ testthat::test_that("e2e - tm_a_gee: Module initializes in teal without errors a app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: Starts with specified label, id_var, arm_var, visit_var, paramcd, cov_var, conf_level and conf_struct.", { +testthat::test_that( + "e2e - tm_a_gee: Starts with specified label, id_var, arm_var, visit_var, paramcd, cov_var, + conf_level and conf_struct.", + { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() From 6f8fa515bc51c608553e442a51a34f17376781b2 Mon Sep 17 00:00:00 2001 From: m7pr Date: Thu, 25 Apr 2024 15:49:48 +0200 Subject: [PATCH 14/18] tests indentation --- tests/testthat/test-shinytest2-tm_a_gee.R | 82 +++++++++++------------ 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index 3b5f2a6351..04cd396559 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -1,5 +1,4 @@ app_driver_tm_a_gee <- function() { - data <- teal.data::teal_data() data <- within(data, { library(dplyr) @@ -53,55 +52,56 @@ testthat::test_that( "e2e - tm_a_gee: Starts with specified label, id_var, arm_var, visit_var, paramcd, cov_var, conf_level and conf_struct.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() - testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), - "GEE" - ) + testthat::expect_equal( + app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + "GEE" + ) - testthat::expect_equal( - app_driver$get_active_module_input("aval_var-dataset_ADQS_singleextract-select"), - "AVALBIN" - ) + testthat::expect_equal( + app_driver$get_active_module_input("aval_var-dataset_ADQS_singleextract-select"), + "AVALBIN" + ) - testthat::expect_equal( - app_driver$get_active_module_input("id_var-dataset_ADQS_singleextract-select"), - "USUBJID" - ) + testthat::expect_equal( + app_driver$get_active_module_input("id_var-dataset_ADQS_singleextract-select"), + "USUBJID" + ) - testthat::expect_equal( - app_driver$get_active_module_input("arm_var-dataset_ADSL_singleextract-select"), - "ARM" - ) + testthat::expect_equal( + app_driver$get_active_module_input("arm_var-dataset_ADSL_singleextract-select"), + "ARM" + ) - testthat::expect_equal( - app_driver$get_active_module_input("visit_var-dataset_ADQS_singleextract-select"), - "AVISIT" - ) - testthat::expect_equal( - app_driver$get_active_module_input("paramcd-dataset_ADQS_singleextract-filter1-vals"), - "FKSI-FWB" - ) + testthat::expect_equal( + app_driver$get_active_module_input("visit_var-dataset_ADQS_singleextract-select"), + "AVISIT" + ) + testthat::expect_equal( + app_driver$get_active_module_input("paramcd-dataset_ADQS_singleextract-filter1-vals"), + "FKSI-FWB" + ) - testthat::expect_equal( - app_driver$get_active_module_input("cov_var-dataset_ADQS_singleextract-select"), - NULL - ) + testthat::expect_equal( + app_driver$get_active_module_input("cov_var-dataset_ADQS_singleextract-select"), + NULL + ) - testthat::expect_equal(app_driver$get_active_module_input("conf_level"), "0.95") + testthat::expect_equal(app_driver$get_active_module_input("conf_level"), "0.95") - testthat::expect_equal(app_driver$get_active_module_input("cor_struct"), "unstructured" ) + testthat::expect_equal(app_driver$get_active_module_input("cor_struct"), "unstructured") - radio_buttons <- app_driver$active_module_element_text("output_table") - testthat::expect_match( - radio_buttons, - "Output Type.*LS means.*Covariance.*Coefficients", - fixed = FALSE - ) - app_driver$stop() -}) + radio_buttons <- app_driver$active_module_element_text("output_table") + testthat::expect_match( + radio_buttons, + "Output Type.*LS means.*Covariance.*Coefficients", + fixed = FALSE + ) + app_driver$stop() + } +) testthat::test_that("e2e - tm_a_gee: Selection of id_var changes the table and does not throw validation errors.", { skip_if_too_deep(5) From 885f54b77d53ddd8515949bc9f061f58f9208b02 Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Fri, 26 Apr 2024 12:50:13 +0200 Subject: [PATCH 15/18] 1108 shinytest2 tm a gee@shinytest2@main (#1142) Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com> Co-authored-by: kartikeya kirar --- tests/testthat/test-shinytest2-tm_a_gee.R | 35 ++++++----------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index 04cd396559..35ce0c2778 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -103,16 +103,18 @@ testthat::test_that( } ) -testthat::test_that("e2e - tm_a_gee: Selection of id_var changes the table and does not throw validation errors.", { +testthat::test_that( + "e2e - tm_a_gee: Selection of id_var does not change the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() table_before <- app_driver$get_active_module_tws_output("table") app_driver$set_active_module_input("id_var-dataset_ADQS_singleextract-select", "SUBJID") - testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) + testthat::expect_true(identical(table_before, app_driver$get_active_module_tws_output("table"))) app_driver$expect_no_validation_error() app_driver$stop() }) + testthat::test_that("e2e - tm_a_gee: Deselection of id_var throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() @@ -150,7 +152,6 @@ testthat::test_that("e2e - tm_a_gee: Deselection of arm_var throws validation er app_driver$stop() }) - testthat::test_that("e2e - tm_a_gee: Selection of visit_var changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() @@ -165,6 +166,7 @@ testthat::test_that("e2e - tm_a_gee: Deselection of visit_var throws validation skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() app_driver$set_active_module_input("visit_var-dataset_ADQS_singleextract-select", character(0)) + app_driver$wait_for_idle() testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) app_driver$expect_validation_error() testthat::expect_equal( @@ -207,19 +209,6 @@ testthat::test_that("e2e - tm_a_gee: Selection of cov_var changes the table and app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: Deselection of cov_var throws validation error.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - app_driver$set_active_module_input("cov_var-dataset_ADQS_singleextract-select", character(0)) - testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) - app_driver$expect_validation_error() - testthat::expect_equal( - app_driver$active_module_element_text("cov_var-dataset_ADQS_singleextract-select_input > div > span"), - "An endpoint is required" - ) - app_driver$stop() -}) - testthat::test_that("e2e - tm_a_gee: Selection of conf_level changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() @@ -257,7 +246,6 @@ testthat::test_that("e2e - tm_a_gee: Deselection of conf_level throws validation app_driver$stop() }) - testthat::test_that("e2e - tm_a_gee: Selection of cor_struct changes the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() @@ -268,21 +256,14 @@ testthat::test_that("e2e - tm_a_gee: Selection of cor_struct changes the table a app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: Deselection of cor_struct throws validation error.", { +testthat::test_that("e2e - tm_a_gee: Deselection of cor_struct does not throw validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - app_driver$set_active_module_input("cor_struct", character(0)) - testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) - # TO BE FIXED - there is no error displayed - app_driver$expect_validation_error() - testthat::expect_equal( - app_driver$active_module_element_text("cov_struct_input > div > span"), - "Please choose a correlation structure" - ) + app_driver$set_active_module_input("cor_struct", character(0)) #shows enourmous warning message + app_driver$expect_no_validation_error() app_driver$stop() }) - testthat::test_that("e2e - tm_a_gee: Selection of output_table changes the table and doesn't throw validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() From b6da85b396e2315d0d0ebab556d7b3c1097aa2a1 Mon Sep 17 00:00:00 2001 From: m7pr Date: Fri, 26 Apr 2024 12:57:02 +0200 Subject: [PATCH 16/18] this is insane --- tests/testthat/test-shinytest2-tm_a_gee.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index 35ce0c2778..e1dd6954f4 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -114,7 +114,6 @@ testthat::test_that( app_driver$stop() }) - testthat::test_that("e2e - tm_a_gee: Deselection of id_var throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() @@ -152,12 +151,13 @@ testthat::test_that("e2e - tm_a_gee: Deselection of arm_var throws validation er app_driver$stop() }) -testthat::test_that("e2e - tm_a_gee: Selection of visit_var changes the table and does not throw validation errors.", { +testthat::test_that( + "e2e - tm_a_gee: Selection of visit_var does not change the table and does not throw validation errors.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() table_before <- app_driver$get_active_module_tws_output("table") app_driver$set_active_module_input("visit_var-dataset_ADQS_singleextract-select", "AVISITN") - testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) + testthat::expect_true(identical(table_before, app_driver$get_active_module_tws_output("table"))) app_driver$expect_no_validation_error() app_driver$stop() }) From bd3e0044334759c5409c4e71789053586844bc79 Mon Sep 17 00:00:00 2001 From: m7pr Date: Fri, 26 Apr 2024 14:43:03 +0200 Subject: [PATCH 17/18] running styler::style_file("tests/testthat/test-shinytest2-tm_a_gee.R") --- tests/testthat/test-shinytest2-tm_a_gee.R | 42 +++++++++++++---------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index e1dd6954f4..65ce9a7284 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -104,15 +104,17 @@ testthat::test_that( ) testthat::test_that( - "e2e - tm_a_gee: Selection of id_var does not change the table and does not throw validation errors.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("id_var-dataset_ADQS_singleextract-select", "SUBJID") - testthat::expect_true(identical(table_before, app_driver$get_active_module_tws_output("table"))) - app_driver$expect_no_validation_error() - app_driver$stop() -}) + "e2e - tm_a_gee: Selection of id_var does not change the table and does not throw validation errors.", + { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + table_before <- app_driver$get_active_module_tws_output("table") + app_driver$set_active_module_input("id_var-dataset_ADQS_singleextract-select", "SUBJID") + testthat::expect_true(identical(table_before, app_driver$get_active_module_tws_output("table"))) + app_driver$expect_no_validation_error() + app_driver$stop() + } +) testthat::test_that("e2e - tm_a_gee: Deselection of id_var throws validation error.", { skip_if_too_deep(5) @@ -152,15 +154,17 @@ testthat::test_that("e2e - tm_a_gee: Deselection of arm_var throws validation er }) testthat::test_that( - "e2e - tm_a_gee: Selection of visit_var does not change the table and does not throw validation errors.", { - skip_if_too_deep(5) - app_driver <- app_driver_tm_a_gee() - table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("visit_var-dataset_ADQS_singleextract-select", "AVISITN") - testthat::expect_true(identical(table_before, app_driver$get_active_module_tws_output("table"))) - app_driver$expect_no_validation_error() - app_driver$stop() -}) + "e2e - tm_a_gee: Selection of visit_var does not change the table and does not throw validation errors.", + { + skip_if_too_deep(5) + app_driver <- app_driver_tm_a_gee() + table_before <- app_driver$get_active_module_tws_output("table") + app_driver$set_active_module_input("visit_var-dataset_ADQS_singleextract-select", "AVISITN") + testthat::expect_true(identical(table_before, app_driver$get_active_module_tws_output("table"))) + app_driver$expect_no_validation_error() + app_driver$stop() + } +) testthat::test_that("e2e - tm_a_gee: Deselection of visit_var throws validation error.", { skip_if_too_deep(5) @@ -259,7 +263,7 @@ testthat::test_that("e2e - tm_a_gee: Selection of cor_struct changes the table a testthat::test_that("e2e - tm_a_gee: Deselection of cor_struct does not throw validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - app_driver$set_active_module_input("cor_struct", character(0)) #shows enourmous warning message + app_driver$set_active_module_input("cor_struct", character(0)) # shows enourmous warning message app_driver$expect_no_validation_error() app_driver$stop() }) From 4febb76d61fb3a67e9a0199fcf205f979d2d5167 Mon Sep 17 00:00:00 2001 From: m7pr Date: Fri, 26 Apr 2024 15:43:44 +0200 Subject: [PATCH 18/18] use ns_des_input --- tests/testthat/test-shinytest2-tm_a_gee.R | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/testthat/test-shinytest2-tm_a_gee.R b/tests/testthat/test-shinytest2-tm_a_gee.R index 65ce9a7284..fc7c9ef347 100644 --- a/tests/testthat/test-shinytest2-tm_a_gee.R +++ b/tests/testthat/test-shinytest2-tm_a_gee.R @@ -61,26 +61,26 @@ testthat::test_that( ) testthat::expect_equal( - app_driver$get_active_module_input("aval_var-dataset_ADQS_singleextract-select"), + app_driver$get_active_module_input(ns_des_input("aval_var", "ADQS", "select")), "AVALBIN" ) testthat::expect_equal( - app_driver$get_active_module_input("id_var-dataset_ADQS_singleextract-select"), + app_driver$get_active_module_input(ns_des_input("id_var", "ADQS", "select")), "USUBJID" ) testthat::expect_equal( - app_driver$get_active_module_input("arm_var-dataset_ADSL_singleextract-select"), + app_driver$get_active_module_input(ns_des_input("arm_var", "ADSL", "select")), "ARM" ) testthat::expect_equal( - app_driver$get_active_module_input("visit_var-dataset_ADQS_singleextract-select"), + app_driver$get_active_module_input(ns_des_input("visit_var", "ADQS", "select")), "AVISIT" ) testthat::expect_equal( - app_driver$get_active_module_input("paramcd-dataset_ADQS_singleextract-filter1-vals"), + app_driver$get_active_module_input(ns_des_input("paramcd", "ADQS", "filter1-vals")), "FKSI-FWB" ) @@ -109,7 +109,7 @@ testthat::test_that( skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("id_var-dataset_ADQS_singleextract-select", "SUBJID") + app_driver$set_active_module_input(ns_des_input("id_var", "ADQS", "select"), "SUBJID") testthat::expect_true(identical(table_before, app_driver$get_active_module_tws_output("table"))) app_driver$expect_no_validation_error() app_driver$stop() @@ -119,7 +119,7 @@ testthat::test_that( testthat::test_that("e2e - tm_a_gee: Deselection of id_var throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - app_driver$set_active_module_input("id_var-dataset_ADQS_singleextract-select", character(0)) + app_driver$set_active_module_input(ns_des_input("id_var", "ADQS", "select"), character(0)) testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) app_driver$expect_validation_error() testthat::expect_equal( @@ -134,7 +134,7 @@ testthat::test_that("e2e - tm_a_gee: Change in arm_var changes the table and doe app_driver <- app_driver_tm_a_gee() table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("arm_var-dataset_ADSL_singleextract-select", "ARMCD") + app_driver$set_active_module_input(ns_des_input("arm_var", "ADSL", "select"), "ARMCD") testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) app_driver$expect_no_validation_error() app_driver$stop() @@ -143,7 +143,7 @@ testthat::test_that("e2e - tm_a_gee: Change in arm_var changes the table and doe testthat::test_that("e2e - tm_a_gee: Deselection of arm_var throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - app_driver$set_active_module_input("arm_var-dataset_ADSL_singleextract-select", character(0)) + app_driver$set_active_module_input(ns_des_input("arm_var", "ADSL", "select"), character(0)) testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) app_driver$expect_validation_error() testthat::expect_equal( @@ -159,7 +159,7 @@ testthat::test_that( skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("visit_var-dataset_ADQS_singleextract-select", "AVISITN") + app_driver$set_active_module_input(ns_des_input("visit_var", "ADQS", "select"), "AVISITN") testthat::expect_true(identical(table_before, app_driver$get_active_module_tws_output("table"))) app_driver$expect_no_validation_error() app_driver$stop() @@ -169,7 +169,7 @@ testthat::test_that( testthat::test_that("e2e - tm_a_gee: Deselection of visit_var throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - app_driver$set_active_module_input("visit_var-dataset_ADQS_singleextract-select", character(0)) + app_driver$set_active_module_input(ns_des_input("visit_var", "ADQS", "select"), character(0)) app_driver$wait_for_idle() testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) app_driver$expect_validation_error() @@ -184,7 +184,7 @@ testthat::test_that("e2e - tm_a_gee: Selection of paramcd changes the table and skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() table_before <- app_driver$get_active_module_tws_output("table") - app_driver$set_active_module_input("paramcd-dataset_ADQS_singleextract-filter1-vals", "BFIALL") + app_driver$set_active_module_input(ns_des_input("paramcd", "ADQS", "filter1-vals"), "BFIALL") testthat::expect_false(identical(table_before, app_driver$get_active_module_tws_output("table"))) app_driver$expect_no_validation_error() app_driver$stop() @@ -193,7 +193,7 @@ testthat::test_that("e2e - tm_a_gee: Selection of paramcd changes the table and testthat::test_that("e2e - tm_a_gee: Deselection of paramcd throws validation error.", { skip_if_too_deep(5) app_driver <- app_driver_tm_a_gee() - app_driver$set_active_module_input("paramcd-dataset_ADQS_singleextract-filter1-vals", character(0)) + app_driver$set_active_module_input(ns_des_input("paramcd", "ADQS", "filter1-vals"), character(0)) testthat::expect_identical(app_driver$get_active_module_tws_output("table"), data.frame()) app_driver$expect_validation_error() testthat::expect_equal(