test: test clicking category added
This commit is contained in:
parent
1d09ffba48
commit
a529dd04b7
|
@ -36,7 +36,7 @@ community_params = {
|
|||
}
|
||||
|
||||
UserCommunityInfo = namedtuple('CommunityInfo', ['name', 'description', 'members', 'image'])
|
||||
UserChannel = namedtuple('Channel', ['name', 'selected'])
|
||||
UserChannel = namedtuple('Channel', ['name', 'selected', 'visible'])
|
||||
|
||||
account_list_item = namedtuple('AccountListItem', ['name', 'color', 'emoji'])
|
||||
wallet_account_list_item = namedtuple('WalletAccountListItem', ['name', 'icon_color', 'icon_emoji', 'object'])
|
||||
|
|
|
@ -153,6 +153,7 @@ class CategoryItem:
|
|||
self._add_category_button: typing.Optional[Button] = None
|
||||
self._more_button: typing.Optional[Button] = None
|
||||
self._arrow_button: typing.Optional[Button] = None
|
||||
self._arrow_icon: typing.Optional[QObject] = None
|
||||
self.init_ui()
|
||||
|
||||
def __repr__(self):
|
||||
|
@ -168,11 +169,17 @@ class CategoryItem:
|
|||
self._more_button = Button(name='', real_name=driver.objectMap.realName(child))
|
||||
elif str(getattr(child, 'id', '')) == 'toggleButton':
|
||||
self._arrow_button = Button(name='', real_name=driver.objectMap.realName(child))
|
||||
elif str(getattr(child, 'objectName', '')) == 'chevron-down-icon':
|
||||
self._arrow_icon = QObject(name='', real_name=driver.objectMap.realName(child))
|
||||
|
||||
@allure.step('Click arrow button')
|
||||
def click_arrow_button(self):
|
||||
self._arrow_button.click()
|
||||
|
||||
@allure.step('Get arrow button rotation value')
|
||||
def get_arrow_icon_rotation_value(self) -> int:
|
||||
return self._arrow_icon.object.rotation
|
||||
|
||||
|
||||
class LeftPanel(QObject):
|
||||
|
||||
|
@ -229,7 +236,8 @@ class LeftPanel(QObject):
|
|||
self._channel_icon_template.real_name['container'] = container
|
||||
channels_list.append(UserChannel(
|
||||
str(obj.objectName),
|
||||
obj.item.selected
|
||||
obj.item.selected,
|
||||
obj.item.visible
|
||||
))
|
||||
return channels_list
|
||||
|
||||
|
@ -238,6 +246,11 @@ class LeftPanel(QObject):
|
|||
def categories_items(self) -> typing.List[CategoryItem]:
|
||||
return [CategoryItem(item) for item in self._categories_items_list.items]
|
||||
|
||||
@allure.step('Get arrow button rotation value')
|
||||
def get_arrow_icon_rotation_value(self, category_name) -> int:
|
||||
category = self.find_category_in_list(category_name)
|
||||
return int(category.get_arrow_icon_rotation_value())
|
||||
|
||||
@allure.step('Get channel params')
|
||||
def get_channel_parameters(self, name) -> UserChannel:
|
||||
for channel in self.channels:
|
||||
|
@ -315,6 +328,9 @@ class LeftPanel(QObject):
|
|||
assert time.monotonic() - started_at < timeout_sec, f'Category: {category_name} not found in {categories}'
|
||||
return category
|
||||
|
||||
def click_category(self, category_name: str):
|
||||
driver.mouseClick(self.find_category_in_list(category_name).object)
|
||||
|
||||
@allure.step('Open more options')
|
||||
def open_more_options(self):
|
||||
self._arrow_button.click()
|
||||
|
|
|
@ -4,7 +4,6 @@ from allure_commons._allure import step
|
|||
|
||||
import configs
|
||||
import constants
|
||||
from gui.components.community.community_category_popup import EditCategoryPopup, CategoryPopup
|
||||
from gui.components.context_menu import ContextMenu
|
||||
from gui.main_window import MainWindow
|
||||
from . import marks
|
||||
|
@ -142,3 +141,43 @@ def test_member_role_cannot_delete_category(main_screen: MainWindow):
|
|||
assert not ContextMenu().is_visible
|
||||
with step('Verify that delete item is not present in more options context menu'):
|
||||
assert not community_screen.left_panel.open_more_options().is_delete_item_visible()
|
||||
|
||||
|
||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704622', 'Community category clicking')
|
||||
@pytest.mark.case(704622)
|
||||
@pytest.mark.parametrize('category_name, general_checkbox',
|
||||
[pytest.param('Category in general', True)])
|
||||
def test_clicking_community_category(main_screen: MainWindow, category_name, general_checkbox):
|
||||
with step('Create community and select it'):
|
||||
main_screen.create_community(constants.community_params)
|
||||
community_screen = main_screen.left_panel.select_community(constants.community_params['name'])
|
||||
|
||||
with step('Create community category and verify that it displays correctly'):
|
||||
community_screen.create_category(category_name, general_checkbox)
|
||||
community_screen.verify_category(category_name)
|
||||
|
||||
with step('Verify that general channel is listed inside category'):
|
||||
assert community_screen.left_panel.get_channel_or_category_index('general') == 1
|
||||
|
||||
with step('Verify that general channel is visible and toggle button has down direction'):
|
||||
general_channel = community_screen.left_panel.get_channel_parameters('general')
|
||||
assert general_channel.visible
|
||||
assert community_screen.left_panel.get_arrow_icon_rotation_value(category_name) == 0
|
||||
|
||||
with step('Click added category'):
|
||||
community_screen.left_panel.click_category(category_name)
|
||||
|
||||
with step('Verify that general channel is not visible and toggle button has right direction'):
|
||||
general_channel = community_screen.left_panel.get_channel_parameters('general')
|
||||
assert not general_channel.visible
|
||||
assert community_screen.left_panel.get_arrow_icon_rotation_value(category_name) == 270
|
||||
|
||||
with step(
|
||||
'Click open more options button and verify that toggle button has down direction'):
|
||||
community_screen.left_panel.open_more_options()
|
||||
# rotation should be 0 here, because we click arrow button before open more options, otherwise it doesn't see it
|
||||
assert community_screen.left_panel.get_arrow_icon_rotation_value(category_name) == 0
|
||||
|
||||
with step('Click plus button and verify that toggle button has down direction'):
|
||||
community_screen.left_panel._add_channel_inside_category_item.click()
|
||||
assert community_screen.left_panel.get_arrow_icon_rotation_value(category_name) == 0
|
||||
|
|
Loading…
Reference in New Issue