Skip to content

Commit a47a7c4

Browse files
TF-3558 E2E Mailbox pull to refresh
1 parent 86fa566 commit a47a7c4

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

integration_test/robots/thread_robot.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,14 @@ class ThreadRobot extends CoreRobot {
3333
Future<void> openMailbox() async {
3434
await $(#mobile_mailbox_menu_button).tap();
3535
}
36+
37+
Future<void> pullToRefreshByEmailSubject(String subject) async {
38+
await $(subject).waitUntilVisible();
39+
await $.tester.fling(
40+
$(subject),
41+
const Offset(0, 300),
42+
1000,
43+
);
44+
await $.pumpAndSettle();
45+
}
3646
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import 'package:flutter_test/flutter_test.dart';
2+
3+
import '../../base/base_test_scenario.dart';
4+
import '../../models/provisioning_email.dart';
5+
import '../../robots/thread_robot.dart';
6+
7+
class PullToRefreshScenario extends BaseTestScenario {
8+
const PullToRefreshScenario(super.$);
9+
10+
@override
11+
Future<void> runTestLogic() async {
12+
const toEmail = String.fromEnvironment('BASIC_AUTH_EMAIL');
13+
const visibleBeforePullToRefresh = 'before pull to refresh';
14+
const visibleAfterPullToRefresh = 'after pull to refresh';
15+
16+
final threadRobot = ThreadRobot($);
17+
18+
await provisionEmail(
19+
[ProvisioningEmail(
20+
toEmail: toEmail,
21+
subject: visibleBeforePullToRefresh,
22+
content: '',
23+
)],
24+
);
25+
await $.pumpAndSettle();
26+
_expectEmailWithSubjectVisible(visibleBeforePullToRefresh);
27+
28+
await provisionEmail(
29+
[ProvisioningEmail(
30+
toEmail: toEmail,
31+
subject: visibleAfterPullToRefresh,
32+
content: '',
33+
)],
34+
refreshEmailView: false,
35+
);
36+
await $.pumpAndSettle();
37+
_expectEmailWithSubjectInvisible(visibleAfterPullToRefresh);
38+
39+
await threadRobot.pullToRefreshByEmailSubject(visibleBeforePullToRefresh);
40+
_expectEmailWithSubjectVisible(visibleAfterPullToRefresh);
41+
}
42+
43+
_expectEmailWithSubjectVisible(String subject) {
44+
expect($(subject), findsOneWidget);
45+
}
46+
47+
_expectEmailWithSubjectInvisible(String subject) {
48+
expect($(subject), findsNothing);
49+
}
50+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import '../../base/test_base.dart';
2+
import '../../scenarios/mailbox/pull_to_refresh_scenario.dart';
3+
4+
void main() {
5+
TestBase().runPatrolTest(
6+
description: 'Should refresh email list when pull to refresh',
7+
scenarioBuilder: ($) => PullToRefreshScenario($),
8+
);
9+
}

0 commit comments

Comments
 (0)