Repository navigation
test: deflake the ipyleaflet Playwright lifecycle test - #354
Merged
Merged
Conversation
Closes #353 test_render_ipyleaflet_rerender_lifecycle samples the browser's view registry right after DOM-level assertions, but LeafletMapModel views attach/detach asynchronously, so the sample can catch a partially settled registry (seen in CI: assert 10 == 9). Add wait_for_stable_model_view_count() -- a per-model counterpart to the wait_for_stable_view_count() helper introduced for the bqplot and keplergl deflake (#342) -- and use it for both samples in the test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #353
Summary
test_render_ipyleaflet_rerender_lifecycleintermittently fails in CI with a live-view count mismatch (assert 10 == 9, seen on PR #324's unrelated run). The test samples the browser's widget view registry immediately after DOM-level assertions (.leaflet-containercount, marker present), butLeafletMapModelviews attach and detach asynchronously, so the sample can catch a partially settled registry.This is the same race that #342 fixed for the bqplot and keplergl lifecycle tests via
wait_for_stable_view_count(). The ipyleaflet test couldn't use that helper because it counts views per model class (client_models()filtered by_model_name) rather than globally via_liveViews.size.Changes:
wait_for_stable_model_view_count(page, model_name)totests/playwright/conftest.py: a per-model counterpart towait_for_stable_view_count()that polls the summed live-view count for a given_model_nameuntil it stops changing between 500ms polls.test_render_ipyleaflet_rerender_lifecycle.Verification
uv run pytest tests/playwright/render_ipyleaflet/test_render_ipyleaflet.py -x -q— 10 passeduv run pytest tests/playwright/render_bqplot/test_render_bqplot.py::test_bqplot_rerender_lifecycle -x -q(other lifecycle-test consumer of the conftest) — passedmake check-formatand pyright cleanNote: other tests sample
client_models()the same way (e.g. ipysigma, plotnine, jscatter); this PR keeps scope to the ipyleaflet flake from #353, but the new helper is available if any of those flake too.