e2e: added check for deleted 1-1 chat history

This commit is contained in:
Yevheniia Berdnyk 2024-01-06 01:31:12 +02:00
parent f992f4addd
commit 4c4ba97308
No known key found for this signature in database
GPG Key ID: 0642C73C66214825
4 changed files with 38 additions and 7 deletions

View File

@ -149,8 +149,9 @@
[{:keys [content chat-id edited-at style-override on-layout]}] [{:keys [content chat-id edited-at style-override on-layout]}]
^{:key (:parsed-text content)} ^{:key (:parsed-text content)}
[rn/view [rn/view
{:style style-override {:style style-override
:on-layout on-layout} :on-layout on-layout
:accessibility-label :message-text-content}
(reduce (fn [acc e] (reduce (fn [acc e]
(render-block acc e chat-id style-override)) (render-block acc e chat-id style-override))
[:<>] [:<>]

View File

@ -654,13 +654,35 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase
def test_1_1_chat_delete_via_long_press_relogin(self): def test_1_1_chat_delete_via_long_press_relogin(self):
self.home_2.navigate_back_to_home_view() self.home_2.navigate_back_to_home_view()
self.home_2.chats_tab.click() self.home_2.chats_tab.click()
self.home_2.get_chat(self.username_1).click()
self.home_2.just_fyi("Getting chat history")
chat_history = list()
for element in self.chat_2.chat_element_by_text(text='').message_text_content.find_elements():
chat_history.append(element.text)
if not chat_history:
self.errors.append("No chat history was loaded")
self.home_2.just_fyi("Deleting chat via delete button and check it will not reappear after relaunching app") self.home_2.just_fyi("Deleting chat via delete button and check it will not reappear after relaunching app")
self.home_2.navigate_back_to_home_view()
self.home_2.chats_tab.click()
self.home_2.delete_chat_long_press(username=self.username_1) self.home_2.delete_chat_long_press(username=self.username_1)
if self.home_2.get_chat_from_home_view(self.username_1).is_element_displayed(): chat = self.home_2.get_chat_from_home_view(self.username_1)
if chat.is_element_displayed():
self.errors.append("Deleted '%s' chat is shown, but the chat has been deleted" % self.username_1) self.errors.append("Deleted '%s' chat is shown, but the chat has been deleted" % self.username_1)
self.home_2.reopen_app() self.home_2.reopen_app()
if self.home_2.get_chat_from_home_view(self.username_1).is_element_displayed(15): if chat.is_element_displayed(15):
self.errors.append( self.errors.append(
"Deleted chat '%s' is shown after re-login, but the chat has been deleted" % self.username_1) "Deleted chat '%s' is shown after re-login, but the chat has been deleted" % self.username_1)
chat.click()
else:
self.home_2.contacts_tab.click()
chat.click()
self.chat_2.profile_send_message_button.click()
lost_messages = list()
for message_text in chat_history:
if not self.chat_2.chat_element_by_text(message_text).is_element_displayed():
lost_messages.append(message_text)
if lost_messages:
self.errors.append("Message(s) missed in 1-1 chat after deleting the chat and relogin: %s" % lost_messages)
self.errors.verify_no_errors() self.errors.verify_no_errors()

View File

@ -325,6 +325,13 @@ class ChatElementByText(Text):
return PinnedByLabelText(self.driver, self.locator) return PinnedByLabelText(self.driver, self.locator)
@property
def message_text_content(self):
return Text(
self.driver,
xpath="//%s//*[@content-desc='message-text-content']/android.widget.TextView" % self.chat_item_locator
)
class UsernameOptions(Button): class UsernameOptions(Button):
def __init__(self, driver, username): def __init__(self, driver, username):

View File

@ -348,7 +348,6 @@ class ProfileView(BaseView):
self.node_version_text = Text(self.driver, self.node_version_text = Text(self.driver,
xpath="//*[@content-desc='node-version']//android.widget.TextView[2]") xpath="//*[@content-desc='node-version']//android.widget.TextView[2]")
# Logout # Logout
self.logout_button = LogoutButton(self.driver) self.logout_button = LogoutButton(self.driver)
self.logout_dialog = LogoutDialog(self.driver) self.logout_dialog = LogoutDialog(self.driver)
@ -356,7 +355,8 @@ class ProfileView(BaseView):
# New profile # New profile
self.profile_password_button = Button(self.driver, accessibility_id="icon, Password, label-component, icon") self.profile_password_button = Button(self.driver, accessibility_id="icon, Password, label-component, icon")
self.profile_legacy_button = Button(self.driver, accessibility_id="icon, Legacy settings, label-component, icon") self.profile_legacy_button = Button(self.driver,
accessibility_id="icon, Legacy settings, label-component, icon")
def switch_network(self, network='Mainnet with upstream RPC'): def switch_network(self, network='Mainnet with upstream RPC'):
self.driver.info("## Switch network to '%s'" % network, device=False) self.driver.info("## Switch network to '%s'" % network, device=False)
@ -439,7 +439,8 @@ class ProfileView(BaseView):
if not AbstractTestCase().environment == 'sauce': if not AbstractTestCase().environment == 'sauce':
raise NotImplementedError('Test case is implemented to run on SauceLabs only') raise NotImplementedError('Test case is implemented to run on SauceLabs only')
## pointing to legacy profile until new feature is implemented ## pointing to legacy profile until new feature is implemented
self.profile_legacy_button.scroll_and_click() self.logout_button.scroll_to_element()
self.profile_legacy_button.click()
self.profile_picture.click() self.profile_picture.click()
if update_by == "Gallery": if update_by == "Gallery":
self.select_from_gallery_button.click() self.select_from_gallery_button.click()