Skip to content

test: deflake test_lonboard_view_state_roundtrips_to_python - #321

Merged
cpsievert merged 1 commit into
mainfrom
fix-lonboard-view-state-flake
Oct 23, 2026
Merged

cpsievert merged 1 commit into
mainfrom
fix-lonboard-view-state-flake

Conversation

@cpsievert

Copy link
Copy Markdown
Collaborator

Summary

test_lonboard_view_state_roundtrips_to_python has been failing intermittently in CI (seen on #306 and #289 in the same day): canvas.bounding_box() returns None right after expect(canvas).to_be_visible() passes. The canvas element can be re-created while the map finishes initializing (e.g., when the initial view state syncs back to Python), so the one-shot bounding_box() call can hit a detached or zero-sized element. This replaces it with page.wait_for_function() that polls the live DOM for a connected, non-zero-sized canvas and returns its rect.

Verification

Ran the lonboard Playwright suite locally (uv run pytest tests/playwright/render_lonboard): all 5 tests pass, and the previously flaky test passed 5/5 repeated runs.

bounding_box() intermittently returns None because the canvas can be
re-created while the map finishes initializing (e.g., when the initial
view state syncs back to Python). Poll the live DOM for a connected,
non-zero-sized canvas instead of relying on a one-shot bounding_box()
call after to_be_visible().
@cpsievert
cpsievert marked this pull request as ready for review October 23, 2026 00:27
@cpsievert
cpsievert merged commit aae38ae into main Oct 23, 2026
5 checks passed
@cpsievert
cpsievert deleted the fix-lonboard-view-state-flake branch October 23, 2026 00:43
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.

1 participant