test(chat): add a test that install a sticker pack and sends a sticker
Fixes #6962
This commit is contained in:
parent
80f9c881f2
commit
6bd1cfde72
|
@ -70,6 +70,12 @@ def process_terminated(pid):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def verify_failure(errorMsg: str):
|
||||||
|
test.fail(errorMsg)
|
||||||
|
|
||||||
|
def verify_values_equal(found: str, wanted: str, msg : str):
|
||||||
|
test.verify(found == wanted, msg + " Found: " + found + " - Wanted: " + wanted)
|
||||||
|
|
||||||
def verify_the_app_is_closed(pid: int):
|
def verify_the_app_is_closed(pid: int):
|
||||||
closed = False
|
closed = False
|
||||||
timeout = False
|
timeout = False
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ProfileSettingsScreen(Enum):
|
||||||
TWITTER_SOCIAL_LINK: str = "twitter_StaticSocialLinkInput"
|
TWITTER_SOCIAL_LINK: str = "twitter_StaticSocialLinkInput"
|
||||||
PERSONAL_SITE_SOCIAL_LINK: str = "personalSite_StaticSocialLinkInput"
|
PERSONAL_SITE_SOCIAL_LINK: str = "personalSite_StaticSocialLinkInput"
|
||||||
OPEN_SOCIAL_LINKS_DIALOG: str = "addMoreSocialLinks_StatusIconTextButton"
|
OPEN_SOCIAL_LINKS_DIALOG: str = "addMoreSocialLinks_StatusIconTextButton"
|
||||||
CLOSE_SOCIAL_LINKS_DIALOG: str = "close_popup_StatusFlatRoundButton"
|
CLOSE_SOCIAL_LINKS_DIALOG: str = "modal_Close_Button"
|
||||||
TWITTER_SOCIAL_LINK_IN_DIALOG: str = "twitter_popup_TextEdit"
|
TWITTER_SOCIAL_LINK_IN_DIALOG: str = "twitter_popup_TextEdit"
|
||||||
PERSONAL_SITE_LINK_IN_DIALOG: str = "personalSite_popup_TextEdit"
|
PERSONAL_SITE_LINK_IN_DIALOG: str = "personalSite_popup_TextEdit"
|
||||||
CUSTOM_LINK_IN_DIALOG: str = "customLink_popup_TextEdit"
|
CUSTOM_LINK_IN_DIALOG: str = "customLink_popup_TextEdit"
|
||||||
|
|
|
@ -12,6 +12,7 @@ import re
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
import time
|
||||||
from drivers.SquishDriver import *
|
from drivers.SquishDriver import *
|
||||||
from drivers.SquishDriverVerification import *
|
from drivers.SquishDriverVerification import *
|
||||||
from drivers.SDKeyboardCommands import *
|
from drivers.SDKeyboardCommands import *
|
||||||
|
@ -61,6 +62,15 @@ class ChatComponents(Enum):
|
||||||
GIF_POPUP_BUTTON = "chatView_gifPopupButton"
|
GIF_POPUP_BUTTON = "chatView_gifPopupButton"
|
||||||
ENABLE_GIF_BUTTON = "gifPopup_enableGifButton"
|
ENABLE_GIF_BUTTON = "gifPopup_enableGifButton"
|
||||||
GIF_MOUSEAREA = "gifPopup_gifMouseArea"
|
GIF_MOUSEAREA = "gifPopup_gifMouseArea"
|
||||||
|
CHAT_INPUT_STICKER_BUTTON = "chat_Input_Stickers_Button"
|
||||||
|
|
||||||
|
class ChatStickerPopup(Enum):
|
||||||
|
STICKERS_POPUP_GET_STICKERS_BUTTON = "chat_StickersPopup_GetStickers_Button"
|
||||||
|
STICKERS_POPUP_MARKET_GRID_VIEW = "chat_StickersPopup_StickerMarket_GridView"
|
||||||
|
STICKERS_POPUP_MARKET_GRID_VIEW_DELEGATE_ITEM_1 = "chat_StickersPopup_StickerMarket_DelegateItem_1"
|
||||||
|
STICKERS_POPUP_MARKET_INSTALL_BUTTON = "chat_StickersPopup_StickerMarket_Install_Button"
|
||||||
|
MODAL_CLOSE_BUTTON = "modal_Close_Button"
|
||||||
|
STICKER_LIST_GRID = "chat_StickersPopup_StickerList_Grid"
|
||||||
|
|
||||||
class ChatMessagesHistory(Enum):
|
class ChatMessagesHistory(Enum):
|
||||||
CHAT_CREATED_TEXT = 1
|
CHAT_CREATED_TEXT = 1
|
||||||
|
@ -246,6 +256,47 @@ class StatusChatScreen:
|
||||||
verify(found, "Checking if the following display name is in the mention's list: " + displayName)
|
verify(found, "Checking if the following display name is in the mention's list: " + displayName)
|
||||||
|
|
||||||
|
|
||||||
|
def install_sticker_pack(self, pack_index: str):
|
||||||
|
click_obj_by_name(ChatComponents.CHAT_INPUT_STICKER_BUTTON.value)
|
||||||
|
click_obj_by_name(ChatStickerPopup.STICKERS_POPUP_GET_STICKERS_BUTTON.value)
|
||||||
|
|
||||||
|
# Wait for grid view to be loaded
|
||||||
|
loaded, grid_view = is_loaded_visible_and_enabled(ChatStickerPopup.STICKERS_POPUP_MARKET_GRID_VIEW.value)
|
||||||
|
if (not loaded):
|
||||||
|
verify_failure("Sticker market grid view is not loaded")
|
||||||
|
|
||||||
|
# Wait for the items in the GridView to be loaded
|
||||||
|
verify(is_displayed(ChatStickerPopup.STICKERS_POPUP_MARKET_GRID_VIEW_DELEGATE_ITEM_1.value), "Sticker item 0 is not displayed")
|
||||||
|
|
||||||
|
scroll_list_view_at_index(grid_view, int(pack_index))
|
||||||
|
|
||||||
|
sticker_pack = grid_view.itemAtIndex(int(pack_index))
|
||||||
|
click_obj(sticker_pack)
|
||||||
|
|
||||||
|
# Install and close
|
||||||
|
click_obj_by_name(ChatStickerPopup.STICKERS_POPUP_MARKET_INSTALL_BUTTON.value)
|
||||||
|
click_obj_by_name(ChatStickerPopup.MODAL_CLOSE_BUTTON.value)
|
||||||
|
|
||||||
|
verify(sticker_pack.installed == True, "The sticker pack at position " + str(pack_index) + " was not installed")
|
||||||
|
|
||||||
|
#Close sticker popup
|
||||||
|
click_obj_by_name(ChatComponents.CHAT_INPUT_STICKER_BUTTON.value)
|
||||||
|
|
||||||
|
def send_sticker(self, sticker_index: int):
|
||||||
|
click_obj_by_name(ChatComponents.CHAT_INPUT_STICKER_BUTTON.value)
|
||||||
|
|
||||||
|
loaded, sticker_list_grid = is_loaded_visible_and_enabled(ChatStickerPopup.STICKER_LIST_GRID.value)
|
||||||
|
|
||||||
|
if (not loaded):
|
||||||
|
verify_failure("Sticker list grid view is not loaded")
|
||||||
|
|
||||||
|
sticker = sticker_list_grid.itemAtIndex(int(sticker_index))
|
||||||
|
click_obj(sticker)
|
||||||
|
|
||||||
|
last_message_obj = get_obj(ChatComponents.CHAT_LOG.value).itemAtIndex(0)
|
||||||
|
verify_values_equal(str(last_message_obj.messageContentType), str(MessageContentType.STICKER.value), "The last message is not a sticker")
|
||||||
|
|
||||||
|
|
||||||
def send_emoji(self, emoji_short_name: str, message: str):
|
def send_emoji(self, emoji_short_name: str, message: str):
|
||||||
if (message != ""):
|
if (message != ""):
|
||||||
self.type_message_in_chat_input(message)
|
self.type_message_in_chat_input(message)
|
||||||
|
|
|
@ -15,7 +15,7 @@ settings_navbar_settings_icon_StatusIcon = {"container": mainWindow_navBarListVi
|
||||||
userContextMenu_ViewMyProfile_Action = {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusViewMyProfileAction", "type": "StatusMenuItemDelegate", "visible": True}
|
userContextMenu_ViewMyProfile_Action = {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusViewMyProfileAction", "type": "StatusMenuItemDelegate", "visible": True}
|
||||||
|
|
||||||
# popups
|
# popups
|
||||||
close_popup_StatusFlatRoundButton = {"container": statusDesktop_mainWindow_overlay, "id": "closeButton", "type": "StatusFlatRoundButton", "unnamed": 1, "visible": True}
|
modal_Close_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "modalCloseButtonRectangle", "type": "Rectangle", "visible": True}
|
||||||
|
|
||||||
# Main Window - chat related:
|
# Main Window - chat related:
|
||||||
mainWindow_public_chat_icon_StatusIcon = {"container": statusDesktop_mainWindow, "objectName": "public-chat-icon", "source": "qrc:/StatusQ/src/assets/img/icons/public-chat.svg", "type": "StatusIcon", "visible": True}
|
mainWindow_public_chat_icon_StatusIcon = {"container": statusDesktop_mainWindow, "objectName": "public-chat-icon", "source": "qrc:/StatusQ/src/assets/img/icons/public-chat.svg", "type": "StatusIcon", "visible": True}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
AUT=nim_status_client
|
AUT=nim_status_client
|
||||||
|
ENVVARS=envvars
|
||||||
LANGUAGE=Python
|
LANGUAGE=Python
|
||||||
OBJECTMAPSTYLE=script
|
OBJECTMAPSTYLE=script
|
||||||
TEST_CASES=tst_statusSignUp tst_passwordStrength
|
TEST_CASES=tst_statusSignUp tst_passwordStrength
|
||||||
|
|
|
@ -16,6 +16,7 @@ chatView_TogglePinMessageButton = {"container": chatView_log, "objectName": "Mes
|
||||||
chatInfoButton_Pin_Text = {"container": chatView_StatusChatInfoButton, "objectName": "StatusChatInfo_pinText", "type": "StatusBaseText", "visible": True}
|
chatInfoButton_Pin_Text = {"container": chatView_StatusChatInfoButton, "objectName": "StatusChatInfo_pinText", "type": "StatusBaseText", "visible": True}
|
||||||
chatButtonsPanelConfirmDeleteMessageButton_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "chatButtonsPanelConfirmDeleteMessageButton", "type": "StatusButton"}
|
chatButtonsPanelConfirmDeleteMessageButton_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "chatButtonsPanelConfirmDeleteMessageButton", "type": "StatusButton"}
|
||||||
mark_as_Read_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "objectName": "chatMarkAsReadMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
|
mark_as_Read_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "objectName": "chatMarkAsReadMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
|
||||||
|
chat_Input_Stickers_Button = {"container": statusDesktop_mainWindow, "objectName": "statusChatInputStickersButton", "type": "StatusFlatRoundButton", "visible": True}
|
||||||
chatView_SuggestionBoxPanel ={"container": statusDesktop_mainWindow, "objectName": "suggestionsBox", "type": "SuggestionBoxPanel"}
|
chatView_SuggestionBoxPanel ={"container": statusDesktop_mainWindow, "objectName": "suggestionsBox", "type": "SuggestionBoxPanel"}
|
||||||
chatView_suggestion_ListView ={"container": chatView_SuggestionBoxPanel, "objectName": "suggestionBoxList", "type": "StatusListView"}
|
chatView_suggestion_ListView ={"container": chatView_SuggestionBoxPanel, "objectName": "suggestionBoxList", "type": "StatusListView"}
|
||||||
chatView_userMentioned_ProfileView ={"container": statusDesktop_mainWindow_overlay, "objectName": "profileView", "type": "ProfileView"}
|
chatView_userMentioned_ProfileView ={"container": statusDesktop_mainWindow_overlay, "objectName": "profileView", "type": "ProfileView"}
|
||||||
|
@ -42,5 +43,12 @@ chat_name_PlaceholderText = {"container": statusDesktop_mainWindow_overlay, "tex
|
||||||
createChatView_contactsList = {"container": statusDesktop_mainWindow, "objectName": "tagSelectorUserList", "type": "ListView"}
|
createChatView_contactsList = {"container": statusDesktop_mainWindow, "objectName": "tagSelectorUserList", "type": "ListView"}
|
||||||
createChatView_confirmBtn = {"container": statusDesktop_mainWindow, "objectName": "createChatConfirmButton", "type": "StatusButton"}
|
createChatView_confirmBtn = {"container": statusDesktop_mainWindow, "objectName": "createChatConfirmButton", "type": "StatusButton"}
|
||||||
|
|
||||||
## Members panel:
|
# Members panel:
|
||||||
chatView_chatMembers_ListView = {"container": statusDesktop_mainWindow, "objectName": "userListPanel", "type": "ListView"}
|
chatView_chatMembers_ListView = {"container": statusDesktop_mainWindow, "objectName": "userListPanel", "type": "ListView"}
|
||||||
|
|
||||||
|
# Stickers Popup
|
||||||
|
chat_StickersPopup_GetStickers_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "stickersPopupGetStickersButton", "type": "StatusButton", "visible": True}
|
||||||
|
chat_StickersPopup_StickerMarket_GridView = {"container": statusDesktop_mainWindow_overlay, "objectName": "stickerMarketStatusGridView", "type": "StatusGridView", "visible": True}
|
||||||
|
chat_StickersPopup_StickerMarket_DelegateItem_1 = {"container": chat_StickersPopup_StickerMarket_GridView, "objectName": "stickerMarketDelegateItem1", "type": "Item", "visible": True}
|
||||||
|
chat_StickersPopup_StickerMarket_Install_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "statusStickerMarketInstallButton", "type": "StatusStickerButton", "visible": True}
|
||||||
|
chat_StickersPopup_StickerList_Grid = {"container": statusDesktop_mainWindow_overlay, "objectName": "statusStickerPopupStickerGrid", "type": "StatusStickerList", "visible": True}
|
||||||
|
|
|
@ -150,6 +150,16 @@ def step(context, emoji):
|
||||||
def step(context, message):
|
def step(context, message):
|
||||||
_statusChat.verify_last_message_sent(message)
|
_statusChat.verify_last_message_sent(message)
|
||||||
|
|
||||||
|
|
||||||
|
@Then("the user can install the sticker pack at position |any|")
|
||||||
|
def step(context, pack_index):
|
||||||
|
_statusChat.install_sticker_pack(pack_index)
|
||||||
|
|
||||||
|
# Using position of sticker because stickers don't have ids, only hashes and it feels weird to type hashes in Gherkin
|
||||||
|
@Then("the user can send the sticker at position |any| in the list")
|
||||||
|
def step(context, sticker_index):
|
||||||
|
_statusChat.send_sticker(sticker_index)
|
||||||
|
|
||||||
@Then("the user cannot input a mention to a not existing user |any|")
|
@Then("the user cannot input a mention to a not existing user |any|")
|
||||||
def step(context, displayName):
|
def step(context, displayName):
|
||||||
_statusChat.cannot_do_mention(displayName)
|
_statusChat.cannot_do_mention(displayName)
|
||||||
|
|
|
@ -137,3 +137,9 @@ Feature: Status Desktop Chat
|
||||||
When user joins chat room automation-test
|
When user joins chat room automation-test
|
||||||
Then the user is able to send chat message "Hello :)"
|
Then the user is able to send chat message "Hello :)"
|
||||||
Then the message Hello 🙂 is displayed in the last message
|
Then the message Hello 🙂 is displayed in the last message
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: User can send a sticker after installing a free pack
|
||||||
|
When user joins chat room automation-test
|
||||||
|
Then the user can install the sticker pack at position 4
|
||||||
|
Then the user can send the sticker at position 2 in the list
|
||||||
|
|
|
@ -80,7 +80,7 @@ Popup {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: closeButton
|
id: closeButton
|
||||||
objectName: "closeButtonRectangle"
|
objectName: "modalCloseButtonRectangle"
|
||||||
property bool hovered: false
|
property bool hovered: false
|
||||||
visible: displayCloseButton
|
visible: displayCloseButton
|
||||||
height: 32
|
height: 32
|
||||||
|
|
|
@ -1234,6 +1234,7 @@ Rectangle {
|
||||||
|
|
||||||
StatusQ.StatusFlatRoundButton {
|
StatusQ.StatusFlatRoundButton {
|
||||||
id: stickersBtn
|
id: stickersBtn
|
||||||
|
objectName: "statusChatInputStickersButton"
|
||||||
implicitHeight: 32
|
implicitHeight: 32
|
||||||
implicitWidth: 32
|
implicitWidth: 32
|
||||||
width: visible ? 32 : 0
|
width: visible ? 32 : 0
|
||||||
|
|
|
@ -32,6 +32,7 @@ Item {
|
||||||
|
|
||||||
StatusGridView {
|
StatusGridView {
|
||||||
id: availableStickerPacks
|
id: availableStickerPacks
|
||||||
|
objectName: "stickerMarketStatusGridView"
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 380
|
height: 380
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
@ -86,6 +87,9 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
|
objectName: "stickerMarketDelegateItem" + index
|
||||||
|
readonly property string packId: model.packId // This property is necessary for the tests
|
||||||
|
readonly property bool installed: model.installed // This property is necessary for the tests
|
||||||
width: availableStickerPacks.cellWidth
|
width: availableStickerPacks.cellWidth
|
||||||
height: availableStickerPacks.cellHeight
|
height: availableStickerPacks.cellHeight
|
||||||
RoundedImage {
|
RoundedImage {
|
||||||
|
@ -125,6 +129,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
footer: StatusStickerButton {
|
footer: StatusStickerButton {
|
||||||
|
objectName: "statusStickerMarketInstallButton"
|
||||||
height: 44
|
height: 44
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
style: StatusStickerButton.StyleType.LargeNoIcon
|
style: StatusStickerButton.StyleType.LargeNoIcon
|
||||||
|
|
|
@ -155,6 +155,7 @@ Popup {
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusQControls.StatusButton {
|
StatusQControls.StatusButton {
|
||||||
|
objectName: "stickersPopupGetStickersButton"
|
||||||
visible: lblNoStickersYet.visible
|
visible: lblNoStickersYet.visible
|
||||||
text: qsTr("Get Stickers")
|
text: qsTr("Get Stickers")
|
||||||
anchors.top: noStickersContainer.bottom
|
anchors.top: noStickersContainer.bottom
|
||||||
|
@ -169,6 +170,7 @@ Popup {
|
||||||
}
|
}
|
||||||
StatusStickerList {
|
StatusStickerList {
|
||||||
id: stickerGrid
|
id: stickerGrid
|
||||||
|
objectName: "statusStickerPopupStickerGrid"
|
||||||
model: recentStickers
|
model: recentStickers
|
||||||
packId: stickerPackListView.selectedPackId
|
packId: stickerPackListView.selectedPackId
|
||||||
onStickerClicked: {
|
onStickerClicked: {
|
||||||
|
|
Loading…
Reference in New Issue