diff --git a/test/appium/tests/atomic/account_management/test_profile.py b/test/appium/tests/atomic/account_management/test_profile.py index 90131a4be5..2c82b9413e 100644 --- a/test/appium/tests/atomic/account_management/test_profile.py +++ b/test/appium/tests/atomic/account_management/test_profile.py @@ -6,7 +6,6 @@ from tests import marks, bootnode_address, mailserver_address, camera_access_err mailserver_staging_hk from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase from tests.users import transaction_senders, basic_user, ens_user -from views.dapps_view import DappsView from views.sign_in_view import SignInView @@ -199,8 +198,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase): profile = home.profile_button.click() profile.switch_network('Mainnet with upstream RPC') home.profile_button.click() - profile.element_by_text('ENS usernames').click() - dapp_view = DappsView(self.driver) + dapp_view = profile.ens_usernames_button.click() dapp_view.just_fyi('check if your name can be added via "ENS usernames" in Profile') dapp_view.element_by_text('Get started').click() @@ -547,6 +545,37 @@ class TestProfileSingleDevice(SingleDeviceTestCase): self.errors.verify_no_errors() + @marks.testrail_id(6219) + @marks.medium + def test_set_primary_ens_custom_domain(self): + sign_in_view = SignInView(self.driver) + ens_not_stateofus = ens_user['ens_another_domain'] + ens_stateofus = ens_user['ens'] + home_view = sign_in_view.recover_access(ens_user['passphrase']) + + home_view.just_fyi('add 2 ENS names in Profile') + profile_view = home_view.profile_button.click() + dapp_view = profile_view.connect_existing_status_ens(ens_stateofus) + profile_view.element_by_text("Add username").click() + profile_view.element_by_text_part("another domain").click() + dapp_view.ens_name.set_value(ens_not_stateofus) + dapp_view.check_ens_name.click_until_presence_of_element(dapp_view.element_by_text('Ok, got it')) + dapp_view.element_by_text('Ok, got it').click() + + home_view.just_fyi('check that by default %s ENS is set' % ens_stateofus) + dapp_view.element_by_text('Primary username').click() + message_to_check = 'Your messages are displayed to others with' + if not dapp_view.element_by_text('%s\n@%s.stateofus.eth' % (message_to_check, ens_stateofus)).is_element_displayed(): + self.errors.append('%s ENS username is not set as primary by default' % ens_stateofus) + + home_view.just_fyi('check view in chat settings ENS from other domain: %s after set new primary ENS' % ens_not_stateofus) + dapp_view.set_primary_ens_username(ens_user['ens_another_domain']).click() + profile_view.show_ens_name_in_chats.click() + if profile_view.username_in_ens_chat_settings_text.text != '@' + ens_not_stateofus: + self.errors.append('ENS username %s is not shown in ENS username Chat Settings after enabling' % ens_not_stateofus) + + self.errors.verify_no_errors() + @marks.all @marks.account @@ -857,8 +886,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase): profile_1 = sign_in_1.profile_button.click() profile_1.switch_network('Mainnet with upstream RPC') home_1.profile_button.click() - profile_1.element_by_text('ENS usernames').click() - dapp_view_1 = DappsView(device_1) + dapp_view_1 = profile_1.ens_usernames_button.click() dapp_view_1.element_by_text('Get started').click() dapp_view_1.ens_name.set_value(ens_user['ens']) expected_text = 'This user name is owned by you and connected with your Chat key.' @@ -868,7 +896,13 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase): dapp_view_1.element_by_text('Ok, got it').click() if profile_1.username_in_ens_chat_settings_text.text != user_1['username']: self.errors.append('Default username is not shown in ENS usernames') - dapp_view_1.back_button.click() + + home_1.just_fyi('check ENS name wallet address and public key') + profile_1.element_by_text(user_1['ens']).click() + for text in ('10 SNT, deposit unlocked', user_1['address'].lower(), user_1['public_key'] ): + if not profile_1.element_by_text_part(text).is_element_displayed(): + self.errors.append('%s text is not shown' % text) + dapp_view_1.get_back_to_home_view() profile_1.home_button.click() home_2.just_fyi('joining same public chat, checking default username on message') @@ -915,4 +949,4 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase): if not profile_2.element_by_text('@' + user_1['ens']).is_element_displayed(): self.errors.append('ENS username is not shown in contacts') - self.errors.verify_no_errors() + self.errors.verify_no_errors() \ No newline at end of file diff --git a/test/appium/tests/users.py b/test/appium/tests/users.py index cc6bd33dda..9f49cc9873 100644 --- a/test/appium/tests/users.py +++ b/test/appium/tests/users.py @@ -7,16 +7,14 @@ basic_user['address'] = "f184747445c3B85CEb147DfB136067CB93d95F1D" basic_user['special_chars_password'] = " !\"#$Á%Ö&'()*+Í, -./:ä;<=>?@[\\]^_`{|}~ " ens_user = dict() -ens_user['passphrase'] = "husband rough hotel obey annual you member reopen struggle air evoke taxi" -ens_user['username'] = "Outstanding Actual Eyas" -ens_user['public_key'] = "0x04318d20a2ca5fd0022579005ed24802e07d4ec610bede808dd13d3318af439e16d55be1a59af007a11120b" \ - "d1c205861e5f53fe7b000a25e2b0d4eee7f0c5ebf7e" -ens_user['ens'] = 'autotester' -ens_user['address'] = '0x31419baa0242dFd2BB485b3e41A78210A1c2332A' +ens_user['passphrase'] = "fashion quality know robust copy neck stand embody entry task orient suggest" +ens_user['username'] = "Legal Vibrant Indianabat" +ens_user['public_key'] = "0x04359bb3e73cba0b815d71e562670ad00bb5d2db0d16cd1c4c92c668b61fde2274d6e487fcdffe66f913b3fea2a" \ + "3058f53ce7946c2b501aa61a9ca8a883df72dc9" +ens_user['ens'] = 'statuse2e' +ens_user['ens_another_domain'] = 'statuse2e.eth' +ens_user['address'] = '0x1eE3058Bd300246B4B20E687Efc9Eba81FF7814b' -ens_user_other_domain = dict() -ens_user_other_domain['ens'] = 'tanyatest1.eth' -ens_user_other_domain['address'] = '0xcf2272205cc0cf96Cfbb9Dd740BD681D1E86901E' dummy_user = dict() dummy_user['username'] = "Vain Wordy Hagfish" diff --git a/test/appium/views/dapps_view.py b/test/appium/views/dapps_view.py index b1c4e59fc8..7a5cd3a734 100644 --- a/test/appium/views/dapps_view.py +++ b/test/appium/views/dapps_view.py @@ -63,6 +63,12 @@ class SelectAccountRadioButton(BaseButton): super(SelectAccountRadioButton, self).__init__(driver) self.locator = self.Locator.xpath_selector("//*[@text='%s']/../../android.view.ViewGroup/android.view.ViewGroup[2]" % account_name) +class SetPrimaryUsername(BaseButton): + def __init__(self, driver, ens_name): + super(SetPrimaryUsername, self).__init__(driver) + self.locator = self.Locator.xpath_selector( + "(//android.widget.ScrollView//*[@text='%s'])[2]/../../../android.view.ViewGroup[2]" % ens_name) + class AlwaysAllowRadioButton(BaseButton): def __init__(self, driver): @@ -119,3 +125,6 @@ class DappsView(BaseView): def select_account_by_name(self, account_name='Status account'): return SelectAccountRadioButton(self.driver, account_name) + + def set_primary_ens_username(self, ens_name): + return SetPrimaryUsername(self.driver, ens_name) diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index db9224b4e7..fb2144037d 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -107,6 +107,19 @@ class DefaultUserNameText(BaseText): self.locator = self.Locator.xpath_selector( '//android.view.ViewGroup[@content-desc="edit-profile-photo-button"]/../android.widget.TextView') +class ENSusernames(BaseButton): + def __init__(self, driver): + super(ENSusernames, self).__init__(driver) + self.locator = self.Locator.text_selector('ENS usernames') + + def navigate(self): + from views.dapps_view import DappsView + return DappsView(self.driver) + + def click(self): + self.scroll_to_element().click() + return self.navigate() + class ShareMyProfileButton(BaseButton): @@ -621,6 +634,7 @@ class ProfileView(BaseView): # ENS self.show_ens_name_in_chats = ShowENSNameInChatsToggle(self.driver) self.username_in_ens_chat_settings_text = ENSUsernameInChatSettings(self.driver) + self.ens_usernames_button = ENSusernames(self.driver) # Mobile Data self.use_mobile_data = UseMobileDataToggle(self.driver) @@ -726,6 +740,19 @@ class ProfileView(BaseView): if i == 5: self.driver.fail("Failed to connect after %s attempts" % i) + def connect_existing_status_ens(self, name): + self.just_fyi('switching to mainnet and add ENS') + profile = self.profile_button.click() + profile.switch_network('Mainnet with upstream RPC') + self.profile_button.click() + dapp_view = self.ens_usernames_button.click() + dapp_view.element_by_text('Get started').click() + dapp_view.ens_name.set_value(name) + dapp_view.check_ens_name.click_until_presence_of_element(self.element_by_text('Ok, got it')) + dapp_view.element_by_text('Ok, got it').click() + return dapp_view + + @property def current_active_network(self): self.advanced_button.click() diff --git a/test/appium/views/sign_in_view.py b/test/appium/views/sign_in_view.py index 6ba9f0d836..25b09d12c3 100644 --- a/test/appium/views/sign_in_view.py +++ b/test/appium/views/sign_in_view.py @@ -55,7 +55,7 @@ class SignInButton(BaseButton): from views.home_view import HomeView return HomeView(self.driver) -class LetsGoButton(BaseEditBox): +class LetsGoButton(BaseButton): def __init__(self, driver): super(LetsGoButton, self).__init__(driver) self.locator = self.Locator.accessibility_id('lets-go-button') @@ -194,7 +194,7 @@ class SignInView(BaseView): self.next_button.click() self.confirm_your_password_input.set_value(password) self.next_button.click() - self.lets_go_button.click() + self.lets_go_button.click_until_absense_of_element(self.lets_go_button) self.profile_button.wait_for_visibility_of_element(30) return self.get_home_view()