test(chat): add a test that install a sticker pack and sends a sticker

Fixes #6962
This commit is contained in:
Jonathan Rainville 2022-08-11 15:16:59 -04:00
parent 80f9c881f2
commit 6bd1cfde72
12 changed files with 94 additions and 4 deletions

View File

@ -70,6 +70,12 @@ def process_terminated(pid):
return True
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):
closed = False
timeout = False

View File

@ -71,7 +71,7 @@ class ProfileSettingsScreen(Enum):
TWITTER_SOCIAL_LINK: str = "twitter_StaticSocialLinkInput"
PERSONAL_SITE_SOCIAL_LINK: str = "personalSite_StaticSocialLinkInput"
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"
PERSONAL_SITE_LINK_IN_DIALOG: str = "personalSite_popup_TextEdit"
CUSTOM_LINK_IN_DIALOG: str = "customLink_popup_TextEdit"

View File

@ -12,6 +12,7 @@ import re
import copy
from enum import Enum
import time
from drivers.SquishDriver import *
from drivers.SquishDriverVerification import *
from drivers.SDKeyboardCommands import *
@ -61,6 +62,15 @@ class ChatComponents(Enum):
GIF_POPUP_BUTTON = "chatView_gifPopupButton"
ENABLE_GIF_BUTTON = "gifPopup_enableGifButton"
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):
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)
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):
if (message != ""):
self.type_message_in_chat_input(message)

View File

@ -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}
# 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:
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}

View File

@ -1,4 +1,5 @@
AUT=nim_status_client
ENVVARS=envvars
LANGUAGE=Python
OBJECTMAPSTYLE=script
TEST_CASES=tst_statusSignUp tst_passwordStrength

View File

@ -16,6 +16,7 @@ chatView_TogglePinMessageButton = {"container": chatView_log, "objectName": "Mes
chatInfoButton_Pin_Text = {"container": chatView_StatusChatInfoButton, "objectName": "StatusChatInfo_pinText", "type": "StatusBaseText", "visible": True}
chatButtonsPanelConfirmDeleteMessageButton_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "chatButtonsPanelConfirmDeleteMessageButton", "type": "StatusButton"}
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_suggestion_ListView ={"container": chatView_SuggestionBoxPanel, "objectName": "suggestionBoxList", "type": "StatusListView"}
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_confirmBtn = {"container": statusDesktop_mainWindow, "objectName": "createChatConfirmButton", "type": "StatusButton"}
## Members panel:
# Members panel:
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}

View File

@ -150,6 +150,16 @@ def step(context, emoji):
def step(context, 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|")
def step(context, displayName):
_statusChat.cannot_do_mention(displayName)

View File

@ -137,3 +137,9 @@ Feature: Status Desktop Chat
When user joins chat room automation-test
Then the user is able to send chat message "Hello :)"
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

View File

@ -80,7 +80,7 @@ Popup {
Rectangle {
id: closeButton
objectName: "closeButtonRectangle"
objectName: "modalCloseButtonRectangle"
property bool hovered: false
visible: displayCloseButton
height: 32

View File

@ -1234,6 +1234,7 @@ Rectangle {
StatusQ.StatusFlatRoundButton {
id: stickersBtn
objectName: "statusChatInputStickersButton"
implicitHeight: 32
implicitWidth: 32
width: visible ? 32 : 0

View File

@ -32,6 +32,7 @@ Item {
StatusGridView {
id: availableStickerPacks
objectName: "stickerMarketStatusGridView"
width: parent.width
height: 380
anchors.left: parent.left
@ -86,6 +87,9 @@ 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
height: availableStickerPacks.cellHeight
RoundedImage {
@ -125,6 +129,7 @@ Item {
}
footer: StatusStickerButton {
objectName: "statusStickerMarketInstallButton"
height: 44
anchors.right: parent.right
style: StatusStickerButton.StyleType.LargeNoIcon

View File

@ -155,6 +155,7 @@ Popup {
}
StatusQControls.StatusButton {
objectName: "stickersPopupGetStickersButton"
visible: lblNoStickersYet.visible
text: qsTr("Get Stickers")
anchors.top: noStickersContainer.bottom
@ -169,6 +170,7 @@ Popup {
}
StatusStickerList {
id: stickerGrid
objectName: "statusStickerPopupStickerGrid"
model: recentStickers
packId: stickerPackListView.selectedPackId
onStickerClicked: {