@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.d.ts
CHANGED
|
@@ -4371,6 +4371,8 @@ declare class IPRestrictionsPage {
|
|
|
4371
4371
|
interface RoleDetails {
|
|
4372
4372
|
roleName: string;
|
|
4373
4373
|
permissions: string[];
|
|
4374
|
+
parentPermission?: string;
|
|
4375
|
+
hierarchyLevelOfPermissions?: number;
|
|
4374
4376
|
}
|
|
4375
4377
|
declare class RolesPage {
|
|
4376
4378
|
page: Page;
|
|
@@ -4431,17 +4433,25 @@ declare class RolesPage {
|
|
|
4431
4433
|
*
|
|
4432
4434
|
* permissions (required): Array of permission names to assign.
|
|
4433
4435
|
*
|
|
4436
|
+
* parentPermission (optional): The parent permission name. Required when selecting nested permissions. Default is an empty string.
|
|
4437
|
+
*
|
|
4438
|
+
* hierarchyLevelOfPermissions (optional): Hierarchy level of the permissions passed in the array. Calculate the hierarchy level from permission name as 0, then category as 1 and subcategory as 2 and so on. Default is 2.
|
|
4439
|
+
*
|
|
4434
4440
|
* @example
|
|
4435
4441
|
*
|
|
4436
4442
|
* await rolesPage.addRoleViaUI({
|
|
4437
4443
|
* roleName: "Custom Role",
|
|
4438
|
-
* permissions: ["
|
|
4444
|
+
* permissions: [ "Reminder of host", "Stripe standard integration", "iCloud calendar" ],
|
|
4445
|
+
* parentPermission: "Manage all hosts settings",
|
|
4446
|
+
* hierarchyLevelOfPermissions: 2,
|
|
4439
4447
|
* });
|
|
4440
4448
|
* @endexample
|
|
4441
4449
|
*/
|
|
4442
4450
|
addRoleViaUI: ({
|
|
4443
4451
|
roleName,
|
|
4444
|
-
permissions
|
|
4452
|
+
permissions,
|
|
4453
|
+
parentPermission,
|
|
4454
|
+
hierarchyLevelOfPermissions
|
|
4445
4455
|
}: RoleDetails) => Promise<void>;
|
|
4446
4456
|
/**
|
|
4447
4457
|
*
|
|
@@ -4451,17 +4461,25 @@ declare class RolesPage {
|
|
|
4451
4461
|
*
|
|
4452
4462
|
* permissions (required): Array of permission names to update.
|
|
4453
4463
|
*
|
|
4464
|
+
* parentPermission (optional): The parent permission name. Required when selecting nested permissions. Default is an empty string.
|
|
4465
|
+
*
|
|
4466
|
+
* hierarchyLevelOfPermissions (optional): Hierarchy level of the permissions passed in the array. Calculate the hierarchy level from permission name as 0, then category as 1 and subcategory as 2 and so on. Default is 2.
|
|
4467
|
+
*
|
|
4454
4468
|
* @example
|
|
4455
4469
|
*
|
|
4456
4470
|
* await rolesPage.editRoleViaUI({
|
|
4457
4471
|
* roleName: "Custom Role",
|
|
4458
|
-
* permissions: ["
|
|
4472
|
+
* permissions: [ "Reminder of host", "Stripe standard integration", "iCloud calendar" ],
|
|
4473
|
+
* parentPermission: "Manage all hosts settings",
|
|
4474
|
+
* hierarchyLevelOfPermissions: 2,
|
|
4459
4475
|
* });
|
|
4460
4476
|
* @endexample
|
|
4461
4477
|
*/
|
|
4462
4478
|
editRoleViaUI: ({
|
|
4463
4479
|
roleName,
|
|
4464
|
-
permissions
|
|
4480
|
+
permissions,
|
|
4481
|
+
parentPermission,
|
|
4482
|
+
hierarchyLevelOfPermissions
|
|
4465
4483
|
}: RoleDetails) => Promise<void>;
|
|
4466
4484
|
/**
|
|
4467
4485
|
*
|
|
@@ -4469,12 +4487,16 @@ declare class RolesPage {
|
|
|
4469
4487
|
*
|
|
4470
4488
|
* permissions (required): Array of permission names to select.
|
|
4471
4489
|
*
|
|
4490
|
+
* parentPermission (optional): The parent permission name. Required when selecting nested permissions. Default is an empty string.
|
|
4491
|
+
*
|
|
4492
|
+
* hierarchyLevelOfPermissions (optional): Hierarchy level of the permissions passed in the array. Calculate the hierarchy level from permission name as 0, then category as 1 and subcategory as 2 and so on. Default is 2.
|
|
4493
|
+
*
|
|
4472
4494
|
* @example
|
|
4473
4495
|
*
|
|
4474
|
-
* await rolesPage.selectAndSubmitPermissions(["
|
|
4496
|
+
* await rolesPage.selectAndSubmitPermissions([ "Reminder of host", "Stripe standard integration", "iCloud calendar" ], "Manage all hosts settings", 2 );
|
|
4475
4497
|
* @endexample
|
|
4476
4498
|
*/
|
|
4477
|
-
selectAndSubmitPermissions: (permissions: string[]) => Promise<void>;
|
|
4499
|
+
selectAndSubmitPermissions: (permissions: string[], parentPermission?: string, hierarchyLevelOfPermissions?: number) => Promise<void>;
|
|
4478
4500
|
/**
|
|
4479
4501
|
*
|
|
4480
4502
|
* Used to delete a role through the UI.
|
|
@@ -6438,6 +6460,8 @@ declare const PROFILE_SECTION_SELECTORS: {
|
|
|
6438
6460
|
*
|
|
6439
6461
|
* rolesEditButton: Selector for the edit button.
|
|
6440
6462
|
*
|
|
6463
|
+
* permissionSubCategoryCard: Selector for permission sub-category card.
|
|
6464
|
+
*
|
|
6441
6465
|
*/
|
|
6442
6466
|
declare const ROLES_SELECTORS: {
|
|
6443
6467
|
newButton: string;
|
|
@@ -6463,6 +6487,7 @@ declare const ROLES_SELECTORS: {
|
|
|
6463
6487
|
roleCell: (roleName: string) => string;
|
|
6464
6488
|
tablePermissionCheckbox: string;
|
|
6465
6489
|
descriptionInputError: string;
|
|
6490
|
+
permissionSubCategoryCard: (index: number) => string;
|
|
6466
6491
|
};
|
|
6467
6492
|
/**
|
|
6468
6493
|
*
|
package/index.js
CHANGED
|
@@ -5196,6 +5196,7 @@ const ROLES_SELECTORS = {
|
|
|
5196
5196
|
roleCell: (roleName) => `${hyphenate(roleName)}-role-cell`,
|
|
5197
5197
|
tablePermissionCheckbox: "ntm-roles-table-permission-checkbox",
|
|
5198
5198
|
descriptionInputError: "description-input-error",
|
|
5199
|
+
permissionSubCategoryCard: (index) => `ntm-roles-permission-sub-category-card-${index}`,
|
|
5199
5200
|
};
|
|
5200
5201
|
|
|
5201
5202
|
const SIGNUP_SELECTORS = {
|
|
@@ -118668,12 +118669,12 @@ class RolesPage {
|
|
|
118668
118669
|
const [{ roleId }, { roleId: secondaryRoleId }] = await Promise.all([roleName, secondaryRoleName].map(this.getRoleIdAndOrganizationId));
|
|
118669
118670
|
return this.roleApis.deleteRole(roleId, secondaryRoleId);
|
|
118670
118671
|
};
|
|
118671
|
-
this.addRoleViaUI = async ({ roleName, permissions }) => {
|
|
118672
|
+
this.addRoleViaUI = async ({ roleName, permissions, parentPermission = "", hierarchyLevelOfPermissions = 2, }) => {
|
|
118672
118673
|
await this.page.getByTestId(ROLES_SELECTORS.newButton).click();
|
|
118673
118674
|
await this.page.getByTestId(ROLES_SELECTORS.nameTextField).fill(roleName);
|
|
118674
|
-
await this.selectAndSubmitPermissions(permissions);
|
|
118675
|
+
await this.selectAndSubmitPermissions(permissions, parentPermission, hierarchyLevelOfPermissions);
|
|
118675
118676
|
};
|
|
118676
|
-
this.editRoleViaUI = async ({ roleName, permissions }) => {
|
|
118677
|
+
this.editRoleViaUI = async ({ roleName, permissions, parentPermission = "", hierarchyLevelOfPermissions = 2, }) => {
|
|
118677
118678
|
await this.page
|
|
118678
118679
|
.getByTestId(ROLES_SELECTORS.tableHeaderRoleName)
|
|
118679
118680
|
.filter({ hasText: roleName })
|
|
@@ -118681,11 +118682,20 @@ class RolesPage {
|
|
|
118681
118682
|
.click();
|
|
118682
118683
|
await this.page.getByTestId(ROLES_SELECTORS.editRoleButton).click();
|
|
118683
118684
|
await expect(this.page.getByTestId(ROLES_SELECTORS.updateRolePaneHeading)).toBeVisible();
|
|
118684
|
-
await this.selectAndSubmitPermissions(permissions);
|
|
118685
|
+
await this.selectAndSubmitPermissions(permissions, parentPermission, hierarchyLevelOfPermissions);
|
|
118685
118686
|
};
|
|
118686
|
-
this.selectAndSubmitPermissions = async (permissions) => {
|
|
118687
|
+
this.selectAndSubmitPermissions = async (permissions, parentPermission = "", hierarchyLevelOfPermissions = 2) => {
|
|
118688
|
+
const parentPermissionSelector = parentPermission
|
|
118689
|
+
? this.page
|
|
118690
|
+
.getByTestId(ROLES_SELECTORS.permissionSubCategoryCard(hierarchyLevelOfPermissions - 1))
|
|
118691
|
+
.filter({ hasText: parentPermission })
|
|
118692
|
+
: this.page;
|
|
118693
|
+
parentPermission &&
|
|
118694
|
+
(await parentPermissionSelector
|
|
118695
|
+
.getByTestId(COMMON_SELECTORS.customCheckboxLabel(parentPermission))
|
|
118696
|
+
.click({ force: true }));
|
|
118687
118697
|
for (const permission of permissions) {
|
|
118688
|
-
await
|
|
118698
|
+
await parentPermissionSelector
|
|
118689
118699
|
.getByTestId(COMMON_SELECTORS.customCheckboxLabel(permission))
|
|
118690
118700
|
.click({ force: true }); // Used force: true because disabling the parent permission disables the child permissions means the checkboxes label become disable
|
|
118691
118701
|
}
|