Skip to content

Commit 3b5fe36

Browse files
committed
e2e: added test for edit/delete message when offline
1 parent 03444ae commit 3b5fe36

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/appium/tests/critical/chats/test_public_chat_browsing.py

+31
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import emoji
55
import pytest
66
from _pytest.outcomes import Failed
7+
from appium.webdriver.connectiontype import ConnectionType
78
from selenium.common.exceptions import NoSuchElementException, TimeoutException
89

910
from tests import marks, run_in_parallel, pytest_config_global, transl
@@ -769,6 +770,36 @@ def test_community_mark_all_messages_as_read(self):
769770
"New messages badge is shown in community channel element while there are no unread messages")
770771
self.errors.verify_no_errors()
771772

773+
@marks.testrail_id(704615)
774+
def test_community_edit_delete_message_when_offline(self):
775+
self.channel_2.just_fyi("Sending messages for edit and delete")
776+
message_to_edit, message_to_delete = "message to edit", "message to delete"
777+
self.channel_2.send_message(message_to_edit)
778+
self.channel_2.send_message(message_to_delete)
779+
self.home_1.navigate_back_to_home_view()
780+
self.home_1.communities_tab.click()
781+
self.home_1.get_chat(self.community_name, community=True).click()
782+
self.community_1.get_channel(self.channel_name).click()
783+
self.channel_1.just_fyi("Receiver is checking if initial messages were delivered")
784+
for message in message_to_edit, message_to_delete:
785+
if not self.channel_2.chat_element_by_text(message).is_element_displayed(30):
786+
self.channel_2.driver.fail("Message '%s' was not received")
787+
788+
self.channel_2.just_fyi("Turning on airplane mode and editing/deleting messages")
789+
self.channel_2.driver.set_network_connection(ConnectionType.AIRPLANE_MODE)
790+
message_after_edit = "text after edit"
791+
self.channel_2.edit_message_in_chat(message_to_edit, message_after_edit)
792+
self.channel_2.delete_message_in_chat(message_to_delete)
793+
self.channel_2.just_fyi("Turning on network connection")
794+
self.channel_2.driver.set_network_connection(ConnectionType.ALL_NETWORK_ON)
795+
796+
self.channel_1.just_fyi("Receiver is checking if messages were updated and deleted")
797+
if not self.channel_1.chat_element_by_text(message_after_edit).is_element_displayed(30):
798+
self.errors.append("Updated message '%s' is not delivered to the receiver" % message_after_edit)
799+
if not self.channel_1.chat_element_by_text(message_to_delete).is_element_disappeared():
800+
self.errors.append("Message '%s' was not deleted for the receiver" % message_to_delete)
801+
self.errors.verify_no_errors()
802+
772803

773804
@pytest.mark.xdist_group(name="new_five_2")
774805
@marks.new_ui_critical

0 commit comments

Comments
 (0)