fix(@desktop/tests): Fixing gif and image unfirling scenarios
Fix #7912
This commit is contained in:
parent
5d19667f2d
commit
0da0360beb
|
@ -172,6 +172,10 @@ def scroll_obj_by_name(objName: str):
|
|||
obj = squish.waitForObject(getattr(names, objName))
|
||||
squish.mouseWheel(obj, 206, 35, 0, -1, squish.Qt.ControlModifier)
|
||||
|
||||
def reset_scroll_obj_by_name(objName: str):
|
||||
obj = squish.waitForObject(getattr(names, objName))
|
||||
obj.contentY = 0
|
||||
|
||||
# execute do_fn until validation_fn returns True or timeout is reached
|
||||
def do_until_validation_with_timeout(do_fn, validation_fn, message: str, timeout_ms: int=_MAX_WAIT_OBJ_TIMEOUT * 2):
|
||||
start_time = time.time()
|
||||
|
|
|
@ -16,6 +16,7 @@ import string
|
|||
from wsgiref import validate
|
||||
from drivers.SquishDriver import *
|
||||
from drivers.SquishDriverVerification import *
|
||||
from utils.ObjectAccess import *
|
||||
from .StatusMainScreen import MainScreenComponents
|
||||
from .StatusMainScreen import StatusMainScreen
|
||||
|
||||
|
@ -48,6 +49,7 @@ class ENSScreen(Enum):
|
|||
|
||||
class MessagingOptionScreen(Enum):
|
||||
ACTIVATE_OR_DEACTIVATE_LINK_PREVIEW: str = "displayMessageLinkPreviewItem"
|
||||
LINK_PREVIEW_SWITCH: str = "linkPreviewSwitch"
|
||||
ACTIVATE_OR_DECTIVATE_IMAGE_UNFURLING: str = "imageUnfurlingItem"
|
||||
TENOR_GIFS_PREVIEW_SWITCH_ITEM: str = "tenorGifsPreviewSwitchItem"
|
||||
SCROLLVIEW: str = "settingsContentBase_ScrollView"
|
||||
|
@ -160,21 +162,26 @@ class SettingsScreen:
|
|||
def open_messaging_settings(self):
|
||||
click_obj_by_name(SidebarComponents.MESSAGING_ITEM.value)
|
||||
|
||||
def activate_link_preview(self):
|
||||
# if link preview is activated do nothing
|
||||
def activate_link_preview_if_dectivated(self):
|
||||
click_obj_by_name(SidebarComponents.MESSAGING_ITEM.value)
|
||||
scroll_item_until_item_is_visible(MessagingOptionScreen.SCROLLVIEW.value, MessagingOptionScreen.ACTIVATE_OR_DEACTIVATE_LINK_PREVIEW.value)
|
||||
click_obj_by_name(MessagingOptionScreen.ACTIVATE_OR_DEACTIVATE_LINK_PREVIEW.value)
|
||||
# view can be scrolled down, we need to reset scroll
|
||||
reset_scroll_obj_by_name(MessagingOptionScreen.SCROLLVIEW.value)
|
||||
scroll_item_until_item_is_visible(MessagingOptionScreen.SCROLLVIEW.value, MessagingOptionScreen.LINK_PREVIEW_SWITCH.value)
|
||||
switch = wait_and_get_obj(MessagingOptionScreen.LINK_PREVIEW_SWITCH.value)
|
||||
if not switch.checked:
|
||||
click_obj_by_name(MessagingOptionScreen.LINK_PREVIEW_SWITCH.value)
|
||||
|
||||
# Post condition: Messaging Settings and Link Preview are visible (@see open_messaging_settings and activate_link_preview)
|
||||
# Post condition: Messaging Settings is active and Link Preview is activated (@see open_messaging_settings and activate_link_preview_if_dectivated)
|
||||
def activate_image_unfurling(self):
|
||||
scroll_item_until_item_is_visible(MessagingOptionScreen.SCROLLVIEW.value, MessagingOptionScreen.ACTIVATE_OR_DECTIVATE_IMAGE_UNFURLING.value)
|
||||
click_obj_by_name(MessagingOptionScreen.ACTIVATE_OR_DECTIVATE_IMAGE_UNFURLING.value)
|
||||
|
||||
# Post condition: Messaging Settings and Link Preview are visible (@see open_messaging_settings and activate_link_preview)
|
||||
def check_tenor_gif_preview_is_enabled(self):
|
||||
# Post condition: Messaging Settings is active and Link Preview is activated (@see open_messaging_settings and activate_link_preview_if_dectivated)
|
||||
def the_user_activates_tenor_gif_preview(self):
|
||||
click_obj_by_name(SidebarComponents.MESSAGING_ITEM.value)
|
||||
scroll_item_until_item_is_visible(MessagingOptionScreen.SCROLLVIEW.value, MessagingOptionScreen.TENOR_GIFS_PREVIEW_SWITCH_ITEM.value)
|
||||
tenorSwitch = wait_and_get_obj(MessagingOptionScreen.TENOR_GIFS_PREVIEW_SWITCH_ITEM.value)
|
||||
verify(tenorSwitch.enabled, "Tenor GIFs preview is enabled")
|
||||
click_obj_by_name(MessagingOptionScreen.TENOR_GIFS_PREVIEW_SWITCH_ITEM.value)
|
||||
|
||||
def toggle_test_networks(self):
|
||||
# needed cause if we do it immmediately the toggle doesn't work
|
||||
|
|
|
@ -38,7 +38,7 @@ class StatusAccountsScreen():
|
|||
account_obj = None
|
||||
[is_loaded, accountsList] = is_loaded_visible_and_enabled(SAccountsComponents.ACCOUNTS_POPUP.value)
|
||||
if is_loaded:
|
||||
for child in getChildrenOfType(accountsList, "AccountMenuItemPanel"):
|
||||
for child in get_children_of_type(accountsList, "AccountMenuItemPanel"):
|
||||
if(child.label == account):
|
||||
account_obj = child
|
||||
found = True
|
||||
|
|
|
@ -374,24 +374,15 @@ class StatusChatScreen:
|
|||
last_message_obj = self.get_message_at_index(0)
|
||||
verify(bool(last_message_obj.isEdited), "Message is not marked as edited")
|
||||
|
||||
def verify_last_message_sent(self, message: str):
|
||||
# Get the message text
|
||||
# We don't search for StatusTextMessage_chatText directly, because there're 2 instances of it in a reply message
|
||||
def get_last_message_text(self):
|
||||
last_message_obj = self.get_message_at_index(0)
|
||||
text_message_obj = get_children_with_object_name(last_message_obj, ChatItems.STATUS_MESSAGE_TEXT_MESSAGE.value)[0]
|
||||
text_edit_obj = get_children_with_object_name(text_message_obj, ChatItems.STATUS_TEXT_MESSAGE_CHAT_TEXT.value)[0]
|
||||
verify(not is_null(text_edit_obj), "Checking last message sent: " + message)
|
||||
verify_text_contains(str(text_edit_obj.text), str(message))
|
||||
return last_message_obj.messageText
|
||||
|
||||
def verify_last_message_sent(self, message: str):
|
||||
verify_text_contains(str(self.get_last_message_text()), str(message))
|
||||
|
||||
def verify_last_message_sent_is_not(self, message: str):
|
||||
last_message_obj = self.get_message_at_index(0)
|
||||
text_message_objs = get_children_with_object_name(last_message_obj, ChatItems.STATUS_MESSAGE_TEXT_MESSAGE.value)
|
||||
if len(text_message_objs) == 0:
|
||||
passes("Success: No message was found")
|
||||
return
|
||||
text_edit_obj = get_children_with_object_name(text_message_objs[0], ChatItems.STATUS_TEXT_MESSAGE_CHAT_TEXT.value)[0]
|
||||
verify(not is_null(text_edit_obj), "Checking last message sent: " + message)
|
||||
verify_text_does_not_contain(str(text_edit_obj.text), str(message))
|
||||
verify_text_does_not_contain(str(self.get_last_message_text()), str(message))
|
||||
|
||||
# This method expects to have just one mention / link in the last chat message
|
||||
def verify_last_message_sent_contains_mention(self, displayName: str, message: str):
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import squish
|
||||
import object
|
||||
|
||||
def getChildrenOfType(parent, typename, depth=1000):
|
||||
def get_children_of_type(parent, typename, depth=1000):
|
||||
children = []
|
||||
for child in object.children(parent):
|
||||
if squish.className(child) == typename:
|
||||
children.append(child)
|
||||
if depth:
|
||||
children.extend(getChildrenOfType(child, typename, depth - 1))
|
||||
children.extend(get_children_of_type(child, typename, depth - 1))
|
||||
return children
|
||||
|
||||
def get_children_with_object_name(parent, objectName, depth=1000):
|
||||
|
|
|
@ -89,6 +89,7 @@ generatedAccounts_ListView = {"container": statusDesktop_mainWindow, "objectName
|
|||
# Messaging Settings:
|
||||
settingsContentBase_ScrollView = {"container": statusDesktop_mainWindow, "objectName": "settingsContentBaseScrollView", "type": "StatusScrollView", "visible": True}
|
||||
displayMessageLinkPreviewItem = {"container": statusDesktop_mainWindow, "objectName": "displayMessageLinkPreviewsItem", "type": "StatusListItem"}
|
||||
linkPreviewSwitch = {"container": statusDesktop_mainWindow, "objectName": "MessagingView_showMessageLinksSwitch", "type": "StatusSwitch", "visible": True}
|
||||
imageUnfurlingItem = {"container": statusDesktop_mainWindow, "objectName": "imageUnfurlingItem", "type": "StatusListItem"}
|
||||
tenorGifsPreviewSwitchItem = {"container": statusDesktop_mainWindow, "objectName": "MessagingView_sitesListView_StatusListItem_tenor_gifs_subdomain", "type": "StatusListItem"}
|
||||
contacts_listItem_btn = {"container": statusDesktop_mainWindow, "objectName": "MessagingView_ContactsListItem_btn", "type": "StatusContactRequestsIndicatorListItem"}
|
||||
|
|
|
@ -19,11 +19,7 @@ def step(context: any):
|
|||
@Given("the user opens the messaging settings")
|
||||
def step(context: any):
|
||||
the_user_opens_the_messaging_settings()
|
||||
|
||||
@Given("tenor GIFs preview is enabled")
|
||||
def step(context: any):
|
||||
_settingsScreen.check_tenor_gif_preview_is_enabled()
|
||||
|
||||
|
||||
@Given("the user activates wallet and opens the wallet section")
|
||||
def step(context: any):
|
||||
init_steps.the_user_activates_wallet_and_opens_the_wallet_section()
|
||||
|
@ -39,11 +35,20 @@ def step(context: any):
|
|||
@Given("the user opens the wallet settings")
|
||||
def step(context: any):
|
||||
the_user_opens_the_wallet_settings()
|
||||
|
||||
|
||||
#########################
|
||||
### ACTIONS region:
|
||||
#########################
|
||||
|
||||
@When("the user activates the link preview if it is deactivated")
|
||||
def step(context: any):
|
||||
_settingsScreen.activate_link_preview_if_dectivated()
|
||||
|
||||
@When("the user activates tenor GIFs preview")
|
||||
def step(context: any):
|
||||
_settingsScreen.the_user_activates_tenor_gif_preview()
|
||||
|
||||
@When("the user opens app settings screen")
|
||||
def step(context: any):
|
||||
the_user_opens_app_settings_screen()
|
||||
|
@ -52,10 +57,6 @@ def step(context: any):
|
|||
def step(context: any):
|
||||
the_user_opens_the_messaging_settings()
|
||||
|
||||
@When("the user activates link preview")
|
||||
def step(context: any):
|
||||
_settingsScreen.activate_link_preview()
|
||||
|
||||
@When("the user activates image unfurling")
|
||||
def step(context: any):
|
||||
_settingsScreen.activate_image_unfurling()
|
||||
|
|
|
@ -207,7 +207,7 @@ def step(context):
|
|||
|
||||
@Then("the GIF message is displayed")
|
||||
def step(context):
|
||||
_statusChat.verify_last_message_sent("tenor.gif")
|
||||
_statusChat.verify_last_message_sent("tenor.com")
|
||||
|
||||
@Then("the image |any| is unfurled in the chat")
|
||||
def step(context: any, image_link: str):
|
||||
|
|
|
@ -64,23 +64,21 @@ Feature: Status Desktop Chat Basic Flows
|
|||
When the user clears chat history
|
||||
Then the chat is cleared
|
||||
|
||||
@mayfail
|
||||
# TODO: Verification of gif sent fails. And also `tenor GIFs preview is enabled` step doesn't work. Review it.
|
||||
Scenario: The user can send a GIF
|
||||
Given the user opens app settings screen
|
||||
And the user opens the messaging settings
|
||||
And tenor GIFs preview is enabled
|
||||
When the user sends a GIF message
|
||||
When the user activates the link preview if it is deactivated
|
||||
And the user activates tenor GIFs preview
|
||||
And the user opens the chat section
|
||||
And the user sends a GIF message
|
||||
Then the GIF message is displayed
|
||||
|
||||
@mayfail
|
||||
# TODO: It works standalone but when it runs as part of the sequence, the action of activates link preview doesn't work.
|
||||
Scenario Outline: The user can activate image unfurling
|
||||
Given the user sends a chat message "<image_url>"
|
||||
And the image "<image_url>" is not unfurled in the chat
|
||||
When the user opens app settings screen
|
||||
And the user opens app settings screen
|
||||
And the user opens the messaging settings
|
||||
And the user activates link preview
|
||||
When the user activates the link preview if it is deactivated
|
||||
And the user activates image unfurling
|
||||
And the user opens the chat section
|
||||
Then the image "<image_url>" is unfurled in the chat
|
||||
|
|
|
@ -170,6 +170,7 @@ SettingsContentBase {
|
|||
components: [
|
||||
StatusSwitch {
|
||||
id: showMessageLinksSwitch
|
||||
objectName: "MessagingView_showMessageLinksSwitch"
|
||||
checked: previewableSites.anyWhitelisted || localAccountSensitiveSettings.displayChatImages
|
||||
onToggled: {
|
||||
if (!checked) {
|
||||
|
|
Loading…
Reference in New Issue