tests(suite_messaging): add assertion that message was indeed edited

This adds an assertion that checks whethere a message was indeed edited
by checking its `isEdited` property.
This commit is contained in:
Pascal Precht 2022-11-16 13:57:43 +01:00 committed by r4bbit.eth
parent d536634fee
commit 2ba6dc32f6
3 changed files with 7 additions and 4 deletions

View File

@ -196,8 +196,8 @@ class StatusChatScreen:
self.send_message(message)
def edit_message_at_index(self, index: int, message: str):
message_object_to_edit = get_obj(ChatComponents.CHAT_LOG.value).itemAtIndex(int(index))
hover_obj(message_object_to_edit)
message_object_to_edit = wait_and_get_obj(ChatComponents.CHAT_LOG.value).itemAtIndex(int(index))
move_mouse_over_object(message_object_to_edit)
click_obj_by_name(ChatComponents.EDIT_MESSAGE_BUTTON.value)
wait_for_object_and_type(ChatComponents.EDIT_MESSAGE_TEXTAREA.value, "<Ctrl+a>")
type(ChatComponents.EDIT_MESSAGE_TEXTAREA.value, message)
@ -340,6 +340,10 @@ class StatusChatScreen:
verify_values_equal(str(last_message_reply_details_obj.replyDetails.sender.id), str(last_message_obj.senderId), "Message sender ID doesn't match reply message sender ID")
def verify_last_message_is_edited(self, message: str):
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

View File

@ -194,8 +194,8 @@ def step(context, reply, message):
@Then("the chat message \"|any|\" is displayed as an edited one")
def step(context, message):
# TODO: Check last message is an edited one.
_statusChat.verify_last_message_sent(message)
_statusChat.verify_last_message_is_edited(message)
@Then("the last message displayed is not \"|any|\"")
def step(context, message):

View File

@ -39,7 +39,6 @@ Feature: Status Desktop Chat Basic Flows
Scenario Outline: The user can edit a message
Given the user sends a chat message "Edit me"
When the user edits the message at index 0 and changes it to "<edited>"
# TODO: Check last message is an edited one, now just checking the last message is the expected one but could not be an edited one.
Then the chat message "<edited>" is displayed as an edited one
Examples:
| edited |