Add integration test and update dependencies

Introduced an integration test in app_test.dart for end-to-end testing. Updated pubspec.yaml to switch serious_python to the main branch and added integration_test and flet_integration_test to dev_dependencies.
This commit is contained in:
Feodor Fitsner 2025-10-22 14:20:31 -07:00
parent 2bc7e34ee6
commit 884afd91f5
2 changed files with 63 additions and 1 deletions

View File

@ -0,0 +1,55 @@
import 'package:flet_integration_test/flet_integration_test.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:{{ cookiecutter.project_name }}/main.dart' as app;
void main() {
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
group('end-to-end test', () {
testWidgets('test app', (tester) async {
const testerServerUrl = String.fromEnvironment('FLET_TEST_SERVER_URL');
late FlutterWidgetTester widgetTester;
if (testerServerUrl.isNotEmpty) {
debugPrint('Connecting to remote tester at $testerServerUrl');
widgetTester = await RemoteWidgetTester.connect(
tester: tester,
binding: binding,
serverUri: Uri.parse(testerServerUrl),
);
} else {
widgetTester = FlutterWidgetTester(tester, binding);
}
app.tester = widgetTester;
final args = <String>[];
const fletTestAppUrl = String.fromEnvironment('FLET_TEST_APP_URL');
if (fletTestAppUrl.isNotEmpty) {
args.add(fletTestAppUrl);
}
const fletTestPidFile = String.fromEnvironment('FLET_TEST_PID_FILE_PATH');
if (fletTestPidFile.isNotEmpty) {
args.add(fletTestPidFile);
}
const fletTestAssetsDir = String.fromEnvironment('FLET_TEST_ASSETS_DIR');
if (fletTestAssetsDir.isNotEmpty) {
args.add(fletTestAssetsDir);
}
app.main(args);
await Future<void>.delayed(const Duration(milliseconds: 500));
await widgetTester.pump(duration: const Duration(seconds: 1));
await widgetTester
.pumpAndSettle(duration: const Duration(milliseconds: 100));
await widgetTester.waitForTeardown();
});
});
}

View File

@ -32,7 +32,7 @@ dependency_overrides:
serious_python: serious_python:
git: git:
url: https://github.com/flet-dev/serious-python.git url: https://github.com/flet-dev/serious-python.git
ref: android-16k ref: main
path: src/serious_python path: src/serious_python
wakelock_plus: ^1.2.10 wakelock_plus: ^1.2.10
@ -56,6 +56,13 @@ dev_dependencies:
flutter_launcher_icons: ^0.14.1 flutter_launcher_icons: ^0.14.1
flutter_native_splash: ^2.4.1 flutter_native_splash: ^2.4.1
flutter_lints: ^2.0.0 flutter_lints: ^2.0.0
integration_test:
sdk: flutter
flet_integration_test:
git:
url: https://github.com/flet-dev/flet.git
ref: v1-flet-test
path: packages/flet_integration_test
flutter: flutter: