Skip to content

Commit

Permalink
TW-2206 added patrol test for sending text message
Browse files Browse the repository at this point in the history
  • Loading branch information
KhaledNjim committed Jan 13, 2025
1 parent febdb8c commit 5d7c9fc
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
5 changes: 5 additions & 0 deletions integration_test/robots/send_text_message_robot.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import '../base/core_robot.dart';

class SendTextMessageRobot extends CoreRobot {
SendTextMessageRobot(super.$);
}
24 changes: 24 additions & 0 deletions integration_test/scenarios/send_text_message_scenario.dart
Original file line number Diff line number Diff line change
@@ -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<void> execute() async {
await loginScenario.execute();
await $.tap($(ChatListItem));
await $.waitUntilVisible($(ChatView));
await $.enterText($(InputBar), "test message");
await $.tap($(ChatInputRowSendBtn));
}
}
24 changes: 24 additions & 0 deletions integration_test/tests/chat/send_text_message_test.dart
Original file line number Diff line number Diff line change
@@ -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();
},
);
}

0 comments on commit 5d7c9fc

Please sign in to comment.