added public chat management test, disabled group chat tests, added more errors to the rerun tests list

Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
Anton Danchenko 2018-05-23 16:02:45 +03:00 committed by yevh-berdnyk
parent 1752c5bc17
commit b8e41cb464
No known key found for this signature in database
GPG Key ID: E9B425FDFC4DEA9C
10 changed files with 125 additions and 19 deletions

View File

@ -2,7 +2,11 @@ RERUN_ERRORS = [
'Original error: Error: ESOCKETTIMEDOUT',
"The server didn't respond in time.",
'An unknown server-side error occurred while processing the command.',
'Could not proxy command to remote server. Original error: Error: socket hang up'
'Could not proxy command to remote server. Original error: Error: socket hang up',
'The server returned an invalid or incomplete response.',
'502 Bad Gateway',
'Unexpected server error',
'504 Gateway Time-out'
]

View File

@ -32,7 +32,7 @@ def find_transaction_on_ropsten(address: str, transaction_hash: str):
pytest.fail('Transaction is not found in Ropsten network')
def verify_balance_is_updated(initial_balance, recipient_address, wait_time=240):
def verify_balance_is_updated(initial_balance, recipient_address, wait_time=360):
counter = 0
while True:
if counter >= wait_time:

View File

@ -42,10 +42,10 @@ def pytest_addoption(parser):
action='store',
default=None,
help='Pull Request number')
parser.addoption('--nightly',
parser.addoption('--testrail_report',
action='store',
default=False,
help='boolean; For running extended test suite against nightly build')
help='boolean; For creating testrail report per run')
parser.addoption('--rerun_count',
action='store',
default=0,
@ -74,7 +74,7 @@ def pytest_configure(config):
test_suite_data.apk_name = ([i for i in [i for i in config.getoption('apk').split('/')
if '.apk' in i]])[0]
if is_master(config):
if config.getoption('nightly'):
if config.getoption('testrail_report'):
testrail_report.add_run(test_suite_data.apk_name)
if config.getoption('env') == 'sauce':
if not is_uploaded():
@ -99,7 +99,7 @@ def pytest_unconfigure(config):
repo = Github(github_token).get_user('status-im').get_repo('status-react')
pull = repo.get_pull(int(config.getoption('pr_number')))
pull.create_issue_comment(github_report.build_html_report())
if config.getoption('nightly'):
if config.getoption('testrail_report'):
testrail_report.add_results()

View File

@ -8,3 +8,4 @@ chat = pytest.mark.chat
chat_management = pytest.mark.chat_management
transaction = pytest.mark.transaction
wallet = pytest.mark.wallet
skip = pytest.mark.skip

View File

@ -1,10 +1,12 @@
import time
import pytest
import random
import string
import emoji
from tests import transaction_users, marks, group_chat_users, get_current_time
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
from views.sign_in_view import SignInView
@marks.all
@marks.chat_management
class TestChatManagementMultiple(MultipleDeviceTestCase):
@ -71,7 +73,65 @@ class TestChatManagementMultiple(MultipleDeviceTestCase):
device_1_chat_view = device_1_home_view.start_1_1_chat(self.senders['h_user']['username'])
if not device_1_chat_view.no_messages_in_chat.is_element_present():
pytest.fail('Message history is shown in a chat which was previously deleted')
self.verify_no_errors()
@marks.testrail_case_id(3419)
def test_public_chat_management(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
users = []
chat_name = ''.join(random.choice(string.ascii_lowercase) for _ in range(19))
for sign_in in device_1, device_2:
users.append(sign_in.create_user())
home = sign_in.get_home_view()
home.join_public_chat(chat_name)
chat_1, chat_2 = device_1.get_chat_view(), device_2.get_chat_view()
message_1, message_2, message_3, message_4, message_5 = 'm1', 'm2', 'm3', 'm4', 'm5'
chat_1.chat_message_input.send_keys(message_1)
chat_1.send_message_button.click()
chat_2.element_by_text(message_1).is_element_present()
chat_2.chat_message_input.send_keys(message_2)
chat_2.send_message_button.click()
chat_1.element_by_text(message_2).is_element_present()
chat_1.chat_options.click()
chat_1.clear_history_button.click()
chat_1.clear_button.click()
chat_2.chat_message_input.send_keys(message_3)
chat_2.send_message_button.click()
chat_1.element_by_text(message_3).is_element_present()
for message in message_1, message_2:
if chat_1.element_starts_with_text(message).is_element_present():
self.errors.append("Message '%s' is shown, but public chat history has been cleared" % message)
chat_2.chat_options.click()
chat_2.delete_chat_button.click()
chat_2.delete_button.click()
chat_1.chat_message_input.send_keys(message_4)
chat_1.send_message_button.click()
public_chat_name = '#' + chat_name
chat_2.element_by_text(public_chat_name).click()
for message in message_1, message_2, message_3, message_4:
if not chat_2.element_starts_with_text(message).is_element_present():
self.errors.append("Message '%s' is not shown in public chat which has been deleted" % message)
chat_1.chat_options.click()
chat_1.leave_chat_button.click()
chat_1.leave_button.click()
chat_2.chat_message_input.send_keys(message_5)
chat_2.send_message_button.click()
if chat_1.element_starts_with_text(message_5).is_element_present(20):
self.errors.append("Message '%s' is shown, but the user left public chat" % message_5)
chat_2.get_back_to_home_view()
home_2, home_1 = chat_2.get_home_view(), chat_1.get_home_view()
home_2.swipe_and_delete_chat('#' + chat_name)
for home in home_2, home_1:
home.relogin()
if home_1.element_by_text(public_chat_name).is_element_present(20):
self.errors.append("Public chat '%s' is shown, but the user left public chat" % public_chat_name)
if home_2.element_by_text(public_chat_name).is_element_present(20):
self.errors.append("Public chat '%s' is shown, but the chat has been deleted via 'swipe to delete'"
% public_chat_name)
self.verify_no_errors()
@ -96,6 +156,7 @@ class TestChatManagement(SingleDeviceTestCase):
pytest.fail('The chat is present after re-login')
@marks.testrail_case_id(3418)
@marks.skip
def test_swipe_and_delete_group_chat(self):
recipient = group_chat_users['A_USER']
sign_in_view = SignInView(self.driver)

View File

@ -79,6 +79,7 @@ class TestMessages(MultipleDeviceTestCase):
@marks.pr
@marks.testrail_case_id(3391)
@marks.skip
def test_group_chat_messages_and_delete_chat(self):
self.create_drivers(3)
@ -212,19 +213,20 @@ class TestMessages(MultipleDeviceTestCase):
if not chat_1.contact_profile_picture.is_element_image_equals_template(file_name):
self.errors.append("Updated profile picture is not shown in one-to-one chat")
home_1.get_back_to_home_view()
chat_name = 'a_chat_%s' % get_current_time()
home_1.create_group_chat([username_2], chat_name)
group_chat_1 = home_1.get_chat_view()
# home_1.get_back_to_home_view()
# chat_name = 'a_chat_%s' % get_current_time()
# home_1.create_group_chat([username_2], chat_name)
# group_chat_1 = home_1.get_chat_view()
#
# home_2.get_back_to_home_view()
# group_chat_2 = home_2.get_chat_with_user(chat_name).click()
# message_text = 'test message'
# group_chat_2.chat_message_input.send_keys(message_text)
# group_chat_2.send_message_button.click()
#
# group_chat_1.wait_for_messages(username_2, message_text, self.errors)
# group_chat_1.verify_username_is_shown_per_message(username_2, message_text, self.errors)
home_2.get_back_to_home_view()
group_chat_2 = home_2.get_chat_with_user(chat_name).click()
message_text = 'test message'
group_chat_2.chat_message_input.send_keys(message_text)
group_chat_2.send_message_button.click()
group_chat_1.wait_for_messages(username_2, message_text, self.errors)
group_chat_1.verify_username_is_shown_per_message(username_2, message_text, self.errors)
self.verify_no_errors()
@marks.testrail_case_id(3429)
@ -300,6 +302,7 @@ class TestOfflineMessages(MultipleDeviceTestCase):
self.verify_no_errors()
@marks.testrail_case_id(3430)
@marks.skip
def test_offline_messaging_group_chat(self):
self.create_drivers(2)
device_1, device_2 = self.drivers[0], self.drivers[1]

View File

@ -1,4 +1,5 @@
import pytest
from tests import marks
from tests import transaction_users, transaction_users_wallet
from tests.base_test_case import SingleDeviceTestCase
from tests import basic_user
@ -38,6 +39,7 @@ class TestSanity(SingleDeviceTestCase):
pytest.fail('Password in logcat!!!', pytrace=False)
@pytest.mark.group_chat
@marks.skip
def test_group_chat_members(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()

View File

@ -66,6 +66,7 @@ class TestTransaction(SingleDeviceTestCase):
send_transaction_view.find_full_text('Wrong password', 20)
@marks.pr
@marks.skip
@marks.testrail_case_id(3403)
def test_transaction_send_command_group_chat(self):
recipient = transaction_users['A_USER']
@ -218,6 +219,7 @@ class TestTransactions(MultipleDeviceTestCase):
@marks.pr
@marks.testrail_case_id(3408)
@marks.skip
def test_send_eth_to_request_in_group_chat(self):
recipient = transaction_users['E_USER']
sender = self.senders['f_user'] = transaction_users['F_USER']

View File

@ -76,6 +76,34 @@ class DeleteChatButton(BaseButton):
self.locator = self.Locator.xpath_selector('//*[@text="Delete chat"]')
class ClearHistoryButton(BaseButton):
def __init__(self, driver):
super(ClearHistoryButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@text="Clear history"]')
class LeaveChatButton(BaseButton):
def __init__(self, driver):
super(LeaveChatButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@text="Leave public chat"]')
class ClearButton(BaseButton):
def __init__(self, driver):
super(ClearButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@text="CLEAR"]')
class LeaveButton(BaseButton):
def __init__(self, driver):
super(LeaveButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@text="LEAVE"]')
class ChatSettings(BaseButton):
def __init__(self, driver):
super(ChatSettings, self).__init__(driver)
@ -171,6 +199,10 @@ class ChatView(BaseView):
self.chat_options = ChatMenuButton(self.driver)
self.members_button = MembersButton(self.driver)
self.delete_chat_button = DeleteChatButton(self.driver)
self.clear_history_button = ClearHistoryButton(self.driver)
self.clear_button = ClearButton(self.driver)
self.leave_chat_button = LeaveChatButton(self.driver)
self.leave_button = LeaveButton(self.driver)
self.chat_settings = ChatSettings(self.driver)
self.view_profile_button = ViewProfileButton(self.driver)

View File

@ -112,6 +112,7 @@ class HomeView(BaseView):
start_new_chat = self.plus_button.click()
start_new_chat.join_public_chat_button.click()
start_new_chat.chat_name_editbox.send_keys(chat_name)
time.sleep(2)
start_new_chat.confirm()
def get_public_key(self):