diff --git a/integration_test/robots/thread_robot.dart b/integration_test/robots/thread_robot.dart index 121eded02..35aa2038e 100644 --- a/integration_test/robots/thread_robot.dart +++ b/integration_test/robots/thread_robot.dart @@ -67,4 +67,14 @@ class ThreadRobot extends CoreRobot { Future selectStarredFilter() async { await $(#starred_filter).tap(); } + + Future pullToRefreshByEmailSubject(String subject) async { + await $(subject).waitUntilVisible(); + await $.tester.fling( + $(subject), + const Offset(0, 300), + 1000, + ); + await $.pumpAndSettle(); + } } \ No newline at end of file diff --git a/integration_test/scenarios/mailbox/pull_to_refresh_scenario.dart b/integration_test/scenarios/mailbox/pull_to_refresh_scenario.dart new file mode 100644 index 000000000..0a9fd8a55 --- /dev/null +++ b/integration_test/scenarios/mailbox/pull_to_refresh_scenario.dart @@ -0,0 +1,50 @@ +import 'package:flutter_test/flutter_test.dart'; + +import '../../base/base_test_scenario.dart'; +import '../../models/provisioning_email.dart'; +import '../../robots/thread_robot.dart'; + +class PullToRefreshScenario extends BaseTestScenario { + const PullToRefreshScenario(super.$); + + @override + Future runTestLogic() async { + const toEmail = String.fromEnvironment('BASIC_AUTH_EMAIL'); + const visibleBeforePullToRefresh = 'before pull to refresh'; + const visibleAfterPullToRefresh = 'after pull to refresh'; + + final threadRobot = ThreadRobot($); + + await provisionEmail( + [ProvisioningEmail( + toEmail: toEmail, + subject: visibleBeforePullToRefresh, + content: '', + )], + ); + await $.pumpAndSettle(); + _expectEmailWithSubjectVisible(visibleBeforePullToRefresh); + + await provisionEmail( + [ProvisioningEmail( + toEmail: toEmail, + subject: visibleAfterPullToRefresh, + content: '', + )], + refreshEmailView: false, + ); + await $.pumpAndSettle(); + _expectEmailWithSubjectInvisible(visibleAfterPullToRefresh); + + await threadRobot.pullToRefreshByEmailSubject(visibleBeforePullToRefresh); + _expectEmailWithSubjectVisible(visibleAfterPullToRefresh); + } + + _expectEmailWithSubjectVisible(String subject) { + expect($(subject), findsOneWidget); + } + + _expectEmailWithSubjectInvisible(String subject) { + expect($(subject), findsNothing); + } +} \ No newline at end of file diff --git a/integration_test/tests/mailbox/pull_to_refresh_test.dart b/integration_test/tests/mailbox/pull_to_refresh_test.dart new file mode 100644 index 000000000..77aa13624 --- /dev/null +++ b/integration_test/tests/mailbox/pull_to_refresh_test.dart @@ -0,0 +1,9 @@ +import '../../base/test_base.dart'; +import '../../scenarios/mailbox/pull_to_refresh_scenario.dart'; + +void main() { + TestBase().runPatrolTest( + description: 'Should refresh email list when pull to refresh', + scenarioBuilder: ($) => PullToRefreshScenario($), + ); +} \ No newline at end of file