@bigbinary/neeto-playwright-commons 1.21.2 → 1.21.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 CHANGED
@@ -485,7 +485,9 @@ const NEETO_EDITOR_SELECTORS = {
485
485
  editorMenuWrapper: "neeto-editor-fixed-menu-wrapper",
486
486
  editorMediaUploaderTab: "neeto-editor-media-uploader-local-tab",
487
487
  dynamicVariableSelector: (variable) => `dynamic-variables-list-item-${joinHyphenCase(variable)}`,
488
- neetoEditorFixedMenuFontSize: 'neeto-editor-fixed-menu-font-size-option',
488
+ neetoEditorFixedMenuFontSize: "neeto-editor-fixed-menu-font-size-option",
489
+ highlightText: (textColorIndex) => `--neeto-editor-highlight-text-${textColorIndex}`,
490
+ highlightBg: (bgColorIndex) => `--neeto-editor-highlight-bg-${bgColorIndex}`,
489
491
  };
490
492
  const NEETO_TEXT_MODIFIER_SELECTORS = {
491
493
  strike: optionSelector("strike"),
@@ -188841,12 +188843,12 @@ const ROUTES = {
188841
188843
  dashboard: "/dashboard",
188842
188844
  neetoThankYou: "/neeto_thank_you_engine",
188843
188845
  adminPanel: {
188844
- roles: "/admin/admin-panel/roles",
188845
- index: "/admin/admin-panel",
188846
- auditLogs: "/admin/admin-panel/audit-logs",
188847
- apiKeys: "/admin/admin-panel/apiKeys",
188848
- customDomain: "/admin/admin-panel/custom-domain",
188849
- ipRestriction: "/admin/admin-panel/ip-restriction",
188846
+ roles: "/admin/general/admin-panel/roles",
188847
+ index: "/admin/general/admin-panel",
188848
+ auditLogs: "/admin/admin-panel/general/audit-logs",
188849
+ apiKeys: "/admin/admin-panel/general/apiKeys",
188850
+ customDomain: "/admin/admin-panel/general/custom-domain",
188851
+ ipRestriction: "/admin/admin-panel/general/ip-restriction",
188850
188852
  },
188851
188853
  };
188852
188854
  const API_ROUTES = {
@@ -191401,14 +191403,15 @@ class SlackPage extends IntegrationBase {
191401
191403
  const loginButton = this.page.getByRole("button", {
191402
191404
  name: this.t("neetoSlack.slack.connect.loginButton"),
191403
191405
  });
191406
+ const allowButton = this.page.getByRole("button", {
191407
+ name: SLACK_WEB_TEXTS.allow,
191408
+ });
191404
191409
  if (await loginButton.isVisible()) {
191405
191410
  await loginButton.click({ delay: 5000 });
191406
191411
  await this.page.waitForURL(RegExp("(.*)slack.com/.*"));
191407
191412
  }
191408
- const allowButton = this.page.getByRole("button", {
191409
- name: SLACK_WEB_TEXTS.allow,
191410
- });
191411
- await test$1.expect(allowButton).toBeEnabled({ timeout: 30000 });
191413
+ await this.page.waitForLoadState("domcontentloaded", { timeout: 25000 });
191414
+ await test$1.expect(allowButton).toBeEnabled({ timeout: 45000 });
191412
191415
  const currentWorkspace = (await this.page
191413
191416
  .locator(SLACK_SELECTORS.teamPicketButtonContent)
191414
191417
  .textContent()) || "";
@@ -191485,6 +191488,7 @@ class SlackPage extends IntegrationBase {
191485
191488
  ramda.isNotNil(slackLoginPassword) &&
191486
191489
  ramda.isNotNil(slackLoginEmail)) {
191487
191490
  await slackWebappPage.goto(THIRD_PARTY_ROUTES.slack.loginWithPassword(slackWorkspace), { timeout: 20000 });
191491
+ await slackWebappPage.waitForLoadState("load", { timeout: 25000 });
191488
191492
  await slackWebappPage
191489
191493
  .locator(SLACK_SELECTORS.loginEmail)
191490
191494
  .pressSequentially(slackLoginEmail, { delay: 10 });
@@ -191492,6 +191496,9 @@ class SlackPage extends IntegrationBase {
191492
191496
  .locator(SLACK_SELECTORS.loginPassword)
191493
191497
  .pressSequentially(slackLoginPassword, { delay: 10 });
191494
191498
  await slackWebappPage.locator(SLACK_SELECTORS.signInButton).click();
191499
+ await slackWebappPage.waitForLoadState("domcontentloaded", {
191500
+ timeout: 25000,
191501
+ });
191495
191502
  const redirectOpenInBrowser = slackWebappPage.locator(SLACK_SELECTORS.redirectOpenInBrowser);
191496
191503
  await test$1.expect(redirectOpenInBrowser).toBeVisible({ timeout: 25000 });
191497
191504
  await redirectOpenInBrowser.click();
@@ -192013,7 +192020,6 @@ const EXPANDED_FONT_SIZE = {
192013
192020
  const TEXT_MODIFIER_TAGS = {
192014
192021
  underline: "u",
192015
192022
  strike: "s",
192016
- highlight: "mark",
192017
192023
  };
192018
192024
  const TEXT_MODIFIER_ROLES = {
192019
192025
  bold: "strong",
@@ -192036,6 +192042,7 @@ class EditorPage {
192036
192042
  this.imageUrl = "https://picsum.photos/200/300";
192037
192043
  this.videoUrl = "https://youtu.be/jNQXAC9IVRw";
192038
192044
  this.cannedResponseSuccessMessage = "";
192045
+ this.highlighterCount = 1;
192039
192046
  this.cleanString = (selector = "") => (selector === null || selector === void 0 ? void 0 : selector.replace("neeto-editor-fixed-menu-", "").replace("-option", "")) ||
192040
192047
  "";
192041
192048
  this.fixedMenuOptions = async () => {
@@ -192128,6 +192135,57 @@ class EditorPage {
192128
192135
  await textModifierSelector.click();
192129
192136
  return [{ key: modifierKey, value: randomText }];
192130
192137
  };
192138
+ this.openHighlighterContainer = (isButtonInMoreMenu) => test$1.expect(async () => {
192139
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
192140
+ await this.editorWrapper
192141
+ .getByTestId(NEETO_TEXT_MODIFIER_SELECTORS["highlight"])
192142
+ .locator("svg")
192143
+ .click();
192144
+ await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.customDropdownContainer())).toBeVisible({ timeout: 5000 });
192145
+ }).toPass({ timeout: 30000 });
192146
+ this.focusText = (textLocator) => {
192147
+ const platform = require$$0$8.platform();
192148
+ return test$1.expect(async () => {
192149
+ await textLocator.click();
192150
+ platform === "darwin"
192151
+ ? await this.page.keyboard.press("Meta+ArrowRight")
192152
+ : await this.page.keyboard.press("End");
192153
+ await test$1.expect(textLocator.locator("..")).toHaveClass(/has-focus/, {
192154
+ timeout: 5000,
192155
+ });
192156
+ }).toPass({ timeout: 20000 });
192157
+ };
192158
+ this.highlightText = async (isButtonInMoreMenu, colorIndex) => {
192159
+ const randomText = await this.fillRandomText();
192160
+ await this.openHighlighterContainer(isButtonInMoreMenu);
192161
+ const colorPallete = this.page.getByTestId(COMMON_SELECTORS.customDropdownContainer());
192162
+ await colorPallete
192163
+ .locator(`[style*="(${NEETO_EDITOR_SELECTORS.highlightText(colorIndex)})"]` //TODO: Use data-cy once https://github.com/bigbinary/neeto-editor-nano/issues/784 resolves
192164
+ )
192165
+ .click();
192166
+ await this.openHighlighterContainer(isButtonInMoreMenu);
192167
+ await colorPallete
192168
+ .locator(`[style*="(${NEETO_EDITOR_SELECTORS.highlightBg(colorIndex)})"]`) //TODO: Use data-cy once https://github.com/bigbinary/neeto-editor-nano/issues/784 resolves
192169
+ .click();
192170
+ const highlightedText = this.contentField.getByText(randomText);
192171
+ await this.focusText(highlightedText);
192172
+ const textStyle = await highlightedText.getAttribute("style");
192173
+ test$1.expect(textStyle).toContain(NEETO_EDITOR_SELECTORS.highlightText(colorIndex));
192174
+ test$1.expect(textStyle).toContain(NEETO_EDITOR_SELECTORS.highlightBg(colorIndex));
192175
+ return randomText;
192176
+ };
192177
+ this.verifyTextHighlighter = async (isButtonInMoreMenu, highlighterCount = this.highlighterCount) => {
192178
+ const highlightedKeyValuePairs = [];
192179
+ for (let colorIdx = 1; colorIdx <= highlighterCount; colorIdx++) {
192180
+ await this.moveCursorAtBottom();
192181
+ const randomText = await this.highlightText(isButtonInMoreMenu, colorIdx);
192182
+ highlightedKeyValuePairs.push({
192183
+ key: `highlight-${colorIdx}`,
192184
+ value: randomText,
192185
+ });
192186
+ }
192187
+ return highlightedKeyValuePairs;
192188
+ };
192131
192189
  this.verifyListModifiers = async (modifier, isButtonInMoreMenu) => {
192132
192190
  const modifierKey = modifier;
192133
192191
  const listModifierSelector = this.editorWrapper.getByTestId(LIST_MODIFIER_SELECTORS[modifierKey]);
@@ -192353,7 +192411,7 @@ class EditorPage {
192353
192411
  codeBlock: isButtonInMoreMenu => this.verifyTextModifiers("codeBlock", isButtonInMoreMenu),
192354
192412
  underline: isButtonInMoreMenu => this.verifyTextDeskModifier("underline", isButtonInMoreMenu),
192355
192413
  strike: isButtonInMoreMenu => this.verifyTextDeskModifier("strike", isButtonInMoreMenu),
192356
- highlight: isButtonInMoreMenu => this.verifyTextDeskModifier("highlight", isButtonInMoreMenu),
192414
+ highlight: isButtonInMoreMenu => this.verifyTextHighlighter(isButtonInMoreMenu),
192357
192415
  bulletList: isButtonInMoreMenu => this.verifyListModifiers("bulletList", isButtonInMoreMenu),
192358
192416
  orderedList: isButtonInMoreMenu => this.verifyListModifiers("orderedList", isButtonInMoreMenu),
192359
192417
  link: isButtonInMoreMenu => this.verifyEditorLinkButton(this.linkUrl, isButtonInMoreMenu),
@@ -192373,7 +192431,7 @@ class EditorPage {
192373
192431
  isButtonInMoreMenu,
192374
192432
  }),
192375
192433
  };
192376
- this.verifyDescriptionEditor = async ({ dynamicVariables, linkUrl, videoPath, filePath, imageUrl, videoUrl, cannedResponseSuccessMessage, } = {}) => {
192434
+ this.verifyDescriptionEditor = async ({ dynamicVariables, linkUrl, videoPath, filePath, imageUrl, videoUrl, highlighterCount, cannedResponseSuccessMessage, } = {}) => {
192377
192435
  const fixedMenuButtons = await this.fixedMenuOptions();
192378
192436
  let moreMenuButtons = [];
192379
192437
  (await this.moreMenuSelector.isVisible()) &&
@@ -192383,6 +192441,7 @@ class EditorPage {
192383
192441
  this.videoPath = videoPath || this.videoPath;
192384
192442
  this.imageUrl = imageUrl || this.imageUrl;
192385
192443
  this.videoUrl = videoUrl || this.videoUrl;
192444
+ this.highlighterCount = highlighterCount || this.highlighterCount;
192386
192445
  this.cannedResponseSuccessMessage = cannedResponseSuccessMessage;
192387
192446
  const keysAndValues = [];
192388
192447
  for (const button of [...fixedMenuButtons, ...moreMenuButtons]) {
@@ -192410,7 +192469,7 @@ class EditorPage {
192410
192469
  do {
192411
192470
  randomText = faker.faker.lorem.word(10);
192412
192471
  } while (this.wordsUsedInEditor.includes(randomText));
192413
- await this.contentField.click();
192472
+ await this.contentField.focus();
192414
192473
  await this.moveCursorAtBottom();
192415
192474
  await this.page.keyboard.type(randomText);
192416
192475
  this.wordsUsedInEditor.push(randomText);
@@ -193026,13 +193085,12 @@ class ApiKeysPage {
193026
193085
  await this.page
193027
193086
  .getByTestId(COMMON_SELECTORS.checkboxInput("never-expires"))
193028
193087
  .uncheck();
193029
- await this.page
193088
+ const expiryDateInput = this.page
193030
193089
  .getByTestId(COMMON_SELECTORS.paneBody)
193031
- .getByTestId(ADMIN_PANEL_SELECTORS.expiryDateInput)
193032
- .click();
193033
- //TODO: Use data-cy labels when this https://github.com/bigbinary/neeto-playwright-commons/issues/602 is resolved
193034
- await this.page.getByLabel(DATE_TEXTS.nextYear, { exact: true }).click();
193035
- await this.page.getByText(expiryDate, { exact: true }).click();
193090
+ .getByTestId(ADMIN_PANEL_SELECTORS.expiryDateInput);
193091
+ await expiryDateInput.click();
193092
+ await expiryDateInput.pressSequentially(expiryDate);
193093
+ await expiryDateInput.blur();
193036
193094
  }
193037
193095
  await this.page.getByTestId(COMMON_SELECTORS.saveChangesButton).click();
193038
193096
  await this.neetoPlaywrightUtilities.verifyToast();
@@ -193110,44 +193168,7 @@ class AuditLogsPage {
193110
193168
  }
193111
193169
 
193112
193170
  class CustomDomainPage {
193113
- constructor(page, neetoPlaywrightUtilities, browser // Made optional to avoid breaking changes during the compliance release
193114
- ) {
193115
- this.addCustomDomainViaUI = async (domainName) => {
193116
- const addCustomDomainButton = this.page.getByTestId(CUSTOM_DOMAIN_SELECTORS.addCustomDomainButton);
193117
- await test$1.expect(addCustomDomainButton).toBeVisible();
193118
- (await addCustomDomainButton.isDisabled()) &&
193119
- (await this.deleteCustomDomainViaUI());
193120
- await addCustomDomainButton.click();
193121
- await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.paneBody)).toBeVisible();
193122
- await this.page
193123
- .getByTestId(CUSTOM_DOMAIN_SELECTORS.customDomainInputField)
193124
- .fill(domainName);
193125
- await this.page
193126
- .getByTestId(CUSTOM_DOMAIN_SELECTORS.submitCustomDomainButton)
193127
- .click();
193128
- await Promise.all([
193129
- test$1.expect(this.page.getByTestId(COMMON_SELECTORS.paneBody).getByText(domainName)).toBeVisible(),
193130
- test$1.expect(this.page.getByTestId(CUSTOM_DOMAIN_SELECTORS.customDomainValidateButton)).toBeVisible(),
193131
- ]);
193132
- await this.page.getByTestId(COMMON_SELECTORS.paneModalCrossIcon).click();
193133
- await Promise.all([
193134
- test$1.expect(this.page.getByTestId(COMMON_SELECTORS.paneBody)).toBeHidden(),
193135
- test$1.expect(addCustomDomainButton).toBeDisabled(),
193136
- test$1.expect(this.page.getByTestId(COMMON_SELECTORS.pendingTagContainer)).toBeVisible(),
193137
- ]);
193138
- };
193139
- this.deleteCustomDomainViaUI = async () => {
193140
- await this.page.getByTestId(CUSTOM_DOMAIN_SELECTORS.dropdownButton).click();
193141
- await this.page
193142
- .getByTestId(CUSTOM_DOMAIN_SELECTORS.deleteCustomDomainButton)
193143
- .click();
193144
- await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.alertTitle)).toHaveText(this.t("neetoCustomDomains.delete"));
193145
- await this.page
193146
- .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
193147
- .click();
193148
- await this.neetoPlaywrightUtilities.verifyToast();
193149
- await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.noDataTitle)).toBeVisible();
193150
- };
193171
+ constructor({ browser, page, neetoPlaywrightUtilities, product, }) {
193151
193172
  this.getCustomDomain = (newSubdomain) => {
193152
193173
  const { subdomainName } = getGlobalUserState();
193153
193174
  this.subdomain = newSubdomain !== null && newSubdomain !== void 0 ? newSubdomain : subdomainName;
@@ -193173,6 +193194,7 @@ class CustomDomainPage {
193173
193194
  await test$1.expect(async () => {
193174
193195
  await validateButton.click();
193175
193196
  await this.neetoPlaywrightUtilities.verifyToast({
193197
+ timeout: 15000,
193176
193198
  message: this.t("neetoCustomDomains.validation.successMessage"),
193177
193199
  });
193178
193200
  }).toPass({ timeout: 60000 });
@@ -193180,13 +193202,14 @@ class CustomDomainPage {
193180
193202
  await test$1.expect(this.page.getByTestId(CUSTOM_DOMAIN_SELECTORS.activeTagContainer)).toBeVisible();
193181
193203
  };
193182
193204
  this.loginToCustomDomain = async () => {
193183
- void this.page.close();
193205
+ await this.page.close();
193184
193206
  const loginPage = this.loginPage;
193185
193207
  const { email } = getGlobalUserState();
193186
193208
  const loginUrl = `${this.baseURL}${ROUTES.admin}`;
193187
193209
  const playwrightUtils = new CustomCommands(loginPage, loginPage.request);
193188
193210
  const organizationPage = new OrganizationPage(loginPage, playwrightUtils);
193189
193211
  await loginPage.goto(loginUrl);
193212
+ await playwrightUtils.waitForPageLoad();
193190
193213
  await organizationPage.loginViaSSO(email);
193191
193214
  await test$1.expect(loginPage).toHaveURL(RegExp(loginUrl), { timeout: 15000 });
193192
193215
  await playwrightUtils.waitForPageLoad();
@@ -193211,21 +193234,22 @@ class CustomDomainPage {
193211
193234
  updateCredentials({ key: "baseUrl", value: this.baseURL });
193212
193235
  updateCredentials({ key: "domain", value: CUSTOM_DOMAIN_SUFFIX });
193213
193236
  };
193214
- this.setupCustomDomain = async (product) => {
193237
+ this.setupCustomDomain = async () => {
193215
193238
  if (shouldSkipCustomDomainSetup())
193216
193239
  return;
193217
- await this.connectCustomDomain(product);
193240
+ await this.connectCustomDomain();
193218
193241
  const context = await this.browser.newContext(EMPTY_STORAGE_STATE);
193219
193242
  this.loginPage = await context.newPage();
193220
193243
  await this.loginToCustomDomain();
193221
193244
  await this.saveCustomDomainState();
193222
193245
  };
193223
- this.connectCustomDomain = async (product, subdomain) => {
193246
+ this.connectCustomDomain = async (subdomain) => {
193224
193247
  if (shouldSkipCustomDomainSetup())
193225
193248
  return;
193226
- const baseURL = baseURLGenerator(product, subdomain);
193249
+ const baseURL = baseURLGenerator(this.product, subdomain);
193227
193250
  const domain = this.getCustomDomain(subdomain);
193228
193251
  this.baseURL = `https://${domain}`;
193252
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
193229
193253
  await this.page.goto(`${baseURL}${ROUTES.adminPanel.customDomain}`);
193230
193254
  await this.neetoPlaywrightUtilities.waitForPageLoad();
193231
193255
  await this.addCustomDomain(domain);
@@ -193233,10 +193257,11 @@ class CustomDomainPage {
193233
193257
  process.env.BASE_URL = this.baseURL;
193234
193258
  await this.waitForTrustedSSL();
193235
193259
  };
193236
- this.disconnectCustomDomain = async (product, subdomain) => {
193260
+ this.disconnectCustomDomain = async () => {
193237
193261
  if (shouldSkipCustomDomainSetup())
193238
193262
  return;
193239
- const baseURL = baseURLGenerator(product, subdomain);
193263
+ const baseURL = baseURLGenerator(this.product, this.subdomain);
193264
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
193240
193265
  await this.page.goto(`${baseURL}${ROUTES.adminPanel.customDomain}`);
193241
193266
  await this.neetoPlaywrightUtilities.waitForPageLoad();
193242
193267
  await this.page.getByTestId(CUSTOM_DOMAIN_SELECTORS.dropdownButton).click();
@@ -193250,10 +193275,11 @@ class CustomDomainPage {
193250
193275
  await this.neetoPlaywrightUtilities.verifyToast();
193251
193276
  await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.noDataTitle)).toBeVisible();
193252
193277
  };
193253
- this.browser = browser;
193254
193278
  this.page = page;
193255
- this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
193279
+ this.browser = browser;
193280
+ this.product = product;
193256
193281
  this.t = playwrightI18nextFixture.getI18nInstance().t;
193282
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
193257
193283
  }
193258
193284
  }
193259
193285
 
@@ -195430,7 +195456,7 @@ const definePlaywrightConfig = (overrides) => {
195430
195456
  geolocation: { latitude: 18.553187, longitude: 73.948313 }, // BB Pune office
195431
195457
  permissions: ["geolocation"],
195432
195458
  launchOptions: {
195433
- args: ["--js-flags=--max-old-space-size=4096"],
195459
+ args: ["--js-flags=--max-old-space-size=6144"],
195434
195460
  },
195435
195461
  ...useOverrides,
195436
195462
  },
@@ -195482,7 +195508,7 @@ exports.CREDENTIALS = CREDENTIALS;
195482
195508
  exports.CUSTOM_DOMAIN_SELECTORS = CUSTOM_DOMAIN_SELECTORS;
195483
195509
  exports.CUSTOM_DOMAIN_SUFFIX = CUSTOM_DOMAIN_SUFFIX;
195484
195510
  exports.CustomCommands = CustomCommands;
195485
- exports.CustomDomainsPage = CustomDomainPage;
195511
+ exports.CustomDomainPage = CustomDomainPage;
195486
195512
  exports.DATE_PICKER_SELECTORS = DATE_PICKER_SELECTORS;
195487
195513
  exports.DATE_TEXTS = DATE_TEXTS;
195488
195514
  exports.DESCRIPTION_EDITOR_TEXTS = DESCRIPTION_EDITOR_TEXTS;