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
|
2024-06-05 07:52:32 +00:00
|
|
|
import driver
|
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
|
|
|
|
2024-02-21 06:02:06 +00:00
|
|
|
pytestmark = marks
|
2023-12-06 12:00:09 +00:00
|
|
|
|
|
|
|
|
2024-02-21 06:02:06 +00:00
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703049', 'Create community channel')
|
2023-12-06 12:00:09 +00:00
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703050', 'Edit community channel')
|
2024-02-21 06:02:06 +00:00
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703051', 'Delete community channel')
|
|
|
|
@pytest.mark.case(703049, 703050, 703051)
|
|
|
|
@pytest.mark.parametrize(
|
2024-02-27 09:05:39 +00:00
|
|
|
'channel_name, channel_description, channel_emoji, channel_emoji_image, channel_color, new_channel_name, '
|
|
|
|
'new_channel_description, new_channel_emoji',
|
2024-02-21 06:02:06 +00:00
|
|
|
[('Channel', 'Description', 'sunglasses', None, '#4360df', 'New-channel', 'New channel description', 'thumbsup')])
|
2024-04-30 12:25:48 +00:00
|
|
|
# @pytest.mark.critical TODO: https://github.com/status-im/desktop-qa-automation/issues/658
|
2024-06-05 07:52:32 +00:00
|
|
|
def test_create_edit_remove_community_channel(main_screen, channel_name, channel_description, channel_emoji,
|
|
|
|
channel_emoji_image,
|
|
|
|
channel_color, new_channel_name, new_channel_description,
|
|
|
|
new_channel_emoji):
|
2024-05-03 09:36:51 +00:00
|
|
|
with step('Enable creation of community option'):
|
|
|
|
settings = main_screen.left_panel.open_settings()
|
|
|
|
settings.left_panel.open_advanced_settings().enable_creation_of_communities()
|
|
|
|
|
2023-12-12 14:05:33 +00:00
|
|
|
with step('Create simple community'):
|
2024-02-21 06:02:06 +00:00
|
|
|
community_params = constants.community_params
|
|
|
|
main_screen.create_community(community_params['name'], community_params['description'],
|
|
|
|
community_params['intro'], community_params['outro'],
|
|
|
|
community_params['logo']['fp'], community_params['banner']['fp'])
|
|
|
|
community_screen = main_screen.left_panel.select_community(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',
|
2024-04-30 12:25:48 +00:00
|
|
|
None
|
2023-12-06 12:00:09 +00:00
|
|
|
)
|
|
|
|
|
2024-02-21 06:02:06 +00:00
|
|
|
with step('Create new channel for recently created community'):
|
|
|
|
community_screen.create_channel(channel_name, channel_description, channel_emoji)
|
|
|
|
|
|
|
|
with step('Verify channel'):
|
|
|
|
community_screen.verify_channel(
|
|
|
|
channel_name,
|
|
|
|
channel_description,
|
2024-04-30 12:25:48 +00:00
|
|
|
channel_emoji_image
|
2024-02-21 06:02:06 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
with step('Edit channel'):
|
|
|
|
community_screen.edit_channel(channel_name, new_channel_name, new_channel_description, new_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'):
|
2024-02-21 06:02:06 +00:00
|
|
|
channel = community_screen.left_panel.get_channel_parameters(new_channel_name)
|
|
|
|
assert channel.name == new_channel_name
|
2023-12-08 07:20:15 +00:00
|
|
|
|
2023-12-12 14:05:33 +00:00
|
|
|
with step('Verify edited channel details are correct in community toolbar'):
|
2024-06-05 07:52:32 +00:00
|
|
|
assert driver.waitFor(lambda: community_screen.tool_bar.channel_name == new_channel_name,
|
|
|
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
|
2024-02-21 06:02:06 +00:00
|
|
|
assert community_screen.tool_bar.channel_description == new_channel_description
|
|
|
|
assert community_screen.tool_bar.channel_emoji == '👍 '
|
2023-12-08 07:20:15 +00:00
|
|
|
assert community_screen.tool_bar.channel_color == channel_color
|
2023-12-06 12:00:09 +00:00
|
|
|
|
|
|
|
with step('Delete channel'):
|
2024-02-21 06:02:06 +00:00
|
|
|
community_screen.delete_channel(new_channel_name)
|
|
|
|
|
|
|
|
with step('Delete general channel'):
|
2023-12-12 14:05:33 +00:00
|
|
|
community_screen.delete_channel('general')
|
2023-12-06 12:00:09 +00:00
|
|
|
|
2024-02-21 06:02:06 +00:00
|
|
|
with step('Verify channels list is empty'):
|
2023-12-13 08:20:56 +00:00
|
|
|
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')
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703270', 'Member role cannot edit channels')
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703271', 'Member role cannot delete channels')
|
2024-02-21 06:02:06 +00:00
|
|
|
@pytest.mark.case(703269, 703270, 703271)
|
2023-12-28 08:49:05 +00:00
|
|
|
@pytest.mark.parametrize('user_data', [configs.testpath.TEST_USER_DATA / 'squisher'])
|
2024-02-21 06:02:06 +00:00
|
|
|
def test_member_role_cannot_add_edit_and_delete_channels(main_screen: MainWindow):
|
2023-12-28 08:49:05 +00:00
|
|
|
with step('Choose community user is not owner of'):
|
2024-06-25 06:09:51 +00:00
|
|
|
community_screen = main_screen.left_panel.select_community('Community with 2 users')
|
2024-02-21 06:02:06 +00:00
|
|
|
with step('Verify that member cannot add new channel'):
|
|
|
|
with step('Verify that create channel or category button is not present'):
|
2024-03-22 12:01:38 +00:00
|
|
|
assert not community_screen.left_panel.does_create_channel_or_category_button_exist()
|
2024-02-21 06:02:06 +00:00
|
|
|
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'):
|
2024-02-27 09:05:39 +00:00
|
|
|
assert ContextMenu().is_visible is False, \
|
|
|
|
f"Context menu should not appear"
|
2024-02-21 06:02:06 +00:00
|
|
|
|
|
|
|
with step('Verify that member cannot edit and delete channel'):
|
|
|
|
with step('Right-click on general channel in the left navigation bar'):
|
2024-02-27 09:05:39 +00:00
|
|
|
general_channel_context_menu = community_screen.left_panel.open_general_channel_context_menu()
|
|
|
|
with step('Verify that edit item is not present in channel context menu'):
|
|
|
|
assert general_channel_context_menu.is_edit_channel_option_present() is False, \
|
|
|
|
f'Edit channel option is present when it should not'
|
|
|
|
with step('Verify that delete item is not present in channel context menu'):
|
|
|
|
assert general_channel_context_menu.is_delete_channel_option_present() is False, \
|
|
|
|
f'Delete channel option is present when it should not'
|
|
|
|
|
|
|
|
with step('Open context menu from the tool bar'):
|
|
|
|
more_options = community_screen.tool_bar.open_more_options_dropdown()
|
2024-02-21 06:02:06 +00:00
|
|
|
with step('Verify that edit item is not present in context menu'):
|
2024-02-27 09:05:39 +00:00
|
|
|
assert more_options.is_edit_channel_option_present() is False, \
|
|
|
|
f'Edit channel option is present when it should not'
|
2024-02-21 06:02:06 +00:00
|
|
|
with step('Verify that delete item is not present in context menu'):
|
2024-02-27 09:05:39 +00:00
|
|
|
assert more_options.is_delete_channel_option_present() is False, \
|
|
|
|
f'Delete channel option is present when it should not'
|