Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
78b6937
fix: namespace in TealAppDriver
averissimo Jul 14, 2025
5c2547c
feat: shinytest2-teal_slices passes
averissimo Jul 14, 2025
fdd3839
feat: shinytest2-data_summary passes
averissimo Jul 14, 2025
2785557
feat: shinytest2-decorators passes
averissimo Jul 14, 2025
8ba4976
feat: shinytest2-init passes
averissimo Jul 14, 2025
cce26d9
feat: shinytest2-filter_panel passes
averissimo Jul 14, 2025
9d180ad
e2e: landing_popup passes
averissimo Jul 15, 2025
e6c40a9
e2e: bookmark_manager passes
averissimo Jul 15, 2025
e7690e8
e2e: reporter passes
averissimo Jul 15, 2025
37fac62
e2e: show-rcode passes
averissimo Jul 15, 2025
e3fc4ba
e2e: teal_data_module passes
averissimo Jul 15, 2025
f76a74f
e2e: wunder_bar passes
averissimo Jul 15, 2025
b9c5f33
e2e: decorators passes
averissimo Jul 15, 2025
0080615
e2e: decorators passes (2)
averissimo Jul 15, 2025
90b41bd
feat: initial bslib regression tests on visibility of sidebar
averissimo Jul 15, 2025
195962f
chore: fix lintr
averissimo Jul 15, 2025
b696e1e
feat: take screenshot of initial run
averissimo Jul 15, 2025
77e4ccf
feat: be more explicit when testing for not null
averissimo Jul 16, 2025
d2f020c
chore: standardize with app() and use same selector when looking for …
averissimo Jul 16, 2025
beba32b
feat: expect screenshot for ui (with the exception of footer as the p…
averissimo Jul 16, 2025
a300b4f
feat: include snaps
averissimo Jul 17, 2025
d702108
Merge branch 'main' into 1535-regression
averissimo Jul 17, 2025
ffc5327
[skip style] [skip vbump] Restyle files
github-actions[bot] Jul 17, 2025
513347f
empty: trigger ci
averissimo Jul 17, 2025
bc507ad
feat: suppress warning and integrate PR feedback
averissimo Jul 22, 2025
0c9ddfc
Update tests/testthat/test-shinytest2-teal_data_module.R
averissimo Jul 22, 2025
df12d0e
docs: improve comment
averissimo Jul 22, 2025
a2780ad
Update tests/testthat/test-shinytest2-teal_data_module.R
averissimo Jul 22, 2025
371244d
fix: accordian typos
averissimo Jul 22, 2025
a7e7db1
fix: missing parenthesis
averissimo Jul 22, 2025
7dea65a
chore: move example_teal_data_module (pr feedback)
averissimo Jul 22, 2025
ceb7f3d
pr: check if elements are visible before hand
averissimo Jul 22, 2025
d86b514
pr: revert last change and create test that checks visible
averissimo Jul 22, 2025
307200c
pr: remove repetitive check and use same selector
averissimo Jul 22, 2025
4cac42c
chore: move testing_depth to help development and similarly to other …
averissimo Jul 23, 2025
a8ce7e6
feat: using html id instead of partial match
averissimo Jul 23, 2025
37feb4b
Merge branch 'main' into 1535-regression
averissimo Jul 23, 2025
e8fdf77
fix: make sure we assign the proper tab namespace based on the href
vedhav Jul 24, 2025
a2889ee
Update DESCRIPTION
averissimo Jul 24, 2025
56ffd77
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Jul 24, 2025
e371252
fix: integrating @vedhav code
averissimo Jul 24, 2025
b6c59b5
Merge branch 'main' into 1535-regression
averissimo Jul 24, 2025
84043bc
Update R/TealAppDriver.R
vedhav Jul 24, 2025
46d6994
[skip style] [skip vbump] Restyle files
github-actions[bot] Jul 24, 2025
c10d78b
empty: trigger ci
averissimo Jul 24, 2025
eb3bd9a
Merge remote-tracking branch 'origin/fix-test-ns@main' into 1535-regr…
averissimo Jul 24, 2025
a831f25
Merge branch 'main' into 1535-regression
averissimo Jul 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/TealAppDriver.R
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
replacement = "",
self$get_text(
sprintf(
"#%s-filters-%s .filter-card-varname",
"#%s-filters-%s-container .filter-card-varname",
self$active_filters_ns(),
x
)
Expand Down
3 changes: 2 additions & 1 deletion R/reporter_previewer_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ reporter_previewer_module <- function(label = "Report previewer", server_args =
server = srv, ui = ui,
server_args = server_args, ui_args = list(), datanames = NULL
)
# Module is created with a placeholder label and the label is changed later.
# Module is created with a placeholder label and path and both are changed later.
# This is to prevent another module being labeled "Report previewer".
class(module) <- c(class(module), "teal_module_previewer")
module$label <- label
module$path <- label
Comment thread
llrs-roche marked this conversation as resolved.
attr(module, "teal_bookmarkable") <- TRUE
module
}
Expand Down
4 changes: 3 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,9 @@ create_app_id <- function(data, modules) {
}
modules <- lapply(modules, defunction)

rlang::hash(list(data = data, modules = modules))
# Suppress warnings of type: `package:MultiAssayExperiment' may not be available when loading`
# This is because the package namespace may be part of the `data` object
suppressWarnings(rlang::hash(list(data = data, modules = modules)))
}

#' Go through list and extract bodies of encountered functions as string, recursively.
Expand Down
6 changes: 3 additions & 3 deletions inst/css/sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ a.disabled {
--bs-accordion-active-bg: rgba(var(--bs-secondary-rgb), 0.3);
}

.teal-transform-accordian .accordion-button {
.teal-transform-accordion .accordion-button {
--bs-accordion-btn-padding-y: 0.5rem;
--bs-accordion-btn-padding-x: 0.5rem;
}

.teal-transform-accordian .accordion-button:not(.collapsed)::after,
.teal-transform-accordian .accordion-button::after {
.teal-transform-accordion .accordion-button:not(.collapsed)::after,
.teal-transform-accordion .accordion-button::after {
display: none;
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/testthat/test-module_teal.R
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ testthat::describe("srv_teal teal_modules", {
`teal_modules-active_module_id` = "module_1"
)
out <- modules_output$module_1()
testthat::expect_true(!is.null(out))
testthat::expect_type(out, "double")
Comment thread
llrs-roche marked this conversation as resolved.
session$setInputs(`data-teal_data_module-dataset` = "mtcars")
testthat::expect_identical(out, modules_output$module_1())
}
Expand Down
107 changes: 50 additions & 57 deletions tests/testthat/test-shinytest2-data_summary.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
testthat::test_that("e2e: data summary just list the unfilterable objects at the bottom when provided", {
testthat::skip("chromium")
skip_if_too_deep(5)
app <- TealAppDriver$new(
data = teal.data::teal_data(x = 1, y = "z", foo = function() NULL),
Expand All @@ -15,7 +14,6 @@ testthat::test_that("e2e: data summary just list the unfilterable objects at the
})

testthat::test_that("e2e: data summary table is displayed with 2 columns data without keys", {
testthat::skip("chromium")
skip_if_too_deep(5)
app <- TealAppDriver$new(
data = simple_teal_data(), # iris, mtcars
Expand All @@ -35,7 +33,6 @@ testthat::test_that("e2e: data summary table is displayed with 2 columns data wi
})

testthat::test_that("e2e: data summary table displays datasets by topological_sort of join_keys", {
testthat::skip("chromium")
skip_if_too_deep(5)

data <- teal.data::teal_data(mtcars1 = mtcars, mtcars2 = data.frame(am = c(0, 1), test = c("a", "b")))
Expand All @@ -44,10 +41,7 @@ testthat::test_that("e2e: data summary table displays datasets by topological_so
teal.data::join_key("mtcars2", "mtcars1", keys = c("am"))
)

app <- TealAppDriver$new(
data = data,
modules = example_module()
)
app <- TealAppDriver$new(data = data, modules = example_module())

testthat::expect_identical(
as.data.frame(app$get_active_data_summary_table())[["Data Name"]],
Expand All @@ -58,7 +52,6 @@ testthat::test_that("e2e: data summary table displays datasets by topological_so
})

testthat::test_that("e2e: data summary table is displayed with 3 columns for data with join keys", {
testthat::skip("chromium")
skip_if_too_deep(5)

data <- teal.data::teal_data(mtcars1 = mtcars, mtcars2 = data.frame(am = c(0, 1), test = c("a", "b")))
Expand All @@ -67,10 +60,7 @@ testthat::test_that("e2e: data summary table is displayed with 3 columns for dat
teal.data::join_key("mtcars2", "mtcars1", keys = c("am"))
)

app <- TealAppDriver$new(
data = data,
modules = example_module()
)
app <- TealAppDriver$new(data = data, modules = example_module())

testthat::expect_identical(
as.data.frame(app$get_active_data_summary_table()),
Expand All @@ -85,62 +75,51 @@ testthat::test_that("e2e: data summary table is displayed with 3 columns for dat
app$stop()
})

testthat::test_that(
"e2e: data summary table does not list unsupported objects",
{
testthat::skip_if_not_installed("MultiAssayExperiment")
testthat::skip("chromium")
skip_if_too_deep(5)

data <- within(
teal.data::teal_data(),
{
mtcars1 <- mtcars
mtcars2 <- data.frame(am = c(0, 1), test = c("a", "b"))
iris <- iris
library(MultiAssayExperiment)
data("miniACC", package = "MultiAssayExperiment", envir = environment())
unsupported <- function(x) x
# nolint end: object_name.
}
)
testthat::test_that("e2e: data summary table does not list unsupported objects", {
testthat::skip_if_not_installed("MultiAssayExperiment")
skip_if_too_deep(5)

teal.data::join_keys(data) <- teal.data::join_keys(
teal.data::join_key("mtcars2", "mtcars1", keys = c("am"))
)
data <- within(
teal.data::teal_data(),
{
mtcars1 <- mtcars
mtcars2 <- data.frame(am = c(0, 1), test = c("a", "b"))
iris <- iris
library(MultiAssayExperiment)
data("miniACC", package = "MultiAssayExperiment", envir = environment())
unsupported <- function(x) x
# nolint end: object_name.
}
)

app <- TealAppDriver$new(
data = data,
modules = example_module()
)
teal.data::join_keys(data) <- teal.data::join_keys(
teal.data::join_key("mtcars2", "mtcars1", keys = c("am"))
)

app <- TealAppDriver$new(data = data, modules = example_module())
Comment thread
llrs-roche marked this conversation as resolved.

testthat::expect_identical(
as.data.frame(app$get_active_data_summary_table()),
data.frame(
`Data Name` = c(
"iris", "miniACC", "- RNASeq2GeneNorm", "- gistict", "- RPPAArray", "- Mutations", "- miRNASeqGene",
"mtcars2", "mtcars1"
),
Obs = c("150/150", "", "198/198", "198/198", "33/33", "97/97", "471/471", "2/2", "32/32"),
Subjects = c("", "92/92", "79/79", "90/90", "46/46", "90/90", "80/80", "", "2/2"),
check.names = FALSE
)
testthat::expect_identical(
as.data.frame(app$get_active_data_summary_table()),
data.frame(
`Data Name` = c(
"iris", "miniACC", "- RNASeq2GeneNorm", "- gistict", "- RPPAArray", "- Mutations", "- miRNASeqGene",
"mtcars2", "mtcars1"
),
Obs = c("150/150", "", "198/198", "198/198", "33/33", "97/97", "471/471", "2/2", "32/32"),
Subjects = c("", "92/92", "79/79", "90/90", "46/46", "90/90", "80/80", "", "2/2"),
check.names = FALSE
)
)

app$stop()
}
)
app$stop()
})

testthat::test_that("e2e: data summary table displays datasets by names() order if no join_keys", {
testthat::skip("chromium")
skip_if_too_deep(5)

data <- teal.data::teal_data(mtcars1 = mtcars, mtcars2 = data.frame(am = c(0, 1), test = c("a", "b")))

app <- TealAppDriver$new(
data = data,
modules = example_module()
)
app <- TealAppDriver$new(data = data, modules = example_module())

testthat::expect_identical(
as.data.frame(app$get_active_data_summary_table())[["Data Name"]],
Expand All @@ -149,3 +128,17 @@ testthat::test_that("e2e: data summary table displays datasets by names() order

app$stop()
})

testthat::test_that("e2e: data summary UI can be collpased and expanded (`bslib` regression)", {
skip_if_too_deep(5)

data <- teal.data::teal_data(mtcars1 = mtcars, mtcars2 = data.frame(am = c(0, 1), test = c("a", "b")))
app <- TealAppDriver$new(data = data, modules = example_module())

# Visible by default
testthat::expect_true(app$is_visible(".teal-active-data-summary-panel .accordion-collapse"))
app$click(selector = ".teal-active-data-summary-panel .accordion-header button")
testthat::expect_false(app$is_visible(".teal-active-data-summary-panel .accordion-collapse"))

app$stop()
})
8 changes: 2 additions & 6 deletions tests/testthat/test-shinytest2-decorators.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ testthat::skip_if_not_installed("shinytest2")
testthat::skip_if_not_installed("rvest")

testthat::test_that("e2e: module with decorator UI and output is modified interactively upon changes in decorator", {
testthat::skip("chromium")
skip_if_too_deep(5)

interactive_decorator <- teal_transform_module(
Expand Down Expand Up @@ -44,9 +43,7 @@ testthat::test_that("e2e: module with decorator UI and output is modified intera
)

testthat::expect_identical(
app$active_module_element_text(
paste0(input_id, "-label")
),
app$active_module_element_text(sprintf("%s-label", input_id)),
"Append text"
)

Expand All @@ -73,7 +70,6 @@ testthat::test_that("e2e: module with decorator UI and output is modified intera
})

testthat::test_that("e2e: module with decorator, where server fails, shows shiny error message", {
testthat::skip("chromium")
skip_if_too_deep(5)
failing_decorator <- teal_transform_module(
ui = function(id) {
Expand Down Expand Up @@ -104,7 +100,7 @@ testthat::test_that("e2e: module with decorator, where server fails, shows shin

app$expect_validation_error()

testthat::expect_setequal(
testthat::expect_identical(
strsplit(app$active_module_element_text(input_id), "\n")[[1]],
c(
"Shiny error when executing the `data` module.",
Expand Down
32 changes: 19 additions & 13 deletions tests/testthat/test-shinytest2-filter_panel.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ testthat::skip_if_not_installed("shinytest2")
testthat::skip_if_not_installed("rvest")

testthat::test_that("e2e: module content is updated when data is filtered in filter panel", {
testthat::skip("chromium")
skip_if_too_deep(5)
app <- TealAppDriver$new(
data = simple_teal_data(),
Expand Down Expand Up @@ -30,7 +29,6 @@ testthat::test_that("e2e: module content is updated when data is filtered in fil
})

testthat::test_that("e2e: filtering a module-specific filter is reflected in other shared module", {
testthat::skip("chromium")
skip_if_too_deep(5)
app <- TealAppDriver$new(
data = simple_teal_data(),
Expand All @@ -56,21 +54,15 @@ testthat::test_that("e2e: filtering a module-specific filter is reflected in oth
)

app$navigate_teal_tab("Module_2")

app$set_active_filter_selection("iris", "Species", c("setosa"))
app$set_active_filter_selection("iris", "Species", "setosa")

app$navigate_teal_tab("Module_1")

testthat::expect_equal(
app$get_active_data_filters("iris")$Species,
c("setosa")
)
testthat::expect_equal(app$get_active_data_filters("iris")$Species, "setosa")

app$stop()
})

testthat::test_that("e2e: filtering a module-specific filter is not refected in other unshared modules", {
testthat::skip("chromium")
testthat::test_that("e2e: filtering a module-specific filter is not reflected in other unshared modules", {
skip_if_too_deep(5)
app <- TealAppDriver$new(
data = simple_teal_data(),
Expand All @@ -93,12 +85,26 @@ testthat::test_that("e2e: filtering a module-specific filter is not refected in
testthat::expect_setequal(app$get_active_data_filters("mtcars")$cyl, c("4", "6"))

app$navigate_teal_tab("Module_2")

app$set_active_filter_selection("mtcars", "cyl", c("4"))

app$navigate_teal_tab("Module_1")

testthat::expect_setequal(app$get_active_data_filters("mtcars")$cyl, c("4", "6"))

app$stop()
})

testthat::test_that("e2e: filter panel UI can be collpased and expanded (`bslib` regression)", {
skip_if_too_deep(5)

data <- teal.data::teal_data(mtcars1 = mtcars, mtcars2 = data.frame(am = c(0, 1), test = c("a", "b")))
app <- TealAppDriver$new(data = data, modules = example_module())

# Visible by default
filter_panel_id <- "#teal-teal_modules-nav-example_teal_module-filter_panel-filters-main_filter_accordion"
filterpanel_accordion_selector <- paste(filter_panel_id, "> .accordion-item > .accordion-collapse")
testthat::expect_true(app$is_visible(filterpanel_accordion_selector))
app$click(selector = paste(filter_panel_id, "> .accordion-item > .accordion-header button"))
testthat::expect_false(app$is_visible(filterpanel_accordion_selector))

app$stop()
})
4 changes: 1 addition & 3 deletions tests/testthat/test-shinytest2-init.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@ testthat::skip_if_not_installed("shinytest2")
testthat::skip_if_not_installed("rvest")

testthat::test_that("e2e: teal app initializes with no errors", {
testthat::skip("chromium")
skip_if_too_deep(5)
app <- TealAppDriver$new(
data = simple_teal_data(),
modules = example_module(label = "Example Module")
)
app$expect_no_shiny_error()
app$expect_screenshot(selector = "#teal-tabpanel_wrapper")
Comment thread
llrs-roche marked this conversation as resolved.
app$stop()
})

testthat::test_that("e2e: teal app initializes with sessionInfo modal", {
testthat::skip("chromium")
skip_if_too_deep(5)
app <- TealAppDriver$new(
data = simple_teal_data(),
Expand Down Expand Up @@ -69,7 +68,6 @@ testthat::test_that("e2e: teal app initializes with sessionInfo modal", {
})

testthat::test_that("e2e: init creates UI containing specified title, favicon, header and footer", {
testthat::skip("chromium")
skip_if_too_deep(5)
app <- TealAppDriver$new(
data = simple_teal_data(),
Expand Down
Loading
Loading