@bigbinary/neeto-playwright-commons 1.20.3 → 1.20.5
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 +41 -23
- package/index.cjs.js.map +1 -1
- package/index.d.ts +9 -4
- package/index.js +41 -23
- package/index.js.map +1 -1
- package/package.json +7 -7
package/index.d.ts
CHANGED
|
@@ -572,11 +572,13 @@ declare class CustomCommands {
|
|
|
572
572
|
}
|
|
573
573
|
declare class MemberApis {
|
|
574
574
|
private neetoPlaywrightUtilities;
|
|
575
|
+
private readonly teamMembersBaseUrl;
|
|
575
576
|
private readonly teamsBaseUrl;
|
|
576
577
|
constructor(neetoPlaywrightUtilities: CustomCommands);
|
|
577
578
|
create: (body: Record<string, unknown>) => Promise<playwright_core.APIResponse | undefined>;
|
|
578
579
|
jobStatus: (jobId: string) => Promise<playwright_core.APIResponse | undefined>;
|
|
579
|
-
fetch: (params
|
|
580
|
+
fetch: (params?: ParamProps) => Promise<playwright_core.APIResponse | undefined>;
|
|
581
|
+
fetchPermissions: () => Promise<playwright_core.APIResponse | undefined>;
|
|
580
582
|
update: (memberId: string, body: Record<string, unknown>) => Promise<playwright_core.APIResponse | undefined>;
|
|
581
583
|
bulkUpdate: (body: Record<string, unknown>) => Promise<playwright_core.APIResponse | undefined>;
|
|
582
584
|
}
|
|
@@ -3453,8 +3455,11 @@ declare class RolesPage {
|
|
|
3453
3455
|
roleApis: RoleApis;
|
|
3454
3456
|
t: TFunction;
|
|
3455
3457
|
constructor(page: Page, neetoPlaywrightUtilities: CustomCommands);
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
+
getPermissionIds: (targetPermissions: string[]) => Promise<string[]>;
|
|
3459
|
+
getRoleIdAndOrganizationId: (roleName: string) => Promise<{
|
|
3460
|
+
roleId: string;
|
|
3461
|
+
organizationId: string;
|
|
3462
|
+
}>;
|
|
3458
3463
|
/**
|
|
3459
3464
|
*
|
|
3460
3465
|
* Used to add a custom role via API request.
|
|
@@ -3494,7 +3499,7 @@ declare class RolesPage {
|
|
|
3494
3499
|
* await rolesPage.deleteRoleViaRequest("Custom Role");
|
|
3495
3500
|
* @endexample
|
|
3496
3501
|
*/
|
|
3497
|
-
deleteRoleViaRequest: (roleName: string) => Promise<playwright_core.APIResponse | undefined>;
|
|
3502
|
+
deleteRoleViaRequest: (roleName: string, secondaryRoleName?: string) => Promise<playwright_core.APIResponse | undefined>;
|
|
3498
3503
|
/**
|
|
3499
3504
|
*
|
|
3500
3505
|
* Used to add a role through the UI.
|
package/index.js
CHANGED
|
@@ -40,11 +40,13 @@ let MemberApis$1 = class MemberApis {
|
|
|
40
40
|
this.jobStatus = (jobId) => this.neetoPlaywrightUtilities.apiRequest({
|
|
41
41
|
url: `${this.teamsBaseUrl}/creation_status/${jobId}`,
|
|
42
42
|
});
|
|
43
|
-
this.fetch = (params) => this.neetoPlaywrightUtilities.apiRequest({
|
|
44
|
-
method: "get",
|
|
43
|
+
this.fetch = (params = {}) => this.neetoPlaywrightUtilities.apiRequest({
|
|
45
44
|
url: this.teamsBaseUrl,
|
|
46
45
|
params,
|
|
47
46
|
});
|
|
47
|
+
this.fetchPermissions = () => this.neetoPlaywrightUtilities.apiRequest({
|
|
48
|
+
url: `${this.teamMembersBaseUrl}/permissions`,
|
|
49
|
+
});
|
|
48
50
|
this.update = (memberId, body) => this.neetoPlaywrightUtilities.apiRequest({
|
|
49
51
|
method: "put",
|
|
50
52
|
url: `${this.teamsBaseUrl}/${memberId}`,
|
|
@@ -55,7 +57,8 @@ let MemberApis$1 = class MemberApis {
|
|
|
55
57
|
url: `${this.teamsBaseUrl}/bulk_update`,
|
|
56
58
|
body: { users: body },
|
|
57
59
|
});
|
|
58
|
-
this.
|
|
60
|
+
this.teamMembersBaseUrl = "/team_members";
|
|
61
|
+
this.teamsBaseUrl = `${this.teamMembersBaseUrl}/teams`;
|
|
59
62
|
}
|
|
60
63
|
};
|
|
61
64
|
|
|
@@ -188899,8 +188902,8 @@ const STATUS_TEXTS = {
|
|
|
188899
188902
|
};
|
|
188900
188903
|
const AUDIT_LOGS_TEXTS = { organizationRole: "Organization Role" };
|
|
188901
188904
|
const COMMON_TEXTS = {
|
|
188902
|
-
skipCleanup: "SKIP_CLEANUP",
|
|
188903
|
-
skipSetup: "SKIP_SETUP",
|
|
188905
|
+
skipCleanup: "@SKIP_CLEANUP",
|
|
188906
|
+
skipSetup: "@SKIP_SETUP",
|
|
188904
188907
|
};
|
|
188905
188908
|
const ORGANIZATION_TEXTS = {
|
|
188906
188909
|
subdomainAvailable: "Subdomain is available",
|
|
@@ -188935,7 +188938,7 @@ class HelpAndProfilePage {
|
|
|
188935
188938
|
this.openAndVerifyChatWidgetV2 = async () => {
|
|
188936
188939
|
await this.page.reload();
|
|
188937
188940
|
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
188938
|
-
await test$2.step("Step 1: Open live chat and verify iframe", this.openLiveChatAndVerify);
|
|
188941
|
+
await test$2.step("Step 1: Open live chat and verify iframe", () => this.openLiveChatAndVerify());
|
|
188939
188942
|
await test$2.step("Step 2: Close and reopen live chat frame", async () => {
|
|
188940
188943
|
await this.page.getByTestId(CHAT_WIDGET_SELECTORS.closeChat).click();
|
|
188941
188944
|
await expect(this.neetoChatWidget).toBeHidden({ timeout: 35000 });
|
|
@@ -191264,7 +191267,7 @@ class SlackPage extends IntegrationBase {
|
|
|
191264
191267
|
.pressSequentially(slackLoginPassword, { delay: 10 });
|
|
191265
191268
|
await slackWebappPage.locator(SLACK_SELECTORS.signInButton).click();
|
|
191266
191269
|
const redirectOpenInBrowser = slackWebappPage.locator(SLACK_SELECTORS.redirectOpenInBrowser);
|
|
191267
|
-
await expect(redirectOpenInBrowser).toBeVisible({ timeout:
|
|
191270
|
+
await expect(redirectOpenInBrowser).toBeVisible({ timeout: 25000 });
|
|
191268
191271
|
await redirectOpenInBrowser.click();
|
|
191269
191272
|
await this.setupCloseHandlers(slackWebappPage);
|
|
191270
191273
|
return;
|
|
@@ -191685,11 +191688,13 @@ class MemberApis {
|
|
|
191685
191688
|
this.jobStatus = (jobId) => this.neetoPlaywrightUtilities.apiRequest({
|
|
191686
191689
|
url: `${this.teamsBaseUrl}/creation_status/${jobId}`,
|
|
191687
191690
|
});
|
|
191688
|
-
this.fetch = (params) => this.neetoPlaywrightUtilities.apiRequest({
|
|
191689
|
-
method: "get",
|
|
191691
|
+
this.fetch = (params = {}) => this.neetoPlaywrightUtilities.apiRequest({
|
|
191690
191692
|
url: this.teamsBaseUrl,
|
|
191691
191693
|
params,
|
|
191692
191694
|
});
|
|
191695
|
+
this.fetchPermissions = () => this.neetoPlaywrightUtilities.apiRequest({
|
|
191696
|
+
url: `${this.teamMembersBaseUrl}/permissions`,
|
|
191697
|
+
});
|
|
191693
191698
|
this.update = (memberId, body) => this.neetoPlaywrightUtilities.apiRequest({
|
|
191694
191699
|
method: "put",
|
|
191695
191700
|
url: `${this.teamsBaseUrl}/${memberId}`,
|
|
@@ -191700,7 +191705,8 @@ class MemberApis {
|
|
|
191700
191705
|
url: `${this.teamsBaseUrl}/bulk_update`,
|
|
191701
191706
|
body: { users: body },
|
|
191702
191707
|
});
|
|
191703
|
-
this.
|
|
191708
|
+
this.teamMembersBaseUrl = "/team_members";
|
|
191709
|
+
this.teamsBaseUrl = `${this.teamMembersBaseUrl}/teams`;
|
|
191704
191710
|
}
|
|
191705
191711
|
}
|
|
191706
191712
|
|
|
@@ -192993,9 +192999,9 @@ class RolesPage {
|
|
|
192993
192999
|
permission_ids: permissionIds,
|
|
192994
193000
|
});
|
|
192995
193001
|
};
|
|
192996
|
-
this.deleteRoleViaRequest = async (roleName) => {
|
|
192997
|
-
const [{ roleId }, { roleId:
|
|
192998
|
-
return this.roleApis.deleteRole(roleId,
|
|
193002
|
+
this.deleteRoleViaRequest = async (roleName, secondaryRoleName = "Editor") => {
|
|
193003
|
+
const [{ roleId }, { roleId: secondaryRoleId }] = await Promise.all([roleName, secondaryRoleName].map(this.getRoleIdAndOrganizationId));
|
|
193004
|
+
return this.roleApis.deleteRole(roleId, secondaryRoleId);
|
|
192999
193005
|
};
|
|
193000
193006
|
this.addRoleViaUI = async ({ roleName, permissions }) => {
|
|
193001
193007
|
await this.page.getByTestId(ROLES_SELECTORS.newButton).click();
|
|
@@ -193009,16 +193015,19 @@ class RolesPage {
|
|
|
193009
193015
|
.getByTestId(ROLES_SELECTORS.dropDownIcon)
|
|
193010
193016
|
.click();
|
|
193011
193017
|
await this.page.getByTestId(ROLES_SELECTORS.editRoleButton).click();
|
|
193018
|
+
await expect(this.page.getByTestId(ROLES_SELECTORS.updateRolePaneHeading)).toBeVisible();
|
|
193012
193019
|
await this.selectAndSubmitPermissions(permissions);
|
|
193013
193020
|
};
|
|
193014
193021
|
this.selectAndSubmitPermissions = async (permissions) => {
|
|
193015
193022
|
for (const permission of permissions) {
|
|
193016
193023
|
await this.page
|
|
193017
|
-
.getByTestId(
|
|
193018
|
-
.
|
|
193024
|
+
.getByTestId(COMMON_SELECTORS.customCheckboxLabel(permission))
|
|
193025
|
+
.click({ force: true }); // Used force: true because disabling the parent permission disables the child permissions means the checkboxes label become disable
|
|
193019
193026
|
}
|
|
193020
|
-
await
|
|
193021
|
-
|
|
193027
|
+
await Promise.all([
|
|
193028
|
+
this.page.getByTestId(ROLES_SELECTORS.proceedButton).click(),
|
|
193029
|
+
this.neetoPlaywrightUtilities.verifyToast(),
|
|
193030
|
+
]);
|
|
193022
193031
|
};
|
|
193023
193032
|
this.verifyAdminPanelCard = ({ cardLocator, title, description, }) => Promise.all([
|
|
193024
193033
|
expect(cardLocator.getByTestId(ADMIN_PANEL_SELECTORS.settingsItemHeading)).toHaveText(title),
|
|
@@ -193026,16 +193035,25 @@ class RolesPage {
|
|
|
193026
193035
|
expect(this.page.getByTestId(COMMON_SELECTORS.sidebarSubLink(title))).toHaveCSS("background-color", COLOR.transparent),
|
|
193027
193036
|
]);
|
|
193028
193037
|
this.deleteRoleViaUI = async (roleName) => {
|
|
193029
|
-
await this.
|
|
193030
|
-
|
|
193038
|
+
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
193039
|
+
await this.page.getByTestId(ROLES_SELECTORS.searchTextField).fill(roleName);
|
|
193040
|
+
const tableHeaderRoles = this.page.getByTestId(ROLES_SELECTORS.tableHeaderRoleName);
|
|
193041
|
+
await expect(tableHeaderRoles).toHaveCount(1);
|
|
193042
|
+
await tableHeaderRoles
|
|
193031
193043
|
.filter({ hasText: roleName })
|
|
193032
193044
|
.getByTestId(ROLES_SELECTORS.dropDownIcon)
|
|
193033
193045
|
.click();
|
|
193034
193046
|
await this.page.getByTestId(ROLES_SELECTORS.deleteRoleButton).click();
|
|
193035
|
-
await this.page
|
|
193036
|
-
|
|
193037
|
-
.click()
|
|
193038
|
-
|
|
193047
|
+
await expect(this.page.getByTestId(COMMON_SELECTORS.alertTitle)).toHaveText(this.t("neetoTeamMembers.labels.deleteRole"));
|
|
193048
|
+
await Promise.all([
|
|
193049
|
+
this.page.getByTestId(COMMON_SELECTORS.alertModalSubmitButton).click(),
|
|
193050
|
+
this.neetoPlaywrightUtilities.verifyToast(),
|
|
193051
|
+
]);
|
|
193052
|
+
await expect(this.page
|
|
193053
|
+
.getByTestId(ROLES_SELECTORS.tableHeaderRoleTitle)
|
|
193054
|
+
.filter({ hasText: roleName })).toBeHidden();
|
|
193055
|
+
await expect(this.page.getByTestId(COMMON_SELECTORS.noDataTitle)).toHaveText(this.t("neetoTeamMembers.labels.roleNotFound", PLURAL));
|
|
193056
|
+
await expect(this.page.getByTestId(ROLES_SELECTORS.newButton)).toHaveCount(2);
|
|
193039
193057
|
};
|
|
193040
193058
|
this.verifyPermissions = ({ allPermissions, rolePermissions, }) => Promise.all(Object.values(allPermissions).map(async (permission) => rolePermissions.includes(permission)
|
|
193041
193059
|
? await expect(this.page.getByTestId(permission)).toBeVisible()
|