From 3c5502075a032316fd5361b3dfb702480e887c06 Mon Sep 17 00:00:00 2001 From: Anton Danchenko Date: Tue, 12 Mar 2019 10:29:20 +0200 Subject: [PATCH] added chat search test Signed-off-by: Anton Danchenko --- .../atomic/chats/test_chats_management.py | 34 +++++++++++++++++++ test/appium/views/home_view.py | 9 ++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/test/appium/tests/atomic/chats/test_chats_management.py b/test/appium/tests/atomic/chats/test_chats_management.py index 9359bceb57..38fa717372 100644 --- a/test/appium/tests/atomic/chats/test_chats_management.py +++ b/test/appium/tests/atomic/chats/test_chats_management.py @@ -151,6 +151,40 @@ class TestChatManagement(SingleDeviceTestCase): start_new_chat.scan_contact_code_button.click() start_new_chat.deny_button.wait_for_visibility_of_element(2) + @marks.testrail_id(5757) + @marks.critical + def test_search_chat_on_home(self): + sign_in = SignInView(self.driver) + home = sign_in.create_user() + search_list = list() + + chat_name = home.get_public_chat_name() + search_list.append(chat_name) + public_chat = home.join_public_chat(chat_name) + public_chat.get_back_to_home_view() + + chat = home.add_contact(basic_user['public_key']) + search_list.append(basic_user['username']) + chat.get_back_to_home_view() + + start_new_chat = home.plus_button.click() + + search_list.append('Google') + start_new_chat.open_url('google.com') + chat.cross_icon.click() + + home.swipe_down() + for keyword in search_list: + home.search_chat_input.send_keys(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) + for element in search_results: + if keyword not in element.text: + self.errors.append("'%s' is shown on the home screen after searching by '%s' keyword" % + (element.text, keyword)) + home.search_chat_input.clear() + self.verify_no_errors() @marks.chat class TestChatManagementMultipleDevice(MultipleDeviceTestCase): diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index 35041fc3b2..e0b6f328cf 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -1,6 +1,6 @@ import time from selenium.common.exceptions import TimeoutException, NoSuchElementException -from views.base_element import BaseButton, BaseText, BaseElement +from views.base_element import BaseButton, BaseText, BaseElement, BaseEditBox from views.base_view import BaseView @@ -98,6 +98,12 @@ 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.xpath_selector('//android.widget.EditText') + + class HomeView(BaseView): def __init__(self, driver): super(HomeView, self).__init__(driver) @@ -105,6 +111,7 @@ 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) def wait_for_syncing_complete(self): self.driver.info('Waiting for syncing complete:')