From 5a5847d5902ed95e870147d343b31b4a0626956a Mon Sep 17 00:00:00 2001 From: Valentina Novgorodtceva Date: Fri, 22 Mar 2024 16:37:20 +0700 Subject: [PATCH] chore: stabilised test (hopefully) --- gui/screens/messages.py | 1 + tests/settings/settings_messaging/test_1x1_chat.py | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gui/screens/messages.py b/gui/screens/messages.py index 0e8a77f..0e41c39 100644 --- a/gui/screens/messages.py +++ b/gui/screens/messages.py @@ -177,6 +177,7 @@ class ChatView(QObject): @allure.step('Get messages') def messages(self, index: int) -> typing.List[Message]: _messages = [] + time.sleep(1) # message_list_item has different indexes if we run multiple instances, so we pass index self._message_list_item.real_name['index'] = index for item in driver.findAllObjects(self._message_list_item.real_name): diff --git a/tests/settings/settings_messaging/test_1x1_chat.py b/tests/settings/settings_messaging/test_1x1_chat.py index a59b51c..1b5d931 100644 --- a/tests/settings/settings_messaging/test_1x1_chat.py +++ b/tests/settings/settings_messaging/test_1x1_chat.py @@ -18,8 +18,8 @@ from gui.main_window import MainWindow pytestmark = marks -@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703011', 'Add a contact with a chat key') -@pytest.mark.case(703011) +@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703087', '1-1 Chat') +@pytest.mark.case(703087) @pytest.mark.parametrize('user_data_one, user_data_two', [ (configs.testpath.TEST_USER_DATA / 'user_account_one', configs.testpath.TEST_USER_DATA / 'user_account_two') ]) @@ -86,12 +86,13 @@ def test_1x1_chat(multiple_instance, user_data_one, user_data_two): messages_screen.left_panel.open_chat(user_one.name) with step(f'User {user_two.name} send reply to {user_one.name}'): - ChatMessagesView().send_message_to_group_chat('Hello squisher') messages_screen.group_chat.send_message_to_group_chat('Hello squisher') - message_objects = messages_screen.chat.messages(1) + message_objects = messages_screen.chat.messages(0) message_items = [message.text for message in message_objects] for message_item in message_items: assert 'Hello squisher' in message_item + message_objects = messages_screen.chat.messages(1) + message_items = [message.text for message in message_objects] for message_item in message_items: assert 'How are you?' in message_item @@ -119,10 +120,10 @@ def test_1x1_chat(multiple_instance, user_data_one, user_data_two): assert '😎' in message_item with step(f'User {user_one.name}, delete own message and verify it was deleted'): - message = messages_screen.left_panel.open_chat(user_two.name).find_message_by_text('How are you?', 3) + message = messages_screen.left_panel.open_chat(user_two.name).find_message_by_text('How are you?', 2) message.hover_message().delete_message() with step(f'User {user_one.name}, cannot delete {user_two.name} message'): - message = messages_screen.left_panel.open_chat(user_two.name).find_message_by_text('Hello squisher', 2) + message = messages_screen.left_panel.open_chat(user_two.name).find_message_by_text('Hello squisher', 1) assert not message.hover_message().is_delete_button_visible() main_window.hide()