def test_search_message(self):
    self._send_message('**test message**')
    self._send_message('**test message**')
    message_index = (self.chat_window.messageList.count() - 1)
    self.window.chat_window.searchMessageLineEdit.setText('test message')
    QtWidgets.QApplication.processEvents()
    QtTest.QTest.mouseClick(self.window.chat_window.searchPrevBtn, QtCore.Qt.LeftButton)
    QtWidgets.QApplication.processEvents()
    assert (self.chat_window.messageList.item(message_index).isSelected() is True)
    QtTest.QTest.mouseClick(self.window.chat_window.searchPrevBtn, QtCore.Qt.LeftButton)
    QtWidgets.QApplication.processEvents()
    assert (self.chat_window.messageList.item((message_index - 1)).isSelected() is True)
    QtTest.QTest.mouseClick(self.window.chat_window.searchNextBtn, QtCore.Qt.LeftButton)
    QtWidgets.QApplication.processEvents()
    assert (self.chat_window.messageList.item(message_index).isSelected() is True)
def test_search_message(self):
    self._send_message('**test message**')
    self._send_message('**test message**')
    message_index = (self.chat_window.messageList.count() - 1)
    self.window.chat_window.searchMessageLineEdit.setText('test message')
    QtWidgets.QApplication.processEvents()
    QtTest.QTest.mouseClick(self.window.chat_window.searchPrevBtn, QtCore.Qt.LeftButton)
    QtWidgets.QApplication.processEvents()
    assert (self.chat_window.messageList.item(message_index).isSelected() is True)
    QtTest.QTest.mouseClick(self.window.chat_window.searchPrevBtn, QtCore.Qt.LeftButton)
    QtWidgets.QApplication.processEvents()
    assert (self.chat_window.messageList.item((message_index - 1)).isSelected() is True)
    QtTest.QTest.mouseClick(self.window.chat_window.searchNextBtn, QtCore.Qt.LeftButton)
    QtWidgets.QApplication.processEvents()
    assert (self.chat_window.messageList.item(message_index).isSelected() is True)