Skip to content

Commit

Permalink
@m7pr suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikeyakirar committed Apr 16, 2024
1 parent 10d2106 commit e7c4228
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 28 deletions.
25 changes: 0 additions & 25 deletions tests/testthat/helper-TealAppDriver.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,3 @@ simple_cdisc_data <- function(datasets = c("ADSL", "ADRS", "ADTTE")) {
teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[datasets]
data
}

# local app drivers for module testing ----------------------------------------
# based on examples

app_driver_tm_data_table <- function() {
app <- TealAppDriver$new(
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")
),
datasets_selected = 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
)
}
28 changes: 25 additions & 3 deletions tests/testthat/test-shinytest2-tm_data_table.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
test_that("e2e: tm_front_page initializes without errors", {
app_driver_tm_data_table <- function() {
app <- TealAppDriver$new(
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")
),
datasets_selected = 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", {
skip_if_too_deep(5)
app_driver <- app_driver_tm_data_table()

app_driver$expect_no_shiny_error()
app_driver$stop()
})

test_that("e2e: tm_front_page displays data table", {
test_that("e2e: tm_data_table displays data table", {
skip_if_too_deep(5)
app_driver <- app_driver_tm_data_table()

Expand All @@ -17,7 +39,7 @@ test_that("e2e: tm_front_page displays data table", {
app_driver$stop()
})

test_that("e2e: tm_front_page variable selection", {
test_that("e2e: tm_data_table variable selection", {
skip_if_too_deep(5)
app_driver <- app_driver_tm_data_table()

Expand Down

0 comments on commit e7c4228

Please sign in to comment.