@bigbinary/neeto-playwright-commons 1.8.2 → 1.8.3

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
@@ -183,6 +183,7 @@ const COMMON_SELECTORS = {
183
183
  pageLoader: "neeto-molecules-page-loader",
184
184
  homeButton: "home-button",
185
185
  neetoUiSwitch: "nui-switch",
186
+ floatingActionMenuButton: "floating-action-menu-container",
186
187
  };
187
188
 
188
189
  class CustomCommands {
@@ -7269,6 +7270,15 @@ class HelpAndProfilePage {
7269
7270
  await test.expect(this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton)).toBeVisible();
7270
7271
  }).toPass({ timeout: 15000 });
7271
7272
  };
7273
+ this.openHelpCenterV2 = async () => {
7274
+ await test.expect(async () => {
7275
+ await this.hoverOnBody();
7276
+ const floatingActionMenuButton = this.page.getByTestId(COMMON_SELECTORS.floatingActionMenuButton);
7277
+ await floatingActionMenuButton.scrollIntoViewIfNeeded();
7278
+ await floatingActionMenuButton.hover();
7279
+ await test.expect(this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton)).toBeVisible();
7280
+ }).toPass({ timeout: 15000 });
7281
+ };
7272
7282
  this.openLiveChatAndVerify = async () => {
7273
7283
  await this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton).click();
7274
7284
  await test.expect(this.neetoChatWidget).toBeVisible();
@@ -7313,6 +7323,46 @@ class HelpAndProfilePage {
7313
7323
  await test.expect(this.neetoChatFrame.getByTestId(CHAT_WIDGET_SELECTORS.chatBubble)).toHaveText(CHAT_WIDGET_TEXTS.welcomeChatBubble);
7314
7324
  });
7315
7325
  };
7326
+ this.openAndVerifyChatWidgetV2 = async () => {
7327
+ const chatInitializationApis = this.neetoPlaywrightUtilities.interceptMultipleResponses({
7328
+ baseUrl: this.chatApiBaseURL,
7329
+ times: 3,
7330
+ timeout: 20 * 1000, // Increased timeout accounting delays in page load
7331
+ });
7332
+ await this.page.reload();
7333
+ await chatInitializationApis;
7334
+ await test.test.step("Step 1: Open Help Center links", this.openHelpCenterV2);
7335
+ await test.test.step("Step 2: Open live chat and verify iframe", this.openLiveChatAndVerify);
7336
+ await test.test.step("Step 3: Close and reopen live chat frame", async () => {
7337
+ await this.page.getByTestId(CHAT_WIDGET_SELECTORS.closeChat).click();
7338
+ await test.expect(this.neetoChatWidget).toBeHidden();
7339
+ await this.openHelpCenterV2();
7340
+ await this.openLiveChatAndVerify();
7341
+ });
7342
+ await test.test.step("Step 4: Start new conversation", async () => {
7343
+ const newConversationButton = this.neetoChatFrame.getByRole("button", {
7344
+ name: CHAT_WIDGET_TEXTS.newConversation,
7345
+ });
7346
+ await test.expect(newConversationButton).toBeVisible(); // Adding additional toBeVisible to take advantage of the auto-retrying web-first assertion
7347
+ await newConversationButton.click();
7348
+ await test.expect(this.neetoChatSpinner).toBeHidden();
7349
+ });
7350
+ await test.test.step("Step 5: Fill and submit email", async () => {
7351
+ var _a, _b;
7352
+ await this.neetoChatFrame
7353
+ .getByTestId(CHAT_WIDGET_SELECTORS.preChatEmailInput)
7354
+ .fill((_b = (_a = readFileSyncIfExists()) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.email);
7355
+ await this.neetoChatFrame
7356
+ .getByTestId(CHAT_WIDGET_SELECTORS.preChatSubmitButton)
7357
+ .getByRole("button")
7358
+ .click();
7359
+ await test.expect(this.neetoChatSpinner).toBeHidden();
7360
+ });
7361
+ await test.test.step("Step 6: Verify conversation window", async () => {
7362
+ await test.expect(this.neetoChatFrame.getByTestId(CHAT_WIDGET_SELECTORS.chatBubble)).toHaveText(CHAT_WIDGET_TEXTS.welcomeChatBubble);
7363
+ });
7364
+ };
7365
+ // TODO Remove when all apps have migrated to the new navbar style
7316
7366
  this.openAndVerifyHelpArticles = async () => {
7317
7367
  await test.test.step("Step 1: Open Help Center links", this.openHelpCenter);
7318
7368
  await test.test.step("Step 2: Open and verify help articles link", async () => {
@@ -7326,12 +7376,34 @@ class HelpAndProfilePage {
7326
7376
  await helpArticlesPage.close();
7327
7377
  });
7328
7378
  };
7379
+ this.openAndVerifyHelpArticlesV2 = async () => {
7380
+ await test.test.step("Step 1: Open Help Center links", this.openHelpCenterV2);
7381
+ await test.test.step("Step 2: Open and verify help articles link", async () => {
7382
+ const helpArticlesPromise = this.page.waitForEvent("popup");
7383
+ await this.page
7384
+ .getByTestId(HELP_CENTER_SELECTORS.documentationButton)
7385
+ .click();
7386
+ const helpArticlesPage = await helpArticlesPromise;
7387
+ await helpArticlesPage.waitForLoadState();
7388
+ await test.expect(helpArticlesPage).toHaveURL(this.kbDocsBaseURL);
7389
+ await helpArticlesPage.close();
7390
+ });
7391
+ };
7392
+ // TODO Remove when all apps have migrated to the new navbar style
7329
7393
  this.openChangelogPane = async () => {
7330
7394
  await test.expect(async () => {
7331
7395
  await this.page.getByTestId(HELP_CENTER_SELECTORS.whatsNewButton).click();
7332
7396
  await test.expect(this.page.locator(CHANGELOG_WIDGET_SELECTORS.changelogWrapper)).toBeVisible();
7333
7397
  }).toPass({ timeout: 15000 });
7334
7398
  };
7399
+ this.openChangelogPaneV2 = async () => {
7400
+ await test.expect(async () => {
7401
+ await this.openHelpCenterV2();
7402
+ await this.page.getByTestId(HELP_CENTER_SELECTORS.whatsNewButton).click();
7403
+ await test.expect(this.page.locator(CHANGELOG_WIDGET_SELECTORS.changelogWrapper)).toBeVisible();
7404
+ }).toPass({ timeout: 45000 });
7405
+ };
7406
+ // TODO Remove when all apps have migrated to the new navbar style
7335
7407
  this.openAndVerifyChangelog = async () => {
7336
7408
  await test.test.step("Step 1: Open Help Center links", this.openHelpCenter);
7337
7409
  await test.test.step("Step 2: Open and verify changelog pane", this.openChangelogPane);
@@ -7358,6 +7430,30 @@ class HelpAndProfilePage {
7358
7430
  await changelogPage.close();
7359
7431
  });
7360
7432
  };
7433
+ this.openAndVerifyChangelogV2 = async () => {
7434
+ await test.test.step("Step 1: Open Help Center links and changelog", this.openChangelogPaneV2);
7435
+ await test.test.step("Step 2: Close and reopen changelog pane", async () => {
7436
+ await this.page
7437
+ .getByTestId(CHANGELOG_WIDGET_SELECTORS.closeButton)
7438
+ .click();
7439
+ await test.expect(this.page.locator(CHANGELOG_WIDGET_SELECTORS.changelogWrapper)).toBeHidden();
7440
+ await this.openChangelogPaneV2();
7441
+ });
7442
+ await test.test.step("Step 3: Open and verify public URL", async () => {
7443
+ const changelogPagePromise = this.page.waitForEvent("popup");
7444
+ await this.page
7445
+ .getByTestId(CHANGELOG_WIDGET_SELECTORS.publicUrlLink)
7446
+ .click();
7447
+ const changelogPage = await changelogPagePromise;
7448
+ await this.neetoPlaywrightUtilities.interceptMultipleResponses({
7449
+ customPageContext: changelogPage,
7450
+ baseUrl: this.changelogBaseURL.split("/site")[0],
7451
+ times: 3,
7452
+ });
7453
+ await test.expect(changelogPage).toHaveURL(this.changelogBaseURL);
7454
+ await changelogPage.close();
7455
+ });
7456
+ };
7361
7457
  this.formatKeyboardShortcut = (shortcut, osPlatform = "windows") => {
7362
7458
  const formattedShortcut = shortcut
7363
7459
  .replaceAll(" ", "then")
@@ -7411,6 +7507,53 @@ class HelpAndProfilePage {
7411
7507
  .locator("div")).toHaveText(formattedSequences);
7412
7508
  });
7413
7509
  };
7510
+ // TODO Remove when all apps have migrated to the new navbar style
7511
+ this.openAndVerifyKeyboardShortcutsPaneV2 = async (productShortcuts, osPlatform = "windows") => {
7512
+ const globalShortcuts = [
7513
+ {
7514
+ description: this.t("neetoMolecules.keyboardShortcuts.global.openKeyboardShortcutsPane"),
7515
+ sequence: "shift+/",
7516
+ },
7517
+ {
7518
+ description: this.t("neetoMolecules.keyboardShortcuts.global.close"),
7519
+ sequence: "esc",
7520
+ },
7521
+ {
7522
+ description: this.t("neetoMolecules.keyboardShortcuts.global.submitForm"),
7523
+ sequence: "ctrl+enter",
7524
+ },
7525
+ ];
7526
+ const shortcuts = [...globalShortcuts, ...productShortcuts];
7527
+ await test.test.step("Step 1: Open Help Center", this.openHelpCenterV2);
7528
+ await test.test.step("Step 2: Open and close keyboard shortcuts from UI", async () => {
7529
+ await this.page
7530
+ .getByTestId(HELP_CENTER_SELECTORS.keyboardShortcutButton)
7531
+ .click();
7532
+ await test.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7533
+ await this.page
7534
+ .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.closePaneButton)
7535
+ .click();
7536
+ await test.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).toHaveCSS("width", "1px");
7537
+ });
7538
+ await test.test.step("Step 3: Open and close keyboard shortcuts through shortcut", async () => {
7539
+ await this.page.keyboard.press("Shift+/");
7540
+ await test.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7541
+ await this.page.keyboard.press("Escape");
7542
+ await test.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).toHaveCSS("width", "1px");
7543
+ });
7544
+ await test.test.step("Step 4: Verify all displayed keyboard shortcuts", async () => {
7545
+ await this.page.keyboard.press("Shift+/");
7546
+ await test.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7547
+ await test.expect(this.page
7548
+ .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.hotKeyItem)
7549
+ .locator("p")).toHaveText(shortcuts.map(shortcut => shortcut.description));
7550
+ const formattedSequences = shortcuts.map(shortcut => this.formatKeyboardShortcut(shortcut.sequence, osPlatform));
7551
+ await test.expect(this.page
7552
+ .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.hotKeyItem)
7553
+ .locator("div")).toHaveText(formattedSequences);
7554
+ });
7555
+ };
7556
+ // TODO Remove when all apps have migrated to the new navbar style
7414
7557
  this.openAppSwitcherAndVerify = async () => {
7415
7558
  const appSwitcher = this.page.getByTestId(COMMON_SELECTORS.appSwitcherButton);
7416
7559
  await test.test.step("Step 1: Verify hovering over app switcher opens the app switcher drawer", () => test.expect(async () => {
@@ -7420,6 +7563,16 @@ class HelpAndProfilePage {
7420
7563
  await test.expect(this.page.getByTestId(COMMON_SELECTORS.appSwitcherWrapper)).toBeVisible();
7421
7564
  }).toPass({ timeout: 15000 }));
7422
7565
  };
7566
+ this.openAppSwitcherAndVerifyV2 = async () => {
7567
+ await test.test.step("Step 1: Verify hovering over app switcher opens the app switcher drawer", () => test.expect(async () => {
7568
+ await this.openHelpCenterV2();
7569
+ await this.page
7570
+ .getByTestId(COMMON_SELECTORS.appSwitcherButton)
7571
+ .hover();
7572
+ await test.expect(this.page.getByTestId(COMMON_SELECTORS.appSwitcherWrapper)).toBeVisible();
7573
+ }).toPass({ timeout: 45000 }));
7574
+ };
7575
+ // TODO Remove when all apps have migrated to the new navbar style
7423
7576
  this.openProfilePopup = () => test.expect(async () => {
7424
7577
  await this.hoverOnBody();
7425
7578
  await this.profileSectionButton.scrollIntoViewIfNeeded();
@@ -7436,6 +7589,7 @@ class HelpAndProfilePage {
7436
7589
  await test.expect(profilePage).toHaveURL(new RegExp(redirectLink));
7437
7590
  await profilePage.close();
7438
7591
  };
7592
+ // TODO Remove when all apps have migrated to the new navbar style
7439
7593
  this.verifyProfileAndOrganizationLinks = async () => {
7440
7594
  await test.test.step("Step 1: Open Profile popup and verify", this.openProfilePopup);
7441
7595
  await test.test.step("Step 2: Open My profile link and verify", async () => this.openAuthLinkAndVerify({
@@ -7448,6 +7602,19 @@ class HelpAndProfilePage {
7448
7602
  redirectLink: ROUTES.authSettings,
7449
7603
  }));
7450
7604
  };
7605
+ this.verifyProfileAndOrganizationLinksV2 = async () => {
7606
+ await test.test.step("Step 1: Open Help center and verify", this.openHelpCenterV2);
7607
+ await test.test.step("Step 2: Open My profile link and verify", async () => this.openAuthLinkAndVerify({
7608
+ linkSelector: PROFILE_SECTION_SELECTORS.myProfileButton,
7609
+ redirectLink: ROUTES.myProfile,
7610
+ }));
7611
+ await test.test.step("Step 3: Open Help center and verify", this.openHelpCenterV2);
7612
+ await test.test.step("Step 4: Open My organization link and verify", async () => this.openAuthLinkAndVerify({
7613
+ linkSelector: PROFILE_SECTION_SELECTORS.profileOrganizationSettingsButton,
7614
+ redirectLink: ROUTES.authSettings,
7615
+ }));
7616
+ };
7617
+ // TODO Remove when all apps have migrated to the new navbar style
7451
7618
  this.verifyLogout = async () => {
7452
7619
  if (shouldSkipSetupAndTeardown())
7453
7620
  return;
@@ -7460,6 +7627,18 @@ class HelpAndProfilePage {
7460
7627
  await test.expect(this.page).toHaveURL(new RegExp(ROUTES.loginLink));
7461
7628
  });
7462
7629
  };
7630
+ this.verifyLogoutV2 = async () => {
7631
+ if (shouldSkipSetupAndTeardown())
7632
+ return;
7633
+ await test.test.step("Step 1: Open Help center and verify", this.openHelpCenterV2);
7634
+ await test.test.step("Step 2: Click logout and verify", async () => {
7635
+ await this.page
7636
+ .getByTestId(PROFILE_SECTION_SELECTORS.logoutButton)
7637
+ .click();
7638
+ await test.expect(this.page).toHaveURL(NEETO_AUTH_BASE_URL());
7639
+ await test.expect(this.page).toHaveURL(new RegExp(ROUTES.loginLink));
7640
+ });
7641
+ };
7463
7642
  this.page = page;
7464
7643
  this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
7465
7644
  this.chatApiBaseURL = chatApiBaseURL;