Tests to generate screenshots/gifs for material controls examples.#6438
Open
InesaFitsner wants to merge 90 commits intorelease/v0.85.0from
Open
Tests to generate screenshots/gifs for material controls examples.#6438InesaFitsner wants to merge 90 commits intorelease/v0.85.0from
InesaFitsner wants to merge 90 commits intorelease/v0.85.0from
Conversation
Add an integration test for the AppBar actions & popup menu: import the example, add a parametrized test that captures before/after screenshots, taps the popup menu (uses a new key on the PopupMenuButton) and generates a GIF. Include corresponding golden images and animated GIF assets. Also update client/pubspec.lock alongside these changes.
Update checkbox example and integration test to capture hovered/selected states and generate a GIF. The example wraps the dynamic-fill Checkbox and adds a key so the test can hover/tap it; the test now captures default, hovered, and selected screenshots and creates styled_checkboxes_flow.gif. Docs updated to reference the GIF instead of the PNG, and new golden images/GIF were added. Also clarified the docs-skill guidance to ensure all generated PNG/GIF assets referenced by docs are copied into website static test-images.
Update the checkbox docs image reference in website/docs/controls/checkbox.md: replace 'styled_checkboxes_flow.gif' with 'styled_checkboxes_selected.png'. This changes the displayed example image for the styled checkboxes to the new PNG asset.
Delete four binary golden test images from website static docs for macOS material examples: auto_complete_basic_flow.gif, banner_flow.gif, assist_chips.png, and filter_chips.png. This cleans up obsolete/unused example assets in the documentation.
Add a new golden image for the CircleAvatar user avatars example and a test that runs the example, enables screenshots, resizes the page, and asserts a 'user_avatars' screenshot. Import the example module in the test file and parameterize the Flet test to run the example. Also update the CircleAvatar docs to increase the example image display width from 7% to 20%.
Add mouse-based click support to the testing framework and add integration tests/assets for context menu triggers. - Implement mouseClick/mouseClickAt in FlutterWidgetTester using PointerDeviceKind.mouse gestures. - Expose new tester RPCs (mouse_click, mouse_click_at) in TesterService and add corresponding abstract methods to the Tester interface. - Add Python Tester wrappers (mouse_click, mouse_click_at) to invoke new RPCs. - Add a key to the context menu trigger area and a new pytest that captures before/after screenshots and creates a GIF; include golden images and GIF assets. - Minor docs heading adjustments for the ContextMenu page. These changes enable automated tests that simulate primary mouse clicks (useful for testing context menu triggers and other mouse-driven interactions).
Add a macOS golden image (basic.png) for the TextField example and a new pytest that runs the example (imports examples.controls.material.text_field.basic.main) and asserts a page controls screenshot for visual regression. Also tweak documentation image usage: reduce image widths in tabs and textfield docs and switch the textfield doc to use the new PNG example image path.
Add an integration test for the handling_change_events example that boots the example, finds the TextField by key, captures initial/intermediate/final screenshots, and generates a GIF. Add the GIF and PNG assets used by the test, and add a key to the example TextField so the test can locate it. Update the docs to reference the example_images path for the GIF.
Add a new integration test for textfield selection changes (selection_change) including screenshot assertions and GIF generation; import the selection_change example into test_textfield.py and record initial/final snapshots. Add golden image assets (initial, final PNGs and GIF) under integration_tests/examples/.../golden/macos/textfield and embed the selection_change GIF in the textfield docs (website/docs/controls/textfield.md) to demonstrate the behavior.
Add an integration test for the password TextField (password reveal) including screenshots and a GIF, and include macOS golden assets. Add a test import and a parametrized test that captures initial, focused, typed and revealed states and generates password_initial/password_final/password.gif. Add a key ("password_textfield") to the example TextField to allow finding it in tests. Update docs to reference the password example image and adjust image widths.
Add integration test and golden asset for multiline TextField. The example was updated with keys (multiline_standard, multiline_auto_height) to target controls in tests. A new pytest test (test_multiline) exercises standard and auto-height multiline fields, captures screenshots at various states, and generates a GIF. The corresponding golden GIF for macOS was added.
Add initial and final golden PNGs for the multiline TextField on macOS and update the integration test to capture and assert the initial and final screenshots (and produce the GIF). Also fix the docs image path to use example_images for the multiline example. These changes improve visual regression coverage and correct the docs reference.
Add integration test and assets for underlined/borderless TextField variants. The example main.py now includes keys for the four TextField controls so the tester can find and interact with them. A new pytest async test captures initial/intermediate/final screenshots and creates a GIF; corresponding golden images and a GIF were added for macOS. Also update the docs example image path to use example_images.
Delete numerous binary media assets (PNGs and GIFs) from sdk/python/examples/controls/material/* example folders (alert_dialog, app_bar, button, checkbox, date_picker, dropdown, navigation_*, radio, text_field, etc.). This cleans up obsolete or relocated example media, reducing repository size and removing redundant example assets.
This reverts commit dca6f40.
# Conflicts: # sdk/python/examples/controls/datatable2/empty_state/main.py # sdk/python/examples/controls/datatable2/empty_state/pyproject.toml # sdk/python/examples/controls/datatable2/example_1/main.py # sdk/python/examples/controls/datatable2/example_1/pyproject.toml # sdk/python/examples/controls/datatable2/example_2/main.py # sdk/python/examples/controls/datatable2/example_2/pyproject.toml # sdk/python/examples/controls/datatable2/media/example_2.gif # sdk/python/examples/controls/datatable2/sortable_and_selectable/main.py # sdk/python/examples/controls/datatable2/sortable_and_selectable/pyproject.toml # sdk/python/examples/extensions/datatable2/example_1/main.py # sdk/python/examples/extensions/datatable2/example_1/pyproject.toml # sdk/python/examples/extensions/datatable2/example_2/data.py # sdk/python/examples/extensions/datatable2/example_2/main.py # sdk/python/examples/extensions/datatable2/example_2/pyproject.toml # sdk/python/examples/extensions/datatable2/media/example_2.gif # sdk/python/examples/extensions/datatable2/media/sortable_and_selectable.gif # sdk/python/examples/extensions/lottie/assets/sample.json # sdk/python/packages/flet/integration_tests/examples/controls/material/golden/macos/navigation_drawer/adaptive_navigation.gif # sdk/python/packages/flet/integration_tests/examples/controls/material/golden/macos/navigation_drawer/adaptive_navigation1.png # sdk/python/packages/flet/integration_tests/examples/controls/material/golden/macos/navigation_drawer/adaptive_navigation2.png # sdk/python/packages/flet/integration_tests/examples/controls/material/golden/macos/navigation_drawer/theming.gif # sdk/python/packages/flet/integration_tests/examples/controls/material/golden/macos/navigation_drawer/theming1.png # sdk/python/packages/flet/integration_tests/examples/controls/material/golden/macos/navigation_drawer/theming2.png # sdk/python/packages/flet/integration_tests/examples/controls/material/golden/macos/navigation_drawer/theming3.png # sdk/python/packages/flet/integration_tests/examples/controls/material/test_navigation_drawer.py # website/docs/controls/datatable2/index.md
Add expand=True to the standalone SubmenuButton so it has tight constraints in the Row. Without it, the first settled frame in the integration test renders blank because the MenuAnchor-backed button doesn't finish sizing before the screenshot is taken.
Wrap post-gesture pump_and_settle calls in a _settle() helper that advances the clock 500ms per pump, matching test_time_picker's pattern. pump_and_settle with no duration exits as soon as no Flutter frames are scheduled, which on slow CI runners lands before the Python on_change/ on_click handler round-trips its control updates back to Flutter - missing the message/label text and theme_mode changes on final frames. Applies to test_radio basic and handling_selection_changes, test_switch handling_events, test_textfield prefix_and_suffix.
When the user dismissed the picker, onClosed overwrote value with null, so the next open fell back to TimeOfDay.now() via the getTimeOfDay default. Mirror DatePicker's pattern (value ?? existing) so a canceled dialog keeps the control's prior value. This is why test_hour_formats::opened_24h showed wall-clock time after the test's Cancel+reopen sequence - 11:25 when goldens were captured, 20:51 on CI - instead of the seeded 19:30.
After fixing the cancel-preserves-value bug, the 24h reopen now shows the seeded 19:30 instead of wall-clock time.
…g_clicks The test called take_screenshot before running page.update() + pump, so the RepaintBoundary wrapping the app (mounted via enable_screenshots=True) did not exist yet and take_screenshot returned null, surfacing as PIL.UnidentifiedImageError on decode. Also wrap the three consecutive taps with the same _settle() helper used in the radio/switch/textfield tests so each on_click increment round-trips before the next tap, ensuring 'Button clicked 3 time(s)' on CI.
Update documentation paths for examples and images to the correct locations. Changes: adjusted example_images and example_images_examples front-matter to include the "controls" subfolder (layoutcontrol.md, expanding-controls.md), updated CodeExample and Image paths to point at controls/material examples (navigationbar/index.md, navigationrail/index.md), and removed frontMatter.example_media from adaptive-apps.md while replacing its usages with explicit examples/controls/... image paths (including a corrected slider image path). These fixes ensure examples and images resolve correctly in the docs site.
Adjust CodeExample path references to reflect a reorganization of example files. Most examples were moved from controls/... to controls/core/... (and a responsive_row/rotated_box path was updated accordingly), so multiple docs under website/docs (controls, cookbook, and types) now point to the new locations to ensure examples load correctly.
Move several Python example directories into a clearer hierarchy: migrate controls examples into controls/core (drag_target_and_draggable/drag_target_positions, responsive_row/scrollable) and move code_editor examples into extensions/code_editor (example_4, example_5). Update website docs to reference the new controls/core/responsive_row/scrollable example path.
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.
Description
Test Code
# Test code for the review of this PRType of change
Checklist
Screenshots
Additional details