insightsengineering / teal

Exploratory Web Apps for Analyzing Clinical Trial Data
https://insightsengineering.github.io/teal/
Other
168 stars 33 forks source link

503 Applying suggestions #1161

Closed averissimo closed 4 months ago

averissimo commented 4 months ago

Pull Request

Part of https://github.com/insightsengineering/coredev-tasks/issues/503

Changes description:

vedhav commented 4 months ago

Let's also introduce TESTING_DEPTH functionality in the testthat setup to help avoid these tests on CRAN and when wanting to run only unit tests as suggested here. The teal.modules.helios has an example of how it was done before.

averissimo commented 4 months ago

I think we should also remove the sole pipe operator on TealAppDriver

vedhav commented 4 months ago

I think we should also remove the sole pipe operator on TealAppDriver

Thank you. I always forget that :(

vedhav commented 4 months ago

To run the e2e tests make sure to set the option for TESTING_DEPTH above or equal to 5. Alternatively, a env variable with the same name can also be set. But, the precedence would be given to the option in case both are set.

options(TESTING_DEPTH = 5)
github-actions[bot] commented 4 months ago

badge

Code Coverage Summary

Filename                          Stmts    Miss  Cover    Missing
------------------------------  -------  ------  -------  -------------------------------------------------------------------------------------------------------------------------------
R/dummy_functions.R                  30      21  30.00%   21-33, 36-43
R/get_rcode_utils.R                  31       1  96.77%   50
R/include_css_js.R                   22       0  100.00%
R/init.R                             86      31  63.95%   108-115, 161-162, 164, 176-197, 227-228, 230
R/landing_popup_module.R             25      25  0.00%    61-87
R/module_filter_manager.R           107      36  66.36%   37-43, 50-58, 67-72, 195, 200-213
R/module_nested_tabs.R              154      58  62.34%   39-112, 128, 180, 202, 228
R/module_snapshot_manager.R         209     157  24.88%   87-99, 127-136, 140-152, 154-161, 168-182, 186-188, 190-195, 198-208, 211-227, 236-251, 265-288, 291-302, 305-311, 325, 343-366
R/module_tabs_with_filters.R         76      33  56.58%   33-68, 100, 116
R/module_teal_with_splash.R         114       4  96.49%   110, 131, 197-198
R/module_teal.R                     106      29  72.64%   57, 68, 77, 150-151, 157, 176-207
R/modules.R                         152      26  82.89%   127-130, 147-151, 206-209, 291-292, 344, 356-364, 418-421
R/reporter_previewer_module.R        18       2  88.89%   30, 34
R/show_rcode_modal.R                 19      19  0.00%    17-36
R/tdata.R                            53       1  98.11%   154
R/teal_data_module-eval_code.R       27       0  100.00%
R/teal_data_module-within.R           7       0  100.00%
R/teal_data_module.R                  6       0  100.00%
R/teal_reporter.R                    62       5  91.94%   69, 118-119, 122, 139
R/teal_slices-store.R                29       0  100.00%
R/teal_slices.R                      59      12  79.66%   137-150
R/TealAppDriver.R                   231     231  0.00%    29-469
R/utils.R                           173       1  99.42%   255
R/validate_inputs.R                  32       0  100.00%
R/validations.R                      58      37  36.21%   110-377
R/zzz.R                              12       8  33.33%   3-15
TOTAL                              1898     737  61.17%

Diff against main

Filename                         Stmts    Miss  Cover
-----------------------------  -------  ------  -------
R/dummy_functions.R                  0     +21  -70.00%
R/init.R                             0      +6  -6.98%
R/module_filter_manager.R            0     +20  -18.69%
R/module_nested_tabs.R               0     +55  -35.71%
R/module_tabs_with_filters.R         0     +33  -43.42%
R/module_teal_with_splash.R          0      +3  -2.63%
R/module_teal.R                      0     +28  -26.42%
R/modules.R                          0      +3  -1.97%
R/reporter_previewer_module.R        0      +2  -11.11%
R/teal_slices.R                      0     +12  -20.34%
R/TealAppDriver.R                   +6    +176  -75.56%
TOTAL                               +6    +359  -18.85%

Results for commit: 748a869863298a49d5f06e3c9e5dc8025a25c1de

Minimum allowed coverage is 80%

:recycle: This comment has been updated with latest results

github-actions[bot] commented 4 months ago

Unit Tests Summary

  1 files   27 suites   11s :stopwatch: 229 tests 208 :white_check_mark: 21 :zzz: 0 :x: 440 runs  419 :white_check_mark: 21 :zzz: 0 :x:

Results for commit 748a8698.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 4 months ago

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
shinytest2-filter_panel 💚 $19.17$ $-19.10$ $-2$ $+3$ $0$ $0$
shinytest2-init 💚 $10.48$ $-10.44$ $-14$ $+3$ $0$ $0$
shinytest2-modules 💚 $16.76$ $-16.69$ $-1$ $+5$ $0$ $0$
shinytest2-reporter 💚 $14.46$ $-14.43$ $-1$ $+3$ $0$ $0$
shinytest2-show-rcode 💚 $3.82$ $-3.80$ $-8$ $+1$ $0$ $0$
shinytest2-teal_data_module 💚 $9.90$ $-9.86$ $-1$ $+3$ $0$ $0$
shinytest2-teal_slices 💚 $10.79$ $-10.77$ $-16$ $+2$ $0$ $0$
shinytest2-utils 💚 $3.35$ $-3.34$ $-3$ $+1$ $0$ $0$
Additional test case details | Test Suite | $Status$ | Time on `main` | $±Time$ | Test Case | |:-----|:----:|:----:|:----:|:-----| | shinytest2-filter_panel | 💚 | $6.72$ | $-6.69$ | e2e_filtering_a_module_specific_filter_is_not_refected_in_other_unshared_modules | | shinytest2-filter_panel | 💚 | $6.78$ | $-6.76$ | e2e_filtering_a_module_specific_filter_is_refected_in_other_shared_module | | shinytest2-filter_panel | 💚 | $5.66$ | $-5.66$ | e2e_module_content_is_updated_when_a_data_is_filtered_in_filter_panel | | shinytest2-init | 💚 | $3.32$ | $-3.31$ | e2e_init_creates_UI_containing_specified_title_favicon_header_and_footer | | shinytest2-init | 💚 | $3.31$ | $-3.29$ | e2e_teal_app_initializes_with_no_errors | | shinytest2-init | 💚 | $3.85$ | $-3.84$ | e2e_teal_app_initializes_with_sessionInfo_modal | | shinytest2-modules | 💚 | $2.96$ | $-2.94$ | e2e_all_the_nested_teal_modules_are_initiated_as_expected | | shinytest2-modules | 💚 | $3.11$ | $-3.10$ | e2e_filter_panel_is_not_displayed_when_datanames_is_NULL | | shinytest2-modules | 💚 | $3.42$ | $-3.40$ | e2e_filter_panel_only_shows_the_data_supplied_using_datanames | | shinytest2-modules | 💚 | $3.29$ | $-3.27$ | e2e_filter_panel_shows_all_the_datasets_when_datanames_is_all | | shinytest2-modules | 💚 | $3.99$ | $-3.97$ | e2e_the_module_server_logic_is_only_triggered_when_the_teal_module_becomes_active | | shinytest2-reporter | 💚 | $8.87$ | $-8.86$ | e2e_adding_a_report_card_in_a_module_adds_it_in_the_report_previewer_tab | | shinytest2-reporter | 💚 | $2.84$ | $-2.83$ | e2e_reporter_tab_is_created_when_a_module_has_reporter | | shinytest2-reporter | 💚 | $2.74$ | $-2.73$ | e2e_reporter_tab_is_not_created_when_a_module_has_no_reporter | | shinytest2-show-rcode | 💚 | $3.82$ | $-3.80$ | e2e_teal_app_initializes_with_Show_R_Code_modal | | shinytest2-teal_data_module | 💚 | $4.03$ | $-4.02$ | e2e_teal_data_module_inputs_change_teal_data_object_that_is_passed_to_teal_main_UI | | shinytest2-teal_data_module | 💚 | $2.51$ | $-2.50$ | e2e_teal_data_module_shows_validation_errors | | shinytest2-teal_data_module | 💚 | $3.35$ | $-3.33$ | e2e_teal_data_module_will_have_a_delayed_load_of_datasets | | shinytest2-teal_slices | 💚 | $4.59$ | $-4.57$ | e2e_teal_slices_filters_are_initialized_when_global_filters_are_created | | shinytest2-teal_slices | 💚 | $6.21$ | $-6.20$ | e2e_teal_slices_filters_are_initialized_when_module_specific_filters_are_created | | shinytest2-utils | 💚 | $3.35$ | $-3.34$ | e2e_show_hide_hamburger_works_as_expected |

Results for commit f8e5b6feaffaa01ead9e4dbee85443c1ad8cacc5

♻️ This comment has been updated with latest results.

m7pr commented 4 months ago

Works as expected, for TESTING_DEPTH = 5 runs all tests, and for higher it omits {shinytest2} tests.

Sys.setenv(TESTING_DEPTH = 5)
> devtools::test()
ℹ Testing teal

You are using teal version 0.15.2.9010
✔ | F W  S  OK | Context
✔ |          4 | filter_manager                                             
✔ |         10 | init                                                       
✔ |         33 | module_nested_tabs [1.1s]                                  
✔ |          8 | module_tabs_with_filters [1.0s]                            
✔ |          8 | module_teal                                                
✔ |         41 | module_teal_with_splash                                    
✔ |         95 | modules                                                    
✔ |          7 | rcode_utils                                                
✔ |          5 | report_previewer_module                                    
✖ | 2        1 | shinytest2-filter_panel [21.7s]
> Sys.setenv(TESTING_DEPTH = 3)
> devtools::test()
ℹ Testing teal

You are using teal version 0.15.2.9010
✔ | F W  S  OK | Context
✔ |          4 | filter_manager                                             
✔ |         10 | init [1.1s]                                                
✔ |         33 | module_nested_tabs                                         
✔ |          8 | module_tabs_with_filters                                   
✔ |          8 | module_teal                                                
✔ |         41 | module_teal_with_splash                                    
✔ |         95 | modules                                                    
✔ |          7 | rcode_utils                                                
✔ |          5 | report_previewer_module                                    
✔ |      3   0 | shinytest2-filter_panel                                    
✔ |      3   0 | shinytest2-init                                            
✔ |      5   0 | shinytest2-modules                                         
✔ |      3   0 | shinytest2-reporter                                        
✔ |      1   0 | shinytest2-show-rcode                                      
✔ |      2   0 | shinytest2-teal_slices                                     
✔ |      1   0 | shinytest2-utils                                           
✔ |          2 | snapshot_manager                                           
✔ |         41 | tdata                                                      
✔ |         16 | teal_data_module-eval_code                                 
✔ |          3 | teal_data_module                                           
✔ |         25 | teal_reporter                                              
✔ |         15 | teal_slices-store                                          
✔ |         18 | teal_slices                                                
✔ |         35 | utils                                                      
✔ |         17 | validate_has_data                                          
✔ |         36 | validate_inputs                                            

══ Results ═════════════════════════════════════════════════════════════════
Duration: 7.3 s

── Skipped tests (18) ──────────────────────────────────────────────────────
• testing depth 3 is below current testing specification 5 (18):
  test-shinytest2-filter_panel.R:2:3, test-shinytest2-filter_panel.R:31:3,
  test-shinytest2-filter_panel.R:74:3, test-shinytest2-init.R:2:3,
  test-shinytest2-init.R:13:3, test-shinytest2-init.R:70:3,
  test-shinytest2-modules.R:2:3, test-shinytest2-modules.R:41:3,
  test-shinytest2-modules.R:58:3, test-shinytest2-modules.R:75:3,
  test-shinytest2-modules.R:95:3, test-shinytest2-reporter.R:2:3,
  test-shinytest2-reporter.R:23:3, test-shinytest2-reporter.R:44:3,
  test-shinytest2-show-rcode.R:2:3, test-shinytest2-teal_slices.R:2:3,
  test-shinytest2-teal_slices.R:47:3, test-shinytest2-utils.R:2:3

[ FAIL 0 | WARN 0 | SKIP 18 | PASS 419 ]
averissimo commented 4 months ago

Great job with TESTING_DEPTH. Is it worth to propagate these changes to other repos that use it?

vedhav commented 4 months ago

Eventually, we will have to do it once we setup the shinytest2 for them.

vedhav commented 4 months ago

I have read the CLA Document and I hereby sign the CLA