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
169 lines
4.9 KiB
Dart
169 lines
4.9 KiB
Dart
import 'package:core/presentation/views/search/search_bar_view.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:labels/extensions/label_extension.dart';
|
|
import 'package:tmail_ui_user/features/base/model/ui_keys.dart';
|
|
import 'package:tmail_ui_user/features/thread/presentation/thread_view.dart';
|
|
import 'package:tmail_ui_user/features/thread/presentation/widgets/email_tile_builder.dart';
|
|
import 'package:tmail_ui_user/features/thread/presentation/widgets/scroll_to_top_button_widget.dart';
|
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
|
|
|
import '../base/core_robot.dart';
|
|
import '../utils/wait_for_condition.dart';
|
|
|
|
class ThreadRobot extends CoreRobot {
|
|
ThreadRobot(super.$);
|
|
|
|
Future<void> openComposer() async {
|
|
await $(const ValueKey(UiKeys.composeEmailButton)).$(InkWell).tap();
|
|
}
|
|
|
|
Future<void> openSearchView() async {
|
|
await $(SearchBarView).$(InkWell).tap();
|
|
}
|
|
|
|
Future<void> tapOnSearchField() async {
|
|
await $(ThreadView).$(SearchBarView).tap();
|
|
}
|
|
|
|
Future<void> openEmailWithSubject(String subject) async {
|
|
final email = $(EmailTileBuilder)
|
|
.which<EmailTileBuilder>((view) => view.presentationEmail.subject == subject);
|
|
await $.waitUntilVisible(email);
|
|
await email.tap();
|
|
await $.pump(const Duration(seconds: 2));
|
|
}
|
|
|
|
Future<void> openEmailWithLabel(String labelDisplayName) async {
|
|
final email = $(EmailTileBuilder).which<EmailTileBuilder>(
|
|
(view) =>
|
|
view.labels
|
|
?.any((label) => label.safeDisplayName == labelDisplayName) ==
|
|
true,
|
|
);
|
|
await $.waitUntilVisible(email);
|
|
await email.tap();
|
|
await $.pump(const Duration(seconds: 2));
|
|
}
|
|
|
|
Future<void> openMailbox() async {
|
|
await $(#mobile_mailbox_menu_button).tap();
|
|
}
|
|
|
|
Future<void> tapEmptyTrashBanner() => $(' ${AppLocalizations().empty_trash_now}').tap();
|
|
|
|
Future<void> tapDeleteAllButtonOnEmptyTrashConfirmDialog(
|
|
AppLocalizations appLocalizations,
|
|
) => $(appLocalizations.delete_all).tap();
|
|
|
|
Future<void> scrollToEmailWithSubject(String subject) async {
|
|
await $.scrollUntilVisible(finder: $(subject), delta: 300);
|
|
await $.pumpAndSettle();
|
|
}
|
|
|
|
Future<void> scrollToTop() async {
|
|
await $(ScrollToTopButtonWidget).$(InkWell).tap();
|
|
await $.pumpAndSettle();
|
|
}
|
|
|
|
Future<void> openQuickFilter() async {
|
|
await $(#mobile_filter_message_button).tap();
|
|
}
|
|
|
|
Future<void> selectAttachmentFilter() async {
|
|
await $(#attachments_filter).tap();
|
|
}
|
|
|
|
Future<void> selectUnreadFilter() async {
|
|
await $(#unread_filter).tap();
|
|
}
|
|
|
|
Future<void> selectStarredFilter() async {
|
|
await $(#starred_filter).tap();
|
|
}
|
|
|
|
Future<void> pullToRefreshByEmailSubject(String subject) async {
|
|
await $(subject).waitUntilVisible();
|
|
await $.tester.fling(
|
|
$(subject),
|
|
const Offset(0, 300),
|
|
1000,
|
|
);
|
|
await $.pumpAndSettle();
|
|
}
|
|
|
|
Future<void> tapOnMailboxWithName(String name) async {
|
|
await $(name).tap();
|
|
await $.pumpAndSettle();
|
|
}
|
|
|
|
Future<void> confirmEmptyTrash() async {
|
|
await $(AppLocalizations().delete_all).tap();
|
|
}
|
|
|
|
Future<void> tapEmptySpamBanner() async {
|
|
await $(' ${AppLocalizations().deleteAllSpamEmailsNow}').tap();
|
|
}
|
|
|
|
Future<void> confirmEmptySpam() async {
|
|
await $(AppLocalizations().delete_all).tap();
|
|
}
|
|
|
|
Future<void> tapEmptyTrashAfterLongPress() async {
|
|
await $(AppLocalizations().emptyTrash).tap();
|
|
}
|
|
|
|
Future<void> tapConfirmEmptyTrashAfterLongPress() async {
|
|
await $(AppLocalizations().delete).tap();
|
|
await $.pumpAndSettle(duration: const Duration(seconds: 2));
|
|
}
|
|
|
|
Future<void> tapLabelAsButton() async {
|
|
await $(#moreAction_selected_email_button).tap();
|
|
await $.pumpAndTrySettle();
|
|
await $(#labelAs_action).tap();
|
|
}
|
|
|
|
Future<void> tapEmptySpamAfterLongPress() async {
|
|
await $(AppLocalizations().deleteAllSpamEmails).tap();
|
|
}
|
|
|
|
Future<void> longPressEmailWithSubject(String subject) => waitForCondition(
|
|
() async {
|
|
await $(subject).longPress();
|
|
return $(#moreAction_selected_email_button).exists;
|
|
},
|
|
);
|
|
|
|
Future<void> moveEmailToMailboxWithName(String mailboxName) async {
|
|
await $(#moreAction_selected_email_button).tap();
|
|
|
|
await $(#moveToMailbox_action).tap();
|
|
|
|
await $(mailboxName).tap();
|
|
}
|
|
|
|
Future<void> moveEmailToTrash() async {
|
|
await $(#moveToTrash_selected_email_button).tap();
|
|
await $.pumpAndTrySettle();
|
|
}
|
|
|
|
Future<void> tapMarkAsReadButton() async {
|
|
await $(#markAsRead_selected_email_button).tap();
|
|
await $.pumpAndTrySettle();
|
|
}
|
|
|
|
Future<void> tapMarkAsStarAction() async {
|
|
await $(#moreAction_selected_email_button).tap();
|
|
await $.pumpAndTrySettle();
|
|
await $(#markAsStarred_action).tap();
|
|
await $.pumpAndTrySettle();
|
|
}
|
|
|
|
Future<void> tapMarkAsSpamAction() async {
|
|
await $(#moreAction_selected_email_button).tap();
|
|
await $.pumpAndTrySettle();
|
|
await $(#moveToSpam_action).tap();
|
|
await $.pumpAndTrySettle();
|
|
}
|
|
} |