TF-3551 E2E Mailbox scroll and back to top
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter_test/flutter_test.dart';
|
|||||||
import 'package:tmail_ui_user/features/base/widget/compose_floating_button.dart';
|
import 'package:tmail_ui_user/features/base/widget/compose_floating_button.dart';
|
||||||
import 'package:tmail_ui_user/features/thread/presentation/thread_view.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/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 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
import '../base/core_robot.dart';
|
import '../base/core_robot.dart';
|
||||||
@@ -40,4 +41,14 @@ class ThreadRobot extends CoreRobot {
|
|||||||
Future<void> tapDeleteAllButtonOnEmptyTrashConfirmDialog(
|
Future<void> tapDeleteAllButtonOnEmptyTrashConfirmDialog(
|
||||||
AppLocalizations appLocalizations,
|
AppLocalizations appLocalizations,
|
||||||
) => $(appLocalizations.delete_all).tap();
|
) => $(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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:tmail_ui_user/features/thread/presentation/widgets/scroll_to_top_button_widget.dart';
|
||||||
|
|
||||||
|
import '../../base/base_test_scenario.dart';
|
||||||
|
import '../../models/provisioning_email.dart';
|
||||||
|
import '../../robots/thread_robot.dart';
|
||||||
|
|
||||||
|
class ScrollListEmailInMailboxAndBackToTopScenario extends BaseTestScenario {
|
||||||
|
const ScrollListEmailInMailboxAndBackToTopScenario(super.$);
|
||||||
|
|
||||||
|
String _getSubjectWithIndex(int emailIndex) => 'scroll email subject $emailIndex';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> runTestLogic() async {
|
||||||
|
const email = String.fromEnvironment('BASIC_AUTH_EMAIL');
|
||||||
|
const totalEmails = 15;
|
||||||
|
const bottomEmailSubject = 'scroll email subject bottom';
|
||||||
|
|
||||||
|
final threadRobot = ThreadRobot($);
|
||||||
|
|
||||||
|
await provisionEmail([ProvisioningEmail(
|
||||||
|
toEmail: email,
|
||||||
|
subject: bottomEmailSubject,
|
||||||
|
content: '',
|
||||||
|
)]);
|
||||||
|
await $.pumpAndSettle(duration: const Duration(seconds: 2));
|
||||||
|
await provisionEmail(List.generate(
|
||||||
|
totalEmails,
|
||||||
|
(index) => ProvisioningEmail(
|
||||||
|
toEmail: email,
|
||||||
|
subject: _getSubjectWithIndex(index),
|
||||||
|
content: '$index',
|
||||||
|
),
|
||||||
|
));
|
||||||
|
await $.pumpAndSettle(duration: const Duration(seconds: 2));
|
||||||
|
|
||||||
|
await threadRobot.scrollToEmailWithSubject(bottomEmailSubject);
|
||||||
|
await _expectScrollToTopButtonVisible();
|
||||||
|
|
||||||
|
await threadRobot.scrollToTop();
|
||||||
|
await _expectScrollToTopButtonInvisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
_expectScrollToTopButtonVisible() {
|
||||||
|
expect($(ScrollToTopButtonWidget), findsOneWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectScrollToTopButtonInvisible() async {
|
||||||
|
expect($(ScrollToTopButtonWidget).visible, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import '../../base/test_base.dart';
|
||||||
|
import '../../scenarios/mailbox/scroll_list_email_in_mailbox_and_back_to_top_scenario.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
TestBase().runPatrolTest(
|
||||||
|
description: 'Should see back to top button when scroll list email in mailbox to bottom '
|
||||||
|
'and not see back to top button when scroll list email to top',
|
||||||
|
scenarioBuilder: ($) => ScrollListEmailInMailboxAndBackToTopScenario($),
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user