From d14f232abf45d729036e1aa18dc8bd68292f352b Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Thu, 12 Nov 2020 18:28:34 +0100 Subject: [PATCH] status e2e Signed-off-by: Churikova Tetiana --- .../atomic/chats/test_chats_management.py | 8 ++- .../tests/atomic/chats/test_commands.py | 4 +- .../atomic/chats/test_keycard_commands.py | 2 +- .../tests/atomic/chats/test_one_to_one.py | 26 ++++++++-- .../dapps_and_browsing/test_browsing.py | 10 ---- test/appium/views/base_view.py | 15 ++++++ test/appium/views/chat_view.py | 52 +++++++++++++++++-- 7 files changed, 94 insertions(+), 23 deletions(-) diff --git a/test/appium/tests/atomic/chats/test_chats_management.py b/test/appium/tests/atomic/chats/test_chats_management.py index 3c876e96c0..4a1430ee31 100644 --- a/test/appium/tests/atomic/chats/test_chats_management.py +++ b/test/appium/tests/atomic/chats/test_chats_management.py @@ -241,10 +241,11 @@ class TestChatManagement(SingleDeviceTestCase): home.join_public_chat(public[1:]) chat.get_back_to_home_view() + message = 'test message' for chat_name in one_to_one, public, group: chat = home.get_chat(chat_name).click() chat.just_fyi('Sending message to %s chat' % chat_name) - chat.chat_message_input.send_keys('test message') + chat.chat_message_input.send_keys(message) chat.send_message_button.click() chat.just_fyi('Deleting %s chat' % chat_name) chat.leave_chat() if chat_name == group else chat.delete_chat() @@ -258,6 +259,11 @@ class TestChatManagement(SingleDeviceTestCase): for chat_name in one_to_one, public, group: if home.get_chat(chat_name).is_element_displayed(): self.errors.append('Deleted %s is shown after re-login, but the chat has been deleted' % chat_name) + sign_in.just_fyi('Rejoin public chat and check that messages are fetched again') + public_chat = home.join_public_chat(public[1:]) + if not public_chat.chat_element_by_text(message).is_element_displayed(20): + self.errors.append('Messages are not fetched when rejoining public chat after deleting') + self.errors.verify_no_errors() @marks.testrail_id(5464) diff --git a/test/appium/tests/atomic/chats/test_commands.py b/test/appium/tests/atomic/chats/test_commands.py index 535ea3481f..fed92a16e2 100644 --- a/test/appium/tests/atomic/chats/test_commands.py +++ b/test/appium/tests/atomic/chats/test_commands.py @@ -47,7 +47,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase): send_message.next_button.click() send_message.sign_transaction() self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=15) - [message.transaction_status.wait_for_element_text('Confirmed') for message in (chat_1_sender_message, chat_2_request_message)] + chat_1_sender_message.transaction_status.wait_for_element_text('Confirmed') self.errors.verify_no_errors() @marks.testrail_id(6253) @@ -95,7 +95,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase): if not chat_2_receiver_message.contains_text(text): self.driver.fail("Transaction message doesn't contain required option %s" % text) select_account_bottom_sheet = chat_2_receiver_message.accept_and_share_address.click() - if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button('Status').is_element_displayed(): + if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button(wallet_1.status_account_name).is_element_displayed(): self.errors.append('Not expected value in "From" in "Select account": "Status" is expected') select_account_bottom_sheet.select_button.click() chat_2_receiver_message.transaction_status.wait_for_element_text("Shared '%s'" % diff --git a/test/appium/tests/atomic/chats/test_keycard_commands.py b/test/appium/tests/atomic/chats/test_keycard_commands.py index 709da05c66..16566bb407 100644 --- a/test/appium/tests/atomic/chats/test_keycard_commands.py +++ b/test/appium/tests/atomic/chats/test_keycard_commands.py @@ -53,7 +53,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase): if not chat_2_receiver_message.contains_text(text): self.driver.fail("Transaction message doesn't contain required option %s" % text) select_account_bottom_sheet = chat_2_receiver_message.accept_and_share_address.click() - if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button('Status').is_element_displayed(): + if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button(wallet_1.status_account_name).is_element_displayed(): self.errors.append('Not expected value in "From" in "Select account": "Status" is expected') select_account_bottom_sheet.select_button.click() chat_2_receiver_message.transaction_status.wait_for_element_text("Shared '%s'" % home_1.status_account_name) 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 8fb554fb3d..c828363939 100644 --- a/test/appium/tests/atomic/chats/test_one_to_one.py +++ b/test/appium/tests/atomic/chats/test_one_to_one.py @@ -279,17 +279,24 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): @marks.testrail_id(6305) @marks.critical - def test_image_in_one_to_one_send_save_reply(self): + def test_image_in_one_to_one_send_save_reply_timeline(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('start 1-1 chat') 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_home.just_fyi('set status in profile') + device_1_status = 'Hey hey hey' + timeline = device_1.status_button.click() + timeline.set_new_status(device_1_status) + if not timeline.element_by_text(device_1_status).is_element_displayed(): + self.drivers[0].fail('Status is not set') device_1_public_key, device_1_username = device_1_profile.get_public_key_and_username(return_username=True) image_description = 'description' [home.click() for home in [device_1_profile.home_button, device_2_profile.home_button]] + + device_1_home.just_fyi('start 1-1 chat') device_1_chat = device_1_home.add_contact(device_2_public_key) device_1_home.just_fyi('send image in 1-1 chat from Gallery, check options for sender') @@ -312,15 +319,24 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): if not element.is_element_displayed(): self.errors.append('Save and reply are not available on long-press on own image messages') if device_1_chat.view_profile_button.is_element_displayed(): - self.errors.append('Options are not shown on long-press on image messages') + self.errors.append('"View profile" is shown on long-press on own message') device_2_home.just_fyi('check image, description and options for receiver') device_2_chat = device_2_home.get_chat(device_1_username).click() for message in device_2_chat.image_chat_item, device_2_chat.chat_element_by_text(image_description): if not message.is_element_displayed(): self.errors.append('Image or description is not shown in chat after sending for receiver') + + device_2_home.just_fyi('Open image, view user profile and check status') + device_2_chat.image_chat_item.click() + device_2_chat.view_image_options.click() + device_2_chat.view_profile_button.click() + device_2_chat.element_by_text(device_1_status).scroll_to_element() + device_2_chat.back_button.click() + + device_2_home.just_fyi('check options on long-press image for receiver') device_2_chat.image_chat_item.long_press_element() - for element in device_2_chat.reply_message_button, device_2_chat.save_image_button: + for element in (device_2_chat.reply_message_button, device_2_chat.save_image_button): if not element.is_element_displayed(): self.errors.append('Save and reply are not available on long-press on received image messages') diff --git a/test/appium/tests/atomic/dapps_and_browsing/test_browsing.py b/test/appium/tests/atomic/dapps_and_browsing/test_browsing.py index 066bb08153..bd263a06fd 100644 --- a/test/appium/tests/atomic/dapps_and_browsing/test_browsing.py +++ b/test/appium/tests/atomic/dapps_and_browsing/test_browsing.py @@ -165,16 +165,6 @@ class TestBrowsing(SingleDeviceTestCase): if not dapp_view.element_by_text('Browser history will appear here').is_element_displayed(): self.errors.append('Browser history is not empty') - @marks.testrail_id(5320) - @marks.critical - def test_open_google_com_via_open_dapp(self): - sign_in_view = SignInView(self.driver) - home = sign_in_view.create_user() - open_dapp_view = home.dapp_tab_button.click() - open_dapp_view.open_url('google.com') - browsing_view = open_dapp_view.get_base_web_view() - browsing_view.element_by_text('Google').wait_for_element(30) - @marks.testrail_id(5321) @marks.critical def test_back_forward_buttons_browsing_website(self): diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index 8fa3c9bbee..8b4b2aec02 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -188,6 +188,20 @@ class ProfileButton(TabButton): self.click_until_presence_of_element(base_view.element_by_text_part(desired_element_text)) return self.navigate() +class StatusButton(TabButton): + def __init__(self, driver): + super(StatusButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id('status-tab-button') + + def navigate(self): + from views.chat_view import ChatView + return ChatView(self.driver) + + def click(self): + self.driver.info('Tap on %s' % self.name) + from views.chat_view import AddNewStatusButton + self.click_until_presence_of_element(AddNewStatusButton(self.driver)) + return self.navigate() class SaveButton(BaseButton): def __init__(self, driver): @@ -384,6 +398,7 @@ class BaseView(object): self.wallet_button = WalletButton(self.driver) self.profile_button = ProfileButton(self.driver) self.dapp_tab_button = DappTabButton(self.driver) + self.status_button = StatusButton(self.driver) self.yes_button = YesButton(self.driver) self.no_button = NoButton(self.driver) diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index 3819e84b3a..b88323e80f 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -40,6 +40,11 @@ class CancelSendImage(BaseEditBox): self.locator = self.Locator.accessibility_id('cancel-send-image') +class ViewImageOptions(BaseEditBox): + def __init__(self, driver): + super(ViewImageOptions, self).__init__(driver) + self.locator = self.Locator.xpath_selector('//*[@content-desc="icon"]/android.widget.ImageView') + class AddToContacts(BaseButton): def __init__(self, driver): super(AddToContacts, self).__init__(driver) @@ -341,7 +346,7 @@ class FirstElementFromGalleryButton(BaseButton): class ViewProfileButton(BaseButton): def __init__(self, driver): super(ViewProfileButton, self).__init__(driver) - self.locator = self.Locator.xpath_selector('//*[@text="View profile"]') + self.locator = self.Locator.translation_id_selector('view-profile') class ViewProfileByAvatarButton(BaseButton): def __init__(self, driver): @@ -717,6 +722,29 @@ class AudioMessageRecordedTime(BaseText): self.locator = self.Locator.accessibility_id("audio-message-recorded-time") +class MyStatusEditBox(BaseEditBox): + def __init__(self, driver): + super(MyStatusEditBox, self).__init__(driver) + self.locator = self.Locator.accessibility_id("my-status-input") + + +class AddNewStatusButton(BaseButton): + def __init__(self, driver): + super(AddNewStatusButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id("plus-button") + +class OpenImagesPanelButton(BaseButton): + def __init__(self, driver): + super(OpenImagesPanelButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id("open-images-panel-button") + + +class SendMyStatusButton(BaseButton): + def __init__(self, driver): + super(SendMyStatusButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id("send-my-status-button") + + class ChatView(BaseView): def __init__(self, driver): super(ChatView, self).__init__(driver) @@ -750,6 +778,7 @@ class ChatView(BaseView): self.save_image_button = SaveImageButton(self.driver) self.recent_image_in_gallery = ImageInRecentInGalleryElement(self.driver) self.cancel_send_image_button = CancelSendImage(self.driver) + self.view_image_options = ViewImageOptions(self.driver) self.audio_message_button = AudioMessageButton(self.driver) self.record_audio_button = RecordAudioButton(self.driver) @@ -759,8 +788,6 @@ class ChatView(BaseView): self.audio_message_in_chat_timer = AudioMessageInChatTimer(self.driver) self.audio_message_recorded_time = AudioMessageRecordedTime(self.driver) - - self.chat_options = ChatMenuButton(self.driver) self.members_button = MembersButton(self.driver) self.delete_chat_button = DeleteChatButton(self.driver) @@ -811,9 +838,14 @@ class ChatView(BaseView): self.profile_details = ProfileDetailsOtherUser(self.driver) self.profile_nickname = ProfileNicknameOtherUser(self.driver) self.profile_nickname_button = ProfileNicknameOtherUserButton(self.driver) - self.nickname_input_field = NicknameInputOtherUser(self.driver) + #Timeline + self.timeline_add_new_status_button = AddNewStatusButton(self.driver) + self.timeline_my_status_editbox = MyStatusEditBox(self.driver) + self.timeline_open_images_panel_button = OpenImagesPanelButton(self.driver) + self.timeline_send_my_status_button = SendMyStatusButton(self.driver) + def delete_chat(self): self.chat_options.click() self.delete_chat_button.click() @@ -983,6 +1015,18 @@ class ChatView(BaseView): timestamp = timestamp[1:] if timestamp[0] == '0' else timestamp return timestamp + def set_new_status(self, status='something is happening', image=False): + + self.timeline_add_new_status_button.click_until_presence_of_element(self.timeline_my_status_editbox) + self.timeline_my_status_editbox.set_value(status) + + if image: + self.timeline_open_images_panel_button.click() + if self.allow_button.is_element_present(): + self.allow_button.click() + self.first_image_from_gallery.click() + self.timeline_send_my_status_button.click() + # Group chat system messages @staticmethod def leave_system_message(username):