2018-01-26 11:07:09 +00:00
|
|
|
import time
|
2023-10-18 22:17:11 +00:00
|
|
|
|
2023-12-09 00:25:19 +00:00
|
|
|
from selenium.common import NoSuchElementException
|
|
|
|
|
2023-10-18 22:17:11 +00:00
|
|
|
from tests import common_password
|
2018-05-02 16:01:17 +00:00
|
|
|
from tests.base_test_case import AbstractTestCase
|
2021-01-25 16:35:40 +00:00
|
|
|
from views.base_element import Text, Button, EditBox, SilentButton
|
2018-01-03 09:34:40 +00:00
|
|
|
from views.base_view import BaseView
|
2017-08-28 10:02:20 +00:00
|
|
|
|
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class OptionsButton(Button):
|
2017-10-30 11:11:58 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver, xpath="(//android.view.ViewGroup[@content-desc='icon'])[2]")
|
2020-07-15 15:48:23 +00:00
|
|
|
|
2021-11-18 15:16:48 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class AddNewContactButton(Button):
|
2020-07-15 15:48:23 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver, accessibility_id="add-new-contact-button")
|
2020-07-15 15:48:23 +00:00
|
|
|
|
|
|
|
def navigate(self):
|
2021-01-25 16:35:40 +00:00
|
|
|
from views.chat_view import ChatView
|
|
|
|
return ChatView(self.driver)
|
2017-10-11 20:10:57 +00:00
|
|
|
|
2018-01-14 17:43:36 +00:00
|
|
|
|
2021-02-26 15:27:20 +00:00
|
|
|
class LogoutButton(SilentButton):
|
2018-01-14 17:43:36 +00:00
|
|
|
def __init__(self, driver):
|
2023-12-20 20:29:08 +00:00
|
|
|
super().__init__(driver, translation_id="logout")
|
|
|
|
# super().__init__(driver, accessibility_id="log-out-button")
|
2018-01-14 17:43:36 +00:00
|
|
|
|
2018-08-20 10:02:37 +00:00
|
|
|
def click(self):
|
|
|
|
self.scroll_to_element().click()
|
|
|
|
return self.navigate()
|
|
|
|
|
2018-05-02 16:01:17 +00:00
|
|
|
|
2018-04-26 06:22:11 +00:00
|
|
|
class LogoutDialog(BaseView):
|
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver)
|
2018-04-26 06:22:11 +00:00
|
|
|
self.logout_button = LogoutDialog.LogoutButton(driver)
|
|
|
|
|
2021-02-26 15:27:20 +00:00
|
|
|
class LogoutButton(SilentButton):
|
2018-04-26 06:22:11 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver, translation_id="logout", uppercase=True)
|
2018-04-26 06:22:11 +00:00
|
|
|
|
|
|
|
def navigate(self):
|
|
|
|
from views.sign_in_view import SignInView
|
|
|
|
return SignInView(self.driver)
|
|
|
|
|
2021-11-18 15:16:48 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class ENSusernames(Button):
|
2018-10-06 12:00:30 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver, translation_id="ens-usernames")
|
2019-11-25 10:32:30 +00:00
|
|
|
|
|
|
|
def navigate(self):
|
|
|
|
from views.dapps_view import DappsView
|
|
|
|
return DappsView(self.driver)
|
|
|
|
|
|
|
|
def click(self):
|
|
|
|
self.scroll_to_element().click()
|
|
|
|
return self.navigate()
|
|
|
|
|
2021-11-18 15:16:48 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class AdvancedButton(Button):
|
2018-01-26 11:07:09 +00:00
|
|
|
def __init__(self, driver):
|
2024-06-07 18:21:29 +00:00
|
|
|
super().__init__(driver, accessibility_id="icon, Advanced, label-component, icon")
|
2018-03-15 20:01:08 +00:00
|
|
|
|
|
|
|
def click(self):
|
|
|
|
self.scroll_to_element().click()
|
|
|
|
return self.navigate()
|
2018-01-26 11:07:09 +00:00
|
|
|
|
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class BackupRecoveryPhraseButton(Button):
|
2018-05-02 16:01:17 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver, accessibility_id="back-up-recovery-phrase-button")
|
2018-05-02 16:01:17 +00:00
|
|
|
|
2018-12-20 14:50:02 +00:00
|
|
|
def click(self):
|
|
|
|
self.scroll_to_element().click()
|
|
|
|
return self.navigate()
|
|
|
|
|
2018-05-02 16:01:17 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class RecoveryPhraseTable(Text):
|
2018-05-02 16:01:17 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver, translation_id="your-recovery-phrase",
|
|
|
|
suffix="/following-sibling::android.view.ViewGroup[1]/android.widget.TextView")
|
2018-07-04 13:40:52 +00:00
|
|
|
|
2021-11-18 15:16:48 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class RecoveryPhraseWordNumberText(Text):
|
2018-07-04 13:40:52 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver, xpath="//*[contains(@text,'#')]")
|
2018-05-02 16:01:17 +00:00
|
|
|
|
|
|
|
@property
|
2018-05-10 10:29:08 +00:00
|
|
|
def number(self):
|
2018-05-02 16:01:17 +00:00
|
|
|
time.sleep(1)
|
2018-05-10 10:29:08 +00:00
|
|
|
return int(self.find_element().text.split('#')[1])
|
2018-05-02 16:01:17 +00:00
|
|
|
|
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class RecoveryPhraseWordInput(EditBox):
|
2018-07-03 12:40:44 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super(RecoveryPhraseWordInput, self).__init__(driver, xpath="//android.widget.EditText")
|
2018-07-03 12:40:44 +00:00
|
|
|
|
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class HelpButton(Button):
|
2018-07-03 12:40:44 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver, accessibility_id="help-button")
|
2018-07-06 11:10:48 +00:00
|
|
|
|
2018-11-05 21:38:19 +00:00
|
|
|
def click(self):
|
|
|
|
self.scroll_to_element().click()
|
|
|
|
|
2018-07-06 11:10:48 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class FaqButton(Button):
|
2018-07-06 11:10:48 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver, accessibility_id="faq-button")
|
2018-07-06 11:10:48 +00:00
|
|
|
|
|
|
|
def navigate(self):
|
|
|
|
from views.web_views.base_web_view import BaseWebView
|
|
|
|
return BaseWebView(self.driver)
|
|
|
|
|
2019-08-23 10:24:52 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class MailServerElement(Button):
|
2018-07-19 09:57:45 +00:00
|
|
|
def __init__(self, driver, server_name):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver, xpath="//*[@content-desc='mailserver-item']//*[@text='%s']" % server_name)
|
2019-03-04 14:19:42 +00:00
|
|
|
self.server_name = server_name
|
2018-07-19 09:57:45 +00:00
|
|
|
|
2019-03-04 14:19:42 +00:00
|
|
|
def click(self):
|
2020-10-22 09:41:29 +00:00
|
|
|
size = self.driver.get_window_size()
|
2021-11-18 15:16:48 +00:00
|
|
|
self.driver.swipe(500, size["height"] * 0.8, 500, size["height"] * 0.05)
|
2020-10-22 09:41:29 +00:00
|
|
|
self.find_element().click()
|
2019-03-04 14:19:42 +00:00
|
|
|
|
2018-07-19 09:57:45 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class AboutButton(Button):
|
2019-12-27 11:34:59 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver, accessibility_id="about-button")
|
2018-09-05 19:50:48 +00:00
|
|
|
|
2018-10-18 08:23:54 +00:00
|
|
|
def click(self):
|
|
|
|
self.scroll_to_element().click()
|
|
|
|
return self.navigate()
|
|
|
|
|
2018-09-05 19:50:48 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class SyncSettingsButton(Button):
|
2020-07-20 15:13:09 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver, accessibility_id="sync-settings-button")
|
2020-03-24 15:39:52 +00:00
|
|
|
|
|
|
|
def click(self):
|
|
|
|
self.scroll_to_element().click()
|
2019-05-29 08:43:41 +00:00
|
|
|
|
2019-08-02 21:22:23 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class DappPermissionsButton(Button):
|
2019-05-29 08:43:41 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver, accessibility_id="dapps-permissions-button")
|
2019-08-02 21:22:23 +00:00
|
|
|
|
|
|
|
def click(self):
|
|
|
|
self.scroll_to_element().click()
|
|
|
|
|
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class PrivacyPolicyButton(Button):
|
2019-08-02 21:22:23 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver, accessibility_id="privacy-policy")
|
2020-08-11 16:10:53 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
def navigate(self):
|
|
|
|
from views.web_views.base_web_view import BaseWebView
|
|
|
|
return BaseWebView(self.driver)
|
2019-10-03 16:08:06 +00:00
|
|
|
|
|
|
|
|
2021-07-05 19:28:55 +00:00
|
|
|
class TermsOfUseButton(Button):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super().__init__(driver, accessibility_id="terms-of-service")
|
|
|
|
|
|
|
|
def navigate(self):
|
|
|
|
from views.web_views.base_web_view import BaseWebView
|
|
|
|
return BaseWebView(self.driver)
|
|
|
|
|
|
|
|
|
2021-01-27 10:19:03 +00:00
|
|
|
class ProfilePictureElement(Button):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super().__init__(driver, accessibility_id="chat-icon")
|
|
|
|
|
2021-11-18 15:16:48 +00:00
|
|
|
|
2021-07-15 11:12:38 +00:00
|
|
|
class KeycardButton(Button):
|
|
|
|
|
|
|
|
def navigate(self):
|
|
|
|
from views.keycard_view import KeycardView
|
|
|
|
return KeycardView(self.driver)
|
|
|
|
|
|
|
|
def click(self):
|
|
|
|
self.scroll_to_element().click()
|
|
|
|
return self.navigate()
|
|
|
|
|
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
class ProfileView(BaseView):
|
2020-12-03 12:59:20 +00:00
|
|
|
|
2019-11-13 17:38:41 +00:00
|
|
|
def __init__(self, driver):
|
2021-01-25 16:35:40 +00:00
|
|
|
super().__init__(driver)
|
|
|
|
self.options_button = OptionsButton(self.driver)
|
2019-10-03 16:08:06 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
# Header
|
|
|
|
self.public_key_text = Text(self.driver, accessibility_id="chat-key")
|
|
|
|
self.default_username_text = Text(self.driver, accessibility_id="default-username")
|
2024-03-19 17:57:58 +00:00
|
|
|
self.contact_name_text = Text(self.driver, accessibility_id="contact-name")
|
2021-01-25 16:35:40 +00:00
|
|
|
self.share_my_profile_button = Button(self.driver, accessibility_id="share-header-button")
|
2021-01-27 10:19:03 +00:00
|
|
|
self.profile_picture = ProfilePictureElement(self.driver)
|
2022-02-23 14:19:18 +00:00
|
|
|
self.online_indicator = Button(self.driver, accessibility_id="online-profile-photo-dot")
|
2021-01-25 16:35:40 +00:00
|
|
|
self.edit_picture_button = Button(self.driver, accessibility_id="edit-profile-photo-button")
|
|
|
|
self.confirm_edit_button = Button(self.driver, accessibility_id="done-button")
|
2024-02-23 16:13:57 +00:00
|
|
|
self.select_from_gallery_button_old = Button(self.driver, translation_id="profile-pic-pick")
|
2021-01-25 16:35:40 +00:00
|
|
|
self.capture_button = Button(self.driver, translation_id="image-source-make-photo")
|
2024-02-23 16:13:57 +00:00
|
|
|
self.take_photo_button_old = Button(self.driver, accessibility_id="take-photo")
|
2021-02-23 12:19:55 +00:00
|
|
|
self.crop_photo_button = Button(self.driver, accessibility_id="Crop")
|
|
|
|
self.decline_photo_crop = Button(self.driver, accessibility_id="Navigate up")
|
|
|
|
self.shutter_button = Button(self.driver, accessibility_id="Shutter")
|
|
|
|
self.accept_photo_button = Button(self.driver, accessibility_id="Done")
|
2017-08-28 10:02:20 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
# ENS
|
2023-12-09 00:25:19 +00:00
|
|
|
self.username_in_ens_chat_settings_text = EditBox(
|
|
|
|
self.driver, xpath="//*[@content-desc='chat-icon']/../../android.widget.TextView[2]")
|
2021-01-25 16:35:40 +00:00
|
|
|
self.ens_usernames_button = ENSusernames(self.driver)
|
|
|
|
self.ens_name_in_share_chat_key_text = Text(self.driver, accessibility_id="ens-username")
|
2017-08-28 10:02:20 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
# Contacts
|
|
|
|
self.contacts_button = Button(self.driver, accessibility_id="contacts-button")
|
|
|
|
self.blocked_users_button = Button(self.driver, accessibility_id="blocked-users-list-button")
|
2020-07-15 15:48:23 +00:00
|
|
|
self.add_new_contact_button = AddNewContactButton(self.driver)
|
2021-01-25 16:35:40 +00:00
|
|
|
self.invite_friends_in_contact_button = Button(self.driver, accessibility_id="invite-friends-button")
|
2018-05-02 16:01:17 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
# Privacy and security
|
|
|
|
self.privacy_and_security_button = Button(self.driver, accessibility_id="privacy-and-security-settings-button")
|
2021-04-29 10:43:00 +00:00
|
|
|
self.accept_new_chats_from = Button(self.driver, accessibility_id="accept-new-chats-from")
|
|
|
|
self.accept_new_chats_from_contacts_only = Button(self.driver, translation_id="contacts")
|
2021-07-14 14:49:27 +00:00
|
|
|
self.reset_password_button = Button(self.driver, accessibility_id="reset-password")
|
|
|
|
self.current_password_edit_box = EditBox(self.driver, accessibility_id="current-password")
|
|
|
|
self.new_password_edit_box = EditBox(self.driver, accessibility_id="new-password")
|
|
|
|
self.confirm_new_password_edit_box = EditBox(self.driver, accessibility_id="confirm-new-password")
|
|
|
|
self.current_password_wrong_text = Text(self.driver, accessibility_id="current-password-error")
|
|
|
|
|
2021-03-04 09:35:48 +00:00
|
|
|
# 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")
|
2022-07-11 11:17:31 +00:00
|
|
|
self.show_profile_pictures_to = Button(self.driver, accessibility_id="show-profile-pictures-to")
|
2021-01-25 16:35:40 +00:00
|
|
|
## Backup recovery phrase
|
2018-07-04 13:40:52 +00:00
|
|
|
self.backup_recovery_phrase_button = BackupRecoveryPhraseButton(self.driver)
|
|
|
|
self.recovery_phrase_table = RecoveryPhraseTable(self.driver)
|
|
|
|
self.recovery_phrase_word_number = RecoveryPhraseWordNumberText(self.driver)
|
|
|
|
self.recovery_phrase_word_input = RecoveryPhraseWordInput(self.driver)
|
2021-01-25 16:35:40 +00:00
|
|
|
## Dapps permissions
|
|
|
|
self.dapp_permissions_button = DappPermissionsButton(self.driver)
|
|
|
|
self.revoke_access_button = Button(self.driver, translation_id="revoke-access")
|
|
|
|
## Delete my profile
|
|
|
|
self.delete_my_profile_button = Button(self.driver, translation_id="delete-my-profile")
|
|
|
|
self.delete_my_profile_password_input = EditBox(self.driver, xpath="//android.widget.EditText")
|
|
|
|
self.delete_profile_button = Button(self.driver, accessibility_id="delete-profile-confirm")
|
|
|
|
|
|
|
|
# Notifications
|
|
|
|
self.profile_notifications_button = Button(self.driver, accessibility_id="notifications-settings-button")
|
2023-10-18 22:17:11 +00:00
|
|
|
self.profile_notifications_toggle_button = Button(self.driver,
|
|
|
|
accessibility_id="local-notifications-settings-button")
|
2023-12-09 00:25:19 +00:00
|
|
|
self.push_notification_toggle = Button(
|
|
|
|
self.driver, xpath="//*[@content-desc='notifications-button']//*[@content-desc='switch']")
|
2021-01-25 16:35:40 +00:00
|
|
|
self.wallet_push_notifications = Button(self.driver, accessibility_id="notifications-button")
|
|
|
|
|
|
|
|
# Sync settings
|
|
|
|
self.sync_settings_button = SyncSettingsButton(self.driver)
|
|
|
|
## Mobile Data
|
|
|
|
self.use_mobile_data = Button(self.driver, translation_id="mobile-network-use-mobile",
|
|
|
|
suffix="/following-sibling::android.widget.Switch[1]")
|
|
|
|
self.ask_me_when_on_mobile_network = Button(self.driver, translation_id="mobile-network-ask-me",
|
|
|
|
suffix="/following-sibling::android.widget.Switch[1]")
|
2022-02-17 12:12:31 +00:00
|
|
|
## Backup settings
|
|
|
|
self.backup_settings_button = Button(self.driver, accessibility_id="backup-settings-button")
|
|
|
|
## Perform backup
|
|
|
|
self.perform_backup_button = Button(self.driver, translation_id="perform-backup")
|
|
|
|
|
2021-11-18 15:16:48 +00:00
|
|
|
## Sync history data
|
2021-06-29 15:55:55 +00:00
|
|
|
self.sync_history_for_button = Button(self.driver, accessibility_id="default-sync-period-button")
|
2021-01-25 16:35:40 +00:00
|
|
|
## History nodes
|
|
|
|
self.mail_server_button = Button(self.driver, accessibility_id="offline-messages-settings-button")
|
|
|
|
self.mail_server_address_input = EditBox(self.driver, translation_id="mailserver-address",
|
|
|
|
suffix="/following-sibling::*[1]/android.widget.EditText")
|
|
|
|
self.mail_server_connect_button = Button(self.driver, accessibility_id="mailserver-connect-button")
|
|
|
|
self.mail_server_auto_selection_button = Button(self.driver, translation_id="mailserver-automatic",
|
|
|
|
suffix="/following-sibling::*[1]")
|
|
|
|
self.use_history_node_button = Button(self.driver, translation_id="offline-messaging-use-history-nodes",
|
|
|
|
suffix="/following-sibling::*[1]")
|
|
|
|
self.mail_server_delete_button = Button(self.driver, accessibility_id="mailserver-delete-button")
|
2021-11-18 15:16:48 +00:00
|
|
|
self.mail_server_confirm_delete_button = Button(self.driver,
|
|
|
|
xpath='//*[@text="%s"]' % self.get_translation_by_key(
|
|
|
|
"delete-mailserver").upper())
|
2021-01-25 16:35:40 +00:00
|
|
|
## Device syncing
|
|
|
|
self.devices_button = Button(self.driver, accessibility_id="pairing-settings-button")
|
|
|
|
self.device_name_input = EditBox(self.driver, accessibility_id="device-name")
|
|
|
|
self.go_to_pairing_settings_button = Button(self.driver, translation_id="pairing-go-to-installation",
|
|
|
|
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")
|
2023-12-20 20:29:08 +00:00
|
|
|
self.syncing_button = Button(self.driver, accessibility_id="icon, Syncing, label-component, icon")
|
2023-10-18 22:17:11 +00:00
|
|
|
self.sync_plus_button = Button(self.driver,
|
|
|
|
xpath="//*[@text='Syncing']/following-sibling::android.view.ViewGroup[1]")
|
2021-01-25 16:35:40 +00:00
|
|
|
|
2021-11-18 15:16:48 +00:00
|
|
|
# Keycard
|
|
|
|
self.keycard_button = Button(self.driver, accessibility_id="keycard-button")
|
2021-07-15 11:12:38 +00:00
|
|
|
self.change_pin_button = KeycardButton(self.driver, translation_id="change-pin")
|
|
|
|
self.change_puk_button = KeycardButton(self.driver, translation_id="change-puk")
|
|
|
|
self.change_pairing_code_button = KeycardButton(self.driver, translation_id="change-pairing")
|
2021-07-23 11:48:14 +00:00
|
|
|
self.create_keycard_backup_button = KeycardButton(self.driver, translation_id="keycard-backup")
|
2021-07-15 11:12:38 +00:00
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
# Advanced
|
|
|
|
self.advanced_button = AdvancedButton(self.driver)
|
2022-07-02 07:50:03 +00:00
|
|
|
self.mutual_contact_request_switcher = Button(self.driver, accessibility_id="mutual-contact-requests-switch")
|
2021-01-25 16:35:40 +00:00
|
|
|
## Network
|
|
|
|
self.network_settings_button = Button(self.driver, accessibility_id="network-button")
|
2021-11-18 15:16:48 +00:00
|
|
|
self.active_network_name = Text(self.driver,
|
|
|
|
xpath="//android.widget.TextView[contains(@text,'with upstream RPC')]")
|
2021-04-19 15:55:25 +00:00
|
|
|
self.plus_button = Button(self.driver, xpath="(//android.widget.ImageView[@content-desc='icon'])[2]")
|
2022-10-06 22:31:27 +00:00
|
|
|
self.custom_chain_button = Button(self.driver, translation_id="custom")
|
2021-11-18 15:16:48 +00:00
|
|
|
self.custom_network_symbol_input = EditBox(self.driver, translation_id="specify-symbol")
|
2021-01-25 16:35:40 +00:00
|
|
|
self.specify_name_input = EditBox(self.driver, translation_id="name",
|
|
|
|
suffix="/following-sibling::*[1]/android.widget.EditText")
|
2022-10-06 22:31:27 +00:00
|
|
|
self.specify_network_id_input = EditBox(self.driver, translation_id="specify-network-id")
|
2021-01-25 16:35:40 +00:00
|
|
|
self.connect_button = Button(self.driver, accessibility_id="network-connect-button")
|
2021-11-18 15:16:48 +00:00
|
|
|
## Toggles
|
|
|
|
self.transaction_management_enabled_toggle = Button(self.driver,
|
|
|
|
accessibility_id="transactions-management-enabled")
|
|
|
|
self.webview_debug_toggle = Button(self.driver, accessibility_id="webview-debug-switch")
|
|
|
|
self.waku_bloom_toggle = Button(self.driver, accessibility_id="waku-bloom-filter-mode-settings-switch")
|
2021-01-25 16:35:40 +00:00
|
|
|
## Log level
|
|
|
|
self.log_level_setting_button = Button(self.driver, accessibility_id="log-level-settings-button")
|
|
|
|
## Fleet
|
|
|
|
self.fleet_setting_button = Button(self.driver, accessibility_id="fleet-settings-button")
|
|
|
|
## Bootnodes
|
|
|
|
self.bootnodes_button = Button(self.driver, accessibility_id="bootnodes-settings-button")
|
|
|
|
self.bootnode_address_input = EditBox(self.driver, accessibility_id="bootnode-address")
|
|
|
|
self.enable_bootnodes = Button(self.driver, xpath="//android.widget.Switch")
|
|
|
|
self.add_bootnode_button = Button(self.driver, accessibility_id="add-bootnode")
|
|
|
|
|
2021-11-18 15:16:48 +00:00
|
|
|
# Need help
|
2018-07-06 11:10:48 +00:00
|
|
|
self.help_button = HelpButton(self.driver)
|
2021-01-25 16:35:40 +00:00
|
|
|
self.submit_bug_button = Button(self.driver, accessibility_id="submit-bug-button")
|
2021-11-18 15:16:48 +00:00
|
|
|
self.bug_description_edit_box = EditBox(self.driver, accessibility_id="bug-report-description")
|
|
|
|
self.bug_steps_edit_box = EditBox(self.driver, accessibility_id="bug-report-steps")
|
|
|
|
self.bug_submit_button = Button(self.driver, accessibility_id="bug-report-submit")
|
2021-01-25 16:35:40 +00:00
|
|
|
self.request_a_feature_button = Button(self.driver, accessibility_id="request-a-feature-button")
|
2018-07-06 11:10:48 +00:00
|
|
|
self.faq_button = FaqButton(self.driver)
|
2019-09-05 02:32:33 +00:00
|
|
|
|
2021-11-18 15:16:48 +00:00
|
|
|
# About
|
2021-01-25 16:35:40 +00:00
|
|
|
self.about_button = AboutButton(self.driver)
|
|
|
|
self.privacy_policy_button = PrivacyPolicyButton(self.driver)
|
2021-07-05 19:28:55 +00:00
|
|
|
self.terms_of_use_button = TermsOfUseButton(self.driver)
|
2021-01-25 16:35:40 +00:00
|
|
|
self.app_version_text = Text(self.driver, xpath="//*[@content-desc='app-version']//android.widget.TextView[2]")
|
|
|
|
self.node_version_text = Text(self.driver,
|
|
|
|
xpath="//*[@content-desc='node-version']//android.widget.TextView[2]")
|
2019-10-03 16:08:06 +00:00
|
|
|
|
2021-11-18 15:16:48 +00:00
|
|
|
# Logout
|
2021-01-25 16:35:40 +00:00
|
|
|
self.logout_button = LogoutButton(self.driver)
|
|
|
|
self.logout_dialog = LogoutDialog(self.driver)
|
|
|
|
self.confirm_logout_button = Button(self.driver, translation_id="logout", uppercase=True)
|
2020-07-29 15:54:45 +00:00
|
|
|
|
2023-12-20 20:29:08 +00:00
|
|
|
# New profile
|
2024-02-23 16:13:57 +00:00
|
|
|
self.edit_profile_button = Button(self.driver, accessibility_id="icon, Edit Profile, label-component, icon")
|
|
|
|
self.change_profile_photo_button = Button(
|
|
|
|
self.driver,
|
|
|
|
xpath="//*[@content-desc='user-avatar']/following-sibling::android.view.ViewGroup[@content-desc='icon']")
|
|
|
|
self.take_photo_button = Button(self.driver, accessibility_id="take-photo-button")
|
|
|
|
self.select_from_gallery_button = Button(self.driver, accessibility_id="select-from-gallery-button")
|
2023-12-20 20:29:08 +00:00
|
|
|
self.profile_password_button = Button(self.driver, accessibility_id="icon, Password, label-component, icon")
|
2024-04-30 06:41:47 +00:00
|
|
|
self.profile_messages_button = Button(self.driver, accessibility_id="icon, Messages, label-component, icon")
|
|
|
|
self.profile_blocked_users_button = Button(self.driver, accessibility_id="Blocked users, label-component, icon")
|
2024-01-05 23:31:12 +00:00
|
|
|
self.profile_legacy_button = Button(self.driver,
|
|
|
|
accessibility_id="icon, Legacy settings, label-component, icon")
|
2024-06-07 18:21:29 +00:00
|
|
|
self.testnet_mode_toggle = Button(self.driver,
|
|
|
|
xpath="//*[@content-desc='test-networks-enabled']/android.widget.Switch")
|
2023-12-20 20:29:08 +00:00
|
|
|
|
2020-06-23 09:01:06 +00:00
|
|
|
def switch_network(self, network='Mainnet with upstream RPC'):
|
2021-10-25 16:05:22 +00:00
|
|
|
self.driver.info("## Switch network to '%s'" % network, device=False)
|
2018-05-18 17:31:01 +00:00
|
|
|
self.advanced_button.click()
|
2017-10-11 20:10:57 +00:00
|
|
|
self.network_settings_button.click()
|
2021-01-25 16:35:40 +00:00
|
|
|
network_button = Button(self.driver, xpath="//*[@text='%s']" % network)
|
2021-11-26 14:15:26 +00:00
|
|
|
network_button.scroll_and_click()
|
2020-09-23 11:48:20 +00:00
|
|
|
self.connect_button.click_until_presence_of_element(self.confirm_button)
|
|
|
|
self.confirm_button.click_until_absense_of_element(self.confirm_button)
|
2021-01-25 16:35:40 +00:00
|
|
|
from views.sign_in_view import SignInView
|
|
|
|
SignInView(self.driver).sign_in()
|
2021-10-25 16:05:22 +00:00
|
|
|
self.driver.info("## Network is switched successfully!", device=False)
|
2018-01-26 11:07:09 +00:00
|
|
|
|
2019-12-26 11:56:59 +00:00
|
|
|
def open_contact_from_profile(self, username):
|
2021-10-25 16:05:22 +00:00
|
|
|
self.driver.info("Opening profile of '%s' via Contacts" % username)
|
2021-09-24 10:35:19 +00:00
|
|
|
self.contacts_button.wait_and_click(30)
|
2019-12-26 11:56:59 +00:00
|
|
|
self.element_by_text(username).click()
|
|
|
|
from views.chat_view import ChatView
|
|
|
|
return ChatView(self.driver)
|
|
|
|
|
2022-10-28 12:57:18 +00:00
|
|
|
def add_contact_via_contacts_list(self, public_key):
|
|
|
|
self.driver.info("Adding user to Contacts via Profile > Contacts")
|
|
|
|
self.contacts_button.wait_and_click(30)
|
|
|
|
self.add_new_contact_button.wait_and_click()
|
|
|
|
chat = self.get_chat_view()
|
|
|
|
chat.public_key_edit_box.click()
|
|
|
|
chat.public_key_edit_box.send_keys(public_key)
|
2023-03-08 10:31:42 +00:00
|
|
|
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_add_to_contacts_button)
|
|
|
|
chat.profile_add_to_contacts_button.click()
|
2023-08-18 16:20:40 +00:00
|
|
|
self.navigate_back_to_home_view()
|
2022-10-28 12:57:18 +00:00
|
|
|
|
2022-11-03 11:26:53 +00:00
|
|
|
def switch_push_notifications(self):
|
|
|
|
self.driver.info("Enabling push notifications via Profile")
|
|
|
|
self.profile_notifications_button.scroll_and_click()
|
|
|
|
self.profile_notifications_toggle_button.click()
|
2023-08-18 16:20:40 +00:00
|
|
|
self.navigate_back_to_home_view()
|
2022-10-28 12:57:18 +00:00
|
|
|
|
2023-10-18 22:17:11 +00:00
|
|
|
def add_custom_network(self, rpc_url: str, name: str, symbol: str, netwrok_id: str):
|
2022-10-06 22:31:27 +00:00
|
|
|
self.driver.info("## Add custom network", device=False)
|
2018-07-03 12:40:44 +00:00
|
|
|
self.advanced_button.click()
|
|
|
|
self.network_settings_button.scroll_to_element()
|
|
|
|
self.network_settings_button.click()
|
2022-10-06 22:31:27 +00:00
|
|
|
self.plus_button.click_until_presence_of_element(self.custom_chain_button)
|
2023-09-06 03:07:12 +00:00
|
|
|
self.custom_network_url_input.send_keys(rpc_url)
|
|
|
|
self.specify_name_input.send_keys(name)
|
|
|
|
self.custom_network_symbol_input.send_keys(symbol)
|
2022-10-06 22:31:27 +00:00
|
|
|
self.custom_chain_button.scroll_and_click()
|
|
|
|
self.specify_network_id_input.scroll_to_element()
|
2023-09-06 03:07:12 +00:00
|
|
|
self.specify_network_id_input.send_keys(netwrok_id)
|
2018-07-03 12:40:44 +00:00
|
|
|
self.save_button.click()
|
2021-11-11 11:40:31 +00:00
|
|
|
self.element_by_text_part(name).scroll_to_element()
|
|
|
|
self.element_by_text_part(name).click_until_presence_of_element(self.connect_button)
|
2018-07-03 12:40:44 +00:00
|
|
|
self.connect_button.click()
|
2019-04-05 13:05:23 +00:00
|
|
|
self.confirm_button.click()
|
2021-10-25 16:05:22 +00:00
|
|
|
self.driver.info("## Custom network is added succesfully!", device=False)
|
2018-07-03 12:40:44 +00:00
|
|
|
return self.get_sign_in_view()
|
|
|
|
|
2018-07-04 13:40:52 +00:00
|
|
|
def get_recovery_phrase(self):
|
|
|
|
text = [i.text for i in self.recovery_phrase_table.find_elements()]
|
2018-05-10 10:29:08 +00:00
|
|
|
return dict(zip(map(int, text[::2]), text[1::2]))
|
2018-05-02 16:01:17 +00:00
|
|
|
|
2018-07-04 13:40:52 +00:00
|
|
|
def backup_recovery_phrase(self):
|
2021-10-25 16:05:22 +00:00
|
|
|
self.driver.info("## Back up seed phrase", device=False)
|
2018-06-29 17:27:30 +00:00
|
|
|
self.ok_continue_button.click()
|
2018-07-04 13:40:52 +00:00
|
|
|
recovery_phrase = self.get_recovery_phrase()
|
2018-06-29 17:27:30 +00:00
|
|
|
self.next_button.click()
|
2018-07-04 13:40:52 +00:00
|
|
|
word_number = self.recovery_phrase_word_number.number
|
2023-09-06 03:07:12 +00:00
|
|
|
self.recovery_phrase_word_input.send_keys(recovery_phrase[word_number])
|
2018-06-29 17:27:30 +00:00
|
|
|
self.next_button.click()
|
2018-07-04 13:40:52 +00:00
|
|
|
word_number_1 = self.recovery_phrase_word_number.number
|
2023-09-06 03:07:12 +00:00
|
|
|
self.recovery_phrase_word_input.send_keys(recovery_phrase[word_number_1])
|
2018-06-29 17:27:30 +00:00
|
|
|
self.done_button.click()
|
|
|
|
self.yes_button.click()
|
|
|
|
self.ok_got_it_button.click()
|
2021-10-25 16:05:22 +00:00
|
|
|
self.driver.info("## Seed phrase is backed up!", device=False)
|
2018-07-04 13:40:52 +00:00
|
|
|
return recovery_phrase
|
2018-06-29 17:27:30 +00:00
|
|
|
|
2023-12-09 00:25:19 +00:00
|
|
|
def edit_profile_picture(self, image_index: int, update_by="Gallery"):
|
2021-10-25 16:05:22 +00:00
|
|
|
self.driver.info("## Setting custom profile image", device=False)
|
2018-05-16 19:59:36 +00:00
|
|
|
if not AbstractTestCase().environment == 'sauce':
|
2018-05-02 16:01:17 +00:00
|
|
|
raise NotImplementedError('Test case is implemented to run on SauceLabs only')
|
2024-02-23 16:13:57 +00:00
|
|
|
self.edit_profile_button.click()
|
|
|
|
self.change_profile_photo_button.click()
|
2021-02-23 12:19:55 +00:00
|
|
|
if update_by == "Gallery":
|
|
|
|
self.select_from_gallery_button.click()
|
2023-12-09 00:25:19 +00:00
|
|
|
self.select_photo_from_gallery_by_index(image_index)
|
2021-02-23 12:19:55 +00:00
|
|
|
else:
|
|
|
|
## take by Photo
|
|
|
|
self.take_photo()
|
|
|
|
self.click_system_back_button()
|
2021-07-28 12:42:06 +00:00
|
|
|
self.profile_picture.click()
|
2021-02-23 12:19:55 +00:00
|
|
|
self.take_photo()
|
|
|
|
self.accept_photo_button.click()
|
|
|
|
self.crop_photo_button.click()
|
2021-10-25 16:05:22 +00:00
|
|
|
self.driver.info("## Custom profile image has been set", device=False)
|
2024-02-23 16:13:57 +00:00
|
|
|
self.click_system_back_button()
|
2021-02-23 12:19:55 +00:00
|
|
|
|
|
|
|
def take_photo(self):
|
|
|
|
self.take_photo_button.click()
|
2019-01-28 09:00:55 +00:00
|
|
|
if self.allow_button.is_element_displayed(sec=5):
|
2018-05-16 19:59:36 +00:00
|
|
|
self.allow_button.click()
|
2021-02-23 12:19:55 +00:00
|
|
|
if self.allow_all_the_time.is_element_displayed(sec=5):
|
|
|
|
self.allow_all_the_time.click()
|
|
|
|
if self.element_by_text("NEXT").is_element_displayed(sec=5):
|
|
|
|
self.element_by_text("NEXT").click()
|
|
|
|
self.shutter_button.click()
|
2018-04-26 06:22:11 +00:00
|
|
|
|
2023-12-09 00:25:19 +00:00
|
|
|
def select_photo_from_gallery_by_index(self, image_index: int):
|
|
|
|
self.allow_button.click_if_shown()
|
|
|
|
self.allow_all_button.click_if_shown()
|
|
|
|
image_element = Button(self.driver, class_name="androidx.cardview.widget.CardView")
|
|
|
|
try:
|
|
|
|
image_element.find_elements()[image_index].click()
|
|
|
|
except IndexError:
|
|
|
|
raise NoSuchElementException("Image with index %s was not found" % image_index) from None
|
2021-07-08 08:32:08 +00:00
|
|
|
|
2018-04-26 06:22:11 +00:00
|
|
|
def logout(self):
|
2021-10-25 16:05:22 +00:00
|
|
|
self.driver.info("Logging out")
|
2018-04-26 06:22:11 +00:00
|
|
|
self.logout_button.click()
|
2020-09-23 11:48:20 +00:00
|
|
|
self.logout_dialog.logout_button.click()
|
|
|
|
self.logout_button.wait_for_invisibility_of_element(30)
|
2018-04-26 06:22:11 +00:00
|
|
|
|
2018-07-19 09:57:45 +00:00
|
|
|
def mail_server_by_name(self, server_name):
|
|
|
|
return MailServerElement(self.driver, server_name)
|
2018-09-05 19:50:48 +00:00
|
|
|
|
2019-05-29 08:43:41 +00:00
|
|
|
def get_toggle_device_by_name(self, device_name):
|
2021-10-25 16:05:22 +00:00
|
|
|
self.driver.info("Selecting device '%s' for sync" % device_name)
|
2023-12-09 00:25:19 +00:00
|
|
|
return SilentButton(
|
|
|
|
self.driver,
|
|
|
|
xpath="//android.widget.TextView[contains(@text,'%s')]/..//android.widget.CheckBox" % device_name)
|
2019-05-29 08:43:41 +00:00
|
|
|
|
2019-05-30 13:09:52 +00:00
|
|
|
def discover_and_advertise_device(self, device_name):
|
2021-10-25 16:05:22 +00:00
|
|
|
self.driver.info("Discovering and advertising '%s'" % device_name)
|
2019-08-29 15:53:17 +00:00
|
|
|
self.sync_settings_button.click()
|
2019-05-30 13:09:52 +00:00
|
|
|
self.devices_button.scroll_to_element()
|
|
|
|
self.devices_button.click()
|
2023-09-06 03:07:12 +00:00
|
|
|
self.device_name_input.send_keys(device_name)
|
2019-05-30 13:09:52 +00:00
|
|
|
self.continue_button.click_until_presence_of_element(self.advertise_device_button, 2)
|
|
|
|
self.advertise_device_button.click()
|
|
|
|
|
2019-10-24 16:03:11 +00:00
|
|
|
def retry_to_connect_to_mailserver(self):
|
2021-10-25 16:05:22 +00:00
|
|
|
self.driver.info("Retrying to connect to mailserver 5 times")
|
2019-10-24 16:03:11 +00:00
|
|
|
i = 0
|
2022-10-04 15:44:55 +00:00
|
|
|
while self.element_by_translation_id("mailserver-error-title").is_element_displayed(20) and i < 5:
|
2021-01-25 16:35:40 +00:00
|
|
|
self.element_by_translation_id("mailserver-retry", uppercase=True).click()
|
2019-10-24 16:03:11 +00:00
|
|
|
i += 1
|
|
|
|
self.just_fyi("retrying to connect: %s attempt" % i)
|
2020-02-26 11:49:27 +00:00
|
|
|
time.sleep(10)
|
2019-10-24 16:03:11 +00:00
|
|
|
if i == 5:
|
|
|
|
self.driver.fail("Failed to connect after %s attempts" % i)
|
|
|
|
|
2021-09-17 16:20:12 +00:00
|
|
|
def connect_existing_ens(self, name, is_stateofus=False):
|
2021-10-25 16:05:22 +00:00
|
|
|
self.driver.info("## Connect existing ENS: %s" % name, device=False)
|
2019-11-25 10:32:30 +00:00
|
|
|
dapp_view = self.ens_usernames_button.click()
|
2021-01-25 16:35:40 +00:00
|
|
|
dapp_view.element_by_translation_id("get-started").click()
|
2021-09-17 16:20:12 +00:00
|
|
|
if not is_stateofus:
|
|
|
|
dapp_view.element_by_translation_id("ens-want-custom-domain").click()
|
2023-09-06 03:07:12 +00:00
|
|
|
dapp_view.ens_name_input.send_keys(name)
|
2021-09-17 16:20:12 +00:00
|
|
|
expected_text = dapp_view.get_translation_by_key("ens-username-connected")
|
|
|
|
if not dapp_view.element_by_text_part(expected_text).is_element_displayed():
|
|
|
|
dapp_view.click_system_back_button()
|
|
|
|
dapp_view.element_by_text_part(expected_text).wait_for_element(30)
|
|
|
|
dapp_view.check_ens_name.click_until_presence_of_element(dapp_view.element_by_translation_id("ens-got-it"))
|
2021-01-25 16:35:40 +00:00
|
|
|
dapp_view.element_by_translation_id("ens-got-it").click()
|
2021-10-25 16:05:22 +00:00
|
|
|
self.driver.info("## ENS name is connected successfully!", device=False)
|
2019-11-25 10:32:30 +00:00
|
|
|
return dapp_view
|
|
|
|
|
2021-01-25 16:35:40 +00:00
|
|
|
@staticmethod
|
|
|
|
def return_mailserver_name(mailserver_name, fleet):
|
2020-01-21 13:59:01 +00:00
|
|
|
return mailserver_name + '.' + fleet
|
|
|
|
|
2018-09-05 19:50:48 +00:00
|
|
|
@property
|
|
|
|
def current_active_network(self):
|
|
|
|
self.advanced_button.click()
|
2019-06-04 11:37:19 +00:00
|
|
|
self.active_network_name.scroll_to_element(10, 'up')
|
2018-09-05 19:50:48 +00:00
|
|
|
return self.active_network_name.text
|
2023-10-18 22:17:11 +00:00
|
|
|
|
|
|
|
def get_sync_code(self):
|
|
|
|
self.syncing_button.scroll_and_click()
|
|
|
|
self.sync_plus_button.click()
|
2024-07-02 15:27:17 +00:00
|
|
|
for checkbox in Button(
|
|
|
|
self.driver,
|
|
|
|
xpath="//*[@content-desc='checkbox-off'][@resource-id='checkbox-component']").find_elements():
|
|
|
|
checkbox.click()
|
|
|
|
self.continue_button.click()
|
2023-10-18 22:17:11 +00:00
|
|
|
self.slide_button_track.swipe_right_on_element(width_percentage=1.3)
|
2024-04-03 12:51:48 +00:00
|
|
|
password_input = self.password_input.find_element()
|
|
|
|
password_input.send_keys(common_password)
|
2023-10-18 22:17:11 +00:00
|
|
|
self.login_button.click()
|
2024-04-03 12:51:48 +00:00
|
|
|
self.wait_for_staleness_of_element(password_input)
|
|
|
|
return self.password_input.text
|