Skip to content

Rewrite testing code to a TestRunner managing dom context - #2679

Draft
WorldSEnder wants to merge 11 commits into
yewstack:masterfrom
WorldSEnder:principled-testing
Draft

Rewrite testing code to a TestRunner managing dom context#2679
WorldSEnder wants to merge 11 commits into
yewstack:masterfrom
WorldSEnder:principled-testing

Conversation

@WorldSEnder

@WorldSEnder WorldSEnder commented May 13, 2022

Copy link
Copy Markdown
Member

Description

Introduces a TestRunner that can mounts components, wait until they are done rendering, offers an API to test some properties about them and avoids mistakenly rendering over other running tests (should enable parallel testing, but this isn't yet available in the browser).

Also gets rid of the timeout based version of waiting for events to complete, by abstracting it with a TriggerBus (basically a global boolean flag that is used as the condition whether to suspend, or to await it until it turns "active"/true). Naming up for debate, feel free to bike-shed a bit, I'm not too keen on the name.

Fixes the failures of this form: https://github.com/yewstack/yew/runs/6289299836?check_suite_focus=true that appear from time to time due a slow browser. See also #2609 (comment)

Net negative code size

Checklist

  • I have reviewed my own code
  • I have rewritten tests
  • Have to investigate the size increase, this should not have an impact on non-test code

@github-actions

github-actions Bot commented May 13, 2022

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 2f351ec):

https://yew-rs-api--pr2679-principled-testing-nahj86pn.web.app

(expires Fri, 20 May 2022 22:34:59 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@WorldSEnder WorldSEnder changed the title Rewrite testing code to an imperative prop-testing style Rewrite testing code to a TestRunner managing dom context May 13, 2022
@github-actions

github-actions Bot commented May 13, 2022

Copy link
Copy Markdown

Size Comparison

Details
examples master (KB) pull request (KB) diff (KB) diff (%)
boids 172.765 173.890 +1.125 +0.651%
contexts 109.643 110.607 +0.965 +0.880%
counter 86.651 88.944 +2.293 +2.646%
counter_functional 87.302 89.553 +2.251 +2.578%
dyn_create_destroy_apps 89.798 92.910 +3.112 +3.466%
file_upload 102.620 104.906 +2.286 +2.228%
function_memory_game 167.348 168.316 +0.969 +0.579%
function_router 350.592 351.926 +1.334 +0.380%
function_todomvc 161.993 162.958 +0.965 +0.596%
futures 226.658 228.941 +2.283 +1.007%
game_of_life 107.510 109.815 +2.306 +2.145%
inner_html 83.685 85.916 +2.231 +2.666%
js_callback 112.878 113.850 +0.972 +0.861%
keyed_list 195.034 196.345 +1.311 +0.672%
mount_point 86.281 88.594 +2.312 +2.680%
nested_list 115.920 117.089 +1.169 +1.008%
node_refs 90.449 91.745 +1.296 +1.433%
password_strength 1539.199 1540.506 +1.307 +0.085%
portals 97.193 98.277 +1.084 +1.115%
router 319.632 320.451 +0.819 +0.256%
simple_ssr 494.018 494.018 0 0.000%
ssr_router 425.589 425.589 0 0.000%
suspense 110.581 111.545 +0.964 +0.872%
timer 89.362 91.652 +2.290 +2.563%
todomvc 143.053 145.353 +2.300 +1.608%
two_apps 87.286 89.594 +2.308 +2.644%
web_worker_fib 153.531 155.907 +2.376 +1.548%
webgl 87.373 89.657 +2.284 +2.614%

⚠️ The following examples have changed their size significantly:

examples master (KB) pull request (KB) diff (KB) diff (%)
counter 86.651 88.944 +2.293 +2.646%
counter_functional 87.302 89.553 +2.251 +2.578%
dyn_create_destroy_apps 89.798 92.910 +3.112 +3.466%
file_upload 102.620 104.906 +2.286 +2.228%
futures 226.658 228.941 +2.283 +1.007%
game_of_life 107.510 109.815 +2.306 +2.145%
inner_html 83.685 85.916 +2.231 +2.666%
mount_point 86.281 88.594 +2.312 +2.680%
nested_list 115.920 117.089 +1.169 +1.008%
node_refs 90.449 91.745 +1.296 +1.433%
portals 97.193 98.277 +1.084 +1.115%
timer 89.362 91.652 +2.290 +2.563%
todomvc 143.053 145.353 +2.300 +1.608%
two_apps 87.286 89.594 +2.308 +2.644%
web_worker_fib 153.531 155.907 +2.376 +1.548%
webgl 87.373 89.657 +2.284 +2.614%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants