Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
367d415
Checkbox basic test and PopupMenuTheme docstrings
InesaFitsner Jul 30, 2025
d4f46cf
add cupertino action sheet test
OwenMcDonnell Jul 31, 2025
6dc5e59
Checkbox tests
InesaFitsner Aug 1, 2025
445e2fc
removed screenshot from example test
InesaFitsner Aug 1, 2025
416c5c2
Add tests
FeodorFitsner Aug 2, 2025
695f83f
Fix tests
FeodorFitsner Aug 2, 2025
f87536a
add simple app-bar test
OwenMcDonnell Aug 7, 2025
480eac2
try counter app test from examples folder
OwenMcDonnell Aug 8, 2025
bf8edb2
update from main
OwenMcDonnell Aug 8, 2025
8c98c86
Merge branch 'main' into v1-controls-integration-tests
FeodorFitsner Aug 9, 2025
964b9fc
Tests cleanup
FeodorFitsner Aug 9, 2025
d573783
move test_app_bar.py and reference image
OwenMcDonnell Aug 9, 2025
2983130
add dropdown test
OwenMcDonnell Aug 9, 2025
56dd15c
Add macOS integration tests GitHub Actions workflow
FeodorFitsner Aug 11, 2025
cfdc712
Update macOS CI to use flutter-action and set version
FeodorFitsner Aug 11, 2025
231b0db
Disable integration tests on appveyor
FeodorFitsner Aug 11, 2025
058c947
Merge branch 'main' into v1-controls-integration-tests
FeodorFitsner Aug 12, 2025
600ad47
Update macos-integration-tests.yml
FeodorFitsner Aug 12, 2025
5695429
Button, ElevatedButton, FilledButton tests
InesaFitsner Aug 12, 2025
bf4f5b8
FloatingActionButton test
InesaFitsner Aug 12, 2025
ec15bbc
IconButton
InesaFitsner Aug 13, 2025
1d02c3c
Add page screenshot capability and update dropdown test
FeodorFitsner Aug 13, 2025
58cf0ba
Merge branch 'v1-controls-integration-tests' of https://github.com/fl…
FeodorFitsner Aug 13, 2025
fee4dd0
banner test
OwenMcDonnell Aug 13, 2025
2e634ee
PopupMenuButton basic test
InesaFitsner Aug 13, 2025
21e715d
OutlinedButton basic test
InesaFitsner Aug 13, 2025
3f7ba37
MenuItemButton basic test
InesaFitsner Aug 13, 2025
5bfc0a4
SegmentedButton basic test
InesaFitsner Aug 13, 2025
db1c472
SubmenuButton basic test
InesaFitsner Aug 13, 2025
f9be866
CupertinoButton basic test
InesaFitsner Aug 13, 2025
748cf5e
CupertinoActionSheetAction basic test
InesaFitsner Aug 13, 2025
5192928
CupertinoContextMenuAction basic test
InesaFitsner Aug 13, 2025
01b8235
CupertinoDialogAction basic test
InesaFitsner Aug 13, 2025
f7991d2
CupertinoFilledButton basic test
InesaFitsner Aug 13, 2025
be86cf8
CupertinoSegmentedButton basic test
InesaFitsner Aug 13, 2025
876a1c9
CupertinoSlidingSegmentedButton basic test
InesaFitsner Aug 13, 2025
a63e4d8
CupertinoTintedButton basic test
InesaFitsner Aug 13, 2025
369bd07
TextButton basic test
InesaFitsner Aug 13, 2025
f670a15
Add canvas drawing tests and golden images for macOS
FeodorFitsner Aug 13, 2025
4f33bae
Merge branch 'v1-controls-integration-tests' of https://github.com/fl…
FeodorFitsner Aug 13, 2025
312bb75
Simplify canvas shadow test
FeodorFitsner Aug 13, 2025
4e2203d
CircleAvatar test
OwenMcDonnell Aug 13, 2025
a979c8f
Skip test_draw_shadow in canvas integration tests
FeodorFitsner Aug 13, 2025
53784cb
Merge branch 'v1-controls-integration-tests' of https://github.com/fl…
FeodorFitsner Aug 13, 2025
16e29e8
AlertDialog basic test
InesaFitsner Aug 13, 2025
7174e6f
BottomSheet basic test
InesaFitsner Aug 13, 2025
0daa658
CupertinoAlertDialog basic test
InesaFitsner Aug 13, 2025
84b0c6b
CupertinoBottomSheet basic test
InesaFitsner Aug 13, 2025
af8e79a
Add long press support to Tester API
FeodorFitsner Aug 13, 2025
dc377da
Merge branch 'v1-controls-integration-tests' of https://github.com/fl…
FeodorFitsner Aug 13, 2025
f8d0cf5
CupertinoContextMenu
InesaFitsner Aug 13, 2025
55814e1
Merge branch 'main' into v1-controls-integration-tests
FeodorFitsner Aug 13, 2025
cd59ae1
Image test
OwenMcDonnell Aug 13, 2025
54e6305
Merge branch 'main' into v1-controls-integration-tests
FeodorFitsner Aug 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ environment:
job_group: build_flet_package
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2204

- job_name: Integration tests on macOS
job_group: integration_tests
python_stack: python 3.10
APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma
FLET_TEST_SCREENSHOTS_PIXEL_RATIO: 2.0
FLET_TEST_SCREENSHOTS_SIMILARITY_THRESHOLD: 99.0
FLET_TEST_DISABLE_FVM: 1
# - job_name: Integration tests on macOS
# job_group: integration_tests
# python_stack: python 3.10
# APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma
# FLET_TEST_SCREENSHOTS_PIXEL_RATIO: 2.0
# FLET_TEST_SCREENSHOTS_SIMILARITY_THRESHOLD: 99.0
# FLET_TEST_DISABLE_FVM: 1

- job_name: Build Flet for Windows
job_group: build_flet
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/macos-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: macOS Integration Tests

on:
push:
pull_request:

env:
FLUTTER_VERSION: "3.32.8"
FLET_TEST_SCREENSHOTS_PIXEL_RATIO: "2.0"
FLET_TEST_SCREENSHOTS_SIMILARITY_THRESHOLD: "99.0"
FLET_TEST_DISABLE_FVM: "1"

jobs:
test-macos:
runs-on: macos-14
steps:
- uses: actions/checkout@v4

- name: Install CocoaPods
run: brew install cocoapods

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
cache: true

- name: Install uv
shell: bash
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"

- name: Show tool versions
run: |
python3 --version
uv --version
pod --version
flutter --version

- name: Run integration tests
working-directory: sdk/python
run: |
uv run pytest -s -o log_cli=true -o log_cli_level=INFO packages/flet/integration_tests

- name: Upload failure screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: integration-test-failures-macos
path: sdk/python/packages/flet/integration_tests/**/*_actual.png
if-no-files-found: ignore
4 changes: 4 additions & 0 deletions client/integration_test/flutter_tester.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ class FlutterWidgetTester implements Tester {
Future<void> tap(TestFinder finder) =>
_tester.tap((finder as FlutterTestFinder).raw);

@override
Future<void> longPress(TestFinder finder) =>
_tester.longPress((finder as FlutterTestFinder).raw);

@override
Future<void> enterText(TestFinder finder, String text) =>
_tester.enterText((finder as FlutterTestFinder).raw, text);
Expand Down
40 changes: 37 additions & 3 deletions packages/flet/lib/src/controls/page.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'dart:ui' as ui;
import 'dart:ui';

import 'package:collection/collection.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:provider/provider.dart';
Expand All @@ -25,6 +27,7 @@ import '../utils/platform_utils_web.dart'
import '../utils/session_store_web.dart'
if (dart.library.io) "../utils/session_store_non_web.dart";
import '../utils/theme.dart';
import '../utils/time.dart';
import '../utils/user_fonts.dart';
import '../widgets/animated_transition_page.dart';
import '../widgets/loading_page.dart';
Expand All @@ -44,6 +47,7 @@ class PageControl extends StatefulWidget {

class _PageControlState extends State<PageControl> with WidgetsBindingObserver {
final _navigatorKey = GlobalKey<NavigatorState>();
final _rootKey = GlobalKey();
late final RouteState _routeState;
late final SimpleRouterDelegate _routerDelegate;
late final RouteParser _routeParser;
Expand All @@ -52,7 +56,7 @@ class _PageControlState extends State<PageControl> with WidgetsBindingObserver {
ServiceRegistry? _userServices;
bool? _prevOnKeyboardEvent;
bool _keyboardHandlerSubscribed = false;

double _dpr = 1.0;
String? _prevViewRoutes;

final Map<int, MultiView> _multiViews = <int, MultiView>{};
Expand Down Expand Up @@ -87,13 +91,14 @@ class _PageControlState extends State<PageControl> with WidgetsBindingObserver {
onRestart: () => _handleAppLifecycleTransition('restart'));

_attachKeyboardListenerIfNeeded();
widget.control.addInvokeMethodListener(_invokeMethod);
}

@override
void didChangeDependencies() {
debugPrint("Page.didChangeDependencies: ${widget.control.id}");
super.didChangeDependencies();

_dpr = MediaQuery.devicePixelRatioOf(context);
_loadFontsIfNeeded(FletBackend.of(context));
}

Expand Down Expand Up @@ -148,9 +153,30 @@ class _PageControlState extends State<PageControl> with WidgetsBindingObserver {
if (_keyboardHandlerSubscribed) {
HardwareKeyboard.instance.removeHandler(_handleKeyDown);
}
widget.control.removeInvokeMethodListener(_invokeMethod);
super.dispose();
}

Future<dynamic> _invokeMethod(String name, dynamic args) async {
debugPrint("Page.$name($args)");
switch (name) {
case "take_screenshot":
if (_rootKey.currentContext == null) {
return null;
}
await Future.delayed(
parseDuration(args["delay"], const Duration(milliseconds: 20))!);
final boundary = _rootKey.currentContext!.findRenderObject()
as RenderRepaintBoundary;
final image = await boundary.toImage(
pixelRatio: parseDouble(args["pixel_ratio"], _dpr)!);
final data = await image.toByteData(format: ui.ImageByteFormat.png);
return data!.buffer.asUint8List();
default:
throw Exception("Unknown Page method: $name");
}
}

void _updateMultiViews() {
if (!widget.control.backend.multiView) {
return;
Expand Down Expand Up @@ -383,7 +409,7 @@ class _PageControlState extends State<PageControl> with WidgetsBindingObserver {
var showSemanticsDebugger =
control.getBool("show_semantics_debugger", false)!;

var app = widgetsDesign == PageDesign.cupertino
Widget? app = widgetsDesign == PageDesign.cupertino
? home != null
? CupertinoApp(
debugShowCheckedModeBanner: false,
Expand Down Expand Up @@ -432,6 +458,14 @@ class _PageControlState extends State<PageControl> with WidgetsBindingObserver {
supportedLocales: localeConfiguration.supportedLocales,
locale: localeConfiguration.locale,
);

if (control.getBool("enable_screenshots") == true) {
app = RepaintBoundary(
key: _rootKey,
child: app,
);
}

return PageContext(
themeMode: themeMode,
brightness: brightness,
Expand Down
2 changes: 1 addition & 1 deletion packages/flet/lib/src/controls/submenu_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class _SubmenuButtonControlState extends State<SubmenuButtonControl> {
leadingIcon: widget.control.buildWidget("leading"),
trailingIcon: widget.control.buildWidget("trailing"),
menuChildren: widget.control.buildWidgets("controls"),
child: widget.control.buildWidget("content"),
child: widget.control.buildTextOrWidget("content"),
);

var focusValue = widget.control.getString("focus");
Expand Down
6 changes: 6 additions & 0 deletions packages/flet/lib/src/services/tester.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ class TesterService extends FletService {
await control.backend.tester!.tap(finder);
}

case "long_press":
var finder = _finders[args["id"]];
if (finder != null) {
await control.backend.tester!.longPress(finder);
}

case "enter_text":
var finder = _finders[args["id"]];
if (finder != null) {
Expand Down
1 change: 1 addition & 0 deletions packages/flet/lib/src/testing/tester.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ abstract class Tester {
TestFinder findByIcon(IconData icon);
Future<Uint8List> takeScreenshot(String name);
Future<void> tap(TestFinder finder);
Future<void> longPress(TestFinder finder);
Future<void> enterText(TestFinder finder, String text);
Future<void> mouseHover(TestFinder finder);
void teardown();
Expand Down
5 changes: 3 additions & 2 deletions sdk/python/examples/apps/counter/counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def plus_click(e):
page.add(
ft.Row(
[
ft.IconButton(ft.Icons.REMOVE, on_click=minus_click),
ft.IconButton(ft.Icons.REMOVE, on_click=minus_click, key="decrement"),
txt_number,
ft.IconButton(ft.Icons.ADD, on_click=plus_click),
],
Expand All @@ -27,4 +27,5 @@ def plus_click(e):
)


ft.run(main)
if __name__ == "__main__":
ft.run(main)
42 changes: 42 additions & 0 deletions sdk/python/examples/apps/counter/test_counter_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from pathlib import Path

import counter as app
import flet as ft
import flet.testing as ftt
import pytest
import pytest_asyncio


@pytest_asyncio.fixture(scope="module")
async def flet_app(request):
flet_app = ftt.FletTestApp(
flutter_app_dir=(Path(__file__).parent / "../../../../../client").resolve(),
flet_app_main=app.main,
test_path=request.fspath,
)
await flet_app.start()
yield flet_app
await flet_app.teardown()


@pytest.mark.asyncio(loop_scope="module")
async def test_app(flet_app: ftt.FletTestApp):
tester = flet_app.tester
await tester.pump_and_settle()
zero_text = await tester.find_by_text("0")
assert zero_text.count == 1

# tap increment button
increment_btn = await tester.find_by_icon(ft.Icons.ADD)
assert increment_btn.count == 1
await tester.tap(increment_btn)
await tester.pump_and_settle()
assert (await tester.find_by_text("1")).count == 1

# tap decrement button
decrement_button = await tester.find_by_key("decrement")
assert decrement_button.count == 1
await tester.tap(decrement_button)
await tester.tap(decrement_button)
await tester.pump_and_settle()
assert (await tester.find_by_text("-1")).count == 1
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ def handle_checked_item_click(e: ft.Event[ft.PopupMenuItem]):
page.add(ft.Text("Body!"))


ft.run(main)
if __name__ == "__main__":
ft.run(main)
3 changes: 2 additions & 1 deletion sdk/python/examples/controls/checkbox/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ def handle_button_click(e: ft.Event[ft.ElevatedButton]):
)


ft.run(main)
if __name__ == "__main__":
ft.run(main)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@


def main(page: ft.Page):
page.theme_mode = ft.ThemeMode.LIGHT

def get_options():
colors = [
ft.Colors.RED,
Expand Down
4 changes: 3 additions & 1 deletion sdk/python/examples/controls/image/src_base64.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
def main(page: ft.Page):
page.add(
ft.Image(
src_base64="iVBORw0KGgo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t5HDbv7t1O90lpYCCCKbhfzW5kAIwUAazR0BlfII8Ow0I6uoVmI9MyAMwbMs8CExmDbk4zgu931MyO4OI4KrYflkRjOoTI+uM9d1vjotwKPu9QMk/sxzuO8POiVFcdZ1M2YBVsMEAKOqLvaPIe7mACuw0z/80SMH58SMplxlfiDhVi7dw2pltRhjKBQTQdrSja2KKTfE551NHuaZ0QVPvWYQUn31/Vm2nDvgjF4grVJx6suSvrvrSJ/6cSW2Oz9mf264uNrB806xZ1k/CZ49dUKgDEtlCROX2hfHpx8pGuuo3PpqYulw8fjndOp1yhgtNKRevJ1FyR2Ola+jXAjdnwTkZ6o896GdWdxDw7IxFg+0DpmXchTKSBWQnIuJn9u4j7dt+13UfHXEkXQOcuQ4kMhVtqsgUyPiQiPQfHw1NB2sRjmXKuTg1NwwBYLhtPtQX26eqTwGXPDOqvmcC4Hnwfrrad94GrVsOYTqUTkQY+iTlNe/6O1miSP/x0VB/+wMIDwHn/vtV1iQC4Xv95uUEWVCoL9Y5Z+gdovoyMHUFJHv88jmVy0vTuw7cZNv2YaA61Bfb7ZX5F8SaUv2xwZevAAAAAElFTkSuQmCC",
width=100,
height=100,
),
)

Expand Down
2 changes: 1 addition & 1 deletion sdk/python/packages/flet/integration_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ FLET_TEST_DEVICE=<simulator-name> FLET_TEST_PLATFORM=android uv run pytest -s -o
Running test to create golden images:

```
FLET_TEST_GOLDEN=1 uv run pytest -s -o log_cli=true -o log_cli_level=INFO packages/flet/integration_tests/test_controls.py
FLET_TEST_GOLDEN=1 uv run pytest -s -o log_cli=true -o log_cli_level=INFO packages/flet/integration_tests/controls/test_buttons.py
```

Environment variables:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import flet as ft
import flet.testing as ftt
import pytest


@pytest.mark.asyncio(loop_scope="module")
async def test_alert_dialog_basic(flet_app: ftt.FletTestApp, request):
flet_app.page.theme_mode = ft.ThemeMode.LIGHT
ad = ft.AlertDialog(
key="ad",
title=ft.Text("Hello"),
content=ft.Text("You are notified!"),
alignment=ft.Alignment.CENTER,
on_dismiss=lambda e: print("Dialog dismissed!"),
title_padding=ft.Padding.all(25),
)
flet_app.page.enable_screenshots = True
flet_app.page.window.width = 400
flet_app.page.window.height = 600
flet_app.page.show_dialog(ad)
flet_app.page.update()
await flet_app.tester.pump_and_settle()

flet_app.assert_screenshot(
"alert_dialog_basic",
await flet_app.page.take_screenshot(
pixel_ratio=flet_app.screenshots_pixel_ratio
),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from pathlib import Path

import flet as ft
import flet.testing as ftt
import pytest
import pytest_asyncio


@pytest.mark.asyncio(loop_scope="module")
async def test_app_bar(flet_app: ftt.FletTestApp, request):
flet_app.page.theme_mode = ft.ThemeMode.LIGHT
await flet_app.assert_control_screenshot(
request.node.name,
ft.AppBar(
bgcolor=ft.Colors.PRIMARY_CONTAINER,
leading=ft.Icon(ft.Icons.PALETTE),
leading_width=40,
title=ft.Text("AppBar Test"),
center_title=False,
actions=[
ft.IconButton(icon=ft.Icons.TAB),
ft.IconButton(icon=ft.Icons.WALLET),
],
),
)
Loading