From f94e1c5826fe4f59769f477270cd68961e521c36 Mon Sep 17 00:00:00 2001 From: yevh-berdnyk Date: Wed, 2 May 2018 19:01:17 +0300 Subject: [PATCH] Added e2e tests for account management verifications Signed-off-by: yevh-berdnyk --- test/appium/tests/test_networks.py | 6 +- test/appium/tests/test_profile.py | 132 +++++++++++++++++- test/appium/tests/test_sanity.py | 12 +- test/appium/views/base_element.py | 27 +++- test/appium/views/base_view.py | 23 ++- test/appium/views/chat_view.py | 46 ++++-- .../views/elements_templates/sauce_logo.png | Bin 0 -> 16542 bytes test/appium/views/home_view.py | 10 -- test/appium/views/profile_view.py | 127 +++++++++++++++-- test/appium/views/sign_in_view.py | 19 +-- test/appium/views/wallet_view.py | 15 ++ 11 files changed, 365 insertions(+), 52 deletions(-) create mode 100644 test/appium/views/elements_templates/sauce_logo.png diff --git a/test/appium/tests/test_networks.py b/test/appium/tests/test_networks.py index 82f2994dc1..ac62087837 100644 --- a/test/appium/tests/test_networks.py +++ b/test/appium/tests/test_networks.py @@ -16,7 +16,7 @@ class TestNetwork(SingleDeviceTestCase): sign_in_view.create_user() profile_view = sign_in_view.profile_button.click() profile_view.switch_network(network) - sign_in_view.first_account_button.click() + sign_in_view.click_account_by_position(0) sign_in_view.password_input.send_keys('qwerty1234') sign_in_view.sign_in_button.click() sign_in_view.find_full_text('Wallet', 20) @@ -39,7 +39,7 @@ class TestNetworkChats(MultipleDeviceTestCase): device_1_public_key = device_1_profile_view.public_key_text.text if network[0] != 'Ropsten with upstream RPC': login_d1 = device_1_profile_view.switch_network(network[0]) - login_d1.first_account_button.click() + login_d1.click_account_by_position(0) login_d1.password_input.send_keys('qwerty1234') login_d1.sign_in_button.click() login_d1.find_full_text('Wallet', 60) @@ -49,7 +49,7 @@ class TestNetworkChats(MultipleDeviceTestCase): if network[1] != 'Ropsten with upstream RPC': device_2_profile_view = device_2.profile_button.click() device_2_sign_in = device_2_profile_view.switch_network(network[1]) - device_2_sign_in.first_account_button.click() + device_2_sign_in.click_account_by_position(0) device_2_sign_in.password_input.send_keys('qwerty1234') device_2_home_view = device_2_sign_in.sign_in_button.click() device_2_home_view.find_full_text('Wallet', 60) diff --git a/test/appium/tests/test_profile.py b/test/appium/tests/test_profile.py index 1c80a8bebb..aa8bf7980b 100644 --- a/test/appium/tests/test_profile.py +++ b/test/appium/tests/test_profile.py @@ -1,3 +1,5 @@ +import random +import emoji import pytest import time from tests.base_test_case import SingleDeviceTestCase @@ -8,6 +10,7 @@ from views.sign_in_view import SignInView @pytest.mark.all class TestProfileView(SingleDeviceTestCase): + @pytest.mark.testrail_case_id(3395) def test_qr_code_and_its_value(self): sign_in_view = SignInView(self.driver) sign_in_view.create_user() @@ -16,9 +19,21 @@ class TestProfileView(SingleDeviceTestCase): key_value = profile_view.public_key_text.text time.sleep(5) key_value_from_qr = profile_view.get_text_from_qr() - assert key_value == key_value_from_qr + if key_value != key_value_from_qr: + self.errors.append("QR code value '%s' doesn't match public key '%s'" % (key_value_from_qr, key_value)) + profile_view.cross_icon.click() + wallet_view = profile_view.wallet_button.click() + wallet_view.request_button.click() + wallet_view.qr_code_image.wait_for_element() + key_value = wallet_view.address_text.text + key_value_from_qr = wallet_view.get_text_from_qr() + if key_value_from_qr != "ethereum:%s'" % key_value: + self.errors.append( + "Wallet QR code value '%s' doesn't match wallet address '%s'" % (key_value_from_qr, key_value)) + self.verify_no_errors() @pytest.mark.pr + @pytest.mark.testrail_case_id(3396) def test_contact_profile_view(self): sign_in_view = SignInView(self.driver) sign_in_view.create_user() @@ -29,6 +44,12 @@ class TestProfileView(SingleDeviceTestCase): chat_view.view_profile_button.click() for text in basic_user['username'], 'In contacts', 'Send transaction', 'Send message', 'Contact code': chat_view.find_full_text(text) + chat_view.profile_send_message.click() + chat_view.chat_message_input.wait_for_visibility_of_element() + chat_view.chat_options.click_until_presence_of_element(chat_view.view_profile_button) + chat_view.view_profile_button.click() + chat_view.profile_send_transaction.click() + assert chat_view.chat_message_input.text.strip() == '/send' @pytest.mark.pr def test_network_switch(self): @@ -37,7 +58,7 @@ class TestProfileView(SingleDeviceTestCase): profile_view = sign_in_view.profile_button.click() profile_view.advanced_button.click() sign_in_view = profile_view.switch_network('Rinkeby with upstream RPC') - sign_in_view.first_account_button.click() + sign_in_view.click_account_by_position(0) sign_in_view.password_input.set_value('qwerty1234') sign_in_view.sign_in_button.click() sign_in_view.profile_button.click_until_presence_of_element(profile_view.advanced_button) @@ -45,3 +66,110 @@ class TestProfileView(SingleDeviceTestCase): desired_network = profile_view.element_by_text('RINKEBY WITH UPSTREAM RPC', 'text') desired_network.scroll_to_element() assert desired_network.is_element_displayed() + + @pytest.mark.testrail_case_id(3398) + def test_profile_picture(self): + sign_in_view = SignInView(self.driver) + sign_in_view.create_user() + profile_view = sign_in_view.profile_button.click() + profile_view.edit_profile_picture(file_name='sauce_logo.png') + profile_view.relogin() + sign_in_view.profile_button.click() + if not profile_view.profile_picture.is_element_image_equals_template(): + pytest.fail('Profile picture was not updated') + + @pytest.mark.testrail_case_id(3399) + def test_backup_seed_phrase_and_recover_account(self): + sign_in_view = SignInView(self.driver) + sign_in_view.create_user(password='qwerty1234') + home_view = sign_in_view.get_home_view() + public_key = home_view.get_public_key() + profile_view = home_view.get_profile_view() + profile_view.backup_seed_phrase_button.click() + profile_view.ok_continue_button.click() + seed_phrase = profile_view.get_seed_phrase() + profile_view.next_button.click() + word_number = profile_view.seed_phrase_word_number.text + profile_view.seed_phrase_word_input.set_value(seed_phrase[word_number]) + profile_view.next_button.click() + word_number_1 = profile_view.seed_phrase_word_number.text + profile_view.seed_phrase_word_input.set_value(seed_phrase[word_number_1]) + profile_view.done_button.click() + profile_view.yes_button.click() + profile_view.ok_got_it_button.click() + profile_view.logout_button.click() + profile_view.confirm_logout_button.click() + recover_access_view = sign_in_view.add_existing_account_button.click() + recover_access_view.passphrase_input.set_value(' '.join(seed_phrase.values())) + recover_access_view.password_input.set_value('qwerty1234') + recover_access_view.sign_in_button.click() + sign_in_view.do_not_share.click() + public_key_1 = home_view.get_public_key() + assert public_key == public_key_1 + + @pytest.mark.testrail_case_id(3411) + def test_debug_on_of(self): + sign_in_view = SignInView(self.driver) + sign_in_view.create_user() + profile_view = sign_in_view.profile_button.click() + profile_view.advanced_button.click() + profile_view.debug_mode_toggle.click() + home_view = profile_view.home_button.click() + chat_view = home_view.get_chat_with_user('Status Console').click() + chat_view.commands_button.click() + chat_view.debug_command.click() + chat_view.debug_on_command.click() + chat_view.send_message_button.click() + chat_view.wait_for_message_in_one_to_one_chat('Debug server has been launched! You can now execute ' + 'status-dev-cli scan to find the server from your computer ' + 'on the same network.', self.errors) + chat_view.wait_for_message_in_one_to_one_chat('Debug mode: On', self.errors) + chat_view.commands_button.click() + chat_view.debug_command.click() + chat_view.debug_off_command.click() + chat_view.send_message_button.click() + chat_view.wait_for_message_in_one_to_one_chat('Debug mode: Off', self.errors) + self.verify_no_errors() + + @pytest.mark.testrail_case_id(3421) + def test_switch_users(self): + sign_in_view = SignInView(self.driver) + for _ in range(3): + sign_in_view.create_user(password='qwerty1234') + home_view = sign_in_view.get_home_view() + profile_view = home_view.profile_button.click() + profile_view.logout_button.click() + profile_view.confirm_logout_button.click() + sign_in_view.click_account_by_position(0) + sign_in_view.password_input.send_keys('qwerty1234') + sign_in_view.sign_in_button.click() + sign_in_view.home_button.wait_for_visibility_of_element() + + @pytest.mark.testrail_case_id(3424) + def test_incorrect_password(self): + sign_in_view = SignInView(self.driver) + sign_in_view.create_account_button.click() + sign_in_view.password_input.set_value('123456') + sign_in_view.next_button.click() + sign_in_view.confirm_password_input.set_value('123455') + sign_in_view.next_button.click() + sign_in_view.find_full_text("Password confirmation doesn't match password.") + sign_in_view.confirm_password_input.clear() + sign_in_view.confirm_password_input.set_value('123456') + sign_in_view.next_button.click() + sign_in_view.name_input.wait_for_element(45) + emoji_name = random.choice(list(emoji.EMOJI_UNICODE)) + username = 'user' + sign_in_view.name_input.click() + sign_in_view.name_input.send_keys(emoji.emojize('%s %s' % (username, emoji_name))) + sign_in_view.next_button.click() + sign_in_view.do_not_share.wait_for_element(10) + sign_in_view.do_not_share.click_until_presence_of_element(sign_in_view.home_button) + profile_view = sign_in_view.profile_button.click() + assert profile_view.username_text.text == '%s %s' % (username, emoji.EMOJI_UNICODE[emoji_name]) + profile_view.logout_button.click() + profile_view.confirm_logout_button.click() + sign_in_view.click_account_by_position(0) + sign_in_view.password_input.send_keys('123455') + sign_in_view.sign_in_button.click() + sign_in_view.find_full_text('Wrong password') diff --git a/test/appium/tests/test_sanity.py b/test/appium/tests/test_sanity.py index 36c0126bd9..ff4f0f4c46 100644 --- a/test/appium/tests/test_sanity.py +++ b/test/appium/tests/test_sanity.py @@ -18,12 +18,8 @@ class TestSanity(SingleDeviceTestCase): new_username = 'NewUserName!' profile_view.username_input.send_keys(new_username) profile_view.confirm_button.click() - sign_in_view = profile_view.logout_button.click() - sign_in_view.first_account_button.click() - sign_in_view.password_input.send_keys('qwerty1234') - home_view = sign_in_view.sign_in_button.click() - home_view.find_full_text('Wallet', 60) - home_view.profile_button.click() + profile_view.relogin() + sign_in_view.profile_button.click() profile_view.edit_button.click() profile_view.find_full_text(new_username, 5) @@ -86,7 +82,7 @@ class TestSanity(SingleDeviceTestCase): sign_in_view.status_app_icon.scroll_to_element() sign_in_view.status_app_icon.click() sign_in_view.ok_button.click() - sign_in_view.first_account_button.click() + sign_in_view.click_account_by_position(0) sign_in_view.password_input.send_keys('qwerty1234') sign_in_view.sign_in_button.click() contact_name.wait_for_element(30) @@ -106,7 +102,7 @@ class TestSanity(SingleDeviceTestCase): profile_view = sign_in_view.profile_button.click() profile_view.logout_button.scroll_to_element() sign_in_view = profile_view.logout_button.click() - sign_in_view.first_account_button.click() + sign_in_view.click_account_by_position(0) sign_in_view.password_input.send_keys(input_text) sign_in_view.sign_in_button.click() sign_in_view.find_full_text(outcome, 60) diff --git a/test/appium/views/base_element.py b/test/appium/views/base_element.py index d8948ef7ad..216dc8dc4f 100644 --- a/test/appium/views/base_element.py +++ b/test/appium/views/base_element.py @@ -1,3 +1,7 @@ +import base64 +from io import BytesIO +import os +from PIL import Image, ImageChops from appium.webdriver.common.mobileby import MobileBy from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import TimeoutException @@ -7,7 +11,6 @@ from tests import info class BaseElement(object): - class Locator(object): def __init__(self, by, value): @@ -50,7 +53,7 @@ class BaseElement(object): def wait_for_element(self, seconds=10): try: - return WebDriverWait(self.driver, seconds)\ + return WebDriverWait(self.driver, seconds) \ .until(expected_conditions.presence_of_element_located((self.locator.by, self.locator.value))) except TimeoutException as exception: exception.msg = "'%s' is not found on screen, using: '%s', during '%s' seconds" % (self.name, self.locator, @@ -59,7 +62,7 @@ class BaseElement(object): def wait_for_visibility_of_element(self, seconds=10): try: - return WebDriverWait(self.driver, seconds)\ + return WebDriverWait(self.driver, seconds) \ .until(expected_conditions.visibility_of_element_located((self.locator.by, self.locator.value))) except TimeoutException as exception: exception.msg = "'%s' is not found on screen, using: '%s', during '%s' seconds" % (self.name, self.locator, @@ -92,6 +95,24 @@ class BaseElement(object): def text(self): return self.find_element().text + @property + def template(self): + try: + return self.__template + except FileNotFoundError: + raise FileNotFoundError('Please add %s image as template' % self.name) + + @template.setter + def template(self, value): + self.__template = Image.open(os.sep.join(__file__.split(os.sep)[:-1]) + '/elements_templates/%s' % value) + + @property + def image(self): + return Image.open(BytesIO(base64.b64decode(self.find_element().screenshot_as_base64))) + + def is_element_image_equals_template(self): + return not ImageChops.difference(self.image, self.template).getbbox() + class BaseEditBox(BaseElement): diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index 16968ad9d7..926a3167e5 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -25,7 +25,7 @@ class BackButton(BaseButton): class AllowButton(BaseButton): def __init__(self, driver): super(AllowButton, self).__init__(driver) - self.locator = self.Locator.xpath_selector("//*[@text='Allow']") + self.locator = self.Locator.xpath_selector("//*[@text='Allow' or @text='ALLOW']") def click(self): try: @@ -290,3 +290,24 @@ class BaseView(object): def public_key_to_address(self, public_key): raw_public_key = bytearray.fromhex(public_key.replace('0x04', '')) return datatypes.PublicKey(raw_public_key).to_address()[2:] + + def get_back_to_home_view(self): + counter = 0 + while not self.home_button.is_element_displayed(2): + try: + if counter >= 5: + return + self.back_button.click() + except (NoSuchElementException, TimeoutException): + counter += 1 + + def relogin(self): + self.get_back_to_home_view() + profile_view = self.profile_button.click() + profile_view.logout_button.click() + profile_view.confirm_logout_button.click() + sign_in_view = self.get_sign_in_view() + sign_in_view.click_account_by_position(0) + sign_in_view.password_input.send_keys('qwerty1234') + sign_in_view.sign_in_button.click() + sign_in_view.home_button.wait_for_visibility_of_element() diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index 9dbdccc22f..6d6535a789 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -42,6 +42,25 @@ class RequestCommand(BaseButton): self.locator = self.Locator.accessibility_id('request-payment-button') +class DebugCommand(BaseButton): + def __init__(self, driver): + super(DebugCommand, self).__init__(driver) + self.locator = self.Locator.xpath_selector( + "//*[contains(@text,'Starts/stops')]/preceding-sibling::*[@text='/debug']") + + +class DebugOnCommand(BaseButton): + def __init__(self, driver): + super(DebugOnCommand, self).__init__(driver) + self.locator = self.Locator.xpath_selector("//*[@text='On']") + + +class DebugOffCommand(BaseButton): + def __init__(self, driver): + super(DebugOffCommand, self).__init__(driver) + self.locator = self.Locator.xpath_selector("//*[@text='Off']") + + class ChatMenuButton(BaseButton): def __init__(self, driver): super(ChatMenuButton, self).__init__(driver) @@ -99,12 +118,6 @@ class MoreUsersButton(BaseButton): self.locator = self.Locator.xpath_selector("//android.widget.TextView[contains(@text, 'MORE')]") -class UserProfileDetails(BaseButton): - def __init__(self, driver): - super(UserProfileDetails, self).__init__(driver) - self.locator = self.Locator.xpath_selector("//*[@text='Profile']") - - class OpenInBrowserButton(BaseButton): def __init__(self, driver): super(OpenInBrowserButton, self).__init__(driver) @@ -127,6 +140,18 @@ class ViewProfileButton(BaseButton): self.locator = self.Locator.xpath_selector('//*[@text="View profile"]') +class ProfileSendMessageButton(BaseButton): + def __init__(self, driver): + super(ProfileSendMessageButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id('start-conversation-button') + + +class ProfileSendTransactionButton(BaseButton): + def __init__(self, driver): + super(ProfileSendTransactionButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id('send-transaction-button') + + class ChatView(BaseView): def __init__(self, driver): super(ChatView, self).__init__(driver) @@ -138,6 +163,9 @@ class ChatView(BaseView): self.commands_button = CommandsButton(self.driver) self.send_command = SendCommand(self.driver) self.request_command = RequestCommand(self.driver) + self.debug_command = DebugCommand(self.driver) + self.debug_on_command = DebugOnCommand(self.driver) + self.debug_off_command = DebugOffCommand(self.driver) self.chat_options = ChatMenuButton(self.driver) self.members_button = MembersButton(self.driver) @@ -151,10 +179,12 @@ class ChatView(BaseView): self.first_recipient_button = FirstRecipient(self.driver) - self.user_profile_details = UserProfileDetails(self.driver) - self.open_in_browser_button = OpenInBrowserButton(self.driver) + # Contact's profile + self.profile_send_message = ProfileSendMessageButton(self.driver) + self.profile_send_transaction = ProfileSendTransactionButton(self.driver) + def wait_for_syncing_complete(self): info('Waiting for syncing complete:') while True: diff --git a/test/appium/views/elements_templates/sauce_logo.png b/test/appium/views/elements_templates/sauce_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..3671d26e979746ceb885b6bb49f8e87cfa653b10 GIT binary patch literal 16542 zcmV*LKxDs(P)uMcJl6{vcT+$pUCn6jyW;1VA(Z zc2{rcz1Cdbd-tAm=7+3mG`4O?A}P;_jEfC$wNA8aQ3}k6(>CBlkPdxF& z>gwu=6DOuGo;Y!0b#?W|dj^BS;lqcg$A=Fe9t;LYj~?B>fB%642Y&iL__acRhbX`L z)vrFWC4b9P9o>=-fB3^cj-U27694JS>C>klee}_zN00vGuIT8|qmMrN=;_m^f6ABk zQ$o42vU2R$u}^;TlRr6vua!@J@{`Ao9a~vh`RQEaPaNgx)2Bc4na}(*3BF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HJi=bqvbW%zguSUhVlVIS;?tWr}ppP4+0z^BRBz9pgM-E zH+BpF9+ZzNQHF5Snmw(I+-M0NMfph}4lYBMAr)I$^i002HoL_t(l)bB>-=jZp1u0Ju^wQJW}%x`XPZgzIIdc19!<}XM77j_{`eR^O- Ss{jB107*qoM6Pp6XaWG)-W%-z literal 0 HcmV?d00001 diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index ddf7721a42..65ec14f6ae 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -82,16 +82,6 @@ class HomeView(BaseView): def get_chat_with_user(self, username): return ChatElement(self.driver, username) - def get_back_to_home_view(self): - counter = 0 - while not self.home_button.is_element_displayed(2): - try: - if counter >= 5: - return - self.back_button.click() - except (NoSuchElementException, TimeoutException): - counter += 1 - def add_contact(self, public_key): start_new_chat = self.plus_button.click() start_new_chat.start_new_chat_button.click() diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index 3a32aacfb2..21136c842a 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -1,6 +1,8 @@ import time + from tests import info -from views.base_element import BaseText, BaseButton, BaseEditBox +from tests.base_test_case import AbstractTestCase +from views.base_element import BaseText, BaseButton, BaseEditBox, BaseElement from views.base_view import BaseView @@ -74,14 +76,12 @@ class LogoutButton(BaseButton): super(LogoutButton, self).__init__(driver) self.locator = self.Locator.accessibility_id('log-out-button') - def click(self): - self.scroll_to_element() - for _ in range(2): - self.find_element().click() - time.sleep(2) - info('Tap on %s' % self.name) - from views.sign_in_view import SignInView - return SignInView(self.driver) + +class ConfirmLogoutButton(BaseButton): + + def __init__(self, driver): + super(ConfirmLogoutButton, self).__init__(driver) + self.locator = self.Locator.xpath_selector("//*[@text='LOG OUT']") class UserNameText(BaseText): @@ -105,6 +105,19 @@ class EditButton(BaseButton): self.locator = self.Locator.accessibility_id('edit-button') +class ProfilePictureElement(BaseElement): + def __init__(self, driver): + super(ProfilePictureElement, self).__init__(driver) + self.locator = self.Locator.accessibility_id('chat-icon') + + +class EditPictureButton(BaseButton): + + def __init__(self, driver): + super(EditPictureButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id('edit-profile-photo-button') + + class ConfirmButton(BaseButton): def __init__(self, driver): @@ -131,6 +144,72 @@ class AdvancedButton(BaseButton): return self.navigate() +class BackupSeedPhraseButton(BaseButton): + + def __init__(self, driver): + super(BackupSeedPhraseButton, self).__init__(driver) + self.locator = self.Locator.xpath_selector("//*[@text='Backup your Seed Phrase']") + + +class OkContinueButton(BaseButton): + + def __init__(self, driver): + super(OkContinueButton, self).__init__(driver) + self.locator = self.Locator.xpath_selector("//*[@text='OK, CONTINUE']") + + +class SeedPhraseTable(BaseText): + + def __init__(self, driver): + super(SeedPhraseTable, self).__init__(driver) + self.locator = self.Locator.xpath_selector( + '//android.widget.FrameLayout/android.view.ViewGroup[3]/android.widget.TextView') + + +class SeedPhraseWordNumberText(BaseText): + + def __init__(self, driver): + super(SeedPhraseWordNumberText, self).__init__(driver) + self.locator = self.Locator.xpath_selector("//*[contains(@text,'#')]") + + @property + def text(self): + time.sleep(1) + return self.find_element().text.split('#')[1] + + +class SeedPhraseWordInput(BaseEditBox): + + def __init__(self, driver): + super(SeedPhraseWordInput, self).__init__(driver) + self.locator = self.Locator.xpath_selector('//android.widget.EditText') + + +class OkGotItButton(BaseButton): + + def __init__(self, driver): + super(OkGotItButton, self).__init__(driver) + self.locator = self.Locator.xpath_selector("//*[@text='OK, GOT IT']") + + +class DebugModeToggle(BaseButton): + + def __init__(self, driver): + super(DebugModeToggle, self).__init__(driver) + self.locator = self.Locator.xpath_selector("//android.widget.Switch") + + def click(self): + self.scroll_to_element() + super(DebugModeToggle, self).click() + + +class SelectFromGalleryButton(BaseButton): + + def __init__(self, driver): + super(SelectFromGalleryButton, self).__init__(driver) + self.locator = self.Locator.xpath_selector("//*[@text='Select from gallery']") + + class ProfileView(BaseView): def __init__(self, driver): @@ -148,15 +227,28 @@ class ProfileView(BaseView): self.network_settings_button = NetworkSettingsButton(self.driver) self.connect_button = NetworkSettingsButton.ConnectButton(self.driver) self.logout_button = LogoutButton(self.driver) + self.confirm_logout_button = ConfirmLogoutButton(self.driver) # new design self.username_text = UserNameText(self.driver) self.share_my_contact_key_button = ShareMyContactKeyButton(self.driver) self.edit_button = EditButton(self.driver) + self.profile_picture = ProfilePictureElement(self.driver) + self.edit_picture_button = EditPictureButton(self.driver) self.confirm_button = ConfirmButton(self.driver) self.cross_icon = CrossIcon(self.driver) self.advanced_button = AdvancedButton(self.driver) + self.debug_mode_toggle = DebugModeToggle(self.driver) + + # Backup seed phrase + self.backup_seed_phrase_button = BackupSeedPhraseButton(self.driver) + self.ok_continue_button = OkContinueButton(self.driver) + self.seed_phrase_table = SeedPhraseTable(self.driver) + self.seed_phrase_word_number = SeedPhraseWordNumberText(self.driver) + self.seed_phrase_word_input = SeedPhraseWordInput(self.driver) + self.ok_got_it_button = OkGotItButton(self.driver) + self.select_from_gallery_button = SelectFromGalleryButton(self.driver) def switch_network(self, network): self.network_settings_button.scroll_to_element() @@ -170,3 +262,20 @@ class ProfileView(BaseView): def get_address(self): profile_view = self.profile_button.click() return profile_view.profile_address_text.text + + def get_seed_phrase(self): + text = [i.text for i in self.seed_phrase_table.find_elements()] + return dict(zip(text[::2], text[1::2])) + + def edit_profile_picture(self, file_name: str): + if AbstractTestCase().environment == 'sauce': + self.profile_picture.template = file_name + self.edit_button.click() + self.edit_picture_button.click() + self.select_from_gallery_button.click() + if self.allow_button.is_element_displayed(sec=10): + self.allow_button.click() + self.element_by_text(file_name).click() + self.confirm_button.click() + else: + raise NotImplementedError('Test case is implemented to run on SauceLabs only') diff --git a/test/appium/views/sign_in_view.py b/test/appium/views/sign_in_view.py index d5ee14e5db..2523c9d2be 100644 --- a/test/appium/views/sign_in_view.py +++ b/test/appium/views/sign_in_view.py @@ -1,14 +1,13 @@ from tests import get_current_time from views.base_element import BaseButton, BaseEditBox from views.base_view import BaseView -import time -class FirstAccountButton(BaseButton): +class AccountButton(BaseButton): def __init__(self, driver): - super(FirstAccountButton, self).__init__(driver) - self.locator = self.Locator.xpath_selector("//android.widget.ScrollView//android.widget.TextView") + super(AccountButton, self).__init__(driver) + self.locator = self.Locator.xpath_selector("//*[contains(@text,'0x')]") class PasswordInput(BaseEditBox): @@ -44,7 +43,8 @@ class RecoverAccessButton(BaseButton): class CreateAccountButton(BaseButton): def __init__(self, driver): super(CreateAccountButton, self).__init__(driver) - self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='CREATE ACCOUNT']") + self.locator = self.Locator.xpath_selector( + "//android.widget.TextView[@text='CREATE ACCOUNT' or @text='CREATE NEW ACCOUNT']") class IHaveAccountButton(RecoverAccessButton): @@ -68,7 +68,7 @@ class ConfirmPasswordInput(BaseEditBox): class NameInput(BaseEditBox): def __init__(self, driver): super(NameInput, self).__init__(driver) - self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Name']") + self.locator = self.Locator.xpath_selector("//android.widget.EditText") class DonNotShare(BaseButton): @@ -84,7 +84,7 @@ class SignInView(BaseView): super(SignInView, self).__init__(driver) self.driver = driver - self.first_account_button = FirstAccountButton(self.driver) + self.account_button = AccountButton(self.driver) self.password_input = PasswordInput(self.driver) self.sign_in_button = SignInButton(self.driver) self.recover_access_button = RecoverAccessButton(self.driver) @@ -104,7 +104,7 @@ class SignInView(BaseView): self.confirm_password_input.set_value(password) self.next_button.click() self.name_input.wait_for_element(45) - self.name_input.set_value('user_%s' % get_current_time()) + self.name_input.send_keys('user_%s' % get_current_time()) self.next_button.click() self.do_not_share.wait_for_element(10) self.do_not_share.click_until_presence_of_element(self.home_button) @@ -118,3 +118,6 @@ class SignInView(BaseView): recover_access_view.sign_in_button.click() self.do_not_share.wait_for_element(10) self.do_not_share.click_until_presence_of_element(self.home_button) + + def click_account_by_position(self, position: int): + self.account_button.find_elements()[position].click() diff --git a/test/appium/views/wallet_view.py b/test/appium/views/wallet_view.py index 9fab1a8e43..6d99466c11 100644 --- a/test/appium/views/wallet_view.py +++ b/test/appium/views/wallet_view.py @@ -98,6 +98,18 @@ class DoneButton(BaseButton): self.locator = self.Locator.accessibility_id('done-button') +class QRCodeImage(BaseButton): + def __init__(self, driver): + super(QRCodeImage, self).__init__(driver) + self.locator = self.Locator.accessibility_id('qr-code-image') + + +class AddressText(BaseButton): + def __init__(self, driver): + super(AddressText, self).__init__(driver) + self.locator = self.Locator.accessibility_id('address-text') + + class WalletView(BaseView): def __init__(self, driver): super(WalletView, self).__init__(driver) @@ -117,6 +129,9 @@ class WalletView(BaseView): self.stt_check_box = STTCheckBox(self.driver) self.done_button = DoneButton(self.driver) + self.qr_code_image = QRCodeImage(self.driver) + self.address_text = AddressText(self.driver) + def get_usd_total_value(self): return float(self.usd_total_value.text)