TF-3558 E2E Mailbox pull to refresh
This commit is contained in:
@@ -67,4 +67,14 @@ class ThreadRobot extends CoreRobot {
|
||||
Future<void> selectStarredFilter() async {
|
||||
await $(#starred_filter).tap();
|
||||
}
|
||||
|
||||
Future<void> pullToRefreshByEmailSubject(String subject) async {
|
||||
await $(subject).waitUntilVisible();
|
||||
await $.tester.fling(
|
||||
$(subject),
|
||||
const Offset(0, 300),
|
||||
1000,
|
||||
);
|
||||
await $.pumpAndSettle();
|
||||
}
|
||||
}
|
||||
@@ -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<void> 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);
|
||||
}
|
||||
}
|
||||
@@ -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($),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user