Compare commits

...
Author SHA1 Message Date
pavloburykh 99ccf59b0a moved test_chat_gap to 1_1 medium group 2022-05-12 12:40:25 +03:00
pavloburykh 4efa75b758 e2e: refactoring 2022-05-11 15:14:14 +03:00
3 changed files with 118 additions and 116 deletions
@@ -219,14 +219,62 @@ class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase):
cls.home_1 = cls.device_1.create_user(enable_notifications=True)
cls.home_2 = cls.device_2.create_user(enable_notifications=True)
cls.profile_1 = cls.home_1.profile_button.click()
cls.default_username_1 = cls.profile_1.default_username_text.text
cls.public_key_1, cls.default_username_1 = cls.profile_1.get_public_key_and_username(return_username=True)
cls.profile_1.home_button.click()
cls.profile_2 = cls.home_2.profile_button.click()
cls.default_username_2 = cls.profile_2.default_username_text.text
cls.profile_2.home_button.click()
cls.public_key_2, cls.default_username_2 = cls.home_2.get_public_key_and_username(return_username=True)
cls.chat_1 = cls.home_1.add_contact(cls.public_key_2)
cls.chat_1.send_message('hey')
cls.home_2.home_button.double_click()
cls.chat_2 = cls.home_2.get_chat(cls.default_username_1).click()
@marks.testrail_id(702267)
def test_1_1_chat_unread_counter_preview_highlited(self):
self.chat_2.get_back_to_home_view()
message_1, message_2 = 'test message2', 'test'
chat_element = self.home_2.get_chat(self.default_username_1)
self.home_2.dapp_tab_button.click()
self.chat_1.send_message(message_1)
if self.home_2.home_button.counter.text != '1':
self.errors.append('New messages counter is not shown on Home button')
self.device_2.home_button.click()
if chat_element.new_messages_counter.text != '1':
self.errors.append('New messages counter is not shown on chat element')
chat_2 = chat_element.click()
chat_2.add_to_contacts.click()
self.home_2.home_button.double_click()
if self.home_2.home_button.counter.is_element_displayed():
self.errors.append('New messages counter is shown on Home button for already seen message')
if chat_element.new_messages_counter.text == '1':
self.errors.append('New messages counter is shown on chat element for already seen message')
self.home_2.delete_chat_long_press(self.default_username_1)
self.home_2.just_fyi("Checking preview of message and chat highlighting")
self.chat_1.send_message(message_2)
chat_2_element = self.home_2.get_chat(self.default_username_1)
if chat_2_element.chat_preview.is_element_differs_from_template('highligted_preview.png', 0):
self.errors.append("Preview message is not hightligted or text is not shown! ")
self.home_2.get_chat(self.default_username_1).click()
self.home_2.home_button.double_click()
if not self.home_2.get_chat(self.default_username_1).chat_preview.is_element_differs_from_template(
'highligted_preview.png', 0):
self.errors.append("Preview message is still highlighted after opening ")
self.home_2.just_fyi("Removing user from contacts for the case 5315")
chat_element.click()
chat_2.chat_options.click()
chat_2.view_profile_button.click()
chat_2.remove_from_contacts.click()
chat_2.get_back_to_home_view()
self.errors.verify_no_errors()
@marks.testrail_id(6315)
def test_1_1_chat_message_reaction(self):
message_from_sender = "Message sender"
@@ -238,6 +286,7 @@ class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase):
self.errors.append("Counter of reaction is not updated on your own message!")
self.device_2.just_fyi("Receiver set own emoji and verifies counter on received message in 1-1 chat")
self.home_2.get_chat(self.default_username_1).click()
message_receiver = self.chat_2.chat_element_by_text(message_from_sender)
if message_receiver.emojis_below_message(own=False) != 1:
self.errors.append("Counter of reaction is not updated on received message!")
@@ -1,4 +1,5 @@
import random
import time
from time import sleep
import emoji
import pytest
@@ -174,9 +175,76 @@ class TestChatMultipleDevice(MultipleSharedDeviceTestCase):
cls.message_1, cls.message_2, cls.message_3, cls.message_4 = "Message1", "Message2", "Message3", "Message4"
@marks.testrail_id(702268)
def test_chat_gap_in_public_and_no_gap_in_1_1_and_group(self):
self.home_2.get_back_to_home_view()
message_1 = "testing gap"
message_2 = "testing no gap"
profile_1 = self.home_1.profile_button.click()
profile_1.sync_settings_button.click()
profile_1.sync_history_for_button.click()
profile_1.element_by_translation_id("two-minutes").click()
[home.home_button.click() for home in (self.home_1, self.home_2)]
self.home_1.just_fyi("Creating 1-1 chat and sending message from device 1")
self.chat_1.send_message("HI")
self.home_1.get_back_to_home_view()
self.home_1.just_fyi("Creating group chat and sending message from device 1")
group_chat_1 = self.home_1.get_chat(self.initial_group_chat_name).click()
group_chat_1.send_message("HI")
self.home_1.get_back_to_home_view()
self.home_1.just_fyi("Creating public chat and sending message from device 1")
pub_chat_1 = self.home_1.get_chat('#' + self.public_chat_name).click()
pub_chat_1.send_message("HI")
self.device_1.toggle_airplane_mode()
self.home_2.just_fyi("Joining public chat by device 2 and sending message")
pub_chat_2 = self.home_2.get_chat('#' + self.public_chat_name).click()
pub_chat_2.send_message(message_1)
self.home_2.get_back_to_home_view()
self.home_2.just_fyi("Joining 1-1 chat by device 2 and sending message")
one_to_one_chat_2 = self.home_2.get_chat(self.default_username_1).click()
one_to_one_chat_2.send_message(message_2)
self.home_2.get_back_to_home_view()
self.home_2.just_fyi("Joining Group chat by device 2 and sending message")
group_chat_2 = self.home_2.get_chat(self.initial_group_chat_name).click()
group_chat_2.send_message(message_2)
group_chat_2.get_back_to_home_view()
# Waiting for 3 minutes and then going back online
time.sleep(180)
self.device_1.toggle_airplane_mode()
self.home_1.just_fyi("Checking gap in public chat and fetching messages")
if pub_chat_1.chat_element_by_text(message_1).is_element_displayed(10):
self.errors.append("Test message has been fetched automatically")
pub_chat_1.element_by_translation_id("fetch-messages").wait_and_click(60)
if not pub_chat_1.chat_element_by_text(message_1).is_element_displayed(10):
self.errors.append("Test message has not been fetched")
self.home_1.get_back_to_home_view()
self.home_1.just_fyi("Checking that there is no gap in 1-1/group chat and messages fetched automatically")
for chat in [self.home_1.get_chat(self.default_username_2), self.home_1.get_chat(self.initial_group_chat_name)]:
chat_view = chat.click()
if chat_view.element_by_translation_id("fetch-messages").is_element_displayed(10):
self.errors.append("Fetch messages button is displayed in {}} chat".format(chat.user_name_text.text))
if not chat_view.chat_element_by_text(message_2).is_element_displayed(10):
self.errors.append(
"Message in {} chat has not been fetched automatically".format(chat.user_name_text.text))
chat_view.back_button.click()
self.errors.verify_no_errors()
@marks.testrail_id(702066)
def test_chat_1_1_push_and_reaction_for_messages_sticker_audio_image(self):
self.home_1.get_chat(self.default_username_2).click()
self.home_2.get_chat(self.default_username_1).click()
# methods with steps to use later in loop
def navigate_to_start_state_of_both_devices():
self.chat_1.put_app_to_background()
@@ -292,121 +292,6 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(5362)
# TODO: can be moved to TestOneToOneChatMultipleSharedDevices - should be quick e2e
def test_1_1_chat_unread_counter_preview_highlited(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user()
profile_2 = home_2.profile_button.click()
default_username_2 = profile_2.default_username_text.text
home_2 = profile_2.home_button.click()
public_key_1 = home_1.get_public_key_and_username()
home_1.home_button.click()
chat_2 = home_2.add_contact(public_key_1)
message, message_2, message_3 = 'test message', 'test message2', 'test'
chat_2.send_message(message)
chat_element = home_1.get_chat(default_username_2)
home_1.dapp_tab_button.click()
chat_2.send_message(message_2)
if home_1.home_button.counter.text != '1':
self.errors.append('New messages counter is not shown on Home button')
device_1.home_button.click()
if chat_element.new_messages_counter.text != '1':
self.errors.append('New messages counter is not shown on chat element')
chat_1 = chat_element.click()
chat_1.add_to_contacts.click()
home_1.home_button.double_click()
if home_1.home_button.counter.is_element_displayed():
self.errors.append('New messages counter is shown on Home button for already seen message')
if chat_element.new_messages_counter.text == '1':
self.errors.append('New messages counter is shown on chat element for already seen message')
home_1.delete_chat_long_press(default_username_2)
home_1.just_fyi("Checking preview of message and chat highlighting")
chat_2.send_message(message_3)
chat_1_element = home_1.get_chat(default_username_2)
if chat_1_element.chat_preview.is_element_differs_from_template('highligted_preview.png', 0):
self.errors.append("Preview message is not hightligted or text is not shown! ")
home_1.get_chat(default_username_2).click()
home_1.home_button.double_click()
if not home_1.get_chat(default_username_2).chat_preview.is_element_differs_from_template('highligted_preview.png', 0):
self.errors.append("Preview message is still highlighted after opening ")
self.errors.verify_no_errors()
@marks.testrail_id(700727)
# TODO: merge with any medium group that contains 3 types of chats
def test_chat_gap_in_public_and_no_gap_in_1_1_and_group(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user()
message_1 = "testing gap"
message_2 = "testing no gap"
pub_chat_name = home_1.get_random_chat_name()
group_chat_name = home_1.get_random_chat_name()
public_key_1, username_1 = home_1.get_public_key_and_username(True)
public_key_2, username_2 = home_2.get_public_key_and_username(True)
profile_1 = home_1.profile_button.click()
profile_1.sync_settings_button.click()
profile_1.sync_history_for_button.click()
profile_1.element_by_translation_id("two-minutes").click()
[home.home_button.click() for home in (home_1, home_2)]
home_1.just_fyi("Creating 1-1 chat and sending message from device 1")
one_to_one_chat_1 = home_1.add_contact(public_key_2)
one_to_one_chat_1.send_message("HI")
home_1.get_back_to_home_view()
home_1.just_fyi("Creating group chat and sending message from device 1")
group_chat_1 = home_1.create_group_chat([username_2], group_chat_name)
group_chat_1.send_message("HI")
home_1.get_back_to_home_view()
home_1.just_fyi("Creating public chat and sending message from device 1")
pub_chat_1, pub_chat_2 = home_1.join_public_chat(pub_chat_name), home_2.join_public_chat(pub_chat_name)
pub_chat_1.send_message("HI")
device_1.toggle_airplane_mode()
home_2.just_fyi("Joining public chat by device 2 and sending message")
pub_chat_2.send_message(message_1)
home_2.get_back_to_home_view()
home_2.just_fyi("Joining 1-1 chat by device 2 and sending message")
one_to_one_chat_2 = home_2.add_contact(public_key_1)
one_to_one_chat_2.send_message(message_2)
home_2.get_back_to_home_view()
home_2.just_fyi("Joining Group chat by device 2 and sending message")
group_chat_2 = home_2.get_chat(group_chat_name).click()
group_chat_2.join_chat_button.click()
group_chat_2.send_message(message_2)
# Waiting for 3 minutes and then going back online
time.sleep(180)
device_1.toggle_airplane_mode()
home_1.just_fyi("Checking gap in public chat and fetching messages")
if pub_chat_1.chat_element_by_text(message_1).is_element_displayed(10):
self.errors.append("Test message has been fetched automatically")
pub_chat_1.element_by_translation_id("fetch-messages").wait_and_click(60)
if not pub_chat_1.chat_element_by_text(message_1).is_element_displayed(10):
self.errors.append("Test message has not been fetched")
home_1.get_back_to_home_view()
home_1.just_fyi("Checking that there is no gap in 1-1/group chat and messages fetched automatically")
for chat in [home_1.get_chat(username_2), home_1.get_chat(group_chat_name)]:
chat_view = chat.click()
if chat_view.element_by_translation_id("fetch-messages").is_element_displayed(10):
self.errors.append("Fetch messages button is displayed in {}} chat".format(chat.user_name_text.text))
if not chat_view.chat_element_by_text(message_2).is_element_displayed(10):
self.errors.append("Message in {} chat has not been fetched automatically".format(chat.user_name_text.text))
chat_view.back_button.click()
self.errors.verify_no_errors()
@marks.testrail_id(695842)
@marks.flaky
def test_community_creating_accept_membership(self):