Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e: profile view changes #18203

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def test_add_contact_field_validation(self):
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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def test_restore_multiaccount_with_waku_backup_remove_switch(self):
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()
Expand Down
33 changes: 22 additions & 11 deletions test/appium/views/base_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,13 @@ def click(self, desired_element_text='privacy'):
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()


Expand Down Expand Up @@ -308,6 +310,10 @@ def __init__(self, driver):
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")

Expand Down Expand Up @@ -670,12 +676,17 @@ def close_share_popup(self):
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

Expand Down
13 changes: 11 additions & 2 deletions test/appium/views/profile_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def navigate(self):

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()
Expand Down Expand Up @@ -287,7 +288,7 @@ def __init__(self, driver):
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']")
Expand Down Expand Up @@ -347,11 +348,16 @@ def __init__(self, driver):
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()
Expand Down Expand Up @@ -432,6 +438,8 @@ def edit_profile_picture(self, image_index: int, update_by="Gallery"):
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()
Expand Down Expand Up @@ -527,6 +535,7 @@ def current_active_network(self):
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)
Expand Down