From 3b5fe3671730939aa114b03f4f042131753ac90a Mon Sep 17 00:00:00 2001 From: Yevheniia Berdnyk Date: Wed, 6 Dec 2023 15:30:01 +0200 Subject: [PATCH] e2e: added test for edit/delete message when offline --- .../chats/test_public_chat_browsing.py | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/appium/tests/critical/chats/test_public_chat_browsing.py b/test/appium/tests/critical/chats/test_public_chat_browsing.py index 0eb18940c4..406bf7207b 100644 --- a/test/appium/tests/critical/chats/test_public_chat_browsing.py +++ b/test/appium/tests/critical/chats/test_public_chat_browsing.py @@ -4,6 +4,7 @@ import random import emoji import pytest from _pytest.outcomes import Failed +from appium.webdriver.connectiontype import ConnectionType from selenium.common.exceptions import NoSuchElementException, TimeoutException from tests import marks, run_in_parallel, pytest_config_global, transl @@ -769,6 +770,36 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): "New messages badge is shown in community channel element while there are no unread messages") self.errors.verify_no_errors() + @marks.testrail_id(704615) + def test_community_edit_delete_message_when_offline(self): + self.channel_2.just_fyi("Sending messages for edit and delete") + message_to_edit, message_to_delete = "message to edit", "message to delete" + self.channel_2.send_message(message_to_edit) + self.channel_2.send_message(message_to_delete) + self.home_1.navigate_back_to_home_view() + self.home_1.communities_tab.click() + self.home_1.get_chat(self.community_name, community=True).click() + self.community_1.get_channel(self.channel_name).click() + self.channel_1.just_fyi("Receiver is checking if initial messages were delivered") + for message in message_to_edit, message_to_delete: + if not self.channel_2.chat_element_by_text(message).is_element_displayed(30): + self.channel_2.driver.fail("Message '%s' was not received") + + self.channel_2.just_fyi("Turning on airplane mode and editing/deleting messages") + self.channel_2.driver.set_network_connection(ConnectionType.AIRPLANE_MODE) + message_after_edit = "text after edit" + self.channel_2.edit_message_in_chat(message_to_edit, message_after_edit) + self.channel_2.delete_message_in_chat(message_to_delete) + self.channel_2.just_fyi("Turning on network connection") + self.channel_2.driver.set_network_connection(ConnectionType.ALL_NETWORK_ON) + + self.channel_1.just_fyi("Receiver is checking if messages were updated and deleted") + if not self.channel_1.chat_element_by_text(message_after_edit).is_element_displayed(30): + self.errors.append("Updated message '%s' is not delivered to the receiver" % message_after_edit) + if not self.channel_1.chat_element_by_text(message_to_delete).is_element_disappeared(): + self.errors.append("Message '%s' was not deleted for the receiver" % message_to_delete) + self.errors.verify_no_errors() + @pytest.mark.xdist_group(name="new_five_2") @marks.new_ui_critical