From 6093d56c90f08a65085fbb2f548b92099c969e8a Mon Sep 17 00:00:00 2001 From: Yevheniia Berdnyk Date: Thu, 7 Dec 2023 16:30:39 +0200 Subject: [PATCH] e2e: increased wait time for PN and CR --- .../tests/critical/chats/test_1_1_public_chats.py | 2 +- .../appium/tests/critical/chats/test_group_chat.py | 12 +++++++----- .../critical/chats/test_public_chat_browsing.py | 14 +++++++------- test/appium/views/base_element.py | 1 + 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/test/appium/tests/critical/chats/test_1_1_public_chats.py b/test/appium/tests/critical/chats/test_1_1_public_chats.py index 3eb98247f0..337e833b53 100644 --- a/test/appium/tests/critical/chats/test_1_1_public_chats.py +++ b/test/appium/tests/critical/chats/test_1_1_public_chats.py @@ -353,7 +353,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): chat_1 = self.device_1.click_upon_push_notification_by_text(emoji_unicode) self.device_1.just_fyi("Check Device 1 is actually on chat") - if not (chat_1.element_by_text_part(message).is_element_displayed() + if not (chat_1.element_by_text_part(message).is_element_displayed(15) and chat_1.element_by_text_part(emoji_unicode).is_element_displayed()): self.device_1.driver.fail("Failed to open chat view after tap on PN") diff --git a/test/appium/tests/critical/chats/test_group_chat.py b/test/appium/tests/critical/chats/test_group_chat.py index 8916ee1488..386293fdaa 100644 --- a/test/appium/tests/critical/chats/test_group_chat.py +++ b/test/appium/tests/critical/chats/test_group_chat.py @@ -410,15 +410,17 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): self.homes[1].mute_chat_long_press(self.chat_name, "mute-for-1-hour") device_time = self.homes[1].driver.device_time current_time = datetime.datetime.strptime(device_time, "%Y-%m-%dT%H:%M:%S%z") - expected_time = current_time + datetime.timedelta(minutes=60) - expected_text = "Muted until %s %s" % ( - expected_time.strftime('%H:%M'), "today" if current_time.hour < 23 else "tomorrow") + expected_times = [current_time + datetime.timedelta(minutes=i) for i in range(59, 62)] + expected_texts = [ + "Muted until %s %s" % (exp_time.strftime('%H:%M'), "today" if current_time.hour < 23 else "tomorrow") for + exp_time in expected_times] chat = self.homes[1].get_chat(self.chat_name) chat.long_press_element() if self.homes[1].mute_chat_button.text != transl["unmute-chat"]: pytest.fail("Chat is not muted") - if not self.homes[1].element_by_text(expected_text).is_element_displayed(): - self.errors.append("Text '%s' is not shown for muted chat" % expected_text) + current_text = self.homes[1].mute_chat_button.unmute_caption_text + if current_text not in expected_texts: + self.errors.append("Text '%s' is not shown for muted chat" % expected_texts[1]) self.homes[1].click_system_back_button() try: initial_counter = int(self.homes[1].chats_tab.counter.text) 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 406bf7207b..7a38432736 100644 --- a/test/appium/tests/critical/chats/test_public_chat_browsing.py +++ b/test/appium/tests/critical/chats/test_public_chat_browsing.py @@ -165,22 +165,22 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase): community_channel=True) device_time = self.home.driver.device_time current_time = datetime.datetime.strptime(device_time, "%Y-%m-%dT%H:%M:%S%z") - expected_time = current_time + datetime.timedelta(days=7) - expected_text = "Muted until %s" % expected_time.strftime('%H:%M %a %-d %b') + expected_times = [current_time + datetime.timedelta(days=7, minutes=i) for i in range(-1, 2)] + expected_texts = ["Muted until %s" % exp_time.strftime('%H:%M %a %-d %b') for exp_time in expected_times] self.community_view.get_channel(self.channel_name).long_press_element() self.home.mute_channel_button.wait_for_visibility_of_element() try: current_text = self.home.mute_channel_button.unmute_caption_text - if current_text != expected_text: - self.errors.append("Text '%s' is not shown for a muted community channel" % expected_text) + if current_text not in expected_texts: + self.errors.append("Text '%s' is not shown for a muted community channel" % expected_texts[1]) except NoSuchElementException: - self.errors.append("Caption with text '%s' is not shown for a muted community channel" % expected_text) + self.errors.append("Caption with text '%s' is not shown for a muted community channel" % expected_texts[1]) self.home.click_system_back_button() self.home.navigate_back_to_home_view() self.home.communities_tab.click() self.home.get_chat(self.community_name, community=True).long_press_element() - if self.home.element_by_text(expected_text).is_element_displayed() or self.home.mute_community_button.text != \ - transl["mute-community"]: + if self.home.element_by_text_part("Muted until").is_element_displayed() or \ + self.home.mute_community_button.text != transl["mute-community"]: self.errors.append("Community is muted when channel is muted") self.home.click_system_back_button() diff --git a/test/appium/views/base_element.py b/test/appium/views/base_element.py index aaf9e7386e..08af6fff36 100644 --- a/test/appium/views/base_element.py +++ b/test/appium/views/base_element.py @@ -152,6 +152,7 @@ class BaseElement(object): def wait_for_rendering_ended_and_click(self, attempts=3): for i in range(attempts): try: + self.wait_for_visibility_of_element(20) self.click() self.driver.info("Attempt %s is successful clicking %s" % (i, self.locator)) return