mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat(mobile): Add integration tests (#1359)
This commit is contained in:
parent
e5d798581c
commit
f4c90426a5
10 changed files with 246 additions and 15 deletions
55
mobile/integration_test/test_utils/login_helper.dart
Normal file
55
mobile/integration_test/test_utils/login_helper.dart
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
class ImmichTestLoginHelper {
|
||||
static Future<void> waitForLoginScreen(WidgetTester tester,
|
||||
{int timeoutSeconds = 20}) async {
|
||||
for (var i = 0; i < timeoutSeconds; i++) {
|
||||
// Search for "IMMICH" test in the app bar
|
||||
final result = find.text("IMMICH");
|
||||
if (tester.any(result)) {
|
||||
// Wait 5s until everything settled
|
||||
await tester.pump(const Duration(seconds: 5));
|
||||
return;
|
||||
}
|
||||
|
||||
// Wait 1s before trying again
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
}
|
||||
|
||||
fail("Timeout while waiting for login screen");
|
||||
}
|
||||
|
||||
static Future<bool> acknowledgeNewServerVersion(WidgetTester tester) async {
|
||||
final result = find.text("Acknowledge");
|
||||
if (!tester.any(result)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
await tester.tap(result);
|
||||
await tester.pump();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static Future<void> enterLoginCredentials(
|
||||
WidgetTester tester, {
|
||||
String server = "",
|
||||
String email = "",
|
||||
String password = "",
|
||||
}) async {
|
||||
final loginForms = find.byType(TextFormField);
|
||||
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
await tester.enterText(loginForms.at(0), email);
|
||||
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
await tester.enterText(loginForms.at(1), password);
|
||||
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
await tester.enterText(loginForms.at(2), server);
|
||||
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue