User profilepic display setting test

Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
Serhy 2021-03-04 11:35:48 +02:00
parent 0491038b09
commit 174329d098
No known key found for this signature in database
GPG Key ID: 5D7C4B9E2B6F500B
5 changed files with 121 additions and 23 deletions

View File

@ -555,21 +555,6 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(5475)
@marks.low
@marks.skip
# TODO: skip until profile picture change feature is enabled
def test_change_profile_picture_several_times(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
profile_view = sign_in_view.profile_button.click()
for file_name in ['sauce_logo.png', 'sauce_logo_red.png', 'saucelabs_sauce.png']:
profile_view.edit_profile_picture(file_name=file_name)
profile_view.swipe_down()
if not profile_view.profile_picture.is_element_image_equals_template(
file_name.replace('.png', '_profile.png')):
self.driver.fail('Profile picture was not updated')
@marks.testrail_id(5468) @marks.testrail_id(5468)
@marks.medium @marks.medium
@marks.skip @marks.skip
@ -647,6 +632,97 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
if public_chat_2.chat_element_by_text(message).member_photo.is_element_image_similar_to_template('sauce_logo.png'): if public_chat_2.chat_element_by_text(message).member_photo.is_element_image_similar_to_template('sauce_logo.png'):
self.drivers[0].fail('Profile picture was not updated in chat after making photo') self.drivers[0].fail('Profile picture was not updated in chat after making photo')
@marks.testrail_id(6636)
@marks.medium
def test_show_profile_picture_of_setting(self):
self.create_drivers(2)
home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user()
profile_1 = home_1.profile_button.click()
public_key_1, default_username_1 = profile_1.get_public_key_and_username(return_username=True)
profile_1.just_fyi("Set user Profile image from Gallery")
profile_1.edit_profile_picture(file_name='sauce_logo.png')
home_1.profile_button.click()
profile_1.swipe_down()
profile_1.just_fyi('set status in profile')
device_1_status = 'My new update!'
timeline = profile_1.status_button.click()
timeline.set_new_status(device_1_status)
if not timeline.timeline_own_account_photo.is_element_image_similar_to_template('sauce_logo.png'):
self.errors.append('Profile picture was not updated in timeline')
profile_1.just_fyi('Check profile image it is not in mentions because user not in contacts yet')
one_to_one_chat_2 = home_2.add_contact(public_key_1, add_in_contacts=False)
one_to_one_chat_2.chat_message_input.set_value('@' + default_username_1)
one_to_one_chat_2.chat_message_input.click()
if one_to_one_chat_2.user_profile_image_in_mentions_list(default_username_1).is_element_image_similar_to_template('sauce_logo.png'):
self.errors.append('Profile picture is updated in 1-1 chat mentions list of contact not in Contacts list')
profile_1.just_fyi('Check profile image is in mentions because now user was added in contacts')
one_to_one_chat_2.add_to_contacts.click()
one_to_one_chat_2.chat_message_input.set_value('@' + default_username_1)
one_to_one_chat_2.chat_message_input.click()
if not one_to_one_chat_2.user_profile_image_in_mentions_list(default_username_1).is_element_image_similar_to_template('sauce_logo.png'):
self.errors.append('Profile picture was not updated in 1-1 chat mentions list')
profile_1.just_fyi('Check profile image updated in user profile view and on Chats view')
profile_2 = one_to_one_chat_2.profile_button.click()
profile_2.contacts_button.click()
profile_2.element_by_text(default_username_1).click()
if not profile_2.profile_picture.is_element_image_similar_to_template('sauce_logo.png'):
self.errors.append('Profile picture was not updated on user Profile view')
profile_2.back_button.click()
one_to_one_chat_2.home_button.click(desired_view='home')
if not home_2.get_chat(default_username_1).chat_image.is_element_image_similar_to_template('sauce_logo.png'):
self.errors.append('User profile picture was not updated on Chats view')
profile_1.just_fyi('Check profile image updated in user profile view in Group chat views 4')
home_1.home_button.click(desired_view='home')
group_chat_message = 'Trololo'
group_chat_2 = home_2.create_group_chat(user_names_to_add=[default_username_1])
group_chat_2.send_message('Message')
group_chat_1 = home_1.get_chat('new_group_chat').click()
group_chat_1.join_chat_button.click()
group_chat_1.send_message(group_chat_message)
if not group_chat_2.chat_element_by_text(group_chat_message).member_photo.is_element_image_similar_to_template('sauce_logo.png'):
self.errors.append('User profile picture was not updated in message Group chat view')
profile_1.just_fyi('Check profile image updated in on login view')
home_1.profile_button.click()
profile_1.logout()
sign_in_1 = home_1.get_sign_in_view()
if not sign_in_1.get_multiaccount_by_position(1).account_logo.is_element_image_similar_to_template('sauce_logo.png'):
self.errors.append('User profile picture was not updated on Multiaccounts list select login view')
sign_in_1.element_by_text(default_username_1).click()
if not sign_in_1.get_multiaccount_by_position(1).account_logo.is_element_image_similar_to_template('sauce_logo.png'):
self.errors.append('User profile picture was not updated on account login view')
sign_in_1.password_input.set_value(common_password)
sign_in_1.sign_in_button.click()
profile_1.just_fyi('Remove user from contact and check there is no profile image displayed')
group_chat_2.profile_button.click()
profile_2.contacts_button.click()
profile_2.element_by_text(default_username_1).click()
one_to_one_chat_2.remove_from_contacts.click()
# Send message to User 2 so update of profile image picked up
group_chat_1 = home_1.get_chat('new_group_chat').click()
group_chat_1.send_message(group_chat_message)
one_to_one_chat_2.back_button.click()
one_to_one_chat_2.home_button.click(desired_view='home')
if home_2.get_chat(default_username_1).chat_image.is_element_image_similar_to_template('sauce_logo.png'):
self.errors.append('User profile picture is not default to default after user removed from Contacts')
profile_2.just_fyi('Enable to see profile image from "Everyone" setting')
home_2.profile_button.click()
profile_2.appearance_button.click()
profile_2.show_profile_pictures_of.click()
profile_2.element_by_text('Everyone').click()
group_chat_1.send_message(group_chat_message)
profile_2.home_button.click(desired_view='home')
if not home_2.get_chat(default_username_1).chat_image.is_element_image_similar_to_template('sauce_logo.png'):
self.errors.append('User profile picture is not returned to default after user removed from Contacts')
@marks.testrail_id(5432) @marks.testrail_id(5432)
@marks.medium @marks.medium
def test_custom_bootnodes(self): def test_custom_bootnodes(self):

View File

@ -474,11 +474,13 @@ class ChatView(BaseView):
self.nickname_input_field = EditBox(self.driver, accessibility_id="nickname-input") self.nickname_input_field = EditBox(self.driver, accessibility_id="nickname-input")
self.remove_from_contacts = Button(self.driver, accessibility_id="Remove from contacts-item-button") self.remove_from_contacts = Button(self.driver, accessibility_id="Remove from contacts-item-button")
# Timeline # Timeline (My Status tab)
self.timeline_add_new_status_button = Button(self.driver, accessibility_id="plus-button") self.timeline_add_new_status_button = Button(self.driver, accessibility_id="plus-button")
self.timeline_my_status_editbox = EditBox(self.driver, accessibility_id="my-status-input") self.timeline_my_status_editbox = EditBox(self.driver, accessibility_id="my-status-input")
self.timeline_open_images_panel_button = Button(self.driver, accessibility_id="open-images-panel-button") self.timeline_open_images_panel_button = Button(self.driver, accessibility_id="open-images-panel-button")
self.timeline_send_my_status_button = Button(self.driver, accessibility_id="send-my-status-button") self.timeline_send_my_status_button = Button(self.driver, accessibility_id="send-my-status-button")
self.timeline_own_account_photo = Button(self.driver, accessibility_id="own-account-photo")
def get_outgoing_transaction(self, account=None): def get_outgoing_transaction(self, account=None):
if account is None: if account is None:
@ -570,7 +572,6 @@ class ChatView(BaseView):
group_info_view.get_username_options(username).click() group_info_view.get_username_options(username).click()
return self return self
def chat_element_by_text(self, text): def chat_element_by_text(self, text):
self.driver.info("**Looking for a message by text: %s**" % text) self.driver.info("**Looking for a message by text: %s**" % text)
return ChatElementByText(self.driver, text) return ChatElementByText(self.driver, text)
@ -640,6 +641,10 @@ class ChatView(BaseView):
element.click() element.click()
element.wait_for_invisibility_of_element() element.wait_for_invisibility_of_element()
def user_profile_image_in_mentions_list(self, username):
return Button(self.driver, xpath="//*[@content-desc='suggestions-list']//*[@text='%s']/"
"..//*[@content-desc='member-photo']" % username)
def search_user_in_mention_suggestion_list(self, username): def search_user_in_mention_suggestion_list(self, username):
return Button(self.driver, xpath="//*[@content-desc='suggestions-list']//*[@text='%s']" % username) return Button(self.driver, xpath="//*[@content-desc='suggestions-list']//*[@text='%s']" % username)

View File

@ -55,6 +55,14 @@ class ChatElement(SilentButton):
return UnreadMessagesPublicChat(self.driver) return UnreadMessagesPublicChat(self.driver)
@property
def chat_image(self):
class ChatImage(BaseElement):
def __init__(self, driver):
super().__init__(driver, xpath="//*[@content-desc='chat-icon']")
return ChatImage(self.driver)
class HomeView(BaseView): class HomeView(BaseView):
def __init__(self, driver): def __init__(self, driver):

View File

@ -191,6 +191,9 @@ class ProfileView(BaseView):
# Privacy and security # Privacy and security
self.privacy_and_security_button = Button(self.driver, accessibility_id="privacy-and-security-settings-button") self.privacy_and_security_button = Button(self.driver, accessibility_id="privacy-and-security-settings-button")
# Appearance
self.appearance_button = Button(self.driver, accessibility_id="appearance-settings-button")
self.show_profile_pictures_of = Button(self.driver, accessibility_id="show-profile-pictures")
## Backup recovery phrase ## Backup recovery phrase
self.backup_recovery_phrase_button = BackupRecoveryPhraseButton(self.driver) self.backup_recovery_phrase_button = BackupRecoveryPhraseButton(self.driver)
self.recovery_phrase_table = RecoveryPhraseTable(self.driver) self.recovery_phrase_table = RecoveryPhraseTable(self.driver)
@ -342,11 +345,7 @@ class ProfileView(BaseView):
self.select_from_gallery_button.click() self.select_from_gallery_button.click()
if self.allow_button.is_element_displayed(sec=5): if self.allow_button.is_element_displayed(sec=5):
self.allow_button.click() self.allow_button.click()
image_name = "sauce_logo.png, 4.64 kB, Nov 4, 2020" image_full_content = self.get_image_in_storage_by_name(file_name)
if file_name == 'sauce_logo_red.png':
image_name = "sauce_logo_red.png, 624 kB, Nov 4, 2020"
image_full_content = self.get_image_in_storage_by_name(image_name)
if not image_full_content.is_element_displayed(2): if not image_full_content.is_element_displayed(2):
self.show_roots_button.click() self.show_roots_button.click()
for element_text in 'Images', 'DCIM': for element_text in 'Images', 'DCIM':
@ -382,7 +381,7 @@ class ProfileView(BaseView):
return MailServerElement(self.driver, server_name) return MailServerElement(self.driver, server_name)
def get_image_in_storage_by_name(self, image_name=str()): def get_image_in_storage_by_name(self, image_name=str()):
return SilentButton(self.driver, xpath="//*[@content-desc='%s']" % image_name) return SilentButton(self.driver, xpath="//*[contains(@content-desc,'%s')]" % image_name)
def get_toggle_device_by_name(self, device_name): def get_toggle_device_by_name(self, device_name):
self.driver.info("**Selecting device %s for sync**" % device_name) self.driver.info("**Selecting device %s for sync**" % device_name)

View File

@ -21,6 +21,15 @@ class MultiAccountOnLoginButton(Button):
super(MultiAccountOnLoginButton, self).__init__(driver, super(MultiAccountOnLoginButton, self).__init__(driver,
xpath="(//*[@content-desc='chat-icon'])[%s]/.." % position) xpath="(//*[@content-desc='chat-icon'])[%s]/.." % position)
@property
def account_logo(self):
class AccountLogo(Text):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, xpath="%s//*[@content-desc='chat-icon']" % parent_locator)
return AccountLogo(self.driver, self.locator)
class MoveAndResetButton(Button): class MoveAndResetButton(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, accessibility_id="move-and-reset-button") super().__init__(driver, accessibility_id="move-and-reset-button")
@ -29,6 +38,7 @@ class MoveAndResetButton(Button):
from views.keycard_view import KeycardView from views.keycard_view import KeycardView
return KeycardView(self.driver) return KeycardView(self.driver)
class BeginRecoveryButton(Button): class BeginRecoveryButton(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, translation_id="keycard-recovery-intro-button-text") super().__init__(driver, translation_id="keycard-recovery-intro-button-text")