1-1 chat: added reply to own message, clear chat and close chat steps
This commit is contained in:
parent
d6a71fa37b
commit
cf52a8222f
|
@ -0,0 +1,23 @@
|
|||
import allure
|
||||
|
||||
import configs
|
||||
from gui.components.base_popup import BasePopup
|
||||
from gui.elements.button import Button
|
||||
from gui.objects_map import names
|
||||
|
||||
|
||||
class ClearChatHistoryPopup(BasePopup):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self._clear_button = Button(names.clear_StatusButton)
|
||||
|
||||
@allure.step('Wait until appears {0}')
|
||||
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
||||
self._clear_button.wait_until_appears(timeout_msec)
|
||||
return self
|
||||
|
||||
@allure.step("Confirm clearing chat")
|
||||
def confirm_clearing_chat(self):
|
||||
self._clear_button.click()
|
||||
self._clear_button.wait_until_hidden()
|
|
@ -0,0 +1,23 @@
|
|||
import allure
|
||||
|
||||
import configs
|
||||
from gui.components.base_popup import BasePopup
|
||||
from gui.elements.button import Button
|
||||
from gui.objects_map import names
|
||||
|
||||
|
||||
class CloseChatPopup(BasePopup):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self._close_chat_button = Button(names.close_chat_StatusButton)
|
||||
|
||||
@allure.step('Wait until appears {0}')
|
||||
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
||||
self._close_chat_button.wait_until_appears(timeout_msec)
|
||||
return self
|
||||
|
||||
@allure.step("Confirm closing chat")
|
||||
def confirm_closing_chat(self):
|
||||
self._close_chat_button.click()
|
||||
self._close_chat_button.wait_until_hidden()
|
|
@ -53,6 +53,9 @@ add_remove_from_group_StatusMenuItem = {"checkable": False, "container": mainWin
|
|||
mainWindow_inputScrollView_StatusScrollView = {"container": statusDesktop_mainWindow, "id": "inputScrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
|
||||
inputScrollView_messageInputField_TextArea = {"container": mainWindow_inputScrollView_StatusScrollView, "objectName": "messageInputField", "type": "TextArea", "visible": True}
|
||||
mainWindow_statusChatInputEmojiButton_StatusFlatRoundButton = {"container": statusDesktop_mainWindow, "objectName": "statusChatInputEmojiButton", "type": "StatusFlatRoundButton", "visible": True}
|
||||
mark_as_Read_StatusMenuItem = {"checkable": False, "container": mainWindow_Overlay, "enabled": True, "objectName": "chatMarkAsReadMenuItem", "type": "StatusMenuItem", "visible": True}
|
||||
clear_History_StatusMenuItem = {"checkable": False, "container": mainWindow_Overlay, "enabled": True, "objectName": "clearHistoryMenuItem", "type": "StatusMenuItem", "visible": True}
|
||||
close_Chat_StatusMenuItem = {"checkable": False, "container": mainWindow_Overlay, "enabled": True, "objectName": "deleteOrLeaveMenuItem", "type": "StatusMenuItem", "visible": True}
|
||||
|
||||
# User List Panel
|
||||
mainWindow_UserListPanel = {"container": mainWindow_chatView_ChatView, "type": "UserListPanel", "unnamed": 1, "visible": True}
|
||||
|
@ -64,15 +67,16 @@ groupUserListPanel_StatusMemberListItem = {"container": mainWindow_userListPanel
|
|||
|
||||
# Message quick actions
|
||||
mainWindow_chatLogView_StatusListView = {"container": statusDesktop_mainWindow, "objectName": "chatLogView", "type": "StatusListView", "visible": True}
|
||||
chatLogView_chatMessageViewDelegate_MessageView = {"container": mainWindow_chatLogView_StatusListView, "index": 0, "objectName": "chatMessageViewDelegate", "type": "MessageView", "visible": True}
|
||||
chatLogView_chatMessageViewDelegate_MessageView = {"container": mainWindow_chatLogView_StatusListView, "objectName": "chatMessageViewDelegate", "type": "MessageView", "visible": True}
|
||||
chatMessageViewDelegate_deletedMessage_RowLayout = {"container": chatLogView_chatMessageViewDelegate_MessageView, "id": "deletedMessage", "type": "RowLayout", "unnamed": 1, "visible": True}
|
||||
chatMessageViewDelegate_StatusMessageQuickActions = {"container": chatLogView_chatMessageViewDelegate_MessageView, "type": "StatusMessageQuickActions", "unnamed": 1, "visible": True}
|
||||
chatMessageViewDelegate_pin_icon_StatusIcon = {"container": chatLogView_chatMessageViewDelegate_MessageView, "objectName": "pin-icon", "type": "StatusIcon", "visible": True}
|
||||
chatMessageViewDelegate_unpin_icon_StatusIcon = {"container": chatLogView_chatMessageViewDelegate_MessageView, "objectName": "unpin-icon", "type": "StatusIcon", "visible": True}
|
||||
chatMessageViewDelegate_replyToMessageButton_StatusFlatRoundButton = {"container": chatLogView_chatMessageViewDelegate_MessageView, "objectName": "replyToMessageButton", "type": "StatusFlatRoundButton", "visible": True}
|
||||
chatMessageViewDelegate_editMessageButton_StatusFlatRoundButton = {"container": chatLogView_chatMessageViewDelegate_MessageView, "objectName": "editMessageButton", "type": "StatusFlatRoundButton", "visible": True}
|
||||
chatMessageViewDelegate_markAsUnreadButton_StatusFlatRoundButton = {"container": chatLogView_chatMessageViewDelegate_MessageView, "objectName": "markAsUnreadButton", "type": "StatusFlatRoundButton", "visible": True}
|
||||
chatMessageViewDelegate_chatDeleteMessageButton_StatusFlatRoundButton = {"container": chatLogView_chatMessageViewDelegate_MessageView, "objectName": "chatDeleteMessageButton", "type": "StatusFlatRoundButton", "visible": True}
|
||||
chatMessageViewDelegate_inputScrollView_StatusScrollView = {"container": chatLogView_chatMessageViewDelegate_MessageView, "id": "inputScrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
|
||||
edit_inputScrollView_messageInputField_TextArea = {"container": chatMessageViewDelegate_inputScrollView_StatusScrollView, "objectName": "messageInputField", "type": "TextArea", "visible": True}
|
||||
chatMessageViewDelegate_Save_StatusButton = {"checkable": False, "container": chatLogView_chatMessageViewDelegate_MessageView, "id": "saveBtn", "type": "StatusButton", "unnamed": 1, "visible": True}
|
||||
chatMessageViewDelegate_reply_icon_StatusIcon = {"container": chatLogView_chatMessageViewDelegate_MessageView, "objectName": "reply-icon", "type": "StatusIcon", "visible": True}
|
||||
mainWindow_replyArea_StatusChatInputReplyArea = {"container": statusDesktop_mainWindow, "id": "replyArea", "type": "StatusChatInputReplyArea", "unnamed": 1, "visible": True}
|
||||
|
|
|
@ -380,6 +380,12 @@ save_changes_StatusButton = {"checkable": False, "container": statusDesktop_main
|
|||
# Leave group popup
|
||||
leave_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "leaveGroupConfirmationDialogLeaveButton", "type": "StatusButton", "visible": True}
|
||||
|
||||
# Clear chat history popup
|
||||
clear_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "clearChatConfirmationDialogClearButton", "type": "StatusButton", "visible": True}
|
||||
|
||||
# Close chat popup
|
||||
close_chat_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "deleteChatConfirmationDialogDeleteButton", "text": "Close chat", "type": "StatusButton", "visible": True}
|
||||
|
||||
# Create Keycard account with new seed phrase popup
|
||||
cancel_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "id": "cancelButton", "type": "StatusButton", "visible": True}
|
||||
image_KeycardImage = {"container": statusDesktop_mainWindow_overlay, "id": "image", "type": "KeycardImage", "unnamed": 1, "visible": True}
|
||||
|
|
|
@ -11,6 +11,8 @@ from gui.components.activity_center import ActivityCenter
|
|||
from gui.components.context_menu import ContextMenu
|
||||
from gui.components.delete_popup import DeleteMessagePopup
|
||||
from gui.components.emoji_popup import EmojiPopup
|
||||
from gui.components.messaging.clear_chat_history_popup import ClearChatHistoryPopup
|
||||
from gui.components.messaging.close_chat_popup import CloseChatPopup
|
||||
from gui.components.messaging.edit_group_name_and_image_popup import EditGroupNameAndImagePopup
|
||||
from gui.components.messaging.leave_group_popup import LeaveGroupPopup
|
||||
from gui.elements.button import Button
|
||||
|
@ -139,6 +141,8 @@ class Message:
|
|||
self.time = str(child.text)
|
||||
case 'chatText':
|
||||
self.text = str(child.text)
|
||||
case 'replyCorner':
|
||||
self.reply_corner = QObject(real_name=driver.objectMap.realName(child))
|
||||
case 'delegate':
|
||||
self.delegate_button = Button(real_name=driver.objectMap.realName(child))
|
||||
|
||||
|
@ -185,6 +189,7 @@ class ChatView(QObject):
|
|||
_messages = []
|
||||
time.sleep(1)
|
||||
# message_list_item has different indexes if we run multiple instances, so we pass index
|
||||
if index is not None:
|
||||
self._message_list_item.real_name['index'] = index
|
||||
for item in driver.findAllObjects(self._message_list_item.real_name):
|
||||
if getattr(item, 'isMessage', False):
|
||||
|
@ -259,6 +264,8 @@ class ChatMessagesView(QObject):
|
|||
self._edit_menu_item = QObject(messaging_names.edit_name_and_image_StatusMenuItem)
|
||||
self._leave_group_item = QObject(messaging_names.leave_group_StatusMenuItem)
|
||||
self._add_remove_item = QObject(messaging_names.add_remove_from_group_StatusMenuItem)
|
||||
self._clear_history_item = QObject(messaging_names.clear_History_StatusMenuItem)
|
||||
self._close_chat_item = QObject(messaging_names.close_Chat_StatusMenuItem)
|
||||
self._message_input_area = QObject(messaging_names.inputScrollView_messageInputField_TextArea)
|
||||
self._message_field = TextEdit(messaging_names.inputScrollView_Message_PlaceholderText)
|
||||
self._emoji_button = Button(messaging_names.mainWindow_statusChatInputEmojiButton_StatusFlatRoundButton)
|
||||
|
@ -334,6 +341,22 @@ class ChatMessagesView(QObject):
|
|||
tool_bar.confirm_action_in_toolbar()
|
||||
time.sleep(1)
|
||||
|
||||
@allure.step('Clear chat history option')
|
||||
def clear_history(self):
|
||||
time.sleep(2)
|
||||
self.open_more_options()
|
||||
time.sleep(2)
|
||||
self._clear_history_item.click()
|
||||
ClearChatHistoryPopup().wait_until_appears().confirm_clearing_chat()
|
||||
|
||||
@allure.step('Close chat')
|
||||
def close_chat(self):
|
||||
time.sleep(2)
|
||||
self.open_more_options()
|
||||
time.sleep(2)
|
||||
self._close_chat_item.click()
|
||||
CloseChatPopup().wait_until_appears().confirm_closing_chat()
|
||||
|
||||
|
||||
class MessageQuickActions(QObject):
|
||||
def __init__(self):
|
||||
|
@ -344,8 +367,11 @@ class MessageQuickActions(QObject):
|
|||
self._edit_button = Button(messaging_names.chatMessageViewDelegate_editMessageButton_StatusFlatRoundButton)
|
||||
self._delete_button = Button(
|
||||
messaging_names.chatMessageViewDelegate_chatDeleteMessageButton_StatusFlatRoundButton)
|
||||
self._reply_button = Button(messaging_names.chatMessageViewDelegate_reply_icon_StatusIcon)
|
||||
self._edit_message_field = TextEdit(messaging_names.edit_inputScrollView_messageInputField_TextArea)
|
||||
self._reply_area = QObject(messaging_names.mainWindow_replyArea_StatusChatInputReplyArea)
|
||||
self._save_text_button = Button(messaging_names.chatMessageViewDelegate_Save_StatusButton)
|
||||
self._message_input_area = TextEdit(messaging_names.inputScrollView_messageInputField_TextArea)
|
||||
|
||||
@allure.step('Click pin button')
|
||||
def pin_message(self):
|
||||
|
@ -366,6 +392,14 @@ class MessageQuickActions(QObject):
|
|||
self._delete_button.click()
|
||||
DeleteMessagePopup().delete()
|
||||
|
||||
@allure.step('Reply to own message')
|
||||
def reply_own_message(self, text: str):
|
||||
self._reply_button.click()
|
||||
assert self._reply_area.exists
|
||||
self._message_input_area.type_text(text)
|
||||
for i in range(2):
|
||||
driver.nativeType('<Return>')
|
||||
|
||||
@allure.step('Delete button is visible')
|
||||
def is_delete_button_visible(self) -> bool:
|
||||
return self._delete_button.is_visible
|
||||
|
|
|
@ -120,11 +120,48 @@ def test_1x1_chat(multiple_instances):
|
|||
for message_item in message_items:
|
||||
assert driver.waitFor(lambda: '😎' in message_item, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
|
||||
|
||||
with step(f'User {user_one.name}, reply to own message and verify that message displayed as a reply'):
|
||||
chat_message_reply = \
|
||||
''.join(random.choice(string.ascii_letters + string.digits) for _ in range(1, 21))
|
||||
message.hover_message().reply_own_message(chat_message_reply)
|
||||
chat = main_window.left_panel.open_messages_screen().left_panel.click_chat_by_name(user_two.name)
|
||||
message = chat.find_message_by_text(chat_message_reply, 0)
|
||||
assert message.reply_corner.exists
|
||||
|
||||
with step(f'User {user_one.name}, delete own message and verify it was deleted'):
|
||||
message = messages_screen.left_panel.click_chat_by_name(user_two.name).find_message_by_text(chat_message1, 2)
|
||||
message = messages_screen.left_panel.click_chat_by_name(user_two.name).find_message_by_text(
|
||||
chat_message_reply, 0)
|
||||
message.hover_message().delete_message()
|
||||
|
||||
with step(f'User {user_one.name}, cannot delete {user_two.name} message'):
|
||||
message = messages_screen.left_panel.click_chat_by_name(user_two.name).find_message_by_text(chat_message2, 1)
|
||||
message = messages_screen.left_panel.click_chat_by_name(user_two.name).find_message_by_text(chat_message2,
|
||||
2)
|
||||
assert not message.hover_message().is_delete_button_visible()
|
||||
|
||||
with step(f'User {user_one.name}, clears chat history'):
|
||||
ChatMessagesView().clear_history()
|
||||
messages = messages_screen.chat.messages(index=None)
|
||||
assert len(messages) == 0
|
||||
assert user_two.name in messages_screen.left_panel.get_chats_names, f'{chat} is not present in chats list'
|
||||
main_window.hide()
|
||||
|
||||
with step(f'Verify chat history was not cleared for {user_two.name} '):
|
||||
aut_two.attach()
|
||||
main_window.prepare()
|
||||
messages_screen.left_panel.click_chat_by_name(user_one.name)
|
||||
messages = messages_screen.chat.messages(index=None)
|
||||
assert len(messages) != 0
|
||||
|
||||
with step(f'User {user_two.name} close chat'):
|
||||
aut_two.attach()
|
||||
main_window.prepare()
|
||||
ChatMessagesView().close_chat()
|
||||
assert user_one.name not in messages_screen.left_panel.get_chats_names, f'{chat} is present in chats list'
|
||||
main_window.hide()
|
||||
|
||||
with step(f'User {user_one.name} sees chat in the list'):
|
||||
aut_one.attach()
|
||||
main_window.prepare()
|
||||
assert driver.waitFor(lambda: user_two.name in messages_screen.left_panel.get_chats_names,
|
||||
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f'{chat} is present in chats list'
|
||||
main_window.hide()
|
||||
|
|
Loading…
Reference in New Issue