From 3b6f3b77ccaf6371fdfecf6efbca71f9cf1c4cc0 Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Fri, 23 Apr 2021 14:36:38 +0200 Subject: [PATCH] e2e fix PNs Signed-off-by: Churikova Tetiana --- .../tests/atomic/chats/test_commands.py | 1 - .../tests/atomic/chats/test_group_chat.py | 6 ++--- .../atomic/chats/test_keycard_commands.py | 1 - .../tests/atomic/chats/test_one_to_one.py | 26 ++++++++++++++----- test/appium/views/base_view.py | 5 ++++ 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/test/appium/tests/atomic/chats/test_commands.py b/test/appium/tests/atomic/chats/test_commands.py index 17c5b100ec..b4e6bf3299 100644 --- a/test/appium/tests/atomic/chats/test_commands.py +++ b/test/appium/tests/atomic/chats/test_commands.py @@ -72,7 +72,6 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase): updated_timestamp_sender = sender_message.timestamp_message.text if updated_timestamp_sender == timestamp_sender: self.errors.append("Timestamp of message is not updated after signing transaction") - sender_message.transaction_status.wait_for_element_text(sender_message.pending) chat_1.wallet_button.click() wallet_1.find_transaction_in_history(amount=amount) diff --git a/test/appium/tests/atomic/chats/test_group_chat.py b/test/appium/tests/atomic/chats/test_group_chat.py index 1efcb0cc78..47417edab8 100644 --- a/test/appium/tests/atomic/chats/test_group_chat.py +++ b/test/appium/tests/atomic/chats/test_group_chat.py @@ -190,8 +190,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase): device_2_chat = device_2_home.get_chat(chat_name).click() device_2_chat.decline_invitation_button.click() left_system_message = device_2_chat.leave_system_message(device_2_username) - if not device_1_chat.chat_element_by_text(left_system_message).is_element_displayed(): - self.errors.append('No system message after user left the group chat') + if device_1_chat.chat_element_by_text(left_system_message).is_element_displayed(): + self.errors.append('System message after user left the group chat is shown if declined before accepting in Activity Centre') if device_2_home.element_by_text(chat_name).is_element_displayed(): self.errors.append("Group chat '%s' is shown, but user has left" % chat_name) @@ -513,7 +513,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase): device_1_chat.send_message_button.click() device_1_chat.chat_message_input.click() for chat in device_1_chat, device_2_chat, device_3_chat: - if not chat.image_chat_item.is_element_displayed(30): + if not chat.image_chat_item.is_element_displayed(60): self.errors.append('Image is not shown in chat after sending for %s' % chat.driver.number) device_1.just_fyi('Send audio message to group chat and verify it on all devices') diff --git a/test/appium/tests/atomic/chats/test_keycard_commands.py b/test/appium/tests/atomic/chats/test_keycard_commands.py index 4d0b7c0dff..247e5f2d58 100644 --- a/test/appium/tests/atomic/chats/test_keycard_commands.py +++ b/test/appium/tests/atomic/chats/test_keycard_commands.py @@ -64,7 +64,6 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase): send_message = sender_message.sign_and_send.click() send_message.next_button.click() send_message.sign_transaction(keycard=True, default_gas_price=False) - sender_message.transaction_status.wait_for_element_text(sender_message.pending) updated_timestamp_sender = sender_message.timestamp_message.text if updated_timestamp_sender == timestamp_sender: self.errors.append("Timestamp of message is not updated after signing transaction") 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 bce67e5a44..820ba42a00 100644 --- a/test/appium/tests/atomic/chats/test_one_to_one.py +++ b/test/appium/tests/atomic/chats/test_one_to_one.py @@ -16,7 +16,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): @marks.testrail_id(6283) @marks.high - def test_push_notification_1_1_chat(self): + def test_push_notification_1_1_chat_no_pn_activity_center(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(enable_notifications=True) @@ -28,14 +28,23 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): profile_1.profile_notifications_toggle_button.click() device_1_home = profile_1.get_back_to_home_view() device_2_public_key = device_2_home.get_public_key_and_username() + message_no_pn, message = 'No PN', 'Text push notification' + + device_2.just_fyi("Device 2 check there is no PN when receiving new message to activity centre") + device_2.put_app_to_background() + device_1_chat = device_1_home.add_contact(device_2_public_key) + device_1_chat.send_message(message_no_pn) + device_2.open_notification_bar() + if device_2.element_by_text_part(message_no_pn).is_element_displayed(): + self.errors.append("Push notification with text was received for new message in activity centre") + device_2.get_app_from_background() + device_2.home_button.click() + device_2_home.get_chat(default_username_1).click() + device_2_home.profile_button.click() device_2.just_fyi("Device 2 puts app on background being on Profile view to receive PN with text") device_2.click_system_home_button() - - device_1_chat = device_1_home.add_contact(device_2_public_key) - message = 'Text push notification' - device_1_chat.chat_message_input.send_keys(message) - device_1_chat.send_message_button.click() + device_1_chat.send_message(message) device_1.just_fyi("Device 1 puts app on background to receive emoji push notification") device_1.profile_button.click() @@ -344,12 +353,15 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): default_username_1 = profile_1.default_username_text.text home_1 = profile_1.get_back_to_home_view() public_key_2 = home_2.get_public_key_and_username() + chat_1 = home_1.add_contact(public_key_2) + chat_1.send_message('hey') + home_2.home_button.double_click() + home_2.get_chat(default_username_1).click() home_2.just_fyi("Put app on background (to check Push notification received for audio message)") home_2.click_system_home_button() home_2.just_fyi("Sending audio message to device who is on background") - chat_1 = home_1.add_contact(public_key_2) chat_1.record_audio_message(message_length_in_seconds=125) if not chat_1.element_by_text("Maximum recording time reached").is_element_displayed(): self.drivers[0].fail("Exceeded 2 mins limit of recording time.") diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index d86284f8ba..2c5979d26f 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -322,6 +322,11 @@ class BaseView(object): for _ in range(times): self.driver.press_keycode(4) + def get_app_from_background(self): + self.driver.info('*Get Status back from Recent apps*') + self.driver.press_keycode(187) + self.status_in_background_button.click() + def put_app_to_background_and_back(self, time_in_background=1): self.driver.info('*Put app to background and back*') self.driver.press_keycode(187)