@bigbinary/neeto-playwright-commons 1.27.0 → 1.27.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
@@ -5046,7 +5046,6 @@ const generateStagingData = (product = "invoice") => {
5046
5046
  };
5047
5047
  };
5048
5048
 
5049
- /* eslint-disable playwright/no-skipped-test */
5050
5049
  const execCommand = (command) => child_process.execSync(command)
5051
5050
  .toString("utf-8")
5052
5051
  .replace(/[\n\r\s]+$/, "");
@@ -5211,7 +5210,7 @@ const globalShortcuts = (t) => [
5211
5210
  },
5212
5211
  {
5213
5212
  description: t("neetoMolecules.keyboardShortcuts.global.openProductSwitcher"),
5214
- sequence: "ctrl+e",
5213
+ sequence: "ctrl+u",
5215
5214
  },
5216
5215
  ];
5217
5216
  const generatePhoneNumber = () => `${"+91"} 9${faker.faker.string.numeric(4)} ${faker.faker.string.numeric(5)}`;
@@ -5377,8 +5376,9 @@ const NEETO_FILTERS_SELECTORS = {
5377
5376
  };
5378
5377
 
5379
5378
  const HELP_CENTER_SELECTORS = {
5379
+ helpMenuBtn: "help-menu-button",
5380
5380
  helpButton: "help-button",
5381
- documentationButton: "help-link-help-center-button",
5381
+ documentationButton: "help-link-help-articles-button",
5382
5382
  keyboardShortcutButton: "help-link-keyboard-shortcut-button",
5383
5383
  chatButton: "help-link-live-chat-button",
5384
5384
  whatsNewButton: "help-link-engage-button",
@@ -114416,29 +114416,21 @@ const THEMES_TEXTS = {
114416
114416
 
114417
114417
  class HelpAndProfilePage {
114418
114418
  constructor({ page, neetoPlaywrightUtilities, chatApiBaseURL, kbDocsBaseURL, changelogBaseURL, }) {
114419
- this.hoverOnBody = () => this.page.locator("body").hover({ timeout: 10000 });
114420
114419
  this.openHelpCenter = async () => {
114420
+ const floatingActionMenuBtn = this.page.getByTestId(COMMON_SELECTORS.floatingActionMenuButton);
114421
114421
  await test.expect(async () => {
114422
- await this.hoverOnBody();
114423
- const floatingActionMenuButton = this.page.getByTestId(COMMON_SELECTORS.floatingActionMenuButton);
114424
- await floatingActionMenuButton.scrollIntoViewIfNeeded();
114425
- await floatingActionMenuButton.hover();
114426
- await test.expect(this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton)).toBeVisible();
114422
+ await floatingActionMenuBtn.scrollIntoViewIfNeeded();
114423
+ await floatingActionMenuBtn.hover();
114424
+ await test.expect(this.page.getByTestId(HELP_CENTER_SELECTORS.whatsNewButton)).toBeVisible();
114427
114425
  }).toPass({ timeout: 60000 });
114428
114426
  };
114429
- this.openLiveChatAndVerify = async (widgetVisibilityTimeout = 10000) => {
114430
- await test.expect(async () => {
114431
- await this.openHelpCenter();
114432
- await this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton).click();
114433
- await test.expect(this.neetoChatWidget).toBeVisible({
114434
- timeout: widgetVisibilityTimeout,
114435
- });
114436
- await test.expect(this.neetoChatSpinner).toBeHidden({ timeout: 20 * 1000 });
114437
- await test.expect(this.neetoChatWidget).toBeVisible({
114438
- timeout: widgetVisibilityTimeout,
114439
- });
114440
- }).toPass({ timeout: 35000 + widgetVisibilityTimeout * 2 });
114441
- };
114427
+ this.openLiveChatAndVerify = () => test.expect(async () => {
114428
+ await this.openHelpCenter();
114429
+ await this.page.getByTestId(HELP_CENTER_SELECTORS.helpMenuBtn).click();
114430
+ await this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton).click();
114431
+ await test.expect(this.neetoChatSpinner).toBeHidden({ timeout: 20000 });
114432
+ await test.expect(this.neetoChatWidget).toBeVisible({ timeout: 10000 });
114433
+ }).toPass({ timeout: 60000 });
114442
114434
  /**
114443
114435
  * @deprecated This method is deprecated. Use openAndVerifyChatWidget instead.
114444
114436
  */
@@ -114458,7 +114450,7 @@ class HelpAndProfilePage {
114458
114450
  this.openAndVerifyChatWidget = async () => {
114459
114451
  await this.page.reload();
114460
114452
  await this.neetoPlaywrightUtilities.waitForPageLoad();
114461
- await test.test.step("1: Open live chat and verify iframe", () => this.openLiveChatAndVerify());
114453
+ await test.test.step("1: Open live chat", this.openLiveChatAndVerify);
114462
114454
  await test.test.step("2: Close and reopen live chat frame", async () => {
114463
114455
  await this.page.getByTestId(CHAT_WIDGET_SELECTORS.closeChat).click();
114464
114456
  await test.expect(this.neetoChatWidget).toBeHidden({ timeout: 35000 });
@@ -114487,6 +114479,7 @@ class HelpAndProfilePage {
114487
114479
  this.openAndVerifyHelpArticles = async () => {
114488
114480
  await test.test.step("1: Open Help Center links", this.openHelpCenter);
114489
114481
  await test.test.step("2: Open and verify help articles link", async () => {
114482
+ await this.page.getByTestId(HELP_CENTER_SELECTORS.helpMenuBtn).click();
114490
114483
  const helpArticlesPromise = this.page.waitForEvent("popup");
114491
114484
  await this.page
114492
114485
  .getByTestId(HELP_CENTER_SELECTORS.documentationButton)
@@ -114527,7 +114520,7 @@ class HelpAndProfilePage {
114527
114520
  });
114528
114521
  };
114529
114522
  this.openAndVerifyChangelog = async () => {
114530
- await test.test.step("1: Open Help Center links and changelog", this.openChangelogPane);
114523
+ await test.test.step("1: Open changelog", this.openChangelogPane);
114531
114524
  await test.test.step("2: Close and reopen changelog pane", async () => {
114532
114525
  await this.page
114533
114526
  .getByTestId(CHANGELOG_WIDGET_SELECTORS.closeButton)
@@ -114544,8 +114537,10 @@ class HelpAndProfilePage {
114544
114537
  await this.neetoPlaywrightUtilities.waitForPageLoad({
114545
114538
  customPageContext: changelogPage,
114546
114539
  });
114547
- await test.expect(changelogPage.getByRole("button", { name: ENGAGE_TEXTS.subscribe })).toBeVisible({ timeout: 10000 });
114548
- await test.expect(changelogPage).toHaveURL(this.changelogBaseURL);
114540
+ await Promise.all([
114541
+ test.expect(changelogPage).toHaveURL(this.changelogBaseURL),
114542
+ test.expect(changelogPage.getByRole("button", { name: ENGAGE_TEXTS.subscribe })).toBeVisible({ timeout: 10000 }),
114543
+ ]);
114549
114544
  await changelogPage.close();
114550
114545
  });
114551
114546
  };
@@ -114664,21 +114659,21 @@ class HelpAndProfilePage {
114664
114659
  await test.expect(this.page.getByTestId(COMMON_SELECTORS.appSwitcherWrapper)).toBeVisible();
114665
114660
  }).toPass({ timeout: 45000 }));
114666
114661
  await test.test.step("2: Verify search functionality", async () => {
114667
- const playdashAppLink = this.page.getByTestId(COMMON_SELECTORS.appLink(productName));
114668
- const replayAppLink = this.page.getByTestId(COMMON_SELECTORS.appLink("Replay"));
114662
+ const playdash = this.page.getByTestId(COMMON_SELECTORS.appLink(productName));
114663
+ const replay = this.page.getByTestId(COMMON_SELECTORS.appLink("Replay"));
114669
114664
  const searchInput = this.page.getByTestId(COMMON_SELECTORS.productSwitcherSearchInput);
114670
114665
  await searchInput.fill(faker.faker.word.words(3));
114671
114666
  //TODO: Use data-testid label when this https://github.com/bigbinary/neeto-molecules/issues/2114 is resolved
114672
114667
  await test.expect(this.page.getByText(this.t("neetoMolecules.productSwitcher.noApps"))).toBeVisible();
114673
114668
  await searchInput.fill(searchQueryPartial);
114674
114669
  await Promise.all([
114675
- test.expect(playdashAppLink).toBeVisible(),
114676
- test.expect(replayAppLink).toBeVisible(),
114670
+ test.expect(playdash).toBeVisible(),
114671
+ test.expect(replay).toBeVisible(),
114677
114672
  ]);
114678
114673
  await searchInput.fill(searchQueryFull);
114679
114674
  await Promise.all([
114680
- test.expect(playdashAppLink).toBeVisible(),
114681
- test.expect(replayAppLink).toBeHidden(),
114675
+ test.expect(playdash).toBeVisible(),
114676
+ test.expect(replay).toBeHidden(),
114682
114677
  ]);
114683
114678
  });
114684
114679
  };
@@ -114705,7 +114700,7 @@ class HelpAndProfilePage {
114705
114700
  this.verifyLogout = async () => {
114706
114701
  if (shouldSkipSetupAndTeardown())
114707
114702
  return;
114708
- await test.test.step("1: Open Help center and verify", this.openHelpCenter);
114703
+ await test.test.step("1: Open Help center", this.openHelpCenter);
114709
114704
  await test.test.step("2: Click logout and verify", async () => {
114710
114705
  await this.page
114711
114706
  .getByTestId(PROFILE_SECTION_SELECTORS.logoutButton)
@@ -114787,6 +114782,7 @@ class HelpAndProfilePage {
114787
114782
  this.openAndVerifyStatus = async (appName) => {
114788
114783
  await test.test.step("1: Open Help Center links", this.openHelpCenter);
114789
114784
  await test.test.step("2: Open and verify status page", async () => {
114785
+ await this.page.getByTestId(HELP_CENTER_SELECTORS.helpMenuBtn).click();
114790
114786
  const statusPagePromise = this.page.waitForEvent("popup");
114791
114787
  await this.page.getByTestId(HELP_CENTER_SELECTORS.statusButton).click();
114792
114788
  const statusPage = await statusPagePromise;
@@ -114800,6 +114796,7 @@ class HelpAndProfilePage {
114800
114796
  this.openAndVerifyCommunity = async () => {
114801
114797
  await test.test.step("1: Open Help Center links", this.openHelpCenter);
114802
114798
  await test.test.step("2: Open and verify community", async () => {
114799
+ await this.page.getByTestId(HELP_CENTER_SELECTORS.helpMenuBtn).click();
114803
114800
  const communityPagePromise = this.page.waitForEvent("popup");
114804
114801
  await this.page
114805
114802
  .getByTestId(HELP_CENTER_SELECTORS.communityButton)
@@ -119248,36 +119245,45 @@ class OrganizationPage {
119248
119245
  }
119249
119246
  }
119250
119247
 
119248
+ dayjs.extend(customParseFormat);
119251
119249
  class ApiKeysPage {
119252
119250
  constructor(page, neetoPlaywrightUtilities) {
119251
+ this.page = page;
119252
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
119253
+ this.enableExpiryDate = async (expiryDate) => {
119254
+ const userProps = await getGlobalUserProps(this.page);
119255
+ const normalizedDate = dayjs(expiryDate, DATE_FORMATS.date);
119256
+ const formattedExpiryDate = normalizedDate.format(userProps === null || userProps === void 0 ? void 0 : userProps.dateFormat);
119257
+ const expiryDateInput = this.page
119258
+ .getByTestId(COMMON_SELECTORS.paneBody)
119259
+ .getByTestId(ADMIN_PANEL_SELECTORS.expiryDateInput);
119260
+ const nextYearBtn = this.page.getByLabel(DATE_TEXTS.nextYear, {
119261
+ exact: true,
119262
+ });
119263
+ await this.page
119264
+ .getByTestId(COMMON_SELECTORS.checkboxInput("never-expires"))
119265
+ .uncheck();
119266
+ await expiryDateInput.click();
119267
+ await test.expect(nextYearBtn).toBeVisible();
119268
+ await expiryDateInput.pressSequentially(formattedExpiryDate, {
119269
+ delay: 250,
119270
+ });
119271
+ await Promise.all([
119272
+ test.expect(expiryDateInput).toHaveValue(formattedExpiryDate),
119273
+ test.expect(this.page.getByRole("button", { name: CALENDAR_LABELS.month })).toHaveText(normalizedDate.format(DATE_FORMATS.month)),
119274
+ test.expect(this.page.getByRole("button", { name: CALENDAR_LABELS.year })).toHaveText(normalizedDate.format(DATE_FORMATS.year)),
119275
+ test.expect(this.page.getByTitle(normalizedDate.format(DATE_FORMATS.calendarDate))).toHaveClass(RegExp(DATE_PICKER_SELECTORS.selectedDateInCalendarClass)),
119276
+ ]);
119277
+ await this.page.keyboard.press("Enter");
119278
+ await test.expect(nextYearBtn).toBeHidden();
119279
+ };
119253
119280
  this.fillApiKeyDetails = async ({ label, expiryDate }) => {
119254
119281
  await this.page
119255
119282
  .getByTestId(COMMON_SELECTORS.paneBody)
119256
119283
  .getByTestId(COMMON_SELECTORS.customInputField("label"))
119257
119284
  .fill(label);
119258
- if (expiryDate) {
119259
- await this.page
119260
- .getByTestId(COMMON_SELECTORS.checkboxInput("never-expires"))
119261
- .uncheck();
119262
- const expiryDateInput = this.page
119263
- .getByTestId(COMMON_SELECTORS.paneBody)
119264
- .getByTestId(ADMIN_PANEL_SELECTORS.expiryDateInput);
119265
- await expiryDateInput.click();
119266
- await test.expect(this.page.getByLabel(DATE_TEXTS.nextYear, { exact: true })).toBeVisible();
119267
- await expiryDateInput.pressSequentially(expiryDate, { delay: 250 });
119268
- dayjs.extend(customParseFormat);
119269
- const parsedExpiryDate = dayjs(expiryDate, DATE_FORMATS.date);
119270
- await Promise.all([
119271
- test.expect(expiryDateInput).toHaveValue(expiryDate),
119272
- test.expect(this.page.getByRole("button", { name: CALENDAR_LABELS.month })).toHaveText(parsedExpiryDate.format(DATE_FORMATS.month)),
119273
- test.expect(this.page.getByRole("button", { name: CALENDAR_LABELS.year })).toHaveText(parsedExpiryDate.format(DATE_FORMATS.year)),
119274
- test.expect(this.page.getByTitle(parsedExpiryDate.format(DATE_FORMATS.calendarDate))).toHaveClass(RegExp(DATE_PICKER_SELECTORS.selectedDateInCalendarClass)),
119275
- ]);
119276
- await this.page.keyboard.press("Enter");
119277
- await test.expect(this.page.getByLabel(DATE_TEXTS.nextYear, { exact: true })).toBeHidden();
119278
- }
119279
- await this.page.getByTestId(COMMON_SELECTORS.saveChangesButton).click();
119280
- await this.neetoPlaywrightUtilities.verifyToast();
119285
+ neetoCist.isPresent(expiryDate) && (await this.enableExpiryDate(expiryDate));
119286
+ await this.neetoPlaywrightUtilities.saveChanges({ isPane: true });
119281
119287
  };
119282
119288
  this.verifyApiKey = ({ targetRow, label, date }) => Promise.all([
119283
119289
  test.expect(targetRow.getByRole("cell", { name: label })).toBeVisible(),
@@ -119306,8 +119312,6 @@ class ApiKeysPage {
119306
119312
  await this.neetoPlaywrightUtilities.verifyToast();
119307
119313
  await test.expect(targetRow).toBeHidden();
119308
119314
  };
119309
- this.page = page;
119310
- this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
119311
119315
  this.t = playwrightI18nextFixture.getI18nInstance().t;
119312
119316
  }
119313
119317
  }
@@ -119924,6 +119928,11 @@ const TEAM_MEMBER_TEXTS = {
119924
119928
  emailSubject: "Your team members export is here",
119925
119929
  };
119926
119930
 
119931
+ const KEYBOARD_SHORTCUT_TEST_CASES = [
119932
+ { os: "windows", agent: USER_AGENTS.windows },
119933
+ { os: "mac", agent: USER_AGENTS.mac },
119934
+ ];
119935
+
119927
119936
  const PHONE_NUMBER_FORMATS = [
119928
119937
  { name: "Afghanistan", code: "+93", format: "70#######", flag: "🇦🇫" },
119929
119938
  { name: "Aland", code: "+358", format: "5####", flag: "🇦🇽" },
@@ -125413,6 +125422,7 @@ exports.ImageUploader = ImageUploader;
125413
125422
  exports.IntegrationBase = IntegrationBase;
125414
125423
  exports.IpRestrictionsApi = IpRestrictionsApi;
125415
125424
  exports.KEYBOARD_SHORTCUTS_SELECTORS = KEYBOARD_SHORTCUTS_SELECTORS;
125425
+ exports.KEYBOARD_SHORTCUT_TEST_CASES = KEYBOARD_SHORTCUT_TEST_CASES;
125416
125426
  exports.LIST_MODIFIER_SELECTORS = LIST_MODIFIER_SELECTORS;
125417
125427
  exports.LIST_MODIFIER_TAGS = LIST_MODIFIER_TAGS;
125418
125428
  exports.LOGIN_SELECTORS = LOGIN_SELECTORS;