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:
parent
2bc7e34ee6
commit
884afd91f5
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ dependency_overrides:
|
|||
serious_python:
|
||||
git:
|
||||
url: https://github.com/flet-dev/serious-python.git
|
||||
ref: android-16k
|
||||
ref: main
|
||||
path: src/serious_python
|
||||
|
||||
wakelock_plus: ^1.2.10
|
||||
|
|
@ -56,6 +56,13 @@ dev_dependencies:
|
|||
flutter_launcher_icons: ^0.14.1
|
||||
flutter_native_splash: ^2.4.1
|
||||
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:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue