From 7f05c096323d5a5713d1905a751bf9776d2a55c8 Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Fri, 2 Aug 2019 11:28:59 +0200 Subject: [PATCH] ens e2e Signed-off-by: Churikova Tetiana --- .../atomic/account_management/test_profile.py | 35 ++++++++++++++++++- .../tests/atomic/chats/test_one_to_one.py | 14 +++++++- test/appium/tests/users.py | 7 ++++ test/appium/views/dapps_view.py | 13 +++++++ 4 files changed, 67 insertions(+), 2 deletions(-) diff --git a/test/appium/tests/atomic/account_management/test_profile.py b/test/appium/tests/atomic/account_management/test_profile.py index f560b93961..a1e2ca0dad 100644 --- a/test/appium/tests/atomic/account_management/test_profile.py +++ b/test/appium/tests/atomic/account_management/test_profile.py @@ -3,8 +3,9 @@ import pytest from tests import marks, bootnode_address, mailserver_address, camera_access_error_text, \ photos_access_error_text from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase -from tests.users import transaction_senders, basic_user +from tests.users import transaction_senders, basic_user, ens_user from views.sign_in_view import SignInView +from views.dapps_view import DappsView @marks.all @@ -104,6 +105,38 @@ class TestProfileSingleDevice(SingleDeviceTestCase): self.errors.append('Wallet address was not copied') self.verify_no_errors() + @marks.testrail_id(5502) + @marks.critical + def test_can_add_existing_ens(self): + sign_in = SignInView(self.driver) + home = sign_in.recover_access(ens_user['passphrase']) + 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) + + # check if your name can be added via "ENS usernames" dapp in Profile + dapp_view.element_by_text('Get started').click() + dapp_view.ens_name.set_value(ens_user['ens']) + if not dapp_view.element_by_text_part('is owned by you').is_element_displayed(): + self.errors.append('Owned username is not shown in ENS Dapp.') + dapp_view.check_ens_name.click() + dapp_view.check_ens_name.click() + if not dapp_view.element_by_text_part('Username added').is_element_displayed(): + self.errors.append('No message "Username added" after resolving own username') + dapp_view.element_by_text('Ok, got it').click() + + # check that after adding username is shown in "ENS usernames" and profile + if not dapp_view.element_by_text(ens_user['ens']).is_element_displayed(): + self.errors.append('No ENS name is shown in own "ENS usernames" after adding') + dapp_view.back_button.click() + if not dapp_view.element_by_text('@%s' % ens_user['ens']).is_element_displayed(): + self.errors.append('No ENS name is shown in own profile after adding') + if not dapp_view.element_by_text('%s.stateofus.eth' % ens_user['ens']).is_element_displayed(): + self.errors.append('No ENS name is shown in own profile after adding') + self.verify_no_errors() + @marks.testrail_id(5475) @marks.low def test_change_profile_picture_several_times(self): diff --git a/test/appium/tests/atomic/chats/test_one_to_one.py b/test/appium/tests/atomic/chats/test_one_to_one.py index 88dc6d8dd3..36491816a5 100644 --- a/test/appium/tests/atomic/chats/test_one_to_one.py +++ b/test/appium/tests/atomic/chats/test_one_to_one.py @@ -9,7 +9,7 @@ from selenium.common.exceptions import TimeoutException from tests import marks, get_current_time from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase -from tests.users import transaction_senders, transaction_recipients, basic_user +from tests.users import transaction_senders, transaction_recipients, basic_user, ens_user from views.sign_in_view import SignInView @@ -716,3 +716,15 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase): chat.swipe_left() chat.sticker_icon.click() chat.chat_item.is_element_displayed() + + @marks.testrail_id(5403) + @marks.critical + def test_start_chat_with_ens(self): + sign_in = SignInView(self.driver) + home = sign_in.create_user() + profile = home.profile_button.click() + profile.switch_network('Mainnet with upstream RPC') + chat = home.add_contact(ens_user['ens']) + if not chat.element_by_text(ens_user['username']).is_element_displayed(): + self.driver.fail('Wrong user is resolved from username when starting 1-1 chat.') + diff --git a/test/appium/tests/users.py b/test/appium/tests/users.py index bc85c6d5d2..6f3f616a95 100644 --- a/test/appium/tests/users.py +++ b/test/appium/tests/users.py @@ -6,6 +6,13 @@ basic_user['public_key'] = "0x040d3400f0ba80b2f6017a9021a66e042abc33cf7051ddf98a 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'] = "Wan Sharp Bettong" +ens_user['public_key'] = "0x042d693dc861dbd1da8542c9614dbea58a488dc3da822759a539279cdf9234de987342ca17009dcc97fbabf" \ + "00a606b770d92c3932e484a2b868eef2915982a24c6" +ens_user['ens'] = 'autotester' + wallet_users = dict() wallet_users['A'] = dict() diff --git a/test/appium/views/dapps_view.py b/test/appium/views/dapps_view.py index b985bce259..e7b9da4aed 100644 --- a/test/appium/views/dapps_view.py +++ b/test/appium/views/dapps_view.py @@ -30,6 +30,15 @@ class BrowserEntry(ChatElement): super(BrowserEntry, self).__init__(driver, name) self.locator = self.Locator.xpath_selector('//*[@text="%s"]/..' % name) +class EnsName(BaseEditBox): + def __init__(self, driver): + super(EnsName, self).__init__(driver) + self.locator = self.Locator.xpath_selector('//android.widget.EditText') + +class EnsCheckName(BaseButton): + def __init__(self, driver): + super(EnsCheckName, self).__init__(driver) + self.locator = self.Locator.xpath_selector('//android.widget.EditText//following-sibling::android.view.ViewGroup[1]') class DappsView(BaseView): @@ -40,6 +49,10 @@ class DappsView(BaseView): self.open_button = OpenButton(self.driver) self.enter_url_editbox = EnterUrlEditbox(self.driver) + #ens dapp + self.ens_name = EnsName(self.driver) + self.check_ens_name = EnsCheckName(self.driver) + def open_url(self, url): self.enter_url_editbox.click() self.enter_url_editbox.send_keys(url)