TF-4056 Add E2E for persist filter when change search input text
This commit is contained in:
@@ -85,4 +85,14 @@ class SearchRobot extends CoreRobot {
|
||||
Future<void> tapBackButton() async {
|
||||
await $(#search_email_back_button).tap();
|
||||
}
|
||||
|
||||
Future<void> selectAttachmentFilter() async {
|
||||
await $.scrollUntilVisible(
|
||||
finder: $(#mobile_hasAttachment_search_filter_button),
|
||||
view: $(#search_filter_list_view),
|
||||
scrollDirection: AxisDirection.right,
|
||||
delta: 50,
|
||||
);
|
||||
await $(#mobile_hasAttachment_search_filter_button).tap();
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/search_filters/search_filter_button.dart';
|
||||
|
||||
import '../../base/base_test_scenario.dart';
|
||||
import '../../models/provisioning_email.dart';
|
||||
import '../../robots/search_robot.dart';
|
||||
import '../../robots/thread_robot.dart';
|
||||
|
||||
class PersistFilterWhenChangeSearchInputTextScenario
|
||||
extends BaseTestScenario {
|
||||
const PersistFilterWhenChangeSearchInputTextScenario(super.$);
|
||||
|
||||
@override
|
||||
Future<void> runTestLogic() async {
|
||||
const email = String.fromEnvironment('BASIC_AUTH_EMAIL');
|
||||
const subject = 'Persist search filter';
|
||||
const queryStringFirst = 'Persist';
|
||||
const queryStringSecond = 'Persist search';
|
||||
|
||||
final threadRobot = ThreadRobot($);
|
||||
final searchRobot = SearchRobot($);
|
||||
|
||||
final file = await preparingTxtFile('attachment');
|
||||
await provisionEmail(
|
||||
[
|
||||
ProvisioningEmail(
|
||||
toEmail: email,
|
||||
subject: subject,
|
||||
content: subject,
|
||||
attachmentPaths: [file.path],
|
||||
),
|
||||
],
|
||||
requestReadReceipt: false,
|
||||
);
|
||||
await $.pumpAndSettle();
|
||||
|
||||
await threadRobot.tapOnSearchField();
|
||||
await searchRobot.enterKeyword(queryStringFirst);
|
||||
await searchRobot.tapOnShowAllResultsText();
|
||||
await _expectEmailWithSubjectVisible(subject);
|
||||
|
||||
await searchRobot.selectAttachmentFilter();
|
||||
await _expectEmailWithSubjectVisible(subject);
|
||||
_expectAttachmentFilterSelected();
|
||||
|
||||
await searchRobot.enterKeyword(queryStringSecond);
|
||||
await _expectEmailWithSubjectVisible(subject);
|
||||
_expectAttachmentFilterSelected();
|
||||
}
|
||||
|
||||
Future<void> _expectEmailWithSubjectVisible(String subject) async {
|
||||
await expectViewVisible($(find.text(subject)));
|
||||
}
|
||||
|
||||
void _expectAttachmentFilterSelected() {
|
||||
expect(
|
||||
$(#mobile_hasAttachment_search_filter_button)
|
||||
.which<SearchFilterButton>((widget) => widget.isSelected)
|
||||
.visible,
|
||||
true,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import '../../base/test_base.dart';
|
||||
import '../../scenarios/search/persist_filter_when_change_search_input_text_scenario.dart';
|
||||
|
||||
void main() {
|
||||
TestBase().runPatrolTest(
|
||||
description: 'Should see the same email when selecting filter and changing search input text',
|
||||
scenarioBuilder: ($) => PersistFilterWhenChangeSearchInputTextScenario($),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user