diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R
index 67615e128..52fcf7ac2 100644
--- a/R/tm_g_bivariate.R
+++ b/R/tm_g_bivariate.R
@@ -560,12 +560,8 @@ srv_g_bivariate <- function(id,
teal.reporter::teal_card("## Module's output(s)")
)
obj %>%
- teal.code::eval_code(
- c(
- 'library("ggplot2");library("dplyr")', # nolint: quotes
- as.expression(anl_merged_input()$expr)
- )
- )
+ teal.code::eval_code('library("ggplot2");library("dplyr")') %>%
+ teal.code::eval_code(as.expression(anl_merged_input()$expr)) # don't mix char with expr in single eval_code
})
merged <- list(
diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R
index 9ab8f332d..38f226797 100644
--- a/R/tm_g_distribution.R
+++ b/R/tm_g_distribution.R
@@ -96,10 +96,6 @@
#' })
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
-#' vars1 <- choices_selected(
-#' variable_choices(data[["ADSL"]], c("ARM", "COUNTRY", "SEX")),
-#' selected = NULL
-#' )
#'
#' app <- init(
#' data = data,
@@ -108,7 +104,7 @@
#' dist_var = data_extract_spec(
#' dataname = "ADSL",
#' select = select_spec(
-#' choices = variable_choices(data[["ADSL"]], c("AGE", "BMRKR1")),
+#' choices = variable_choices("ADSL", c("AGE", "BMRKR1")),
#' selected = "BMRKR1",
#' multiple = FALSE,
#' fixed = FALSE
@@ -117,14 +113,20 @@
#' strata_var = data_extract_spec(
#' dataname = "ADSL",
#' filter = filter_spec(
-#' vars = vars1,
+#' vars = choices_selected(
+#' variable_choices("ADSL", c("ARM", "COUNTRY", "SEX")),
+#' selected = NULL
+#' ),
#' multiple = TRUE
#' )
#' ),
#' group_var = data_extract_spec(
#' dataname = "ADSL",
#' filter = filter_spec(
-#' vars = vars1,
+#' vars = choices_selected(
+#' variable_choices("ADSL", c("ARM", "COUNTRY", "SEX")),
+#' selected = "ARM"
+#' ),
#' multiple = TRUE
#' )
#' )
diff --git a/man/tm_g_distribution.Rd b/man/tm_g_distribution.Rd
index cf3884a16..5f5058bf2 100644
--- a/man/tm_g_distribution.Rd
+++ b/man/tm_g_distribution.Rd
@@ -141,10 +141,6 @@ data <- within(data, {
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
-vars1 <- choices_selected(
- variable_choices(data[["ADSL"]], c("ARM", "COUNTRY", "SEX")),
- selected = NULL
-)
app <- init(
data = data,
@@ -153,7 +149,7 @@ app <- init(
dist_var = data_extract_spec(
dataname = "ADSL",
select = select_spec(
- choices = variable_choices(data[["ADSL"]], c("AGE", "BMRKR1")),
+ choices = variable_choices("ADSL", c("AGE", "BMRKR1")),
selected = "BMRKR1",
multiple = FALSE,
fixed = FALSE
@@ -162,14 +158,20 @@ app <- init(
strata_var = data_extract_spec(
dataname = "ADSL",
filter = filter_spec(
- vars = vars1,
+ vars = choices_selected(
+ variable_choices("ADSL", c("ARM", "COUNTRY", "SEX")),
+ selected = NULL
+ ),
multiple = TRUE
)
),
group_var = data_extract_spec(
dataname = "ADSL",
filter = filter_spec(
- vars = vars1,
+ vars = choices_selected(
+ variable_choices("ADSL", c("ARM", "COUNTRY", "SEX")),
+ selected = "ARM"
+ ),
multiple = TRUE
)
)
@@ -189,8 +191,8 @@ if (interactive()) {
\if{html}{\out{}}
}
\item{example-2}{
- \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXQGEAIgEkAZS9dfihSKF04AA9YVBElUPCDYy5qAH1EqBsEsIijXQB3WlIACxV2TNxdECVdXQBBHwCAGWTdVIxMxERGRpalAF9FCAArIhU0gGs4VlEK3Nt8-jgTKGFSNIJ+WlECNLGJ6dngaHg5zLkAXTcILRZRAEY2ghLxgjE00TgRDTh+dlqujujFoUHoIk2r1o73OuWAwAUYD6zURl0uVQIAKRWAAsoiqoivAB5RwAOQcAE18bpEQFnAANRFyOS4QFfH7kfi6AC8ulJjmaKIgwyUaFQbRUxQBEDqmR5IVyrJluj4QhEonlquEYmldTqpBgaQkGR2pBB9EEmmsgL1IVNaWB8syaWiZvUG1EqDgmJttoV4VOel5iOR+N9tvZ3tI8sjGk+Xp9yr9epebzE8uBoPBcEhadh4XhIaaKLAaIxWPqAHFXHgaWAAEI4rAAaSwDyZLPDftjnPliMbLbbYaTyZV61ocSDugAYvVmnSlaO9SZaFE-vLZ-PXCPbcNk52d7pRG7wg6WE7ci6om6457vbrR5lA32kcXh0uV9RyIx5Z-v-H7y7W1gQ1XkQIeRclzHL8JxEeUHBcIDdD3P0D2TCRGCIQRUDPH9eWdV1mFvBMH2TJ9YCnIt+jwJC-xkX9aC-GQAMTKCgXuDN7ggpC6hgcdJ3gpxtyXFDd19FDhmGWgTF0dgVG-d1tDgGxbBqZVRDKCBWHqdB2DFAASQRaCqAyvkYHRGGGAYlDAAZLiAA}{Open in Shinylive}
- \if{html}{\out{}}
+ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXQGEAIgEkAZS9dfihSKF04AA9YVBElUPCDYy5qAH1EqBsEsIijXQB3WlIACxV2TNxdECVdXQBBHwCAGWTdVIxMxERGRpalAF9FCAArIhU0gGs4VlEK3Nt8-jgTKGFSNIJ+WlECNLGJ6dngaHg5zLkAXTcIJTRUNpVi9lqQ3N0AXjfw3Fe+IREok+un+wjELwgdTqpBgaQkGR2pEYDEEmmsryhIURaS0LGBmTS0SR6g2olQcAIEMxmMypz0XwUYD6zUZv0h1LqojgIg0wK5PNJ5MpGI5ugIJXGBDEwNxyKg9BEmwltClc0ZzNZYpeTIA4q48LpGQAhACyWAA0lgAIyMuRyNmiqH8inkfjA41my02vAijkwda0OL03QAMXqzQCzgdjtMtCicDdXzDEdc7I5w3T0cxomJ4RxeK+BKJzA0aTJFKpotpsGD6qaLJ9aepJlo1HIjGBLbbMjLQsrjtlQK+4slYjL3JdCf7MdltHlipHKvBdf6BuFTKwJs1jK8AHlHAA5BwATW3YEjAA1bfbfaLnRoE8CD45miym5nb5j-W3AyJgQ4XE-XQM2pG9310CRGCIQRUHzDtC1yQkomJUty2FcC6mreB3SZetWSArt207Vt217CsgLqQdgUXVVxwFKcKKhWd5zgJVRzVXDVyqdd6k3M890PE8z0va8sxje9XRw3itzARiwJjEEAyDf8nFTR0QMxDTgNeYZhloExdHYFR2xJbQ4BsWwanZUQyggVh6nQdh7gAEkEWgqhcrlGB0RhhgGJQwAGS4gA}{Open in Shinylive}
+ \if{html}{\out{}}
\if{html}{\out{}}
}
}
diff --git a/tests/testthat/test-examples.R b/tests/testthat/test-examples.R
index 57a0d2c33..580613bbb 100644
--- a/tests/testthat/test-examples.R
+++ b/tests/testthat/test-examples.R
@@ -141,7 +141,9 @@ for (i in rd_files()) {
paste0("example-", basename(i)),
{
testthat::skip_on_cran()
- testthat::skip("chromium")
+ if (grepl("tm_g_distribution", basename(i))) {
+ testthat::skip("distribution initializes with short validation error")
+ }
skip_if_too_deep(5)
testthat::skip_if_not_installed("pkgload")
# Allow for specific validation errors for individual examples
diff --git a/tests/testthat/test-shinytest2-tm_a_pca.R b/tests/testthat/test-shinytest2-tm_a_pca.R
index 6f48b371b..11cf5248a 100644
--- a/tests/testthat/test-shinytest2-tm_a_pca.R
+++ b/tests/testthat/test-shinytest2-tm_a_pca.R
@@ -7,32 +7,33 @@ app_driver_tm_a_pca <- function() {
})
init_teal_app_driver(
- data = data,
- modules = tm_a_pca(
- dat = teal.transform::data_extract_spec(
- dataname = "USArrests",
- select = teal.transform::select_spec(
- choices = teal.transform::variable_choices(
- data = data[["USArrests"]],
- c("Murder", "Assault", "UrbanPop", "Rape")
- ),
- selected = c("Murder", "Assault"),
- multiple = TRUE
- )
- ),
- size = c(3, 1, 5),
- alpha = c(.5, 0, 1),
- font_size = c(10, 8, 15),
- ggtheme = "light",
- rotate_xaxis_labels = TRUE,
- pre_output = shiny::tags$div(id = "unique_id_pre", "A pre output"),
- post_output = shiny::tags$div(id = "unique_id_post", "A post output")
+ teal::init(
+ data = data,
+ modules = tm_a_pca(
+ dat = teal.transform::data_extract_spec(
+ dataname = "USArrests",
+ select = teal.transform::select_spec(
+ choices = teal.transform::variable_choices(
+ data = data[["USArrests"]],
+ c("Murder", "Assault", "UrbanPop", "Rape")
+ ),
+ selected = c("Murder", "Assault"),
+ multiple = TRUE
+ )
+ ),
+ size = c(3, 1, 5),
+ alpha = c(.5, 0, 1),
+ font_size = c(10, 8, 15),
+ ggtheme = "light",
+ rotate_xaxis_labels = TRUE,
+ pre_output = shiny::tags$div(id = "unique_id_pre", "A pre output"),
+ post_output = shiny::tags$div(id = "unique_id_post", "A post output")
+ )
)
)
}
testthat::test_that("e2e - tm_a_pca: Module is initialised with the specified defaults in function call.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_pca()
@@ -44,9 +45,14 @@ testthat::test_that("e2e - tm_a_pca: Module is initialised with the specified de
c("Murder", "Assault")
)
- module_parent_id <- gsub("-module$", "", app_driver$active_module_ns())
- testthat::expect_equal(app_driver$get_text(sprintf("#%s %s", module_parent_id, "#unique_id_pre")), "A pre output")
- testthat::expect_equal(app_driver$get_text(sprintf("#%s %s", module_parent_id, "#unique_id_post")), "A post output")
+ testthat::expect_equal(
+ app_driver$get_text("#unique_id_pre"),
+ "A pre output"
+ )
+ testthat::expect_equal(
+ app_driver$get_text("#unique_id_post"),
+ "A post output"
+ )
# Plot options that can be changed in call
testthat::expect_true(app_driver$get_active_module_input("rotate_xaxis_labels"))
@@ -57,7 +63,6 @@ testthat::test_that("e2e - tm_a_pca: Module is initialised with the specified de
})
testthat::test_that("e2e - tm_a_pca: Eigenvector table should have data extract selection Murder/Assault on header.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_pca()
@@ -75,7 +80,6 @@ testthat::test_that("e2e - tm_a_pca: Eigenvector table should have data extract
})
testthat::test_that("e2e - tm_a_pca: Eigenvector table should have data extract selection Murder/UrbanPop on header.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_pca()
@@ -93,7 +97,6 @@ testthat::test_that("e2e - tm_a_pca: Eigenvector table should have data extract
})
testthat::test_that("e2e - tm_a_pca: Color by columns (data_extract) must be from non-selected variable set.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_pca()
@@ -111,7 +114,6 @@ testthat::test_that("e2e - tm_a_pca: Color by columns (data_extract) must be fro
})
testthat::test_that("e2e - tm_a_pca: Changing output encodings of tables_display does not generate errors.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_pca()
@@ -133,7 +135,6 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of tables_display
})
testthat::test_that("e2e - tm_a_pca: Changing output encodings for 'plot type' does not generate errors.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_pca()
@@ -157,7 +158,6 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings for 'plot type' d
})
testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'standardization' does not generate errors.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_pca()
@@ -176,7 +176,6 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'standardizati
})
testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'NA action' does not generate errors.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_pca()
@@ -191,31 +190,26 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'NA action' do
})
testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'plot_type' hides and shows options.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_pca()
app_driver$expect_no_validation_error()
# Selected plot's specific settings is not visible
- no_plot_settings_selector <- sprintf("#%s-%s %s", app_driver$active_module_ns(), "plot_settings", "span.help-block")
- x_axis_selector <- sprintf("#%s-%s", app_driver$active_module_ns(), "x_axis")
- color_by_selector <- sprintf(
- "#%s-%s",
- app_driver$active_module_ns(),
- "response-dataset_USArrests_singleextract-select_input"
- )
+ no_plot_settings_selector <- app_driver$namespaces(TRUE)$module("plot_settings span.help-block")
+ x_axis_selector <- app_driver$namespaces(TRUE)$module("x_axis")
+ color_by_selector <- app_driver$namespaces(TRUE)$module("response-dataset_USArrests_singleextract-select_input")
- app_driver$set_active_module_input("plot_type", "Elbow plot", wait = FALSE)
+ app_driver$set_active_module_input("plot_type", "Elbow plot", wait_ = FALSE)
testthat::expect_true(app_driver$is_visible(no_plot_settings_selector))
testthat::expect_false(app_driver$is_visible(x_axis_selector))
testthat::expect_false(app_driver$is_visible(color_by_selector))
- app_driver$set_active_module_input("plot_type", "Circle plot", wait = FALSE)
+ app_driver$set_active_module_input("plot_type", "Circle plot", wait_ = FALSE)
testthat::expect_false(app_driver$is_visible(no_plot_settings_selector))
testthat::expect_true(app_driver$is_visible(x_axis_selector))
- app_driver$set_active_module_input("plot_type", "Biplot", wait = FALSE)
+ app_driver$set_active_module_input("plot_type", "Biplot", wait_ = FALSE)
testthat::expect_false(app_driver$is_visible(no_plot_settings_selector))
testthat::expect_true(app_driver$is_visible(x_axis_selector))
testthat::expect_true(app_driver$is_visible(color_by_selector))
@@ -224,7 +218,6 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'plot_type' hi
})
testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'theme' does not generate errors.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_pca()
@@ -243,7 +236,6 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'theme' does n
})
testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'font size' does not generate errors.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_pca()
diff --git a/tests/testthat/test-shinytest2-tm_a_regression.R b/tests/testthat/test-shinytest2-tm_a_regression.R
index be5ddd24f..32493233e 100644
--- a/tests/testthat/test-shinytest2-tm_a_regression.R
+++ b/tests/testthat/test-shinytest2-tm_a_regression.R
@@ -5,59 +5,59 @@ app_driver_tm_a_regression <- function() {
})
init_teal_app_driver(
- data = data,
- modules = tm_a_regression(
- label = "Regression",
- response = teal.transform::data_extract_spec(
- dataname = "CO2",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = "uptake",
- selected = "uptake",
- multiple = FALSE,
- fixed = TRUE
+ teal::init(
+ data = data,
+ modules = tm_a_regression(
+ label = "Regression",
+ response = teal.transform::data_extract_spec(
+ dataname = "CO2",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = "uptake",
+ selected = "uptake",
+ multiple = FALSE,
+ fixed = TRUE
+ )
+ ),
+ regressor = teal.transform::data_extract_spec(
+ dataname = "CO2",
+ select = teal.transform::select_spec(
+ label = "Select variables:",
+ choices = teal.transform::variable_choices(data[["CO2"]], c("conc", "Treatment")),
+ selected = "conc",
+ multiple = TRUE,
+ fixed = FALSE
+ )
+ ),
+ plot_height = c(600, 200, 2000),
+ plot_width = NULL,
+ alpha = c(1, 0, 1),
+ size = c(2, 1, 8),
+ ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"),
+ pre_output = NULL,
+ post_output = NULL,
+ default_plot_type = 3,
+ default_outlier_label = "USUBJID",
+ label_segment_threshold = c(0.5, 0, 10),
+ ggplot2_args = teal.widgets::ggplot2_args(
+ labs = list(subtitle = "Plot generated by Regression Module")
)
- ),
- regressor = teal.transform::data_extract_spec(
- dataname = "CO2",
- select = teal.transform::select_spec(
- label = "Select variables:",
- choices = teal.transform::variable_choices(data[["CO2"]], c("conc", "Treatment")),
- selected = "conc",
- multiple = TRUE,
- fixed = FALSE
- )
- ),
- plot_height = c(600, 200, 2000),
- plot_width = NULL,
- alpha = c(1, 0, 1),
- size = c(2, 1, 8),
- ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"),
- pre_output = NULL,
- post_output = NULL,
- default_plot_type = 3,
- default_outlier_label = "USUBJID",
- label_segment_threshold = c(0.5, 0, 10),
- ggplot2_args = teal.widgets::ggplot2_args(
- labs = list(subtitle = "Plot generated by Regression Module")
)
)
)
}
testthat::test_that("e2e - tm_a_regression: Data parameter and module label is passed properly.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_regression()
app_driver$expect_no_shiny_error()
- testthat::expect_equal(
- app_driver$get_text("#teal-teal_modules-active_tab .active"),
- "Regression"
- )
+ testthat::expect_equal(app_driver$get_text(".teal-modules-tree .active"), "Regression")
- encoding_dataset <- app_driver$get_text("#teal-teal_modules-regression .help-block")
+ encoding_dataset <- app_driver$get_text(
+ paste(app_driver$namespaces(TRUE)$wrapper(NULL), ".help-block")
+ )
testthat::expect_match(encoding_dataset, "Dataset:[\n ]*CO2", all = FALSE)
app_driver$stop()
@@ -65,18 +65,21 @@ testthat::test_that("e2e - tm_a_regression: Data parameter and module label is p
testthat::test_that("e2e - tm_a_regression:
Data extract spec elements are initialized with the default values specified by response and regressor arg.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_regression()
testthat::expect_identical(
- app_driver$active_module_element_text("response-dataset_CO2_singleextract-select_selected_text"),
+ app_driver$get_text(
+ app_driver$namespaces(TRUE)$module("response-dataset_CO2_singleextract-select_selected_text")
+ ),
"uptake"
)
testthat::expect_identical(
- app_driver$get_active_module_input("regressor-dataset_CO2_singleextract-select"),
+ app_driver$get_text(
+ app_driver$namespaces(TRUE)$module("regressor-dataset_CO2_singleextract-select_selected_text")
+ ),
"conc"
)
app_driver$set_active_module_input("regressor-dataset_CO2_singleextract-select", "Treatment")
@@ -85,7 +88,6 @@ testthat::test_that("e2e - tm_a_regression:
})
testthat::test_that("e2e - tm_a_regression: Plot type is set properly.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_regression()
@@ -99,12 +101,11 @@ testthat::test_that("e2e - tm_a_regression: Plot type is set properly.", {
testthat::test_that("e2e - tm_a_regression:
Plot type has 7 specific choices & changing choices does not throw errors.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_regression()
- plot_types <- app_driver$active_module_element_text("plot_type > div")
+ plot_types <- app_driver$get_text(app_driver$namespaces(TRUE)$module("plot_type > div"))
possible_choices <-
c(
@@ -127,30 +128,28 @@ testthat::test_that("e2e - tm_a_regression:
})
testthat::test_that("e2e - tm_a_regression: Outlier definition and label are visible by default.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_regression()
testthat::expect_true(app_driver$get_active_module_input("show_outlier"))
- testthat::expect_true(app_driver$is_visible(app_driver$active_module_element("outlier-label")))
- testthat::expect_true(app_driver$is_visible(app_driver$active_module_element("label_var_input")))
+ testthat::expect_true(app_driver$is_visible(app_driver$namespaces(TRUE)$module("outlier-label")))
+ testthat::expect_true(app_driver$is_visible(app_driver$namespaces(TRUE)$module("label_var_input")))
app_driver$stop()
})
testthat::test_that("e2e - tm_a_regression: Outlier definition and label have default values and label text.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_regression()
testthat::expect_match(
- app_driver$active_module_element_text("label_var_input"),
+ app_driver$get_text(app_driver$namespaces(TRUE)$module("label_var_input")),
"Outlier label",
fixed = TRUE
)
- outlier_label <- app_driver$active_module_element_text("outlier-label")
+ outlier_label <- app_driver$get_text(app_driver$namespaces(TRUE)$module("outlier-label"))
testthat::expect_match(
outlier_label,
"Outlier definition:",
@@ -169,14 +168,13 @@ testthat::test_that("e2e - tm_a_regression: Outlier definition and label have de
})
testthat::test_that("e2e - tm_a_regression: Unchecking display outlier hides outlier label and definition.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_a_regression()
app_driver$set_active_module_input("show_outlier", FALSE)
- testthat::expect_false(app_driver$is_visible(app_driver$active_module_element("outlier-label")))
- testthat::expect_false(app_driver$is_visible(app_driver$active_module_element("label_var_input")))
+ testthat::expect_false(app_driver$is_visible(app_driver$namespaces(TRUE)$module("outlier-label")))
+ testthat::expect_false(app_driver$is_visible(app_driver$namespaces(TRUE)$module("label_var_input")))
app_driver$expect_no_validation_error()
diff --git a/tests/testthat/test-shinytest2-tm_data_table.R b/tests/testthat/test-shinytest2-tm_data_table.R
index 4c3ab4071..5e64d7058 100644
--- a/tests/testthat/test-shinytest2-tm_data_table.R
+++ b/tests/testthat/test-shinytest2-tm_data_table.R
@@ -1,42 +1,40 @@
app_driver_tm_data_table <- function() {
init_teal_app_driver(
- data = simple_teal_data(),
- modules = tm_data_table(
- label = "Data Table",
- variables_selected = list(
- iris = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "Species")
- ),
- datanames = c("iris", "mtcars"),
- dt_args = list(caption = "Table Caption"),
- dt_options = list(
- searching = FALSE, pageLength = 30, lengthMenu = c(5, 15, 30, 100),
- scrollX = TRUE
- ),
- server_rendering = FALSE,
- pre_output = NULL,
- post_output = NULL
+ teal::init(
+ data = simple_teal_data(),
+ modules = tm_data_table(
+ label = "Data Table",
+ variables_selected = list(
+ iris = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "Species")
+ ),
+ datanames = c("iris", "mtcars"),
+ dt_args = list(caption = "Table Caption"),
+ dt_options = list(
+ searching = FALSE, pageLength = 30, lengthMenu = c(5, 15, 30, 100),
+ scrollX = TRUE
+ ),
+ server_rendering = FALSE,
+ pre_output = NULL,
+ post_output = NULL
+ )
),
timeout = 3000
)
}
test_that("e2e - tm_data_table: Initializes without errors", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_data_table()
app_driver$expect_no_shiny_error()
- testthat::expect_equal(
- app_driver$get_text("#teal-teal_modules-active_tab .active"),
- "Data Table"
- )
+
+ testthat::expect_equal(app_driver$get_text(".teal-modules-tree .active"), "Data Table")
app_driver$stop()
})
test_that("e2e - tm_data_table: Verify checkbox displayed over data table", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_data_table()
@@ -46,16 +44,15 @@ test_that("e2e - tm_data_table: Verify checkbox displayed over data table", {
})
test_that("e2e - tm_data_table: Verify module displays data table", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_data_table()
# table
testthat::expect_match(app_driver$get_active_module_output("iris-data_table"), "Table Caption")
- testthat::expect_true(app_driver$is_visible(selector = app_driver$active_module_element("iris-data_table")))
+ testthat::expect_true(app_driver$is_visible(selector = app_driver$namespaces(TRUE)$module("iris-data_table")))
extract_iris_table <- function() {
- app_driver$active_module_element("iris-data_table") %>%
+ app_driver$namespaces(TRUE)$module("iris-data_table") %>%
app_driver$get_html_rvest() %>%
rvest::html_table(fill = TRUE) %>%
.[[2]] %>%
@@ -83,7 +80,6 @@ test_that("e2e - tm_data_table: Verify module displays data table", {
})
test_that("e2e - tm_data_table: Verify default variable selection and set new selection", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_data_table()
diff --git a/tests/testthat/test-shinytest2-tm_file_viewer.R b/tests/testthat/test-shinytest2-tm_file_viewer.R
index 0a3210a13..a79d982e9 100644
--- a/tests/testthat/test-shinytest2-tm_file_viewer.R
+++ b/tests/testthat/test-shinytest2-tm_file_viewer.R
@@ -2,14 +2,16 @@ nest_logo_url <- "https://raw.githubusercontent.com/insightsengineering/hex-stic
app_driver_tm_file_viewer <- function() {
init_teal_app_driver(
- data = simple_teal_data(),
- modules = tm_file_viewer(
- label = "File Viewer Module",
- input_path = list(
- folder = system.file("sample_files", package = "teal.modules.general"),
- png = system.file("sample_files/sample_file.png", package = "teal.modules.general"),
- txt = system.file("sample_files/sample_file.txt", package = "teal.modules.general"),
- url = nest_logo_url
+ teal::init(
+ data = simple_teal_data(),
+ modules = tm_file_viewer(
+ label = "File Viewer Module",
+ input_path = list(
+ folder = system.file("sample_files", package = "teal.modules.general"),
+ png = system.file("sample_files/sample_file.png", package = "teal.modules.general"),
+ txt = system.file("sample_files/sample_file.txt", package = "teal.modules.general"),
+ url = nest_logo_url
+ )
)
),
timeout = 3000
@@ -17,7 +19,6 @@ app_driver_tm_file_viewer <- function() {
}
test_that("e2e - tm_file_viewer: Initializes without errors and shows files tree specified in input_path argument", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_file_viewer()
@@ -25,8 +26,8 @@ test_that("e2e - tm_file_viewer: Initializes without errors and shows files tree
# check valid path as no file is selected
app_driver$expect_validation_error()
# encoding are visible
- testthat::expect_true(app_driver$is_visible(selector = app_driver$active_module_element("tree")))
- list_files <- app_driver$get_html_rvest(selector = app_driver$active_module_element("tree")) %>%
+ testthat::expect_true(app_driver$is_visible(selector = app_driver$namespaces(TRUE)$module("tree")))
+ list_files <- app_driver$get_html_rvest(selector = app_driver$namespaces(TRUE)$module("tree")) %>%
rvest::html_nodes("a") %>%
rvest::html_text()
testthat::expect_setequal(
@@ -34,23 +35,19 @@ test_that("e2e - tm_file_viewer: Initializes without errors and shows files tree
c("folder", "png", "txt", "url")
)
- testthat::expect_equal(
- app_driver$get_text("#teal-teal_modules-active_tab .active"),
- "File Viewer Module"
- )
+ testthat::expect_equal(app_driver$get_text(".teal-modules-tree .active"), "File Viewer Module")
app_driver$stop()
})
test_that("e2e - tm_file_viewer: Shows selected image file", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_file_viewer()
app_driver$click(selector = "[id= '4_anchor']")
- testthat::expect_true(app_driver$is_visible(sprintf("%s img", app_driver$active_module_element("output"))))
+ testthat::expect_true(app_driver$is_visible(app_driver$namespaces(TRUE)$module("output img")))
- img_src <- app_driver$get_html_rvest(app_driver$active_module_element("output")) %>%
+ img_src <- app_driver$get_html_rvest(app_driver$namespaces(TRUE)$module("output")) %>%
rvest::html_element("img") %>%
rvest::html_attr("src")
@@ -60,14 +57,13 @@ test_that("e2e - tm_file_viewer: Shows selected image file", {
})
test_that("e2e - tm_file_viewer: Shows selected text file", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_file_viewer()
app_driver$click(selector = "[id= '5_anchor']")
- testthat::expect_true(app_driver$is_visible(sprintf("%s pre", app_driver$active_module_element("output"))))
+ testthat::expect_true(app_driver$is_visible(app_driver$namespaces(TRUE)$module("output pre")))
- pre_text <- app_driver$get_html_rvest(app_driver$active_module_element("output")) %>%
+ pre_text <- app_driver$get_html_rvest(app_driver$namespaces(TRUE)$module("output")) %>%
rvest::html_element("pre") %>%
rvest::html_text()
@@ -83,12 +79,11 @@ test_that("e2e - tm_file_viewer: Shows selected text file", {
})
test_that("e2e - tm_file_viewer: Shows selected url", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_file_viewer()
app_driver$click(selector = "[id= '6_anchor']")
- testthat::expect_true(app_driver$is_visible(sprintf("%s img", app_driver$active_module_element("output"))))
+ testthat::expect_true(app_driver$is_visible(app_driver$namespaces(TRUE)$module("output img")))
testthat::expect_equal(
attr(app_driver$get_active_module_input("tree")$url, "ancestry"),
diff --git a/tests/testthat/test-shinytest2-tm_front_page.R b/tests/testthat/test-shinytest2-tm_front_page.R
index 43fab3172..f801c5d47 100644
--- a/tests/testthat/test-shinytest2-tm_front_page.R
+++ b/tests/testthat/test-shinytest2-tm_front_page.R
@@ -5,33 +5,31 @@ app_driver_tm_front_page <- function() {
})
init_teal_app_driver(
- data = data,
- modules = tm_front_page(
- label = "Front page",
- datanames = "all",
- header_text = c(
- "Important information" = "It can go here.",
- "Other information" = "Can go here."
- ),
- tables = list("MTCARS" = head(mtcars, 5), "IRIS" = head(iris, 5)),
- additional_tags = HTML("Additional HTML or shiny tags go here"),
- footnotes = "This is a footnote"
+ teal::init(
+ data = data,
+ modules = tm_front_page(
+ label = "Front page",
+ datanames = "all",
+ header_text = c(
+ "Important information" = "It can go here.",
+ "Other information" = "Can go here."
+ ),
+ tables = list("MTCARS" = head(mtcars, 5), "IRIS" = head(iris, 5)),
+ additional_tags = HTML("Additional HTML or shiny tags go here"),
+ footnotes = "This is a footnote"
+ )
),
timeout = 3000
)
}
test_that("e2e - tm_front_page: Initializes without errors and check html elements", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_front_page()
app_driver$expect_no_shiny_error()
- testthat::expect_equal(
- app_driver$get_text("#teal-teal_modules-active_tab .active"),
- "Front page"
- )
+ testthat::expect_equal(app_driver$get_text(".teal-modules-tree .active"), "Front page")
# header text
testthat::expect_match(
@@ -47,26 +45,28 @@ test_that("e2e - tm_front_page: Initializes without errors and check html elemen
})
test_that("e2e - tm_front_page: Verify the module displays tables", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_front_page()
# tables
testthat::expect_match(app_driver$get_active_module_output("table_1"), "MTCARS")
- testthat::expect_true(app_driver$is_visible(sprintf("%s table", app_driver$active_module_element("table_1"))))
+ testthat::expect_true(app_driver$is_visible(app_driver$namespaces(TRUE)$module("table_1 table")))
testthat::expect_match(app_driver$get_active_module_output("table_2"), "IRIS")
- testthat::expect_true(app_driver$is_visible(sprintf("%s table", app_driver$active_module_element("table_2"))))
+ testthat::expect_true(app_driver$is_visible(app_driver$namespaces(TRUE)$module("table_2 table")))
app_driver$stop()
})
test_that("e2e - tm_front_page: Verify the module displays metadata", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_front_page()
# show metadata
- app_driver$click(NS(app_driver$active_module_ns(), "metadata_button"))
- testthat::expect_true(app_driver$is_visible(sprintf("%s table", app_driver$active_module_element("metadata_table"))))
+ app_driver$click(app_driver$namespaces()$module("metadata_button"))
+ testthat::expect_true(
+ app_driver$is_visible(
+ app_driver$namespaces(TRUE)$module("metadata_table table")
+ )
+ )
app_driver$stop()
})
diff --git a/tests/testthat/test-shinytest2-tm_g_association.R b/tests/testthat/test-shinytest2-tm_g_association.R
index 3879a3f26..af61baee5 100644
--- a/tests/testthat/test-shinytest2-tm_g_association.R
+++ b/tests/testthat/test-shinytest2-tm_g_association.R
@@ -8,55 +8,55 @@ app_driver_tm_g_association <- function() {
})
init_teal_app_driver(
- data = data,
- modules = tm_g_association(
- label = "Association",
- ref = teal.transform::data_extract_spec(
- dataname = "CO2",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")),
- selected = "Plant",
- fixed = FALSE
+ teal::init(
+ data = data,
+ modules = tm_g_association(
+ label = "Association",
+ ref = teal.transform::data_extract_spec(
+ dataname = "CO2",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")),
+ selected = "Plant",
+ fixed = FALSE
+ )
+ ),
+ vars = teal.transform::data_extract_spec(
+ dataname = "CO2",
+ select = teal.transform::select_spec(
+ label = "Select variables:",
+ choices = teal.transform::variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")),
+ selected = "Treatment",
+ multiple = TRUE,
+ fixed = FALSE
+ )
+ ),
+ show_association = TRUE,
+ plot_height = c(600, 400, 5000),
+ plot_width = NULL,
+ distribution_theme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"),
+ association_theme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"),
+ pre_output = NULL,
+ post_output = NULL,
+ ggplot2_args = teal.widgets::ggplot2_args(
+ labs = list(subtitle = "Plot generated by Association Module")
)
- ),
- vars = teal.transform::data_extract_spec(
- dataname = "CO2",
- select = teal.transform::select_spec(
- label = "Select variables:",
- choices = teal.transform::variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")),
- selected = "Treatment",
- multiple = TRUE,
- fixed = FALSE
- )
- ),
- show_association = TRUE,
- plot_height = c(600, 400, 5000),
- plot_width = NULL,
- distribution_theme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"),
- association_theme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"),
- pre_output = NULL,
- post_output = NULL,
- ggplot2_args = teal.widgets::ggplot2_args(
- labs = list(subtitle = "Plot generated by Association Module")
)
)
)
}
testthat::test_that("e2e - tm_g_association: Data parameter and module label is passed properly.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
+ testthat::skip("ggmosaic issue: will be resumed via the issue #925 in tmg")
app_driver <- app_driver_tm_g_association()
app_driver$expect_no_shiny_error()
- testthat::expect_equal(
- app_driver$get_text("#teal-teal_modules-active_tab li a.active"),
- "Association"
- )
+ testthat::expect_equal(app_driver$get_text(".teal-modules-tree .active"), "Association")
+
- encoding_dataset <- app_driver$get_text("#teal-teal_modules-association .help-block")
+ encoding_dataset <- app_driver$get_text(paste(app_driver$namespaces(TRUE)$wrapper(NULL), ".help-block"))
testthat::expect_match(encoding_dataset, "Dataset:[\n ]*CO2", all = FALSE)
app_driver$stop()
@@ -64,8 +64,8 @@ testthat::test_that("e2e - tm_g_association: Data parameter and module label is
testthat::test_that("e2e - tm_g_association:
Data extract spec elements are initialized with the default values specified by ref and vars arguments.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
+ testthat::skip("ggmosaic issue: will be resumed via the issue ")
app_driver <- app_driver_tm_g_association()
testthat::expect_identical(
@@ -86,18 +86,18 @@ testthat::test_that("e2e - tm_g_association:
})
testthat::test_that("e2e - tm_g_association: Module plot is visible.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
+ testthat::skip("ggmosaic issue: will be resumed via the issue ")
app_driver <- app_driver_tm_g_association()
- testthat::expect_true(app_driver$is_visible(app_driver$active_module_element("myplot-plot_main > img")))
+ testthat::expect_true(app_driver$is_visible(app_driver$namespaces(TRUE)$module("myplot-plot_main > img")))
app_driver$stop()
})
testthat::test_that("e2e - tm_g_association: Check and set default values for radio buttons.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
+ testthat::skip("ggmosaic issue: will be resumed via the issue ")
app_driver <- app_driver_tm_g_association()
testthat::expect_true(app_driver$get_active_module_input("association"))
diff --git a/tests/testthat/test-shinytest2-tm_g_bivariate.R b/tests/testthat/test-shinytest2-tm_g_bivariate.R
index 5afa82407..0bef08233 100644
--- a/tests/testthat/test-shinytest2-tm_g_bivariate.R
+++ b/tests/testthat/test-shinytest2-tm_g_bivariate.R
@@ -6,86 +6,87 @@ app_driver_tm_g_bivariate <- function() {
})
init_teal_app_driver(
- data = data,
- modules = tm_g_bivariate(
- x = teal.transform::data_extract_spec(
- dataname = "CO2",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["CO2"]]),
- selected = "conc",
- fixed = FALSE
- )
- ),
- y = teal.transform::data_extract_spec(
- dataname = "CO2",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["CO2"]]),
- selected = "uptake",
- multiple = FALSE,
- fixed = FALSE
- )
- ),
- row_facet = teal.transform::data_extract_spec(
- dataname = "CO2",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["CO2"]]),
- selected = "Type",
- fixed = FALSE
- )
- ),
- col_facet = teal.transform::data_extract_spec(
- dataname = "CO2",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["CO2"]]),
- selected = "Treatment",
- fixed = FALSE
- )
- ),
- color = teal.transform::data_extract_spec(
- dataname = "CO2",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")),
- selected = "Treatment",
- fixed = FALSE
- )
- ),
- fill = teal.transform::data_extract_spec(
- dataname = "CO2",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")),
- selected = "Treatment",
- fixed = FALSE
- )
- ),
- size = teal.transform::data_extract_spec(
- dataname = "CO2",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")),
- selected = "Treatment",
- fixed = FALSE
- )
- ),
- color_settings = TRUE,
- free_x_scales = FALSE,
- free_y_scales = TRUE,
- ggplot2_args = teal.widgets::ggplot2_args(
- labs = list(subtitle = "Plot generated by Bivariate Module")
- ),
- ggtheme = "classic",
- swap_axes = TRUE
+ teal::init(
+ data = data,
+ modules = tm_g_bivariate(
+ x = teal.transform::data_extract_spec(
+ dataname = "CO2",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["CO2"]]),
+ selected = "conc",
+ fixed = FALSE
+ )
+ ),
+ y = teal.transform::data_extract_spec(
+ dataname = "CO2",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["CO2"]]),
+ selected = "uptake",
+ multiple = FALSE,
+ fixed = FALSE
+ )
+ ),
+ row_facet = teal.transform::data_extract_spec(
+ dataname = "CO2",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["CO2"]]),
+ selected = "Type",
+ fixed = FALSE
+ )
+ ),
+ col_facet = teal.transform::data_extract_spec(
+ dataname = "CO2",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["CO2"]]),
+ selected = "Treatment",
+ fixed = FALSE
+ )
+ ),
+ color = teal.transform::data_extract_spec(
+ dataname = "CO2",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")),
+ selected = "Treatment",
+ fixed = FALSE
+ )
+ ),
+ fill = teal.transform::data_extract_spec(
+ dataname = "CO2",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")),
+ selected = "Treatment",
+ fixed = FALSE
+ )
+ ),
+ size = teal.transform::data_extract_spec(
+ dataname = "CO2",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")),
+ selected = "Treatment",
+ fixed = FALSE
+ )
+ ),
+ color_settings = TRUE,
+ free_x_scales = FALSE,
+ free_y_scales = TRUE,
+ ggplot2_args = teal.widgets::ggplot2_args(
+ labs = list(subtitle = "Plot generated by Bivariate Module")
+ ),
+ ggtheme = "classic",
+ swap_axes = TRUE
+ )
)
)
}
testthat::test_that("e2e - tm_g_bivariate: Module is initialised with the specified defaults.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_bivariate()
@@ -114,23 +115,22 @@ testthat::test_that("e2e - tm_g_bivariate: Module is initialised with the specif
})
testthat::test_that("e2e - tm_g_bivariate: Coloring options are hidden when coloring is toggled off.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_bivariate()
testthat::expect_true(
app_driver$is_visible(
- app_driver$active_module_element("color-dataset_CO2_singleextract-select_input")
+ app_driver$namespaces(TRUE)$module("color-dataset_CO2_singleextract-select_input")
)
)
testthat::expect_true(
app_driver$is_visible(
- app_driver$active_module_element("size-dataset_CO2_singleextract-select_input")
+ app_driver$namespaces(TRUE)$module("size-dataset_CO2_singleextract-select_input")
)
)
testthat::expect_true(
app_driver$is_visible(
- app_driver$active_module_element("fill-dataset_CO2_singleextract-select_input")
+ app_driver$namespaces(TRUE)$module("fill-dataset_CO2_singleextract-select_input")
)
)
@@ -138,17 +138,17 @@ testthat::test_that("e2e - tm_g_bivariate: Coloring options are hidden when colo
testthat::expect_false(
app_driver$is_visible(
- app_driver$active_module_element("color-dataset_CO2_singleextract-select_input")
+ app_driver$namespaces(TRUE)$module("color-dataset_CO2_singleextract-select_input")
)
)
testthat::expect_false(
app_driver$is_visible(
- app_driver$active_module_element("size-dataset_CO2_singleextract-select_input")
+ app_driver$namespaces(TRUE)$module("size-dataset_CO2_singleextract-select_input")
)
)
testthat::expect_false(
app_driver$is_visible(
- app_driver$active_module_element("fill-dataset_CO2_singleextract-select_input")
+ app_driver$namespaces(TRUE)$module("fill-dataset_CO2_singleextract-select_input")
)
)
@@ -156,44 +156,42 @@ testthat::test_that("e2e - tm_g_bivariate: Coloring options are hidden when colo
})
testthat::test_that("e2e - tm_g_bivariate: Facetting options are hidden when facet is toggled off.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_bivariate()
testthat::expect_true(
app_driver$is_visible(
- app_driver$active_module_element("row_facet-dataset_CO2_singleextract-select")
+ app_driver$namespaces(TRUE)$module("row_facet-dataset_CO2_singleextract-select")
)
)
testthat::expect_true(
app_driver$is_visible(
- app_driver$active_module_element("col_facet-dataset_CO2_singleextract-select")
+ app_driver$namespaces(TRUE)$module("col_facet-dataset_CO2_singleextract-select")
)
)
- testthat::expect_true(app_driver$is_visible(app_driver$active_module_element("free_x_scales")))
- testthat::expect_true(app_driver$is_visible(app_driver$active_module_element("free_y_scales")))
+ testthat::expect_true(app_driver$is_visible(app_driver$namespaces(TRUE)$module("free_x_scales")))
+ testthat::expect_true(app_driver$is_visible(app_driver$namespaces(TRUE)$module("free_y_scales")))
app_driver$set_active_module_input("facetting", FALSE)
testthat::expect_false(
app_driver$is_visible(
- app_driver$active_module_element("row_facet-dataset_CO2_singleextract-select")
+ app_driver$namespaces(TRUE)$module("row_facet-dataset_CO2_singleextract-select")
)
)
testthat::expect_false(
app_driver$is_visible(
- app_driver$active_module_element("col_facet-dataset_CO2_singleextract-select")
+ app_driver$namespaces(TRUE)$module("col_facet-dataset_CO2_singleextract-select")
)
)
- testthat::expect_false(app_driver$is_visible(app_driver$active_module_element("free_x_scales")))
- testthat::expect_false(app_driver$is_visible(app_driver$active_module_element("free_y_scales")))
+ testthat::expect_false(app_driver$is_visible(app_driver$namespaces(TRUE)$module("free_x_scales")))
+ testthat::expect_false(app_driver$is_visible(app_driver$namespaces(TRUE)$module("free_y_scales")))
app_driver$stop()
})
testthat::test_that("e2e - tm_g_bivariate: Setting encoding inputs produces outputs without validation errors.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_bivariate()
diff --git a/tests/testthat/test-shinytest2-tm_g_distribution.R b/tests/testthat/test-shinytest2-tm_g_distribution.R
index 69a31450f..64f294d4a 100644
--- a/tests/testthat/test-shinytest2-tm_g_distribution.R
+++ b/tests/testthat/test-shinytest2-tm_g_distribution.R
@@ -9,43 +9,44 @@ app_driver_tm_g_distribution <- function() {
)
init_teal_app_driver(
- data = data,
- modules = tm_g_distribution(
- dist_var = teal.transform::data_extract_spec(
- dataname = "ADSL",
- select = teal.transform::select_spec(
- choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "BMRKR1")),
- selected = "BMRKR1",
- multiple = FALSE,
- fixed = FALSE
- )
- ),
- strata_var = teal.transform::data_extract_spec(
- dataname = "ADSL",
- filter = teal.transform::filter_spec(
- vars = vars1,
- multiple = TRUE
- )
- ),
- group_var = teal.transform::data_extract_spec(
- dataname = "ADSL",
- filter = teal.transform::filter_spec(
- vars = vars1,
- multiple = TRUE
- )
- ),
- ggplot2_args = teal.widgets::ggplot2_args(
- labs = list(subtitle = "Plot generated by Distribution Module")
- ),
- ggtheme = "classic",
- freq = TRUE,
- bins = 36,
+ teal::init(
+ data = data,
+ modules = tm_g_distribution(
+ dist_var = teal.transform::data_extract_spec(
+ dataname = "ADSL",
+ select = teal.transform::select_spec(
+ choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "BMRKR1")),
+ selected = "BMRKR1",
+ multiple = FALSE,
+ fixed = FALSE
+ )
+ ),
+ strata_var = teal.transform::data_extract_spec(
+ dataname = "ADSL",
+ filter = teal.transform::filter_spec(
+ vars = vars1,
+ multiple = TRUE
+ )
+ ),
+ group_var = teal.transform::data_extract_spec(
+ dataname = "ADSL",
+ filter = teal.transform::filter_spec(
+ vars = vars1,
+ multiple = TRUE
+ )
+ ),
+ ggplot2_args = teal.widgets::ggplot2_args(
+ labs = list(subtitle = "Plot generated by Distribution Module")
+ ),
+ ggtheme = "classic",
+ freq = TRUE,
+ bins = 36,
+ )
)
)
}
testthat::test_that("e2e - tm_g_distribution: Module is initialised with the specified defaults.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_distribution()
@@ -70,7 +71,6 @@ testthat::test_that("e2e - tm_g_distribution: Module is initialised with the spe
})
testthat::test_that("e2e - tm_g_distribution: Histogram encoding inputs produce output without validation errors.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_distribution()
@@ -108,7 +108,6 @@ testthat::test_that("e2e - tm_g_distribution: Histogram encoding inputs produce
})
testthat::test_that("e2e - tm_g_distribution: QQ plot encoding inputs produce output without validation errors.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_distribution()
@@ -119,7 +118,7 @@ testthat::test_that("e2e - tm_g_distribution: QQ plot encoding inputs produce ou
app_driver$set_active_module_input("tabs", "QQplot")
app_driver$set_active_module_input("t_dist", "normal")
- app_driver$click(NS(app_driver$active_module_ns(), "params_reset"))
+ app_driver$click(app_driver$namespaces()$module("params_reset"))
app_driver$expect_no_validation_error()
diff --git a/tests/testthat/test-shinytest2-tm_g_response.R b/tests/testthat/test-shinytest2-tm_g_response.R
index b3be6d9f1..4093bca6f 100644
--- a/tests/testthat/test-shinytest2-tm_g_response.R
+++ b/tests/testthat/test-shinytest2-tm_g_response.R
@@ -7,32 +7,34 @@ app_driver_tm_g_response <- function() {
teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[names(data)]
init_teal_app_driver(
- data = data,
- modules = teal::modules(
- tm_g_response(
- label = "Response Plots",
- response = teal.transform::data_extract_spec(
- dataname = "ADSL",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["ADSL"]], c("BMRKR2", "COUNTRY")),
- selected = "BMRKR2",
- multiple = FALSE,
- fixed = FALSE
+ teal::init(
+ data = data,
+ modules = teal::modules(
+ tm_g_response(
+ label = "Response Plots",
+ response = teal.transform::data_extract_spec(
+ dataname = "ADSL",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["ADSL"]], c("BMRKR2", "COUNTRY")),
+ selected = "BMRKR2",
+ multiple = FALSE,
+ fixed = FALSE
+ )
+ ),
+ x = teal.transform::data_extract_spec(
+ dataname = "ADSL",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["ADSL"]], c("SEX", "RACE")),
+ selected = "RACE",
+ multiple = FALSE,
+ fixed = FALSE
+ )
+ ),
+ ggplot2_args = teal.widgets::ggplot2_args(
+ labs = list(subtitle = "Plot generated by Response Module")
)
- ),
- x = teal.transform::data_extract_spec(
- dataname = "ADSL",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["ADSL"]], c("SEX", "RACE")),
- selected = "RACE",
- multiple = FALSE,
- fixed = FALSE
- )
- ),
- ggplot2_args = teal.widgets::ggplot2_args(
- labs = list(subtitle = "Plot generated by Response Module")
)
)
)
@@ -40,7 +42,6 @@ app_driver_tm_g_response <- function() {
}
testthat::test_that("e2e - tm_g_response: module is initialised with the specified defaults.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_response()
@@ -59,7 +60,6 @@ testthat::test_that("e2e - tm_g_response: module is initialised with the specifi
})
testthat::test_that("e2e - tm_g_response: encoding inputs produce output without validation errors.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_response()
@@ -90,7 +90,6 @@ testthat::test_that("e2e - tm_g_response: encoding inputs produce output without
})
testthat::test_that("e2e - tm_g_response: deselecting response produces validation error.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_response()
@@ -102,7 +101,6 @@ testthat::test_that("e2e - tm_g_response: deselecting response produces validati
})
testthat::test_that("e2e - tm_g_response: deselecting x produces validation error.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_response()
diff --git a/tests/testthat/test-shinytest2-tm_g_scatterplot.R b/tests/testthat/test-shinytest2-tm_g_scatterplot.R
index 4ca19d26c..07bce5ee4 100644
--- a/tests/testthat/test-shinytest2-tm_g_scatterplot.R
+++ b/tests/testthat/test-shinytest2-tm_g_scatterplot.R
@@ -7,84 +7,85 @@ app_driver_tm_g_scatterplot <- function() {
teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[names(data)]
init_teal_app_driver(
- data = data,
- modules = tm_g_scatterplot(
- label = "Scatterplot Choices",
- x = teal.transform::data_extract_spec(
- dataname = "ADSL",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "BMRKR1", "BMRKR2")),
- selected = "AGE",
- multiple = FALSE,
- fixed = FALSE
- )
- ),
- y = teal.transform::data_extract_spec(
- dataname = "ADSL",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "BMRKR1", "BMRKR2")),
- selected = "BMRKR1",
- multiple = FALSE,
- fixed = FALSE
- )
- ),
- color_by = data_extract_spec(
- dataname = "ADSL",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(
- data[["ADSL"]],
- c("AGE", "BMRKR1", "BMRKR2", "RACE", "REGION1")
- ),
- selected = NULL,
- multiple = FALSE,
- fixed = FALSE
- )
- ),
- size_by = data_extract_spec(
- dataname = "ADSL",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "BMRKR1")),
- selected = "AGE",
- multiple = FALSE,
- fixed = FALSE
- )
- ),
- row_facet = data_extract_spec(
- dataname = "ADSL",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["ADSL"]], c("BMRKR2", "RACE", "REGION1")),
- selected = NULL,
- multiple = FALSE,
- fixed = FALSE
- )
- ),
- col_facet = data_extract_spec(
- dataname = "ADSL",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["ADSL"]], c("BMRKR2", "RACE", "REGION1")),
- selected = NULL,
- multiple = FALSE,
- fixed = FALSE
- )
- ),
- ggplot2_args = teal.widgets::ggplot2_args(
- labs = list(subtitle = "Plot generated by Scatterplot Module")
- ),
- rotate_xaxis_labels = TRUE,
- ggtheme = "classic",
- max_deg = 6
+ teal::init(
+ data = data,
+ modules = tm_g_scatterplot(
+ label = "Scatterplot Choices",
+ x = teal.transform::data_extract_spec(
+ dataname = "ADSL",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "BMRKR1", "BMRKR2")),
+ selected = "AGE",
+ multiple = FALSE,
+ fixed = FALSE
+ )
+ ),
+ y = teal.transform::data_extract_spec(
+ dataname = "ADSL",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "BMRKR1", "BMRKR2")),
+ selected = "BMRKR1",
+ multiple = FALSE,
+ fixed = FALSE
+ )
+ ),
+ color_by = data_extract_spec(
+ dataname = "ADSL",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(
+ data[["ADSL"]],
+ c("AGE", "BMRKR1", "BMRKR2", "RACE", "REGION1")
+ ),
+ selected = NULL,
+ multiple = FALSE,
+ fixed = FALSE
+ )
+ ),
+ size_by = data_extract_spec(
+ dataname = "ADSL",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "BMRKR1")),
+ selected = "AGE",
+ multiple = FALSE,
+ fixed = FALSE
+ )
+ ),
+ row_facet = data_extract_spec(
+ dataname = "ADSL",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["ADSL"]], c("BMRKR2", "RACE", "REGION1")),
+ selected = NULL,
+ multiple = FALSE,
+ fixed = FALSE
+ )
+ ),
+ col_facet = data_extract_spec(
+ dataname = "ADSL",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["ADSL"]], c("BMRKR2", "RACE", "REGION1")),
+ selected = NULL,
+ multiple = FALSE,
+ fixed = FALSE
+ )
+ ),
+ ggplot2_args = teal.widgets::ggplot2_args(
+ labs = list(subtitle = "Plot generated by Scatterplot Module")
+ ),
+ rotate_xaxis_labels = TRUE,
+ ggtheme = "classic",
+ max_deg = 6
+ )
)
)
}
testthat::test_that("e2e - tm_g_scatterplot: Module is initialised with the specified defaults.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app <- app_driver_tm_g_scatterplot()
@@ -111,7 +112,6 @@ testthat::test_that("e2e - tm_g_scatterplot: Module is initialised with the spec
})
testthat::test_that("e2e - tm_g_scatterplot: Base for the log transformation can be applied.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app <- app_driver_tm_g_scatterplot()
@@ -132,7 +132,6 @@ testthat::test_that("e2e - tm_g_scatterplot: Base for the log transformation can
})
testthat::test_that("e2e - tm_g_scatterplot: The log transform is only possible for positive numeric vars.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app <- app_driver_tm_g_scatterplot()
@@ -152,7 +151,6 @@ testthat::test_that("e2e - tm_g_scatterplot: The log transform is only possible
})
testthat::test_that("e2e - tm_g_scatterplot: Get validation error when facetting with the same row & col variable.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app <- app_driver_tm_g_scatterplot()
@@ -164,8 +162,7 @@ testthat::test_that("e2e - tm_g_scatterplot: Get validation error when facetting
app$stop()
})
-testthat::test_that("e2e - tm_g_scatterplot: The encoding inputs produce output without validation errors.", {
- testthat::skip("chromium")
+testthat::test_that("e2e - tm_g_scatterplot: The encoding inputs are set without validation errors.", {
skip_if_too_deep(5)
app <- app_driver_tm_g_scatterplot()
diff --git a/tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R b/tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R
index f5733eef9..918cbf6da 100644
--- a/tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R
+++ b/tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R
@@ -1,82 +1,80 @@
app_driver_tm_g_scatterplotmatrix <- function() { # nolint: object_length_linter.
data <- simple_cdisc_data()
init_teal_app_driver(
- data = data,
- modules = tm_g_scatterplotmatrix(
- label = "Scatterplot matrix",
- variables = list(
- teal.transform::data_extract_spec(
- dataname = "ADSL",
- select = teal.transform::select_spec(
- label = "Select variables:",
- choices = teal.transform::variable_choices(data[["ADSL"]]),
- selected = c("AGE", "RACE", "SEX"),
- multiple = TRUE,
- ordered = TRUE,
- fixed = FALSE
- )
- ),
- teal.transform::data_extract_spec(
- dataname = "ADRS",
- filter = teal.transform::filter_spec(
- label = "Select endpoints:",
- vars = c("PARAMCD", "AVISIT"),
- choices = teal.transform::value_choices(data[["ADRS"]], c("PARAMCD", "AVISIT"), c("PARAM", "AVISIT")),
- selected = "INVET - END OF INDUCTION",
- multiple = TRUE
+ teal::init(
+ data = data,
+ modules = tm_g_scatterplotmatrix(
+ label = "Scatterplot matrix",
+ variables = list(
+ teal.transform::data_extract_spec(
+ dataname = "ADSL",
+ select = teal.transform::select_spec(
+ label = "Select variables:",
+ choices = teal.transform::variable_choices(data[["ADSL"]]),
+ selected = c("AGE", "RACE", "SEX"),
+ multiple = TRUE,
+ ordered = TRUE,
+ fixed = FALSE
+ )
),
- select = teal.transform::select_spec(
- label = "Select variables:",
- choices = teal.transform::variable_choices(data[["ADRS"]]),
- selected = c("AGE", "AVAL", "ADY"),
- multiple = TRUE,
- ordered = TRUE,
- fixed = FALSE
+ teal.transform::data_extract_spec(
+ dataname = "ADRS",
+ filter = teal.transform::filter_spec(
+ label = "Select endpoints:",
+ vars = c("PARAMCD", "AVISIT"),
+ choices = teal.transform::value_choices(data[["ADRS"]], c("PARAMCD", "AVISIT"), c("PARAM", "AVISIT")),
+ selected = "INVET - END OF INDUCTION",
+ multiple = TRUE
+ ),
+ select = teal.transform::select_spec(
+ label = "Select variables:",
+ choices = teal.transform::variable_choices(data[["ADRS"]]),
+ selected = c("AGE", "AVAL", "ADY"),
+ multiple = TRUE,
+ ordered = TRUE,
+ fixed = FALSE
+ )
)
- )
- ),
- plot_height = c(600, 200, 2000),
- plot_width = NULL,
- pre_output = NULL,
- post_output = NULL
+ ),
+ plot_height = c(600, 200, 2000),
+ plot_width = NULL,
+ pre_output = NULL,
+ post_output = NULL
+ )
),
timeout = 3000
)
}
test_that("e2e - tm_g_scatterplotmatrix: Initializes without errors", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_scatterplotmatrix()
app_driver$expect_no_shiny_error()
- testthat::expect_equal(
- app_driver$get_text("#teal-teal_modules-active_tab .active"),
- "Scatterplot matrix"
- )
+ testthat::expect_equal(app_driver$get_text(".teal-modules-tree .active"), "Scatterplot matrix")
- encoding_dataset <- app_driver$get_text("#teal-teal_modules-scatterplot_matrix .help-block")
+ encoding_dataset <- app_driver$get_text(paste(app_driver$namespaces(TRUE)$wrapper(NULL), ".help-block"))
testthat::expect_match(encoding_dataset, "Datasets.*ADSL.*ADRS", all = FALSE)
app_driver$stop()
})
test_that("e2e - tm_g_scatterplotmatrix: Verify module displays data table", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_scatterplotmatrix()
# table
testthat::expect_true(
- app_driver$is_visible(sprintf("%s .shiny-plot-output", app_driver$active_module_element("myplot-plot_out_main")))
+ app_driver$is_visible(
+ app_driver$namespaces(TRUE)$module("myplot-plot_out_main .shiny-plot-output")
+ )
)
app_driver$stop()
})
test_that("e2e - tm_g_scatterplotmatrix: Verify default values and settings (data_extracts) for data selection", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_scatterplotmatrix()
@@ -104,7 +102,6 @@ test_that("e2e - tm_g_scatterplotmatrix: Verify default values and settings (dat
})
test_that("e2e - tm_g_scatterplotmatrix: Change plot settings", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_scatterplotmatrix()
@@ -113,7 +110,7 @@ test_that("e2e - tm_g_scatterplotmatrix: Change plot settings", {
app_driver$expect_no_validation_error()
- app_driver$click(selector = app_driver$active_module_element("cor"))
+ app_driver$click(selector = app_driver$namespaces(TRUE)$module("cor"))
app_driver$expect_no_validation_error()
app_driver$stop()
})
diff --git a/tests/testthat/test-shinytest2-tm_misssing_data.R b/tests/testthat/test-shinytest2-tm_misssing_data.R
index 58f61a88c..73d602f2b 100644
--- a/tests/testthat/test-shinytest2-tm_misssing_data.R
+++ b/tests/testthat/test-shinytest2-tm_misssing_data.R
@@ -14,21 +14,23 @@ app_driver_tm_missing_data <- function() {
})
init_teal_app_driver(
- data = data,
- modules = tm_missing_data(
- label = "Missing data",
- plot_height = c(600, 400, 5000),
- plot_width = NULL,
- datanames = "all",
- ggtheme = "gray",
- ggplot2_args = list(
- "Combinations Hist" = teal.widgets::ggplot2_args(
- labs = list(subtitle = "Plot produced by Missing Data Module", caption = NULL)
+ teal::init(
+ data = data,
+ modules = tm_missing_data(
+ label = "Missing data",
+ plot_height = c(600, 400, 5000),
+ plot_width = NULL,
+ datanames = "all",
+ ggtheme = "gray",
+ ggplot2_args = list(
+ "Combinations Hist" = teal.widgets::ggplot2_args(
+ labs = list(subtitle = "Plot produced by Missing Data Module", caption = NULL)
+ ),
+ "Combinations Main" = teal.widgets::ggplot2_args(labs = list(title = NULL))
),
- "Combinations Main" = teal.widgets::ggplot2_args(labs = list(title = NULL))
- ),
- pre_output = NULL,
- post_output = NULL
+ pre_output = NULL,
+ post_output = NULL
+ )
),
timeout = 3000,
seed = 1
@@ -36,21 +38,14 @@ app_driver_tm_missing_data <- function() {
}
test_that("e2e - tm_missing_data: Initializes without errors", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_missing_data()
app_driver$expect_no_shiny_error()
- testthat::expect_equal(
- app_driver$get_text("#teal-teal_modules-active_tab .active"),
- "Missing data"
- )
-
- encoding_dataset <- app_driver$get_text(
- app_driver$active_module_element("dataset_encodings .help-block")
- )
+ testthat::expect_equal(app_driver$get_text(".teal-modules-tree .active"), "Missing data")
+ encoding_dataset <- app_driver$get_text(paste(app_driver$namespaces(TRUE)$wrapper(NULL), ".help-block"))
testthat::expect_match(encoding_dataset, "Datasets.*iris.*mtcars", all = FALSE)
@@ -58,7 +53,6 @@ test_that("e2e - tm_missing_data: Initializes without errors", {
})
test_that("e2e - tm_missing_data: Default settings and visibility of the summary graph", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_missing_data()
# default summary tab
@@ -72,18 +66,15 @@ test_that("e2e - tm_missing_data: Default settings and visibility of the summary
c("Petal.Length", "Sepal.Length", "Petal.Width", "Species", "Sepal.Width")
)
- app_driver$click(selector = app_driver$active_module_element("iris-filter_na"))
+ app_driver$click(selector = app_driver$namespaces(TRUE)$module("iris-filter_na"))
app_driver$expect_no_validation_error()
- app_driver$click(selector = app_driver$active_module_element("iris-any_na"))
+ app_driver$click(selector = app_driver$namespaces(TRUE)$module("iris-any_na"))
app_driver$expect_no_validation_error()
testthat::expect_true(
app_driver$is_visible(
- sprintf(
- "%s .shiny-plot-output",
- app_driver$active_module_element("iris-summary_plot-plot_out_main")
- )
+ app_driver$namespaces(TRUE)$module("iris-summary_plot-plot_out_main .shiny-plot-output")
)
)
@@ -91,7 +82,6 @@ test_that("e2e - tm_missing_data: Default settings and visibility of the summary
})
test_that("e2e - tm_missing_data: Check default settings and visibility of the combinations graph and encodings", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_missing_data()
@@ -103,10 +93,7 @@ test_that("e2e - tm_missing_data: Check default settings and visibility of the c
app_driver$expect_no_validation_error()
testthat::expect_true(
app_driver$is_visible(
- sprintf(
- "%s .shiny-plot-output",
- app_driver$active_module_element("iris-combination_plot-plot_out_main")
- )
+ app_driver$namespaces(TRUE)$module("iris-combination_plot-plot_out_main .shiny-plot-output")
)
)
@@ -114,22 +101,19 @@ test_that("e2e - tm_missing_data: Check default settings and visibility of the c
testthat::expect_true(
app_driver$is_visible(
- sprintf(
- "%s .shiny-input-container",
- app_driver$active_module_element("iris-cutoff")
- )
+ app_driver$namespaces(TRUE)$module("iris-cutoff .shiny-input-container")
)
)
- testthat::expect_equal(app_driver$get_active_module_input("iris-combination_cutoff"), 2L)
+ testthat::expect_equal(app_driver$get_active_module_input("iris-combination_cutoff"), 1L)
app_driver$set_active_module_input("iris-combination_cutoff", 10L)
+ testthat::expect_equal(app_driver$get_active_module_input("iris-combination_cutoff"), 10L)
app_driver$expect_no_validation_error()
app_driver$stop()
})
test_that("e2e - tm_missing_data: Validate functionality and UI response for 'By Variable Levels'", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_missing_data()
# By variable levels
@@ -154,18 +138,17 @@ test_that("e2e - tm_missing_data: Validate functionality and UI response for 'By
"counts"
)
app_driver$set_active_module_input("iris-count_type", "proportions")
- testthat::expect_true(app_driver$is_visible(app_driver$active_module_element("iris-levels_table")))
+ testthat::expect_true(app_driver$is_visible(app_driver$namespaces(TRUE)$module("iris-levels_table")))
app_driver$stop()
})
test_that("e2e - tm_missing_data: Validate 'By Variable Levels' table values", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_missing_data()
app_driver$set_active_module_input("iris-summary_type", "By Variable Levels")
- levels_table <- app_driver$active_module_element("iris-levels_table") %>%
+ levels_table <- app_driver$namespaces(TRUE)$module("iris-levels_table") %>%
app_driver$get_html_rvest() %>%
rvest::html_table(fill = TRUE) %>%
.[[1]]
diff --git a/tests/testthat/test-shinytest2-tm_outliers.R b/tests/testthat/test-shinytest2-tm_outliers.R
index 9468f7653..bdd83a5fd 100644
--- a/tests/testthat/test-shinytest2-tm_outliers.R
+++ b/tests/testthat/test-shinytest2-tm_outliers.R
@@ -14,34 +14,36 @@ app_driver_tm_outlier <- function() {
)
init_teal_app_driver(
- data = data,
- modules = tm_outliers(
- outlier_var = list(
- teal.transform::data_extract_spec(
- dataname = "CO2",
- select = teal.transform::select_spec(
- label = "Select variable:",
- choices = teal.transform::variable_choices(data[["CO2"]], c("conc", "uptake")),
- selected = "uptake",
- multiple = FALSE,
- fixed = FALSE
+ teal::init(
+ data = data,
+ modules = tm_outliers(
+ outlier_var = list(
+ teal.transform::data_extract_spec(
+ dataname = "CO2",
+ select = teal.transform::select_spec(
+ label = "Select variable:",
+ choices = teal.transform::variable_choices(data[["CO2"]], c("conc", "uptake")),
+ selected = "uptake",
+ multiple = FALSE,
+ fixed = FALSE
+ )
)
- )
- ),
- categorical_var = list(
- teal.transform::data_extract_spec(
- dataname = "CO2",
- filter = teal.transform::filter_spec(
- vars = vars,
- choices = teal.transform::value_choices(data[["CO2"]], vars$selected),
- selected = teal.transform::value_choices(data[["CO2"]], vars$selected),
- multiple = TRUE
+ ),
+ categorical_var = list(
+ teal.transform::data_extract_spec(
+ dataname = "CO2",
+ filter = teal.transform::filter_spec(
+ vars = vars,
+ choices = teal.transform::value_choices(data[["CO2"]], vars$selected),
+ selected = teal.transform::value_choices(data[["CO2"]], vars$selected),
+ multiple = TRUE
+ )
+ )
+ ),
+ ggplot2_args = list(
+ teal.widgets::ggplot2_args(
+ labs = list(subtitle = "Plot generated by Outliers Module")
)
- )
- ),
- ggplot2_args = list(
- teal.widgets::ggplot2_args(
- labs = list(subtitle = "Plot generated by Outliers Module")
)
)
)
@@ -49,18 +51,14 @@ app_driver_tm_outlier <- function() {
}
testthat::test_that("e2e - tm_outliers: Data parameter and module label is passed properly.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_outlier()
app_driver$expect_no_shiny_error()
- testthat::expect_equal(
- app_driver$get_text("#teal-teal_modules-active_tab .active"),
- "Outliers Module"
- )
+ testthat::expect_equal(app_driver$get_text(".teal-modules-tree .active"), "Outliers Module")
- encoding_dataset <- app_driver$get_text("#teal-teal_modules-outliers_module .help-block")
+ encoding_dataset <- app_driver$get_text(paste(app_driver$namespaces(TRUE)$wrapper(NULL), ".help-block"))
testthat::expect_match(encoding_dataset, "Dataset:[\n ]*CO2", all = FALSE)
testthat::expect_match(encoding_dataset, "Outlier data points", all = FALSE)
@@ -70,7 +68,6 @@ testthat::test_that("e2e - tm_outliers: Data parameter and module label is passe
testthat::test_that("e2e - tm_outliers:
Data extract spec elements are initialized with the default values
specified by outlier_var and categorical_var argument.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_outlier()
@@ -107,7 +104,6 @@ testthat::test_that("e2e - tm_outliers:
})
testthat::test_that("e2e - tm_outliers: Plot type is correctly set by default and has appropriate possible options.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_outlier()
@@ -115,7 +111,7 @@ testthat::test_that("e2e - tm_outliers: Plot type is correctly set by default an
testthat::expect_identical(app_driver$get_active_module_input("boxplot_alts"), "Box plot")
- plot_choices <- app_driver$active_module_element_text("boxplot_alts")
+ plot_choices <- app_driver$get_text(app_driver$namespaces(TRUE)$module("boxplot_alts"))
testthat::expect_match(plot_choices, "Violin plot", fixed = TRUE)
app_driver$set_active_module_input("boxplot_alts", "Violin plot")
@@ -125,7 +121,6 @@ testthat::test_that("e2e - tm_outliers: Plot type is correctly set by default an
})
testthat::test_that("e2e - tm_outliers: Module is divided into 3 tabs.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_outlier()
@@ -133,7 +128,9 @@ testthat::test_that("e2e - tm_outliers: Module is divided into 3 tabs.", {
testthat::expect_identical(app_driver$get_active_module_input("tabs"), "Boxplot")
testthat::expect_match(
- app_driver$active_module_element_text("tabs"),
+ app_driver$get_text(
+ app_driver$namespaces(TRUE)$module("tabs")
+ ),
"Boxplot.*Density Plot.*Cumulative Distribution Plot",
fixed = FALSE
)
@@ -141,25 +138,23 @@ testthat::test_that("e2e - tm_outliers: Module is divided into 3 tabs.", {
})
testthat::test_that("e2e - tm_outliers: Plot type is hidden when Boxplot tab is not selected.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_outlier()
app_driver$expect_no_shiny_error()
- testthat::expect_true(app_driver$is_visible(app_driver$active_module_element("boxplot_alts")))
+ testthat::expect_true(app_driver$is_visible(app_driver$namespaces(TRUE)$module("boxplot_alts")))
app_driver$set_active_module_input("tabs", "Density Plot")
- testthat::expect_false(app_driver$is_visible(app_driver$active_module_element("boxplot_alts")))
+ testthat::expect_false(app_driver$is_visible(app_driver$namespaces(TRUE)$module("boxplot_alts")))
app_driver$set_active_module_input("tabs", "Cumulative Distribution Plot")
- testthat::expect_false(app_driver$is_visible(app_driver$active_module_element("boxplot_alts")))
+ testthat::expect_false(app_driver$is_visible(app_driver$namespaces(TRUE)$module("boxplot_alts")))
app_driver$stop()
})
testthat::test_that("e2e - tm_outliers: Default radio buttons are set properly.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_outlier()
@@ -176,14 +171,13 @@ testthat::test_that("e2e - tm_outliers: Default radio buttons are set properly."
})
testthat::test_that("e2e - tm_outliers: Method parameters are set properly.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_outlier()
app_driver$expect_no_shiny_error()
testthat::expect_identical(app_driver$get_active_module_input("method"), "IQR")
- method_choices <- app_driver$active_module_element_text("method")
+ method_choices <- app_driver$get_text(app_driver$namespaces(TRUE)$module("method"))
testthat::expect_match(method_choices, "Z-score", fixed = TRUE)
testthat::expect_match(method_choices, "Percentile", fixed = TRUE)
@@ -192,21 +186,24 @@ testthat::test_that("e2e - tm_outliers: Method parameters are set properly.", {
testthat::test_that("e2e - tm_outliers:
Outlier definition text and range are displayed properly depending on method.", {
- testthat::skip("chromium")
skip_if_too_deep(5)
app_driver <- app_driver_tm_outlier()
app_driver$expect_no_shiny_error()
# Initially only the first slider should be visible.
- testthat::expect_true(app_driver$is_visible(app_driver$active_module_element("iqr_slider")))
- testthat::expect_false(app_driver$is_visible(app_driver$active_module_element("zscore_slider")))
- testthat::expect_false(app_driver$is_visible(app_driver$active_module_element("percentile_slider")))
+ testthat::expect_true(app_driver$is_visible(app_driver$namespaces(TRUE)$module("iqr_slider")))
+ testthat::expect_false(app_driver$is_visible(app_driver$namespaces(TRUE)$module("zscore_slider")))
+ testthat::expect_false(app_driver$is_visible(app_driver$namespaces(TRUE)$module("percentile_slider")))
# IQR METHOD
testthat::expect_identical(app_driver$get_active_module_input("method"), "IQR")
testthat::expect_match(
- normalize_math_italic_text(app_driver$active_module_element_text("ui_outlier_help")),
+ normalize_math_italic_text(
+ app_driver$get_text(
+ app_driver$namespaces(TRUE)$module("ui_outlier_help")
+ )
+ ),
"x