diff --git a/test/appium/tests/atomic/account_management/test_wallet_management.py b/test/appium/tests/atomic/account_management/test_wallet_management.py index 482f090de5..416218b411 100644 --- a/test/appium/tests/atomic/account_management/test_wallet_management.py +++ b/test/appium/tests/atomic/account_management/test_wallet_management.py @@ -490,3 +490,57 @@ class TestWalletManagement(SingleDeviceTestCase): self.errors.append('ENS address "stateofus.eth" without domain is not resolved as recipient') self.errors.verify_no_errors() + + @marks.testrail_id(6269) + @marks.medium + def test_search_asset_and_currency(self): + sign_in = SignInView(self.driver) + home = sign_in.create_user() + profile = home.profile_button.click() + profile.switch_network('Mainnet with upstream RPC') + search_list_assets = { + 'ad': ['AdEx', 'Open Trading Network', 'TrueCAD'], + 'zs': ['ZSC'] + } + wallet = home.wallet_button.click() + + home.just_fyi('Searching for asset by name and symbol') + wallet.set_up_wallet() + wallet.multiaccount_more_options.click() + wallet.manage_assets_button.click() + for keyword in search_list_assets: + home.search_by_keyword(keyword) + if keyword == 'ad': + search_elements = wallet.all_assets_full_names.find_elements() + else: + search_elements = wallet.all_assets_symbols.find_elements() + if not search_elements: + self.errors.append('No search results after searching by %s keyword' % keyword) + search_results = [element.text for element in search_elements] + if search_results != search_list_assets[keyword]: + self.errors.append("'%s' is shown on the home screen after searching by '%s' keyword" % + (', '.join(search_list_assets[keyword]), keyword)) + home.cancel_button.click() + wallet.back_button.click() + + home.just_fyi('Searching for currency') + search_list_currencies = { + 'aF': ['Afghanistan Afghan (AFN)', 'South Africa Rand (ZAR)'], + 'bolívi': ['Bolivia Bolíviano (BOB)'] + } + wallet.multiaccount_more_options.click_until_presence_of_element(wallet.set_currency_button) + wallet.set_currency_button.click() + for keyword in search_list_currencies: + home.search_by_keyword(keyword) + search_elements = wallet.currency_item_text.find_elements() + if not search_elements: + self.errors.append('No search results after searching by %s keyword' % keyword) + search_results = [element.text for element in search_elements] + from pprint import pprint + pprint(search_results) + if search_results != search_list_assets[keyword]: + self.errors.append("'%s' is shown on the home screen after searching by '%s' keyword" % + (', '.join(search_list_assets[keyword]), keyword)) + home.cancel_button.click() + + self.errors.verify_no_errors() diff --git a/test/appium/tests/atomic/chats/test_chats_management.py b/test/appium/tests/atomic/chats/test_chats_management.py index e017dd114e..bd961f665c 100644 --- a/test/appium/tests/atomic/chats/test_chats_management.py +++ b/test/appium/tests/atomic/chats/test_chats_management.py @@ -225,9 +225,7 @@ class TestChatManagement(SingleDeviceTestCase): home.just_fyi('Can search for public chat name, ens name, username') home.swipe_down() for keyword in search_list: - home.just_fyi('Search for %s' %keyword) - home.search_chat_input.click() - home.search_chat_input.send_keys(keyword) + home.search_by_keyword(keyword) search_results = home.chat_name_text.find_elements() if not search_results: self.errors.append('No search results after searching by %s keyword' % keyword) @@ -321,6 +319,47 @@ class TestChatManagement(SingleDeviceTestCase): self.errors.verify_no_errors() + @marks.testrail_id(5498) + @marks.medium + def test_share_user_profile_url_public_chat(self): + sign_in = SignInView(self.driver) + home = sign_in.create_user() + + sign_in.just_fyi('Join to one-to-one chat and share link to other user profile via messenger') + chat_view = home.add_contact(dummy_user["public_key"]) + chat_view.chat_options.click() + chat_view.view_profile_button.click_until_presence_of_element(chat_view.remove_from_contacts) + chat_view.profile_details.click() + chat_view.share_button.click() + chat_view.share_via_messenger() + if not chat_view.element_by_text_part('https://join.status.im/u/%s' % dummy_user["public_key"]).is_element_present(): + self.errors.append("Can't share public key of contact") + for _ in range(2): + chat_view.click_system_back_button() + + sign_in.just_fyi('Join to public chat and share link to it via messenger') + chat_view.get_back_to_home_view() + public_chat_name = 'pubchat' + public_chat = home.join_public_chat(public_chat_name) + public_chat.chat_options.click() + public_chat.share_chat_button.click() + public_chat.share_via_messenger() + if not chat_view.element_by_text_part('https://join.status.im/%s' % public_chat_name).is_element_present(): + self.errors.append("Can't share link to public chat") + for _ in range(2): + chat_view.click_system_back_button() + chat_view.get_back_to_home_view() + + sign_in.just_fyi('Open URL and share link to it via messenger') + daap_view = home.dapp_tab_button.click() + browsing_view = daap_view.open_url('dap.ps') + browsing_view.share_url_button.click() + browsing_view.share_via_messenger() + if not chat_view.element_by_text_part('https://join.status.im/b/https://dap.ps').is_element_present(): + self.errors.append("Can't share link to URL") + + self.errors.verify_no_errors() + @marks.chat class TestChatManagementMultipleDevice(MultipleDeviceTestCase): 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 7b71ae661b..aab5bb1ddc 100644 --- a/test/appium/tests/atomic/chats/test_one_to_one.py +++ b/test/appium/tests/atomic/chats/test_one_to_one.py @@ -110,7 +110,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): @marks.testrail_id(5315) @marks.high - def test_send_message_to_newly_added_contact(self): + def test_send_non_english_message_to_newly_added_contact(self): self.create_drivers(2) device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) @@ -129,15 +129,16 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): device_2_home.home_button.click() device_1_chat = device_1_home.add_contact(device_2_public_key) - message = 'hello' - device_1_chat.chat_message_input.send_keys(message) - device_1_chat.send_message_button.click() + messages = ['hello', '¿Cómo estás tu año?', 'ё, доброго вечерочка', '® æ ç ♥'] + for message in messages: + device_1_chat.send_message(message) chat_element = device_2_home.get_chat(default_username_1) chat_element.wait_for_visibility_of_element() device_2_chat = chat_element.click() - if not device_2_chat.chat_element_by_text(message).is_element_displayed(): - self.errors.append("Message with test '%s' was not received" % message) + for message in messages: + if not device_2_chat.chat_element_by_text(message).is_element_displayed(): + self.errors.append("Message with test '%s' was not received" % message) if not device_2_chat.add_to_contacts.is_element_displayed(): self.errors.append('Add to contacts button is not shown') if device_2_chat.user_name_text.text != default_username_1: @@ -151,6 +152,63 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): # self.errors.append("Updated profile picture is not shown in one-to-one chat") self.errors.verify_no_errors() + @marks.testrail_id(5782) + @marks.critical + def test_install_pack_and_send_sticker(self): + self.create_drivers(2) + device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) + device_1_home, device_2_home = device_1.create_user(), device_2.create_user() + + device_1_home.just_fyi('join public chat and check that stickers are not available on Ropsten') + chat_name = device_1_home.get_random_chat_name() + device_1_home.join_public_chat(chat_name) + device_1_public_chat = device_1_home.get_chat_view() + if device_1_public_chat.show_stickers_button.is_element_displayed(): + self.errors.append('Sticker button is shown while on Ropsten') + + device_1_home.just_fyi('switch to mainnet') + device_1_public_chat.get_back_to_home_view() + device_1_profile, device_2_profile = device_1_home.profile_button.click(), device_2_home.profile_button.click() + device_2_public_key = device_2_profile.get_public_key_and_username() + device_1_public_key, device_1_username = device_1_profile.get_public_key_and_username(return_username=True) + + for device in device_2_profile, device_1_profile: + device.switch_network('Mainnet with upstream RPC') + device_1_home.get_chat('#' + chat_name).click() + + device_1_home.just_fyi('install free sticker pack and use it in public chat') + device_1_public_chat.show_stickers_button.click() + device_1_public_chat.get_stickers.click() + device_1_public_chat.install_sticker_pack_by_name('Status Cat') + device_1_public_chat.back_button.click() + time.sleep(2) + device_1_public_chat.swipe_left() + device_1_public_chat.sticker_icon.click() + if not device_1_public_chat.chat_item.is_element_displayed(): + self.errors.append('Sticker was not sent') + device_1_public_chat.swipe_right() + if not device_1_public_chat.sticker_icon.is_element_displayed(): + self.errors.append('Sticker is not shown in recently used list') + device_1_public_chat.get_back_to_home_view() + + device_1_home.just_fyi('send stickers in 1-1 chat from Recent') + device_1_one_to_one_chat = device_1_home.add_contact(device_2_public_key) + device_1_one_to_one_chat.show_stickers_button.click() + device_1_one_to_one_chat.sticker_icon.click() + if not device_1_one_to_one_chat.chat_item.is_element_displayed(): + self.errors.append('Sticker was not sent from Recent') + + device_2_home.just_fyi('check that can install stickers by tapping on sticker message') + device2_one_to_one_chat = device_2_home.get_chat(device_1_username).click() + device2_one_to_one_chat.chat_item.click() + if not device2_one_to_one_chat.element_by_text_part('Status Cat').is_element_displayed(): + self.errors.append('Stickerpack is not available for installation after tapping on sticker message') + device2_one_to_one_chat.element_by_text_part('Free').click() + if device2_one_to_one_chat.element_by_text_part('Free').is_element_displayed(): + self.errors.append('Stickerpack was not installed') + + self.errors.verify_no_errors() + @marks.testrail_id(5316) @marks.critical def test_add_to_contacts(self): @@ -493,40 +551,6 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase): self.errors.verify_no_errors() - @marks.testrail_id(5782) - @marks.critical - def test_install_pack_and_send_sticker(self): - sign_in = SignInView(self.driver) - home = sign_in.create_user() - - sign_in.just_fyi('join public chat and check that stickers are not available on Ropsten') - chat_name = home.get_random_chat_name() - home.join_public_chat(chat_name) - chat = sign_in.get_chat_view() - if chat.show_stickers_button.is_element_displayed(): - self.errors.append('Sticker button is shown while on Ropsten') - - sign_in.just_fyi('switch to mainnet') - chat.get_back_to_home_view() - profile = home.profile_button.click() - profile.switch_network('Mainnet with upstream RPC') - home.get_chat('#' + chat_name).click() - - sign_in.just_fyi('install free sticker pack and use it in public chat') - chat.show_stickers_button.click() - chat.get_stickers.click() - chat.install_sticker_pack_by_name('Status Cat') - chat.back_button.click() - time.sleep(2) - chat.swipe_left() - chat.sticker_icon.click() - if not chat.chat_item.is_element_displayed(): - self.errors.append('Sticker was not sent') - chat.swipe_right() - if not chat.sticker_icon.is_element_displayed(): - self.errors.append('Sticker is not shown in recently used list') - self.errors.verify_no_errors() - @marks.testrail_id(5783) @marks.critical def test_can_use_purchased_stickers_on_recovered_account(self): diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index 4d5c32c817..de8ef866cb 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -125,6 +125,12 @@ class HomeButton(TabButton): self.click_until_presence_of_element(PlusButton(self.driver)) return self.navigate() +class ShareButton(BaseButton): + + def __init__(self, driver): + super(ShareButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id('share-my-contact-code-button') + class DappTabButton(TabButton): def __init__(self, driver): @@ -342,6 +348,12 @@ class AirplaneModeButton(BaseButton): self.driver.press_keycode(4) +class SearchChatInput(BaseEditBox): + def __init__(self, driver): + super().__init__(driver) + self.locator = self.Locator.text_selector('Search') + + class BaseView(object): def __init__(self, driver): self.driver = driver @@ -376,7 +388,8 @@ class BaseView(object): self.cross_icon_iside_welcome_screen_button = CrossIconInWelcomeScreen(self.driver) self.status_in_background_button = StatusInBackgroundButton(self.driver) self.cancel_button = CancelButton(self.driver) - + self.search_chat_input = SearchChatInput(self.driver) + self.share_button = ShareButton(self.driver) # external browser self.search_in_google_edit_box = SearchEditBox(self.driver) @@ -697,6 +710,11 @@ class BaseView(object): self.driver.install_app(pytest_config_global['apk_upgrade'], replace=True) self.driver.info('Upgrading apk to apk_upgrade') + def search_by_keyword(self, keyword): + self.driver.info('Search for %s' % keyword) + self.search_chat_input.click() + self.search_chat_input.send_keys(keyword) + # Method-helper def write_page_source_to_file(self, full_path_to_file): string_source = self.driver.page_source diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index 8e7e9115ce..c977a02deb 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -122,6 +122,18 @@ class ReplyMessageButton(BaseButton): self.locator = self.Locator.text_selector("Reply") +class ProfileDetailsOtherUser(BaseButton): + def __init__(self, driver): + super(ProfileDetailsOtherUser, self).__init__(driver) + self.locator = self.Locator.accessibility_id('profile-public-key') + + +class ShareChatButton(BaseButton): + def __init__(self, driver): + super(ShareChatButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id('share-chat-button') + + class GroupInfoButton(BaseButton): def __init__(self, driver): @@ -541,6 +553,7 @@ class ChatView(BaseView): self.delete_chat_button = DeleteChatButton(self.driver) self.clear_history_button = ClearHistoryButton(self.driver) self.reply_message_button = ReplyMessageButton(self.driver) + self.share_chat_button = ShareChatButton(self.driver) self.clear_button = ClearButton(self.driver) self.block_contact_button = BlockContactButton(self.driver) self.unblock_contact_button = UnblockContactButton(self.driver) @@ -571,6 +584,7 @@ class ChatView(BaseView): self.profile_address_text = ProfileAddressText(self.driver) self.profile_block_contact = ProfileBlockContactButton(self.driver) self.profile_add_to_contacts = ProfileAddToContactsButton(self.driver) + self.profile_details = ProfileDetailsOtherUser(self.driver) def delete_chat(self): self.chat_options.click() diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index bcf38374df..0d9be45d61 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -161,12 +161,6 @@ class ChatUrlText(BaseText): self.locator = self.Locator.accessibility_id('chat-url-text') -class SearchChatInput(BaseEditBox): - def __init__(self, driver): - super().__init__(driver) - self.locator = self.Locator.text_selector('Search') - - class HomeView(BaseView): def __init__(self, driver): super(HomeView, self).__init__(driver) @@ -174,7 +168,6 @@ class HomeView(BaseView): self.plus_button = PlusButton(self.driver) self.chat_name_text = ChatNameText(self.driver) self.chat_url_text = ChatUrlText(self.driver) - self.search_chat_input = SearchChatInput(self.driver) self.start_new_chat_button = StartNewChatButton(self.driver) self.new_group_chat_button = NewGroupChatButton(self.driver) diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index 62e82fea8d..e9fc173b94 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -133,6 +133,12 @@ class ProfilePictureElement(BaseElement): self.locator = self.Locator.accessibility_id('chat-icon') +class ProfileDetailsOtherUser(BaseElement): + def __init__(self, driver): + super(ProfileDetailsOtherUser, self).__init__(driver) + self.locator = self.Locator.accessibility_id('profile-public-key') + + class EditPictureButton(BaseButton): def __init__(self, driver): @@ -155,12 +161,6 @@ class CrossIcon(BaseButton): self.locator = self.Locator.accessibility_id('done-button') -class ShareButton(BaseButton): - - def __init__(self, driver): - super(ShareButton, self).__init__(driver) - self.locator = self.Locator.accessibility_id('share-my-contact-code-button') - class ENSUsernameInShareChatKeyPopup(BaseText): @@ -187,6 +187,7 @@ class LogLevelSetting(BaseButton): super(LogLevelSetting, self).__init__(driver) self.locator = self.Locator.xpath_selector('//*[@content-desc="log-level-settings-button"]/android.widget.TextView[2]') + class BackupRecoveryPhraseButton(BaseButton): def __init__(self, driver): @@ -588,7 +589,6 @@ class ProfileView(BaseView): self.remove_picture_button = RemovePictureButton(self.driver) self.confirm_edit_button = ConfirmEditButton(self.driver) self.cross_icon = CrossIcon(self.driver) - self.share_button = ShareButton(self.driver) self.advanced_button = AdvancedButton(self.driver) self.log_level_setting = LogLevelSetting(self.driver) self.debug_mode_toggle = DebugModeToggle(self.driver) diff --git a/test/appium/views/wallet_view.py b/test/appium/views/wallet_view.py index b78dafaaa9..5492704d69 100644 --- a/test/appium/views/wallet_view.py +++ b/test/appium/views/wallet_view.py @@ -39,17 +39,36 @@ class ScanQRButton(BaseButton): super(ScanQRButton, self).__init__(driver) self.locator = self.Locator.accessibility_id("accounts-qr-code") + class EnterQRcodeEditBox(BaseEditBox): def __init__(self, driver): super(EnterQRcodeEditBox, self).__init__(driver) self.locator = self.Locator.text_selector('Type a message...') + class AssetText(BaseText): def __init__(self, driver, asset): super(AssetText, self).__init__(driver) self.locator = self.Locator.xpath_selector("//*[@text='%s']/preceding-sibling::*[1]" % asset) +class AssetFullNameInAssets(BaseText): + def __init__(self, driver): + super(AssetFullNameInAssets, self).__init__(driver) + self.locator = self.Locator.xpath_selector('//*[@content-desc="checkbox"]/../android.widget.TextView[1]') + + +class AssetSymbolInAssets(BaseText): + def __init__(self, driver): + super(AssetSymbolInAssets, self).__init__(driver) + self.locator = self.Locator.xpath_selector('//*[@content-desc="checkbox"]/../android.widget.TextView[2]') + +class CurrencyItemText(BaseText): + def __init__(self, driver): + super(CurrencyItemText, self).__init__(driver) + self.locator = self.Locator.xpath_selector('//*[@content-desc="currency-item"]//android.widget.TextView') + + class UsdTotalValueText(BaseText): def __init__(self, driver): super(UsdTotalValueText, self).__init__(driver) @@ -380,6 +399,10 @@ class WalletView(BaseView): self.options_button = OptionsButton(self.driver) self.manage_assets_button = ManageAssetsButton(self.driver) self.stt_check_box = STTCheckBox(self.driver) + self.all_assets_full_names = AssetFullNameInAssets(self.driver) + self.all_assets_symbols = AssetSymbolInAssets(self.driver) + self.currency_item_text = CurrencyItemText(self.driver) + self.qr_code_image = QRCodeImage(self.driver) self.address_text = AddressText(self.driver) @@ -396,7 +419,6 @@ class WalletView(BaseView): self.add_custom_token_button = AddCustomTokenButton(self.driver) # elements for multiaccount - self.multiaccount_more_options = MultiaccountMoreOptions(self.driver) self.accounts_status_account = AccountElementButton(self.driver, account_name="Status account") self.collectibles_button = CollectiblesButton(self.driver) diff --git a/test/appium/views/web_views/base_web_view.py b/test/appium/views/web_views/base_web_view.py index 90542cb329..8006249ed4 100644 --- a/test/appium/views/web_views/base_web_view.py +++ b/test/appium/views/web_views/base_web_view.py @@ -75,6 +75,12 @@ class PolicySummary(BaseElement): self.locator = self.Locator.xpath_selector('//*[@content-desc="Policy summary"] | //*[@text="Policy summary"]') +class ShareUrlButton(BaseButton): + def __init__(self, driver): + super(ShareUrlButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id('modal-share-link-button') + + class BaseWebView(BaseView): def __init__(self, driver): @@ -93,6 +99,7 @@ class BaseWebView(BaseView): self.web_view_menu_button = WebViewMenuButton(self.driver) self.always_button = AlwaysButton(self.driver) self.browser_refresh_page_button = BrowserRefreshPageButton(self.driver) + self.share_url_button = ShareUrlButton(self.driver) def wait_for_d_aap_to_load(self, wait_time=35): counter = 0