HOTFIX Integration test 0.24.8 (#4298)
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
import '../base/base_test_scenario.dart';
|
||||
import '../robots/composer_robot.dart';
|
||||
import '../robots/mailbox_menu_robot.dart';
|
||||
import '../robots/thread_robot.dart';
|
||||
|
||||
class SaveAsTemplateScenario extends BaseTestScenario {
|
||||
@@ -10,37 +12,40 @@ class SaveAsTemplateScenario extends BaseTestScenario {
|
||||
|
||||
@override
|
||||
Future<void> runTestLogic() async {
|
||||
final imagePaths = ImagePaths();
|
||||
final appLocalizations = AppLocalizations();
|
||||
final mailboxMenuRobot = MailboxMenuRobot($);
|
||||
final threadRobot = ThreadRobot($);
|
||||
final composerRobot = ComposerRobot($);
|
||||
|
||||
await threadRobot.openMailbox();
|
||||
await mailboxMenuRobot.openFolderByName(
|
||||
appLocalizations.templatesMailboxDisplayName,
|
||||
);
|
||||
|
||||
await threadRobot.openComposer();
|
||||
await composerRobot.grantContactPermission();
|
||||
|
||||
await composerRobot.addSubject('test subject');
|
||||
await composerRobot.saveAsTemplate();
|
||||
await $.pumpAndTrySettle();
|
||||
await _expectSaveToastSuccessVisible();
|
||||
await composerRobot.tapCloseComposer(imagePaths);
|
||||
await composerRobot.tapDiscardChanges();
|
||||
await _expectTemplateVisible('test subject');
|
||||
|
||||
await composerRobot.addSubject('test subject');
|
||||
await threadRobot.openEmailWithSubject('test subject');
|
||||
await composerRobot.addSubject('test subject updated');
|
||||
hideKeyboard();
|
||||
await $.pumpAndTrySettle(duration: const Duration(seconds: 1));
|
||||
await composerRobot.saveAsTemplate();
|
||||
|
||||
await _expectUpdateToastSuccessVisible();
|
||||
await $.pumpAndTrySettle();
|
||||
await composerRobot.tapCloseComposer(imagePaths);
|
||||
await composerRobot.tapDiscardChanges();
|
||||
await _expectTemplateVisible('test subject updated');
|
||||
}
|
||||
|
||||
Future<void> _expectSaveToastSuccessVisible() async {
|
||||
await $(AppLocalizations().saveMessageToTemplateSuccess).waitUntilVisible();
|
||||
expect(
|
||||
$(AppLocalizations().saveMessageToTemplateSuccess).visible,
|
||||
isTrue,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _expectUpdateToastSuccessVisible() async {
|
||||
await $(AppLocalizations().updateMessageToTemplateSuccess).waitUntilVisible();
|
||||
expect(
|
||||
$(AppLocalizations().updateMessageToTemplateSuccess).visible,
|
||||
isTrue,
|
||||
);
|
||||
Future<void> _expectTemplateVisible(String subject) async {
|
||||
await $(subject).waitUntilVisible();
|
||||
expect($(subject).visible, isTrue);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user