Fix failing integration test#88
Conversation
Code Coverage SummaryDiff against mainResults for commit: 875b709 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Unit Tests Summary 1 files 12 suites 33s ⏱️ Results for commit 875b709. ♻️ This comment has been updated with latest results. |
Unit Test Performance Difference
Additional test case details
Results for commit 9a1b820 ♻️ This comment has been updated with latest results. |
| } | ||
|
|
||
| # Badge label may prefix variables with dataset (e.g. "ADLB BNRIND"). | ||
| .teal_picks_strip_ds_prefix_vec <- function(x) { # nolint: object_length_linter. |
There was a problem hiding this comment.
this is not used in this package yet
| # Wait until a Shiny input has a non-empty DOM value (e.g. after `updateSelectInput`). | ||
| # Caller must supply the full Shiny input ID (without leading "#"). | ||
| # Uses one [`AppDriver$wait_for_js()`] instead of polling `wait_for_idle()`. | ||
| wait_until_nonempty_active_module_input <- function(app_driver, input_id) { # nolint: object_length_linter. |
There was a problem hiding this comment.
this is not used in this package yet
|
Hi, my initial intention was to port every testing function developed in tmc to be maintained in teal.picks and then reused in tmc and other module packages. That is why I copied the full script. But let's go step by step, I have removed the non used functions. Most of them are already used only for the tests in teal.picks |
averissimo
left a comment
There was a problem hiding this comment.
Looks good overall, but maybe we should move the new functions to the R folder (either as private or exported).
This way we can re-use them in other packages without too much repeated code.
Left some other housecleaning comments as well ;)
There was a problem hiding this comment.
If we add this functions here we should make them available in the R/ folder instead.
This would reduce redundant code in tmc/tmg/...
I think we can export the JS API with a app_driver or shinytest2 prefix. Or other naming convention
app_driver_get_teal_picks_slotapp_driver_set_teal_picks_slotapp_driver_click_teal_picks_summary_badge
Is any other function being used?
There was a problem hiding this comment.
Maybe add a checkmate::assert_class(app_driver, "AppDriver") to those functions just in case
There was a problem hiding this comment.
I agree that adding them to the R folder is the best idea. I suggest not to export them but to export them using getFromNamespace
There was a problem hiding this comment.
I agree that adding them to the R folder is the best idea. I suggest not to export them but to export them using
getFromNamespace
Ok, sounds good!.
This has a downside of reducing the test coverage.
Can you add some coverage for the basic functions to have some coverage of the file?
Thanks
Co-authored-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
Co-authored-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
| teal_picks_exports <- function(app_driver, pick_id) { | ||
| #' Read all teal.picks exported values for a module namespace. | ||
| #' | ||
| #' The module namespace is inferred from the summary badge id in the DOM, |
There was a problem hiding this comment.
Use backticks around DOM to avoid adding it to wordlist.
| #' The module namespace is inferred from the summary badge id in the DOM, | |
| #' The module namespace is inferred from the summary badge id in the `DOM`, |
There was a problem hiding this comment.
Changed and rerun documentation in a single commit
| #' @return Called expectation result. | ||
| #' @keywords internal | ||
| expect_visible <- function(selector, app_driver, timeout) { | ||
| app_driver_expect_visible <- function(selector, app_driver, timeout) { |
There was a problem hiding this comment.
I'm not sure this is the best location for this function.
This is used across many packages, would teal be better? WDYT?
There was a problem hiding this comment.
Initially, I agreed with your suggestion. I was looking again at the function code. This function has a bad name that is confusing. It calls an internal selector that is teal.picks specific. I think the best solution is to rename the function and keep it in teal.picks
|
Many thanks for the review! I agree with your suggestions, they improve the quality of the change. I will update this PR and improve the coverage. |
| withr::with_envvar(c(NOT_CRAN = "true"), { | ||
| skip_on_cran() |
There was a problem hiding this comment.
These two lines are strange.. But I could not make covr "see" the tests and at the same time have safety that they would be skipped on CRAN without them. As they are testing functions is not possible to test them if not in a e2e test. That creates the inconvenience that locally the test will be executed even if env var TESTING_DEPTH is set to 1. But when I tried to add skip_if_to_deep(5) at the beginning of the script it was not seen by covr again.
|
Thanks for the review @averissimo , I have applied your changes. The biggest has been to increase the coverage. As it was an e2e test, I had to do a weird change for covr to see it. Additionally, I have removed warnings in the badge test using the warning class implemented in this package. |
There was a failing integration test in the badge test.
To fix it, it was changed the way we click the input and check if the expected content is there or not. I reused the testing functions of tmc. Actually, we can keep them on teal.picks and reuse them in modules packages. In that case, we probably would need to place the function within R folder.
Please run the test:
testthat::test_file("tests/testthat/test-badge_dropdown.R")To make it sure now the test are passed.