-
Notifications
You must be signed in to change notification settings - Fork 607
v1: Integration tests - part 2 #5578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
also fix bug with using str for DataCell content and formatting
Fixed bug with String title
Introduces a new layout utility for parsing 'expand' properties and refactors controls to use it for consistent expand logic. Adds error handling for unbounded horizontal GridView and ListView, updates related integration tests, and includes new golden images for horizontal views. Fix #5555
…/flet into v1-integration-tests-p2
Tabs test doesn't work
Added bounded height check to TabBarViewControl to prevent rendering errors when height is unbounded. Updated integration test to wrap TabBarView in a Container and use expand_screenshot for more reliable screenshot comparison. Modified FletTestApp to support expand_screenshot option. Added new golden image for macOS tabs basic test.
Eliminates redundant assignments of `flet_app.page.theme_mode = ft.ThemeMode.LIGHT` from all integration test files. This streamlines test setup and avoids unnecessary theme configuration, relying on default or externally set theme modes.
Updated the visibility assertion in DataCell.before_update to check if content is an instance of Control before asserting its visibility. This prevents errors when content is not a Control.
…/flet into v1-integration-tests-p2
Changed the test image source in test_draw_url_image to a new URL and updated the canvas dimensions. The corresponding golden image was also updated to reflect these changes.
…/flet into v1-integration-tests-p2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've reviewed this pull request using the Sourcery rules engine
Deploying flet-docs with
|
| Latest commit: |
332e1b5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d507580f.flet-docs.pages.dev |
| Branch Preview URL: | https://v1-integration-tests-p2.flet-docs.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces integration tests for various controls and enhances the Flet testing framework with improved screenshot capabilities and layout parsing utilities. It standardizes the Python integration test framework by adding pytest_asyncio fixtures, automatically setting theme mode to light, and providing a unified screenshot API with expand support.
- Adds layout parsing utilities (parseExpand/getExpand) and exports them in flet.dart for consistent expand property handling
- Implements unbounded height checks with LayoutBuilder and ErrorControl for TabBarView, GridView, ListView, and NavigationRail controls to prevent layout issues
- Standardizes Python integration tests by removing redundant theme_mode setups, adding pytest_asyncio fixtures, and using consistent screenshot methodology
Reviewed Changes
Copilot reviewed 84 out of 133 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/python/packages/flet/src/flet/testing/flet_test_app.py | Adds auto theme_mode setting and expand_screenshot parameter to assert_control_screenshot |
| sdk/python/packages/flet/src/flet/controls/material/expansion_tile.py | Guards before_update assertion with Control instance check |
| sdk/python/packages/flet/src/flet/controls/material/datatable.py | Guards before_update assertion with Control instance check |
| sdk/python/packages/flet/pyproject.toml | Adds pytest_asyncio dependency for async test support |
| packages/flet/lib/src/utils/layout.dart | Introduces parseExpand utility and getExpand extension method |
| packages/flet/lib/src/controls/*.dart | Updates expand handling to use new getExpand utility and adds unbounded height checks |
| sdk/python/packages/flet/integration_tests/controls/test_*.py | Over 30 new integration test files with standardized structure |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| height=120, | ||
| [ | ||
| fc.Image( | ||
| src="https://raw.githubusercontent.com/flet-dev/media/refs/heads/main/pictures/minion.png", |
Copilot
AI
Aug 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard-coding external URLs in tests can lead to flaky tests if the external resource becomes unavailable. Consider using a local test asset or mocking the image loading behavior.
| src="https://raw.githubusercontent.com/flet-dev/media/refs/heads/main/pictures/minion.png", | |
| src="52-100x100.png", |
sdk/python/packages/flet/integration_tests/controls/test_tabs.py
Outdated
Show resolved
Hide resolved
| # ft.Container( | ||
| # content=ft.Text("This is Tab 2"), | ||
| # alignment=ft.Alignment.CENTER, | ||
| # ), |
Copilot
AI
Aug 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented-out code should be removed rather than left in the codebase. If this code is needed for future reference, consider using version control history or adding a TODO comment explaining why it's preserved.
| # ), |
| @@ -0,0 +1,30 @@ | |||
| # @pytest.mark.asyncio(loop_scope="module") | |||
Copilot
AI
Aug 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire file contains only commented-out code. If this test is not needed, the file should be removed. If it's for future implementation, consider adding a clear TODO comment or removing the file until it's ready.
sdk/python/packages/flet/integration_tests/controls/test_menu_bar.py
Outdated
Show resolved
Hide resolved
Added detailed docstrings to each attribute of the PopupMenuTheme class to clarify their purpose and usage, improving code documentation and developer understanding.
…/flet into v1-integration-tests-p2
Corrects the function name typo from 'test_menu_ber_basic' to 'test_menu_bar_basic' in test_menu_bar.py. Removes commented-out code from test_tabs.py for improved readability and maintainability.
…/flet into v1-integration-tests-p2
Summary by Sourcery
Add layout parsing and improve control expand logic, guard unbounded constraints, and unify Python integration test framework with new screenshot API
New Features:
Bug Fixes:
Enhancements:
Build:
Tests: