Compare commits

...
Author SHA1 Message Date
Yevheniia Berdnyk 04a8ae9959 e2e: fixing tests: navigation 2023-08-25 04:09:52 +03:00
7 changed files with 162 additions and 164 deletions
@@ -51,7 +51,7 @@ class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.drivers[0].fail('No message is shown after sending ETH in 1-1 chat for sender')
sender_message.transaction_status.wait_for_element_text(sender_message.address_requested)
chat_2 = self.home_2.get_chat(self.sender['username']).click()
chat_2 = self.home_2.get_one_to_one_chat(self.sender['username']).click()
receiver_message = chat_2.get_incoming_transaction(self.account_name_1)
timestamp_sender = sender_message.timestamp_command_message.text
if not receiver_message.is_element_displayed():
@@ -101,7 +101,7 @@ class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.wallet_2.wait_balance_is_changed()
self.wallet_2.find_transaction_in_history(amount=amount)
self.wallet_2.home_button.click()
self.home_2.get_chat(self.sender['username']).click()
self.home_2.get_one_to_one_chat(self.sender['username']).click()
[message.transaction_status.wait_for_element_text(message.confirmed, 60) for message in
(sender_message, receiver_message)]
@@ -112,7 +112,7 @@ class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase):
def test_1_1_chat_command_decline_eth_push_changing_state(self):
[home.driver.background_app(3) for home in (self.home_1, self.home_2)]
self.home_1.home_button.double_click()
self.home_1.get_chat(username=self.recipient_username).click()
self.home_1.get_one_to_one_chat(username=self.recipient_username).click()
self.home_1.just_fyi('Decline transaction before sharing address and check that state is changed')
self.chat_1.commands_button.click()
@@ -125,7 +125,7 @@ class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.home_1.click_system_home_button()
self.home_2.home_button.double_click()
chat_2 = self.home_2.get_chat(self.sender['username']).click()
chat_2 = self.home_2.get_one_to_one_chat(self.sender['username']).click()
chat_2_receiver_message = chat_2.get_incoming_transaction()
chat_2_receiver_message.decline_transaction.click()
self.home_1.open_notification_bar()
@@ -165,7 +165,7 @@ class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.home_1.driver.close_app()
self.home_2.just_fyi('Request %s STT in 1-1 chat and check it is visible for sender and receiver' % amount)
chat_2 = self.home_2.get_chat(username=self.sender['username']).click()
chat_2 = self.home_2.get_one_to_one_chat(username=self.sender['username']).click()
chat_2.commands_button.click()
request_transaction = chat_2.request_command.click()
request_transaction.amount_edit_box.set_value(amount)
@@ -182,7 +182,7 @@ class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.device_1.driver.launch_app()
self.device_1.sign_in()
self.home_1.connection_offline_icon.wait_for_invisibility_of_element(30)
self.home_1.get_chat(self.recipient_username).click()
self.home_1.get_one_to_one_chat(self.recipient_username).click()
chat_1_sender_message = self.chat_1.get_outgoing_transaction()
if not chat_1_sender_message.is_element_displayed():
self.drivers[0].fail('No outgoing transaction in 1-1 chat is shown for sender after requesting STT')
@@ -198,8 +198,8 @@ class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase):
home.toggle_airplane_mode()
home.home_button.double_click()
home.connection_offline_icon.wait_for_invisibility_of_element(100)
self.home_2.get_chat(self.sender['username']).click()
self.home_1.get_chat(self.recipient_username).click()
self.home_2.get_one_to_one_chat(self.sender['username']).click()
self.home_1.get_one_to_one_chat(self.recipient_username).click()
[message.transaction_status.wait_for_element_text(message.confirmed, wait_time=120) for message in
(chat_1_sender_message, chat_2_request_message)]
@@ -227,7 +227,7 @@ class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase):
self.chat_1 = self.home_1.add_contact(self.public_key_2)
self.chat_1.send_message('hey')
self.home_2.home_button.double_click()
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
self.chat_2 = self.home_2.get_one_to_one_chat(self.default_username_1).click()
@marks.testrail_id(6316)
def test_1_1_chat_audio_message_with_push(self):
@@ -250,7 +250,7 @@ class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase):
listen_time = 5
self.device_2.home_button.click()
self.home_2.get_chat(self.default_username_1).click()
self.home_2.get_one_to_one_chat(self.default_username_1).click()
chat_2.play_audio_message(listen_time)
if chat_2.audio_message_in_chat_timer.text not in ("00:05", "00:06", "00:07", "00:08"):
self.errors.append("Listened 5 seconds but timer shows different listened time in audio message")
@@ -262,16 +262,16 @@ class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase):
def test_1_1_chat_delete_via_delete_button_relogin(self):
self.home_1.driver.quit()
self.home_2.home_button.click()
self.home_2.get_chat(username=self.default_username_1).click()
self.home_2.get_one_to_one_chat(username=self.default_username_1).click()
self.home_2.just_fyi("Deleting chat via delete button and check it will not reappear after relaunching app")
self.chat_2.delete_chat()
self.chat_2.get_back_to_home_view()
if self.home_2.get_chat_from_home_view(self.default_username_1).is_element_displayed():
if self.home_2.get_one_to_one_chat(self.default_username_1).is_element_displayed():
self.errors.append('Deleted %s chat is shown, but the chat has been deleted' % self.default_username_1)
self.home_2.reopen_app()
if self.home_2.get_chat_from_home_view(self.default_username_1).is_element_displayed():
if self.home_2.get_one_to_one_chat(self.default_username_1).is_element_displayed():
self.errors.append(
'Deleted chat %s is shown after re-login, but the chat has been deleted' % self.default_username_1)
self.errors.verify_no_errors()
@@ -310,7 +310,7 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
@marks.testrail_id(702186)
def test_keycard_command_send_tx_eth_1_1_chat(self):
self.home_2.get_chat(self.sender['username']).click()
self.home_2.get_one_to_one_chat(self.sender['username']).click()
self.chat_2.send_message("hey on kk!")
self.chat_2.home_button.click()
@@ -318,7 +318,7 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
account_name = self.chat_1.status_account_name
self.chat_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount)
self.home_1.get_chat(self.nick).click()
self.home_1.get_one_to_one_chat(self.nick).click()
self.chat_1.send_message("hello again!")
self.chat_1.commands_button.click()
send_transaction = self.chat_1.send_command.click()
@@ -333,7 +333,7 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
self.chat_1.driver.fail('No message is shown after sending ETH in 1-1 chat for sender')
sender_message.transaction_status.wait_for_element_text(sender_message.address_requested)
self.home_2.get_chat(self.sender['username']).click()
self.home_2.get_one_to_one_chat(self.sender['username']).click()
receiver_message = self.chat_2.get_incoming_transaction()
timestamp_sender = sender_message.timestamp_command_message.text
if not receiver_message.is_element_displayed(30):
@@ -378,7 +378,7 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
def test_contact_add_remove_mention_default_username_nickname_public_chat(self):
[home.home_button.double_click() for home in [self.home_1, self.home_2]]
self.chat_1.just_fyi('check that can mention user with 3-random name in public chat')
self.home_1.get_chat('#%s' % self.pub_chat_name).click()
self.home_1.get_one_to_one_chat('#%s' % self.pub_chat_name).click()
self.chat_1.just_fyi('Set nickname for user without adding him to contacts, check it in public chat')
chat_element = self.chat_1.chat_element_by_text(self.message)
@@ -495,7 +495,7 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
self.errors.append("Not connected to history node after enabling fetching on mobile data")
self.home_2.click_system_back_button()
self.home_2.mobile_connection_on_icon.wait_for_visibility_of_element(10)
self.home_2.get_chat('#%s' % public_chat_name).click()
self.home_2.get_one_to_one_chat('#%s' % public_chat_name).click()
if not public_2.chat_element_by_text(public_chat_message).is_element_displayed(180):
self.errors.append("Chat history was not fetched with mobile data fetching ON")
@@ -560,7 +560,7 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
self.home_2.home_button.wait_for_element(30)
if not self.home_2.element_by_text_part(self.pub_chat_name).is_element_displayed():
self.errors.append("Public chat was removed from home after migration to kk")
self.home_2.get_chat(self.sender['username']).click()
self.home_2.get_one_to_one_chat(self.sender['username']).click()
if self.chat_2.add_to_contacts.is_element_displayed():
self.errors.append("User was removed from contacts after migration to kk")
self.errors.verify_no_errors()
@@ -622,7 +622,7 @@ class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase):
wallet_1 = self.home_1.wallet_button.click()
wallet_1.wait_balance_is_changed()
wallet_1.home_button.click()
self.home_1.get_chat(self.ens).click()
self.home_1.get_one_to_one_chat(self.ens).click()
self.chat_1.commands_button.click()
amount = self.chat_1.get_unique_amount()
@@ -641,7 +641,7 @@ class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase):
chat_1_sender_message.transaction_status.wait_for_element_text(chat_1_sender_message.confirmed)
self.chat_2.just_fyi("Check that message is fetched for receiver")
self.home_2.get_chat(self.sender['username']).click()
self.home_2.get_one_to_one_chat(self.sender['username']).click()
chat_2_reciever_message = self.chat_2.get_incoming_transaction(transaction_value=amount)
chat_2_reciever_message.transaction_status.wait_for_element_text(chat_2_reciever_message.confirmed,
wait_time=60)
@@ -652,7 +652,7 @@ class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.home_1.just_fyi('Mention user by ENS in 1-1 chat')
message, message_ens_owner = '%s hey!' % self.ens, '%s hey!' % self.reciever['ens']
self.home_1.get_chat(self.ens).click()
self.home_1.get_one_to_one_chat(self.ens).click()
self.chat_1.send_message(message)
self.home_1.just_fyi('Set nickname and mention user by nickname in 1-1 chat')
@@ -667,7 +667,7 @@ class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.chat_1.home_button.double_click()
if not self.chat_1.element_by_text(updated_message).is_element_displayed():
self.errors.append('"%s" is not show in chat preview on home screen!' % message)
self.home_1.get_chat(russian_nickname).click()
self.home_1.get_one_to_one_chat(russian_nickname).click()
self.chat_1.just_fyi('Check redirect to user profile on mention by nickname tap')
self.chat_1.chat_element_by_text(updated_message).click()
@@ -678,7 +678,7 @@ class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.chat_1.profile_send_message_button.click()
self.chat_2.just_fyi("Check message with mention for ENS owner")
self.home_2.get_chat(self.sender['username']).click()
self.home_2.get_one_to_one_chat(self.sender['username']).click()
if not self.chat_2.chat_element_by_text(message_ens_owner).is_element_displayed():
self.errors.append('Expected %s message is not shown for ENS owner' % message_ens_owner)
@@ -745,7 +745,7 @@ class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase):
profile_2.switch_network('Goerli with upstream RPC')
self.home_1.just_fyi('Install free sticker pack and use it in 1-1 chat on Goerli')
self.home_1.get_chat(self.ens).click()
self.home_1.get_one_to_one_chat(self.ens).click()
self.chat_1.chat_message_input.clear()
self.chat_1.install_sticker_pack_by_name()
self.chat_1.sticker_icon.click()
@@ -766,7 +766,7 @@ class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase):
# self.home_2.just_fyi('Check that can install stickers by tapping on sticker message')
# TODO: disabled because of #13683 (rechecked 04.10.22, valid)
self.home_2.home_button.double_click()
self.home_2.get_chat(self.sender['username']).click()
self.home_2.get_one_to_one_chat(self.sender['username']).click()
# self.chat_2.chat_item.click()
# self.chat_2.element_by_text_part('Free').wait_and_click(40)
# if self.chat_2.element_by_text_part('Free').is_element_displayed():
@@ -853,10 +853,10 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.home_2.handle_contact_request(self.username_1)
self.profile_1.just_fyi("Sending message to contact via Messages > Recent")
self.chat_1 = self.home_1.get_chat(self.username_2).click()
self.chat_1 = self.home_1.get_one_to_one_chat(self.username_2).click()
self.chat_1.send_message('hey')
self.home_2.navigate_back_to_home_view()
self.chat_2 = self.home_2.get_chat(self.username_1).click()
self.chat_2 = self.home_2.get_one_to_one_chat(self.username_1).click()
self.message_1, self.message_2, self.message_3, self.message_4 = \
"Message 1", "Message 2", "Message 3", "Message 4"
@@ -1120,7 +1120,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.chat_1.just_fyi("Go back to chat view and checking that profile photo is updated")
if not self.chat_2.chat_message_input.is_element_displayed():
self.home_2.get_chat(self.username_1).click()
self.home_2.get_one_to_one_chat(self.username_1).click()
if self.chat_2.chat_element_by_text(message).member_photo.is_element_differs_from_template("member3.png",
diff=6):
self.errors.append("Image of user in 1-1 chat is too different from template!")
@@ -1138,7 +1138,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.device_2.put_app_to_background()
self.device_2.open_notification_bar()
if not self.chat_1.chat_message_input.is_element_displayed():
self.home_1.get_chat(self.username_2).click()
self.home_1.get_one_to_one_chat(self.username_2).click()
self.chat_1.send_message(message)
self.device_1.just_fyi("Device 1 puts app on background to receive emoji push notification")
@@ -1350,7 +1350,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.home_2.just_fyi('Device2 checks "Sending" status when sending message from offline')
if not self.chat_2.chat_message_input.is_element_displayed():
self.home_2.chats_tab.click()
self.home_2.get_chat(self.username_1).click()
self.home_2.get_one_to_one_chat(self.username_1).click()
self.chat_2.send_message(message_1)
status = self.chat_2.chat_element_by_text(message_1).status
if not (status == 'Sending' or status == 'Sent'):
@@ -1363,7 +1363,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
home.driver.launch_app()
SignInView(home.driver).sign_in()
home.chats_tab.click()
home.get_chat(self.username_2 if i == 0 else self.username_1).click()
home.get_one_to_one_chat(self.username_2 if i == 0 else self.username_1).click()
self.home_1.just_fyi('Device1 goes back online and checks that 1-1 chat will be fetched')
if not self.chat_1.chat_element_by_text(message_1).is_element_displayed(120):
@@ -1381,11 +1381,11 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.home_1.navigate_back_to_home_view()
self.home_1.chats_tab.click()
self.home_1.just_fyi("Mute chat")
self.home_1.mute_chat_long_press(self.username_2)
self.home_1.mute_chat_long_press(self.home_1.get_one_to_one_chat(self.username_2))
muted_message = "should be muted"
self.chat_2.send_message(muted_message)
chat = self.home_1.get_chat(self.username_2)
chat = self.home_1.get_one_to_one_chat(self.username_2)
if chat.new_messages_counter.is_element_displayed(30) or self.home_1.chats_tab.counter.is_element_displayed(10):
self.errors.append("New messages counter is shown after mute")
if not chat.chat_preview.text.startswith(muted_message):
@@ -1423,11 +1423,11 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.home_2.chats_tab.click()
self.home_2.just_fyi("Deleting chat via delete button and check it will not reappear after relaunching app")
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():
self.home_2.delete_chat_long_press(self.home_2.get_one_to_one_chat(self.username_1))
if self.home_2.get_one_to_one_chat(self.username_1).is_element_displayed():
self.errors.append('Deleted %s chat is shown, but the chat has been deleted' % self.username_1)
self.home_2.reopen_app()
if self.home_2.get_chat_from_home_view(self.username_1).is_element_displayed(15):
if self.home_2.get_one_to_one_chat(self.username_1).is_element_displayed(15):
self.errors.append(
'Deleted chat %s is shown after re-login, but the chat has been deleted' % self.username_1)
self.errors.verify_no_errors()
@@ -62,7 +62,7 @@ class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
group_invite_pn.click()
else:
self.homes[1].click_system_back_button(2)
self.homes[1].get_chat(self.chat_name).click()
self.homes[1].get_group_chat(self.chat_name).click()
self.homes[1].just_fyi("Check system messages in group chat for admin and member")
create_system_message = self.chats[0].create_system_message(self.usernames[0], self.chat_name)
@@ -84,7 +84,7 @@ class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
@marks.testrail_id(700732)
def test_group_chat_add_new_member(self):
[self.homes[i].home_button.double_click() for i in range(3)]
self.homes[0].get_chat(self.chat_name).click()
self.homes[0].get_group_chat(self.chat_name).click()
self.chats[0].add_members_to_group_chat([self.usernames[2]])
self.chats[2].just_fyi("Check there will be PN and no unread in AC for a new member")
@@ -97,10 +97,10 @@ class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.homes[2].click_system_back_button()
self.homes[2].just_fyi("Check new group appeared in chat list for a new member")
if not self.homes[2].get_chat(self.chat_name).is_element_displayed(60):
if not self.homes[2].get_group_chat(self.chat_name).is_element_displayed(60):
self.drivers[2].fail("New group chat hasn't appeared in chat list")
self.homes[2].get_chat(self.chat_name).click()
self.homes[2].get_group_chat(self.chat_name).click()
for message in (self.message_to_admin, self.message_before_adding):
if self.chats[2].chat_element_by_text(message).is_element_displayed():
@@ -114,10 +114,10 @@ class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.homes[0].create_group_chat([self.usernames[1]], chat_name)
self.homes[1].just_fyi("Check that new group chat from contact is highlited")
chat_2_element = self.homes[1].get_chat(chat_name)
chat_2_element = self.homes[1].get_group_chat(chat_name)
if chat_2_element.no_message_preview.is_element_differs_from_template('highligted_preview_group.png', 0):
self.errors.append("Preview message is not hightligted or text is not shown! ")
chat_2 = self.homes[1].get_chat(chat_name).click()
chat_2 = self.homes[1].get_group_chat(chat_name).click()
chat_2.home_button.click()
if not chat_2_element.no_message_preview.is_element_differs_from_template('highligted_preview_group.png', 0):
self.errors.append("Preview message is still hightligted after opening! ")
@@ -128,10 +128,10 @@ class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.drivers[2].quit()
[self.homes[i].home_button.double_click() for i in range(2)]
self.homes[0].home_button.double_click()
self.homes[1].get_chat(self.chat_name).click()
self.homes[1].get_group_chat(self.chat_name).click()
self.homes[0].just_fyi("Admin deleted chat via long press")
self.homes[0].leave_chat_long_press(self.chat_name)
self.homes[0].leave_chat_long_press(self.homes[0].get_group_chat(self.chat_name))
self.homes[1].just_fyi('Check that leave system message is presented after user left the group chat')
if not self.chats[1].chat_element_by_text(left_system_message).is_element_displayed():
@@ -140,7 +140,7 @@ class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.homes[0].just_fyi("Member sends some message, admin relogins and check chat does not reappear")
self.chats[1].send_message(self.message_to_admin)
self.homes[0].relogin()
if self.homes[0].get_chat_from_home_view(self.chat_name).is_element_displayed():
if self.homes[0].get_one_to_one_chat(self.chat_name).is_element_displayed():
self.drivers[0].fail('Deleted %s is present after relaunch app' % self.chat_name)
@@ -210,7 +210,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
def test_group_chat_join_send_text_messages_push(self):
message_to_admin = self.message_to_admin
[self.homes[i].navigate_back_to_home_view() for i in range(3)]
self.homes[1].get_chat(self.chat_name).click()
self.homes[1].get_group_chat(self.chat_name).click()
self.chats[1].send_message(message_to_admin)
@@ -222,7 +222,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
else:
self.errors.append("No PN was received on new message for message in group chat")
self.homes[0].click_system_back_button()
self.homes[0].get_chat(self.chat_name).click()
self.homes[0].get_group_chat(self.chat_name).click()
self.chats[1].just_fyi('Check message status and message delivery')
self.chats[1].chat_element_by_text(message_to_admin).wait_for_status_to_be('Delivered', timeout=120)
@@ -233,7 +233,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
@marks.testrail_id(703202)
def test_group_chat_reactions(self):
[self.homes[i].navigate_back_to_home_view() for i in range(3)]
[self.homes[i].get_chat(self.chat_name).click() for i in range(3)]
[self.homes[i].get_group_chat(self.chat_name).click() for i in range(3)]
message = "This is a test message to check some reactions."
self.chats[0].just_fyi("Admin sends a message")
self.chats[0].send_message(message)
@@ -306,7 +306,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
self.chats[0].just_fyi("Admin relogins")
self.chats[0].reopen_app()
self.homes[0].get_chat(self.chat_name).click()
self.homes[0].get_group_chat(self.chat_name).click()
self.chats[0].just_fyi("Admin checks reactions count after relogin")
message_element = self.chats[0].chat_element_by_text(message)
@@ -347,7 +347,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
def test_group_chat_send_image_save_and_share(self):
[self.homes[i].navigate_back_to_home_view() for i in range(3)]
for i in range(3):
self.homes[i].get_chat(self.chat_name).click()
self.homes[i].get_group_chat(self.chat_name).click()
self.chats[1].just_fyi("Member_1 sends an image")
image_description = "test image"
@@ -407,7 +407,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
self.homes[i].navigate_back_to_home_view()
self.homes[i].chats_tab.click()
self.homes[i].groups_tab.click()
self.homes[i].get_chat(self.chat_name).click()
self.homes[i].get_group_chat(self.chat_name).click()
message_1, message_2 = 'message from old member', 'message from new member'
@@ -431,7 +431,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
self.drivers[0].launch_app()
SignInView(self.drivers[0]).sign_in()
self.homes[0].chats_tab.click()
self.homes[0].get_chat(self.chat_name).click()
self.homes[0].get_group_chat(self.chat_name).click()
self.homes[0].just_fyi("check that messages are shown for every member")
for i in range(3):
@@ -444,7 +444,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
@marks.testrail_id(702732)
def test_group_chat_pin_messages(self):
[self.homes[i].navigate_back_to_home_view() for i in range(3)]
[self.homes[i].get_chat(self.chat_name).click() for i in range(3)]
[self.homes[i].get_group_chat(self.chat_name).click() for i in range(3)]
self.message_1, self.message_2, self.message_3, self.message_4 = \
"Message 1", "Message 2", "Message 3", "Message 4"
@@ -525,13 +525,13 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
[self.homes[i].navigate_back_to_home_view() for i in range(3)]
self.homes[1].just_fyi("Member 1 mutes the chat for 1 hour")
self.homes[1].mute_chat_long_press(self.chat_name, "mute-for-1-hour")
self.homes[1].mute_chat_long_press(self.homes[1].get_group_chat(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")
chat = self.homes[1].get_chat(self.chat_name)
chat = self.homes[1].get_group_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")
@@ -545,7 +545,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
self.homes[0].just_fyi("Admin sends a message")
muted_message = "Text message in the muted chat"
self.homes[0].get_chat(self.chat_name).click()
self.homes[0].get_group_chat(self.chat_name).click()
self.chats[0].send_message(muted_message)
self.homes[1].just_fyi("Member 1 checks that chat is muted and message is received")
@@ -579,7 +579,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
unmuted_message = "Chat is unmuted now"
self.homes[2].just_fyi("Member 2 sends a message")
self.homes[2].get_chat(self.chat_name).click()
self.homes[2].get_group_chat(self.chat_name).click()
try:
initial_counter = int(self.homes[1].chats_tab.counter.text)
except NoSuchElementException:
@@ -317,9 +317,9 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
self.channel_name = "cats"
self.community = self.home.create_community(community_type="closed")
self.home.get_chat(self.community_name, community=True).click()
self.home.get_community(self.community_name).click()
self.community_view = self.home.get_community_view()
self.channel = self.community_view.get_channel(self.channel_name).click()
self.channel = self.community_view.get_community_channel(self.channel_name).click()
@marks.testrail_id(703503)
def test_community_discovery(self):
@@ -390,7 +390,8 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
self.home.navigate_back_to_home_view()
self.home.communities_tab.click()
self.home.just_fyi("Mute community and check that channels are also muted")
self.home.mute_chat_long_press(chat_name=self.community_name, mute_period="mute-for-1-hour", community=True)
self.home.mute_chat_long_press(chat_element=self.home.get_community(self.community_name),
mute_period="mute-for-1-hour", community=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(hours=1)
@@ -398,13 +399,13 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
expected_time.strftime('%H:%M'),
"today" if current_time.hour < 23 else "tomorrow"
)
self.home.get_chat(self.community_name, community=True).long_press_element()
self.home.get_community(self.community_name).long_press_element()
if not self.home.element_by_text(expected_text).is_element_displayed():
self.errors.append("Text '%s' is not shown for muted community" % expected_text)
self.home.click_system_back_button()
self.home.get_chat(self.community_name, community=True).click()
self.community_view.get_channel(self.channel_name).long_press_element()
self.home.get_community(self.community_name).click()
self.community_view.get_community_channel(self.channel_name).long_press_element()
if not self.home.element_by_text(expected_text).is_element_displayed():
self.errors.append("Text '%s' is not shown for a channel in muted community" % expected_text)
@@ -412,26 +413,27 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
self.home.mute_channel_button.click()
self.home.navigate_back_to_home_view()
self.home.communities_tab.click()
self.home.get_chat(self.community_name, community=True).long_press_element()
self.home.get_community(self.community_name).long_press_element()
if not self.home.element_by_text("Mute community").is_element_displayed():
self.errors.append("Community is not unmuted when channel is unmuted")
self.home.click_system_back_button()
self.home.just_fyi("Mute channel and check that community is not muted")
self.home.get_chat(self.community_name, community=True).click()
self.home.mute_chat_long_press(chat_name=self.channel_name, mute_period="mute-for-1-week",
self.home.get_community(self.community_name).click()
self.home.mute_chat_long_press(chat_element=self.home.get_community_channel(self.channel_name),
mute_period="mute-for-1-week",
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')
self.community_view.get_channel(self.channel_name).long_press_element()
self.community_view.get_community_channel(self.channel_name).long_press_element()
if not self.home.element_by_text(expected_text).is_element_displayed():
self.errors.append("Text '%s' is not shown for a muted community channel" % expected_text)
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()
self.home.get_community(self.community_name).long_press_element()
if self.home.element_by_text(expected_text).is_element_displayed() or self.home.mute_community_button.text != \
transl["mute-community"]:
self.errors.append("Community is muted when channel is muted")
@@ -552,9 +554,9 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.text_message = 'hello'
# self.home_2.just_fyi("Send message to contact (need for blocking contact) test")
self.chat_1 = self.home_1.get_chat(self.username_2).click()
self.chat_1 = self.home_1.get_one_to_one_chat(self.username_2).click()
self.chat_1.send_message('hey')
self.chat_2 = self.home_2.get_chat(self.username_1).click()
self.chat_2 = self.home_2.get_one_to_one_chat(self.username_1).click()
# self.chat_2.send_message(self.text_message)
# [home.click_system_back_button_until_element_is_shown() for home in self.homes]
self.home_1.navigate_back_to_home_view()
@@ -575,7 +577,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.chat_2.send_message(self.text_message)
self.chat_2.chat_element_by_text(self.community_name).view_community_button.click()
self.community_2.join_community()
self.channel_2 = self.community_2.get_channel(self.channel_name).click()
self.channel_2 = self.community_2.get_community_channel(self.channel_name).click()
@marks.testrail_id(702838)
def test_community_message_send_check_timestamps_sender_username(self):
@@ -873,12 +875,12 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.home_2.get_to_community_channel_from_home(self.community_name)
self.channel_2.send_message(message)
self.home_1.just_fyi('Check new messages badge is shown for community')
community_element_1 = self.home_1.get_chat(self.community_name, community=True)
community_element_1 = self.home_1.get_community(self.community_name)
if not community_element_1.new_messages_grey_dot.is_element_displayed(sec=30):
self.errors.append('New message community badge is not shown')
community_1 = community_element_1.click()
channel_1_element = community_1.get_channel(self.channel_name)
community_element_1.click()
channel_1_element = self.community_1.get_community_channel(self.channel_name)
self.home_1.just_fyi('Check new messages badge is shown for community')
if not community_element_1.new_messages_grey_dot.is_element_displayed():
@@ -912,7 +914,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.errors.append("Messages from blocked user is not cleared in public chat ")
self.chat_1.navigate_back_to_home_view()
self.home_1.chats_tab.click()
if not self.home_1.element_by_translation_id( "no-messages").is_element_displayed():
if not self.home_1.element_by_translation_id("no-messages").is_element_displayed():
self.errors.append("1-1 chat from blocked user is not removed and messages home is not empty!")
self.chat_1.toggle_airplane_mode()
@@ -930,8 +932,8 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.chat_1.toggle_airplane_mode()
# self.home_1.jump_to_card_by_text('# %s' % self.channel_name)
self.home_1.communities_tab.click()
self.home_1.get_chat(self.community_name, community=True).click()
self.home_1.get_chat(self.channel_name, community_channel=True).click()
self.home_1.get_community(self.community_name).click()
self.home_1.get_community_channel(self.channel_name).click()
for message in message_to_disappear, message_blocked:
if self.chat_1.chat_element_by_text(message).is_element_displayed(30):
self.errors.append(
@@ -951,10 +953,8 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.home_2.just_fyi("Check that can send message in community after unblock")
self.chat_2.send_message(message_unblocked)
# self.home_1.jump_to_card_by_text('# %s' % self.channel_name)
self.home_1.communities_tab.click()
self.home_1.get_chat(self.community_name, community=True).click()
self.home_1.get_chat(self.channel_name, community_channel=True).click()
self.home_1.get_to_community_channel_from_home(self.community_name)
self.chat_1.hide_keyboard_if_shown()
if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed(120):
self.errors.append("%s was not received in public chat after user unblock!" % message_unblocked)
@@ -980,7 +980,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
if unblocked:
self.home_2.just_fyi("Check message in 1-1 chat after unblock")
self.home_2.chats_tab.click()
self.home_2.get_chat(self.username_1).click()
self.home_2.get_one_to_one_chat(self.username_1).click()
self.chat_2.send_message(message_unblocked)
try:
self.chat_2.chat_element_by_text(message_unblocked).wait_for_status_to_be(expected_status='Delivered',
@@ -997,14 +997,13 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
for home in self.home_1, self.home_2:
home.navigate_back_to_home_view()
home.communities_tab.click()
self.home_2.get_chat(self.community_name, community=True).click()
self.community_2.get_channel(self.channel_name).click()
self.home_2.get_to_community_channel_from_home(self.community_name)
self.channel_2.send_message(self.text_message)
community_1_element = self.community_1.get_chat(self.community_name, community=True)
community_1_element = self.community_1.get_community(self.community_name)
if not community_1_element.new_messages_grey_dot.is_element_displayed(90):
self.errors.append('New messages counter is not shown in home > Community element')
community_1_element.click()
channel_1_element = self.community_1.get_chat(self.channel_name, community_channel=True)
channel_1_element = self.community_1.get_community_channel(self.channel_name)
if not channel_1_element.new_messages_grey_dot.is_element_displayed():
self.errors.append("New messages counter is not shown in community channel element")
self.community_1.click_system_back_button()
@@ -1028,8 +1027,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
if not self.channel_2.chat_message_input.is_element_displayed():
self.channel_2.navigate_back_to_home_view()
self.home_2.communities_tab.click()
self.home_2.get_chat(self.community_name, community=True).click()
self.community_2.get_channel(self.channel_name).click()
self.home_2.get_to_community_channel_from_home(self.community_name)
self.device_2.just_fyi("Invited member sends a message with a mention")
self.channel_2.send_message("hi")
@@ -1082,8 +1080,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
if not self.channel_1.chat_message_input.is_element_displayed():
self.channel_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.home_1.get_to_community_channel_from_home(self.community_name)
self.device_1.just_fyi("Admin sends a message with a mention")
self.channel_1.mention_user(self.username_2)
@@ -1118,8 +1115,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
for home in self.homes:
home.navigate_back_to_home_view()
home.jump_to_communities_home()
community = home.get_chat(self.community_name, community=True).click()
community.get_channel(self.channel_name).click()
home.get_to_community_channel_from_home(self.community_name)
for message, symbol in markdown.items():
self.home_1.just_fyi('Checking that "%s" is applied (%s) in community channel' % (message, symbol))
@@ -1137,8 +1133,8 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
home.navigate_back_to_home_view()
home.chats_tab.click()
if self.home_1.get_chat(self.username_2).is_element_displayed():
self.home_1.get_chat(self.username_2).click()
if self.home_1.get_one_to_one_chat(self.username_2).is_element_displayed():
self.home_1.get_one_to_one_chat(self.username_2).click()
else:
# if test_community_contact_block_unblock_offline failed we need to add users to contacts again
self.home_1.contacts_tab.click()
@@ -1146,11 +1142,17 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.home_1.contact_details_row(username=self.username_2).click()
self.chat_1.profile_send_message_button.click()
else:
self.home_1.add_contact(self.public_key_2)
self.home_2.handle_contact_request(self.username_1)
self.home_1.navigate_back_to_home_view()
self.chat_1.profile_button.click()
self.profile_1.contacts_button.wait_and_click()
self.profile_1.blocked_users_button.wait_and_click()
self.profile_1.element_by_text(self.username_2).click()
self.chat_1.unblock_contact_button.click()
self.chat_1.close_button.click()
self.chat_1.navigate_back_to_home_view()
self.chat_1.send_message("just a message")
self.home_2.get_chat(self.username_1).click()
self.home_2.get_one_to_one_chat(self.username_1).click()
for message, symbol in markdown.items():
self.home_1.just_fyi('Checking that "%s" is applied (%s) in 1-1 chat' % (message, symbol))
@@ -1170,7 +1172,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
def test_community_leave(self):
self.home_2.navigate_back_to_home_view()
self.home_2.jump_to_communities_home()
community = self.home_2.get_chat(self.community_name, community=True)
community = self.home_2.get_community(self.community_name)
community_to_leave = CommunityView(self.drivers[1])
community.long_press_until_element_is_shown(community_to_leave.leave_community_button)
community_to_leave.leave_community_button.click()
@@ -1192,7 +1194,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.community_1.share_community(community_name, self.username_2)
self.home_2.just_fyi("Device 2 joins the community")
self.home_2.get_chat(self.username_1).click()
self.home_2.get_one_to_one_chat(self.username_1).click()
control_message_1_1_chat = "it is just a message text"
self.chat_2.send_message(control_message_1_1_chat)
self.chat_2.chat_element_by_text(community_name).view_community_button.click()
@@ -1242,11 +1244,11 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
home.chats_tab.click()
self.home_2.just_fyi("Device 2 sends a message with hashtag in 1-1 chat")
self.home_2.get_chat(self.username_1).click()
self.home_2.get_one_to_one_chat(self.username_1).click()
self.chat_2.send_message(message_with_hashtag)
self.home_1.just_fyi("Device 1 clicks on the message with hashtag in 1-1 chat")
self.home_1.get_chat(self.username_2).click()
self.home_1.get_one_to_one_chat(self.username_2).click()
self.chat_1.chat_element_by_text(message_with_hashtag).click_on_link_inside_message_body()
if self.chat_1.chat_element_by_text(control_message_1_1_chat).is_element_disappeared():
self.errors.append("Receiver was navigated out of 1-1 chat")
@@ -153,9 +153,9 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.one_to_one_message = 'one-t-one message'
self.home_2.just_fyi("Send message to contact (need for jump to) test")
self.chat_1 = self.home_1.get_chat(self.username_2).click()
self.chat_1 = self.home_1.get_one_to_one_chat(self.username_2).click()
self.chat_1.send_message(self.one_to_one_message)
self.chat_2 = self.home_2.get_chat(self.username_1).click()
self.chat_2 = self.home_2.get_one_to_one_chat(self.username_1).click()
self.chat_2.send_message(self.text_message)
[home.navigate_back_to_home_view() for home in self.homes]
@@ -171,10 +171,10 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.community_1.share_community(self.community_name, self.username_2)
self.home_1.get_to_community_channel_from_home(self.community_name)
self.chat_2 = self.home_2.get_chat(self.username_1).click()
self.chat_2 = self.home_2.get_one_to_one_chat(self.username_1).click()
self.chat_2.chat_element_by_text(self.community_name).view_community_button.click()
self.community_2.join_community()
self.channel_2 = self.community_2.get_channel(self.channel_name).click()
self.channel_2 = self.community_2.get_community_channel(self.channel_name).click()
@marks.testrail_id(702936)
def test_navigation_jump_to(self):
@@ -199,8 +199,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
message_to_reply, reply_to_message_from_sender = 'something to reply to', 'this is a reply'
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.home_1.get_to_community_channel_from_home(self.community_name)
self.channel_1.send_message(message_to_reply)
self.home_1.navigate_back_to_home_view()
@@ -211,7 +210,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.home_1.just_fyi("Checking unread indicators")
self.home_1.notifications_unread_badge.wait_for_visibility_of_element(120)
community_element_1 = self.home_1.get_chat(self.community_name, community=True)
community_element_1 = self.home_1.get_community(self.community_name)
for unread_counter in community_element_1.new_messages_counter, self.home_1.communities_tab.counter:
if not unread_counter.is_element_displayed(60):
self.errors.append('New message counter badge is not shown!')
@@ -280,8 +279,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
if not self.channel_2.chat_message_input.is_element_displayed():
self.channel_2.navigate_back_to_home_view()
self.home_2.communities_tab.click()
self.home_2.get_chat(self.community_name, community=True).click()
self.home_2.get_chat(self.channel_name, community_channel=True).click()
self.home_2.get_to_community_channel_from_home(self.community_name)
self.home_1.navigate_back_to_home_view()
self.home_1.communities_tab.click()
@@ -291,7 +289,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.home_1.just_fyi("Checking unread indicators")
self.home_1.notifications_unread_badge.wait_for_visibility_of_element(120)
community_element_1 = self.home_1.get_chat(self.community_name, community=True)
community_element_1 = self.home_1.get_community(self.community_name)
for unread_counter in community_element_1.new_messages_counter, self.home_1.communities_tab.counter:
if not unread_counter.is_element_displayed(60):
self.errors.append('New message counter badge is not shown while mentioned!')
@@ -320,7 +318,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.home_2.just_fyi("Clearing history")
self.home_2.navigate_back_to_home_view()
self.home_2.chats_tab.click()
self.home_2.clear_chat_long_press(self.username_1)
self.home_2.clear_chat_long_press(self.home_2.get_one_to_one_chat(self.username_1))
[home.navigate_back_to_home_view() for home in (self.home_1, self.home_2)]
self.home_1.just_fyi("Open community to message")
@@ -334,7 +332,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.home_2.just_fyi("Request access to community")
self.home_2.navigate_back_to_home_view()
self.home_2.chats_tab.click()
self.chat_2 = self.home_2.get_chat(self.username_1).click()
self.chat_2 = self.home_2.get_one_to_one_chat(self.username_1).click()
self.chat_2.chat_element_by_text(community_name).view_community_button.wait_and_click(sec=60)
self.community_2.join_community()
for home in self.home_1, self.home_2:
+2 -2
View File
@@ -345,7 +345,7 @@ class TestChatMediumMultipleDevice(MultipleSharedDeviceTestCase):
self.chat_1.put_app_to_background()
self.device_1.open_notification_bar()
self.chat_2.get_back_to_home_view(2)
self.home_2.get_chat_from_home_view(self.default_username_1).click()
self.home_2.get_one_to_one_chat(self.default_username_1).click()
def device_2_sends_sticker():
self.chat_2.just_fyi("Sending Sticker in chat")
@@ -866,7 +866,7 @@ class TestChatKeycardMentionsMediumMultipleDevice(MultipleSharedDeviceTestCase):
self.errors.append('New messages counter is shown on Home button for already seen message')
if self.home_1.get_chat(self.sender['username']).new_messages_counter.text == '1':
self.errors.append('New messages counter is shown on chat element for already seen message')
self.home_1.delete_chat_long_press(self.sender['username'])
self.home_1.delete_chat_long_press(self.home_1.get_one_to_one_chat(self.sender['username']))
self.home_1.just_fyi("Checking preview of message and chat highlighting")
self.chat_2.send_message(message_3)
+1 -6
View File
@@ -417,11 +417,6 @@ class CommunityView(HomeView):
self.checkbox_button.enable()
self.join_community_button.scroll_and_click()
def get_channel(self, channel_name: str):
self.driver.info("Getting %s channel element in community" % channel_name)
chat_element = self.get_chat(username=channel_name, community_channel=True, wait_time=30)
return chat_element
def add_channel(self, name: str, description="Some new channel"):
self.driver.info("Adding channel in community")
self.plus_button.click()
@@ -430,7 +425,7 @@ class CommunityView(HomeView):
self.channel_descripton.set_value(description)
chat_view = ChatView(self.driver)
chat_view.confirm_create_in_community_button.click()
self.get_chat(name).click()
self.get_community_channel(name).click()
return chat_view
def leave_community(self):
+46 -43
View File
@@ -29,22 +29,22 @@ class ActivityTabButton(Button):
class ChatElement(SilentButton):
def __init__(self, driver, username_part, community=False, community_channel=False):
def __init__(self, driver, username_part, one_to_one=False, community=False, community_channel=False):
self.username = username_part
self.community = community
self.community_channel = community_channel
if self.community_channel:
super().__init__(
driver,
xpath="//*[@content-desc='chat-name-text']//*[starts-with(@text,'# %s')]/../.." % username_part)
elif community:
super().__init__(
driver,
xpath="//*[@content-desc='chat-name-text'][starts-with(@text,'%s')]/.." % username_part)
else:
if one_to_one:
super().__init__(
driver,
xpath="//*[@content-desc='author-primary-name'][starts-with(@text,'%s')]/.." % username_part)
elif self.community_channel:
super().__init__(
driver,
xpath="//*[@content-desc='chat-name-text']//*[starts-with(@text,'# %s')]/../.." % username_part)
else:
super().__init__(
driver,
xpath="//*[@content-desc='chat-name-text'][starts-with(@text,'%s')]/.." % username_part)
def navigate(self):
if self.community:
@@ -337,29 +337,31 @@ class HomeView(BaseView):
except TimeoutException:
break
def get_chat(self, username, community=False, community_channel=False, wait_time=10):
if community:
self.driver.info("Looking for community: '%s'" % username)
else:
self.driver.info("Looking for chat: '%s'" % username)
chat_element = ChatElement(self.driver, username[:25], community=community, community_channel=community_channel)
if not chat_element.is_element_displayed(wait_time) and community is False and community_channel is False:
if self.notifications_unread_badge.is_element_displayed(30):
chat_in_ac = ActivityCenterElement(self.driver, username[:25])
self.open_activity_center_button.click_until_presence_of_element(chat_in_ac)
chat_in_ac.wait_for_element(20)
chat_in_ac.click()
return chat_element
def get_one_to_one_chat(self, username: str):
self.driver.info("Looking for 1-1 chat: '%s'" % username)
return ChatElement(self.driver, username[:25], one_to_one=True)
# if not chat_element.is_element_displayed(wait_time):
# if self.notifications_unread_badge.is_element_displayed(30):
# chat_in_ac = ActivityCenterElement(self.driver, username[:25])
# self.open_activity_center_button.click_until_presence_of_element(chat_in_ac)
# chat_in_ac.wait_for_element(20)
# chat_in_ac.click()
def get_community(self, community_name: str):
self.driver.info("Looking for community: '%s'" % community_name)
return ChatElement(self.driver, community_name, community=True)
def get_community_channel(self, channel_name: str):
self.driver.info("Looking for community channel: '%s'" % channel_name)
return ChatElement(self.driver, channel_name, community_channel=True)
def get_group_chat(self, chat_name: str):
self.driver.info("Looking for group chat: '%s'" % chat_name)
return ChatElement(self.driver, chat_name)
def get_to_community_channel_from_home(self, community_name, channel_name='general'):
community_view = self.get_community_view()
self.get_chat(community_name, community=True).click()
return community_view.get_channel(channel_name).click()
def get_chat_from_home_view(self, username):
self.driver.info("Looking for chat: '%s'" % username)
chat_element = ChatElement(self.driver, username[:25])
return chat_element
self.get_community(community_name).click()
return self.get_community_channel(channel_name).click()
def get_element_from_activity_center_view(self, message_body):
self.driver.info("Looking for activity center element: '%s'" % message_body)
@@ -505,29 +507,30 @@ class HomeView(BaseView):
status_test_dapp.deny_button.click_until_absense_of_element(status_test_dapp.deny_button)
return status_test_dapp
def delete_chat_long_press(self, username):
self.driver.info("Deleting chat '%s' by long press" % username)
self.get_chat(username).long_press_element()
def delete_chat_long_press(self, chat_element: ChatElement):
self.driver.info("Deleting chat '%s' by long press" % chat_element.username)
chat_element.long_press_element()
self.delete_chat_button.click()
self.delete_chat_button.click()
def leave_chat_long_press(self, username):
self.driver.info("Leaving chat '%s' by long press" % username)
self.get_chat(username).long_press_element()
def leave_chat_long_press(self, chat_element: ChatElement):
self.driver.info("Leaving chat '%s' by long press" % chat_element.username)
chat_element.long_press_element()
from views.chat_view import ChatView
ChatView(self.driver).leave_chat_button.click()
ChatView(self.driver).leave_button.click()
def clear_chat_long_press(self, username):
self.driver.info("Clearing history in chat '%s' by long press" % username)
self.get_chat(username).long_press_element()
def clear_chat_long_press(self, chat_element: ChatElement):
self.driver.info("Clearing history in chat '%s' by long press" % chat_element.username)
chat_element.long_press_element()
self.clear_history_button.click()
from views.chat_view import ChatView
ChatView(self.driver).clear_button.click()
def mute_chat_long_press(self, chat_name, mute_period="mute-till-unmute", community=False, community_channel=False):
self.driver.info("Muting chat with %s" % chat_name)
self.get_chat(username=chat_name, community=community, community_channel=community_channel).long_press_element()
def mute_chat_long_press(self, chat_element: ChatElement, mute_period="mute-till-unmute", community=False,
community_channel=False):
self.driver.info("Muting chat with %s" % chat_element.username)
chat_element.long_press_element()
if community:
self.mute_community_button.click()
elif community_channel: