Skip to content

Commit

Permalink
Merge branch 'main' into 712-tm_a_regression@main
Browse files Browse the repository at this point in the history
  • Loading branch information
m7pr authored Apr 19, 2024
2 parents 608fb71 + c143c28 commit 1abd428
Show file tree
Hide file tree
Showing 4 changed files with 429 additions and 3 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: teal.modules.general
Title: General Modules for 'teal' Applications
Version: 0.3.0.9010
Date: 2024-04-18
Version: 0.3.0.9012
Date: 2024-04-19
Authors@R: c(
person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre")),
person("Pawel", "Rucki", , "pawel.rucki@roche.com", role = "aut"),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# teal.modules.general 0.3.0.9010
# teal.modules.general 0.3.0.9012

# teal.modules.general 0.3.0

Expand Down
113 changes: 113 additions & 0 deletions tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
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
),
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
),
timeout = 3000
)
}

test_that("e2e - tm_g_scatterplotmatrix: Initializes without errors", {
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-main_ui-root-active_tab > li.active > a"),
"Scatterplot matrix"
)

encoding_dataset <- app_driver$get_text("#teal-main_ui-root-scatterplot_matrix .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", {
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_scatterplotmatrix()

# table
testthat::expect_true(app_driver$is_visible(selector = app_driver$active_module_element("myplot-plot_out_main")))

app_driver$stop()
})

test_that("e2e - tm_g_scatterplotmatrix: Verify default values and settings (data_extracts) for data selection", {
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_scatterplotmatrix()

# default variable selection
dataset <- app_driver$get_active_module_input("variables-dataset")
variables <- app_driver$get_active_module_input(sprintf(
"variables-dataset_%s_singleextract-select",
dataset
))
testthat::expect_equal(
dataset,
"ADSL"
)
testthat::expect_equal(
variables,
c("AGE", "SEX", "RACE")
)

# new variable selection
app_driver$set_active_module_input("variables-dataset", "ADRS")
app_driver$set_active_module_input("dataset_ADRS_singleextract-select", c("SEX", "RACE", "ETHNIC"))
app_driver$expect_no_validation_error()

app_driver$stop()
})

test_that("e2e - tm_g_scatterplotmatrix: Change plot settings", {
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_scatterplotmatrix()

app_driver$set_active_module_input("alpha", 0.7)
app_driver$set_active_module_input("cex", 2)

app_driver$expect_no_validation_error()

app_driver$click(selector = app_driver$active_module_element("cor"))
app_driver$expect_no_validation_error()
app_driver$stop()
})
Loading

0 comments on commit 1abd428

Please sign in to comment.