2023-10-11 12:00:17 +00:00
|
|
|
import allure
|
|
|
|
import pytest
|
|
|
|
from allure_commons._allure import step
|
2023-12-28 16:22:50 +00:00
|
|
|
|
2024-02-16 06:33:56 +00:00
|
|
|
import configs
|
2024-06-19 05:19:44 +00:00
|
|
|
import constants
|
|
|
|
import driver
|
2024-08-15 14:31:23 +00:00
|
|
|
from constants.community_settings import LimitWarnings
|
2024-06-19 05:19:44 +00:00
|
|
|
from gui.main_window import MainWindow
|
2023-12-07 16:47:34 +00:00
|
|
|
from . import marks
|
2023-10-11 12:00:17 +00:00
|
|
|
|
2023-12-07 16:47:34 +00:00
|
|
|
pytestmark = marks
|
2023-10-11 12:00:17 +00:00
|
|
|
|
|
|
|
|
2024-08-15 14:31:23 +00:00
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/739309',
|
|
|
|
'Can create up to 5 member role permissions')
|
|
|
|
@pytest.mark.case(739309)
|
2024-03-29 14:49:05 +00:00
|
|
|
@pytest.mark.parametrize('params', [constants.community_params])
|
|
|
|
def test_add_5_member_role_permissions(main_screen: MainWindow, params):
|
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()
|
|
|
|
|
2024-03-29 14:49:05 +00:00
|
|
|
main_screen.create_community(params['name'], params['description'],
|
|
|
|
params['intro'], params['outro'],
|
|
|
|
params['logo']['fp'], params['banner']['fp'])
|
|
|
|
|
|
|
|
permission_data = [
|
|
|
|
{
|
|
|
|
'checkbox_state': True,
|
|
|
|
'first_asset': 'Dai Stablecoin',
|
|
|
|
'amount': '1',
|
|
|
|
'allowed_to': 'becomeMember',
|
|
|
|
'asset_title': '1 DAI',
|
|
|
|
'allowed_to_title': 'Become member'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'checkbox_state': True,
|
|
|
|
'first_asset': 'Aragon',
|
|
|
|
'amount': '2',
|
|
|
|
'allowed_to': 'becomeMember',
|
|
|
|
'asset_title': '2 ANT',
|
|
|
|
'allowed_to_title': 'Become member'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'checkbox_state': True,
|
|
|
|
'first_asset': '1inch',
|
|
|
|
'amount': '3',
|
|
|
|
'allowed_to': 'becomeMember',
|
|
|
|
'asset_title': '3 1INCH',
|
|
|
|
'allowed_to_title': 'Become member'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'checkbox_state': True,
|
|
|
|
'first_asset': 'ABYSS',
|
|
|
|
'amount': '4',
|
|
|
|
'allowed_to': 'becomeMember',
|
|
|
|
'asset_title': '4 ABYSS',
|
|
|
|
'allowed_to_title': 'Become member'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'checkbox_state': True,
|
|
|
|
'first_asset': 'Bytom',
|
|
|
|
'amount': '5',
|
|
|
|
'allowed_to': 'becomeMember',
|
|
|
|
'asset_title': '5 BTM',
|
|
|
|
'allowed_to_title': 'Become member'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
with step('Open add new permission page'):
|
|
|
|
community_screen = main_screen.left_panel.select_community(params['name'])
|
|
|
|
community_setting = community_screen.left_panel.open_community_settings()
|
|
|
|
permissions_intro_view = community_setting.left_panel.open_permissions()
|
|
|
|
|
|
|
|
with step('Create new permission'):
|
|
|
|
for index, item in enumerate(permission_data):
|
|
|
|
permissions_settings = permissions_intro_view.add_new_permission()
|
|
|
|
permissions_settings.set_who_holds_checkbox_state(permission_data[index]['checkbox_state'])
|
|
|
|
permissions_settings.set_who_holds_asset_and_amount(permission_data[index]['first_asset'],
|
|
|
|
permission_data[index]['amount'])
|
|
|
|
permissions_settings.set_is_allowed_to(permission_data[index]['allowed_to'])
|
|
|
|
permissions_settings.create_permission()
|
|
|
|
|
|
|
|
with step('Created permission is displayed on permission page'):
|
|
|
|
if permission_data[index]['asset_title'] is not False:
|
|
|
|
assert driver.waitFor(
|
|
|
|
lambda: permission_data[index]['asset_title'] in permissions_settings.get_who_holds_tags_titles(),
|
|
|
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
|
|
|
|
|
|
|
|
with step('Open form to create 6th member role permission and validate it is not allowed'):
|
|
|
|
extra_permission_data = {
|
|
|
|
'checkbox_state': True,
|
|
|
|
'first_asset': 'Bytom',
|
|
|
|
'amount': '6',
|
|
|
|
'allowed_to': 'becomeMember'
|
|
|
|
}
|
|
|
|
permissions_settings = permissions_intro_view.add_new_permission()
|
|
|
|
permissions_settings.set_who_holds_checkbox_state(extra_permission_data['checkbox_state'])
|
|
|
|
permissions_settings.set_who_holds_asset_and_amount(extra_permission_data['first_asset'],
|
|
|
|
extra_permission_data['amount'])
|
|
|
|
permissions_settings.set_is_allowed_to(extra_permission_data['allowed_to'])
|
|
|
|
|
2024-06-19 05:19:44 +00:00
|
|
|
assert permissions_settings.is_warning_text_present(), 'Member role limit warning is not displayed'
|
|
|
|
assert permissions_settings.get_warning_text() \
|
2024-03-29 14:49:05 +00:00
|
|
|
== LimitWarnings.MEMBER_ROLE_LIMIT_WARNING.value, \
|
|
|
|
f'Warning text about become a member limit reached is incorrect'
|