Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

503 shinytest2 for Show R code modal #1146

Merged
merged 16 commits into from
Mar 19, 2024

Conversation

m7pr
Copy link
Contributor

@m7pr m7pr commented Mar 12, 2024

@m7pr m7pr added the core label Mar 12, 2024
@m7pr m7pr requested review from averissimo and vedhav March 12, 2024 10:29
@m7pr m7pr changed the base branch from main to 503-introduce-shinytest2@main March 12, 2024 10:29
Copy link
Contributor

github-actions bot commented Mar 12, 2024

Unit Tests Summary

  1 files   26 suites   1m 30s ⏱️
226 tests 226 ✅ 0 💤 0 ❌
483 runs  483 ✅ 0 💤 0 ❌

Results for commit a9c118f.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Mar 12, 2024

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
shinytest2-show-rcode 👶 $+3.84$ $+9$ $0$ $0$ $0$
Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
shinytest2-show-rcode 👶 $+3.84$ e2e_teal_app_initializes_with_Show_R_Code_modal

Results for commit dfafb4d

♻️ This comment has been updated with latest results.

@m7pr
Copy link
Contributor Author

m7pr commented Mar 12, 2024

  testthat::expect_equal(
    app$get_text("#shiny-modal > div > div > div.modal-header > h4"),
    "Example Code"
  )

is failing but I don't have that issue when running the test locally ...

@vedhav
Copy link
Contributor

vedhav commented Mar 12, 2024

  testthat::expect_equal(
    app$get_text("#shiny-modal > div > div > div.modal-header > h4"),
    "Example Code"
  )

is failing but I don't have that issue when running the test locally ...

It's failing for me. Let me try to debug.

@m7pr
Copy link
Contributor Author

m7pr commented Mar 12, 2024

It's failing when I run the test but when I run the code inside the test, line by line it does not break.

@vedhav
Copy link
Contributor

vedhav commented Mar 12, 2024

Perhaps we need to wait after the click app$click(selector = button_selector)
Interactively there is a delay so it passes.

@vedhav
Copy link
Contributor

vedhav commented Mar 12, 2024

Yeah, adding app$wait_for_idle(timeout = default_idle_timeout) after the click solves it!

@m7pr
Copy link
Contributor Author

m7pr commented Mar 12, 2024

aaaah, thanks! will push

Copy link
Contributor

github-actions bot commented Mar 12, 2024

badge

Code Coverage Summary

Filename                          Stmts    Miss  Cover    Missing
------------------------------  -------  ------  -------  -------------------------------------------------------------------------------------------------------------------------------
R/dummy_functions.R                  30       0  100.00%
R/get_rcode_utils.R                  31       1  96.77%   50
R/include_css_js.R                   22       0  100.00%
R/init.R                             86      25  70.93%   108-115, 161-162, 164, 179-185, 192-197, 228
R/landing_popup_module.R             25      25  0.00%    61-87
R/module_filter_manager.R           107      29  72.90%   50-58, 67-72, 195, 200-213
R/module_nested_tabs.R              154       3  98.05%   47, 128, 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       0  100.00%
R/module_teal_with_splash.R         114       2  98.25%   110, 131
R/module_teal.R                     106       1  99.06%   57
R/modules.R                         153      24  84.31%   127-130, 147-151, 206-210, 292-293, 345, 357-365
R/reporter_previewer_module.R        18       0  100.00%
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                   195      59  69.74%   66-77, 124-127, 135, 155, 167-168, 190-196, 278-325, 369, 402
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                              11       7  36.36%   3-14
TOTAL                              1862     408  78.09%

Diff against main

Filename             Stmts    Miss  Cover
-----------------  -------  ------  -------
R/TealAppDriver.R        0      -2  +1.03%
TOTAL                    0      -2  +0.11%

Results for commit: a9c118f

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@averissimo averissimo self-assigned this Mar 14, 2024
Copy link
Contributor

@averissimo averissimo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(edit)
🤔 How about placing this on a different test file? It's only 2 tests but it might help to organize tests

(original)
One more spec hits the dust!! Nice job!

🔍 I think we shouldn't be overly specific on the selector rules. Allowing for some flexibility on changes from how shiny creates modals.

That is, we may skip those intermediate div containers as that's not relevant to our test #id > div > div > div.modal-header > h4

Made some suggestions to avoid the child selector, using data-dismiss attribute instead. Let's discuss if there is a better way or if we should also search for the attribute's value

tests/testthat/test-shinytest2-init.R Outdated Show resolved Hide resolved
tests/testthat/test-shinytest2-init.R Outdated Show resolved Hide resolved
tests/testthat/test-shinytest2-init.R Outdated Show resolved Hide resolved
tests/testthat/test-shinytest2-init.R Outdated Show resolved Hide resolved
@m7pr
Copy link
Contributor Author

m7pr commented Mar 14, 2024

Hey @averissimo thanks for the review! I tried to apply comments from this PR, and the other one about Session Info.

About this

How about placing this on a different test file? It's only 2 tests but it might help to organize tests

This actually checks verbatim_popup that is used by example_module. This does not test R/show_rcode_modal which is not used anymore. I could suggest we name the new file as tests/test-shinytest2-show-rcode.R but I hope it's not gonna be confusing with R/show_rcode_modal that I think we could completely remove #1154

@m7pr
Copy link
Contributor Author

m7pr commented Mar 14, 2024

moved the test to a separate file

@m7pr m7pr requested a review from averissimo March 14, 2024 14:21
Base automatically changed from 503-introduce-shinytest2@main to main March 18, 2024 12:05
@vedhav vedhav changed the base branch from main to 503-introduce-shinytest2@main March 18, 2024 12:51
@vedhav vedhav force-pushed the show-r-code@503-introduce-shinytest2@main branch from 7d75d6a to e7be874 Compare March 18, 2024 12:57
@vedhav vedhav changed the base branch from 503-introduce-shinytest2@main to main March 18, 2024 12:57
@m7pr
Copy link
Contributor Author

m7pr commented Mar 19, 2024

Hey @averissimo I applied changes on this PR and used methods ($active_module_element) that we created in other PRs.
I think this simple PR is ready to be merged.

Copy link
Contributor

@averissimo averissimo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@m7pr m7pr merged commit ec8fbfc into main Mar 19, 2024
21 checks passed
@m7pr m7pr deleted the show-r-code@503-introduce-shinytest2@main branch March 19, 2024 14:45
@github-actions github-actions bot locked and limited conversation to collaborators Mar 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants