chore(mobile): add login integration tests and reorganize CI definitions (#1417)

* Add integration tests for the login process

* Reorganize tests

* Test wrong instance URL

* Run mobile unit tests in CI

* Fix CI

* Pin Flutter Version to 3.3.10

* Push something stupid to re-trigger CI
This commit is contained in:
Matthias Rupp 2023-01-25 17:10:04 +01:00 committed by GitHub
parent d1db47ee34
commit f64db3a2f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 212 additions and 76 deletions

View file

@ -1,14 +1,28 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:hive/hive.dart';
import 'package:immich_mobile/main.dart';
import 'package:integration_test/integration_test.dart';
import 'package:meta/meta.dart';
import 'package:immich_mobile/main.dart' as app;
import 'login_helper.dart';
class ImmichTestHelper {
final WidgetTester tester;
ImmichTestHelper(this.tester);
ImmichTestLoginHelper? _loginHelper;
ImmichTestLoginHelper get loginHelper {
_loginHelper ??= ImmichTestLoginHelper(tester);
return _loginHelper!;
}
static Future<IntegrationTestWidgetsFlutterBinding> initialize() async {
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
@ -32,9 +46,12 @@ class ImmichTestHelper {
}
void immichWidgetTest(String description, Future<void> Function(WidgetTester) test) {
testWidgets(description, (widgetTester) async {
await ImmichTestHelper.loadApp(widgetTester);
await test(widgetTester);
});
@isTest
void immichWidgetTest(String description, Future<void> Function(WidgetTester, ImmichTestHelper) test) {
testWidgets(description, (widgetTester) async {
await ImmichTestHelper.loadApp(widgetTester);
await test(widgetTester, ImmichTestHelper(widgetTester));
}, semanticsEnabled: false);
}