e2e: align with new communities / cleanup

This commit is contained in:
Churikova Tetiana 2023-04-28 12:15:32 +02:00
parent e0ed2a250b
commit 6c0c742676
No known key found for this signature in database
GPG Key ID: EDE559EC439D18A0
17 changed files with 238 additions and 342 deletions

View File

@ -25,7 +25,7 @@ class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase):
profile = home.profile_button.click()
profile.profile_notifications_button.scroll_and_click()
profile.wallet_push_notifications.click()
self.recipient_public_key, self.recipient_username = self.home_2.get_public_key_and_username(
self.recipient_public_key, self.recipient_username = self.home_2.get_public_key(
return_username=True)
self.wallet_1, self.wallet_2 = self.home_1.wallet_button.click(), self.home_2.wallet_button.click()
[wallet.home_button.click() for wallet in (self.wallet_1, self.wallet_2)]
@ -222,7 +222,7 @@ class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase):
self.profile_1 = self.home_1.profile_button.click()
self.default_username_1 = self.profile_1.default_username_text.text
self.profile_1.home_button.click()
self.public_key_2, self.default_username_2 = self.home_2.get_public_key_and_username(return_username=True)
self.public_key_2, self.default_username_2 = self.home_2.get_public_key()
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()
@ -369,7 +369,7 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
self.profile_2.backup_recovery_phrase_button.click()
recovery_phrase = self.profile_2.backup_recovery_phrase()
self.recovery_phrase = ' '.join(recovery_phrase.values())
self.public_key_2, self.default_username_2 = self.home_2.get_public_key_and_username(return_username=True)
self.public_key_2, self.default_username_2 = self.home_2.get_public_key()
self.chat_1 = self.home_1.add_contact(self.public_key_2, add_in_contacts=False)
self.chat_1.chat_options.click()
self.chat_1.view_profile_button.click()
@ -907,17 +907,16 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user, {'enable_notifications': True}),
(self.device_2.create_user, {'enable_notifications': True}))))
self.username_1, self.username_2 = 'sender', 'receiver'
self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user, {'enable_notifications': True,
'username': self.username_1}),
(self.device_2.create_user, {'enable_notifications': True,
'username': self.username_2}))))
self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view()
self.profile_1 = self.home_1.get_profile_view()
self.profile_2 = self.home_2.get_profile_view()
users = self.loop.run_until_complete(run_in_parallel(
((self.home_1.get_public_key_and_username, {'return_username': True}),
(self.home_2.get_public_key_and_username, {'return_username': True}))
))
self.public_key_1, self.default_username_1 = users[0]
self.public_key_2, self.default_username_2 = users[1]
self.homes = (self.home_1, self.home_2)
self.profile_1, self.profile_2 = (home.get_profile_view() for home in self.homes)
self.public_key_2 = self.home_2.get_public_key()
self.profile_1.just_fyi("Sending contact request via Profile > Contacts")
for home in (self.home_1, self.home_2):
@ -926,13 +925,13 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.home_1.send_contact_request_via_bottom_sheet(self.public_key_2)
self.home_2.just_fyi("Accepting contact request from activity centre")
self.home_2.handle_contact_request(self.default_username_1)
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.default_username_2).click()
self.chat_1 = self.home_1.get_chat(self.username_2).click()
self.chat_1.send_message('hey')
self.home_2.click_system_back_button_until_element_is_shown()
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
self.chat_2 = self.home_2.get_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"
@ -998,18 +997,22 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
replied_message = self.chat_1.chat_element_by_text(reply)
if replied_message.replied_message_text != url_message:
self.errors.append("Reply for '%s' not present in message received in public chat" % url_message)
# The "open_in_status" feature is not implemented yet
# url_message = 'http://status.im'
# self.chat_1.send_message(url_message)
# self.chat_2.element_starts_with_text(url_message, 'button').click()
# web_view = self.chat_2.open_in_status_button.click()
# if not web_view.element_by_text('Private, Secure Communication').is_element_displayed(60):
# self.errors.append('URL was not opened from 1-1 chat')
self.home_2.just_fyi(("Check 'Open in Status' option"))
url_message = 'http://status.im'
self.chat_1.send_message(url_message)
self.chat_2.element_starts_with_text(url_message, 'button').click_inside_element_by_coordinate(0.2, 0.5)
web_view = self.chat_2.open_in_status_button.click()
if not web_view.element_by_text('Private, Secure Communication').is_element_displayed(60):
self.errors.append('URL was not opened from 1-1 chat')
self.errors.verify_no_errors()
@marks.testrail_id(702731)
def test_1_1_chat_pin_messages(self):
self.home_1.just_fyi("Check that Device1 can pin own message in 1-1 chat")
self.chat_2.jump_to_card_by_text(self.username_1)
self.chat_1.send_message(self.message_1)
self.chat_1.send_message(self.message_2)
self.chat_1.chat_element_by_text(self.message_1).wait_for_status_to_be("Delivered")
@ -1031,9 +1034,9 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
if pinned_by.is_element_displayed():
text = pinned_by.text.strip()
if chat_number == 0:
expected_text = "You" if message == self.message_1 else self.default_username_2
expected_text = "You" if message == self.message_1 else self.username_2
else:
expected_text = "You" if message == self.message_2 else self.default_username_1
expected_text = "You" if message == self.message_2 else self.username_1
if text != expected_text:
self.errors.append(
"Pinned by '%s' doesn't match expected '%s' for user %s" % (
@ -1105,9 +1108,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.profile_1.chats_tab.click()
self.chat_2.just_fyi("Send messages with non-latin symbols")
if not self.chat_1.chat_message_input.is_element_displayed():
self.chat_1.click_system_back_button_until_element_is_shown()
self.home_1.get_chat(self.default_username_2).click()
self.home_1.jump_to_card_by_text(self.username_2)
messages = ['hello', '¿Cómo estás tu año?', 'ё, доброго вечерочка', '® æ ç ♥']
[self.chat_2.send_message(message) for message in messages]
for message in messages:
@ -1115,6 +1116,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.errors.append("Message with test '%s' was not received" % message)
self.chat_2.just_fyi("Checking updated member photo, timestamp and username on message")
self.chat_2.hide_keyboard_if_shown()
timestamp = self.chat_2.chat_element_by_text(messages[0]).timestamp
sent_time_variants = self.chat_2.convert_device_time_to_chat_timestamp()
if timestamp not in sent_time_variants:
@ -1131,7 +1133,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.default_username_1).click()
self.home_2.get_chat(self.username_1).click()
if self.chat_2.chat_element_by_text(message).member_photo.is_element_differs_from_template("member3.png",
diff=5):
self.errors.append("Image of user in 1-1 chat is too different from template!")
@ -1141,24 +1143,25 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
def test_1_1_chat_push_emoji(self):
message_no_pn, message = 'No PN', 'Text push notification'
[device.click_system_back_button_until_element_is_shown() for device in
(self.device_1, self.device_2)]
[home.click_system_back_button_until_element_is_shown() for home in self.homes]
self.home_2.profile_button.click()
self.home_1.chats_tab.click()
self.device_2.just_fyi("Device 2 puts app on background being on Profile view to receive PN with text")
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.default_username_2).click()
self.home_1.get_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")
self.device_1.click_system_back_button_until_element_is_shown()
self.device_1.profile_button.click()
self.device_1.click_system_home_button()
self.device_2.just_fyi("Check text push notification and tap it")
self.device_2.open_notification_bar()
if not self.home_2.get_pn(message):
self.device_2.click_system_back_button()
self.device_2.status_in_background_button.click()
self.device_2.driver.fail("Push notification with text was not received")
chat_2 = self.device_2.click_upon_push_notification_by_text(message)
@ -1168,8 +1171,11 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
chat_2.send_message(emoji.emojize(emoji_message))
self.device_1.just_fyi("Device 1 checks PN with emoji")
self.device_1.put_app_to_background()
self.device_1.open_notification_bar()
if not self.device_1.element_by_text_part(emoji_unicode).is_element_displayed(60):
self.device_1.click_system_back_button()
self.device_1.status_in_background_button.click()
self.device_1.driver.fail("Push notification with emoji was not received")
chat_1 = self.device_1.click_upon_push_notification_by_text(emoji_unicode)
@ -1179,7 +1185,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.device_1.driver.fail("Failed to open chat view after tap on PN")
self.device_1.just_fyi("Checks there are no PN after message was seen")
[device.open_notification_bar() for device in (self.device_1, self.device_2)]
[home.open_notification_bar() for home in self.homes]
if (self.device_2.element_by_text_part(message).is_element_displayed()
or self.device_1.element_by_text_part(emoji_unicode).is_element_displayed()):
self.errors.append("PN are keep staying after message was seen by user")
@ -1187,12 +1193,9 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
@marks.testrail_id(702855)
def test_1_1_chat_edit_message(self):
[device.click_system_back_button_until_element_is_shown() for device in
(self.device_1, self.device_2)]
if not self.chat_1.chat_message_input.is_element_displayed():
self.home_1.get_chat(self.default_username_2).click()
if not self.chat_2.chat_message_input.is_element_displayed():
self.home_2.get_chat(self.default_username_1).click()
[home.click_system_back_button_until_element_is_shown() for home in self.homes]
self.chat_2.jump_to_card_by_text(self.username_1)
self.chat_1.jump_to_card_by_text(self.username_2)
self.device_2.just_fyi(
"Device 1 sends text message and edits it in 1-1 chat. Device2 checks edited message is shown")
@ -1207,12 +1210,8 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
@marks.testrail_id(702733)
def test_1_1_chat_text_message_delete_push_disappear(self):
[device.click_system_back_button_until_element_is_shown() for device in
(self.device_1, self.device_2)]
if not self.chat_1.chat_message_input.is_element_displayed():
self.home_1.get_chat(self.default_username_2).click()
if not self.chat_2.chat_message_input.is_element_displayed():
self.home_2.get_chat(self.default_username_1).click()
self.chat_2.jump_to_card_by_text(self.username_1)
self.chat_1.jump_to_card_by_text(self.username_2)
self.device_2.just_fyi("Verify Device1 can not edit and delete received message from Device2")
message_after_edit_1_1 = 'smth I should edit'
@ -1248,9 +1247,12 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.device_2.just_fyi("Send one more message and check that PN will be deleted with message deletion")
message_to_delete = 'DELETE ME'
self.home_1.put_app_to_background()
self.chat_2.send_message(message_to_delete)
self.home_1.open_notification_bar()
if not self.home_1.get_pn(message_to_delete):
self.home_1.click_system_back_button()
self.home_1.status_in_background_button.click()
self.errors.append("Push notification doesn't appear")
self.chat_2.delete_message_in_chat(message_to_delete)
pn_to_disappear = self.home_1.get_pn(message_to_delete)
@ -1262,13 +1264,10 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
@marks.testrail_id(702783)
def test_1_1_chat_is_shown_message_sent_delivered_from_offline(self):
if not self.chat_1.chat_message_input.is_element_displayed():
self.home_1.get_chat(self.default_username_2).click()
if not self.chat_2.chat_message_input.is_element_displayed():
self.home_2.get_chat(self.default_username_1).click()
self.chat_2.jump_to_card_by_text(self.username_1)
self.chat_1.jump_to_card_by_text(self.username_2)
self.home_1.just_fyi('Turn on airplane mode and check that offline status is shown on home view')
[home.toggle_airplane_mode() for home in (self.home_1, self.home_2)]
[home.toggle_airplane_mode() for home in self.homes]
# Not implemented yet
# self.home_1.connection_offline_icon.wait_and_click(20)
@ -1288,12 +1287,12 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.errors.append('Message status is not "Sending", it is "%s"!' % status)
self.home_2.just_fyi('Device2 goes back online and checks that status of the message is changed to "delivered"')
for i, home in enumerate([self.home_1, self.home_2]):
for i, home in enumerate(self.homes):
home.toggle_airplane_mode()
if "im.status.ethereum" not in home.driver.current_activity:
home.click_system_back_button_until_element_is_shown()
home.chats_tab.click()
home.get_chat(self.default_username_2 if i == 0 else self.default_username_1).click()
home.get_chat(self.username_2 if i == 0 else self.username_1).click()
try:
chat_element.wait_for_status_to_be(expected_status='Delivered', timeout=120)
except TimeoutException:
@ -1311,11 +1310,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.default_username_1)
if self.home_2.get_chat_from_home_view(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.delete_chat_long_press(username=self.username_1)
if self.home_2.get_chat_from_home_view(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.default_username_1).is_element_displayed(15):
if self.home_2.get_chat_from_home_view(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.default_username_1)
'Deleted chat %s is shown after re-login, but the chat has been deleted' % self.username_1)
self.errors.verify_no_errors()

View File

@ -20,7 +20,7 @@ class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
sign_in = SignInView(self.drivers[key])
self.homes[key] = sign_in.create_user(enable_notifications=True)
SignInView(self.drivers[2]).put_app_to_background_and_back()
self.public_keys[key], self.usernames[key] = sign_in.get_public_key_and_username(True)
self.public_keys[key], self.usernames[key] = sign_in.get_public_key(True)
sign_in.home_button.click()
SignInView(self.drivers[0]).put_app_to_background_and_back()
self.chat_name = self.homes[0].get_random_chat_name()
@ -150,31 +150,29 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
self.message_to_admin = 'Hey, admin!'
self.public_keys, self.usernames, self.chats = {}, {}, {}
sign_in_views = [SignInView(self.drivers[key]) for key in self.drivers]
self.usernames = ('user admin', 'member_1', 'member_2')
self.loop.run_until_complete(
run_in_parallel(
(
(sign_in_views[0].create_user, {'enable_notifications': True}),
(sign_in_views[1].create_user, {'enable_notifications': True, 'username': "test user1"}),
(sign_in_views[2].create_user, {'enable_notifications': True, 'username': "test user2"})
(sign_in_views[0].create_user, {'enable_notifications': True, 'username': self.usernames[0]}),
(sign_in_views[1].create_user, {'enable_notifications': True, 'username': self.usernames[1]}),
(sign_in_views[2].create_user, {'enable_notifications': True, 'username': self.usernames[2]})
)
)
)
self.homes = [sign_in.get_home_view() for sign_in in sign_in_views]
users = self.loop.run_until_complete(
self.public_keys = self.loop.run_until_complete(
run_in_parallel(
(
(self.homes[0].get_public_key_and_username, {'return_username': True}),
(self.homes[1].get_public_key_and_username, {'return_username': True}),
(self.homes[2].get_public_key_and_username, {'return_username': True})
(self.homes[0].get_public_key,),
(self.homes[1].get_public_key,),
(self.homes[2].get_public_key,)
)
)
)
self.homes[0].just_fyi('Admin adds future members to contacts')
for i in range(3):
self.public_keys[i], self.usernames[i] = users[i]
for i in range(3):
self.homes[i].click_system_back_button_until_element_is_shown()
self.homes[i].chats_tab.click()
@ -198,8 +196,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
self.chat_name = self.homes[0].get_random_chat_name()
self.homes[0].chats_tab.click()
self.chats[0] = self.homes[0].create_group_chat(user_names_to_add=[self.usernames[1], self.usernames[2]],
group_chat_name=self.chat_name,
new_ui=True)
group_chat_name=self.chat_name)
for i in range(1, 3):
self.chats[i] = ChatView(self.drivers[i])

View File

@ -239,7 +239,7 @@ class TestRestoreOneDeviceMerged(MultipleSharedDeviceTestCase):
@marks.testrail_id(700748)
def test_restore_uppercase_whitespaces_seed_phrase_special_char_passw_logcat(self):
profile = self.home.profile_button.click()
public_key, username = self.sign_in.get_public_key_and_username(return_username=True)
public_key, username = self.sign_in.get_public_key()
self.sign_in.just_fyi("Check public key matches expected and no back up seed phrase is available")
profile.privacy_and_security_button.click()
@ -453,7 +453,7 @@ class TestRestoreOneDeviceMerged(MultipleSharedDeviceTestCase):
self.errors.append('Restored address %s does not match expected' % address)
self.sign_in.just_fyi('Check that after migration username and public key match expected')
public_key, default_username = self.sign_in.get_public_key_and_username(return_username=True)
public_key, default_username = self.sign_in.get_public_key()
profile = self.sign_in.get_profile_view()
if public_key != self.user['public_key']:
self.errors.append('Public key %s does not match expected' % public_key)

View File

@ -312,7 +312,6 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
self.channel_name = 'general'
self.community = self.home.create_community(name=self.community_name, description='test description')
self.home.jump_to_communities_home()
self.home.get_chat(self.community_name, community=True).click()
community_view = self.home.get_community_view()
self.channel = community_view.get_channel(self.channel_name).click()
@ -330,6 +329,7 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
self.drivers[0].fail("Not navigated to channel view after reopening app")
@marks.testrail_id(702742)
@marks.xfail(reason='flaky test; sometimes can not be copied through appium')
def test_community_copy_and_paste_message_in_chat_input(self):
message_texts = ['mmmeowesage_text', 'https://status.im']
@ -359,50 +359,42 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user, {'enable_notifications': True}),
(self.device_2.create_user,))))
self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view()
self.public_key_1, self.default_username_1 = self.home_1.get_public_key_and_username(return_username=True)
self.public_key_2, self.default_username_2 = self.home_2.get_public_key_and_username(return_username=True)
self.username_1, self.username_2 = "user_1", "user_2"
self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user, {'enable_notifications': True,
'username': self.username_1}),
(self.device_2.create_user, {'username': self.username_2}))))
self.homes = self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view()
self.public_key_2 = self.home_2.get_public_key()
self.profile_1 = self.home_1.get_profile_view()
[home.click_system_back_button_until_element_is_shown() for home in (self.home_1, self.home_2)]
[home.chats_tab.click() for home in (self.home_1, self.home_2)]
[home.click_system_back_button_until_element_is_shown() for home in self.homes]
[home.chats_tab.click() for home in self.homes]
self.home_1.add_contact(self.public_key_2)
self.home_2.handle_contact_request(self.default_username_1)
self.home_2.handle_contact_request(self.username_1)
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.default_username_2).click()
self.chat_1 = self.home_1.get_chat(self.username_2).click()
self.chat_1.send_message('hey')
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
self.chat_2 = self.home_2.get_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.home_1, self.home_2)]
[home.click_system_back_button_until_element_is_shown() for home in self.homes]
self.home_1.just_fyi("Open community to message")
self.home_1.communities_tab.click()
self.community_name = self.home_1.get_random_chat_name()
self.channel_name = 'general'
self.home_1.create_community(name=self.community_name, description='community to test', require_approval=False)
self.home_1.jump_to_communities_home()
self.home_1.get_chat(self.community_name, community=True).click()
community_view = self.home_1.get_community_view()
self.channel_1 = community_view.get_channel(self.channel_name).click()
self.channel_1 = self.home_1.get_to_community_channel_from_home(self.community_name)
self.channel_1.send_message(self.text_message)
self.community_1 = CommunityView(self.drivers[0])
self.community_1.send_invite_to_community(self.community_name, self.default_username_2)
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
self.community_1, self.community_2 = self.home_1.get_community_view(), self.home_2.get_community_view()
self.community_1.send_invite_to_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.element_by_text_part('View').click()
self.community_2 = CommunityView(self.drivers[1])
self.community_2.join_community()
self.home_1.just_fyi("Reopen community view to use new interface")
for home in (self.home_1, self.home_2):
home.jump_to_communities_home()
home.get_chat(self.community_name, community=True).click()
community_view = home.get_community_view()
community_view.get_channel(self.channel_name).click()
self.channel_2 = self.home_2.get_chat_view()
self.channel_2 = self.community_2.get_channel(self.channel_name).click()
@marks.testrail_id(702838)
@marks.xfail(reason="blocked by 14797")
@ -416,7 +408,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
(", ".join(sent_time_variants), timestamp))
for channel in self.channel_1, self.channel_2:
channel.verify_message_is_under_today_text(message, self.errors)
if self.channel_2.chat_element_by_text(message).username.text != self.default_username_1:
if self.channel_2.chat_element_by_text(message).username.text != self.username_1:
self.errors.append("Default username '%s' is not shown next to the received message" % self.username_1)
self.errors.verify_no_errors()
@ -456,6 +448,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(702840)
@marks.xfail(reason='flaky test; sometimes can not be copied through appium')
def test_community_emoji_send_copy_paste_reply(self):
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_name]
@ -561,7 +554,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
@marks.testrail_id(702894)
def test_community_contact_block_unblock_offline(self):
[home.jump_to_card_by_text('# %s' % self.channel_name) for home in [self.home_1, self.home_2]]
[home.jump_to_card_by_text('# %s' % self.channel_name) for home in self.homes]
self.channel_1.send_message('message to get avatar of user 2 visible in next message')
self.channel_2.just_fyi("Sending message before block")
@ -579,7 +572,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
if self.chat_1.chat_element_by_text(message_to_disappear).is_element_displayed():
self.errors.append("Messages from blocked user is not cleared in public chat ")
self.chat_1.jump_to_messages_home()
if self.home_1.element_by_text(self.default_username_2).is_element_displayed():
if self.home_1.element_by_text(self.username_2).is_element_displayed():
self.errors.append("1-1 chat from blocked user is not removed!")
self.chat_1.toggle_airplane_mode()
@ -602,7 +595,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.chat_1.profile_button.click()
profile_1.contacts_button.wait_and_click()
profile_1.blocked_users_button.wait_and_click()
profile_1.element_by_text(self.default_username_2).click()
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.click_system_back_button_until_element_is_shown()
@ -613,44 +606,43 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed(30):
self.errors.append("Message was not received in public chat after user unblock!")
# TODO: 15279 - user is not removed from contacts mutually
# self.home_2.just_fyi("Add blocked user to contacts again after removing(removed automatically when blocked)")
# chat_element = self.channel_1.chat_element_by_text(message_unblocked)
# chat_element.find_element()
# chat_element.member_photo.click()
# self.channel_1.profile_add_to_contacts_button.click()
# self.channel_1.profile_send_message_button.click()
# self.chat_1.send_message("piy")
#
# self.home_2.just_fyi("Check message in 1-1 chat after unblock")
# self.home_2.jump_to_messages_home()
# self.home_2.get_chat(self.default_username_1).click()
# self.chat_2.send_message(message_unblocked)
# # self.home_1.get_chat(self.default_username_2, wait_time=30).click()
# if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed():
# self.errors.append("Message was not received in 1-1 chat after user unblock!")
self.home_2.just_fyi("Add blocked user to contacts again after removing(removed automatically when blocked)")
chat_element = self.channel_1.chat_element_by_text(message_unblocked)
chat_element.find_element()
chat_element.member_photo.click()
self.channel_1.profile_add_to_contacts_button.click()
self.home_2.jump_to_messages_home()
self.home_2.handle_contact_request(self.username_1)
self.channel_1.profile_send_message_button.wait_and_click()
self.chat_1.send_message("piy")
self.home_2.just_fyi("Check message in 1-1 chat after unblock")
self.home_2.get_chat(self.username_1).click()
self.chat_2.send_message(message_unblocked)
if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed(30):
self.errors.append("Message was not received in 1-1 chat after user unblock!")
self.errors.verify_no_errors()
# @marks.testrail_id(702842)
# Skipped until implemented in NEW UI
# def test_community_mark_all_messages_as_read(self):
# self.channel_1.jump_to_communities_home()
# self.home_1.get_chat(self.community_name, community=True).click()
# self.channel_2.send_message(self.text_message)
# #self.home_1.get_chat(self.community_name).click()
# channel_1_element = self.community_1.get_channel(self.channel_name)
# if not channel_1_element.new_messages_public_chat.is_element_displayed():
# self.errors.append('New messages counter is not shown in public chat')
# mark_as_read_button = self.community_1.mark_all_messages_as_read_button
# channel_1_element.long_press_until_element_is_shown(mark_as_read_button)
# mark_as_read_button.click()
# if channel_1_element.new_messages_public_chat.is_element_displayed():
# self.errors.append('Unread messages badge is shown in community channel while there are no unread messages')
@marks.testrail_id(703086)
def test_community_mark_all_messages_as_read(self):
self.channel_1.jump_to_communities_home()
self.home_2.jump_to_card_by_text('# %s' % self.channel_name)
self.channel_2.send_message(self.text_message)
community_1_element = self.community_1.get_chat(self.community_name)
if not community_1_element.new_messages_public_chat.is_element_displayed(90):
self.errors.append('New messages counter is not shown in home > Commmunity element')
mark_as_read_button = self.community_1.mark_all_messages_as_read_button
community_1_element.long_press_until_element_is_shown(mark_as_read_button)
mark_as_read_button.click()
if community_1_element.new_messages_public_chat.is_element_displayed():
self.errors.append('Unread messages badge is shown in community channel while there are no unread messages')
# TODO: there should be one more check for community channel, which is still not ready
# self.community_1.click_system_back_button_until_element_is_shown()
# community_1_element = self.home_1.get_chat(self.community_name, community=True)
# if community_1_element.new_messages_community.is_element_displayed():
# self.errors.append('New messages community badge is shown on community after marking messages as read')
# self.errors.verify_no_errors()
self.errors.verify_no_errors()
@marks.testrail_id(702786)
def test_community_mentions_push_notification(self):
@ -663,14 +655,14 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.device_2.just_fyi("Invited member sends a message with a mention")
self.channel_2.send_message("hi")
self.channel_2.mention_user(self.default_username_1)
self.channel_2.mention_user(self.username_1)
self.channel_2.send_message_button.click()
self.device_1.just_fyi("Admin gets push notification with the mention and tap it")
self.device_1.open_notification_bar()
if self.home_1.get_pn(self.default_username_1):
self.device_1.click_upon_push_notification_by_text(self.default_username_1)
if not self.channel_1.chat_element_by_text(self.default_username_1).is_element_displayed():
if self.home_1.get_pn(self.username_1):
self.device_1.click_upon_push_notification_by_text(self.username_1)
if not self.channel_1.chat_element_by_text(self.username_1).is_element_displayed():
if self.channel_1.chat_message_input.is_element_displayed():
self.errors.append("Message with the mention is not shown in the chat for the admin")
else:
@ -681,13 +673,14 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
# ToDo: this part is skipped because of an issue - sent messages stuck without any status for a long time
# and can not be edited during that time
# self.device_2.just_fyi("Sender edits the message with a mention")
# self.channel_2.chat_element_by_text(self.default_username_1).long_press_element_by_coordinate(rel_y=0)
# self.channel_2.chat_element_by_text(self.username_1).wait_for_sent_state()
# self.channel_2.chat_element_by_text(self.username_1).long_press_element_by_coordinate(rel_y=0)
# try:
# self.channel_2.element_by_translation_id("edit-message").click()
# for i in range(29, 32):
# self.channel_2.driver.press_keycode(i)
# self.channel_2.send_message_button.click()
# edited_message = self.default_username_1 + " abc"
# edited_message = self.username_1 + " abc"
# if not self.channel_2.chat_element_by_text(edited_message).is_element_displayed():
# self.errors.append("Edited message is not shown correctly for the sender")
# if not self.channel_1.chat_element_by_text(edited_message).is_element_displayed():
@ -704,14 +697,14 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
# self.community_1.get_channel(self.channel_name).click()
#
# self.device_1.just_fyi("Admin sends a message with a mention")
# self.channel_1.mention_user(self.default_username_2)
# self.channel_1.mention_user(self.username_2)
# self.channel_1.send_message_button.click()
# self.device_2.just_fyi("Invited member gets push notification with the mention and tap it")
# self.device_2.open_notification_bar()
# if not self.home_2.get_pn(self.default_username_2):
# if not self.home_2.get_pn(self.username_2):
# self.device_2.driver.fail("Push notification with the mention was not received by the invited member")
# self.device_2.click_upon_push_notification_by_text(self.default_username_2)
# if not self.channel_2.chat_element_by_text(self.default_username_2).is_element_displayed():
# self.device_2.click_upon_push_notification_by_text(self.username_2)
# if not self.channel_2.chat_element_by_text(self.username_2).is_element_displayed():
# if self.channel_2.chat_message_input.is_element_displayed():
# self.device_2.driver.fail("Message with the mention is not shown in the chat for the invited member")
# else:

View File

@ -301,7 +301,7 @@ class TestKeycardTxOneDeviceMerged(MultipleSharedDeviceTestCase):
@marks.testrail_id(700768)
def test_keycard_relogin_after_restore(self):
self.sign_in.just_fyi('Check that username and public key match expected')
public_key, default_username = self.sign_in.get_public_key_and_username(return_username=True)
public_key, default_username = self.sign_in.get_public_key()
profile = self.sign_in.get_profile_view()
if public_key != self.user['public_key']:
self.errors.append('Public key %s does not match expected' % public_key)
@ -431,7 +431,7 @@ class TestKeycardTxOneDeviceMerged(MultipleSharedDeviceTestCase):
self.sign_in.profile_button.wait_for_visibility_of_element(30)
wallet_1 = self.sign_in.wallet_button.click()
wallet_address = wallet_1.get_wallet_address()
public_key, default_username = self.sign_in.get_public_key_and_username(return_username=True)
public_key, default_username = self.sign_in.get_public_key()
profile_1 = self.sign_in.get_profile_view()
profile_1.logout()
@ -469,7 +469,7 @@ class TestKeycardTxOneDeviceMerged(MultipleSharedDeviceTestCase):
wallet_2.wallet_button.double_click()
if wallet_address != wallet_address_2:
self.errors.append('Wallet address on restored multiaccount is not equal to created keycard multiaccount')
public_key_2, default_username_2 = self.sign_in.get_public_key_and_username(return_username=True)
public_key_2, default_username_2 = self.sign_in.get_public_key()
if public_key != public_key_2:
self.errors.append('Public key on restored multiaccount is not equal to created keycard multiaccount')
if default_username_2 != default_username:

View File

@ -1,76 +1,8 @@
import pytest
from tests import marks, run_in_parallel, common_password
from tests import marks, run_in_parallel
from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers
from views.sign_in_view import SignInView
from views.chat_view import CommunityView
@pytest.mark.xdist_group(name="four_2")
@marks.medium
class TestActivityCenterMultipleDeviceMedium(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.home_1, self.home_2 = self.device_1.create_user(enable_notifications=True), self.device_2.create_user()
self.public_key_user_1, self.username_1 = self.home_1.get_public_key_and_username(return_username=True)
self.public_key_user_2, self.username_2 = self.home_2.get_public_key_and_username(return_username=True)
[self.group_chat_name_1, self.group_chat_name_2] = "GroupChat1", "GroupChat2"
self.message_from_sender = "Message sender"
self.home_2.home_button.double_click()
self.device_2_one_to_one_chat = self.home_2.add_contact(self.public_key_user_1)
@marks.testrail_id(702185)
def test_activity_center_notifications_on_mentions_in_groups_and_empty_state(self):
[home.home_button.double_click() for home in [self.home_1, self.home_2]]
if not self.home_1.element_by_text_part(self.username_2).is_element_displayed():
self.home_1.handle_contact_request(self.username_2)
self.home_1.home_button.double_click()
self.device_2.just_fyi('Device2 creates Group chat 3')
self.home_2.create_group_chat([self.username_1], group_chat_name=self.group_chat_name_1)
self.home_2.home_button.double_click()
self.home_1.just_fyi("Device1 joins Group chat 3")
group_chat_1 = self.home_1.get_chat(self.group_chat_name_1).click()
group_chat_1.join_chat_button.click_if_shown()
group_chat_1.home_button.double_click()
self.home_2.just_fyi("Device2 mentions Device1 in Group chat 3")
chat_2 = self.home_2.get_chat_from_home_view(self.group_chat_name_1).click()
chat_2.select_mention_from_suggestion_list(self.username_1, self.username_1[:2])
chat_2.send_as_keyevent("group")
group_chat_message = self.username_1 + " group"
chat_2.send_message_button.click()
self.home_1.just_fyi("Device1 checks unread indicator on Activity center bell")
if not self.home_1.notifications_unread_badge.is_element_displayed():
self.errors.append("Unread badge is NOT shown after receiving mentions from Group")
self.home_1.notifications_unread_badge.click_until_absense_of_element(self.home_1.plus_button, 6)
self.home_1.just_fyi("Check that notification from group is presented in Activity Center")
if not self.home_1.get_element_from_activity_center_view(
self.username_2).chat_message_preview == group_chat_message:
self.errors.append("No mention in Activity Center for Group Chat")
self.home_1.just_fyi("Open group chat where user mentioned")
self.home_1.get_element_from_activity_center_view(self.username_2).click()
self.home_1.home_button.double_click()
self.home_1.just_fyi("Check there are no unread messages counter on chats after message is read")
if (self.home_1.notifications_unread_badge.is_element_displayed() or
self.home_1.get_chat_from_home_view(self.group_chat_name_1).new_messages_counter.text == "1"):
self.errors.append("Unread message indicator is kept after message is read in chat")
self.home_1.just_fyi("Check there is an empty view on Activity Center")
self.home_1.notifications_button.click()
if not self.home_1.element_by_translation_id('empty-activity-center').is_element_displayed():
self.errors.append("Activity Center still has some chats after user has opened all of them")
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="new_two_2")
@ -80,19 +12,15 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user, {'enable_notifications': True}),
(self.device_2.create_user,))))
self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view()
self.username_1, self.username_2 = 'sender', 'receiver'
self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user, {'enable_notifications': True,
'username': self.username_1}),
(self.device_2.create_user, {'username': self.username_2}))))
self.homes = self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view()
self.profile_1, self.profile_2 = self.home_1.get_profile_view(), self.home_2.get_profile_view()
users = self.loop.run_until_complete(run_in_parallel(
((self.home_1.get_public_key_and_username, {'return_username': True}),
(self.home_2.get_public_key_and_username, {'return_username': True}))
))
self.public_key_1, self.default_username_1 = users[0]
self.public_key_2, self.default_username_2 = users[1]
[home.click_system_back_button_until_element_is_shown() for home in [self.home_1, self.home_2]]
[home.chats_tab.click() for home in [self.home_1, self.home_2]]
self.public_key_1, self.public_key_2 = (home.get_public_key() for home in self.homes)
[home.click_system_back_button_until_element_is_shown() for home in self.homes]
[home.chats_tab.click() for home in self.homes]
@marks.testrail_id(702850)
@marks.xfail(reason="Blocked by 15500")
@ -104,7 +32,7 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.home_2.add_a_contact_chat_bottom_sheet_button.click()
self.home_2.element_by_translation_id("paste").click()
self.home_2.element_by_translation_id("user-found").wait_for_visibility_of_element(10)
if not self.home_2.element_by_text(self.default_username_1).is_element_displayed():
if not self.home_2.element_by_text(self.username_1).is_element_displayed():
self.errors.append("Username is not shown on 'Add contact' page after entering valid public key")
chat = self.home_2.get_chat_view()
@ -127,17 +55,20 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.errors.append("The amount of contact requests is not shown for incoming CR!")
self.device_1.just_fyi('Device1 declines pending contact request')
self.home_1.handle_contact_request(username=self.default_username_2, action='decline')
self.home_1.handle_contact_request(username=self.username_2, action='decline')
for indicator in (self.home_1.notifications_unread_badge, self.home_1.contact_new_badge, self.home_1.pending_contact_request_text):
if indicator.is_element_displayed():
self.errors.append("Unread indicator on contacts tab or on activity center is shown after declining contact request!")
self.device_1.just_fyi("Check that it is still pending contact after declining on sender device")
self.home_2.jump_to_messages_home()
self.home_2.contacts_tab.click()
if self.home_2.pending_contact_request_text.text != '1':
self.errors.append("No pending CR for sender anymore after receiver has declined CR!")
self.home_2.recent_tab.click()
self.home_2.open_activity_center_button.click()
self.home_2.activity_unread_filter_button.click()
activity_center_element = self.home_2.get_element_from_activity_center_view(self.username_1)
if activity_center_element.message_body.text != self.home_2.get_translation_by_key("add-me-to-your-contacts"):
self.errors.append("Pending contact request is not shown on unread notification element on Activity center!,"
" actual is '%s'" % activity_center_element.message_body.text)
self.home_2.close_activity_centre.click()
self.errors.verify_no_errors()
@ -152,7 +83,7 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.home_1.open_activity_center_button.click()
self.home_1.just_fyi("Mark all as read")
cr_element = self.home_1.get_element_from_activity_center_view(self.default_username_2)
cr_element = self.home_1.get_element_from_activity_center_view(self.username_2)
self.home_1.more_options_activity_button.click()
self.home_1.mark_all_read_activity_button.click()
if cr_element.is_element_displayed():
@ -164,13 +95,13 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.home_1.activity_notification_swipe_button.click()
self.home_1.close_activity_centre.click()
self.home_1.contacts_tab.click()
if not self.home_1.contact_details(username=self.default_username_2).is_element_displayed(20):
if not self.home_1.contact_details(username=self.username_2).is_element_displayed(20):
self.errors.append("Contact was not added to contact list after accepting contact request (as receiver)")
self.device_2.just_fyi('Device1 check that contact appeared in contact list mutually')
self.home_2.chats_tab.click()
self.home_2.contacts_tab.click()
if not self.home_2.contact_details(username=self.default_username_1).is_element_displayed(20):
if not self.home_2.contact_details(username=self.username_1).is_element_displayed(20):
self.errors.append("Contact was not added to contact list after accepting contact request (as sender)")
self.errors.verify_no_errors()
@ -183,63 +114,50 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.username_1, self.username_2 = 'user1', 'user2'
self.loop.run_until_complete(
run_in_parallel(((self.device_1.create_user, {'username': 'user1'}),
(self.device_2.create_user, {'username': 'user2'}))))
self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view()
run_in_parallel(((self.device_1.create_user, {'username': self.username_1}),
(self.device_2.create_user, {'username': self.username_2}))))
self.homes = self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view()
self.profile_1, self.profile_2 = self.home_1.get_profile_view(), self.home_2.get_profile_view()
users = self.loop.run_until_complete(run_in_parallel(
((self.home_1.get_public_key_and_username, {'return_username': True}),
(self.home_2.get_public_key_and_username, {'return_username': True}))
))
self.public_key_1, self.default_username_1 = users[0]
self.public_key_2, self.default_username_2 = users[1]
[home.click_system_back_button_until_element_is_shown() for home in (self.home_1, self.home_2)]
[home.chats_tab.click() for home in (self.home_1, self.home_2)]
self.public_key_2 = self.home_2.get_public_key()
self.home_2.click_system_back_button_until_element_is_shown()
[home.chats_tab.click() for home in self.homes]
self.home_1.add_contact(self.public_key_2)
self.home_2.handle_contact_request(self.default_username_1)
self.home_2.handle_contact_request(self.username_1)
self.text_message = 'hello'
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.default_username_2).click()
self.chat_1 = self.home_1.get_chat(self.username_2).click()
self.chat_1.send_message(self.one_to_one_message)
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
self.chat_2 = self.home_2.get_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.home_1, self.home_2)]
[home.click_system_back_button_until_element_is_shown() for home in self.homes]
self.home_1.just_fyi("Open community to message")
self.home_1.communities_tab.click()
self.community_name = self.home_1.get_random_chat_name()
self.channel_name = 'general'
self.home_1.create_community(name=self.community_name, description='community to test', require_approval=False)
self.home_1.jump_to_communities_home()
self.home_1.get_chat(self.community_name, community=True).click()
community_view = self.home_1.get_community_view()
self.channel_1 = community_view.get_channel(self.channel_name).click()
self.channel_1 = self.home_1.get_to_community_channel_from_home(self.community_name)
self.channel_1.send_message(self.text_message)
self.community_1 = CommunityView(self.drivers[0])
self.community_1.send_invite_to_community(self.community_name, self.default_username_2)
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
self.community_1, self.community_2 = self.home_1.get_community_view(), self.home_2.get_community_view()
self.community_1.send_invite_to_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.element_by_text_part('View').click()
self.community_2 = CommunityView(self.drivers[1])
self.community_2.join_community()
self.home_1.just_fyi("Reopen community view to use new interface")
for home in (self.home_1, self.home_2):
home.jump_to_communities_home()
home.get_chat(self.community_name, community=True).click()
community_view = home.get_community_view()
community_view.get_channel(self.channel_name).click()
self.channel_2 = self.home_2.get_chat_view()
self.channel_2 = self.community_2.get_channel(self.channel_name).click()
@marks.testrail_id(702936)
def test_navigation_jump_to(self):
self.community_1.just_fyi("Check Jump to screen and redirect on tap")
self.community_1.jump_to_button.click()
for card in (self.community_name, self.default_username_2):
for card in (self.community_name, self.username_2):
if not self.community_1.element_by_text_part(card).is_element_displayed(20):
self.errors.append("Card %s is not shown on Jump to screen!" % card)
self.community_1.element_by_translation_id("community-channel").click()
@ -247,7 +165,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.errors.append("User was not redirected to community channel after tapping on community channel card!")
self.channel_1.click_system_back_button()
self.community_1.jump_to_button.click()
self.community_1.element_by_text_part(self.default_username_2).click()
self.community_1.element_by_text_part(self.username_2).click()
if not self.chat_1.chat_element_by_text(self.one_to_one_message).is_element_displayed(20):
self.errors.append("User was not redirected to 1-1 chat after tapping card!")
@ -332,13 +250,12 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(702957)
@marks.xfail(reason="Blocked by 15500")
def test_activity_center_mentions(self):
self.home_1.jump_to_communities_home()
self.home_2.jump_to_card_by_text('# %s' % self.channel_name)
self.device_2.just_fyi("Invited member sends a message with a mention")
self.channel_2.mention_user(self.default_username_1)
self.channel_2.mention_user(self.username_1)
self.channel_2.send_message_button.click()
self.home_1.just_fyi("Checking unread indicators")
@ -352,26 +269,25 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.home_1.just_fyi("Checking mention attributes in activity center")
self.home_1.open_activity_center_button.click()
mention_element = self.home_1.get_element_from_activity_center_view('@%s' % self.default_username_1)
mention_element = self.home_1.get_element_from_activity_center_view('@%s' % self.username_1)
if mention_element.title.text != 'Mention':
self.errors.append("Expected title is not shown, '%s' is instead!" % mention_element.title)
if not mention_element.unread_indicator.is_element_displayed():
self.errors.append("No unread dot is shown on activity center element (mention)!")
if mention_element.message_body.text != '@%s' % self.default_username_1:
if mention_element.message_body.text != '@%s' % self.username_1:
self.errors.append("Mention body in activity center does not match expected, it is %s!" % mention_element.message_body.text)
self.home_1.just_fyi("Tap on it and check redirect to channel")
mention_element.click()
if not self.channel_1.chat_element_by_text(self.default_username_1).is_element_displayed():
if not self.channel_1.chat_element_by_text(self.username_1).is_element_displayed():
self.errors.append("Was not redirected to chat after tapping on mention!")
self.errors.verify_no_errors()
@marks.testrail_id(702958)
@marks.xfail(reason="Blocked by 15500")
def test_activity_center_admin_notification_accept_swipe(self):
self.home_2.just_fyi("Clearing history")
self.home_2.jump_to_messages_home()
self.home_2.clear_chat_long_press(self.default_username_1)
self.home_2.clear_chat_long_press(self.username_1)
[home.jump_to_communities_home() for home in (self.home_1, self.home_2)]
self.home_1.just_fyi("Open community to message")
@ -381,11 +297,11 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.home_1.create_community(name=community_name, description='community to test', require_approval=True)
self.home_1.reopen_app()
community_element = self.home_1.get_chat(community_name, community=True)
self.community_1.share_community(community_element, self.default_username_2)
self.community_1.share_community(community_element, self.username_2)
self.home_2.just_fyi("Request access to community")
self.home_2.jump_to_messages_home()
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
self.chat_2 = self.home_2.get_chat(self.username_1).click()
self.chat_2.element_by_text_part('View').click()
self.community_2.join_community()
[home.jump_to_communities_home() for home in (self.home_1, self.home_2)]
@ -393,7 +309,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.home_1.just_fyi("Checking unread indicators")
self.home_1.notifications_unread_badge.wait_for_visibility_of_element(120)
self.home_1.open_activity_center_button.click()
reply_element = self.home_1.get_element_from_activity_center_view(self.default_username_2)
reply_element = self.home_1.get_element_from_activity_center_view(self.username_2)
if reply_element.title.text != 'Join request':
self.errors.append("Expected title is not shown, '%s' is instead!" % reply_element.title)
if not reply_element.unread_indicator.is_element_displayed():
@ -406,8 +322,3 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
if not self.home_2.element_by_text_part(community_name).is_element_displayed(30):
self.errors.append("Community is not appeared in the list after accepting admin request from activity centre")
self.errors.verify_no_errors()

View File

@ -185,7 +185,7 @@ class TestBrowserProfileOneDevice(MultipleSharedDeviceTestCase):
@marks.testrail_id(702159)
def test_profile_invite_friends(self):
chat_key = self.home.get_public_key_and_username()
chat_key = self.home.get_public_key()
self.home.home_button.double_click()
self.home.just_fyi("Check it via 'Invite friends' on home view")

View File

@ -20,8 +20,8 @@ class TestTimelineHistoryNodesBootnodesMultipleDeviceMergedMedium(MultipleShared
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.home_1, self.home_2 = device_1.create_user(), device_2.create_user()
self.profile_1, self.profile_2 = self.home_1.profile_button.click(), self.home_2.profile_button.click()
self.public_key_1, self.username_1 = self.profile_1.get_public_key_and_username(return_username=True)
self.public_key_2, self.username_2 = self.profile_2.get_public_key_and_username(return_username=True)
self.public_key_1, self.username_1 = self.profile_1.get_public_key()
self.public_key_2, self.username_2 = self.profile_2.get_public_key()
self.text_message = 'hello'
[home.home_button.click() for home in (self.home_1, self.home_2)]
self.public_chat_name = self.home_1.get_random_chat_name()
@ -304,8 +304,8 @@ class TestChatMediumMultipleDevice(MultipleSharedDeviceTestCase):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.home_1, self.home_2 = self.device_1.create_user(enable_notifications=True), self.device_2.create_user()
self.public_key_1, self.default_username_1 = self.home_1.get_public_key_and_username(return_username=True)
self.public_key_2, self.default_username_2 = self.home_2.get_public_key_and_username(return_username=True)
self.public_key_1, self.default_username_1 = self.home_1.get_public_key()
self.public_key_2, self.default_username_2 = self.home_2.get_public_key()
[home.home_button.click() for home in (self.home_1, self.home_2)]
self.home_1.just_fyi("Creating 1-1 chats")
@ -687,7 +687,7 @@ class TestGroupChatMultipleDeviceMediumMerged(MultipleSharedDeviceTestCase):
self.sign_ins[key] = SignInView(self.drivers[key])
self.homes[key] = self.sign_ins[key].create_user()
SignInView(self.drivers[2]).put_app_to_background_and_back()
self.public_keys[key], self.usernames[key] = self.sign_ins[key].get_public_key_and_username(True)
self.public_keys[key], self.usernames[key] = self.sign_ins[key].get_public_key(True)
self.sign_ins[key].home_button.click()
SignInView(self.drivers[0]).put_app_to_background_and_back()
@ -822,8 +822,7 @@ class TestChatKeycardMentionsMediumMultipleDevice(MultipleSharedDeviceTestCase):
self.device_1.just_fyi('Grab user data for transactions and public chat, set up wallets')
self.home_1 = self.device_1.create_user(keycard=True, enable_notifications=True)
self.device_2.put_app_to_background_and_back()
self.recipient_public_key, self.recipient_username = self.home_1.get_public_key_and_username(
return_username=True)
self.recipient_public_key, self.recipient_username = self.home_1.get_public_key()
self.amount = self.device_1.get_unique_amount()
self.asset_name = 'STT'
self.wallet_1 = self.home_1.wallet_button.click()
@ -1024,8 +1023,8 @@ class TestMutualContactRequests(MultipleSharedDeviceTestCase):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.home_1, self.home_2 = self.device_1.create_user(enable_notifications=True), self.device_2.create_user()
self.public_key_1, self.default_username_1 = self.home_1.get_public_key_and_username(return_username=True)
self.public_key_2, self.default_username_2 = self.home_2.get_public_key_and_username(return_username=True)
self.public_key_1, self.default_username_1 = self.home_1.get_public_key()
self.public_key_2, self.default_username_2 = self.home_2.get_public_key()
[home.tap_mutual_cr_switcher() for home in (self.home_1, self.home_2)]
[home.home_button.click() for home in (self.home_1, self.home_2)]

View File

@ -16,7 +16,7 @@ class TestDeeplinkChatProfileOneDevice(MultipleSharedDeviceTestCase):
self.drivers, self.loop = create_shared_drivers(1)
self.sign_in = SignInView(self.drivers[0])
self.home = self.sign_in.create_user()
self.public_key, self.default_username = self.home.get_public_key_and_username(return_username=True)
self.public_key, self.default_username = self.home.get_public_key()
self.home.home_button.click()
self.public_chat_name = 'pubchat'
self.nickname = 'dummy_user'
@ -343,7 +343,7 @@ class TestDeeplinkChatProfileOneDevice(MultipleSharedDeviceTestCase):
# self.drivers, self.loop = create_shared_drivers(1)
# self.sign_in = SignInView(self.drivers[0])
# self.home = self.sign_in.create_user()
# self.public_key, self.default_username = self.home.get_public_key_and_username(return_username=True)
# self.public_key, self.default_username = self.home.get_public_key()
# self.home.click_system_back_button_until_element_is_shown()
# self.home.chats_tab.click_until_presence_of_element(self.home.plus_button)
#

View File

@ -18,7 +18,7 @@ class TestPairingSyncMediumMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.drivers[1]), SignInView(self.drivers[2])
self.home_1 = self.device_1.create_user()
self.public_key_1, self.username_1 = self.home_1.get_public_key_and_username(return_username=True)
self.public_key_1, self.username_1 = self.home_1.get_public_key()
self.profile_1 = self.home_1.profile_button.click()
self.profile_1.privacy_and_security_button.click()
@ -29,7 +29,7 @@ class TestPairingSyncMediumMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.profile_1.home_button.click()
self.device_2.put_app_to_background_and_back()
self.home_3 = self.device_3.create_user()
self.public_key_3, self.username_3 = self.home_3.get_public_key_and_username(return_username=True)
self.public_key_3, self.username_3 = self.home_3.get_public_key()
self.device_3.home_button.click()
self.device_1.put_app_to_background_and_back()
self.comm_before_sync_name, self.channel, self.message = 'b-%s' % self.home_1.get_random_chat_name(), 'some-rand-chann', 'comm_message'

View File

@ -18,7 +18,7 @@ class TestPermissionsScanQrOneDevice(MultipleSharedDeviceTestCase):
self.drivers, self.loop = create_shared_drivers(1)
self.sign_in = SignInView(self.drivers[0])
self.home = self.sign_in.recover_access(transaction_senders['C']['passphrase'])
self.public_key = self.home.get_public_key_and_username()
self.public_key = self.home.get_public_key()
self.home.home_button.click()
@marks.testrail_id(702289)

View File

@ -17,8 +17,8 @@ class TestProfileGapsCommunityMediumMultipleDevicesMerged(MultipleSharedDeviceTe
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.home_1, self.home_2 = self.device_1.create_user(enable_notifications=True), self.device_2.create_user(enable_notifications=True)
self.public_key_1, self.default_username_1 = self.home_1.get_public_key_and_username(return_username=True)
self.public_key_2, self.default_username_2 = self.home_2.get_public_key_and_username(return_username=True)
self.public_key_1, self.default_username_1 = self.home_1.get_public_key()
self.public_key_2, self.default_username_2 = self.home_2.get_public_key()
[home.home_button.click() for home in (self.home_1, self.home_2)]
self.home_1.just_fyi("Creating 1-1 chats")

View File

@ -206,7 +206,7 @@ class TestChatManagement(SingleDeviceTestCase):
sign_in.just_fyi('Check username and relogin')
profile = sign_in.get_profile_view()
public_key, real_username = profile.get_public_key_and_username(return_username=True)
public_key, real_username = profile.get_public_key()
if real_username != username:
self.errors.append('Username was changed after interruption of creating account')
profile.logout()
@ -244,7 +244,7 @@ class TestChatManagement(SingleDeviceTestCase):
element.wait_for_visibility_of_element(30)
element.click()
sign_in.profile_button.wait_for_visibility_of_element(30)
public_key, default_username = sign_in.get_public_key_and_username(return_username=True)
public_key, default_username = sign_in.get_public_key()
profile_view = sign_in.get_profile_view()
if public_key != basic_user['public_key']:
self.errors.append('Public key %s does not match expected' % public_key)
@ -986,7 +986,7 @@ class TestChatManagement(SingleDeviceTestCase):
sign_in.start_button.click()
sign_in.just_fyi('Delete 2nd multiaccount')
public_key, username = sign_in.get_public_key_and_username(return_username=True)
public_key, username = sign_in.get_public_key()
profile.privacy_and_security_button.click()
profile.delete_my_profile_button.scroll_and_click()
for text in (username, delete_alert_warning):
@ -1115,7 +1115,7 @@ class TestChatManagement(SingleDeviceTestCase):
self.address = self.wallet.get_wallet_address()
w3.donate_testnet_eth(self.address, 0.1)
self.wallet.wait_balance_is_changed()
self.chat_key = self.home.get_public_key_and_username()
self.chat_key = self.home.get_public_key()
self.wallet.just_fyi("Get required STT")
self.wallet.get_test_assets(token=True)

View File

@ -253,7 +253,7 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
device_2_home = device_2.create_user()
device_2_public_key = device_2_home.get_public_key_and_username()
device_2_public_key = device_2_home.get_public_key()
device_2_home.home_button.click()
user = upgrade_users['chats']
seed = user['passphrase']
@ -492,7 +492,7 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
home_1 = device_1.import_db(seed_phrase=user['passphrase'], import_db_folder_name='group/admin')
home_2 = device_2.create_user()
profile_2 = home_2.profile_button.click()
public_key_2, username_2 = profile_2.get_public_key_and_username(return_username=True)
public_key_2, username_2 = profile_2.get_public_key(e)
device_1.just_fyi("Activity centre: send message to 1-1 and invite member to group chat")
chat_1 = home_1.add_contact(public_key_2, add_in_contacts=False)

View File

@ -367,6 +367,10 @@ class BaseView(object):
self.driver.info('# STEP: %s' % some_str, device=False)
self.driver.execute_script("sauce:context=STEP: %s" % some_str)
def hide_keyboard_if_shown(self):
if self.driver.is_keyboard_shown():
self.driver.hide_keyboard()
def click_system_back_button(self, times=1):
self.driver.info('Click system back button')
for _ in range(times):
@ -616,17 +620,15 @@ class BaseView(object):
TouchAction(self.driver).tap(None, 255, 104, 1).perform()
time.sleep(3)
def get_public_key_and_username(self, return_username=False):
self.driver.info("Get public key and username, return_username '%s'" % str(return_username))
def get_public_key(self):
self.driver.info("Get public key")
profile_view = self.get_profile_view()
self.profile_button.click_until_presence_of_element(profile_view.default_username_text)
default_username = profile_view.default_username_text.text
profile_view.share_my_profile_button.click()
profile_view.public_key_text.wait_for_visibility_of_element(20)
public_key = profile_view.public_key_text.text
self.click_system_back_button()
user_data = (public_key, default_username) if return_username else public_key
return user_data
return public_key
def tap_mutual_cr_switcher(self):
profile_view = self.profile_button.click()

View File

@ -146,7 +146,6 @@ class ChatElementByText(Text):
@property
def timestamp_command_message(self):
class TimeStampText(Button):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, xpath="(%s//android.widget.TextView)[last()]" % parent_locator)
@ -183,6 +182,11 @@ class ChatElementByText(Text):
xpath="//android.view.ViewGroup//android.widget.TextView[contains(@text,'%s')]" % text)
return element.is_element_displayed(wait_time)
def wait_for_sent_state(self, wait_time=30):
return BaseElement(self.driver, prefix=self.locator,
xpath="//*[@content-desc='message-sent']").is_element_displayed(wait_time)
@property
def uncollapse(self) -> bool:
class Collapse(Button):
@ -1098,7 +1102,7 @@ class ChatView(BaseView):
"%I:%M %p")
timestamp_obj = datetime.strptime(timestamp, '%I:%M %p')
possible_timestamps_obj = [timestamp_obj + timedelta(0, 0, 0, 0, 1), timestamp_obj,
timestamp_obj - timedelta(0, 0, 0, 0, 1)]
timestamp_obj - timedelta(0, 0, 0, 0, 1), timestamp_obj - timedelta(0, 0, 0, 0, 2)]
timestamps = list(map(lambda x: x.strftime("%I:%M %p"), possible_timestamps_obj))
final_timestamps = [t[1:] if t[0] == '0' else t for t in timestamps]
return final_timestamps
@ -1139,8 +1143,8 @@ class ChatView(BaseView):
self.chat_message_input.click_inside()
self.chat_message_input.send_keys("@")
try:
mentions_list = self.mentions_list.wait_for_element()
mentions_list.find_element(MobileBy.XPATH, "//*[@text='%s']" % user_name).click()
self.mentions_list.wait_for_element()
self.driver.find_element(MobileBy.XPATH, "//*[@content-desc='user-list']//*[@text='%s']" % user_name).click()
except TimeoutException:
self.driver.fail("Mentions list is not shown")

View File

@ -196,7 +196,7 @@ class HomeView(BaseView):
self.stop_status_service_button = Button(self.driver, accessibility_id="STOP")
self.my_profile_on_start_new_chat_button = Button(self.driver,
xpath="//*[@content-desc='current-account-photo']")
self.communities_button = ChatButton(self.driver, accessibility_id="communities-button")
self.communities_button = ChatButton(self.driver, accessibility_id="create-community")
self.ens_banner_close_button = Button(self.driver, accessibility_id=":ens-banner-close-button")
# Notification centre
@ -225,7 +225,7 @@ class HomeView(BaseView):
self.chats_menu_invite_friends_button = Button(self.driver, accessibility_id="chats-menu-invite-friends-button")
self.delete_chat_button = Button(self.driver, translation_id="delete-chat")
self.clear_history_button = Button(self.driver, accessibility_id="clear-history")
self.mark_all_messages_as_read_button = Button(self.driver, accessibility_id="mark-all-read-button")
self.mark_all_messages_as_read_button = Button(self.driver, accessibility_id="mark-as-read")
# Connection icons
self.mobile_connection_off_icon = Button(self.driver, accessibility_id="conn-button-mobile-sync-off")
@ -287,6 +287,11 @@ class HomeView(BaseView):
chat_in_ac.click()
return chat_element
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])
@ -338,26 +343,13 @@ class HomeView(BaseView):
chat.set_nickname(nickname)
self.click_system_back_button_until_element_is_shown()
def create_group_chat(self, user_names_to_add: list, group_chat_name: str = 'new_group_chat', new_ui=False):
def create_group_chat(self, user_names_to_add: list, group_chat_name: str = 'new_group_chat'):
self.driver.info("## Creating group chat '%s'" % group_chat_name, device=False)
self.new_chat_button.click()
chat = self.get_chat_view()
if new_ui:
self.start_a_new_chat_bottom_sheet_button.click()
[chat.get_username_checkbox(user_name).click() for user_name in user_names_to_add]
self.setup_chat_button.click()
else:
chat = self.new_group_chat_button.click()
if user_names_to_add:
for user_name in user_names_to_add:
if len(user_names_to_add) > 5:
chat.search_by_keyword(user_name[:5])
chat.get_username_checkbox(user_name).click()
chat.search_input.clear()
else:
chat.get_username_checkbox(user_name).click()
chat.next_button.click()
self.start_a_new_chat_bottom_sheet_button.click()
[chat.get_username_checkbox(user_name).click() for user_name in user_names_to_add]
self.setup_chat_button.click()
chat.chat_name_editbox.send_keys(group_chat_name)
chat.create_button.click()
self.driver.info("## Group chat %s is created successfully!" % group_chat_name, device=False)
@ -381,7 +373,6 @@ class HomeView(BaseView):
self.driver.info("## Creating community '%s', set image is set to '%s'" % (name, str(set_image)), device=False)
self.plus_button.click()
chat_view = self.communities_button.click()
chat_view.create_community_button.click()
chat_view.community_name_edit_box.set_value(name)
chat_view.community_description_edit_box.set_value(description)
if set_image:
@ -398,7 +389,7 @@ class HomeView(BaseView):
chat_view.confirm_create_in_community_button.wait_and_click()
self.driver.info("## Community is created successfully!", device=False)
return chat_view.get_community_by_name(name)
return self.get_community_view()
def import_community(self, key):
self.driver.info("## Importing community")