diff --git a/test/appium/tests/atomic/account_management/test_profile.py b/test/appium/tests/atomic/account_management/test_profile.py index e8a742090b..a34782bdac 100644 --- a/test/appium/tests/atomic/account_management/test_profile.py +++ b/test/appium/tests/atomic/account_management/test_profile.py @@ -28,25 +28,21 @@ class TestProfileSingleDevice(SingleDeviceTestCase): sign_in_view.create_user() profile_view = sign_in_view.profile_button.click() profile_view.share_my_contact_key_button.click() + public_key = profile_view.public_key_text.text profile_view.share_button.click() - try: - profile_view.element_by_text('Gmail').is_element_displayed() - profile_view.element_by_text('Gmail', 'button').click() - profile_view.element_by_text('Welcome to Gmail').wait_for_visibility_of_element() - except (NoSuchElementException, TimeoutException): - self.errors.append('Can\'t share contact code via email') + profile_view.share_via_messenger() + if not profile_view.element_by_text_part(public_key).is_element_present(): + self.errors.append("Can't share public key") profile_view.click_system_back_button() profile_view.cross_icon.click() wallet = profile_view.wallet_button.click() wallet.set_up_wallet() request = wallet.receive_transaction_button.click() + address = wallet.address_text.text request.share_button.click() - try: - profile_view.element_by_text('Gmail').is_element_displayed() - profile_view.element_by_text('Gmail', 'button').click() - profile_view.element_by_text('Welcome to Gmail').wait_for_visibility_of_element() - except (NoSuchElementException, TimeoutException): - self.errors.append('Can\'t share wallet address via email') + wallet.share_via_messenger() + if not wallet.element_by_text_part(address).is_element_present(): + self.errors.append("Can't share address") self.verify_no_errors() @marks.testrail_id(3704) @@ -112,3 +108,42 @@ class TestProfileSingleDevice(SingleDeviceTestCase): if sign_in_view.profile_button.counter.is_element_displayed(): self.errors.append('Profile button counter is shown after seed phrase backup') self.verify_no_errors() + + @marks.testrail_id(3721) + def test_invite_friends(self): + sign_in_view = SignInView(self.driver) + home = sign_in_view.create_user() + wallet = home.wallet_button.click() + wallet.set_up_wallet() + wallet.receive_transaction_button.click() + address = wallet.address_text.text[2:] + wallet.get_back_to_home_view() + wallet.home_button.click() + start_new_chat = home.plus_button.click() + start_new_chat.invite_friends_button.click() + start_new_chat.share_via_messenger() + start_new_chat.find_text_part("Get Status at http://status.im?refCode=%s" % address) + + @marks.testrail_id(3450) + def test_set_currency(self): + sign_in_view = SignInView(self.driver) + sign_in_view.create_user() + profile_view = sign_in_view.profile_button.click() + profile_view.set_currency('Euro (EUR)') + profile_view.get_back_to_home_view() + wallet_view = profile_view.wallet_button.click() + wallet_view.set_up_wallet() + assert '€' in wallet_view.total_amount_text.text + assert 'EUR' == wallet_view.currency_text.text + + @marks.testrail_id(3707) + def test_add_custom_network(self): + sign_in_view = SignInView(self.driver) + sign_in_view.create_user() + profile_view = sign_in_view.profile_button.click() + profile_view.add_custom_network() + sign_in_view.click_account_by_position(0) + sign_in_view.sign_in() + profile_view = sign_in_view.profile_button.click() + profile_view.advanced_button.click() + profile_view.find_text_part('CUSTOM_ROPSTEN') diff --git a/test/appium/tests/atomic/account_management/test_recover.py b/test/appium/tests/atomic/account_management/test_recover.py index 9cac8a662a..031e34c7d9 100644 --- a/test/appium/tests/atomic/account_management/test_recover.py +++ b/test/appium/tests/atomic/account_management/test_recover.py @@ -1,74 +1,42 @@ import pytest -from tests import marks, common_password, group_chat_users -from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase +from tests import marks, common_password +from tests.base_test_case import SingleDeviceTestCase from views.sign_in_view import SignInView -@marks.all -@marks.account -class TestRecoverAccountMultipleDevice(MultipleDeviceTestCase): - - @marks.testrail_id(759) - def test_recover_account(self): - self.create_drivers(2) - device, device_2 = self.drivers[0], self.drivers[1] - sign_in, sign_in_2 = SignInView(device), SignInView(device_2) - username_1 = 'user_1' - username_2 = group_chat_users['A_USER']['username'] - home = sign_in.create_user(username_1) - home_2 = sign_in_2.recover_access(passphrase=group_chat_users['A_USER']['passphrase'], - password=group_chat_users['A_USER']['password']) - public_key = home.get_public_key() - chat_2 = home_2.add_contact(public_key) - message = 'test message' - chat_2.chat_message_input.send_keys(message) - chat_2.send_message_button.click() - device_2.quit() - - profile = home.get_profile_view() - profile.backup_seed_phrase_button.click() - profile.ok_continue_button.click() - seed_phrase = profile.get_seed_phrase() - profile.back_button.click() - profile.advanced_button.click() - profile.debug_mode_toggle.click() - profile.home_button.click() - console_chat = home.get_chat_with_user('Status Console').click() - console_chat.send_faucet_request() - console_chat.get_back_to_home_view() - wallet = home.wallet_button.click() - wallet.set_up_wallet() - address = wallet.get_wallet_address() - wallet.wait_balance_changed_on_wallet_screen() - - device.reset() - sign_in.accept_agreements() - sign_in.recover_access(passphrase=' '.join(seed_phrase.values()), password=common_password) - home.connection_status.wait_for_invisibility_of_element(30) - chat_element = home.get_chat_with_user(username_2) - if chat_element.is_element_displayed(): - chat = chat_element.click() - if not chat.chat_element_by_text(message).is_element_displayed(): - self.errors.append("Message with text '%s' was not received" % message) - chat.get_back_to_home_view() - else: - self.errors.append('Chat with user %s is not recovered' % username_2) - home.wallet_button.click() - wallet.set_up_wallet() - if wallet.get_wallet_address() != address: - self.errors.append('Wallet address is changed after recover') - if wallet.get_eth_value() != 0.1: - self.errors.append('Wallet balance is changed after recover') - if wallet.get_public_key() != public_key: - self.errors.append('Public key is changed after recover') - self.verify_no_errors() - - @marks.all @marks.account class TestRecoverAccountSingleDevice(SingleDeviceTestCase): + @marks.testrail_id(759) + def test_recover_account(self): + sign_in = SignInView(self.driver) + home = sign_in.create_user() + public_key = home.get_public_key() + profile = home.get_profile_view() + profile.backup_seed_phrase_button.click() + profile.ok_continue_button.click() + seed_phrase = profile.get_seed_phrase() + profile.back_button.click() + wallet = profile.wallet_button.click() + wallet.set_up_wallet() + address = wallet.get_wallet_address() + self.driver.reset() + sign_in.accept_agreements() + sign_in.recover_access(passphrase=' '.join(seed_phrase.values()), password=common_password) + home.connection_status.wait_for_invisibility_of_element(30) + home.wallet_button.click() + wallet.set_up_wallet() + address2 = wallet.get_wallet_address() + if address2 != address: + self.errors.append('Wallet address is %s after recovery, but %s is expected' % (address2, address)) + public_key2 = wallet.get_public_key() + if public_key2 != public_key: + self.errors.append('Public key is %s after recovery, but %s is expected' % (public_key2, public_key)) + self.verify_no_errors() + + @marks.skip @marks.testrail_id(845) def test_recover_account_with_incorrect_passphrase(self): sign_in = SignInView(self.driver) diff --git a/test/appium/tests/atomic/account_management/test_wallet.py b/test/appium/tests/atomic/account_management/test_wallet.py index cd39eb621a..3321325f25 100644 --- a/test/appium/tests/atomic/account_management/test_wallet.py +++ b/test/appium/tests/atomic/account_management/test_wallet.py @@ -69,9 +69,9 @@ class TestWallet(SingleDeviceTestCase): transaction_details.copy_transaction_hash_button.click() transaction_details.get_back_to_home_view() wallet_view.home_button.click() - chat_view = home_view.get_chat_with_user('user').click() - chat_view.chat_message_input.paste_text_from_clipboard() - if chat_view.chat_message_input.text != transaction_hash: + public_chat = home_view.join_public_chat('testchat') + public_chat.chat_message_input.paste_text_from_clipboard() + if public_chat.chat_message_input.text != transaction_hash: pytest.fail('Transaction hash was not copied') @marks.testrail_id(3713) 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 10a3dae442..0c7d0631b5 100644 --- a/test/appium/tests/atomic/chats/test_one_to_one.py +++ b/test/appium/tests/atomic/chats/test_one_to_one.py @@ -3,7 +3,7 @@ import string import emoji import pytest from selenium.common.exceptions import TimeoutException -from tests import marks, get_current_time, group_chat_users, transaction_users +from tests import marks, get_current_time, group_chat_users, basic_user from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase from views.sign_in_view import SignInView @@ -366,20 +366,33 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase): class TestChatManagement(SingleDeviceTestCase): @marks.testrail_id(1428) - def test_clear_history(self): - recipient = transaction_users['E_USER'] + def test_clear_history_one_to_one_chat(self): sign_in_view = SignInView(self.driver) - sign_in_view.create_user() - home_view = sign_in_view.get_home_view() - home_view.add_contact(recipient['public_key']) - chat_view = home_view.get_chat_view() - for _ in range(4): + home_view = sign_in_view.create_user() + chat_view = home_view.add_contact(basic_user['public_key']) + for _ in range(2): chat_view.chat_message_input.send_keys('test message') chat_view.send_message_button.click() chat_view.clear_history() if not chat_view.no_messages_in_chat.is_element_present(): pytest.fail('Message history is shown') home_view.relogin() - home_view.get_chat_with_user(recipient['username']).click() + home_view.get_chat_with_user(basic_user['username']).click() if not chat_view.no_messages_in_chat.is_element_present(): pytest.fail('Message history is shown after re-login') + + @marks.testrail_id(3720) + def test_delete_one_to_one_chat_via_delete_button(self): + sign_in = SignInView(self.driver) + home = sign_in.create_user() + chat_view = home.add_contact(basic_user['public_key']) + for _ in range(2): + chat_view.chat_message_input.send_keys('test message') + chat_view.send_message_button.click() + chat_view.delete_chat() + if home.get_chat_with_user(basic_user['username']).is_element_present(10): + self.errors.append("One-to-one' chat is shown, but the chat has been deleted") + home.relogin() + if home.get_chat_with_user(basic_user['username']).is_element_present(10): + self.errors.append("One-to-one' chat is shown after re-login, but the chat has been deleted") + self.verify_no_errors() diff --git a/test/appium/tests/atomic/chats/test_public.py b/test/appium/tests/atomic/chats/test_public.py index afea1dbaf7..ec07b04915 100644 --- a/test/appium/tests/atomic/chats/test_public.py +++ b/test/appium/tests/atomic/chats/test_public.py @@ -1,16 +1,14 @@ -import random -import string - +import pytest from tests import marks from tests.base_test_case import MultipleDeviceTestCase from views.sign_in_view import SignInView @marks.chat -class TestMessagesPublicChat(MultipleDeviceTestCase): +class TestPublicChat(MultipleDeviceTestCase): @marks.testrail_id(1383) - def test_public_chat(self): + def test_public_chat_messaging(self): self.create_drivers(2) device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) username_1, username_2 = 'user_1', 'user_2' @@ -39,3 +37,53 @@ class TestMessagesPublicChat(MultipleDeviceTestCase): self.errors.append("Username '%s' is shown for the sender" % username_1) self.verify_no_errors() + + @marks.testrail_id(3706) + def test_public_chat_clear_history(self): + self.create_drivers(2) + device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) + chat_name = device_1.get_public_chat_name() + for sign_in in device_1, device_2: + home = sign_in.create_user() + home.join_public_chat(chat_name) + chat_1, chat_2 = device_1.get_chat_view(), device_2.get_chat_view() + message_1, message_2, message_3 = 'm1', 'm2', 'm3' + chat_1.chat_message_input.send_keys(message_1) + chat_1.send_message_button.click() + chat_2.element_by_text(message_1).is_element_present() + + chat_2.chat_message_input.send_keys(message_2) + chat_2.send_message_button.click() + chat_1.element_by_text(message_2).is_element_present() + chat_1.chat_options.click() + chat_1.clear_history_button.click() + chat_1.clear_button.click() + chat_2.chat_message_input.send_keys(message_3) + chat_2.send_message_button.click() + chat_1.element_by_text(message_3).is_element_present() + for message in message_1, message_2: + if chat_1.element_starts_with_text(message).is_element_present(): + pytest.fail("Message '%s' is shown, but public chat history has been cleared" % message) + home_1 = chat_1.get_back_to_home_view() + home_1.relogin() + home_1.element_by_text('#' + chat_name).click() + for message in message_1, message_2: + if chat_1.element_starts_with_text(message).is_element_present(): + pytest.fail("Message '%s' is shown after re-login, but public chat history has been cleared" % message) + + @marks.testrail_id(3720) + def test_delete_public_chat_via_delete_button(self): + self.create_drivers(1) + sign_in = SignInView(self.drivers[0]) + home = sign_in.create_user() + chat_name = home.get_public_chat_name() + public_chat = home.join_public_chat(chat_name) + public_chat.chat_message_input.send_keys('takoe') + public_chat.send_message_button.click() + public_chat.delete_chat() + if home.element_by_text(chat_name).is_element_present(5): + self.errors.append("Public chat '%s' is shown, but the chat has been deleted" % chat_name) + home.relogin() + if home.element_by_text(chat_name).is_element_present(5): + self.errors.append("Public chat '%s' is shown after re-login, but the chat has been deleted" % chat_name) + self.verify_no_errors() diff --git a/test/appium/tests/atomic/test_browsing.py b/test/appium/tests/atomic/test_browsing.py new file mode 100644 index 0000000000..0ba5ecf804 --- /dev/null +++ b/test/appium/tests/atomic/test_browsing.py @@ -0,0 +1,63 @@ +import pytest +from tests import transaction_users, marks +from tests.base_test_case import SingleDeviceTestCase +from views.sign_in_view import SignInView + + +@pytest.mark.all +class TestBrowsing(SingleDeviceTestCase): + + @marks.testrail_id(1411) + def test_browse_page_with_non_english_text(self): + sign_in = SignInView(self.driver) + sign_in.create_user() + home_view = sign_in.get_home_view() + start_new_chat = home_view.plus_button.click() + start_new_chat.open_d_app_button.click() + start_new_chat.enter_url_editbox.set_value('www.wikipedia.org') + start_new_chat.confirm() + browsing_view = home_view.get_base_web_view() + browsing_view.wait_for_d_aap_to_load() + wiki_texts = ['Español', '日本語', 'Français', '中文', 'Português'] + for wiki_text in wiki_texts: + browsing_view.find_text_part(wiki_text, 15) + + @marks.testrail_id(1412) + def test_open_invalid_link(self): + sign_in = SignInView(self.driver) + sign_in.create_user() + home_view = sign_in.get_home_view() + start_new_chat = home_view.plus_button.click() + start_new_chat.open_d_app_button.click() + start_new_chat.enter_url_editbox.set_value('invalid.takoe') + start_new_chat.confirm() + browsing_view = home_view.get_base_web_view() + browsing_view.find_text_part('Unable to load page') + + @marks.testrail_id(3705) + def test_connection_is_not_secure(self): + sign_in = SignInView(self.driver) + sign_in.create_user() + home_view = sign_in.get_home_view() + start_new_chat = home_view.plus_button.click() + start_new_chat.open_d_app_button.click() + start_new_chat.enter_url_editbox.set_value('google.com') + start_new_chat.confirm() + browsing_view = home_view.get_base_web_view() + browsing_view.find_full_text("Connection is not proven secure. Make sure you trust this site before signing " + "transactions or entering personal data.") + + @marks.testrail_id(3731) + def test_swipe_to_delete_browser_entry(self): + sign_in = SignInView(self.driver) + home_view = sign_in.create_user() + start_new_chat = home_view.plus_button.click() + start_new_chat.open_d_app_button.click() + start_new_chat.enter_url_editbox.set_value('google.com') + start_new_chat.confirm() + browsing_view = home_view.get_base_web_view() + browsing_view.browser_cross_icon.click() + home_view.swipe_and_delete_chat('Browser') + home_view.relogin() + if home_view.get_chat_with_user('Browser').is_element_present(20): + pytest.fail('The browser entry is present after re-login') diff --git a/test/appium/views/base_element.py b/test/appium/views/base_element.py index 9248e2d3d4..ce5c6a912b 100644 --- a/test/appium/views/base_element.py +++ b/test/appium/views/base_element.py @@ -151,7 +151,7 @@ class BaseElement(object): location, size = element.location, element.size x, y = location['x'], location['y'] width, height = size['width'], size['height'] - self.driver.swipe(start_x=x + width / 2, start_y=y + height / 2, end_x=x, end_y=y + height / 2) + self.driver.swipe(start_x=x + width * 2, start_y=y + height / 2, end_x=x, end_y=y + height / 2) def long_press_element(self): element = self.find_element() diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index 73e2335141..f9b13bd62b 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -280,7 +280,7 @@ class BaseView(object): element.locator = element.Locator.text_selector(text) return element - def element_by_text_part(self, text, element_type='base'): + def element_by_text_part(self, text, element_type='button'): info("Looking for an element by text part: '%s'" % text) element = self.element_types[element_type](self.driver) element.locator = element.Locator.text_part_selector(text) @@ -298,6 +298,12 @@ class BaseView(object): element.locator = element.Locator.xpath_selector("//*[starts-with(@text,'%s')]" % text) return element.wait_for_element(wait_time) + def element_by_accessibility_id(self, accessibility_id, element_type='button'): + info("Looking for an element by text: '%s'" % accessibility_id) + element = self.element_types[element_type](self.driver) + element.locator = element.Locator.accessibility_id(accessibility_id) + return element + def swipe_down(self): self.driver.swipe(500, 500, 500, 1000) @@ -358,6 +364,7 @@ class BaseView(object): self.back_button.click() except (NoSuchElementException, TimeoutException): counter += 1 + return self.get_home_view() def relogin(self, password=common_password): self.get_back_to_home_view() @@ -377,3 +384,10 @@ class BaseView(object): public_key = profile_view.public_key_text.text profile_view.cross_icon.click() return public_key + + def share_via_messenger(self): + self.element_by_text('Messenger').click() + self.element_by_text('NEW MESSAGE').click() + self.send_as_keyevent('+0') + self.confirm() + self.element_by_accessibility_id('Send Message').click() diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index 22ee73d250..1ac3bf3ae6 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -302,14 +302,10 @@ class ChatView(BaseView): self.send_message_button.click_until_presence_of_element(send_transaction.sign_transaction_button) send_transaction.sign_transaction(sender_password) - def delete_chat(self, chat_name: str, errors: list): + def delete_chat(self): self.chat_options.click() self.delete_chat_button.click() self.delete_button.click() - from views.home_view import HomeView - if not HomeView(self.driver).plus_button.is_element_present() or \ - self.element_by_text(chat_name).is_element_present(): - errors.append('Chat was not deleted') def clear_history(self): self.chat_options.click() diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index a3a8da4508..c34a0fffeb 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -231,13 +231,49 @@ class SelectFromGalleryButton(BaseButton): self.locator = self.Locator.xpath_selector("//*[@text='Select from gallery']") +class MainCurrencyButton(BaseButton): + + def __init__(self, driver): + super(MainCurrencyButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id("currency-button") + + +class NetworkPlusButton(BaseButton): + + def __init__(self, driver): + super(NetworkPlusButton, self).__init__(driver) + self.locator = self.Locator.xpath_selector("(//android.view.ViewGroup[@content-desc='icon'])[2]") + + +class RopstenChainButton(BaseButton): + + def __init__(self, driver): + super(RopstenChainButton, self).__init__(driver) + self.locator = self.Locator.xpath_selector( + "//*[contains(@text,'Ropsten test network')]/following-sibling::android.widget.CheckBox[1]") + + +class CustomNetworkName(BaseEditBox): + + def __init__(self, driver): + super(CustomNetworkName, self).__init__(driver) + self.locator = self.Locator.xpath_selector("//*[@text='Name']/following-sibling::*[1]/android.widget.EditText") + + +class CustomNetworkURL(BaseEditBox): + + def __init__(self, driver): + super(CustomNetworkURL, self).__init__(driver) + self.locator = self.Locator.xpath_selector( + "//*[@text='RPC URL']/following-sibling::*[1]/android.widget.EditText") + + class ProfileView(BaseView): def __init__(self, driver): super(ProfileView, self).__init__(driver) self.driver = driver - # old design self.options_button = OptionsButton(self.driver) self.username_input = OptionsButton.UsernameInput(self.driver) self.user_status_box = OptionsButton.UserStatusBox(self.driver) @@ -246,12 +282,16 @@ class ProfileView(BaseView): self.profile_address_text = ProfileAddressText(self.driver) self.network_settings_button = NetworkSettingsButton(self.driver) + self.network_plus_button = NetworkPlusButton(self.driver) + self.ropsten_chain_button = RopstenChainButton(self.driver) + self.custom_network_url = CustomNetworkURL(self.driver) + self.custom_network_name = CustomNetworkName(self.driver) self.connect_button = NetworkSettingsButton.ConnectButton(self.driver) self.logout_button = LogoutButton(self.driver) self.logout_dialog = LogoutDialog(self.driver) self.confirm_logout_button = ConfirmLogoutButton(self.driver) - # new design + self.main_currency_button = MainCurrencyButton(self.driver) self.username_text = UserNameText(self.driver) self.share_my_contact_key_button = ShareMyContactKeyButton(self.driver) @@ -284,6 +324,20 @@ class ProfileView(BaseView): from views.sign_in_view import SignInView return SignInView(self.driver) + def add_custom_network(self): + self.advanced_button.click() + self.debug_mode_toggle.click() + self.network_settings_button.scroll_to_element() + self.network_settings_button.click() + self.network_plus_button.click_until_presence_of_element(self.ropsten_chain_button) + self.ropsten_chain_button.click() + self.custom_network_url.send_keys('https://ropsten.infura.io/iMko0kJNQUdhbCSaJcox') + self.custom_network_name.send_keys('custom_ropsten') + self.save_button.click() + self.element_by_text_part('custom_ropsten').click_until_presence_of_element(self.connect_button) + self.connect_button.click() + return self.get_sign_in_view() + def get_address(self): profile_view = self.profile_button.click() return profile_view.profile_address_text.text @@ -324,3 +378,9 @@ class ProfileView(BaseView): self.logout_button.click() return self.logout_dialog.logout_button.click() + def set_currency(self, desired_currency='Euro (EUR)'): + self.main_currency_button.click() + desired_currency = self.element_by_text(desired_currency) + desired_currency.scroll_to_element() + desired_currency.click() + diff --git a/test/appium/views/start_new_chat_view.py b/test/appium/views/start_new_chat_view.py index 0c26f90f0c..0f0d886824 100644 --- a/test/appium/views/start_new_chat_view.py +++ b/test/appium/views/start_new_chat_view.py @@ -58,6 +58,12 @@ class UsernameCheckbox(BaseButton): self.locator = self.Locator.xpath_selector("//*[@text='%s']/../../android.widget.CheckBox" % username) +class InviteFriendsButton(BaseButton): + def __init__(self, driver): + super(InviteFriendsButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id('invite-friends-button') + + class StartNewChatView(ContactsView): def __init__(self, driver): super(StartNewChatView, self).__init__(driver) @@ -68,6 +74,7 @@ class StartNewChatView(ContactsView): self.open_d_app_button = OpenDAppButton(self.driver) self.open_button = OpenButton(self.driver) + self.invite_friends_button = InviteFriendsButton(self.driver) self.chat_name_editbox = ChatNameEditBox(self.driver) self.enter_url_editbox = EnterUrlEditbox(self.driver) diff --git a/test/appium/views/wallet_view.py b/test/appium/views/wallet_view.py index a021d93167..6a3c3501ac 100644 --- a/test/appium/views/wallet_view.py +++ b/test/appium/views/wallet_view.py @@ -144,6 +144,20 @@ class AssetCheckBox(BaseButton): self.locator = self.Locator.xpath_selector("//*[@text='%s']/../android.widget.CheckBox" % asset_name) +class TotalAmountText(BaseText): + + def __init__(self, driver): + super(TotalAmountText, self).__init__(driver) + self.locator = self.Locator.accessibility_id('total-amount-value-text') + + +class CurrencyText(BaseText): + + def __init__(self, driver): + super(CurrencyText, self).__init__(driver) + self.locator = self.Locator.accessibility_id('total-amount-currency-text') + + class WalletView(BaseView): def __init__(self, driver): super(WalletView, self).__init__(driver) @@ -169,6 +183,9 @@ class WalletView(BaseView): self.set_up_button = SetUpButton(self.driver) self.sign_in_phrase = SignInPhraseText(self.driver) + self.total_amount_text = TotalAmountText(self.driver) + self.currency_text = CurrencyText(self.driver) + def get_usd_total_value(self): import re return float(re.sub('[$,]', '', self.usd_total_value.text)) diff --git a/test/appium/views/web_views/base_web_view.py b/test/appium/views/web_views/base_web_view.py index b58573cbfa..3068a67373 100644 --- a/test/appium/views/web_views/base_web_view.py +++ b/test/appium/views/web_views/base_web_view.py @@ -46,6 +46,17 @@ class AlwaysButton(BaseButton): self.locator = self.Locator.text_part_selector('ALWAYS') +class BrowserCrossIcon(BaseButton): + + def __init__(self, driver): + super(BrowserCrossIcon, self).__init__(driver) + self.locator = self.Locator.xpath_selector('(//android.view.ViewGroup[@content-desc="icon"])[1]') + + def navigate(self): + from views.home_view import HomeView + return HomeView(self.driver) + + class BaseWebView(BaseView): def __init__(self, driver): @@ -61,6 +72,7 @@ class BaseWebView(BaseView): self.web_view_browser = WebViewBrowserButton(self.driver) self.always_button = AlwaysButton(self.driver) + self.browser_cross_icon = BrowserCrossIcon(self.driver) def wait_for_d_aap_to_load(self, wait_time=35): counter = 0