@bigbinary/neeto-playwright-commons 1.24.9 → 1.25.1

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
@@ -21,6 +21,8 @@ var require$$0$a = require('tty');
21
21
  var require$$0$9 = require('os');
22
22
  var stealth$1 = require('puppeteer-extra-plugin-stealth');
23
23
  var require$$1$4 = require('events');
24
+ var timezone = require('dayjs/plugin/timezone');
25
+ var utc = require('dayjs/plugin/utc');
24
26
  var https = require('https');
25
27
 
26
28
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
@@ -4849,9 +4851,9 @@ const NEETO_EDITOR_SELECTORS = {
4849
4851
  todoListOption: optionSelector("todoList"),
4850
4852
  editorMenuWrapper: "neeto-editor-fixed-menu-wrapper",
4851
4853
  dataEmojiType: (type) => `[data-emoji="${type}"]`,
4852
- //Use data-cy once https://github.com/neetozone/neeto-editor/issues/1651 is resolved
4854
+ //Use data-testid once https://github.com/neetozone/neeto-editor/issues/1651 is resolved
4853
4855
  calloutContent: ".callout-content",
4854
- //Use data-cy once https://github.com/neetozone/neeto-editor/issues/1648 is resolved
4856
+ //Use data-testid once https://github.com/neetozone/neeto-editor/issues/1648 is resolved
4855
4857
  calloutTypeOption: ".neeto-editor-callout-dropdown__type-option",
4856
4858
  editorMediaUploaderTab: "neeto-editor-media-uploader-local-tab",
4857
4859
  dynamicVariableSelector: (variable) => `dynamic-variables-list-item-${joinHyphenCase(variable)}`,
@@ -5052,6 +5054,9 @@ const PROFILE_SECTION_SELECTORS = {
5052
5054
  actionHeaderUserName: "floating-action-menu-header-user-name",
5053
5055
  actionHeaderUserEmail: "floating-action-menu-header-user-email",
5054
5056
  submitButton: "ntm-profile-submit-button",
5057
+ editBtn: "edit-basic-info-menu-button",
5058
+ firstNameTextField: "profile-first-name-text-field",
5059
+ lastNameTextField: "profile-last-name-text-field",
5055
5060
  manageBillingAndSubscriptionsButton: "manage-billing-subscriptions-menu-button",
5056
5061
  };
5057
5062
 
@@ -5321,6 +5326,12 @@ const IP_RESTRICTIONS_SELECTORS = {
5321
5326
  typeSelectError: "type-select-error",
5322
5327
  resetButton: "ip-restriction-reset-button",
5323
5328
  };
5329
+ const AUDIT_LOGS_SELECTORS = {
5330
+ card: "audit-log-card",
5331
+ content: "audit-log-content",
5332
+ timestamp: "audit-log-timestamp",
5333
+ text: "audit-log-text",
5334
+ };
5324
5335
 
5325
5336
  const DATE_PICKER_SELECTORS = {
5326
5337
  pickerInput: "picker-input",
@@ -113694,7 +113705,6 @@ const COMMUNITY_TEXTS = { joinNow: "Join Now" };
113694
113705
  const STATUS_TEXTS = {
113695
113706
  application: (appName) => `Neeto${appName} Application`,
113696
113707
  };
113697
- const AUDIT_LOGS_TEXTS = { organizationRole: "Organization Role" };
113698
113708
  const COMMON_TEXTS = {
113699
113709
  skipCleanup: "@SKIP_CLEANUP",
113700
113710
  skipSetup: "@SKIP_SETUP",
@@ -113933,7 +113943,7 @@ class HelpAndProfilePage {
113933
113943
  const replayAppLink = this.page.getByTestId(COMMON_SELECTORS.appLink("Replay"));
113934
113944
  const searchInput = this.page.getByTestId(COMMON_SELECTORS.productSwitcherSearchInput);
113935
113945
  await searchInput.fill(faker.faker.word.words(3));
113936
- //TODO: Use data-cy label when this https://github.com/bigbinary/neeto-molecules/issues/2114 is resolved
113946
+ //TODO: Use data-testid label when this https://github.com/bigbinary/neeto-molecules/issues/2114 is resolved
113937
113947
  await test.expect(this.page.getByText(this.t("neetoMolecules.productSwitcher.noApps"))).toBeVisible();
113938
113948
  await searchInput.fill(searchQueryPartial);
113939
113949
  await Promise.all([
@@ -113961,7 +113971,7 @@ class HelpAndProfilePage {
113961
113971
  const replayAppLink = this.page.getByTestId(COMMON_SELECTORS.appLink("Replay"));
113962
113972
  const searchInput = this.page.getByTestId(COMMON_SELECTORS.productSwitcherSearchInput);
113963
113973
  await searchInput.fill(faker.faker.word.words(3));
113964
- //TODO: Use data-cy label when this https://github.com/bigbinary/neeto-molecules/issues/2114 is resolved
113974
+ //TODO: Use data-testid label when this https://github.com/bigbinary/neeto-molecules/issues/2114 is resolved
113965
113975
  await test.expect(this.page.getByText(this.t("neetoMolecules.productSwitcher.noApps"))).toBeVisible();
113966
113976
  await searchInput.fill(searchQueryPartial);
113967
113977
  await Promise.all([
@@ -114153,6 +114163,28 @@ class HelpAndProfilePage {
114153
114163
  });
114154
114164
  });
114155
114165
  };
114166
+ this.updateProfile = async ({ firstName, lastName }) => {
114167
+ await this.openHelpCenter();
114168
+ await this.page
114169
+ .getByTestId(PROFILE_SECTION_SELECTORS.myProfileButton)
114170
+ .click();
114171
+ await this.page
114172
+ .getByTestId(COMMON_SELECTORS.pane)
114173
+ .getByTestId(COMMON_SELECTORS.dropdownIcon)
114174
+ .click();
114175
+ await this.page.getByTestId(PROFILE_SECTION_SELECTORS.editBtn).click();
114176
+ firstName &&
114177
+ (await this.page
114178
+ .getByTestId(PROFILE_SECTION_SELECTORS.firstNameTextField)
114179
+ .fill(firstName));
114180
+ lastName &&
114181
+ (await this.page
114182
+ .getByTestId(PROFILE_SECTION_SELECTORS.lastNameTextField)
114183
+ .fill(lastName));
114184
+ await this.page.getByTestId(PROFILE_SECTION_SELECTORS.submitButton).click();
114185
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
114186
+ await test.expect(this.page.getByTestId(COMMON_SELECTORS.paneModalCrossIcon)).toBeHidden();
114187
+ };
114156
114188
  this.page = page;
114157
114189
  this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
114158
114190
  this.chatApiBaseURL = chatApiBaseURL;
@@ -116753,7 +116785,7 @@ class ZapierPage extends IntegrationBase {
116753
116785
  await signInPage.waitForLoadState();
116754
116786
  await test.expect(signInPage.getByRole("heading", { name: ZAPIER_WEB_TEXTS.loading })).toBeHidden({ timeout: 10000 });
116755
116787
  // The zapier connect page have two custom fm-prettytext boxes
116756
- // (not an input/textarea) without aria-label or data-cy
116788
+ // (not an input/textarea) without aria-label or data-testid
116757
116789
  const prettyTextBox = signInPage.locator(ZAPIER_SELECTORS.fmPrettytext);
116758
116790
  // eslint-disable-next-line playwright/no-nth-methods
116759
116791
  const subdomainBox = prettyTextBox.nth(0);
@@ -117043,8 +117075,8 @@ class EditorPage {
117043
117075
  .all();
117044
117076
  (await this.moreMenuSelector.isVisible()) && fixedMenuButtons.pop();
117045
117077
  return Promise.all(fixedMenuButtons.map(async (button) => {
117046
- const dataCy = await button.getAttribute("data-cy");
117047
- return this.cleanString(dataCy);
117078
+ const dataTestid = await button.getAttribute("data-testid");
117079
+ return this.cleanString(dataTestid);
117048
117080
  }));
117049
117081
  };
117050
117082
  this.moreMenuOptions = async () => {
@@ -117052,8 +117084,8 @@ class EditorPage {
117052
117084
  const dropdownContainer = this.page.getByTestId(COMMON_SELECTORS.dropdownContainer);
117053
117085
  const moreMenuButtons = await dropdownContainer.getByRole("button").all();
117054
117086
  const moreMenuButtonLocators = Promise.all(moreMenuButtons.map(async (button) => {
117055
- const dataCy = await button.getAttribute("data-cy");
117056
- return this.cleanString(dataCy);
117087
+ const dataTestid = await button.getAttribute("data-testid");
117088
+ return this.cleanString(dataTestid);
117057
117089
  }));
117058
117090
  await this.moreMenuSelector.click();
117059
117091
  await test.expect(dropdownContainer).toBeHidden();
@@ -117068,8 +117100,8 @@ class EditorPage {
117068
117100
  .getByRole("button")
117069
117101
  .all();
117070
117102
  const headingLevels = (await Promise.all(headingButtons.map(async (button) => {
117071
- const dataCy = await button.getAttribute("data-cy");
117072
- const headingLevel = dataCy === null || dataCy === void 0 ? void 0 : dataCy.split("-").pop();
117103
+ const dataTestid = await button.getAttribute("data-testid");
117104
+ const headingLevel = dataTestid === null || dataTestid === void 0 ? void 0 : dataTestid.split("-").pop();
117073
117105
  return /^h[1-5]$/.test(headingLevel || "") ? headingLevel : null;
117074
117106
  }))).filter(Boolean);
117075
117107
  const fontSizeDropdown = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.fontSize);
@@ -118205,49 +118237,68 @@ class ApiKeysPage {
118205
118237
  }
118206
118238
  }
118207
118239
 
118240
+ const ACTIONS = {
118241
+ inviteUsers: "invitedUsers",
118242
+ updatedUser: "updatedUser",
118243
+ removedUser: "removedUser",
118244
+ createdRole: "createdRole",
118245
+ addedPermission: "addedPermission",
118246
+ removedPermission: "removedPermission",
118247
+ updatedRole: "updatedRole",
118248
+ deletedRole: "deletedRole",
118249
+ updatedName: "updatedName",
118250
+ };
118251
+
118252
+ dayjs.extend(utc);
118253
+ dayjs.extend(timezone);
118208
118254
  class AuditLogsPage {
118209
- constructor(page, neetoPlaywrightUtilities) {
118255
+ constructor(page, neetoPlaywrightUtilities,
118256
+ // TODO: Make this parameter required in the next major release
118257
+ product) {
118210
118258
  this.page = page;
118211
118259
  this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
118212
- this.verifyAuditLogEntry = async ({ page = this.page, tableDetails, paneDetails, }) => {
118213
- await this.verifyAuditLog(tableDetails);
118214
- await this.verifyDataInPane({
118215
- ...paneDetails,
118216
- page,
118217
- action: tableDetails.action,
118218
- });
118219
- };
118220
- this.verifyAuditLog = async ({ targetRow, action, date, adminName, }) => {
118221
- if (targetRow) {
118222
- this.targetRow = targetRow;
118223
- }
118224
- await Promise.all([action, this.t("neetoMolecules.common.success"), adminName, date].map(name => test.expect(this.targetRow.getByRole("cell", { name })).toBeVisible()));
118260
+ this.product = product;
118261
+ this.verifyAuditLogs = async ({ action, adminName, data, }) => {
118262
+ if (adminName)
118263
+ this.admin = adminName;
118264
+ const expectedMessage = this.messageBuilders[action](data);
118265
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
118266
+ await this.assertAuditLogContent(expectedMessage);
118225
118267
  };
118226
- this.verifyDataInPane = async ({ page = this.page, action, values, firstName, lastName, roleName, }) => {
118227
- const rowInPane = page
118228
- .getByTestId(COMMON_SELECTORS.paneBody)
118229
- .getByRole("row");
118230
- await this.targetRow.getByText(action).click();
118268
+ this.assertAuditLogContent = async (expectedMessage) => {
118269
+ // Using nth-methods here because we need to select the latest audit log card
118270
+ // eslint-disable-next-line playwright/no-nth-methods
118271
+ const card = this.page.getByTestId(AUDIT_LOGS_SELECTORS.card).first();
118272
+ const content = card.getByTestId(AUDIT_LOGS_SELECTORS.content);
118231
118273
  await Promise.all([
118232
- ...values.map(value => test.expect(page.getByTestId(COMMON_SELECTORS.paneBody).getByText(value)).toBeVisible()),
118233
- firstName &&
118234
- // eslint-disable-next-line playwright/missing-playwright-await
118235
- test.expect(rowInPane
118236
- .filter({ hasText: this.t("neetoTeamMembers.labels.firstName") })
118237
- .getByText(firstName)).toBeVisible(),
118238
- lastName &&
118239
- // eslint-disable-next-line playwright/missing-playwright-await
118240
- test.expect(rowInPane
118241
- .filter({ hasText: this.t("neetoTeamMembers.labels.lastName") })
118242
- .getByText(lastName)).toBeVisible(),
118243
- roleName &&
118244
- // eslint-disable-next-line playwright/missing-playwright-await
118245
- test.expect(rowInPane
118246
- .filter({ hasText: AUDIT_LOGS_TEXTS.organizationRole })
118247
- .getByText(roleName)).toBeVisible(),
118274
+ test.expect(content.getByTestId(AUDIT_LOGS_SELECTORS.timestamp)).toContainText(this.currentDate),
118275
+ test.expect(content.getByTestId(AUDIT_LOGS_SELECTORS.text)).toHaveText(expectedMessage),
118248
118276
  ]);
118249
118277
  };
118250
- this.t = playwrightI18nextFixture.getI18nInstance().t;
118278
+ /**
118279
+ * @deprecated This method is deprecated. Use verifyAuditLogs instead.
118280
+ */
118281
+ this.verifyDataInPane = ({}) => { };
118282
+ /**
118283
+ * @deprecated This method is deprecated. Use verifyAuditLogs instead.
118284
+ */
118285
+ this.verifyAuditLog = async ({}) => { };
118286
+ /**
118287
+ * @deprecated This method is deprecated. Use verifyAuditLogs instead.
118288
+ */
118289
+ this.verifyAuditLogEntry = async ({}) => { };
118290
+ this.currentDate = dayjs().tz("Asia/Kolkata").format("MMM D, YYYY");
118291
+ this.messageBuilders = {
118292
+ [ACTIONS.inviteUsers]: (data) => `${this.admin} has invited ${data.emails.join(", ").toLowerCase()} to Neeto${this.product}`,
118293
+ [ACTIONS.updatedUser]: (data) => `${this.admin} updated ${data.emails[1].toLowerCase()}'s email: from ${data.emails[0].toLowerCase()} to ${data.emails[1]} on Neeto${this.product}`,
118294
+ [ACTIONS.removedUser]: (data) => `${this.admin} updated ${data.emails[0].toLowerCase()}'s active: from true to false on Neeto${this.product}`,
118295
+ [ACTIONS.createdRole]: (data) => `${this.admin} created ${data.roleName} role on Neeto${this.product}`,
118296
+ [ACTIONS.addedPermission]: (data) => `${this.admin} added ${data.permissions.join(", ").toLowerCase()} permission to ${data.roleName} role on Neeto${this.product}`,
118297
+ [ACTIONS.removedPermission]: (data) => `${this.admin} removed ${data.permissions.join(", ")} permissions from ${data.roleName} role on Neeto${this.product}`,
118298
+ [ACTIONS.updatedRole]: (data) => `${this.admin} updated ${data.roleName} role on Neeto${this.product}`,
118299
+ [ACTIONS.deletedRole]: (data) => `${this.admin} deleted ${data.roleName} role on Neeto${this.product}`,
118300
+ [ACTIONS.updatedName]: (data) => `${this.admin} updated their first name: from ${data.name} to ${this.admin.split(" ")[0]} on Neeto${this.product}`,
118301
+ };
118251
118302
  }
118252
118303
  }
118253
118304
 
@@ -124072,7 +124123,6 @@ const definePlaywrightConfig = (overrides) => {
124072
124123
  ...globalOverrides,
124073
124124
  use: {
124074
124125
  baseURL: process.env.BASE_URL,
124075
- testIdAttribute: "data-cy",
124076
124126
  trace: "on",
124077
124127
  screenshot: "only-on-failure",
124078
124128
  navigationTimeout: 35000,
@@ -124114,10 +124164,11 @@ const definePlaywrightConfig = (overrides) => {
124114
124164
  });
124115
124165
  };
124116
124166
 
124167
+ exports.ACTIONS = ACTIONS;
124117
124168
  exports.ADMIN_PANEL_SELECTORS = ADMIN_PANEL_SELECTORS;
124118
124169
  exports.API_KEYS_SELECTORS = API_KEYS_SELECTORS;
124119
124170
  exports.API_ROUTES = API_ROUTES;
124120
- exports.AUDIT_LOGS_TEXTS = AUDIT_LOGS_TEXTS;
124171
+ exports.AUDIT_LOGS_SELECTORS = AUDIT_LOGS_SELECTORS;
124121
124172
  exports.AdminPanelPage = AdminPanelPage;
124122
124173
  exports.ApiKeysApi = ApiKeysApi;
124123
124174
  exports.ApiKeysPage = ApiKeysPage;