TF-3570 Add integration test for case mark as star/unStar in EmailView
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -40,4 +40,8 @@ class EmailRobot extends CoreRobot {
|
|||||||
Future<void> tapMarkAsUnreadOptionInContextMenu() async {
|
Future<void> tapMarkAsUnreadOptionInContextMenu() async {
|
||||||
await $(#markAsUnread_action).tap();
|
await $(#markAsUnread_action).tap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> tapEmailDetailedStarButton() async {
|
||||||
|
await $(#email_detailed_star_button).tap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
|
||||||
|
import 'package:core/presentation/resources/image_paths.dart';
|
||||||
|
import 'package:core/presentation/views/button/tmail_button_widget.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
import '../../base/base_test_scenario.dart';
|
||||||
|
import '../../models/provisioning_email.dart';
|
||||||
|
import '../../robots/email_robot.dart';
|
||||||
|
import '../../robots/thread_robot.dart';
|
||||||
|
|
||||||
|
class MarkAsStarEmailScenario extends BaseTestScenario {
|
||||||
|
|
||||||
|
const MarkAsStarEmailScenario(super.$);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> runTestLogic() async {
|
||||||
|
const subject = 'Mark as star/unStar email';
|
||||||
|
const emailUser = String.fromEnvironment('BASIC_AUTH_EMAIL');
|
||||||
|
final threadRobot = ThreadRobot($);
|
||||||
|
final emailRobot = EmailRobot($);
|
||||||
|
final imagePaths = ImagePaths();
|
||||||
|
|
||||||
|
await provisionEmail(
|
||||||
|
[
|
||||||
|
ProvisioningEmail(
|
||||||
|
toEmail: emailUser,
|
||||||
|
subject: subject,
|
||||||
|
content: subject,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
requestReadReceipt: false,
|
||||||
|
);
|
||||||
|
await $.pumpAndSettle();
|
||||||
|
|
||||||
|
await threadRobot.openEmailWithSubject(subject);
|
||||||
|
await $.pumpAndSettle();
|
||||||
|
_expectEmailDetailedStarButtonVisible();
|
||||||
|
|
||||||
|
await emailRobot.tapEmailDetailedStarButton();
|
||||||
|
await $.pumpAndSettle(duration: const Duration(seconds: 2));
|
||||||
|
await _expectDisplayedStarIcon(imagePaths);
|
||||||
|
|
||||||
|
await emailRobot.tapEmailDetailedStarButton();
|
||||||
|
await $.pumpAndSettle(duration: const Duration(seconds: 2));
|
||||||
|
await _expectDisplayedUnStarIcon(imagePaths);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _expectEmailDetailedStarButtonVisible() {
|
||||||
|
expect($(#email_detailed_star_button), findsOneWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectDisplayedStarIcon(ImagePaths imagePaths) async {
|
||||||
|
await expectViewVisible(
|
||||||
|
$(#email_detailed_star_button).which<TMailButtonWidget>(
|
||||||
|
(widget) => widget.icon == imagePaths.icStar),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectDisplayedUnStarIcon(ImagePaths imagePaths) async {
|
||||||
|
await expectViewVisible(
|
||||||
|
$(#email_detailed_star_button).which<TMailButtonWidget>(
|
||||||
|
(widget) => widget.icon == imagePaths.icUnStar),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
import '../../base/test_base.dart';
|
||||||
|
import '../../scenarios/email_detailed/mark_as_star_email_scenario.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
TestBase().runPatrolTest(
|
||||||
|
description: 'Should see star and unStar icon when open detailed email and mark as star and unStar email successfully',
|
||||||
|
scenarioBuilder: ($) => MarkAsStarEmailScenario($),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -176,6 +176,7 @@ class EmailViewAppBarWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Widget _getMarkStarButton(AppLocalizations applocalizations) => TMailButtonWidget.fromIcon(
|
Widget _getMarkStarButton(AppLocalizations applocalizations) => TMailButtonWidget.fromIcon(
|
||||||
|
key: const Key('email_detailed_star_button'),
|
||||||
icon: presentationEmail.hasStarred
|
icon: presentationEmail.hasStarred
|
||||||
? _imagePaths.icStar
|
? _imagePaths.icStar
|
||||||
: _imagePaths.icUnStar,
|
: _imagePaths.icUnStar,
|
||||||
|
|||||||
Reference in New Issue
Block a user