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.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.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()

View File

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

View File

@ -148,11 +148,13 @@ class ProfileButton(TabButton):
if not self.is_element_displayed():
ChatsTab(self.driver).click()
from views.profile_view import ProfileView
if desired_element_text == 'privacy':
self.click_until_presence_of_element(ProfileView(self.driver).privacy_and_security_button)
else:
base_view = BaseView(self.driver)
self.click_until_presence_of_element(base_view.element_by_text_part(desired_element_text))
### Profile - legacy
# if desired_element_text == 'privacy':
# self.click_until_presence_of_element(ProfileView(self.driver).privacy_and_security_button)
# else:
# 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()
@ -308,6 +310,10 @@ class BaseView(object):
self.sign_in_phrase = SignInPhraseText(self.driver)
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
self.checkbox_button = CheckBox(self.driver, accessibility_id="checkbox-off")
@ -670,12 +676,17 @@ class BaseView(object):
time.sleep(3)
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)
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.driver.info("Get public key via Share QR button")
self.show_qr_button.click_until_presence_of_element(self.link_to_profile_button)
self.link_to_profile_button.click()
public_key = self.driver.get_clipboard_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()
return public_key

View File

@ -24,7 +24,8 @@ class AddNewContactButton(Button):
class LogoutButton(SilentButton):
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):
self.scroll_to_element().click()
@ -287,7 +288,7 @@ class ProfileView(BaseView):
uppercase=True)
self.advertise_device_button = Button(self.driver, accessibility_id="advertise-device")
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,
xpath="//*[@text='Syncing']/following-sibling::android.view.ViewGroup[1]")
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,
xpath="//*[@content-desc='node-version']//android.widget.TextView[2]")
# Logout
self.logout_button = LogoutButton(self.driver)
self.logout_dialog = LogoutDialog(self.driver)
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'):
self.driver.info("## Switch network to '%s'" % network, device=False)
self.advanced_button.click()
@ -432,6 +438,8 @@ class ProfileView(BaseView):
self.driver.info("## Setting custom profile image", device=False)
if not AbstractTestCase().environment == 'sauce':
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()
if update_by == "Gallery":
self.select_from_gallery_button.click()
@ -527,6 +535,7 @@ class ProfileView(BaseView):
return self.active_network_name.text
def get_sync_code(self):
# Pointing to legacy profile until feature is
self.syncing_button.scroll_and_click()
self.sync_plus_button.click()
self.slide_button_track.swipe_right_on_element(width_percentage=1.3)