test(@desktop/chat): Can reply to a message in a community channel

This commit is contained in:
mprakhov 2022-11-25 11:04:15 +02:00 committed by Mykhailo Prakhov
parent 6b7eea8db9
commit 8f13ad8f93
4 changed files with 35 additions and 18 deletions

View File

@ -44,6 +44,8 @@ class CommunityScreenComponents(Enum):
COMMUNITY_CHAT_LIST_CATEGORIES = "communityChatListCategories_Repeater"
CHAT_INPUT_ROOT = "chatInput_Root"
TOGGLE_PIN_MESSAGE_BUTTON = "chatView_TogglePinMessageButton"
REPLY_TO_MESSAGE_BUTTON = "chatView_ReplyToMessageButton"
PIN_TEXT = "chatInfoButton_Pin_Text"
ADD_MEMBERS_BUTTON = "community_AddMembers_Button"
EXISTING_CONTACTS_LISTVIEW = "community_InviteFirends_Popup_ExistinContacts_ListView"
@ -314,26 +316,27 @@ class StatusCommunityScreen:
image_index = 2 if has_message else 1
self._verify_image_sent(image_index)
def _do_wait_for_pin_button(self, message_index: int):
def _do_wait_for_msg_action_button(self, message_index: int, btn_name: str):
if (self._retry_number > 3):
verify_failure("Cannot find the pin button after hovering the message")
verify_failure("Cannot find the action button after hovering the message")
message_object_to_pin = wait_and_get_obj(CommunityScreenComponents.CHAT_LOG.value).itemAtIndex(int(message_index))
move_mouse_over_object(message_object_to_pin)
pin_visible, _ = is_loaded_visible_and_enabled(CommunityScreenComponents.TOGGLE_PIN_MESSAGE_BUTTON.value, 100)
if not pin_visible:
message_object_to_action = wait_and_get_obj(CommunityScreenComponents.CHAT_LOG.value).itemAtIndex(int(message_index))
move_mouse_over_object(message_object_to_action)
btn_visible, _ = is_loaded_visible_and_enabled(btn_name, 100)
if not btn_visible:
self._retry_number += 1
self._do_wait_for_pin_button(message_index)
self._do_wait_for_msg_action_button(message_index, btn_name)
def _wait_for_pin_button(self, message_index: int):
def _wait_for_msg_action_button(self, message_index: int, btn_name: str):
self._retry_number = 0
self._do_wait_for_pin_button(message_index)
self._do_wait_for_msg_action_button(message_index, btn_name)
def _click_msg_action_button(self, message_index: int, btn_name: str):
self._wait_for_msg_action_button(message_index, btn_name)
click_obj_by_name(btn_name)
def toggle_pin_message_at_index(self, message_index: int):
self._wait_for_pin_button(message_index)
click_obj_by_name(CommunityScreenComponents.TOGGLE_PIN_MESSAGE_BUTTON.value)
self._click_msg_action_button(message_index, CommunityScreenComponents.TOGGLE_PIN_MESSAGE_BUTTON.value)
def check_pin_count(self, wanted_pin_count: int):
pin_text_obj = wait_and_get_obj(CommunityScreenComponents.PIN_TEXT.value)
@ -390,4 +393,5 @@ class StatusCommunityScreen:
header = get_obj(CommunityScreenComponents.COMMUNITY_HEADER_BUTTON.value)
verify_values_equal(str(header.nbMembers), str(amount), "Number of members is not correct")
def toggle_reply_message_at_index(self, message_index: int):
self._click_msg_action_button(message_index, CommunityScreenComponents.REPLY_TO_MESSAGE_BUTTON.value)

View File

@ -30,7 +30,7 @@ communitySettings_MembersTab_Members_ListView = {"container": statusDesktop_main
communitySettings_MembersTab_Member_Kick_Button = {"container": communitySettings_MembersTab_Members_ListView, "objectName": "MemberListIten_KickButton", "type": "StatusButton", "visible": True}
communitySettings_KickModal_Kick_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "CommunityMembers_KickModal_KickButton", "type": "StatusButton", "visible": True}
chatView_TogglePinMessageButton = {"container": chatView_log, "objectName": "MessageView_toggleMessagePin", "type": "StatusFlatRoundButton", "visible": True}
chatView_ReplyToMessageButton = {"container": chatView_log, "objectName": "replyToMessageButton", "type": "StatusFlatRoundButton", "visible": True}
# Community channel popup:
createOrEditCommunityChannelNameInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createOrEditCommunityChannelNameInput", "type": "TextEdit", "visible": True}

View File

@ -66,7 +66,12 @@ def step(context, message):
@When("the user sends multiple test images in the current channel with message \"|any|\" with an image again")
def step(context, message):
_statusCommunityScreen.send_test_image(context.userData["fixtures_root"], True, message)
@When("the user replies to community chat message at index |integer| with \"|any|\"")
def step(context, message_index: int, message: str):
_statusCommunityScreen.toggle_reply_message_at_index(message_index)
the_user_sends_a_chat_message(message)
@When("the user pins the message at index |integer|")
def step(context, message_index: int):
_statusCommunityScreen.toggle_pin_message_at_index(message_index)

View File

@ -52,4 +52,12 @@ Feature: Status Desktop community messages
Then the amount of pinned messages is 2
When the user unpins the message at index 0
Then the amount of pinned messages is 1
Then the amount of pinned messages is 1
Scenario Outline: The user can reply to own message
Given the user sends a chat message "<message>"
When the user replies to community chat message at index 0 with "<reply>"
Then the chat message "<reply>" is displayed as a reply of this user's "<message>"
Examples:
| message | reply |
| Community chat message | This is a reply |