@bigbinary/neeto-playwright-commons 1.13.6 → 1.13.8

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 CHANGED
@@ -257,7 +257,7 @@ const COMMON_SELECTORS = {
257
257
  profileSidebar: "profile-section",
258
258
  selectOption: (label) => `${hyphenize(label)}-select-option`,
259
259
  radioLabel: (embedLabel) => `${hyphenize(embedLabel)}-radio-label`,
260
- toastMessage: "toastr-message-container",
260
+ toastMessage: (type) => `toastr-${type}-container`,
261
261
  toastCloseButton: "toastr-close-button",
262
262
  windowAlert: "#alert-box",
263
263
  body: "body",
@@ -3891,7 +3891,7 @@ class CustomCommands {
3891
3891
  */
3892
3892
  this.verifySuccessToast = async ({ message = "", closeAfterVerification = true, } = {}) => {
3893
3893
  if (!ramda.isEmpty(message)) {
3894
- await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage)).toContainText(message);
3894
+ await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage("success"))).toContainText(message);
3895
3895
  }
3896
3896
  else {
3897
3897
  await test$1.expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toContainText("👍");
@@ -3901,12 +3901,9 @@ class CustomCommands {
3901
3901
  await test$1.expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toBeHidden();
3902
3902
  };
3903
3903
  this.verifyToast = async ({ message = "", toastType = "success", closeAfterVerification = true, timeout = 10000, } = {}) => {
3904
- if (toastType === "error") {
3905
- await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.errorToastIcon)).toBeVisible({ timeout });
3906
- }
3907
3904
  const toastrCloseButton = this.page.getByTestId(COMMON_SELECTORS.toastCloseButton);
3908
3905
  if (!ramda.isEmpty(message)) {
3909
- await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage)).toContainText(message, { timeout });
3906
+ await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage(toastType))).toContainText(message, { timeout });
3910
3907
  }
3911
3908
  else {
3912
3909
  await test$1.expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toContainText("👍", { timeout });
@@ -21189,10 +21186,8 @@ class ThankYouPage {
21189
21186
  await fetchConfiguration;
21190
21187
  };
21191
21188
  this.saveChanges = async () => {
21192
- const saveChangesButton = this.page.getByTestId(THANK_YOU_SELECTORS.saveChangesButton);
21193
- await saveChangesButton.click();
21189
+ await this.page.getByTestId(THANK_YOU_SELECTORS.saveChangesButton).click();
21194
21190
  await this.neetoPlaywrightUtilities.verifyToast();
21195
- await test$1.expect(saveChangesButton).toBeDisabled();
21196
21191
  };
21197
21192
  this.verifyThankYouImage = async (imagePath, imageName) => {
21198
21193
  await test$1.expect(this.page.getByTestId(THANK_YOU_SELECTORS.thankYouConfigurationLabel())).toBeChecked();
@@ -21494,6 +21489,7 @@ const GOOGLE_LOGIN_TEXTS = {
21494
21489
  neetoAutomation: "neeto.automation",
21495
21490
  };
21496
21491
  const ENGAGE_TEXTS = { subscribe: "Subscribe" };
21492
+ const AUDIT_LOGS_TEXTS = { organizationRole: "Organization Role" };
21497
21493
 
21498
21494
  /* eslint-disable playwright/require-top-level-describe */
21499
21495
  /* eslint-disable playwright/no-standalone-expect */
@@ -24140,55 +24136,72 @@ class MemberApis {
24140
24136
  this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
24141
24137
  this.create = (body) => this.neetoPlaywrightUtilities.apiRequest({
24142
24138
  method: "post",
24143
- url: "/team_members/teams",
24139
+ url: this.teamsBaseUrl,
24144
24140
  body: { user: body },
24145
24141
  });
24142
+ this.jobStatus = (jobId) => this.neetoPlaywrightUtilities.apiRequest({
24143
+ url: `${this.teamsBaseUrl}/creation_status/${jobId}`,
24144
+ });
24146
24145
  this.fetch = (params) => this.neetoPlaywrightUtilities.apiRequest({
24147
24146
  method: "get",
24148
- url: "/team_members/teams",
24147
+ url: this.teamsBaseUrl,
24149
24148
  params,
24150
24149
  });
24151
24150
  this.update = (memberId, body) => this.neetoPlaywrightUtilities.apiRequest({
24152
24151
  method: "put",
24153
- url: `/team_members/teams/${memberId}`,
24152
+ url: `${this.teamsBaseUrl}/${memberId}`,
24154
24153
  body: { team: body },
24155
24154
  });
24156
24155
  this.bulkUpdate = (body) => this.neetoPlaywrightUtilities.apiRequest({
24157
24156
  method: "patch",
24158
- url: "/team_members/teams/bulk_update",
24157
+ url: `${this.teamsBaseUrl}/bulk_update`,
24159
24158
  body: { users: body },
24160
24159
  });
24160
+ this.teamsBaseUrl = "/team_members/teams";
24161
24161
  }
24162
24162
  }
24163
24163
 
24164
24164
  class Member {
24165
24165
  constructor(neetoPlaywrightUtilities) {
24166
24166
  this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
24167
- this.addMemberViaRequest = ({ email, role = MEMBER_TEXTS.agent, appName, }) => test$1.expect
24168
- .poll(async () => {
24169
- const response = await this.memberApis.create({
24170
- emails: [email],
24171
- organization_role: role,
24172
- app_roles: [
24173
- { app_name: appName, active_role: role, is_enabled: true },
24174
- ],
24175
- });
24176
- return response === null || response === void 0 ? void 0 : response.status();
24177
- }, { timeout: 30000 })
24178
- .toBe(200);
24167
+ this.addMemberViaRequest = async ({ email, role = MEMBER_TEXTS.agent, appName, }) => {
24168
+ let response;
24169
+ await test$1.expect
24170
+ .poll(async () => {
24171
+ response = await this.memberApis.create({
24172
+ emails: [email],
24173
+ organization_role: role,
24174
+ app_roles: [
24175
+ { app_name: appName, active_role: role, is_enabled: true },
24176
+ ],
24177
+ });
24178
+ return response === null || response === void 0 ? void 0 : response.status();
24179
+ }, { timeout: 30000 })
24180
+ .toBe(200);
24181
+ const responseBodyBuffer = await (response === null || response === void 0 ? void 0 : response.body());
24182
+ const { job_id: jobId } = JSON.parse(String(responseBodyBuffer));
24183
+ // eslint-disable-next-line playwright/no-standalone-expect
24184
+ await test$1.expect
24185
+ .poll(async () => {
24186
+ const jobResponse = await this.memberApis.jobStatus(jobId);
24187
+ const responseBodyBuffer = await (jobResponse === null || jobResponse === void 0 ? void 0 : jobResponse.body());
24188
+ const { is_completed: isCompleted } = JSON.parse(String(responseBodyBuffer));
24189
+ return isCompleted;
24190
+ }, { timeout: 30000 })
24191
+ .toBe(true);
24192
+ };
24179
24193
  this.editMemberViaRequest = async ({ email, firstName, lastName, newRole, }) => {
24180
- const response = await this.memberApis.fetch({ search: email });
24181
- if (response) {
24182
- const responseBodyBuffer = await response.body();
24183
- const responseBody = JSON.parse(responseBodyBuffer.toString());
24184
- const memberDetails = responseBody === null || responseBody === void 0 ? void 0 : responseBody.members[0];
24185
- await this.memberApis.update(memberDetails.id, {
24194
+ const responseBody = (await this.memberApis
24195
+ .fetch({ search: email })
24196
+ .then(response => response === null || response === void 0 ? void 0 : response.json()));
24197
+ const memberDetails = responseBody === null || responseBody === void 0 ? void 0 : responseBody.members.find(({ email }) => email === email.toLowerCase());
24198
+ memberDetails &&
24199
+ (await this.memberApis.update(memberDetails.id, {
24186
24200
  active: true,
24187
24201
  first_name: firstName,
24188
24202
  last_name: lastName,
24189
24203
  organization_role: newRole,
24190
- });
24191
- }
24204
+ }));
24192
24205
  };
24193
24206
  this.deactivateMemberViaRequest = (email) => this.memberApis.bulkUpdate({ active: false, emails: [email] });
24194
24207
  this.generateRandomTeamMembers = ({ count = 1, role = "standard" }) => neetoCist.dynamicArray(count, () => ({
@@ -25095,6 +25108,45 @@ class OrganizationPage {
25095
25108
  }
25096
25109
  }
25097
25110
 
25111
+ class AuditLogsPage {
25112
+ constructor(page, neetoPlaywrightUtilities) {
25113
+ this.verifyAuditLog = async ({ targetRow, action, date, adminName, }) => {
25114
+ this.targetRow = targetRow;
25115
+ await test$1.expect(targetRow.getByRole("cell", { name: action })).toBeVisible();
25116
+ await test$1.expect(targetRow.getByRole("cell", {
25117
+ name: this.t("neetoMolecules.common.success"),
25118
+ })).toBeVisible();
25119
+ await test$1.expect(targetRow.getByRole("cell", { name: adminName })).toBeVisible();
25120
+ await test$1.expect(targetRow.getByRole("cell", { name: date })).toBeVisible();
25121
+ };
25122
+ this.verifyDataInPane = async ({ page = this.page, action, values, firstName, lastName, roleName, }) => {
25123
+ await this.targetRow.getByText(action).click();
25124
+ await Promise.all(values.map(value => test$1.expect(page.getByTestId(COMMON_SELECTORS.paneBody).getByText(value)).toBeVisible()));
25125
+ const rowInPane = page
25126
+ .getByTestId(COMMON_SELECTORS.paneBody)
25127
+ .getByRole("row");
25128
+ firstName &&
25129
+ // eslint-disable-next-line playwright/no-standalone-expect
25130
+ (await test$1.expect(rowInPane
25131
+ .filter({ hasText: this.t("neetoTeamMembers.labels.firstName") })
25132
+ .getByText(firstName)).toBeVisible());
25133
+ lastName &&
25134
+ // eslint-disable-next-line playwright/no-standalone-expect
25135
+ (await test$1.expect(rowInPane
25136
+ .filter({ hasText: this.t("neetoTeamMembers.labels.lastName") })
25137
+ .getByText(lastName)).toBeVisible());
25138
+ roleName &&
25139
+ // eslint-disable-next-line playwright/no-standalone-expect
25140
+ (await test$1.expect(rowInPane
25141
+ .filter({ hasText: AUDIT_LOGS_TEXTS.organizationRole })
25142
+ .getByText(roleName)).toBeVisible());
25143
+ };
25144
+ this.page = page;
25145
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
25146
+ this.t = playwrightI18nextFixture.getI18nInstance().t;
25147
+ }
25148
+ }
25149
+
25098
25150
  class SidebarSection {
25099
25151
  constructor(page, neetoPlaywrightUtilities) {
25100
25152
  this.clickOnSubLink = (label) => this.page.getByTestId(COMMON_SELECTORS.sidebarSubLink(label)).click();
@@ -158425,6 +158477,8 @@ const definePlaywrightConfig = (overrides) => {
158425
158477
  };
158426
158478
 
158427
158479
  exports.API_ROUTES = API_ROUTES;
158480
+ exports.AUDIT_LOGS_TEXTS = AUDIT_LOGS_TEXTS;
158481
+ exports.AuditLogsPage = AuditLogsPage;
158428
158482
  exports.BASE_URL = BASE_URL;
158429
158483
  exports.CHANGELOG_WIDGET_SELECTORS = CHANGELOG_WIDGET_SELECTORS;
158430
158484
  exports.CHAT_WIDGET_SELECTORS = CHAT_WIDGET_SELECTORS;