e2e: updated profile view (#18203)

This commit is contained in:
Tetiana Churikova 2023-12-20 21:29:08 +01:00 committed by GitHub
parent 7cf31651b3
commit ec41b30794
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 13 deletions

View File

@ -147,6 +147,7 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.device_2.create_user(username=new_username_2, first_user=False) self.device_2.create_user(username=new_username_2, first_user=False)
self.device_2.just_fyi('Device2 sends a contact request to Device1 using his profile link') self.device_2.just_fyi('Device2 sends a contact request to Device1 using his profile link')
self.home_2.driver.set_clipboard_text(self.public_key_1)
self.home_2.chats_tab.click() self.home_2.chats_tab.click()
self.home_2.new_chat_button.click_until_presence_of_element(self.home_2.add_a_contact_chat_bottom_sheet_button) self.home_2.new_chat_button.click_until_presence_of_element(self.home_2.add_a_contact_chat_bottom_sheet_button)
self.home_2.add_a_contact_chat_bottom_sheet_button.click() self.home_2.add_a_contact_chat_bottom_sheet_button.click()

View File

@ -242,6 +242,7 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
self.home.just_fyi("Perform back up") self.home.just_fyi("Perform back up")
self.home.navigate_back_to_home_view() self.home.navigate_back_to_home_view()
self.home.profile_button.click() self.home.profile_button.click()
profile.profile_legacy_button.scroll_and_click()
profile.sync_settings_button.click() profile.sync_settings_button.click()
profile.backup_settings_button.click() profile.backup_settings_button.click()
profile.perform_backup_button.click() profile.perform_backup_button.click()

View File

@ -148,11 +148,13 @@ class ProfileButton(TabButton):
if not self.is_element_displayed(): if not self.is_element_displayed():
ChatsTab(self.driver).click() ChatsTab(self.driver).click()
from views.profile_view import ProfileView from views.profile_view import ProfileView
if desired_element_text == 'privacy': ### Profile - legacy
self.click_until_presence_of_element(ProfileView(self.driver).privacy_and_security_button) # if desired_element_text == 'privacy':
else: # self.click_until_presence_of_element(ProfileView(self.driver).privacy_and_security_button)
base_view = BaseView(self.driver) # else:
self.click_until_presence_of_element(base_view.element_by_text_part(desired_element_text)) # base_view = BaseView(self.driver)
# self.click_until_presence_of_element(base_view.element_by_text_part(desired_element_text))
self.click_until_presence_of_element(ProfileView(self.driver).profile_password_button)
return self.navigate() return self.navigate()
@ -308,6 +310,10 @@ class BaseView(object):
self.sign_in_phrase = SignInPhraseText(self.driver) self.sign_in_phrase = SignInPhraseText(self.driver)
self.toast_content_element = BaseElement(self.driver, accessibility_id="toast-content") self.toast_content_element = BaseElement(self.driver, accessibility_id="toast-content")
# share contact screen
self.show_qr_button = Button(self.driver, accessibility_id="show-qr-button")
self.link_to_profile_button = Button(self.driver, accessibility_id="share-qr-code-info-text")
# checkboxes and toggles # checkboxes and toggles
self.checkbox_button = CheckBox(self.driver, accessibility_id="checkbox-off") self.checkbox_button = CheckBox(self.driver, accessibility_id="checkbox-off")
@ -670,12 +676,17 @@ class BaseView(object):
time.sleep(3) time.sleep(3)
def get_public_key(self): def get_public_key(self):
self.driver.info("Get public key") self.driver.info("Get public key via Share QR button")
profile_view = self.get_profile_view()
self.profile_button.click_until_presence_of_element(profile_view.default_username_text) self.show_qr_button.click_until_presence_of_element(self.link_to_profile_button)
profile_view.share_my_profile_button.click() self.link_to_profile_button.click()
profile_view.public_key_text.wait_for_visibility_of_element(20) public_key = self.driver.get_clipboard_text()
public_key = profile_view.public_key_text.text # Legacy profile view
# profile_view = self.get_profile_view()
# self.profile_button.click_until_presence_of_element(profile_view.default_username_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() self.click_system_back_button()
return public_key return public_key

View File

@ -24,7 +24,8 @@ class AddNewContactButton(Button):
class LogoutButton(SilentButton): class LogoutButton(SilentButton):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, accessibility_id="log-out-button") super().__init__(driver, translation_id="logout")
# super().__init__(driver, accessibility_id="log-out-button")
def click(self): def click(self):
self.scroll_to_element().click() self.scroll_to_element().click()
@ -287,7 +288,7 @@ class ProfileView(BaseView):
uppercase=True) uppercase=True)
self.advertise_device_button = Button(self.driver, accessibility_id="advertise-device") self.advertise_device_button = Button(self.driver, accessibility_id="advertise-device")
self.sync_all_button = Button(self.driver, translation_id="sync-all-devices") self.sync_all_button = Button(self.driver, translation_id="sync-all-devices")
self.syncing_button = Button(self.driver, accessibility_id="syncing") self.syncing_button = Button(self.driver, accessibility_id="icon, Syncing, label-component, icon")
self.sync_plus_button = Button(self.driver, self.sync_plus_button = Button(self.driver,
xpath="//*[@text='Syncing']/following-sibling::android.view.ViewGroup[1]") xpath="//*[@text='Syncing']/following-sibling::android.view.ViewGroup[1]")
self.slide_button_track = Button(self.driver, xpath="//*[@resource-id='slide-button-track']") self.slide_button_track = Button(self.driver, xpath="//*[@resource-id='slide-button-track']")
@ -347,11 +348,16 @@ class ProfileView(BaseView):
self.node_version_text = Text(self.driver, self.node_version_text = Text(self.driver,
xpath="//*[@content-desc='node-version']//android.widget.TextView[2]") xpath="//*[@content-desc='node-version']//android.widget.TextView[2]")
# Logout # Logout
self.logout_button = LogoutButton(self.driver) self.logout_button = LogoutButton(self.driver)
self.logout_dialog = LogoutDialog(self.driver) self.logout_dialog = LogoutDialog(self.driver)
self.confirm_logout_button = Button(self.driver, translation_id="logout", uppercase=True) self.confirm_logout_button = Button(self.driver, translation_id="logout", uppercase=True)
# New profile
self.profile_password_button = Button(self.driver, accessibility_id="icon, Password, label-component, icon")
self.profile_legacy_button = Button(self.driver, accessibility_id="icon, Legacy settings, label-component, icon")
def switch_network(self, network='Mainnet with upstream RPC'): def switch_network(self, network='Mainnet with upstream RPC'):
self.driver.info("## Switch network to '%s'" % network, device=False) self.driver.info("## Switch network to '%s'" % network, device=False)
self.advanced_button.click() self.advanced_button.click()
@ -432,6 +438,8 @@ class ProfileView(BaseView):
self.driver.info("## Setting custom profile image", device=False) self.driver.info("## Setting custom profile image", device=False)
if not AbstractTestCase().environment == 'sauce': if not AbstractTestCase().environment == 'sauce':
raise NotImplementedError('Test case is implemented to run on SauceLabs only') raise NotImplementedError('Test case is implemented to run on SauceLabs only')
## pointing to legacy profile until new feature is implemented
self.profile_legacy_button.scroll_and_click()
self.profile_picture.click() self.profile_picture.click()
if update_by == "Gallery": if update_by == "Gallery":
self.select_from_gallery_button.click() self.select_from_gallery_button.click()
@ -527,6 +535,7 @@ class ProfileView(BaseView):
return self.active_network_name.text return self.active_network_name.text
def get_sync_code(self): def get_sync_code(self):
# Pointing to legacy profile until feature is
self.syncing_button.scroll_and_click() self.syncing_button.scroll_and_click()
self.sync_plus_button.click() self.sync_plus_button.click()
self.slide_button_track.swipe_right_on_element(width_percentage=1.3) self.slide_button_track.swipe_right_on_element(width_percentage=1.3)