2023-12-06 12:00:09 +00:00
|
|
|
import allure
|
|
|
|
import pytest
|
|
|
|
from allure_commons._allure import step
|
|
|
|
|
2023-12-28 08:49:05 +00:00
|
|
|
import configs
|
2023-12-06 12:00:09 +00:00
|
|
|
import constants
|
2023-12-28 08:49:05 +00:00
|
|
|
from gui.components.context_menu import ContextMenu
|
2023-12-06 12:00:09 +00:00
|
|
|
from gui.main_window import MainWindow
|
2023-12-13 16:16:35 +00:00
|
|
|
from . import marks
|
2023-12-06 12:00:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703049', 'Create community channel')
|
|
|
|
@pytest.mark.case(703049)
|
2023-12-08 07:20:15 +00:00
|
|
|
@pytest.mark.parametrize('channel_name, channel_description, channel_emoji, channel_emoji_image, channel_color',
|
|
|
|
[('Channel', 'Description', 'sunglasses', '😎', '#4360df')])
|
|
|
|
def test_create_community_channel(main_screen: MainWindow, channel_name, channel_description, channel_emoji,
|
|
|
|
channel_emoji_image, channel_color):
|
2024-02-19 13:27:54 +00:00
|
|
|
main_screen.create_community(constants.community_params['name'], constants.community_params['description'],
|
|
|
|
constants.community_params['intro'], constants.community_params['outro'],
|
|
|
|
constants.community_params['logo']['fp'], constants.community_params['banner']['fp'])
|
2023-12-06 12:00:09 +00:00
|
|
|
community_screen = main_screen.left_panel.select_community(constants.community_params['name'])
|
|
|
|
community_screen.create_channel(channel_name, channel_description, channel_emoji)
|
|
|
|
|
|
|
|
with step('Verify channel'):
|
|
|
|
community_screen.verify_channel(
|
|
|
|
channel_name,
|
|
|
|
channel_description,
|
2023-12-08 07:20:15 +00:00
|
|
|
channel_emoji_image,
|
|
|
|
channel_color
|
2023-12-06 12:00:09 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703050', 'Edit community channel')
|
|
|
|
@pytest.mark.case(703050)
|
2023-12-08 07:20:15 +00:00
|
|
|
@pytest.mark.parametrize('channel_name, channel_description, channel_emoji, channel_emoji_image, channel_color',
|
|
|
|
[('Channel', 'Description', 'sunglasses', None, '#4360df')])
|
|
|
|
def test_edit_community_channel(main_screen, channel_name, channel_description, channel_emoji, channel_emoji_image,
|
|
|
|
channel_color):
|
2023-12-12 14:05:33 +00:00
|
|
|
with step('Create simple community'):
|
2024-02-19 13:27:54 +00:00
|
|
|
main_screen.create_community(constants.community_params['name'], constants.community_params['description'],
|
|
|
|
constants.community_params['intro'], constants.community_params['outro'],
|
|
|
|
constants.community_params['logo']['fp'],
|
|
|
|
constants.community_params['banner']['fp'])
|
2023-12-12 14:05:33 +00:00
|
|
|
community_screen = main_screen.left_panel.select_community(constants.community_params['name'])
|
2023-12-06 12:00:09 +00:00
|
|
|
|
2023-12-12 14:05:33 +00:00
|
|
|
with step('Verify General channel is present for recently created community'):
|
2023-12-06 12:00:09 +00:00
|
|
|
community_screen.verify_channel(
|
|
|
|
'general',
|
|
|
|
'General channel for the community',
|
2023-12-08 07:20:15 +00:00
|
|
|
None,
|
|
|
|
channel_color
|
2023-12-06 12:00:09 +00:00
|
|
|
)
|
|
|
|
|
2023-12-12 14:05:33 +00:00
|
|
|
with step('Edit general channel'):
|
|
|
|
community_screen.edit_channel('general', channel_name, channel_description, channel_emoji)
|
2023-12-06 12:00:09 +00:00
|
|
|
|
2023-12-12 14:05:33 +00:00
|
|
|
with step('Verify edited channel details are correct in channels list'):
|
2023-12-08 07:20:15 +00:00
|
|
|
channel = community_screen.left_panel.get_channel_parameters(channel_name)
|
|
|
|
assert channel.name == channel_name
|
|
|
|
assert channel.selected
|
|
|
|
|
2023-12-12 14:05:33 +00:00
|
|
|
with step('Verify edited channel details are correct in community toolbar'):
|
2023-12-08 07:20:15 +00:00
|
|
|
assert community_screen.tool_bar.channel_name == channel_name
|
|
|
|
assert community_screen.tool_bar.channel_description == channel_description
|
|
|
|
assert community_screen.tool_bar.channel_emoji == '😎 '
|
|
|
|
assert community_screen.tool_bar.channel_color == channel_color
|
2023-12-06 12:00:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703051', 'Delete community channel')
|
|
|
|
@pytest.mark.case(703051)
|
|
|
|
def test_delete_community_channel(main_screen):
|
2023-12-12 14:05:33 +00:00
|
|
|
with step('Create simple community'):
|
2024-02-19 13:27:54 +00:00
|
|
|
main_screen.create_community(constants.community_params['name'], constants.community_params['description'],
|
|
|
|
constants.community_params['intro'], constants.community_params['outro'],
|
|
|
|
constants.community_params['logo']['fp'],
|
|
|
|
constants.community_params['banner']['fp'])
|
2023-12-12 14:05:33 +00:00
|
|
|
community_screen = main_screen.left_panel.select_community(constants.community_params['name'])
|
2023-12-06 12:00:09 +00:00
|
|
|
|
|
|
|
with step('Delete channel'):
|
2023-12-12 14:05:33 +00:00
|
|
|
community_screen.delete_channel('general')
|
2023-12-06 12:00:09 +00:00
|
|
|
|
2023-12-13 08:20:56 +00:00
|
|
|
with step('Verify channel list is empty'):
|
|
|
|
assert len(community_screen.left_panel.channels) == 0
|
2023-12-28 08:49:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703269', 'Member role cannot add channels')
|
|
|
|
@pytest.mark.case(703269)
|
|
|
|
@pytest.mark.parametrize('user_data', [configs.testpath.TEST_USER_DATA / 'squisher'])
|
|
|
|
def test_member_role_cannot_add_channels(main_screen: MainWindow):
|
|
|
|
with step('Choose community user is not owner of'):
|
|
|
|
community_screen = main_screen.left_panel.select_community('Super community')
|
|
|
|
with step('Verify that create channel or category button is not present'):
|
|
|
|
assert not community_screen.left_panel.is_create_channel_or_category_button_visible()
|
|
|
|
with step('Verify that add channel button is not present'):
|
|
|
|
assert not community_screen.left_panel.is_add_channels_button_visible()
|
|
|
|
with step('Right-click a channel on the left navigation bar'):
|
|
|
|
community_screen.left_panel.right_click_on_panel()
|
|
|
|
with step('Verify that context menu does not appear'):
|
|
|
|
assert not ContextMenu().is_visible
|
|
|
|
|
|
|
|
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703270', 'Member role cannot edit channels')
|
|
|
|
@pytest.mark.case(703270)
|
|
|
|
@pytest.mark.parametrize('user_data', [configs.testpath.TEST_USER_DATA / 'squisher'])
|
|
|
|
def test_member_role_cannot_edit_channels(main_screen: MainWindow):
|
|
|
|
with step('Choose community user is not owner of'):
|
|
|
|
community_screen = main_screen.left_panel.select_community('Super community')
|
|
|
|
with step('Right-click on general channel in the left navigation bar'):
|
|
|
|
community_screen.left_panel.open_general_channel_context_menu()
|
|
|
|
with step('Verify that edit item is not present in context menu'):
|
|
|
|
assert not community_screen.tool_bar.is_edit_item_visible()
|
|
|
|
with step('Open more options context menu'):
|
|
|
|
more_options_dropdown = community_screen.tool_bar.open_more_options_dropdown()
|
|
|
|
with step('Verify that edit item is not present in context menu'):
|
|
|
|
assert not more_options_dropdown.is_edit_item_visible()
|
|
|
|
|
|
|
|
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703271', 'Member role cannot delete channels')
|
|
|
|
@pytest.mark.case(703271)
|
|
|
|
@pytest.mark.parametrize('user_data', [configs.testpath.TEST_USER_DATA / 'squisher'])
|
|
|
|
def test_member_role_cannot_delete_channels(main_screen: MainWindow):
|
|
|
|
with step('Choose community user is not owner of'):
|
|
|
|
community_screen = main_screen.left_panel.select_community('Super community')
|
|
|
|
with step('Right-click on general channel in the left navigation bar'):
|
|
|
|
community_screen.left_panel.open_general_channel_context_menu()
|
|
|
|
with step('Verify that delete item is not present in context menu'):
|
|
|
|
assert not community_screen.tool_bar.is_delete_item_visible()
|
|
|
|
with step('Open more options context menu'):
|
|
|
|
more_options_dropdown = community_screen.tool_bar.open_more_options_dropdown()
|
|
|
|
with step('Verify that delete item is not present in context menu'):
|
|
|
|
assert not more_options_dropdown.is_delete_item_visible()
|