@bigbinary/neeto-playwright-commons 1.26.3 → 1.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +16 -6
- package/index.cjs.js.map +1 -1
- package/index.d.ts +31 -6
- package/index.js +16 -6
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -5217,6 +5217,7 @@ const ROLES_SELECTORS = {
|
|
|
5217
5217
|
roleCell: (roleName) => `${neetoCist.hyphenate(roleName)}-role-cell`,
|
|
5218
5218
|
tablePermissionCheckbox: "ntm-roles-table-permission-checkbox",
|
|
5219
5219
|
descriptionInputError: "description-input-error",
|
|
5220
|
+
permissionSubCategoryCard: (index) => `ntm-roles-permission-sub-category-card-${index}`,
|
|
5220
5221
|
};
|
|
5221
5222
|
|
|
5222
5223
|
const SIGNUP_SELECTORS = {
|
|
@@ -118689,12 +118690,12 @@ class RolesPage {
|
|
|
118689
118690
|
const [{ roleId }, { roleId: secondaryRoleId }] = await Promise.all([roleName, secondaryRoleName].map(this.getRoleIdAndOrganizationId));
|
|
118690
118691
|
return this.roleApis.deleteRole(roleId, secondaryRoleId);
|
|
118691
118692
|
};
|
|
118692
|
-
this.addRoleViaUI = async ({ roleName, permissions }) => {
|
|
118693
|
+
this.addRoleViaUI = async ({ roleName, permissions, parentPermission = "", hierarchyLevelOfPermissions = 2, }) => {
|
|
118693
118694
|
await this.page.getByTestId(ROLES_SELECTORS.newButton).click();
|
|
118694
118695
|
await this.page.getByTestId(ROLES_SELECTORS.nameTextField).fill(roleName);
|
|
118695
|
-
await this.selectAndSubmitPermissions(permissions);
|
|
118696
|
+
await this.selectAndSubmitPermissions(permissions, parentPermission, hierarchyLevelOfPermissions);
|
|
118696
118697
|
};
|
|
118697
|
-
this.editRoleViaUI = async ({ roleName, permissions }) => {
|
|
118698
|
+
this.editRoleViaUI = async ({ roleName, permissions, parentPermission = "", hierarchyLevelOfPermissions = 2, }) => {
|
|
118698
118699
|
await this.page
|
|
118699
118700
|
.getByTestId(ROLES_SELECTORS.tableHeaderRoleName)
|
|
118700
118701
|
.filter({ hasText: roleName })
|
|
@@ -118702,11 +118703,20 @@ class RolesPage {
|
|
|
118702
118703
|
.click();
|
|
118703
118704
|
await this.page.getByTestId(ROLES_SELECTORS.editRoleButton).click();
|
|
118704
118705
|
await test.expect(this.page.getByTestId(ROLES_SELECTORS.updateRolePaneHeading)).toBeVisible();
|
|
118705
|
-
await this.selectAndSubmitPermissions(permissions);
|
|
118706
|
+
await this.selectAndSubmitPermissions(permissions, parentPermission, hierarchyLevelOfPermissions);
|
|
118706
118707
|
};
|
|
118707
|
-
this.selectAndSubmitPermissions = async (permissions) => {
|
|
118708
|
+
this.selectAndSubmitPermissions = async (permissions, parentPermission = "", hierarchyLevelOfPermissions = 2) => {
|
|
118709
|
+
const parentPermissionSelector = parentPermission
|
|
118710
|
+
? this.page
|
|
118711
|
+
.getByTestId(ROLES_SELECTORS.permissionSubCategoryCard(hierarchyLevelOfPermissions - 1))
|
|
118712
|
+
.filter({ hasText: parentPermission })
|
|
118713
|
+
: this.page;
|
|
118714
|
+
parentPermission &&
|
|
118715
|
+
(await parentPermissionSelector
|
|
118716
|
+
.getByTestId(COMMON_SELECTORS.customCheckboxLabel(parentPermission))
|
|
118717
|
+
.click({ force: true }));
|
|
118708
118718
|
for (const permission of permissions) {
|
|
118709
|
-
await
|
|
118719
|
+
await parentPermissionSelector
|
|
118710
118720
|
.getByTestId(COMMON_SELECTORS.customCheckboxLabel(permission))
|
|
118711
118721
|
.click({ force: true }); // Used force: true because disabling the parent permission disables the child permissions means the checkboxes label become disable
|
|
118712
118722
|
}
|