chore: duplicate permission step added to permission test
This commit is contained in:
parent
588be3c60e
commit
c71d11e990
|
@ -7,6 +7,7 @@ class PermissionsElements(Enum):
|
|||
WELCOME_CHECKLIST_ELEMENT_1 = 'Give individual members access to private channels'
|
||||
WELCOME_CHECKLIST_ELEMENT_2 = 'Monetise your community with subscriptions and fees'
|
||||
WELCOME_CHECKLIST_ELEMENT_3 = 'Require holding a token or NFT to obtain exclusive membership rights'
|
||||
DUPLICATE_WARNING = 'Permission with same properties is already active, edit properties to create a new permission.'
|
||||
|
||||
|
||||
class TokensElements(Enum):
|
||||
|
|
|
@ -183,10 +183,11 @@ inCommunityTagListItem = {"container": mainWindow_PermissionsView, "objectName":
|
|||
edit_pencil_icon_StatusIcon = {"container": mainWindow_PermissionsView, "objectName": "edit_pencil-icon", "type": "StatusIcon", "visible": True}
|
||||
delete_icon_StatusIcon = {"container": mainWindow_PermissionsView, "objectName": "delete-icon", "type": "StatusIcon", "visible": True}
|
||||
hide_icon_StatusIcon = {"container": mainWindow_PermissionsView, "objectName": "hide-icon", "type": "StatusIcon", "visible": True}
|
||||
copy_icon_StatusIcon = {"container": mainWindow_PermissionsView, "objectName": "copy-icon", "type": "StatusIcon", "visible": True}
|
||||
editPermissionView_settingsDirtyToastMessage_SettingsDirtyToastMessage = {"container": mainWindow_editPermissionView_EditPermissionView, "id": "settingsDirtyToastMessage", "type": "SettingsDirtyToastMessage", "unnamed": 1, "visible": True}
|
||||
update_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "type": "StatusButton", "unnamed": 1, "visible": True}
|
||||
isAllowedToEditPermissionView_StatusListItemTag = {"container": mainWindow_editPermissionView_EditPermissionView, "type": "StatusListItemTag", "unnamed": 1, "visible": True}
|
||||
memberRoleLimitWarning = {"container": mainWindow_editPermissionView_EditPermissionView, "id": "duplicationPanel", "type": "WarningPanel", "unnamed": 1, "visible": True}
|
||||
editPermissionView_duplicationPanel_WarningPanel = {"container": mainWindow_editPermissionView_EditPermissionView, "objectName": "duplicationPanel", "type": "WarningPanel", "visible": True}
|
||||
|
||||
# Edit Community
|
||||
mainWindow_communityEditPanelScrollView_EditSettingsPanel = {"container": statusDesktop_mainWindow, "objectName": "communityEditPanelScrollView", "type": "EditSettingsPanel", "visible": True}
|
||||
|
|
|
@ -372,6 +372,7 @@ class PermissionsIntroView(QObject):
|
|||
self._edit_permission_button = QObject(communities_names.edit_pencil_icon_StatusIcon)
|
||||
self._delete_permission_button = QObject(communities_names.delete_icon_StatusIcon)
|
||||
self._hide_icon = QObject(communities_names.hide_icon_StatusIcon)
|
||||
self._duplicate_icon = QObject(communities_names.copy_icon_StatusIcon)
|
||||
|
||||
@property
|
||||
@allure.step('Get hide icon visibility')
|
||||
|
@ -419,6 +420,11 @@ class PermissionsIntroView(QObject):
|
|||
def click_delete_permission(self):
|
||||
self._delete_permission_button.click()
|
||||
|
||||
@allure.step('Click duplicate permission button')
|
||||
def click_duplicate_permission(self):
|
||||
self._duplicate_icon.click()
|
||||
return PermissionsSettingsView().wait_until_appears()
|
||||
|
||||
|
||||
class PermissionsSettingsView(QObject):
|
||||
def __init__(self):
|
||||
|
@ -440,15 +446,18 @@ class PermissionsSettingsView(QObject):
|
|||
self._is_allowed_tag = QObject(communities_names.isAllowedTagListItem)
|
||||
self._in_community_in_channel_tag = QObject(communities_names.inCommunityTagListItem)
|
||||
self._is_allowed_to_edit_tag = QObject(communities_names.isAllowedToEditPermissionView_StatusListItemTag)
|
||||
self._member_role_limit_warning = QObject(communities_names.memberRoleLimitWarning)
|
||||
self._warning_panel = QObject(communities_names.editPermissionView_duplicationPanel_WarningPanel)
|
||||
|
||||
@allure.step('Verify member role limit warning is present')
|
||||
def is_member_role_warning_text_present(self):
|
||||
return self._member_role_limit_warning.exists
|
||||
@allure.step('Verify warning panel is present')
|
||||
def is_warning_text_present(self):
|
||||
return self._warning_panel.exists
|
||||
|
||||
@allure.step('Get warning text')
|
||||
def get_member_role_limit_warning_text(self):
|
||||
return str(self._member_role_limit_warning.object.text)
|
||||
@allure.step('Get text from warning panel')
|
||||
def get_warning_text(self):
|
||||
if self._warning_panel.exists:
|
||||
return self._warning_panel.object.text
|
||||
else:
|
||||
raise LookupError
|
||||
|
||||
@allure.step('Get titles of Who holds tags')
|
||||
def get_who_holds_tags_titles(self, attempt: int = 2) -> typing.List[str]:
|
||||
|
|
|
@ -3,15 +3,14 @@ import pytest
|
|||
from allure_commons._allure import step
|
||||
|
||||
import configs
|
||||
from gui.components.changes_detected_popup import PermissionsChangesDetectedToastMessage
|
||||
from gui.components.delete_popup import DeletePermissionPopup
|
||||
from gui.screens.community_settings import PermissionsIntroView
|
||||
from . import marks
|
||||
|
||||
import constants
|
||||
import driver
|
||||
from constants.community_settings import ToastMessages, LimitWarnings
|
||||
from constants.community_settings import ToastMessages, LimitWarnings, PermissionsElements
|
||||
from gui.components.changes_detected_popup import PermissionsChangesDetectedToastMessage
|
||||
from gui.components.delete_popup import DeletePermissionPopup
|
||||
from gui.main_window import MainWindow
|
||||
from gui.screens.community_settings import PermissionsIntroView
|
||||
from . import marks
|
||||
|
||||
pytestmark = marks
|
||||
|
||||
|
@ -182,6 +181,31 @@ def test_add_edit_and_remove_permissions(main_screen: MainWindow, params):
|
|||
assert ToastMessages.DELETE_PERMISSION_TOAST.value in messages, \
|
||||
f"Toast message is incorrect, current message is {message}"
|
||||
|
||||
with step('Create new permission'):
|
||||
new_permission_data = {
|
||||
'checkbox_state': True,
|
||||
'first_asset': 'ETH',
|
||||
'amount': '6',
|
||||
'allowed_to': 'becomeMember'
|
||||
}
|
||||
permissions_settings = permissions_intro_view.add_new_permission()
|
||||
permissions_settings.set_who_holds_checkbox_state(new_permission_data['checkbox_state'])
|
||||
permissions_settings.set_who_holds_asset_and_amount(new_permission_data['first_asset'],
|
||||
new_permission_data['amount'])
|
||||
permissions_settings.set_is_allowed_to(new_permission_data['allowed_to'])
|
||||
permissions_settings.create_permission()
|
||||
|
||||
with step('Duplicate created permission and verify correct duplicate warning appears'):
|
||||
permission_view = permissions_intro_view.click_duplicate_permission()
|
||||
assert permission_view.get_warning_text() == PermissionsElements.DUPLICATE_WARNING.value
|
||||
permissions_settings.set_who_holds_asset_and_amount('Aragon', '10')
|
||||
permissions_settings.create_permission()
|
||||
|
||||
with step('Duplicated permission is displayed on permission page'):
|
||||
assert driver.waitFor(
|
||||
lambda: '10 ANT' in permissions_settings.get_who_holds_tags_titles(),
|
||||
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('params', [constants.community_params])
|
||||
@pytest.mark.critical
|
||||
|
@ -270,7 +294,7 @@ def test_add_5_member_role_permissions(main_screen: MainWindow, params):
|
|||
extra_permission_data['amount'])
|
||||
permissions_settings.set_is_allowed_to(extra_permission_data['allowed_to'])
|
||||
|
||||
assert permissions_settings.is_member_role_warning_text_present(), 'Member role limit warning is not displayed'
|
||||
assert permissions_settings.get_member_role_limit_warning_text() \
|
||||
assert permissions_settings.is_warning_text_present(), 'Member role limit warning is not displayed'
|
||||
assert permissions_settings.get_warning_text() \
|
||||
== LimitWarnings.MEMBER_ROLE_LIMIT_WARNING.value, \
|
||||
f'Warning text about become a member limit reached is incorrect'
|
||||
|
|
|
@ -590,6 +590,7 @@ StatusScrollView {
|
|||
|
||||
WarningPanel {
|
||||
id: duplicationPanel
|
||||
objectName: "duplicationPanel"
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 50 // by desing
|
||||
|
|
Loading…
Reference in New Issue