Fix flaky Playwright test in test_examples_viz.py#3039
Merged
Conversation
|
Performance benchmarks:
|
quaquel
approved these changes
Dec 29, 2025
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.
Summary
This PR fixes a persistent CI failure in
tests/examples/test_examples_viz.py, specifically affecting thetest_pd_grid_modeltest on thechromiumrunner.The failure was caused by a Playwright Strict Mode Violation, where the test runner found multiple images matching the selector when only one was expected.
The Problem
The CI logs reported the following error:
This occurs because the test environment renders multiple visualization components (the Grid view and the Chart view) on the same page. When the test attempts to take a screenshot using page_session.locator("img"), Playwright finds both images and throws an error because the selector is ambiguous.
The Fix
I have updated the run_model_test function to strictly define which image to capture:
Grid Capture: Changed .locator("img") to .locator("img").first.
Graph/Chart Capture: Changed .locator("img") to .locator("img").last.
This change ensures the selectors are unique, resolving the ambiguity and preventing the test from crashing due to rendering timing or multiple elements