fix(ui-test/ChatFlow): retry to load stickers

For some reason stickers are not loaded for the first time. User has now
the ability to retry the loading procedure. Retry action loads stickers
successfully in most cases.

fixes: #7995
This commit is contained in:
Patryk Osmaczko 2022-11-23 14:46:02 +01:00 committed by osmaczko
parent 56fc768d6f
commit d0725d451e
4 changed files with 43 additions and 5 deletions

View File

@ -76,6 +76,7 @@ class ChatComponents(Enum):
class ChatStickerPopup(Enum):
STICKERS_POPUP_GET_STICKERS_BUTTON = "chat_StickersPopup_GetStickers_Button"
STICKERS_POPUP_RETRY_BUTTON = "chat_StickersPopup_Retry_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"
@ -272,9 +273,25 @@ class StatusChatScreen:
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")
grid_view_displayed, grid_view = is_loaded_visible_and_enabled(ChatStickerPopup.STICKERS_POPUP_MARKET_GRID_VIEW.value)
verify(grid_view_displayed, "Sticker market grid view is not loaded")
# Stickers may not be loaded, retry to load them
stickers_not_loaded = is_displayed(ChatStickerPopup.STICKERS_POPUP_RETRY_BUTTON.value)
if (stickers_not_loaded):
click_obj_by_name(ChatStickerPopup.STICKERS_POPUP_RETRY_BUTTON.value)
# Wait for stickers to load
stickers_grid_displayed = is_displayed(ChatStickerPopup.STICKERS_POPUP_MARKET_GRID_VIEW_DELEGATE_ITEM_1.value)
# In the meantime popup may be closed due to external (unknown?) reason, reopen it
if (not stickers_grid_displayed):
grid_view_displayed = is_displayed(ChatStickerPopup.STICKERS_POPUP_MARKET_GRID_VIEW.value)
if (not grid_view_displayed):
click_obj_by_name(ChatComponents.CHAT_INPUT_STICKER_BUTTON.value)
click_obj_by_name(ChatStickerPopup.STICKERS_POPUP_GET_STICKERS_BUTTON.value)
grid_view_displayed, grid_view = is_loaded_visible_and_enabled(ChatStickerPopup.STICKERS_POPUP_MARKET_GRID_VIEW.value)
verify(grid_view_displayed, "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")

View File

@ -54,6 +54,7 @@ chatView_chatMembers_ListView = {"container": statusDesktop_mainWindow, "objectN
# Stickers Popup
chat_StickersPopup_GetStickers_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "stickersPopupGetStickersButton", "type": "StatusButton", "visible": True}
chat_StickersPopup_Retry_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "stickersPopupRetryButton", "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}

View File

@ -160,8 +160,8 @@ Feature: Status Desktop Chat Basic Flows
Then the last chat message contains "🙂"
And the last chat message contains "Hello"
@mayfail
# TODO: It works standalone but when it runs as part of the sequence and mostly in the CI, the action of verification doesn't work.
@mayfail
# NOTE: It may be flaky due to undeterministic network conditions and 3rd party infura response.
Scenario: The user can send a sticker after installing a free pack
Given the user installs the sticker pack at position 4
When the user sends the sticker at position 2 in the list

View File

@ -103,6 +103,26 @@ Popup {
active: d.stickerPacksLoading
sourceComponent: loadingImageComponent
}
ColumnLayout {
id: failedToLoadStickersInfo
anchors.centerIn: parent
visible: d.stickerPacksLoadFailed
StatusBaseText {
text: qsTr("Failed to load stickers")
color: Theme.palette.dangerColor1
}
StatusButton {
objectName: "stickersPopupRetryButton"
Layout.alignment: Qt.AlignHCenter
text: qsTr("Try again")
onClicked: d.loadStickers()
}
}
}
Item {