diff --git a/integration_test/factories/mobile_robot_factory.dart b/integration_test/factories/mobile_robot_factory.dart index 3cf2e0190..6fe66fe11 100644 --- a/integration_test/factories/mobile_robot_factory.dart +++ b/integration_test/factories/mobile_robot_factory.dart @@ -2,7 +2,9 @@ import 'package:patrol/patrol.dart'; import '../robots/abstract/abstract_hardware_keyboard_robot.dart'; import '../robots/abstract/abstract_common_robot.dart'; +import '../robots/abstract/abstract_account_switcher_robot.dart'; import '../robots/abstract/abstract_settings_robot.dart'; +import '../robots/mobile/mobile_account_switcher_robot.dart'; import '../robots/mobile/mobile_common_robot.dart'; import '../robots/abstract/abstract_app_grid_robot.dart'; import '../robots/abstract/abstract_composer_robot.dart'; @@ -60,6 +62,9 @@ class MobileRobotFactory implements RobotFactory { @override AbstractSearchRobot searchRobot() => MobileSearchRobot($); + @override + AbstractAccountSwitcherRobot accountSwitcherRobot() => MobileAccountSwitcherRobot($); + @override AbstractSettingsRobot settingsRobot() => MobileSettingsRobot($); diff --git a/integration_test/factories/robot_factory.dart b/integration_test/factories/robot_factory.dart index deeda839f..b55423e9f 100644 --- a/integration_test/factories/robot_factory.dart +++ b/integration_test/factories/robot_factory.dart @@ -8,6 +8,7 @@ import '../robots/abstract/abstract_login_robot.dart'; import '../robots/abstract/abstract_mailbox_menu_robot.dart'; import '../robots/abstract/abstract_rules_filter_creator_robot.dart'; import '../robots/abstract/abstract_search_robot.dart'; +import '../robots/abstract/abstract_account_switcher_robot.dart'; import '../robots/abstract/abstract_settings_robot.dart'; import '../robots/abstract/abstract_thread_robot.dart'; @@ -23,6 +24,7 @@ abstract class RobotFactory { AbstractEmailRobot emailRobot(); AbstractSearchRobot searchRobot(); AbstractSettingsRobot settingsRobot(); + AbstractAccountSwitcherRobot accountSwitcherRobot(); /// Web only: real key presses. Null where no host keyboard is wired. AbstractHardwareKeyboardRobot? hardwareKeyboardRobot(); diff --git a/integration_test/factories/web_robot_factory.dart b/integration_test/factories/web_robot_factory.dart index 9e9014901..8ca1bcef5 100644 --- a/integration_test/factories/web_robot_factory.dart +++ b/integration_test/factories/web_robot_factory.dart @@ -2,7 +2,9 @@ import 'package:patrol/patrol.dart'; import '../robots/abstract/abstract_hardware_keyboard_robot.dart'; import '../robots/abstract/abstract_common_robot.dart'; +import '../robots/abstract/abstract_account_switcher_robot.dart'; import '../robots/abstract/abstract_settings_robot.dart'; +import '../robots/web/web_account_switcher_robot.dart'; import '../robots/web/web_common_robot.dart'; import '../robots/web/web_email_robot.dart'; import '../robots/abstract/abstract_app_grid_robot.dart'; @@ -61,6 +63,9 @@ class WebRobotFactory implements RobotFactory { @override AbstractSearchRobot searchRobot() => WebSearchRobot($); + @override + AbstractAccountSwitcherRobot accountSwitcherRobot() => WebAccountSwitcherRobot($); + @override AbstractSettingsRobot settingsRobot() => WebSettingsRobot($); diff --git a/integration_test/mixin/delegation_standalone_scenario_mixin.dart b/integration_test/mixin/delegation_standalone_scenario_mixin.dart index 8625f225d..e152c86de 100644 --- a/integration_test/mixin/delegation_standalone_scenario_mixin.dart +++ b/integration_test/mixin/delegation_standalone_scenario_mixin.dart @@ -2,14 +2,15 @@ import 'package:tmail_ui_user/features/manage_account/presentation/model/account import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; import '../base/base_test_scenario.dart'; -import '../robots/web/web_account_switcher_robot.dart'; +import '../robots/abstract/abstract_account_switcher_robot.dart'; -/// Shared stand-alone web setup for T-07 account-switcher scenarios. +/// Shared setup of the stand-alone web and the Android and iOS app account-switcher scenarios. mixin DelegationStandaloneScenarioMixin on BaseTestScenario { static const ownerAddress = 'alice@example.com'; static const ownAddress = 'bob@example.com'; - WebAccountSwitcherRobot get accountSwitcher => WebAccountSwitcherRobot($); + AbstractAccountSwitcherRobot get accountSwitcher => + robots.accountSwitcherRobot(); /// Turns Delegation on in Preferences and returns to the mailbox chrome. Future enableDelegationAndReturnToMailbox() async { @@ -28,6 +29,7 @@ mixin DelegationStandaloneScenarioMixin on BaseTestScenario { l10n.delegation, switchedOn: true, ); + await settingsRobot.leaveSettingsDetail(); await settingsRobot.closeSettings(); await robots.commonRobot().waitForMailboxReady(); } diff --git a/integration_test/robots/abstract/abstract_account_switcher_robot.dart b/integration_test/robots/abstract/abstract_account_switcher_robot.dart index c80efc820..f1e59bfde 100644 --- a/integration_test/robots/abstract/abstract_account_switcher_robot.dart +++ b/integration_test/robots/abstract/abstract_account_switcher_robot.dart @@ -22,5 +22,6 @@ abstract class AbstractAccountSwitcherRobot { /// notifier during the show-delay window before the dialog appears. Future cancelInFlightSwitch(); - Future dismissViewingBanner(); + /// Shows `mine` again from the chrome of the shown delegated mailbox. + Future leaveDelegatedMailbox(); } diff --git a/integration_test/robots/account_switch_robot_mixin.dart b/integration_test/robots/account_switch_robot_mixin.dart index 0026e2f10..013b38bf4 100644 --- a/integration_test/robots/account_switch_robot_mixin.dart +++ b/integration_test/robots/account_switch_robot_mixin.dart @@ -8,10 +8,10 @@ import 'package:tmail_ui_user/features/delegation/domain/extensions/session_dele import 'package:tmail_ui_user/features/delegation/presentation/notifier/account_switch_notifier.dart'; import 'package:tmail_ui_user/features/delegation/presentation/notifier/active_account_notifier.dart'; -import '../../base/core_robot.dart'; -import '../../utils/wait_for_condition.dart'; +import '../base/core_robot.dart'; +import '../utils/wait_for_condition.dart'; -/// Account lookup and switch-state waits shared by the web account switchers. +/// Account lookup and switch-state waits shared by the account switchers. mixin AccountSwitchRobotMixin on CoreRobot { ProviderContainer appContainer() { final element = $.tester.element(find.byType(MaterialApp)); diff --git a/integration_test/robots/account_switcher_assertion_robot.dart b/integration_test/robots/account_switcher_assertion_robot.dart new file mode 100644 index 000000000..2f61b3d18 --- /dev/null +++ b/integration_test/robots/account_switcher_assertion_robot.dart @@ -0,0 +1,118 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:get/get.dart'; +import 'package:tmail_ui_user/features/base/model/ui_keys.dart'; +import 'package:tmail_ui_user/features/delegation/presentation/notifier/active_account_notifier.dart'; +import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart'; +import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; +import 'package:tmail_ui_user/main/routes/route_utils.dart'; + +import '../base/core_robot.dart'; +import '../utils/wait_for_condition.dart'; +import 'abstract/abstract_account_switcher_assertion_robot.dart'; +import 'account_switch_robot_mixin.dart'; + +/// Switch state, menu, loading dialog and toast checks shared by every platform. +abstract class AccountSwitcherAssertionRobot extends CoreRobot + with AccountSwitchRobotMixin + implements AbstractAccountSwitcherAssertionRobot { + AccountSwitcherAssertionRobot(super.$); + + @override + Future expectMenuShowsDelegated(String ownerAddress) async { + await $(AppLocalizations().delegatedToYou).waitUntilVisible(); + await $(ownerAddress).waitUntilVisible(); + } + + @override + Future expectSwitcherOnMine() async { + await waitSwitchIdleOnMine(); + } + + @override + Future expectSwitchSettled(String ownerAddress) async { + await waitSwitchIdleOn(ownerAddress); + await expectLoadingDialogGone(); + FocusManager.instance.primaryFocus?.unfocus(); + await $.pumpAndTrySettle(); + } + + @override + Future expectShownIdentitiesInclude(String email) async { + await waitForCondition( + () => Get.find() + .listIdentities + .any((identity) => identity.email == email), + reason: 'dashboard identities include $email', + ); + } + + @override + Future expectUrlNamesShownAccount() async { + await waitForCondition( + () { + final active = appContainer().read(activeAccountProvider); + return active != null && + active.isDelegated && + _urlAccount() == active.accountId.id.value; + }, + reason: 'the location bar names the shown delegated account', + ); + } + + @override + Future expectUrlNamesNoAccount() async { + await waitForCondition( + () => _urlAccount() == null, + reason: 'the location bar names no account', + ); + } + + @override + Future expectUrlNamesOpenedFolder() async { + await waitForCondition( + () => Uri.base.queryParameters[RouteUtils.paramContext] != null, + reason: 'the location bar names the opened folder', + ); + } + + String? _urlAccount() => Uri.base.queryParameters[RouteUtils.paramAccount]; + + @override + Future expectLoadingDialogVisible(String ownerAddress) async { + await waitForCondition( + () async { + // Zero show-delay opens the dialog on the next frame after switchStarted. + await $.pump(); + return $(const ValueKey(UiKeys.accountSwitchLoadingDialog)) + .evaluate() + .isNotEmpty; + }, + reason: 'account switch loading dialog visible', + ); + // Owner is inside Text.rich spans. find.text(owner) does not match that. + await $(const ValueKey(UiKeys.accountSwitchLoadingCancel)) + .waitUntilVisible(); + expect( + find.descendant( + of: find.byKey(const ValueKey(UiKeys.accountSwitchLoadingDialog)), + matching: find.textContaining(ownerAddress, findRichText: true), + ), + findsOneWidget, + reason: 'loading dialog copy names $ownerAddress', + ); + } + + @override + Future expectLoadingDialogGone() => waitLoadingDialogGone(); + + @override + Future expectCouldNotOpenToast(String ownerAddress) async { + final message = + AppLocalizations().couldNotOpenOwnerMailbox(ownerAddress); + await waitForCondition( + () => $(message).evaluate().isNotEmpty, + reason: 'could not open mailbox toast visible', + ); + } +} diff --git a/integration_test/robots/account_switcher_robot.dart b/integration_test/robots/account_switcher_robot.dart new file mode 100644 index 000000000..b7096c6da --- /dev/null +++ b/integration_test/robots/account_switcher_robot.dart @@ -0,0 +1,90 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:linagora_design_flutter/linagora_design_flutter.dart'; +import 'package:patrol/patrol.dart'; +import 'package:tmail_ui_user/features/base/model/ui_keys.dart'; +import 'package:tmail_ui_user/features/delegation/presentation/notifier/account_switch_notifier.dart'; + +import '../base/core_robot.dart'; +import '../utils/wait_for_condition.dart'; +import 'abstract/abstract_account_switcher_assertion_robot.dart'; +import 'abstract/abstract_account_switcher_robot.dart'; +import 'account_switch_robot_mixin.dart'; + +/// Account menu rows and the switch loading dialog, shared by every platform. +abstract class AccountSwitcherRobot extends CoreRobot + with AccountSwitchRobotMixin + implements AbstractAccountSwitcherRobot { + @override + final AbstractAccountSwitcherAssertionRobot assertion; + + AccountSwitcherRobot(super.$, this.assertion); + + /// The open account menu. + PatrolFinder get menu; + + bool get isMenuOpen => menu.evaluate().isNotEmpty; + + Future _tapMenuItem( + String emailAddress, { + SettlePolicy? settlePolicy, + }) async { + final itemKey = LinagoraAccountMenu.itemKey(accountIdForAddress(emailAddress)); + final row = menu.$(itemKey); + if (settlePolicy == null) { + await row.tap(); + } else { + await row.tap(settlePolicy: settlePolicy); + } + } + + @override + Future selectByAddress(String emailAddress) async { + await openMenu(); + await selectAddressWhenMenuOpen(emailAddress); + } + + @override + Future selectAddressWhenMenuOpen(String emailAddress) async { + await _tapMenuItem(emailAddress); + await $.pumpAndTrySettle(); + } + + @override + Future selectByAddressAwaitingLoading(String emailAddress) async { + await openMenu(); + // Keep the switch in flight: trySettle would wait out showDelay + load and + // hide the loading dialog before the assertion runs. + await _tapMenuItem(emailAddress, settlePolicy: SettlePolicy.noSettle); + await assertion.expectLoadingDialogVisible(emailAddress); + } + + @override + Future tapCancelOnLoadingDialog() async { + await $( + const ValueKey(UiKeys.accountSwitchLoadingCancel), + ).tap(settlePolicy: SettlePolicy.noSettle); + await assertion.expectLoadingDialogGone(); + } + + @override + Future cancelInFlightSwitch() async { + await waitForCondition( + () => appContainer().read(accountSwitchProvider).isSwitching, + reason: 'account switch in flight', + ); + + final cancelButton = $( + const ValueKey(UiKeys.accountSwitchLoadingCancel), + ); + if (cancelButton.evaluate().isNotEmpty) { + await cancelButton.tap(settlePolicy: SettlePolicy.noSettle); + } else { + // Still inside SwitchLoadingDialogTiming.showDelay — same cancel as the + // dialog Cancel / Android back interceptor. + appContainer().read(accountSwitchProvider.notifier).cancel(); + await $.pump(); + } + await assertion.expectLoadingDialogGone(); + } +} diff --git a/integration_test/robots/composer_recipient_robot.dart b/integration_test/robots/composer_recipient_robot.dart index 8de5521d0..e8406448d 100644 --- a/integration_test/robots/composer_recipient_robot.dart +++ b/integration_test/robots/composer_recipient_robot.dart @@ -77,10 +77,9 @@ class ComposerRecipientRobot extends CoreRobot await _field(prefix).$(TextField).tap(); } + /// The expand chevron also reveals From on a narrow composer. @override - Future openFromField() async { - await $(Key('prefix_${PrefixEmailAddress.to.name}_recipient_from_button')).tap(); - } + Future openFromField() => openCcField(); @override Future openFirstRecipientMenu(PrefixEmailAddress prefix) async { diff --git a/integration_test/robots/mobile/mobile_account_switcher_assertion_robot.dart b/integration_test/robots/mobile/mobile_account_switcher_assertion_robot.dart new file mode 100644 index 000000000..1f836e0d1 --- /dev/null +++ b/integration_test/robots/mobile/mobile_account_switcher_assertion_robot.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:linagora_design_flutter/linagora_design_flutter.dart'; +import 'package:tmail_ui_user/features/base/model/ui_keys.dart'; + +import '../account_switcher_assertion_robot.dart'; + +/// Compact switcher of the thread app bar, which has no Viewing banner. +class MobileAccountSwitcherAssertionRobot + extends AccountSwitcherAssertionRobot { + MobileAccountSwitcherAssertionRobot(super.$); + + @override + Future expectSwitcherInactive() async { + await $.pumpAndTrySettle(); + // Thread app bar must be up so findsNothing is not vacuously true. + await $(const ValueKey(UiKeys.mobileMailboxMenuButton)).waitUntilVisible(); + expect(find.byKey(LinagoraAccountSwitcher.chipKey), findsNothing); + } + + @override + Future expectViewing(String ownerAddress) async { + await waitSwitchIdleOn(ownerAddress); + await $(LinagoraAccountSwitcher.chipKey).waitUntilVisible(); + } +} diff --git a/integration_test/robots/mobile/mobile_account_switcher_robot.dart b/integration_test/robots/mobile/mobile_account_switcher_robot.dart new file mode 100644 index 000000000..452c0a947 --- /dev/null +++ b/integration_test/robots/mobile/mobile_account_switcher_robot.dart @@ -0,0 +1,31 @@ +import 'package:linagora_design_flutter/linagora_design_flutter.dart'; +import 'package:model/extensions/session_extension.dart'; +import 'package:patrol/patrol.dart'; +import 'package:tmail_ui_user/features/delegation/presentation/notifier/active_account_notifier.dart'; + +import '../account_switcher_robot.dart'; +import 'mobile_account_switcher_assertion_robot.dart'; + +/// Compact switcher of the thread app bar. +class MobileAccountSwitcherRobot extends AccountSwitcherRobot { + MobileAccountSwitcherRobot(PatrolIntegrationTester $) + : super($, MobileAccountSwitcherAssertionRobot($)); + + @override + PatrolFinder get menu => $(LinagoraAccountSwitcher.menuKey); + + @override + Future openMenu() async { + if (isMenuOpen) return; + await $(LinagoraAccountSwitcher.chipKey).tap(); + await $.pumpAndTrySettle(); + } + + /// No Viewing banner on the compact switcher: picks `mine` in its menu. + @override + Future leaveDelegatedMailbox() async { + final session = appContainer().read(activeAccountProvider)?.session; + if (session == null) throw StateError('no active session to leave'); + await selectByAddress(session.getOwnEmailAddressOrEmpty()); + } +} diff --git a/integration_test/robots/web/web_account_switcher_assertion_robot.dart b/integration_test/robots/web/web_account_switcher_assertion_robot.dart index 9d968907b..0c112d3eb 100644 --- a/integration_test/robots/web/web_account_switcher_assertion_robot.dart +++ b/integration_test/robots/web/web_account_switcher_assertion_robot.dart @@ -1,20 +1,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:get/get.dart'; import 'package:tmail_ui_user/features/base/model/ui_keys.dart'; -import 'package:tmail_ui_user/features/delegation/presentation/notifier/active_account_notifier.dart'; -import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart'; import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; -import 'package:tmail_ui_user/main/routes/route_utils.dart'; -import '../../base/core_robot.dart'; -import '../../utils/wait_for_condition.dart'; -import '../abstract/abstract_account_switcher_assertion_robot.dart'; -import 'account_switch_robot_mixin.dart'; +import '../account_switcher_assertion_robot.dart'; -class WebAccountSwitcherAssertionRobot extends CoreRobot - with AccountSwitchRobotMixin - implements AbstractAccountSwitcherAssertionRobot { +/// Web stand-alone avatar menu and its Viewing banner. +class WebAccountSwitcherAssertionRobot extends AccountSwitcherAssertionRobot { WebAccountSwitcherAssertionRobot(super.$); @override @@ -38,102 +30,4 @@ class WebAccountSwitcherAssertionRobot extends CoreRobot await $(const ValueKey(UiKeys.viewingOwnerBanner)).waitUntilVisible(); await $(label).waitUntilVisible(); } - - @override - Future expectMenuShowsDelegated(String ownerAddress) async { - await $(AppLocalizations().delegatedToYou).waitUntilVisible(); - await $(ownerAddress).waitUntilVisible(); - } - - @override - Future expectSwitcherOnMine() async { - await waitSwitchIdleOnMine(); - } - - @override - Future expectSwitchSettled(String ownerAddress) async { - await waitSwitchIdleOn(ownerAddress); - await expectLoadingDialogGone(); - FocusManager.instance.primaryFocus?.unfocus(); - await $.pumpAndTrySettle(); - } - - @override - Future expectShownIdentitiesInclude(String email) async { - await waitForCondition( - () => Get.find() - .listIdentities - .any((identity) => identity.email == email), - reason: 'dashboard identities include $email', - ); - } - - @override - Future expectUrlNamesShownAccount() async { - await waitForCondition( - () { - final active = appContainer().read(activeAccountProvider); - return active != null && - active.isDelegated && - _urlAccount() == active.accountId.id.value; - }, - reason: 'the location bar names the shown delegated account', - ); - } - - @override - Future expectUrlNamesNoAccount() async { - await waitForCondition( - () => _urlAccount() == null, - reason: 'the location bar names no account', - ); - } - - @override - Future expectUrlNamesOpenedFolder() async { - await waitForCondition( - () => Uri.base.queryParameters[RouteUtils.paramContext] != null, - reason: 'the location bar names the opened folder', - ); - } - - String? _urlAccount() => Uri.base.queryParameters[RouteUtils.paramAccount]; - - @override - Future expectLoadingDialogVisible(String ownerAddress) async { - await waitForCondition( - () async { - // Zero show-delay opens the dialog on the next frame after switchStarted. - await $.pump(); - return $(const ValueKey(UiKeys.accountSwitchLoadingDialog)) - .evaluate() - .isNotEmpty; - }, - reason: 'account switch loading dialog visible', - ); - // Owner is inside Text.rich spans. find.text(owner) does not match that. - await $(const ValueKey(UiKeys.accountSwitchLoadingCancel)) - .waitUntilVisible(); - expect( - find.descendant( - of: find.byKey(const ValueKey(UiKeys.accountSwitchLoadingDialog)), - matching: find.textContaining(ownerAddress, findRichText: true), - ), - findsOneWidget, - reason: 'loading dialog copy names $ownerAddress', - ); - } - - @override - Future expectLoadingDialogGone() => waitLoadingDialogGone(); - - @override - Future expectCouldNotOpenToast(String ownerAddress) async { - final message = - AppLocalizations().couldNotOpenOwnerMailbox(ownerAddress); - await waitForCondition( - () => $(message).evaluate().isNotEmpty, - reason: 'could not open mailbox toast visible', - ); - } } diff --git a/integration_test/robots/web/web_account_switcher_robot.dart b/integration_test/robots/web/web_account_switcher_robot.dart index fc7eb19b9..7882c7b95 100644 --- a/integration_test/robots/web/web_account_switcher_robot.dart +++ b/integration_test/robots/web/web_account_switcher_robot.dart @@ -1,102 +1,28 @@ import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:linagora_design_flutter/linagora_design_flutter.dart'; import 'package:patrol/patrol.dart'; import 'package:tmail_ui_user/features/base/model/ui_keys.dart'; -import 'package:tmail_ui_user/features/delegation/presentation/notifier/account_switch_notifier.dart'; -import '../../base/core_robot.dart'; -import '../../utils/wait_for_condition.dart'; -import '../abstract/abstract_account_switcher_assertion_robot.dart'; -import '../abstract/abstract_account_switcher_robot.dart'; -import 'account_switch_robot_mixin.dart'; +import '../account_switcher_robot.dart'; import 'web_account_switcher_assertion_robot.dart'; /// Web stand-alone avatar menu. -class WebAccountSwitcherRobot extends CoreRobot - with AccountSwitchRobotMixin - implements AbstractAccountSwitcherRobot { +class WebAccountSwitcherRobot extends AccountSwitcherRobot { + WebAccountSwitcherRobot(PatrolIntegrationTester $) + : super($, WebAccountSwitcherAssertionRobot($)); + @override - final AbstractAccountSwitcherAssertionRobot assertion; - - WebAccountSwitcherRobot(super.$) - : assertion = WebAccountSwitcherAssertionRobot($); - - bool get _isMenuOpen => - $(const ValueKey(UiKeys.accountSwitcherMenu)).evaluate().isNotEmpty; - - Future _tapMenuItem( - String emailAddress, { - SettlePolicy? settlePolicy, - }) async { - final itemKey = LinagoraAccountMenu.itemKey(accountIdForAddress(emailAddress)); - final row = $(const ValueKey(UiKeys.accountSwitcherMenu)).$(itemKey); - if (settlePolicy == null) { - await row.tap(); - } else { - await row.tap(settlePolicy: settlePolicy); - } - } + PatrolFinder get menu => $(const ValueKey(UiKeys.accountSwitcherMenu)); @override Future openMenu() async { - if (_isMenuOpen) return; + if (isMenuOpen) return; await $(const ValueKey(UiKeys.userAvatar)).tap(); await $.pumpAndTrySettle(); } + /// Taps ✕ on the Viewing banner. @override - Future selectByAddress(String emailAddress) async { - await openMenu(); - await selectAddressWhenMenuOpen(emailAddress); - } - - @override - Future selectAddressWhenMenuOpen(String emailAddress) async { - await _tapMenuItem(emailAddress); - await $.pumpAndTrySettle(); - } - - @override - Future selectByAddressAwaitingLoading(String emailAddress) async { - await openMenu(); - // Keep the switch in flight: trySettle would wait out showDelay + load and - // hide the loading dialog before the assertion runs. - await _tapMenuItem(emailAddress, settlePolicy: SettlePolicy.noSettle); - await assertion.expectLoadingDialogVisible(emailAddress); - } - - @override - Future tapCancelOnLoadingDialog() async { - await $( - const ValueKey(UiKeys.accountSwitchLoadingCancel), - ).tap(settlePolicy: SettlePolicy.noSettle); - await assertion.expectLoadingDialogGone(); - } - - @override - Future cancelInFlightSwitch() async { - await waitForCondition( - () => appContainer().read(accountSwitchProvider).isSwitching, - reason: 'account switch in flight', - ); - - final cancelButton = $( - const ValueKey(UiKeys.accountSwitchLoadingCancel), - ); - if (cancelButton.evaluate().isNotEmpty) { - await cancelButton.tap(settlePolicy: SettlePolicy.noSettle); - } else { - // Still inside SwitchLoadingDialogTiming.showDelay — same cancel as the - // dialog Cancel / Android back interceptor. - appContainer().read(accountSwitchProvider.notifier).cancel(); - await $.pump(); - } - await assertion.expectLoadingDialogGone(); - } - - @override - Future dismissViewingBanner() async { + Future leaveDelegatedMailbox() async { await $(const ValueKey(UiKeys.viewingOwnerBannerDismiss)).tap(); await $.pumpAndTrySettle(); } diff --git a/integration_test/robots/web/web_composer_recipient_robot.dart b/integration_test/robots/web/web_composer_recipient_robot.dart index aa7790134..f21c035f4 100644 --- a/integration_test/robots/web/web_composer_recipient_robot.dart +++ b/integration_test/robots/web/web_composer_recipient_robot.dart @@ -13,4 +13,9 @@ class WebComposerRecipientRobot extends ComposerRecipientRobot { // of the expand chevron. await $(Key('prefix_${PrefixEmailAddress.to.name}${UiKeys.recipientCcButtonSuffix}')).tap(); } + + @override + Future openFromField() async { + await $(Key('prefix_${PrefixEmailAddress.to.name}_recipient_from_button')).tap(); + } } diff --git a/integration_test/robots/web/web_workplace_account_switcher_assertion_robot.dart b/integration_test/robots/web/web_workplace_account_switcher_assertion_robot.dart index e3808bae8..19e6deb14 100644 --- a/integration_test/robots/web/web_workplace_account_switcher_assertion_robot.dart +++ b/integration_test/robots/web/web_workplace_account_switcher_assertion_robot.dart @@ -6,7 +6,7 @@ import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; import '../../base/core_robot.dart'; import '../abstract/abstract_workplace_account_switcher_assertion_robot.dart'; -import 'account_switch_robot_mixin.dart'; +import '../account_switch_robot_mixin.dart'; class WebWorkplaceAccountSwitcherAssertionRobot extends CoreRobot with AccountSwitchRobotMixin diff --git a/integration_test/robots/web/web_workplace_account_switcher_robot.dart b/integration_test/robots/web/web_workplace_account_switcher_robot.dart index f77af372b..73c1aa09c 100644 --- a/integration_test/robots/web/web_workplace_account_switcher_robot.dart +++ b/integration_test/robots/web/web_workplace_account_switcher_robot.dart @@ -4,7 +4,7 @@ import 'package:linagora_design_flutter/linagora_design_flutter.dart'; import '../../base/core_robot.dart'; import '../abstract/abstract_workplace_account_switcher_assertion_robot.dart'; import '../abstract/abstract_workplace_account_switcher_robot.dart'; -import 'account_switch_robot_mixin.dart'; +import '../account_switch_robot_mixin.dart'; import 'web_workplace_account_switcher_assertion_robot.dart'; /// Web Workplace account-switcher chip (#4977 §8). diff --git a/integration_test/scenarios/delegation/switch_back_to_mine_via_avatar_menu_standalone_scenario.dart b/integration_test/scenarios/delegation/switch_back_to_mine_via_avatar_menu_standalone_scenario.dart index 93448e0ad..46ca7650d 100644 --- a/integration_test/scenarios/delegation/switch_back_to_mine_via_avatar_menu_standalone_scenario.dart +++ b/integration_test/scenarios/delegation/switch_back_to_mine_via_avatar_menu_standalone_scenario.dart @@ -1,7 +1,7 @@ import '../../base/base_test_scenario.dart'; import '../../mixin/delegation_standalone_scenario_mixin.dart'; -/// Switch to owner, then return to mine via the avatar menu (not Viewing ✕). +/// Switch to owner, then return to mine via the switcher menu (not Viewing ✕). class SwitchBackToMineViaAvatarMenuStandaloneScenario extends BaseTestScenario with DelegationStandaloneScenarioMixin { const SwitchBackToMineViaAvatarMenuStandaloneScenario(super.$, super.robots); diff --git a/integration_test/scenarios/delegation/switch_delegated_mailbox_failure_toast_standalone_scenario.dart b/integration_test/scenarios/delegation/switch_delegated_mailbox_failure_toast_standalone_scenario.dart index 4a24317a9..e01a520af 100644 --- a/integration_test/scenarios/delegation/switch_delegated_mailbox_failure_toast_standalone_scenario.dart +++ b/integration_test/scenarios/delegation/switch_delegated_mailbox_failure_toast_standalone_scenario.dart @@ -3,11 +3,11 @@ import '../../mixin/delegation_standalone_scenario_mixin.dart'; /// Cancel mid-switch → "Couldn't open [Owner]'s mailbox" toast. /// -/// Server-side failure is hard to force in Patrol web. Cancelling an in-flight +/// Server-side failure is hard to force in Patrol. Cancelling an in-flight /// switch yields [AccountSwitchCancelled], which uses the same toast copy as /// failed / timed-out opens (unit-tested in account_switch_failure_toast_test). /// -/// Patrol web scripts set `ACCOUNT_SWITCH_LOADING_SHOW_DELAY_MS=0` so the +/// Patrol scripts set `ACCOUNT_SWITCH_LOADING_SHOW_DELAY_MS=0` so the /// dialog appears even when local James finishes the load quickly. class SwitchDelegatedMailboxFailureToastStandaloneScenario extends BaseTestScenario with DelegationStandaloneScenarioMixin { diff --git a/integration_test/scenarios/delegation/switch_delegated_mailbox_standalone_scenario.dart b/integration_test/scenarios/delegation/switch_delegated_mailbox_standalone_scenario.dart index 1d6bd0b93..05a329812 100644 --- a/integration_test/scenarios/delegation/switch_delegated_mailbox_standalone_scenario.dart +++ b/integration_test/scenarios/delegation/switch_delegated_mailbox_standalone_scenario.dart @@ -1,7 +1,7 @@ import '../../base/base_test_scenario.dart'; import '../../mixin/delegation_standalone_scenario_mixin.dart'; -/// Bob has alice's mailbox delegated (reset-server seed). Stand-alone web only. +/// Bob has alice's mailbox delegated (reset-server seed). Stand-alone web and the Android and iOS app. class SwitchDelegatedMailboxStandaloneScenario extends BaseTestScenario with DelegationStandaloneScenarioMixin { const SwitchDelegatedMailboxStandaloneScenario(super.$, super.robots); @@ -36,9 +36,9 @@ class SwitchDelegatedMailboxStandaloneScenario extends BaseTestScenario DelegationStandaloneScenarioMixin.ownerAddress, ); await composer.tapCloseComposer(); - await $.pumpAndTrySettle(); + await composer.expectComposerClosedDiscardingChanges(); - await switcher.dismissViewingBanner(); + await switcher.leaveDelegatedMailbox(); await switcher.assertion.expectSwitcherOnMine(); } } diff --git a/integration_test/scenarios/delegation/web_url_names_shown_delegated_account_scenario.dart b/integration_test/scenarios/delegation/web_url_names_shown_delegated_account_scenario.dart index 88266a8ec..a3a7cc70c 100644 --- a/integration_test/scenarios/delegation/web_url_names_shown_delegated_account_scenario.dart +++ b/integration_test/scenarios/delegation/web_url_names_shown_delegated_account_scenario.dart @@ -25,7 +25,7 @@ class WebUrlNamesShownDelegatedAccountScenario extends BaseTestScenario await switcher.assertion.expectUrlNamesOpenedFolder(); await switcher.assertion.expectUrlNamesShownAccount(); - await switcher.dismissViewingBanner(); + await switcher.leaveDelegatedMailbox(); await switcher.assertion.expectSwitcherOnMine(); await switcher.assertion.expectUrlNamesNoAccount(); } diff --git a/integration_test/tests/delegation/switch_back_to_mine_via_avatar_menu_standalone_test.dart b/integration_test/tests/delegation/switch_back_to_mine_via_avatar_menu_standalone_test.dart index 493725e02..1a52b57eb 100644 --- a/integration_test/tests/delegation/switch_back_to_mine_via_avatar_menu_standalone_test.dart +++ b/integration_test/tests/delegation/switch_back_to_mine_via_avatar_menu_standalone_test.dart @@ -8,6 +8,6 @@ void main() { 'Should switch back to mine from the avatar menu while Viewing a delegated mailbox', scenarioBuilder: ($, robots) => SwitchBackToMineViaAvatarMenuStandaloneScenario($, robots), - tags: [TestTags.web], + tags: [TestTags.android, TestTags.ios, TestTags.web], ); } \ No newline at end of file diff --git a/integration_test/tests/delegation/switch_delegated_mailbox_failure_toast_standalone_test.dart b/integration_test/tests/delegation/switch_delegated_mailbox_failure_toast_standalone_test.dart index 888090464..561c8fb35 100644 --- a/integration_test/tests/delegation/switch_delegated_mailbox_failure_toast_standalone_test.dart +++ b/integration_test/tests/delegation/switch_delegated_mailbox_failure_toast_standalone_test.dart @@ -8,6 +8,6 @@ void main() { "Should toast Couldn't open owner's mailbox when the switch is cancelled", scenarioBuilder: ($, robots) => SwitchDelegatedMailboxFailureToastStandaloneScenario($, robots), - tags: [TestTags.web], + tags: [TestTags.android, TestTags.ios, TestTags.web], ); } diff --git a/integration_test/tests/delegation/switch_delegated_mailbox_loading_dialog_standalone_test.dart b/integration_test/tests/delegation/switch_delegated_mailbox_loading_dialog_standalone_test.dart index 0335a95a6..1381651f5 100644 --- a/integration_test/tests/delegation/switch_delegated_mailbox_loading_dialog_standalone_test.dart +++ b/integration_test/tests/delegation/switch_delegated_mailbox_loading_dialog_standalone_test.dart @@ -8,6 +8,6 @@ void main() { 'Should show the account-switch loading dialog while opening a delegated mailbox', scenarioBuilder: ($, robots) => SwitchDelegatedMailboxLoadingDialogStandaloneScenario($, robots), - tags: [TestTags.web], + tags: [TestTags.android, TestTags.ios, TestTags.web], ); } diff --git a/integration_test/tests/delegation/switch_delegated_mailbox_standalone_test.dart b/integration_test/tests/delegation/switch_delegated_mailbox_standalone_test.dart index 49995ddf6..dc2d41c7c 100644 --- a/integration_test/tests/delegation/switch_delegated_mailbox_standalone_test.dart +++ b/integration_test/tests/delegation/switch_delegated_mailbox_standalone_test.dart @@ -8,6 +8,6 @@ void main() { 'Should switch to a delegated mailbox from the stand-alone avatar menu', scenarioBuilder: ($, robots) => SwitchDelegatedMailboxStandaloneScenario($, robots), - tags: [TestTags.web], + tags: [TestTags.android, TestTags.ios, TestTags.web], ); } diff --git a/scripts/patrol-integration-test-with-docker.sh b/scripts/patrol-integration-test-with-docker.sh index 3dc6e3438..aa87f6005 100755 --- a/scripts/patrol-integration-test-with-docker.sh +++ b/scripts/patrol-integration-test-with-docker.sh @@ -152,7 +152,8 @@ set -m --dart-define=ADDITIONAL_MAIL_RECIPIENT="$ALICE@$DOMAIN" \ --dart-define=BASIC_AUTH_EMAIL="$BOB@$DOMAIN" \ --dart-define=BASIC_AUTH_URL="$BASIC_AUTH_URL" \ - --dart-define=RESET_SERVER_URL="$BORE_RESET_URL" 2>&1 | tee "$CI_LOGS/patrol-build.log" | perl scripts/ci-console-filter.pl "ci-logs/patrol-build.log" + --dart-define=RESET_SERVER_URL="$BORE_RESET_URL" \ + --dart-define=ACCOUNT_SWITCH_LOADING_SHOW_DELAY_MS=0 2>&1 | tee "$CI_LOGS/patrol-build.log" | perl scripts/ci-console-filter.pl "ci-logs/patrol-build.log" timing "Patrol/Gradle build end ($(( SECONDS - build_started ))s)" ) & PATROL_BUILD_PID=$! diff --git a/scripts/patrol-local-integration-test-with-docker.sh b/scripts/patrol-local-integration-test-with-docker.sh index a8987de77..a9d580a48 100755 --- a/scripts/patrol-local-integration-test-with-docker.sh +++ b/scripts/patrol-local-integration-test-with-docker.sh @@ -64,4 +64,5 @@ patrol test \ --dart-define=ADDITIONAL_MAIL_RECIPIENT="$ALICE@$DOMAIN" \ --dart-define=BASIC_AUTH_EMAIL="$BOB@$DOMAIN" \ --dart-define=BASIC_AUTH_URL="$BASIC_AUTH_URL" \ - --dart-define=RESET_SERVER_URL="http://10.0.2.2:$RESET_PORT" \ No newline at end of file + --dart-define=RESET_SERVER_URL="http://10.0.2.2:$RESET_PORT" \ + --dart-define=ACCOUNT_SWITCH_LOADING_SHOW_DELAY_MS=0 \ No newline at end of file