diff --git a/integration_test/robots/thread_robot.dart b/integration_test/robots/thread_robot.dart index f3d1f7045..3db41e9fe 100644 --- a/integration_test/robots/thread_robot.dart +++ b/integration_test/robots/thread_robot.dart @@ -51,4 +51,20 @@ class ThreadRobot extends CoreRobot { await $(ScrollToTopButtonWidget).$(InkWell).tap(); await $.pumpAndSettle(); } + + Future openQuickFilter() async { + await $(#mobile_filter_message_button).tap(); + } + + Future selectAttachmentFilter() async { + await $(#filter_email_attachments).tap(); + } + + Future selectUnreadFilter() async { + await $(#filter_email_unread).tap(); + } + + Future selectStarredFilter() async { + await $(#filter_email_starred).tap(); + } } \ No newline at end of file diff --git a/integration_test/scenarios/mailbox/quick_filter_scenario.dart b/integration_test/scenarios/mailbox/quick_filter_scenario.dart new file mode 100644 index 000000000..a480480ea --- /dev/null +++ b/integration_test/scenarios/mailbox/quick_filter_scenario.dart @@ -0,0 +1,79 @@ +import 'package:flutter_test/flutter_test.dart'; + +import '../../base/base_test_scenario.dart'; +import '../../models/provisioning_email.dart'; +import '../../robots/thread_robot.dart'; + +class QuickFilterScenario extends BaseTestScenario { + const QuickFilterScenario(super.$); + + @override + Future runTestLogic() async { + const email = String.fromEnvironment('BASIC_AUTH_EMAIL'); + final unreadEmail = ProvisioningEmail( + toEmail: email, + subject: 'quick filter unread email', + content: '', + ); + final readEmail = ProvisioningEmail( + toEmail: email, + subject: 'quick filter read email', + content: '', + ); + final starredEmail = ProvisioningEmail( + toEmail: email, + subject: 'quick filter starred email', + content: '', + ); + final file = await preparingTxtFile('some content'); + final attachmentEmail = ProvisioningEmail( + toEmail: email, + subject: 'quick filter attachment email', + content: '', + attachmentPaths: [file.path], + ); + + final threadRobot = ThreadRobot($); + + await provisionEmail([ + unreadEmail, + readEmail, + starredEmail, + attachmentEmail, + ]); + await $.pumpAndSettle(); + + await simulateUpdateFlagsOfEmailsWithSubjectsFromOutsideCurrentClient( + subjects: ['quick filter read email'], + isRead: true, + ); + await simulateUpdateFlagsOfEmailsWithSubjectsFromOutsideCurrentClient( + subjects: ['quick filter starred email'], + isStar: true, + ); + + await threadRobot.openQuickFilter(); + await threadRobot.selectAttachmentFilter(); + await _expectEmailWithAttachmentVisible(); + + await threadRobot.openQuickFilter(); + await threadRobot.selectUnreadFilter(); + await _expectUnreadEmailVisible(); + + await threadRobot.openQuickFilter(); + await threadRobot.selectStarredFilter(); + await _expectStarredEmailVisible(); + } + + Future _expectEmailWithAttachmentVisible() async { + await expectViewVisible($('quick filter attachment email')); + } + + Future _expectUnreadEmailVisible() async { + await expectViewVisible($('quick filter unread email')); + } + + Future _expectStarredEmailVisible() async { + await expectViewVisible($('quick filter starred email')); + } +} \ No newline at end of file diff --git a/integration_test/tests/mailbox/quick_filter_test.dart b/integration_test/tests/mailbox/quick_filter_test.dart new file mode 100644 index 000000000..4718cf991 --- /dev/null +++ b/integration_test/tests/mailbox/quick_filter_test.dart @@ -0,0 +1,10 @@ +import '../../base/test_base.dart'; +import '../../scenarios/mailbox/quick_filter_scenario.dart'; + +void main() { + TestBase().runPatrolTest( + description: 'Should see email with expected condition ' + 'when quick filter email changed', + scenarioBuilder: ($) => QuickFilterScenario($), + ); +} \ No newline at end of file