diff --git a/test/appium/tests/atomic/chats/test_chats_management.py b/test/appium/tests/atomic/chats/test_chats_management.py index 2e922e6ffd..f26abaad40 100644 --- a/test/appium/tests/atomic/chats/test_chats_management.py +++ b/test/appium/tests/atomic/chats/test_chats_management.py @@ -488,13 +488,13 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase): @marks.testrail_id(5763) @marks.medium - def test_block_user_from_one_to_one_header(self): + def test_block_user_from_one_to_one_header_check_push_notification_service(self): self.create_drivers(2) device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) message_before_block_1 = "Before block from %s" % device_1.driver.number message_before_block_2 = "Before block from %s" % device_2.driver.number message_after_block_2 = "After block from %s" % device_2.driver.number - home_1, home_2 = device_1.create_user(), device_2.create_user() + home_1, home_2 = device_1.create_user(enable_notifications=True), device_2.create_user() profile_1 = home_1.profile_button.click() device_2_public_key = home_2.get_public_key_and_username() home_2.get_back_to_home_view() @@ -532,11 +532,12 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase): device_1.just_fyi('no 1-1, messages from blocked user are hidden in public chat') if home_1.get_chat(basic_user['username']).is_element_displayed(): home_1.driver.fail("Chat with blocked user '%s' is not deleted" % device_2.driver.number) - public_chat_after_block = home_1.join_public_chat(chat_name) - if public_chat_after_block.chat_element_by_text(message_before_block_2).is_element_displayed(): + public_chat_after_block_1 = home_1.join_public_chat(chat_name) + if public_chat_after_block_1.chat_element_by_text(message_before_block_2).is_element_displayed(): self.errors.append( "Messages from blocked user '%s' are not cleared in public chat '%s'" % (device_2.driver.number, chat_name)) + device_1.click_system_home_button() device_2.just_fyi('send messages to 1-1 and public chat') for _ in range(2): @@ -550,13 +551,19 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase): chat_public_2.chat_message_input.send_keys(message_after_block_2) chat_public_2.send_message_button.click() - device_1.just_fyi("check that new messages didn't arrived from blocked user") - if public_chat_after_block.chat_element_by_text(message_after_block_2).is_element_displayed(): + device_1.just_fyi("check that new messages and push notifications don't arrive from blocked user") + device_1.open_notification_bar() + if device_1.element_by_text_part(message_after_block_2).is_element_displayed(): + self.errors.append("Push notification is received from blocked user") + device_1.element_by_text_part("Background notification service").click() + + if public_chat_after_block_1.chat_element_by_text(message_after_block_2).is_element_displayed(): self.errors.append("Message from blocked user '%s' is received" % device_2.driver.number) - public_chat_after_block.get_back_to_home_view() + public_chat_after_block_1.get_back_to_home_view() if home_1.get_chat(basic_user['username']).is_element_displayed(): device_2.driver.fail("Chat with blocked user is reappeared after receiving new messages") - self.drivers[0].close_app() + device_1.open_notification_bar() + home_1.stop_status_service_button.click() device_2.just_fyi("send messages when device 1 is offline") for _ in range(2): @@ -569,6 +576,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase): chat_2.send_message_button.click() device_1.just_fyi("reopen app and check that messages from blocked user are not fetched") + device_1.click_system_home_button() self.drivers[0].launch_app() device_1.accept_agreements() device_1.sign_in() @@ -577,10 +585,16 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase): home_1.join_public_chat(chat_name) home_1.get_chat_view() if chat_public_1.chat_element_by_text(message_after_block_2).is_element_displayed(): - self.errors.append( - "Message from blocked user '%s' is received after fetching new messages from offline" + self.errors.append("Message from blocked user '%s' is received after fetching new messages from offline" % device_2.driver.number) + device_1.just_fyi("check that PNs are still enabled in profile after closing 'background notification centre' " + "message and relogin") + home_1.profile_button.click() + profile_1.push_notification_toggle.scroll_to_element() + if not profile_1.push_notification_toggle.is_element_image_equals_template('enabled_toggle.png'): + self.errors.append('Toggle is not enabled') + self.errors.verify_no_errors() @marks.testrail_id(6233) diff --git a/test/appium/tests/atomic/chats/test_keycard_commands.py b/test/appium/tests/atomic/chats/test_keycard_commands.py index acbffdbd7b..224f74afa2 100644 --- a/test/appium/tests/atomic/chats/test_keycard_commands.py +++ b/test/appium/tests/atomic/chats/test_keycard_commands.py @@ -96,7 +96,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase): self.errors.verify_no_errors() @marks.testrail_id(6294) - @marks.critical + @marks.medium def test_keycard_request_and_receive_stt_in_1_1_chat_offline(self): sender = transaction_senders['D'] self.create_drivers(2) @@ -161,13 +161,9 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase): self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, token=True) chat_2.toggle_airplane_mode() chat_2.connection_status.wait_for_invisibility_of_element(60) - if chat_2_sender_message.transaction_status.text != 'Confirmed': + if not chat_2.element_by_text('Confirmed').is_element_displayed(30): self.errors.append('Wrong state is shown for outgoing transaction: "Confirmed" is expected, in fact' ' %s ' % chat_2_sender_message.transaction_status.text) - try: - self.network_api.find_transaction_by_unique_amount(recipient_address[2:], amount, token=True) - except Failed as e: - self.errors.append(e.msg) self.errors.verify_no_errors() 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 5dd158cf4c..8fc86f3d97 100644 --- a/test/appium/tests/atomic/chats/test_one_to_one.py +++ b/test/appium/tests/atomic/chats/test_one_to_one.py @@ -84,10 +84,8 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): device_1.driver.fail("Failed to open chat view after tap on PN") device_1.just_fyi("Checks there are no PN after message was seen") - device_1.click_system_home_button() - device_2.click_system_home_button() - device_1.open_notification_bar() - device_2.open_notification_bar() + [device.click_system_home_button() for device in (device_1, device_2)] + [device.open_notification_bar() for device in (device_1, device_2)] if (device_2.element_by_text_part(message).is_element_displayed() or device_1.element_by_text_part(emoji_unicode).is_element_displayed()): self.errors.append("PN are keep staying after message was seen by user") diff --git a/test/appium/tests/atomic/transactions/test_keycard_wallet.py b/test/appium/tests/atomic/transactions/test_keycard_wallet.py index 6f29c6d6b7..231176c666 100644 --- a/test/appium/tests/atomic/transactions/test_keycard_wallet.py +++ b/test/appium/tests/atomic/transactions/test_keycard_wallet.py @@ -138,7 +138,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): send_transaction.sign_transaction_button.click() send_transaction.sign_transaction(keycard=True) self.network_api.wait_for_confirmation_of_transaction(status_account_address, transaction_amount) - self.network_api.verify_balance_is_updated('0.1', status_account_address) + self.network_api.verify_balance_is_updated('0', status_account_address) wallet_view.just_fyi("Verifying previously sent transaction in new account") wallet_view.back_button.click() @@ -186,3 +186,19 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): if total_eth_from_two_accounts != expected_balance: self.driver.fail('Total wallet balance %s != of Status account (%s) + SubAccount (%s)' % ( total_eth_from_two_accounts, balance_of_status_account, balance_of_sub_account)) + + wallet_view.just_fyi("Check that can set max and send transaction with max amount from subaccount") + wallet_view.get_account_by_name(account_name).click() + wallet_view.send_transaction_button.click() + send_transaction.set_max_button.click() + set_amount = float(send_transaction.amount_edit_box.text) + if set_amount == 0.0 or set_amount >= balance_of_sub_account: + self.driver.fail('Value after setting up max amount is set to %s' % str(set_amount)) + send_transaction.confirm() + send_transaction.chose_recipient_button.click() + send_transaction.accounts_button.click() + send_transaction.element_by_text('Status account').click() + send_transaction.sign_transaction_button.click() + send_transaction.sign_transaction(keycard=True) + wallet_view.element_by_text('Assets').click() + wallet_view.wait_balance_is_equal_expected_amount(asset='ETH', expected_balance=0) diff --git a/test/appium/tests/atomic/transactions/test_wallet.py b/test/appium/tests/atomic/transactions/test_wallet.py index 8d9cfa14ad..9b5fc5a013 100644 --- a/test/appium/tests/atomic/transactions/test_wallet.py +++ b/test/appium/tests/atomic/transactions/test_wallet.py @@ -571,7 +571,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): wallet_view.back_button.click() screen = 'sending screen from wallet' - sign_in_view.just_fyi('Checking %s on %s' % (errors['sending_screen']['Network fee'],screen)) + sign_in_view.just_fyi('Checking %s on %s' % (errors['sending_screen']['Network fee'], screen)) account_name = 'new' wallet_view.add_account(account_name) wallet_view.get_account_by_name(account_name).click() @@ -613,7 +613,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): send_transaction.cancel_button.click() screen = 'sending screen from DApp' - sign_in_view.just_fyi('Checking %s on %s' % (errors['sending_screen']['Network fee'],screen)) + sign_in_view.just_fyi('Checking %s on %s' % (errors['sending_screen']['Network fee'], screen)) home_view = wallet_view.home_button.click() dapp_view = sign_in_view.dapp_tab_button.click() dapp_view.select_account_button.click() diff --git a/test/appium/views/elements_templates/enabled_toggle.png b/test/appium/views/elements_templates/enabled_toggle.png new file mode 100644 index 0000000000..7fd77d4869 Binary files /dev/null and b/test/appium/views/elements_templates/enabled_toggle.png differ diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index 0d9be45d61..af5739487a 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -72,6 +72,10 @@ class ChatsMenuInviteFriendsButton(BaseButton): super(ChatsMenuInviteFriendsButton, self).__init__(driver) self.locator = self.Locator.accessibility_id('chats-menu-invite-friends-button') +class StopStatusServiceButton(BaseButton): + def __init__(self, driver): + super(StopStatusServiceButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id('STOP') class UserNameBelowNewChatButton(BaseButton): def __init__(self, driver, username_part): @@ -177,6 +181,7 @@ class HomeView(BaseView): self.delete_chat_button = DeleteChatButton(self.driver) self.clear_history_button = ClearHistoryButton(self.driver) self.mark_all_messages_as_read_button = MarkAllMessagesAsReadButton(self.driver) + self.stop_status_service_button = StopStatusServiceButton(self.driver) def wait_for_syncing_complete(self): self.driver.info('Waiting for syncing complete:') diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index 768f1aaa1d..bc09858c79 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -569,6 +569,12 @@ class AskMeWhenOnMobileNetworkToggle(BaseButton): self.locator = self.Locator.xpath_selector( "//*[@text='Ask me when on mobile network']/following-sibling::android.widget.Switch[1]") +class PushNotificationToggle(BaseButton): + def __init__(self, driver): + super(PushNotificationToggle, self).__init__(driver) + self.locator = self.Locator.xpath_selector( + "//*[@content-desc='notifications-button']//*[@content-desc='switch']") + class ENSUsernameInChatSettings(BaseElement): def __init__(self, driver): super(ENSUsernameInChatSettings, self).__init__(driver) @@ -672,6 +678,9 @@ class ProfileView(BaseView): self.use_mobile_data = UseMobileDataToggle(self.driver) self.ask_me_when_on_mobile_network = AskMeWhenOnMobileNetworkToggle(self.driver) + #Push notifications + self.push_notification_toggle = PushNotificationToggle(self.driver) + def switch_network(self, network='Mainnet with upstream RPC'): self.advanced_button.click() self.network_settings_button.click() diff --git a/test/appium/views/send_transaction_view.py b/test/appium/views/send_transaction_view.py index 1631818d0f..966c7f9d63 100644 --- a/test/appium/views/send_transaction_view.py +++ b/test/appium/views/send_transaction_view.py @@ -13,7 +13,7 @@ class FirstRecipient(BaseButton): class CancelButton(BaseButton): def __init__(self, driver): super(CancelButton, self).__init__(driver) - self.locator = self.Locator.xpath_selector("//*[@text='Cancel']") + self.locator = self.Locator.text_selector("Cancel") class SignTransactionButton(BaseButton): @@ -28,6 +28,12 @@ class AmountEditBox(BaseEditBox, BaseButton): super(AmountEditBox, self).__init__(driver) self.locator = self.Locator.accessibility_id('amount-input') +class SetMaxButton(BaseButton): + + def __init__(self, driver): + super(SetMaxButton, self).__init__(driver) + self.locator = self.Locator.text_selector('Set max') + class SignInPhraseText(BaseText): def __init__(self, driver): @@ -189,7 +195,7 @@ class ValidationErrorOnSendTransaction(BaseButton): class ValidationIconOnSendTransaction(BaseButton): def __init__(self, driver): super(ValidationIconOnSendTransaction, self).__init__(driver) - self.locator = self.Locator.xpath_selector('//*[@content-desc="custom-gas-fee"]/../android.view.ViewGroup/*[@content-desc="icon"]') + self.locator = self.Locator.xpath_selector('//*[@content-desc="custom-gas-fee"]/../android.view.ViewGroup//*[@content-desc="icon"]') @@ -288,6 +294,7 @@ class SendTransactionView(BaseView): self.enter_recipient_address_text = EnterRecipientAddressInputText(self.driver) self.recent_recipients_button = RecentRecipientsButton(self.driver) self.amount_edit_box = AmountEditBox(self.driver) + self.set_max_button = SetMaxButton(self.driver) self.validation_error_element = ValidationIconOnSendTransaction(self.driver) self.network_fee_button = NetworkFeeButton(self.driver)