test(chat): Can clean chat history

Closes: #6876
This commit is contained in:
Boris Melnik 2022-08-15 20:16:01 +03:00
parent d8a7dcf3a2
commit 7b77973b86
6 changed files with 37 additions and 2 deletions

View File

@ -36,6 +36,8 @@ class ChatComponents(Enum):
CHAT_INPUT_EMOJI_BUTTON = "chatInput_Emoji_Button"
EMOJI_POPUP_EMOJI_PLACEHOLDER = "emojiPopup_Emoji_Button_Placeholder"
CHAT_LIST = "chatList_Repeater"
MORE_OPTIONS_BUTTON = "chatView_ChatToolbarMoreOptionsButton"
CLEAR_HISTORY_MENUITEM = "clearHistoryMenuItem"
class ChatMessagesHistory(Enum):
CHAT_CREATED_TEXT = 1
@ -55,7 +57,15 @@ class StatusChatScreen:
type(ChatComponents.MESSAGE_INPUT.value, message)
press_enter(ChatComponents.MESSAGE_INPUT.value)
# Verifications region:
def clear_history(self):
click_obj_by_name(ChatComponents.MORE_OPTIONS_BUTTON.value)
click_obj_by_name(ChatComponents.CLEAR_HISTORY_MENUITEM.value)
# Verifications region:
def verify_last_message_is_not_loaded(self):
[loaded, _] = is_loaded_visible_and_enabled(ChatComponents.LAST_MESSAGE_TEXT.value)
verify_fasle(loaded, "Success: No message was found")
def verify_last_message_sent(self, message: str):
[loaded, last_message_obj] = is_loaded_visible_and_enabled(ChatComponents.LAST_MESSAGE_TEXT.value)
verify(loaded, "Checking last message sent: " + message)

View File

@ -16,6 +16,10 @@ chatView_suggestion_ListView ={"container": chatView_SuggestionBoxPanel, "object
chatView_userMentioned_ProfileView ={"container": statusDesktop_mainWindow_overlay, "objectName": "profileView", "type": "ProfileView"}
emojiPopup_Emoji_Button_Placeholder = {"container": statusDesktop_mainWindow, "objectName": "statusEmoji_%NAME%", "type": "StatusEmoji", "visible": True}
chatInput_Emoji_Button = {"container": statusDesktop_mainWindow, "objectName": "statusChatInputEmojiButton", "type": "StatusFlatRoundButton", "visible": True}
chatView_ChatToolbarMoreOptionsButton = {"container": statusDesktop_mainWindow, "objectName": "chatToolbarMoreOptionsButton", "type": "StatusFlatRoundButton"}
# More options menu
clearHistoryMenuItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "clearHistoryMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
# Join chat popup:
startChat_Btn = {"container": statusDesktop_mainWindow_overlay, "objectName": "startChatButton", "type": "StatusButton"}

View File

@ -31,7 +31,11 @@ def step(context, chatName):
@When("the user inputs a mention to |any| with message |any|")
def step(context,displayName,message):
_statusChat.send_message_with_mention(displayName, message)
_statusChat.send_message_with_mention(displayName, message)
@When("the user clears chat history")
def step(context):
_statusChat.clear_history()
@Then("user is able to send chat message")
def step(context):
@ -47,6 +51,10 @@ def step(context):
_statusChat.send_message(message)
_statusChat.verify_last_message_sent(message)
context.userData["randomMessage"] = message
@Then("the chat is cleared")
def step(context):
_statusChat.verify_last_message_is_not_loaded()
@Then("the group chat is created")
def step(context):

View File

@ -50,6 +50,17 @@ Feature: Status Desktop Chat
Then the user can delete the message at index 0
Then the last message is not the random message
Scenario: User can clear chat history
When user joins chat room test
Then user is able to send chat message
| message |
| Hello |
| How are you |
| I am from status |
| tell me how you do? |
When the user clears chat history
Then the chat is cleared
@mayfail
Scenario: User cannot delete another user's message

View File

@ -194,6 +194,7 @@ ColumnLayout {
onNotificationButtonClicked: root.notificationButtonClicked()
popupMenu: ChatContextMenuView {
objectName: "moreOptionsContextMenu"
emojiPopup: root.emojiPopup
openHandler: function () {
if(!chatContentModule) {

View File

@ -161,6 +161,7 @@ StatusPopupMenu {
// }
StatusMenuItem {
objectName: "clearHistoryMenuItem"
text: qsTr("Clear history")
icon.name: "close-circle"
onTriggered: {