added chat search test

Signed-off-by: Anton Danchenko <ant.danchenko@gmail.com>
This commit is contained in:
Anton Danchenko 2019-03-12 10:29:20 +02:00
parent 036692f8ba
commit 3c5502075a
No known key found for this signature in database
GPG Key ID: C2D4819B698627E4
2 changed files with 42 additions and 1 deletions

View File

@ -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):

View File

@ -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:')