diff --git a/tests/testthat/helper-TealAppDriver.R b/tests/testthat/helper-TealAppDriver.R index b28850e396..ca20b142ee 100644 --- a/tests/testthat/helper-TealAppDriver.R +++ b/tests/testthat/helper-TealAppDriver.R @@ -23,3 +23,18 @@ init_teal_app_driver <- function(...) { .package = "teal" ) } + + +# TODO: This will be moved to the `TealAppDriver` class. +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_g_forest_tte copy.R b/tests/testthat/test-shinytest2-tm_g_forest_tte copy.R new file mode 100644 index 0000000000..efc81d2bfe --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_g_forest_tte copy.R @@ -0,0 +1,77 @@ +app_driver_tm_g_ipp <- function() { + data <- teal_data() %>% + within({ + library(nestcolor) + library(dplyr) + ADSL <- tmc_ex_adsl %>% + slice(1:20) %>% + df_explicit_na() + ADLB <- tmc_ex_adlb %>% + filter(USUBJID %in% ADSL$USUBJID) %>% + df_explicit_na() %>% + filter(AVISIT != "SCREENING") + }) + + datanames <- c("ADSL", "ADLB") + teal.data::datanames(data) <- datanames + teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[datanames] + + init_teal_app_driver( + data = data, + modules = teal::modules( + tm_g_ipp( + label = "Individual Patient Plot", + dataname = "ADLB", + arm_var = teal.transform::choices_selected( + teal.transform::value_choices(data[["ADLB"]], "ARMCD"), + "ARM A" + ), + paramcd = teal.transform::choices_selected( + teal.transform::value_choices(data[["ADLB"]], "PARAMCD"), + "ALT" + ), + aval_var = teal.transform::choices_selected( + teal.transform::variable_choices(data[["ADLB"]], c("AVAL", "CHG")), + "AVAL" + ), + avalu_var = teal.transform::choices_selected( + teal.transform::variable_choices(data[["ADLB"]], c("AVALU")), + "AVALU", + fixed = TRUE + ), + id_var = teal.transform::choices_selected( + teal.transform::variable_choices(data[["ADLB"]], c("USUBJID")), + "USUBJID", + fixed = TRUE + ), + visit_var = teal.transform::choices_selected( + teal.transform::variable_choices(data[["ADLB"]], c("AVISIT")), + "AVISIT" + ), + baseline_var = teal.transform::choices_selected( + teal.transform::variable_choices(data[["ADLB"]], c("BASE")), + "BASE", + fixed = TRUE + ), + add_baseline_hline = FALSE, + separate_by_obs = FALSE + ) + ) + ) +} + +testthat::test_that("e2e - tm_g_ipp: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_g_ipp() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + testthat::expect_match( + app_driver$get_attr( + app_driver$active_module_element("myplot-plot_main > img"), + "src" + ), + "data:image/png;base64," + ) + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_g_forest_tte.R b/tests/testthat/test-shinytest2-tm_g_forest_tte.R new file mode 100644 index 0000000000..6772661bc7 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_g_forest_tte.R @@ -0,0 +1,69 @@ +app_driver_tm_g_forest_tte <- function() { + data <- teal.data::teal_data() %>% + within({ + library(nestcolor) + library(formatters) + + ADSL <- tmc_ex_adsl + ADTTE <- tmc_ex_adtte + ADSL$RACE <- droplevels(ADSL$RACE) %>% + with_label("Race") + }) + datanames <- c("ADSL", "ADTTE") + teal.data::datanames(data) <- datanames + teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[datanames] + + arm_ref_comp <- list( + ARM = list( + ref = "B: Placebo", + comp = c("A: Drug X", "C: Combination") + ), + ARMCD = list( + ref = "ARM B", + comp = c("ARM A", "ARM C") + ) + ) + + init_teal_app_driver( + data = data, + modules = teal::modules( + tm_g_forest_tte( + label = "Forest Survival", + dataname = "ADTTE", + arm_var = teal.transform::choices_selected( + teal.transform::variable_choices(data[["ADSL"]], c("ARM", "ARMCD")), + "ARMCD" + ), + arm_ref_comp = arm_ref_comp, + paramcd = teal.transform::choices_selected( + teal.transform::value_choices(data[["ADTTE"]], "PARAMCD", "PARAM"), + "OS" + ), + subgroup_var = teal.transform::choices_selected( + teal.transform::variable_choices(data[["ADSL"]], names(data[["ADSL"]])), + c("BMRKR2", "SEX") + ), + strata_var = teal.transform::choices_selected( + teal.transform::variable_choices(data[["ADSL"]], c("STRATA1", "STRATA2")), + "STRATA2" + ) + ) + ) + ) +} + +testthat::test_that("e2e - tm_g_forest_tte: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_g_forest_tte() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + testthat::expect_match( + app_driver$get_attr( + app_driver$active_module_element("myplot-plot_main > img"), + "src" + ), + "data:image/png;base64," + ) + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_g_km.R b/tests/testthat/test-shinytest2-tm_g_km.R new file mode 100644 index 0000000000..5bac87a8ac --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_g_km.R @@ -0,0 +1,65 @@ +app_driver_tm_g_km <- function() { + data <- teal.data::teal_data() %>% + within({ + ADSL <- tmc_ex_adsl + ADTTE <- tmc_ex_adtte + }) + + datanames <- c("ADSL", "ADTTE") + teal.data::datanames(data) <- datanames + teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[datanames] + + arm_ref_comp <- list( + ACTARMCD = list( + ref = "ARM B", + comp = c("ARM A", "ARM C") + ), + ARM = list( + ref = "B: Placebo", + comp = c("A: Drug X", "C: Combination") + ) + ) + + init_teal_app_driver( + data = data, + modules = teal::modules( + tm_g_km( + label = "Kaplan-Meier Plot", + dataname = "ADTTE", + arm_var = teal.transform::choices_selected( + teal.transform::variable_choices(data[["ADSL"]], c("ARM", "ARMCD", "ACTARMCD")), + "ARM" + ), + paramcd = teal.transform::choices_selected( + teal.transform::value_choices(data[["ADTTE"]], "PARAMCD", "PARAM"), + "OS" + ), + arm_ref_comp = arm_ref_comp, + strata_var = teal.transform::choices_selected( + teal.transform::variable_choices(data[["ADSL"]], c("SEX", "BMRKR2")), + "SEX" + ), + facet_var = teal.transform::choices_selected( + teal.transform::variable_choices(data[["ADSL"]], c("SEX", "BMRKR2")), + NULL + ) + ) + ) + ) +} + +testthat::test_that("e2e - tm_g_km: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_g_km() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + testthat::expect_match( + app_driver$get_attr( + app_driver$active_module_element("myplot-plot_main > img"), + "src" + ), + "data:image/png;base64," + ) + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_g_lineplot.R b/tests/testthat/test-shinytest2-tm_g_lineplot.R new file mode 100644 index 0000000000..dbf02b4ba9 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_g_lineplot.R @@ -0,0 +1,53 @@ +app_driver_tm_g_lineplot <- function() { + data <- teal.data::teal_data() %>% + within({ + library(dplyr) + library(forcats) + + ADSL <- tmc_ex_adsl + ADLB <- tmc_ex_adlb %>% + mutate(AVISIT == fct_reorder(AVISIT, AVISITN, min)) + }) + + datanames <- c("ADSL", "ADLB") + teal.data::datanames(data) <- datanames + teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[datanames] + + init_teal_app_driver( + data = data, + modules = teal::modules( + tm_g_lineplot( + label = "Line Plot", + dataname = "ADLB", + strata = teal.transform::choices_selected( + teal.transform::variable_choices(data[["ADSL"]], c("ARM", "ARMCD", "ACTARMCD")), + "ARM" + ), + y = teal.transform::choices_selected( + teal.transform::variable_choices(data[["ADLB"]], c("AVAL", "BASE", "CHG", "PCHG")), + "AVAL" + ), + param = teal.transform::choices_selected( + teal.transform::value_choices(data[["ADLB"]], "PARAMCD", "PARAM"), + "ALT" + ) + ) + ) + ) +} + +testthat::test_that("e2e - tm_g_lineplot: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_g_lineplot() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + testthat::expect_match( + app_driver$get_attr( + app_driver$active_module_element("myplot-plot_main > img"), + "src" + ), + "data:image/png;base64," + ) + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_g_pp_adverse_events.R b/tests/testthat/test-shinytest2-tm_g_pp_adverse_events.R new file mode 100644 index 0000000000..55fbddb8f4 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_g_pp_adverse_events.R @@ -0,0 +1,70 @@ +app_driver_tm_g_pp_adverse_events <- function() { # nolint: object_length + data <- teal.data::teal_data() %>% + within({ + library(dplyr) + ADAE <- tmc_ex_adae + ADSL <- tmc_ex_adsl %>% + filter(USUBJID %in% ADAE$USUBJID) + }) + + datanames <- c("ADSL", "ADAE") + teal.data::datanames(data) <- datanames + teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[datanames] + + init_teal_app_driver( + data = data, + modules = teal::modules( + tm_g_pp_adverse_events( + label = "Adverse Events", + dataname = "ADAE", + parentname = "ADSL", + patient_col = "USUBJID", + plot_height = c(600L, 200L, 2000L), + aeterm = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADAE"]], "AETERM"), + selected = "AETERM" + ), + tox_grade = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADAE"]], "AETOXGR"), + selected = "AETOXGR" + ), + causality = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADAE"]], "AEREL"), + selected = "AEREL" + ), + outcome = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADAE"]], "AEOUT"), + selected = "AEOUT" + ), + action = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADAE"]], "AEACN"), + selected = "AEACN" + ), + time = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADAE"]], "ASTDY"), + selected = "ASTDY" + ), + decod = NULL + ) + ) + ) +} + +testthat::test_that( + "e2e - tm_g_pp_adverse_events: Module initializes in teal without errors and produces plot output.", + { + skip_if_too_deep(5) + app_driver <- app_driver_tm_g_pp_adverse_events() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + testthat::expect_match( + app_driver$get_attr( + app_driver$active_module_element("myplot-plot_main > img"), + "src" + ), + "data:image/png;base64," + ) + app_driver$stop() + } +) diff --git a/tests/testthat/test-shinytest2-tm_g_pp_patient_timeline.R b/tests/testthat/test-shinytest2-tm_g_pp_patient_timeline.R new file mode 100644 index 0000000000..6abd2f1427 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_g_pp_patient_timeline.R @@ -0,0 +1,19 @@ +app_driver_tm_g_km <- function() { + +} + +testthat::test_that("e2e - tm_g_km: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_g_km() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + testthat::expect_match( + app_driver$get_attr( + app_driver$active_module_element("myplot-plot_main > img"), + "src" + ), + "data:image/png;base64," + ) + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_g_pp_therapy.R b/tests/testthat/test-shinytest2-tm_g_pp_therapy.R new file mode 100644 index 0000000000..e10da4ad8e --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_g_pp_therapy.R @@ -0,0 +1,86 @@ +# Error +app_driver_tm_g_pp_therapy <- function() { + data <- teal.data::teal_data() %>% + within({ + library(dplyr) + ADCM <- tmc_ex_adcm + ADSL <- tmc_ex_adsl %>% + filter(USUBJID %in% ADCM$USUBJID) + ADCM$CMASTDTM <- ADCM$ASTDTM + ADCM$CMAENDTM <- ADCM$AENDTM + adcm_keys <- c("STUDYID", "USUBJID", "ASTDTM", "CMSEQ", "ATC1", "ATC2", "ATC3", "ATC4") + }) + + datanames <- c("ADSL", "ADCM") + teal.data::datanames(data) <- datanames + teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[datanames] + + init_teal_app_driver( + data = data, + modules = teal::modules( + tm_g_pp_therapy( + label = "Therapy", + dataname = "ADCM", + parentname = "ADSL", + patient_col = "USUBJID", + plot_height = c(600L, 200L, 2000L), + atirel = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADCM"]], "ATIREL"), + selected = c("ATIREL") + ), + cmdecod = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADCM"]], "CMDECOD"), + selected = "CMDECOD" + ), + cmindc = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADCM"]], "CMINDC"), + selected = "CMINDC" + ), + cmdose = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADCM"]], "CMDOSE"), + selected = "CMDOSE" + ), + cmtrt = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADCM"]], "CMTRT"), + selected = "CMTRT" + ), + cmdosu = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADCM"]], "CMDOSU"), + selected = c("CMDOSU") + ), + cmroute = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADCM"]], "CMROUTE"), + selected = "CMROUTE" + ), + cmdosfrq = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADCM"]], "CMDOSFRQ"), + selected = "CMDOSFRQ" + ), + cmstdy = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADCM"]], "ASTDY"), + selected = "ASTDY" + ), + cmendy = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADCM"]], "AENDY"), + selected = "AENDY" + ) + ) + ) + ) +} + +testthat::test_that("e2e - tm_g_pp_therapy: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_g_pp_therapy() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + testthat::expect_match( + app_driver$get_attr( + app_driver$active_module_element("myplot-plot_main > img"), + "src" + ), + "data:image/png;base64," + ) + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_g_pp_vitals.R b/tests/testthat/test-shinytest2-tm_g_pp_vitals.R new file mode 100644 index 0000000000..6abd2f1427 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_g_pp_vitals.R @@ -0,0 +1,19 @@ +app_driver_tm_g_km <- function() { + +} + +testthat::test_that("e2e - tm_g_km: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_g_km() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + testthat::expect_match( + app_driver$get_attr( + app_driver$active_module_element("myplot-plot_main > img"), + "src" + ), + "data:image/png;base64," + ) + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_abnormality.R b/tests/testthat/test-shinytest2-tm_t_abnormality.R new file mode 100644 index 0000000000..d39f3ab80e --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_abnormality.R @@ -0,0 +1,61 @@ +app_driver_tm_t_abnormality <- function() { + data <- teal.data::teal_data() + data <- within(data, { + library(dplyr) + + ADSL <- tmc_ex_adsl + ADLB <- tmc_ex_adlb %>% + mutate( + ONTRTFL = case_when( + AVISIT %in% c("SCREENING", "BASELINE") ~ "", + TRUE ~ "Y" + ) %>% with_label("On Treatment Record Flag") + ) + }) + datanames <- c("ADSL", "ADLB") + teal.data::datanames(data) <- datanames + teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[datanames] + + init_teal_app_driver( + data = data, + modules = teal::modules( + tm_t_abnormality( + label = "Abnormality Table", + dataname = "ADLB", + arm_var = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADSL"]], subset = c("ARM", "ARMCD")), + selected = "ARM" + ), + add_total = FALSE, + by_vars = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADLB"]], subset = c("LBCAT", "PARAM", "AVISIT")), + selected = c("LBCAT", "PARAM"), + keep_order = TRUE + ), + baseline_var = teal.transform::choices_selected( + teal.transform::variable_choices(data[["ADLB"]], subset = "BNRIND"), + selected = "BNRIND", fixed = TRUE + ), + grade = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADLB"]], subset = "ANRIND"), + selected = "ANRIND", + fixed = TRUE + ), + abnormal = list(low = "LOW", high = "HIGH"), + exclude_base_abn = FALSE + ) + ) + ) +} + +testthat::test_that("e2e - tm_t_abnormality: Module initializes in teal without errors and produces table output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_abnormality() + 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() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_abnormality_by_worst_grade.R b/tests/testthat/test-shinytest2-tm_t_abnormality_by_worst_grade.R new file mode 100644 index 0000000000..7226eb3212 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_abnormality_by_worst_grade.R @@ -0,0 +1,52 @@ +app_driver_tm_t_abnormality_by_worst_grade <- function() { # nolint: object_length + data <- teal.data::teal_data() %>% + within({ + library(dplyr) + + ADSL <- tmc_ex_adsl + ADLB <- tmc_ex_adlb %>% + filter(!AVISIT %in% c("SCREENING", "BASELINE")) + }) + + datanames <- c("ADSL", "ADLB") + teal.data::datanames(data) <- datanames + teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[datanames] + + init_teal_app_driver( + data = data, + modules = teal::modules( + tm_t_abnormality_by_worst_grade( + label = "Laboratory Test Results with Highest Grade Post-Baseline", + dataname = "ADLB", + arm_var = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADSL"]], subset = c("ARM", "ARMCD")), + selected = "ARM" + ), + paramcd = teal.transform::choices_selected( + choices = teal.transform::value_choices(data[["ADLB"]], "PARAMCD", "PARAM"), + selected = c("ALT", "CRP", "IGA") + ), + add_total = FALSE + ) + ), + filter = teal::teal_slices( + teal.slice::teal_slice("ADSL", "SAFFL", selected = "Y"), + teal.slice::teal_slice("ADLB", "ONTRTFL", selected = "Y") + ) + ) +} + +testthat::test_that( + "e2e - tm_t_abnormality_by_worst_grade: Module initializes in teal without errors and produces table output.", + { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_abnormality_by_worst_grade() + 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() + } +) diff --git a/tests/testthat/test-shinytest2-tm_t_ancova.R b/tests/testthat/test-shinytest2-tm_t_ancova.R new file mode 100644 index 0000000000..f2b21f3ae0 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_ancova.R @@ -0,0 +1,69 @@ +app_driver_tm_t_ancova <- function() { + data <- teal.data::teal_data() %>% + within({ + ADSL <- tmc_ex_adsl + ADQS <- tmc_ex_adqs + }) + + datanames <- c("ADSL", "ADQS") + teal.data::datanames(data) <- datanames + teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[datanames] + + arm_ref_comp <- list( + ARM = list( + ref = "B: Placebo", + comp = c("A: Drug X", "C: Combination") + ), + ACTARMCD = list( + ref = "ARM B", + comp = c("ARM A", "ARM C") + ) + ) + + init_teal_app_driver( + data = data, + modules = teal::modules( + tm_t_ancova( + label = "ANCOVA Table", + dataname = "ADQS", + avisit = teal.transform::choices_selected( + choices = teal.transform::value_choices(data[["ADQS"]], "AVISIT"), + selected = "WEEK 1 DAY 8" + ), + arm_var = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADSL"]], c("ARM", "ACTARMCD", "ARMCD")), + selected = "ARMCD" + ), + arm_ref_comp = arm_ref_comp, + aval_var = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADQS"]], c("CHG", "AVAL")), + selected = "CHG" + ), + cov_var = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADQS"]], c("BASE", "STRATA1", "SEX")), + selected = "STRATA1" + ), + paramcd = teal.transform::choices_selected( + choices = teal.transform::value_choices(data[["ADQS"]], "PARAMCD", "PARAM"), + selected = "FKSI-FWB" + ), + interact_var = teal.transform::choices_selected( + choices = teal.transform::variable_choices(data[["ADQS"]], c("BASE", "STRATA1", "SEX")), + selected = "STRATA1" + ) + ) + ) + ) +} + +testthat::test_that("e2e - tm_t_ancova: Module initializes in teal without errors and produces table output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_ancova() + 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() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_binary_outcome.R b/tests/testthat/test-shinytest2-tm_t_binary_outcome.R new file mode 100644 index 0000000000..8f46115ca6 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_binary_outcome.R @@ -0,0 +1,12 @@ +app_driver_tm_t_binary_outcome <- function() { + +} + +testthat::test_that("e2e - tm_t_binary_outcome: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_binary_outcome() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_coxreg.R b/tests/testthat/test-shinytest2-tm_t_coxreg.R new file mode 100644 index 0000000000..6abd2f1427 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_coxreg.R @@ -0,0 +1,19 @@ +app_driver_tm_g_km <- function() { + +} + +testthat::test_that("e2e - tm_g_km: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_g_km() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + testthat::expect_match( + app_driver$get_attr( + app_driver$active_module_element("myplot-plot_main > img"), + "src" + ), + "data:image/png;base64," + ) + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_events.R b/tests/testthat/test-shinytest2-tm_t_events.R new file mode 100644 index 0000000000..6c93cc6cd6 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_events.R @@ -0,0 +1,12 @@ +app_driver_tm_t_events <- function() { + +} + +testthat::test_that("e2e - tm_t_events: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_events() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_events_by_grade.R b/tests/testthat/test-shinytest2-tm_t_events_by_grade.R new file mode 100644 index 0000000000..9176a4058e --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_events_by_grade.R @@ -0,0 +1,12 @@ +app_driver_tm_t_events_by_grade <- function() { + +} + +testthat::test_that("e2e - tm_t_events_by_grade: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_events_by_grade() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_events_patyear.R b/tests/testthat/test-shinytest2-tm_t_events_patyear.R new file mode 100644 index 0000000000..3d5731903f --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_events_patyear.R @@ -0,0 +1,12 @@ +app_driver_tm_t_events_patyear <- function() { + +} + +testthat::test_that("e2e - tm_t_events_patyear: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_events_patyear() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_events_summary.R b/tests/testthat/test-shinytest2-tm_t_events_summary.R new file mode 100644 index 0000000000..9c7b76e735 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_events_summary.R @@ -0,0 +1,12 @@ +app_driver_tm_t_events_summary <- function() { + +} + +testthat::test_that("e2e - tm_t_events_summary: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_events_summary() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_exposure.R b/tests/testthat/test-shinytest2-tm_t_exposure.R new file mode 100644 index 0000000000..82bcd2ae53 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_exposure.R @@ -0,0 +1,12 @@ +app_driver_tm_t_exposure <- function() { + +} + +testthat::test_that("e2e - tm_t_exposure: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_exposure() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_logistic.R b/tests/testthat/test-shinytest2-tm_t_logistic.R new file mode 100644 index 0000000000..1ed65db570 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_logistic.R @@ -0,0 +1,12 @@ +app_driver_tm_t_logistic <- function() { + +} + +testthat::test_that("e2e - tm_t_logistic: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_logistic() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_mult_events.R b/tests/testthat/test-shinytest2-tm_t_mult_events.R new file mode 100644 index 0000000000..f871cefbbb --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_mult_events.R @@ -0,0 +1,12 @@ +app_driver_tm_t_mult_events <- function() { + +} + +testthat::test_that("e2e - tm_t_mult_events: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_mult_events() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_pp_basic_info.R b/tests/testthat/test-shinytest2-tm_t_pp_basic_info.R new file mode 100644 index 0000000000..a9ef25f3e4 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_pp_basic_info.R @@ -0,0 +1,12 @@ +app_driver_tm_t_pp_basic_info <- function() { + +} + +testthat::test_that("e2e - tm_t_pp_basic_info: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_pp_basic_info() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_pp_laboratory.R b/tests/testthat/test-shinytest2-tm_t_pp_laboratory.R new file mode 100644 index 0000000000..2d4df6f817 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_pp_laboratory.R @@ -0,0 +1,12 @@ +app_driver_tm_t_pp_laboratory <- function() { + +} + +testthat::test_that("e2e - tm_t_pp_laboratory: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_pp_laboratory() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_pp_medical_history.R b/tests/testthat/test-shinytest2-tm_t_pp_medical_history.R new file mode 100644 index 0000000000..dffd5217a2 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_pp_medical_history.R @@ -0,0 +1,14 @@ +app_driver_tm_t_pp_medical_history <- function() { # nolint: object_length +} + +testthat::test_that( + "e2e - tm_t_pp_medical_history: Module initializes in teal without errors and produces plot output.", + { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_pp_medical_history() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() + } +) diff --git a/tests/testthat/test-shinytest2-tm_t_pp_prior_medication.R b/tests/testthat/test-shinytest2-tm_t_pp_prior_medication.R new file mode 100644 index 0000000000..f2f61c99c3 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_pp_prior_medication.R @@ -0,0 +1,14 @@ +app_driver_tm_t_pp_prior_medication <- function() { # nolint: object_length +} + +testthat::test_that( + "e2e - tm_t_pp_prior_medication: Module initializes in teal without errors and produces plot output.", + { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_pp_prior_medication() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() + } +) diff --git a/tests/testthat/test-shinytest2-tm_t_shift_by_arm.R b/tests/testthat/test-shinytest2-tm_t_shift_by_arm.R new file mode 100644 index 0000000000..43b85288de --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_shift_by_arm.R @@ -0,0 +1,12 @@ +app_driver_tm_t_shift_by_arm <- function() { + +} + +testthat::test_that("e2e - tm_t_shift_by_arm: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_shift_by_arm() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_shift_by_arm_by_worst.R b/tests/testthat/test-shinytest2-tm_t_shift_by_arm_by_worst.R new file mode 100644 index 0000000000..8e842dbb51 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_shift_by_arm_by_worst.R @@ -0,0 +1,15 @@ +app_driver_tm_t_shift_by_arm_by_worst <- function() { + +} + +testthat::test_that( + "e2e - tm_t_shift_by_arm_by_worst: Module initializes in teal without errors and produces plot output.", + { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_shift_by_arm_by_worst() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() + } +) diff --git a/tests/testthat/test-shinytest2-tm_t_shift_by_grade.R b/tests/testthat/test-shinytest2-tm_t_shift_by_grade.R new file mode 100644 index 0000000000..52deee1719 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_shift_by_grade.R @@ -0,0 +1,12 @@ +app_driver_tm_t_shift_by_grade <- function() { + +} + +testthat::test_that("e2e - tm_t_shift_by_grade: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_shift_by_grade() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_smq.R b/tests/testthat/test-shinytest2-tm_t_smq.R new file mode 100644 index 0000000000..d2c128fdf4 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_smq.R @@ -0,0 +1,12 @@ +app_driver_tm_t_smq <- function() { + +} + +testthat::test_that("e2e - tm_t_smq: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_smq() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_summary.R b/tests/testthat/test-shinytest2-tm_t_summary.R new file mode 100644 index 0000000000..69249c8580 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_summary.R @@ -0,0 +1,12 @@ +app_driver_tm_t_summary <- function() { + +} + +testthat::test_that("e2e - tm_t_summary: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_summary() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_summary_by.R b/tests/testthat/test-shinytest2-tm_t_summary_by.R new file mode 100644 index 0000000000..789f0b1304 --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_summary_by.R @@ -0,0 +1,12 @@ +app_driver_tm_t_summary_by <- function() { + +} + +testthat::test_that("e2e - tm_t_summary_by: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_summary_by() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +}) diff --git a/tests/testthat/test-shinytest2-tm_t_tte.R b/tests/testthat/test-shinytest2-tm_t_tte.R new file mode 100644 index 0000000000..ecdd08a44f --- /dev/null +++ b/tests/testthat/test-shinytest2-tm_t_tte.R @@ -0,0 +1,12 @@ +app_driver_tm_t_tte <- function() { + +} + +testthat::test_that("e2e - tm_t_tte: Module initializes in teal without errors and produces plot output.", { + skip_if_too_deep(5) + app_driver <- app_driver_tm_t_tte() + app_driver$expect_no_shiny_error() + app_driver$expect_no_validation_error() + + app_driver$stop() +})