test: test remove member if admin added
This commit is contained in:
parent
aa29339272
commit
2113b49863
|
@ -7,3 +7,5 @@ class Messaging(Enum):
|
||||||
NO_FRIENDS_ITEM = 'You don’t have any contacts yet'
|
NO_FRIENDS_ITEM = 'You don’t have any contacts yet'
|
||||||
NEW_CONTACT_REQUEST = 'New Contact Request'
|
NEW_CONTACT_REQUEST = 'New Contact Request'
|
||||||
MESSAGE_NOTE_IDENTITY_REQUEST = 'Ask a question that only the real athletic will be able to answer e.g. a question about a shared experience, or ask athletic to enter a code or phrase you have sent to them via a different communication channel (phone, post, etc...).'
|
MESSAGE_NOTE_IDENTITY_REQUEST = 'Ask a question that only the real athletic will be able to answer e.g. a question about a shared experience, or ask athletic to enter a code or phrase you have sent to them via a different communication channel (phone, post, etc...).'
|
||||||
|
YOU_NEED_TO_BE_A_MEMBER = 'You need to be a member of this group to send messages'
|
||||||
|
|
|
@ -13,6 +13,9 @@ chatList_ListView = {"container": statusDesktop_mainWindow, "objectName": "chatL
|
||||||
|
|
||||||
# Tool Bar
|
# Tool Bar
|
||||||
mainWindow_statusToolBar_StatusToolBar = {"container": mainWindow_chatView_ChatView, "objectName": "statusToolBar", "type": "StatusToolBar", "visible": True}
|
mainWindow_statusToolBar_StatusToolBar = {"container": mainWindow_chatView_ChatView, "objectName": "statusToolBar", "type": "StatusToolBar", "visible": True}
|
||||||
|
statusToolBar_Confirm_StatusButton = {"checkable": False, "container": mainWindow_statusToolBar_StatusToolBar, "objectName": "inlineSelectorConfirmButton", "type": "StatusButton", "visible": True}
|
||||||
|
statusToolBar_Cancel_StatusButton = {"checkable": False, "container": mainWindow_statusToolBar_StatusToolBar, "type": "StatusButton", "unnamed": 1, "visible": True}
|
||||||
|
statusToolBar_StatusTagItem = {"container": mainWindow_statusToolBar_StatusToolBar, "type": "StatusTagItem", "visible": True}
|
||||||
|
|
||||||
# Chat View
|
# Chat View
|
||||||
mainWindow_ChatColumnView = {"container": mainWindow_chatView_ChatView, "type": "ChatColumnView", "unnamed": 1, "visible": True}
|
mainWindow_ChatColumnView = {"container": mainWindow_chatView_ChatView, "type": "ChatColumnView", "unnamed": 1, "visible": True}
|
||||||
|
@ -42,6 +45,9 @@ inputScrollView_Message_PlaceholderText = {"container": mainWindow_inputScrollVi
|
||||||
mainWindow_scrollView_StatusScrollView = {"container": mainWindow_StatusWindow, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
|
mainWindow_scrollView_StatusScrollView = {"container": mainWindow_StatusWindow, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
|
||||||
scrollView_StatusChatListItem = {"container": mainWindow_scrollView_StatusScrollView, "type": "StatusChatListItem", "visible": True}
|
scrollView_StatusChatListItem = {"container": mainWindow_scrollView_StatusScrollView, "type": "StatusChatListItem", "visible": True}
|
||||||
tiny_pin_icon_StatusIcon = {"container": chatLogView_chatMessageViewDelegate_MessageView, "objectName": "tiny/pin-icon", "type": "StatusIcon"}
|
tiny_pin_icon_StatusIcon = {"container": chatLogView_chatMessageViewDelegate_MessageView, "objectName": "tiny/pin-icon", "type": "StatusIcon"}
|
||||||
|
add_remove_from_group_StatusMenuItem = {"checkable": False, "container": mainWindow_Overlay, "enabled": True, "type": "StatusMenuItem", "unnamed": 1, "visible": True}
|
||||||
|
mainWindow_inputScrollView_StatusScrollView = {"container": mainWindow_StatusWindow, "id": "inputScrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
|
||||||
|
inputScrollView_messageInputField_TextArea = {"container": mainWindow_inputScrollView_StatusScrollView, "objectName": "messageInputField", "type": "TextArea", "visible": True}
|
||||||
|
|
||||||
# User List Panel
|
# User List Panel
|
||||||
mainWindow_UserListPanel = {"container": mainWindow_chatView_ChatView, "type": "UserListPanel", "unnamed": 1, "visible": True}
|
mainWindow_UserListPanel = {"container": mainWindow_chatView_ChatView, "type": "UserListPanel", "unnamed": 1, "visible": True}
|
||||||
|
|
|
@ -69,10 +69,27 @@ class ToolBar(QObject):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__('mainWindow_statusToolBar_StatusToolBar')
|
super().__init__('mainWindow_statusToolBar_StatusToolBar')
|
||||||
self.pinned_message_tooltip = QObject('statusToolBar_StatusChatInfo_pinText_TruncatedTextWithTooltip')
|
self.pinned_message_tooltip = QObject('statusToolBar_StatusChatInfo_pinText_TruncatedTextWithTooltip')
|
||||||
|
self.confirm_button = Button('statusToolBar_Confirm_StatusButton')
|
||||||
|
self.status_button = Button('statusToolBar_Cancel_StatusButton')
|
||||||
|
self.contact_tag = QObject('statusToolBar_StatusTagItem')
|
||||||
|
|
||||||
|
@property
|
||||||
|
@allure.step('Get visibility of pin message tooltip')
|
||||||
def is_pin_message_tooltip_visible(self) -> bool:
|
def is_pin_message_tooltip_visible(self) -> bool:
|
||||||
return self.pinned_message_tooltip.is_visible
|
return self.pinned_message_tooltip.is_visible
|
||||||
|
|
||||||
|
@allure.step('Confirm action in toolbar')
|
||||||
|
def confirm_action_in_toolbar(self):
|
||||||
|
self.confirm_button.click()
|
||||||
|
|
||||||
|
@allure.step('Remove member by clicking close icon on member tag')
|
||||||
|
def click_contact_close_icon(self, member):
|
||||||
|
for item in driver.findAllObjects(self.contact_tag.real_name):
|
||||||
|
if str(getattr(item, 'text', '')) == str(member):
|
||||||
|
for child in walk_children(item):
|
||||||
|
if getattr(child, 'objectName', '') == 'close-icon':
|
||||||
|
driver.mouseClick(child)
|
||||||
|
|
||||||
|
|
||||||
class Message:
|
class Message:
|
||||||
|
|
||||||
|
@ -217,6 +234,8 @@ class ChatMessagesView(QObject):
|
||||||
self._more_button = Button('moreOptionsButton_StatusFlatRoundButton')
|
self._more_button = Button('moreOptionsButton_StatusFlatRoundButton')
|
||||||
self._edit_menu_item = QObject('edit_name_and_image_StatusMenuItem')
|
self._edit_menu_item = QObject('edit_name_and_image_StatusMenuItem')
|
||||||
self._leave_group_item = QObject('leave_group_StatusMenuItem')
|
self._leave_group_item = QObject('leave_group_StatusMenuItem')
|
||||||
|
self._add_remove_item = QObject('add_remove_from_group_StatusMenuItem')
|
||||||
|
self._message_input_area = QObject('inputScrollView_messageInputField_TextArea')
|
||||||
self._message_field = TextEdit('inputScrollView_Message_PlaceholderText')
|
self._message_field = TextEdit('inputScrollView_Message_PlaceholderText')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -233,6 +252,16 @@ class ChatMessagesView(QObject):
|
||||||
if getattr(item, 'id', '') == 'descText':
|
if getattr(item, 'id', '') == 'descText':
|
||||||
return str(item.text)
|
return str(item.text)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@allure.step('Get gray text from message area')
|
||||||
|
def gray_text_from_message_area(self) -> str:
|
||||||
|
return driver.waitForObjectExists(self._message_input_area.real_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC).placeholderText
|
||||||
|
|
||||||
|
@property
|
||||||
|
@allure.step('Get enabled state of message area')
|
||||||
|
def is_message_area_enabled(self) -> bool:
|
||||||
|
return driver.waitForObjectExists(self._message_input_area.real_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC).enabled
|
||||||
|
|
||||||
@allure.step('Click more options button')
|
@allure.step('Click more options button')
|
||||||
def open_more_options(self):
|
def open_more_options(self):
|
||||||
self._more_button.click()
|
self._more_button.click()
|
||||||
|
@ -259,6 +288,18 @@ class ChatMessagesView(QObject):
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
driver.nativeType('<Return>')
|
driver.nativeType('<Return>')
|
||||||
|
|
||||||
|
@allure.step('Remove member from chat')
|
||||||
|
def remove_member_from_chat(self, member):
|
||||||
|
time.sleep(2)
|
||||||
|
self.open_more_options()
|
||||||
|
time.sleep(2)
|
||||||
|
self._add_remove_item.click()
|
||||||
|
tool_bar = ToolBar().wait_until_appears()
|
||||||
|
tool_bar.click_contact_close_icon(member)
|
||||||
|
time.sleep(1)
|
||||||
|
tool_bar.confirm_action_in_toolbar()
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
class MessageQuickActions(QObject):
|
class MessageQuickActions(QObject):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import allure
|
import allure
|
||||||
import pytest
|
import pytest
|
||||||
from allure_commons._allure import step
|
from allure_commons._allure import step
|
||||||
|
|
||||||
|
import driver
|
||||||
from . import marks
|
from . import marks
|
||||||
|
|
||||||
import configs.testpath
|
import configs.testpath
|
||||||
|
@ -15,7 +17,7 @@ pytestmark = marks
|
||||||
|
|
||||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703014', 'Create a group and send messages')
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703014', 'Create a group and send messages')
|
||||||
@pytest.mark.case(703014)
|
@pytest.mark.case(703014)
|
||||||
@pytest.mark.timeout(timeout=265)
|
@pytest.mark.timeout(timeout=310)
|
||||||
@pytest.mark.parametrize('user_data_one, user_data_two, user_data_three', [
|
@pytest.mark.parametrize('user_data_one, user_data_two, user_data_three', [
|
||||||
(configs.testpath.TEST_USER_DATA / 'user_account_one', configs.testpath.TEST_USER_DATA / 'user_account_two',
|
(configs.testpath.TEST_USER_DATA / 'user_account_one', configs.testpath.TEST_USER_DATA / 'user_account_two',
|
||||||
configs.testpath.TEST_USER_DATA / 'user_account_two')
|
configs.testpath.TEST_USER_DATA / 'user_account_two')
|
||||||
|
@ -127,11 +129,13 @@ def test_group_chat(multiple_instance, user_data_one, user_data_two, user_data_t
|
||||||
for message_item in message_items:
|
for message_item in message_items:
|
||||||
assert 'Hi' in message_item
|
assert 'Hi' in message_item
|
||||||
|
|
||||||
with step('Leave group'):
|
with step(f'Remove {user_three.name} from group'):
|
||||||
messages_screen.group_chat.leave_group().confirm_leaving()
|
messages_screen.group_chat.remove_member_from_chat(user_three.name)
|
||||||
|
|
||||||
with step('Check that group name is not displayed on left panel'):
|
with step('Verify there are two members in group members list'):
|
||||||
assert new_name not in messages_screen.left_panel.contacts
|
assert driver.waitFor(lambda: user_one.name in messages_screen.right_panel.members, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
|
||||||
|
assert user_two.name in messages_screen.right_panel.members
|
||||||
|
assert len(messages_screen.right_panel.members) == 2
|
||||||
main_window.hide()
|
main_window.hide()
|
||||||
|
|
||||||
with step(f'Restart app for {user_two.name} and open group chat'):
|
with step(f'Restart app for {user_two.name} and open group chat'):
|
||||||
|
@ -139,9 +143,9 @@ def test_group_chat(multiple_instance, user_data_one, user_data_two, user_data_t
|
||||||
main_window.authorize_user(user_two)
|
main_window.authorize_user(user_two)
|
||||||
messages_screen.left_panel.open_chat(new_name)
|
messages_screen.left_panel.open_chat(new_name)
|
||||||
|
|
||||||
with step('Verify there are two members in group members list'):
|
with step('Verify there are three members in group members list'):
|
||||||
|
assert user_one.name in messages_screen.right_panel.members
|
||||||
assert user_two.name in messages_screen.right_panel.members
|
assert user_two.name in messages_screen.right_panel.members
|
||||||
assert user_three.name in messages_screen.right_panel.members
|
|
||||||
assert len(messages_screen.right_panel.members) == 2
|
assert len(messages_screen.right_panel.members) == 2
|
||||||
|
|
||||||
with step('Send message to group chat and verify it was sent'):
|
with step('Send message to group chat and verify it was sent'):
|
||||||
|
@ -158,25 +162,27 @@ def test_group_chat(multiple_instance, user_data_one, user_data_two, user_data_t
|
||||||
assert new_name not in messages_screen.left_panel.contacts
|
assert new_name not in messages_screen.left_panel.contacts
|
||||||
main_window.hide()
|
main_window.hide()
|
||||||
|
|
||||||
with step(f'Restart app for {user_three.name} and open group chat'):
|
with step(f'Restart app for {user_three.name} and verify that user is not the member of chat'):
|
||||||
aut_three.restart()
|
aut_three.restart()
|
||||||
main_window.authorize_user(user_three)
|
main_window.authorize_user(user_three)
|
||||||
|
|
||||||
|
with step('Check that {user_three.name} is not a member of a group'):
|
||||||
|
messages_screen.left_panel.open_chat(new_name)
|
||||||
|
gray_message_text = messages_screen.group_chat.gray_text_from_message_area
|
||||||
|
assert gray_message_text == Messaging.YOU_NEED_TO_BE_A_MEMBER.value
|
||||||
|
assert not messages_screen.group_chat.is_message_area_enabled
|
||||||
|
|
||||||
|
with step(f'Restart app for {user_one.name} and open group chat'):
|
||||||
|
aut_one.restart()
|
||||||
|
main_window.authorize_user(user_one)
|
||||||
messages_screen.left_panel.open_chat(new_name)
|
messages_screen.left_panel.open_chat(new_name)
|
||||||
|
|
||||||
with step('Verify there is one member in group members list'):
|
with step('Verify there is one member in group members list'):
|
||||||
assert user_three.name in messages_screen.right_panel.members
|
assert user_one.name in messages_screen.right_panel.members
|
||||||
assert len(messages_screen.right_panel.members) == 1
|
assert len(messages_screen.right_panel.members) == 1
|
||||||
|
|
||||||
with step('Send message to group chat and verify it was sent'):
|
|
||||||
messages_screen.group_chat.send_message_to_group_chat('Hi')
|
|
||||||
message_objects = messages_screen.chat.messages
|
|
||||||
message_items = [message.text for message in message_objects]
|
|
||||||
for message_item in message_items:
|
|
||||||
assert 'Hi' in message_item
|
|
||||||
|
|
||||||
with step('Leave group'):
|
with step('Leave group'):
|
||||||
messages_screen.left_panel.open_leave_group_popup(new_name).confirm_leaving()
|
messages_screen.group_chat.leave_group().confirm_leaving()
|
||||||
|
|
||||||
with step('Check that group name is not displayed on left panel'):
|
with step('Check that group name is not displayed on left panel'):
|
||||||
assert new_name not in messages_screen.left_panel.contacts
|
assert new_name not in messages_screen.left_panel.contacts
|
||||||
main_window.hide()
|
|
||||||
|
|
Loading…
Reference in New Issue