Closed donyunardi closed 2 months ago
I am not able to reproduce the failed tests locally. Waiting for the integration test to run again tonight.
The integration test just ran and it failed with the same error message as in the original post. I still can't replicate the error locally.
@insightsengineering/nest-core-dev Can someone else try to replicate this?
I am also unable to reproduce it locally. All the tests are passing.
It passes for me too.
My intuition is that it takes a while after the app$click("teal_data_module-submit")
to load the teal app. It passes locally in our machines but the CI that runs these tests have limited resources so it fails. Once we add a wait_for_idle
call it could fix it. Let me try to simulate this with less resources.
Note that we do a wait call in our TealAppDriver$click
by default. However, it's default wait time is 500 ms which might be less for a teal_data_module
init
.
I always add $wait_for_idle
after every $click
! I though we have extended the $click()
method so it also has $wait_for_idle
in it.
Maybe we should extend the defaults in this method as well?
Maybe we should extend the defaults in this method as well? Yes. Let's do 5000.
I'll prep the PR.
If you are stuck then you can add debug logs and try to understand the processing from these
The integration still fails with the same error message.
All the error message has similar issue and it boils down to this method app$get_active_filter_vars()
.
https://github.com/insightsengineering/teal/blob/1de78ee3ad70858aee6ef78d188be207b010bf17/R/TealAppDriver.R#L241-L253
This method always returns empty during integration test.
We can see it from the assertion failure here:
── Error ('test-shinytest2-filter_panel.R:48:3'): e2e: filtering a module-specific filter is refected in other shared module ──
Error in `app$get_active_data_filters("iris")`: Assertion on 'dataset_name' failed: Must be a subset of the empty set, i.e. also empty.
── Error ('test-shinytest2-filter_panel.R:87:3'): e2e: filtering a module-specific filter is not refected in other unshared modules ──
Error in `app$get_active_data_filters("mtcars")`: Assertion on 'dataset_name' failed: Must be a subset of the empty set, i.e. also empty.
(get_active_data_filters
calls get_active_filter_vars()
and then assert the result:
https://github.com/insightsengineering/teal/blob/1de78ee3ad70858aee6ef78d188be207b010bf17/R/TealAppDriver.R#L288-L291
and here:
── Failure ('test-shinytest2-modules.R:49:3'): e2e: filter panel only shows the data supplied using datanames ──
app$get_active_filter_vars() not identical to "mtcars".
Lengths differ: 0 is not 1
── Failure ('test-shinytest2-modules.R:65:3'): e2e: filter panel shows all the datasets when datanames is all ──
app$get_active_filter_vars() not identical to c("iris", "mtcars").
Lengths differ: 0 is not 2
── Failure ('test-shinytest2-teal_data_module.R:32:3'): e2e: teal_data_module will have a delayed load of datasets ──
This suggests that during the integration test, it's unable to locate the required CSS/HTML needed, therefore it's returning empty value. I'm not entirely sure why, but perhaps we should log the value of each object in that method and print it out.
I'll prepare the PR for now, but please feel free to chime in if this leads to another clue.
We got failed integration test and need to fix this:
Complete log
```r * using log directory ‘/builds/nest/automation/systems-integration-tests/teal.Rcheck’ * using R version 4.3.1 (2023-06-16) * using platform: x86_64-pc-linux-gnu (64-bit) * R was compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 GNU Fortran (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 * running under: Ubuntu 22.04.3 LTS * using session charset: UTF-8 * using option ‘--ignore-vignettes’ * checking for file ‘teal/DESCRIPTION’ ... OK * checking extension type ... Package * this is package ‘teal’ version ‘0.15.2.9022’ * package encoding: UTF-8 * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package ‘teal’ can be installed ... OK * checking installed package size ... OK * checking package directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking startup messages can be suppressed ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking files in ‘vignettes’ ... SKIPPED * checking examples ... OK * checking for unstated dependencies in ‘tests’ ... OK * checking tests ... Running ‘testthat.R’ ERROR Running the tests in ‘tests/testthat.R’ failed. Complete output: > pkg_name <- "teal" > library(pkg_name, character.only = TRUE) Loading required package: shiny Loading required package: teal.data Loading required package: teal.code Loading required package: teal.slice Registered S3 method overwritten by 'teal': method from c.teal_slices teal.slice You are using teal version 0.15.2.9022 Attaching package: 'teal' The following objects are masked from 'package:teal.slice': as.teal_slices, teal_slices > testthat::test_check(pkg_name) [ FAIL 8 | WARN 0 | SKIP 0 | PASS 479 ] ══ Failed tests ════════════════════════════════════════════════════════════════ ── Error ('test-shinytest2-filter_panel.R:48:3'): e2e: filtering a module-specific filter is refected in other shared module ── Error in `app$get_active_data_filters("iris")`: Assertion on 'dataset_name' failed: Must be a subset of the empty set, i.e. also empty. Backtrace: ▆ 1. ├─testthat::expect_equal(...) at test-shinytest2-filter_panel.R:48:3 2. │ └─testthat::quasi_label(enquo(object), label, arg = "object") 3. │ └─rlang::eval_bare(expr, quo_get_env(quo)) 4. └─app$get_active_data_filters("iris") 5. └─checkmate::assert_subset(dataset_name, datasets) 6. └─checkmate::makeAssertion(x, res, .var.name, add) 7. └─checkmate:::mstop(...) ── Error ('test-shinytest2-filter_panel.R:87:3'): e2e: filtering a module-specific filter is not refected in other unshared modules ── Error in `app$get_active_data_filters("mtcars")`: Assertion on 'dataset_name' failed: Must be a subset of the empty set, i.e. also empty. Backtrace: ▆ 1. ├─testthat::expect_equal(...) at test-shinytest2-filter_panel.R:87:3 2. │ └─testthat::quasi_label(enquo(object), label, arg = "object") 3. │ └─rlang::eval_bare(expr, quo_get_env(quo)) 4. └─app$get_active_data_filters("mtcars") 5. └─checkmate::assert_subset(dataset_name, datasets) 6. └─checkmate::makeAssertion(x, res, .var.name, add) 7. └─checkmate:::mstop(...) ── Failure ('test-shinytest2-modules.R:49:3'): e2e: filter panel only shows the data supplied using datanames ── app$get_active_filter_vars() not identical to "mtcars". Lengths differ: 0 is not 1 ── Failure ('test-shinytest2-modules.R:65:3'): e2e: filter panel shows all the datasets when datanames is all ── app$get_active_filter_vars() not identical to c("iris", "mtcars"). Lengths differ: 0 is not 2 ── Failure ('test-shinytest2-teal_data_module.R:32:3'): e2e: teal_data_module will have a delayed load of datasets ── app$get_active_filter_vars() (`actual`) and c("dataset1", "dataset2") (`expected`) don't have the same values. * Only in `actual`: "dataset1", "dataset2" ── Error ('test-shinytest2-teal_data_module.R:116:3'): e2e: teal_data_module inputs change teal_data object that is passed to teal main UI ── Error in `app$get_active_data_filters("dataset1")`: Assertion on 'dataset_name' failed: Must be a subset of the empty set, i.e. also empty. Backtrace: ▆ 1. ├─testthat::expect_setequal(...) at test-shinytest2-teal_data_module.R:116:3 2. │ └─testthat::quasi_label(enquo(object), arg = "object") 3. │ └─rlang::eval_bare(expr, quo_get_env(quo)) 4. └─app$get_active_data_filters("dataset1") 5. └─checkmate::assert_subset(dataset_name, datasets) 6. └─checkmate::makeAssertion(x, res, .var.name, add) 7. └─checkmate:::mstop(...) ── Error ('test-shinytest2-teal_slices.R:17:3'): e2e: teal_slices filters are initialized when global filters are created ── Error in `app$get_active_data_filters("iris")`: Assertion on 'dataset_name' failed: Must be a subset of the empty set, i.e. also empty. Backtrace: ▆ 1. ├─testthat::expect_identical(...) at test-shinytest2-teal_slices.R:17:3 2. │ └─testthat::quasi_label(enquo(object), label, arg = "object") 3. │ └─rlang::eval_bare(expr, quo_get_env(quo)) 4. └─app$get_active_data_filters("iris") 5. └─checkmate::assert_subset(dataset_name, datasets) 6. └─checkmate::makeAssertion(x, res, .var.name, add) 7. └─checkmate:::mstop(...) ── Error ('test-shinytest2-teal_slices.R:65:3'): e2e: teal_slices filters are initialized when module specific filters are created ── Error in `app$get_active_data_filters("iris")`: Assertion on 'dataset_name' failed: Must be a subset of the empty set, i.e. also empty. Backtrace: ▆ 1. ├─testthat::expect_identical(...) at test-shinytest2-teal_slices.R:65:3 2. │ └─testthat::quasi_label(enquo(object), label, arg = "object") 3. │ └─rlang::eval_bare(expr, quo_get_env(quo)) 4. └─app$get_active_data_filters("iris") 5. └─checkmate::assert_subset(dataset_name, datasets) 6. └─checkmate::makeAssertion(x, res, .var.name, add) 7. └─checkmate:::mstop(...) [ FAIL 8 | WARN 0 | SKIP 0 | PASS 479 ] Error: Test failures Execution halted * checking PDF version of manual ... OK * DONE Status: 1 ERROR See ‘/builds/nest/automation/systems-integration-tests/teal.Rcheck/00check.log’ for details. ```