mirror of
https://github.com/linagora/tmail-flutter.git
synced 2026-12-06 16:04:20 +00:00
* Patrol POC replace Firebase Test Lab with local Android emulator Replace GCloud auth, Firebase Test Lab, and ngrok with a local Android AVD via reactivecircus/android-emulator-runner on CI. The backend runs in Docker and is reachable from the emulator at the QEMU host alias 10.0.2.2. CI / scripts: - Remove Google Cloud auth, Firebase run step, and ngrok tunnel - Add KVM, Gradle, and AVD cache setup; shard tests across 4 parallel runners - Scripts: drop ngrok, point jmap.properties to 10.0.2.2, manage cleanup via trap - prebuild.sh: parallelize module builds, suppress noisy output - provisioning.sh: parallelize james-cli/curl calls, fix hardcoded container IP Backend reset for test isolation: - Add backend-reset-server.py: HTTP server that restarts tmail-backend and re-runs provisioning on POST /reset, so each test starts with a clean state - Add BackendResetClient.dart: Dart client called in patrolTearDown - Reduce visibleTimeout 30s → 10s; allow insecure connections in debug mode * Patrol POC fix flaky tests Replace fixed pumpAndSettle delays with waitUntilVisible/waitUntilExists so tests react to actual UI state rather than arbitrary timeouts. - Add PatrolFileExtensions.toFileInfo() and use it in composer robot/scenario utils - Guard MobileEditorWidget.dispose() under isIntegrationTesting to prevent teardown crash - Fix scroll direction (AxisDirection.down) in calendar attendee button scroll - Add scrollTo() before tap in label modal robot and edit-tag scenario - Wait on EmailTileBuilder (not label name) after email provisioning — more reliable - Inline image: wait for HtmlContentViewer to contain base64 data before asserting - Use native platform wait for inline image in upload scenario - Remove unnecessary Future.delayed and extra pumpAndSettle calls - Pre-select English before switching language to ensure deterministic starting state - Fix app_grid back-press sequence
68 lines
2.0 KiB
Dart
68 lines
2.0 KiB
Dart
import 'package:core/utils/config/env_loader.dart';
|
|
import 'package:core/utils/platform_info.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:patrol/patrol.dart';
|
|
import 'package:tmail_ui_user/main/main_entry.dart';
|
|
|
|
import '../models/test_tags.dart';
|
|
import '../utils/backend_reset_client.dart';
|
|
import 'base_scenario.dart';
|
|
import '../factories/robot_factory.dart';
|
|
import '../factories/robot_factory_provider.dart';
|
|
|
|
class TestBase {
|
|
static final TestBase _instance = TestBase._internal();
|
|
factory TestBase() => _instance;
|
|
|
|
TestBase._internal();
|
|
|
|
void runPatrolTest({
|
|
required String description,
|
|
required BaseScenario Function(PatrolIntegrationTester $, RobotFactory robots) scenarioBuilder,
|
|
List<TestTags> tags = const [TestTags.android, TestTags.ios],
|
|
}) {
|
|
patrolSetUp(_setup);
|
|
|
|
patrolTearDown(_tearDown);
|
|
|
|
patrolTest(
|
|
description,
|
|
config: const PatrolTesterConfig(
|
|
settlePolicy: SettlePolicy.trySettle,
|
|
existsTimeout: Duration(seconds: 10),
|
|
visibleTimeout: Duration(seconds: 10),
|
|
settleTimeout: Duration(seconds: 10),
|
|
printLogs: true,
|
|
),
|
|
tags: tags.map((t) => t.name).toList(),
|
|
platformAutomatorConfig: PlatformAutomatorConfig.fromOptions(
|
|
findTimeout: const Duration(seconds: 10),
|
|
),
|
|
framePolicy: LiveTestWidgetsFlutterBindingFramePolicy.benchmarkLive,
|
|
($) async {
|
|
await setupTest();
|
|
await scenarioBuilder($, createRobotFactory($)).execute();
|
|
},
|
|
);
|
|
}
|
|
|
|
Future<void> setupTest() async {
|
|
await EnvLoader.loadEnvFile();
|
|
await runTmail();
|
|
|
|
final originalOnError = FlutterError.onError!;
|
|
FlutterError.onError = (FlutterErrorDetails details) {
|
|
originalOnError(details);
|
|
};
|
|
}
|
|
|
|
Future<void> _setup() async {
|
|
PlatformInfo.isIntegrationTesting = true;
|
|
}
|
|
|
|
Future<void> _tearDown() async {
|
|
PlatformInfo.isIntegrationTesting = false;
|
|
await BackendResetClient.reset();
|
|
}
|
|
} |