@bigbinary/neeto-playwright-commons 1.26.2 → 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.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: ["Manage themes", "View roles"]
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: ["Manage roles"]
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(["Manage themes", "View roles"]);
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 = {
@@ -117925,7 +117926,8 @@ class TeamMembers {
117925
117926
  await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden();
117926
117927
  };
117927
117928
  this.filterMembers = async ({ email = { id: "", condition: "Is" }, roles = [], name = "", }) => {
117928
- await this.page.getByTestId(NEETO_FILTERS_SELECTORS.filterButton).click();
117929
+ await filterUtils.clearFiltersFromActionBlock(this.page);
117930
+ await filterUtils.openFilterPane(this.page);
117929
117931
  if (isPresent(email.id)) {
117930
117932
  await this.page
117931
117933
  .getByTestId(NEETO_FILTERS_SELECTORS.emailSelectContainer)
@@ -118667,12 +118669,12 @@ class RolesPage {
118667
118669
  const [{ roleId }, { roleId: secondaryRoleId }] = await Promise.all([roleName, secondaryRoleName].map(this.getRoleIdAndOrganizationId));
118668
118670
  return this.roleApis.deleteRole(roleId, secondaryRoleId);
118669
118671
  };
118670
- this.addRoleViaUI = async ({ roleName, permissions }) => {
118672
+ this.addRoleViaUI = async ({ roleName, permissions, parentPermission = "", hierarchyLevelOfPermissions = 2, }) => {
118671
118673
  await this.page.getByTestId(ROLES_SELECTORS.newButton).click();
118672
118674
  await this.page.getByTestId(ROLES_SELECTORS.nameTextField).fill(roleName);
118673
- await this.selectAndSubmitPermissions(permissions);
118675
+ await this.selectAndSubmitPermissions(permissions, parentPermission, hierarchyLevelOfPermissions);
118674
118676
  };
118675
- this.editRoleViaUI = async ({ roleName, permissions }) => {
118677
+ this.editRoleViaUI = async ({ roleName, permissions, parentPermission = "", hierarchyLevelOfPermissions = 2, }) => {
118676
118678
  await this.page
118677
118679
  .getByTestId(ROLES_SELECTORS.tableHeaderRoleName)
118678
118680
  .filter({ hasText: roleName })
@@ -118680,11 +118682,20 @@ class RolesPage {
118680
118682
  .click();
118681
118683
  await this.page.getByTestId(ROLES_SELECTORS.editRoleButton).click();
118682
118684
  await expect(this.page.getByTestId(ROLES_SELECTORS.updateRolePaneHeading)).toBeVisible();
118683
- await this.selectAndSubmitPermissions(permissions);
118685
+ await this.selectAndSubmitPermissions(permissions, parentPermission, hierarchyLevelOfPermissions);
118684
118686
  };
118685
- 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 }));
118686
118697
  for (const permission of permissions) {
118687
- await this.page
118698
+ await parentPermissionSelector
118688
118699
  .getByTestId(COMMON_SELECTORS.customCheckboxLabel(permission))
118689
118700
  .click({ force: true }); // Used force: true because disabling the parent permission disables the child permissions means the checkboxes label become disable
118690
118701
  }