chore: fix community channels and categories locators
This commit is contained in:
parent
debae1e5f6
commit
1af622a8db
|
@ -19,8 +19,13 @@ mainWindow_startChatButton_StatusIconTabButton = {"checkable": True, "container"
|
||||||
mainWindow_createChatOrCommunity_Loader = {"container": mainWindow_communityColumnView_CommunityColumnView, "id": "createChatOrCommunity", "type": "Loader", "unnamed": 1, "visible": True}
|
mainWindow_createChatOrCommunity_Loader = {"container": mainWindow_communityColumnView_CommunityColumnView, "id": "createChatOrCommunity", "type": "Loader", "unnamed": 1, "visible": True}
|
||||||
mainWindow_scrollView_StatusScrollView = {"container": mainWindow_communityColumnView_CommunityColumnView, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
|
mainWindow_scrollView_StatusScrollView = {"container": mainWindow_communityColumnView_CommunityColumnView, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
|
||||||
scrollView_Flickable = {"container": mainWindow_scrollView_StatusScrollView, "type": "Flickable", "unnamed": 1, "visible": True}
|
scrollView_Flickable = {"container": mainWindow_scrollView_StatusScrollView, "type": "Flickable", "unnamed": 1, "visible": True}
|
||||||
scrollView_chatListItems_StatusListView = {"container": scrollView_Flickable, "objectName": "chatListItems", "type": "StatusListView", "visible": True}
|
|
||||||
channel_listItem = {"container": scrollView_chatListItems_StatusListView, "id": "chatListDelegate", "type": "DropArea", "isCategory": False, "visible": True}
|
# Channels and categories
|
||||||
|
communityChatListAndCategories = {"container": scrollView_Flickable, "id": "communityChatListAndCategories", "type": "StatusChatListAndCategories", "unnamed": 1, "visible": True}
|
||||||
|
channelAndCategoriesListItems = {"container": communityChatListAndCategories, "objectName": "statusChatListAndCategoriesChatList", "type": "StatusChatList"}
|
||||||
|
chatListItems = {"container": channelAndCategoriesListItems, "objectName": "chatListItems", "type": "StatusListView", "visible": True}
|
||||||
|
chatListItemDropAreaItem = {"container": chatListItems, "id": "chatListDelegate", "type": "DropArea", "isCategory": False, "visible": True}
|
||||||
|
categoryListItemDropAreaItem = {"container": chatListItems, "id": "chatListDelegate", "type": "DropArea", "isCategory": True, "visible": True}
|
||||||
channel_identicon_StatusSmartIdenticon = {"container": None, "id": "identicon", "type": "StatusSmartIdenticon", "unnamed": 1, "visible": True}
|
channel_identicon_StatusSmartIdenticon = {"container": None, "id": "identicon", "type": "StatusSmartIdenticon", "unnamed": 1, "visible": True}
|
||||||
channel_name_StatusBaseText = {"container": None, "type": "StatusBaseText", "unnamed": 1, "visible": True}
|
channel_name_StatusBaseText = {"container": None, "type": "StatusBaseText", "unnamed": 1, "visible": True}
|
||||||
mainWindow_createChannelOrCategoryBtn_StatusBaseText = {"container": mainWindow_communityColumnView_CommunityColumnView, "objectName": "createChannelOrCategoryBtn", "type": "StatusBaseText", "visible": True}
|
mainWindow_createChannelOrCategoryBtn_StatusBaseText = {"container": mainWindow_communityColumnView_CommunityColumnView, "objectName": "createChannelOrCategoryBtn", "type": "StatusBaseText", "visible": True}
|
||||||
|
|
|
@ -155,7 +155,7 @@ class CategoryItem:
|
||||||
|
|
||||||
def __init__(self, obj):
|
def __init__(self, obj):
|
||||||
self.object = obj
|
self.object = obj
|
||||||
self.category_name: typing.Optional[Image] = None
|
self._category_name: typing.Optional[Image] = None
|
||||||
self._add_category_button: typing.Optional[Button] = None
|
self._add_category_button: typing.Optional[Button] = None
|
||||||
self._more_button: typing.Optional[Button] = None
|
self._more_button: typing.Optional[Button] = None
|
||||||
self._arrow_button: typing.Optional[Button] = None
|
self._arrow_button: typing.Optional[Button] = None
|
||||||
|
@ -198,14 +198,19 @@ class LeftPanel(QObject):
|
||||||
self._members_text_label = TextLabel(communities_names.mainWindow_Members_TruncatedTextWithTooltip)
|
self._members_text_label = TextLabel(communities_names.mainWindow_Members_TruncatedTextWithTooltip)
|
||||||
self._general_channel_item = QObject(communities_names.scrollView_general_StatusChatListItem)
|
self._general_channel_item = QObject(communities_names.scrollView_general_StatusChatListItem)
|
||||||
self._add_channels_button = Button(communities_names.add_channels_StatusButton)
|
self._add_channels_button = Button(communities_names.add_channels_StatusButton)
|
||||||
self._channel_list_item = QObject(communities_names.channel_listItem)
|
|
||||||
self._channel_icon_template = QObject(communities_names.channel_identicon_StatusSmartIdenticon)
|
self._channel_icon_template = QObject(communities_names.channel_identicon_StatusSmartIdenticon)
|
||||||
self._channel_or_category_button = Button(
|
self._channel_or_category_button = Button(
|
||||||
communities_names.mainWindow_createChannelOrCategoryBtn_StatusBaseText)
|
communities_names.mainWindow_createChannelOrCategoryBtn_StatusBaseText)
|
||||||
self._create_channel_menu_item = Button(communities_names.create_channel_StatusMenuItem)
|
self._create_channel_menu_item = Button(communities_names.create_channel_StatusMenuItem)
|
||||||
self._create_category_menu_item = Button(communities_names.create_category_StatusMenuItem)
|
self._create_category_menu_item = Button(communities_names.create_category_StatusMenuItem)
|
||||||
self._join_community_button = Button(communities_names.mainWindow_Join_Community_StatusButton)
|
self._join_community_button = Button(communities_names.mainWindow_Join_Community_StatusButton)
|
||||||
self._categories_items_list = List(communities_names.scrollView_chatListItems_StatusListView)
|
|
||||||
|
self.communityChatListAndCategories = QObject(communities_names.communityChatListAndCategories)
|
||||||
|
self.channelAndCategoriesListItems = QObject(communities_names.channelAndCategoriesListItems)
|
||||||
|
self.chatListItems = QObject(communities_names.chatListItems)
|
||||||
|
self.chatListItemDropAreaItem = QObject(communities_names.chatListItemDropAreaItem)
|
||||||
|
self.categoryItemDropAreaItem = QObject(communities_names.categoryListItemDropAreaItem)
|
||||||
|
|
||||||
self._category_list_item = QObject(communities_names.categoryItem_StatusChatListCategoryItem)
|
self._category_list_item = QObject(communities_names.categoryItem_StatusChatListCategoryItem)
|
||||||
self._create_category_button = Button(communities_names.add_categories_StatusFlatButton)
|
self._create_category_button = Button(communities_names.add_categories_StatusFlatButton)
|
||||||
self._delete_category_item = QObject(communities_names.delete_Category_StatusMenuItem)
|
self._delete_category_item = QObject(communities_names.delete_Category_StatusMenuItem)
|
||||||
|
@ -241,7 +246,7 @@ class LeftPanel(QObject):
|
||||||
def channels(self) -> typing.List[UserChannel]:
|
def channels(self) -> typing.List[UserChannel]:
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
channels_list = []
|
channels_list = []
|
||||||
for obj in driver.findAllObjects(self._channel_list_item.real_name):
|
for obj in driver.findAllObjects(self.chatListItemDropAreaItem.real_name):
|
||||||
container = driver.objectMap.realName(obj)
|
container = driver.objectMap.realName(obj)
|
||||||
self._channel_icon_template.real_name['container'] = container
|
self._channel_icon_template.real_name['container'] = container
|
||||||
channels_list.append(UserChannel(
|
channels_list.append(UserChannel(
|
||||||
|
@ -254,7 +259,7 @@ class LeftPanel(QObject):
|
||||||
@property
|
@property
|
||||||
@allure.step('Get categories')
|
@allure.step('Get categories')
|
||||||
def categories_items(self) -> typing.List[CategoryItem]:
|
def categories_items(self) -> typing.List[CategoryItem]:
|
||||||
return [CategoryItem(item) for item in self._categories_items_list.items]
|
return [CategoryItem(item) for item in driver.findAllObjects(self.categoryItemDropAreaItem.real_name)]
|
||||||
|
|
||||||
@allure.step('Get arrow button rotation value')
|
@allure.step('Get arrow button rotation value')
|
||||||
def get_arrow_icon_rotation_value(self, category_name) -> int:
|
def get_arrow_icon_rotation_value(self, category_name) -> int:
|
||||||
|
@ -289,7 +294,8 @@ class LeftPanel(QObject):
|
||||||
|
|
||||||
@allure.step('Select channel')
|
@allure.step('Select channel')
|
||||||
def select_channel(self, name: str):
|
def select_channel(self, name: str):
|
||||||
for obj in driver.findAllObjects(self._channel_list_item.real_name):
|
time.sleep(3)
|
||||||
|
for obj in driver.findAllObjects(self.chatListItemDropAreaItem.real_name):
|
||||||
if str(obj.objectName) == name:
|
if str(obj.objectName) == name:
|
||||||
driver.mouseClick(obj)
|
driver.mouseClick(obj)
|
||||||
return obj
|
return obj
|
||||||
|
@ -302,7 +308,7 @@ class LeftPanel(QObject):
|
||||||
|
|
||||||
@allure.step('Open category context menu')
|
@allure.step('Open category context menu')
|
||||||
def open_category_context_menu(self):
|
def open_category_context_menu(self):
|
||||||
self._category_list_item.right_click()
|
self.categoryItemDropAreaItem.right_click()
|
||||||
|
|
||||||
@allure.step('Open create category popup')
|
@allure.step('Open create category popup')
|
||||||
def open_create_category_popup(self, attempts: int = 2) -> NewCategoryPopup:
|
def open_create_category_popup(self, attempts: int = 2) -> NewCategoryPopup:
|
||||||
|
@ -324,16 +330,14 @@ class LeftPanel(QObject):
|
||||||
|
|
||||||
@allure.step('Find category')
|
@allure.step('Find category')
|
||||||
def find_category_in_list(
|
def find_category_in_list(
|
||||||
self, category_name: str, timeout_sec: int = configs.timeouts.MESSAGING_TIMEOUT_SEC):
|
self, category_name: str):
|
||||||
started_at = time.monotonic()
|
time.sleep(1)
|
||||||
category = None
|
categories = self.categories_items
|
||||||
while category is None:
|
for _category in categories:
|
||||||
categories = self.categories_items
|
if _category.category_name == category_name:
|
||||||
for _category in categories:
|
category = _category
|
||||||
if _category.category_name == category_name:
|
return category
|
||||||
category = _category
|
raise LookupError(f'Category: {category_name} not found in {categories}')
|
||||||
assert time.monotonic() - started_at < timeout_sec, f'Category: {category_name} not found in {categories}'
|
|
||||||
return category
|
|
||||||
|
|
||||||
def click_category(self, category_name: str):
|
def click_category(self, category_name: str):
|
||||||
driver.mouseClick(self.find_category_in_list(category_name).object)
|
driver.mouseClick(self.find_category_in_list(category_name).object)
|
||||||
|
@ -376,7 +380,7 @@ class LeftPanel(QObject):
|
||||||
|
|
||||||
@allure.step('Get channel or category index in the list')
|
@allure.step('Get channel or category index in the list')
|
||||||
def get_channel_or_category_index(self, name: str) -> int:
|
def get_channel_or_category_index(self, name: str) -> int:
|
||||||
for child in walk_children(self._categories_items_list.object):
|
for child in walk_children(self.chatListItems.object):
|
||||||
if child.objectName == name:
|
if child.objectName == name:
|
||||||
return child.visualIndex
|
return child.visualIndex
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ class ChatView(QObject):
|
||||||
@allure.step('Get messages')
|
@allure.step('Get messages')
|
||||||
def messages(self, index: int) -> typing.List[Message]:
|
def messages(self, index: int) -> typing.List[Message]:
|
||||||
_messages = []
|
_messages = []
|
||||||
time.sleep(1)
|
time.sleep(2)
|
||||||
# message_list_item has different indexes if we run multiple instances, so we pass index
|
# message_list_item has different indexes if we run multiple instances, so we pass index
|
||||||
if index is not None:
|
if index is not None:
|
||||||
self._message_list_item.real_name['index'] = index
|
self._message_list_item.real_name['index'] = index
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
|
||||||
|
def remove_tags(html):
|
||||||
|
# parse html content
|
||||||
|
soup = BeautifulSoup(html, "html.parser")
|
||||||
|
|
||||||
|
for data in soup(['style', 'script']):
|
||||||
|
# Remove tags
|
||||||
|
data.decompose()
|
||||||
|
|
||||||
|
# return data by retrieving the tag content
|
||||||
|
return ' '.join(soup.stripped_strings)
|
|
@ -12,9 +12,6 @@ from . import marks
|
||||||
pytestmark = marks
|
pytestmark = marks
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703272', 'Member role cannot add category')
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703272', 'Member role cannot add category')
|
||||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703273', 'Member role cannot edit category')
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703273', 'Member role cannot edit category')
|
||||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703274', 'Member role cannot remove category')
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703274', 'Member role cannot remove category')
|
||||||
|
@ -53,7 +50,6 @@ def test_member_role_cannot_add_edit_or_delete_category(main_screen: MainWindow)
|
||||||
@pytest.mark.parametrize('category_name, general_checkbox',
|
@pytest.mark.parametrize('category_name, general_checkbox',
|
||||||
[pytest.param('Category in general', True)])
|
[pytest.param('Category in general', True)])
|
||||||
def test_clicking_community_category(main_screen: MainWindow, category_name, general_checkbox):
|
def test_clicking_community_category(main_screen: MainWindow, category_name, general_checkbox):
|
||||||
|
|
||||||
with step('Enable creation of community option'):
|
with step('Enable creation of community option'):
|
||||||
settings = main_screen.left_panel.open_settings()
|
settings = main_screen.left_panel.open_settings()
|
||||||
settings.left_panel.open_advanced_settings().enable_creation_of_communities()
|
settings.left_panel.open_advanced_settings().enable_creation_of_communities()
|
||||||
|
|
|
@ -12,6 +12,7 @@ from constants import UserAccount
|
||||||
from gui.components.context_menu import ContextMenu
|
from gui.components.context_menu import ContextMenu
|
||||||
from gui.main_window import MainWindow
|
from gui.main_window import MainWindow
|
||||||
from gui.screens.messages import MessagesScreen
|
from gui.screens.messages import MessagesScreen
|
||||||
|
from scripts.utils.parsers import remove_tags
|
||||||
from . import marks
|
from . import marks
|
||||||
|
|
||||||
pytestmark = marks
|
pytestmark = marks
|
||||||
|
@ -205,14 +206,15 @@ def test_view_and_post_in_non_restricted_channel(multiple_instances, user_data_o
|
||||||
main_screen.hide()
|
main_screen.hide()
|
||||||
|
|
||||||
with step(
|
with step(
|
||||||
f'User {user_one.name}, select non-restricted channel, verify that can view other messages and also can send message'):
|
f'User {user_one.name}, select non-restricted channel, verify that can view other messages and also '
|
||||||
|
f'can send message'):
|
||||||
aut_one.attach()
|
aut_one.attach()
|
||||||
main_screen.prepare()
|
main_screen.prepare()
|
||||||
community_screen = main_screen.left_panel.select_community('Community with 2 users')
|
community_screen = main_screen.left_panel.select_community('Community with 2 users')
|
||||||
community_screen.left_panel.select_channel(channel_name)
|
community_screen.left_panel.select_channel(channel_name)
|
||||||
messages_screen = MessagesScreen()
|
messages_screen = MessagesScreen()
|
||||||
message_object = messages_screen.chat.messages(0)[0]
|
message_object = messages_screen.chat.messages(0)[0]
|
||||||
assert 'Hi' in message_object.text, f"Message text is not found in last message"
|
assert 'Hi' in str(message_object.text), f"Message text is not found in last message"
|
||||||
message_text = "Hi hi"
|
message_text = "Hi hi"
|
||||||
messages_screen.group_chat.send_message_to_group_chat(message_text)
|
messages_screen.group_chat.send_message_to_group_chat(message_text)
|
||||||
main_screen.hide()
|
main_screen.hide()
|
||||||
|
@ -221,7 +223,7 @@ def test_view_and_post_in_non_restricted_channel(multiple_instances, user_data_o
|
||||||
aut_two.attach()
|
aut_two.attach()
|
||||||
main_screen.prepare()
|
main_screen.prepare()
|
||||||
message_object = messages_screen.chat.messages(0)[0]
|
message_object = messages_screen.chat.messages(0)[0]
|
||||||
assert driver.waitFor(lambda: 'Hi hi' in message_object.text,
|
assert driver.waitFor(lambda: 'Hi hi' in remove_tags(str(message_object.text)),
|
||||||
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f"Message text is not found in last message"
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f"Message text is not found in last message"
|
||||||
|
|
||||||
community_screen.delete_channel(channel_name)
|
community_screen.delete_channel(channel_name)
|
||||||
|
|
Loading…
Reference in New Issue