From 5d7c9fc13208d2b0856d862579b7cc51f3b53274 Mon Sep 17 00:00:00 2001 From: KhaledNjim <160496984+KhaledNjim@users.noreply.github.com> Date: Mon, 13 Jan 2025 23:48:35 +0100 Subject: [PATCH] TW-2206 added patrol test for sending text message --- .../robots/send_text_message_robot.dart | 5 ++++ .../scenarios/send_text_message_scenario.dart | 24 +++++++++++++++++++ .../tests/chat/send_text_message_test.dart | 24 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 integration_test/robots/send_text_message_robot.dart create mode 100644 integration_test/scenarios/send_text_message_scenario.dart create mode 100644 integration_test/tests/chat/send_text_message_test.dart diff --git a/integration_test/robots/send_text_message_robot.dart b/integration_test/robots/send_text_message_robot.dart new file mode 100644 index 000000000..70c1507b0 --- /dev/null +++ b/integration_test/robots/send_text_message_robot.dart @@ -0,0 +1,5 @@ +import '../base/core_robot.dart'; + +class SendTextMessageRobot extends CoreRobot { + SendTextMessageRobot(super.$); +} diff --git a/integration_test/scenarios/send_text_message_scenario.dart b/integration_test/scenarios/send_text_message_scenario.dart new file mode 100644 index 000000000..6ca9ef867 --- /dev/null +++ b/integration_test/scenarios/send_text_message_scenario.dart @@ -0,0 +1,24 @@ +import 'package:fluffychat/pages/chat/chat_input_row_send_btn.dart'; +import 'package:fluffychat/pages/chat/chat_view.dart'; +import 'package:fluffychat/pages/chat/input_bar/input_bar.dart'; +import 'package:fluffychat/pages/chat_list/chat_list_item.dart'; +import 'package:flutter_test/flutter_test.dart'; +import '../base/base_scenario.dart'; +import 'login_scenario.dart'; + +class SendTextMessageScenario extends BaseScenario { + LoginScenario loginScenario; + SendTextMessageScenario( + super.$, { + required this.loginScenario, + }); + + @override + Future execute() async { + await loginScenario.execute(); + await $.tap($(ChatListItem)); + await $.waitUntilVisible($(ChatView)); + await $.enterText($(InputBar), "test message"); + await $.tap($(ChatInputRowSendBtn)); + } +} diff --git a/integration_test/tests/chat/send_text_message_test.dart b/integration_test/tests/chat/send_text_message_test.dart new file mode 100644 index 000000000..214f3826a --- /dev/null +++ b/integration_test/tests/chat/send_text_message_test.dart @@ -0,0 +1,24 @@ +import 'package:patrol/patrol.dart'; + +import '../../base/test_base.dart'; +import '../../scenarios/login_scenario.dart'; +import '../../scenarios/send_text_message_scenario.dart'; + +void main() { + TestBase().runPatrolTest( + description: 'Should see Message bubble after sending text message', + test: ($) async { + final loginScenario = LoginScenario( + $, + username: const String.fromEnvironment('USERNAME'), + serverUrl: const String.fromEnvironment('SERVER_URL'), + password: const String.fromEnvironment('PASSWORD'), + ); + final sendTextMessageScenario = SendTextMessageScenario( + $, + loginScenario: loginScenario, + ); + await sendTextMessageScenario.execute(); + }, + ); +}