-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part of #712 - [x] tested header-text - [x] tested table displayed correctly - [x] additional argument tags. - [x] checked metadata data --------- Signed-off-by: kartikeya kirar <kirar.kartikeya1@gmail.com> Co-authored-by: André Veríssimo <211358+averissimo@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Vedha Viyash <49812166+vedhav@users.noreply.github.com>
- Loading branch information
1 parent
c143c28
commit 715e40e
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
app_driver_tm_front_page <- function() { | ||
data <- simple_cdisc_data() | ||
data <- within(data, { | ||
attr(ADSL, "metadata") <- list("Author" = "NEST team", "data_source" = "synthetic data") | ||
}) | ||
|
||
init_teal_app_driver( | ||
data = data, | ||
modules = tm_front_page( | ||
label = "Front page", | ||
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", | ||
show_metadata = TRUE | ||
), | ||
timeout = 3000 | ||
) | ||
} | ||
|
||
test_that("e2e - tm_front_page: Initializes without errors and check html elements", { | ||
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-main_ui-root-active_tab > li.active > a"), | ||
"Front page" | ||
) | ||
|
||
# header text | ||
testthat::expect_match( | ||
app_driver$get_text(selector = "#front_page_headers"), | ||
"Important information" | ||
) | ||
# additional tags | ||
testthat::expect_match( | ||
app_driver$get_text(selector = "#front_page_custom_html"), | ||
"Additional HTML or shiny tags go here" | ||
) | ||
app_driver$stop() | ||
}) | ||
|
||
test_that("e2e - tm_front_page: Verify the module displays tables", { | ||
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(selector = app_driver$active_module_element("table_1"))) | ||
|
||
testthat::expect_match(app_driver$get_active_module_output("table_2"), "IRIS") | ||
testthat::expect_true(app_driver$is_visible(selector = app_driver$active_module_element("table_2"))) | ||
app_driver$stop() | ||
}) | ||
|
||
test_that("e2e - tm_front_page: Verify the module displays metadata", { | ||
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(selector = app_driver$active_module_element("metadata_table"))) | ||
|
||
app_driver$stop() | ||
}) |