Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
be696dd
Add helpers
llrs-roche Jun 23, 2025
cb6e1ce
Add shinytest2 tests
llrs-roche Jun 23, 2025
a099f6a
Remove comments not needed
llrs-roche Jun 24, 2025
b2e6f2b
Fix typo
llrs-roche Jun 25, 2025
bfd3a05
MAE dataset
llrs-roche Jun 25, 2025
6339c07
Update tests
llrs-roche Jun 25, 2025
cfb0020
Merged origin/main into 651_regr_test@main
llrs-roche Jun 25, 2025
abed63b
Renaming
llrs-roche Jun 26, 2025
68a098e
Add prefix to test_that and other chores
llrs-roche Jun 26, 2025
e2d1c46
Use selector instead of just id
llrs-roche Jun 26, 2025
eab5f43
Add all tests
llrs-roche Jun 26, 2025
ce5d0f9
Use classes to pick the table and check visibility
llrs-roche Jun 27, 2025
306b4e3
Fix DF tests
llrs-roche Jun 27, 2025
4db33f1
Chore: clean up tests description and reorganize them
llrs-roche Jun 27, 2025
c9f4d2b
Test MAE
llrs-roche Jun 27, 2025
3b80769
Address (most of) review feedback
llrs-roche Jun 27, 2025
d2ab058
chore: remove wait_for_idle arguments
llrs-roche Jun 27, 2025
14e86d0
Add test for content and adding filters
llrs-roche Jun 27, 2025
ac39613
Style
llrs-roche Jun 30, 2025
5368721
Add failing test
llrs-roche Jun 30, 2025
7c42dad
feat: cleanup of code with describe/it and add DT to suggests
averissimo Jul 2, 2025
d5b945a
feat: add skip if too deep to shinytest2 files
averissimo Jul 2, 2025
5560d2b
feat: check for contents besides visibility
averissimo Jul 2, 2025
eba8c28
fix: wait for animation
averissimo Jul 2, 2025
39c4cf6
[skip style] [skip vbump] Restyle files
github-actions[bot] Jul 2, 2025
13c8a66
empty: trigger CI
averissimo Jul 2, 2025
9ecdf7e
feat: Test for exclude_var
llrs-roche Jul 7, 2025
20b616a
chore: Some minor tweaks
llrs-roche Jul 7, 2025
24381ca
Remove redundant test
llrs-roche Jul 7, 2025
9660d0b
feat: Remove test that only check name of divs
llrs-roche Jul 7, 2025
9c20bb0
Add test to really check that there are no inputs available
llrs-roche Jul 7, 2025
d83d889
feat: improve tests decriptions
llrs-roche Jul 7, 2025
def77f7
Add is_existing
llrs-roche Jul 9, 2025
dce83cf
Address comments
llrs-roche Jul 9, 2025
6c3ed5a
Apply feedback for DF to the MAE objects
llrs-roche Jul 9, 2025
20f0a3b
Merge branch 'main' into 651_regr_test@main
llrs-roche Jul 14, 2025
91002ff
Rewrite tests
llrs-roche Jul 16, 2025
30218b0
Focus only on MAE specific UI
llrs-roche Jul 16, 2025
651d08c
Remove functions no longer used
llrs-roche Jul 16, 2025
f971beb
[skip style] [skip vbump] Restyle files
github-actions[bot] Jul 16, 2025
c418280
Fix style
llrs-roche Jul 16, 2025
7e97b31
Remove comment that points to a bug
llrs-roche Jul 16, 2025
c079db0
Merge branch '651_regr_test@main' of github.com:insightsengineering/t…
llrs-roche Jul 16, 2025
79240a1
Updates based on feedback
llrs-roche Jul 22, 2025
29c2d2c
[skip style] [skip vbump] Restyle files
github-actions[bot] Jul 22, 2025
e6898e8
Merge branch 'main' into 651_regr_test@main
llrs-roche Jul 23, 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
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ Imports:
teal.widgets (>= 0.4.3),
utils
Suggests:
DT (>= 0.13),
knitr (>= 1.42),
MultiAssayExperiment,
rmarkdown (>= 2.23),
shinytest2 (>= 0.4.1),
SummarizedExperiment,
testthat (>= 3.2.2),
withr (>= 3.0.2)
Expand All @@ -72,7 +74,7 @@ Config/Needs/verdepcheck: rstudio/shiny, rstudio/bslib, mllg/checkmate,
daroczig/logger, plotly/plotly, r-lib/R6, daattali/shinycssloaders,
daattali/shinyjs, dreamRs/shinyWidgets, insightsengineering/teal.data,
insightsengineering/teal.logger, insightsengineering/teal.widgets,
yihui/knitr, bioc::MultiAssayExperiment, bioc::SummarizedExperiment,
rstudio/DT, yihui/knitr, bioc::MultiAssayExperiment, bioc::SummarizedExperiment,
rstudio/rmarkdown, r-lib/testthat, r-lib/withr, bioc::matrixStats
Config/Needs/website: insightsengineering/nesttemplate
Encoding: UTF-8
Expand Down
8 changes: 4 additions & 4 deletions R/FilteredData.R
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ FilteredData <- R6::R6Class( # nolint
include_js_files(pattern = "togglePanelItems"),
class = "teal-slice",
bslib::accordion(
id = ns("main_filter_accordian"),
id = ns("main_filter_accordion"),
bslib::accordion_panel(
"Filter Data",
tags$div(
Expand Down Expand Up @@ -578,8 +578,8 @@ FilteredData <- R6::R6Class( # nolint
});
",
ns("additional_filter_helpers"),
ns("main_filter_accordian"),
ns("main_filter_accordian"),
ns("main_filter_accordion"),
ns("main_filter_accordion"),
ns("additional_filter_helpers")
)
)
Expand Down Expand Up @@ -710,7 +710,7 @@ FilteredData <- R6::R6Class( # nolint
tags$div(
class = "teal-slice",
bslib::accordion(
id = ns("main_filter_accordian"),
id = ns("main_filter_accordion"),
bslib::accordion_panel(
title = "Active Filter Summary",
tags$div(
Expand Down
14 changes: 7 additions & 7 deletions R/FilteredDataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ FilteredDataset <- R6::R6Class( # nolint
include_css_files("filter-panel"),
include_js_files(pattern = "icons"),
bslib::accordion(
id = session$ns("dataset_filter_accordian"),
id = session$ns("dataset_filter_accordion"),
class = "teal-slice-dataset-filter",
bslib::accordion_panel(
dataname,
Expand Down Expand Up @@ -298,10 +298,10 @@ FilteredDataset <- R6::R6Class( # nolint
});
",
session$ns("filter_util_icons"),
session$ns("dataset_filter_accordian"),
session$ns("dataset_filter_accordian"),
session$ns("dataset_filter_accordion"),
session$ns("dataset_filter_accordion"),
session$ns("active_filter_badge"),
session$ns("dataset_filter_accordian")
session$ns("dataset_filter_accordion")
)
)
)
Expand Down Expand Up @@ -344,7 +344,7 @@ FilteredDataset <- R6::R6Class( # nolint
$('#%s .accordion-button.collapsed').click();
}",
session$ns("add_panel"),
session$ns("dataset_filter_accordian")
session$ns("dataset_filter_accordion")
)
)
),
Expand Down Expand Up @@ -387,8 +387,8 @@ FilteredDataset <- R6::R6Class( # nolint

# If the accordion input is `NULL` it is being collapsed.
# It has the accordion panel label if it is expanded.
observeEvent(input$dataset_filter_accordian, ignoreNULL = FALSE, {
if (is.null(input$dataset_filter_accordian)) {
observeEvent(input$dataset_filter_accordion, ignoreNULL = FALSE, {
if (is.null(input$dataset_filter_accordion)) {
# Hiding the `add_panel` dropdown and changing the minus icon to plus
# TODO: simplify this implementation. This is done in multiple places
shinyjs::runjs(
Expand Down
26 changes: 26 additions & 0 deletions tests/testthat/helpers-shinytest2.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
default_idle_timeout <- 20000 # Wait (ms) at most until idle
default_idle_duration <- 200 # Time (ms) it is idle

# Check visibility (borrowed from teal.widgets/tests/testthat/helpers-utils.R)
is_visible <- function(app_driver, element) {
js_script <- sprintf("
Array.from(document.querySelectorAll('%s')).map(el => {
return el.checkVisibility() && (el.textContent.trim().length > 0 || el.children.length > 0);
});
", element)

any(unlist(app_driver$get_js(js_script)))
}

# Write a js code to extract the classes
get_attribute <- function(selector, attribute) {
sprintf(
"Array.from(document.querySelectorAll('%s')).map(el => el.getAttribute('%s'))",
selector, attribute
)
}

is_existing <- function(app_driver, element) {
js_script <- sprintf("document.querySelectorAll('%s').length > 0;", element)
app_driver$get_js(js_script)
}
51 changes: 51 additions & 0 deletions tests/testthat/helpers-testing-depth.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#' Returns testing depth set by session option or by environmental variable.
#'
#' @details Looks for the session option `TESTING_DEPTH` first.
#' If not set, takes the system environmental variable `TESTING_DEPTH`.
#' If neither is set, then returns 3 by default.
#' If the value of `TESTING_DEPTH` is not a numeric of length 1, then returns 3.
#'
#' @return `numeric(1)` the testing depth.
#'
get_testing_depth <- function() {
default_depth <- 3
depth <- getOption("TESTING_DEPTH", Sys.getenv("TESTING_DEPTH", default_depth))
depth <- tryCatch(
as.numeric(depth),
error = function(error) default_depth,
warning = function(warning) default_depth
)
if (length(depth) != 1) depth <- default_depth
depth
}

#' Skipping tests in the testthat pipeline under specific scope
#' @description This function should be used per each `testthat::test_that` call.
#' Each of the call should specify an appropriate depth value.
#' The depth value will set the appropriate scope so more/less time consuming tests could be recognized.
#' The environment variable `TESTING_DEPTH` is used for changing the scope of `testthat` pipeline.
#' `TESTING_DEPTH` interpretation for each possible value:
#' \itemize{
#' \item{0}{no tests at all}
#' \item{1}{fast - small scope - executed on every commit}
#' \item{3}{medium - medium scope - daily integration pipeline}
#' \item{5}{slow - all tests - daily package tests}
#' }
#' @param depth `numeric` the depth of the testing evaluation,
#' has opposite interpretation to environment variable `TESTING_DEPTH`.
#' So e.g. `0` means run it always and `5` means a heavy test which should be run rarely.
#' If the `depth` argument is larger than `TESTING_DEPTH` then the test is skipped.
#' @importFrom testthat skip
#' @return `NULL` or invoke an error produced by `testthat::skip`
#' @note By default `TESTING_DEPTH` is equal to 3 if there is no environment variable for it.
#' By default `depth` argument lower or equal to 3 will not be skipped because by default `TESTING_DEPTH`
#' is equal to 3. To skip <= 3 depth tests then the environment variable has to be lower than 3 respectively.
skip_if_too_deep <- function(depth) { # nolintr
checkmate::assert_numeric(depth, len = 1, lower = 0, upper = 5)
testing_depth <- get_testing_depth() # by default 3 if there are no env variable
if (testing_depth < depth) {
testthat::skip(paste("testing depth", testing_depth, "is below current testing specification", depth))
}
}

default_idle_timeout <- 20000
Loading
Loading