@bigbinary/neeto-playwright-commons 1.8.12 → 1.8.14

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
@@ -7283,15 +7283,6 @@ const KEYBOARD_SHORTCUTS_SELECTORS = {
7283
7283
  class HelpAndProfilePage {
7284
7284
  constructor({ page, neetoPlaywrightUtilities, chatApiBaseURL, kbDocsBaseURL, changelogBaseURL, }) {
7285
7285
  this.hoverOnBody = () => this.page.locator("body").hover();
7286
- this.openHelpCenter = async () => {
7287
- await test.expect(async () => {
7288
- await this.hoverOnBody();
7289
- const helpButton = this.page.getByTestId(CHAT_WIDGET_SELECTORS.helpButton);
7290
- await helpButton.scrollIntoViewIfNeeded();
7291
- await helpButton.hover();
7292
- await test.expect(this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton)).toBeVisible();
7293
- }).toPass({ timeout: 15000 });
7294
- };
7295
7286
  this.openHelpCenterV2 = async () => {
7296
7287
  await test.expect(async () => {
7297
7288
  await this.hoverOnBody();
@@ -7302,74 +7293,36 @@ class HelpAndProfilePage {
7302
7293
  }).toPass({ timeout: 15000 });
7303
7294
  };
7304
7295
  this.openLiveChatAndVerify = async () => {
7305
- await this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton).click();
7306
- await test.expect(this.neetoChatWidget).toBeVisible();
7307
- await test.expect(this.neetoChatSpinner).toBeHidden();
7308
- };
7309
- this.openAndVerifyChatWidget = async () => {
7310
- const chatInitializationApis = this.neetoPlaywrightUtilities.interceptMultipleResponses({
7311
- baseUrl: this.chatApiBaseURL,
7312
- times: 3,
7313
- timeout: 20 * 1000, // Increased timeout accounting delays in page load
7314
- });
7315
- await this.page.reload();
7316
- await chatInitializationApis;
7317
- await test.test.step("Step 1: Open Help Center links", this.openHelpCenter);
7318
- await test.test.step("Step 2: Open live chat and verify iframe", this.openLiveChatAndVerify);
7319
- await test.test.step("Step 3: Close and reopen live chat frame", async () => {
7320
- await this.page.getByTestId(CHAT_WIDGET_SELECTORS.closeChat).click();
7321
- await test.expect(this.neetoChatWidget).toBeHidden();
7322
- await this.openHelpCenter();
7323
- await this.openLiveChatAndVerify();
7324
- });
7325
- await test.test.step("Step 4: Start new conversation", async () => {
7326
- const newConversationButton = this.neetoChatFrame.getByRole("button", {
7327
- name: CHAT_WIDGET_TEXTS.newConversation,
7328
- });
7329
- await test.expect(newConversationButton).toBeVisible(); // Adding additional toBeVisible to take advantage of the auto-retrying web-first assertion
7330
- await newConversationButton.click();
7331
- await test.expect(this.neetoChatSpinner).toBeHidden();
7332
- });
7333
- await test.test.step("Step 5: Fill and submit email", async () => {
7334
- var _a, _b;
7335
- await this.neetoChatFrame
7336
- .getByTestId(CHAT_WIDGET_SELECTORS.preChatEmailInput)
7337
- .fill((_b = (_a = readFileSyncIfExists()) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.email);
7338
- await this.neetoChatFrame
7339
- .getByTestId(CHAT_WIDGET_SELECTORS.preChatSubmitButton)
7340
- .getByRole("button")
7341
- .click();
7342
- await test.expect(this.neetoChatSpinner).toBeHidden();
7343
- });
7344
- await test.test.step("Step 6: Verify conversation window", async () => {
7345
- await test.expect(this.neetoChatFrame.getByTestId(CHAT_WIDGET_SELECTORS.chatBubble)).toHaveText(CHAT_WIDGET_TEXTS.welcomeChatBubble);
7346
- });
7296
+ await test.expect(async () => {
7297
+ await this.openHelpCenterV2();
7298
+ await this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton).click();
7299
+ await test.expect(this.neetoChatWidget).toBeVisible();
7300
+ await test.expect(this.neetoChatSpinner).toBeHidden({ timeout: 20 * 1000 });
7301
+ await test.expect(this.neetoChatWidget).toBeVisible();
7302
+ }).toPass({ timeout: 45000 });
7347
7303
  };
7348
7304
  this.openAndVerifyChatWidgetV2 = async () => {
7349
7305
  const chatInitializationApis = this.neetoPlaywrightUtilities.interceptMultipleResponses({
7350
7306
  baseUrl: this.chatApiBaseURL,
7351
7307
  times: 3,
7352
- timeout: 20 * 1000, // Increased timeout accounting delays in page load
7353
7308
  });
7354
7309
  await this.page.reload();
7355
7310
  await chatInitializationApis;
7356
- await test.test.step("Step 1: Open Help Center links", this.openHelpCenterV2);
7357
- await test.test.step("Step 2: Open live chat and verify iframe", this.openLiveChatAndVerify);
7358
- await test.test.step("Step 3: Close and reopen live chat frame", async () => {
7311
+ await test.test.step("Step 1: Open live chat and verify iframe", this.openLiveChatAndVerify);
7312
+ await test.test.step("Step 2: Close and reopen live chat frame", async () => {
7359
7313
  await this.page.getByTestId(CHAT_WIDGET_SELECTORS.closeChat).click();
7360
- await test.expect(this.neetoChatWidget).toBeHidden();
7361
- await this.openHelpCenterV2();
7314
+ await test.expect(this.neetoChatWidget).toBeHidden({ timeout: 20000 });
7362
7315
  await this.openLiveChatAndVerify();
7363
7316
  });
7364
- await test.test.step("Step 4: Start new conversation", async () => {
7317
+ await test.test.step("Step 3: Start new conversation", async () => {
7365
7318
  const newConversationButton = this.neetoChatFrame.getByRole("button", {
7366
7319
  name: CHAT_WIDGET_TEXTS.newConversation,
7367
7320
  });
7368
- await test.expect(newConversationButton).toBeVisible(); // Adding additional toBeVisible to take advantage of the auto-retrying web-first assertion
7321
+ await test.expect(newConversationButton).toBeVisible({ timeout: 20000 }); // Adding additional toBeVisible to take advantage of the auto-retrying web-first assertion
7369
7322
  await newConversationButton.click();
7370
- await test.expect(this.neetoChatSpinner).toBeHidden();
7323
+ await test.expect(this.neetoChatSpinner).toBeHidden({ timeout: 20000 });
7371
7324
  });
7372
- await test.test.step("Step 5: Fill and submit email", async () => {
7325
+ await test.test.step("Step 4: Fill and submit email", async () => {
7373
7326
  var _a, _b;
7374
7327
  await this.neetoChatFrame
7375
7328
  .getByTestId(CHAT_WIDGET_SELECTORS.preChatEmailInput)
@@ -7378,26 +7331,12 @@ class HelpAndProfilePage {
7378
7331
  .getByTestId(CHAT_WIDGET_SELECTORS.preChatSubmitButton)
7379
7332
  .getByRole("button")
7380
7333
  .click();
7381
- await test.expect(this.neetoChatSpinner).toBeHidden();
7334
+ await test.expect(this.neetoChatSpinner).toBeHidden({ timeout: 20000 });
7382
7335
  });
7383
- await test.test.step("Step 6: Verify conversation window", async () => {
7336
+ await test.test.step("Step 5: Verify conversation window", async () => {
7384
7337
  await test.expect(this.neetoChatFrame.getByTestId(CHAT_WIDGET_SELECTORS.chatBubble)).toHaveText(CHAT_WIDGET_TEXTS.welcomeChatBubble);
7385
7338
  });
7386
7339
  };
7387
- // TODO Remove when all apps have migrated to the new navbar style
7388
- this.openAndVerifyHelpArticles = async () => {
7389
- await test.test.step("Step 1: Open Help Center links", this.openHelpCenter);
7390
- await test.test.step("Step 2: Open and verify help articles link", async () => {
7391
- const helpArticlesPromise = this.page.waitForEvent("popup");
7392
- await this.page
7393
- .getByTestId(HELP_CENTER_SELECTORS.documentationButton)
7394
- .click();
7395
- const helpArticlesPage = await helpArticlesPromise;
7396
- await helpArticlesPage.waitForLoadState();
7397
- await test.expect(helpArticlesPage).toHaveURL(this.kbDocsBaseURL);
7398
- await helpArticlesPage.close();
7399
- });
7400
- };
7401
7340
  this.openAndVerifyHelpArticlesV2 = async () => {
7402
7341
  await test.test.step("Step 1: Open Help Center links", this.openHelpCenterV2);
7403
7342
  await test.test.step("Step 2: Open and verify help articles link", async () => {
@@ -7411,13 +7350,6 @@ class HelpAndProfilePage {
7411
7350
  await helpArticlesPage.close();
7412
7351
  });
7413
7352
  };
7414
- // TODO Remove when all apps have migrated to the new navbar style
7415
- this.openChangelogPane = async () => {
7416
- await test.expect(async () => {
7417
- await this.page.getByTestId(HELP_CENTER_SELECTORS.whatsNewButton).click();
7418
- await test.expect(this.page.locator(CHANGELOG_WIDGET_SELECTORS.changelogWrapper)).toBeVisible();
7419
- }).toPass({ timeout: 15000 });
7420
- };
7421
7353
  this.openChangelogPaneV2 = async () => {
7422
7354
  await test.expect(async () => {
7423
7355
  await this.openHelpCenterV2();
@@ -7425,33 +7357,6 @@ class HelpAndProfilePage {
7425
7357
  await test.expect(this.page.locator(CHANGELOG_WIDGET_SELECTORS.changelogWrapper)).toBeVisible();
7426
7358
  }).toPass({ timeout: 45000 });
7427
7359
  };
7428
- // TODO Remove when all apps have migrated to the new navbar style
7429
- this.openAndVerifyChangelog = async () => {
7430
- await test.test.step("Step 1: Open Help Center links", this.openHelpCenter);
7431
- await test.test.step("Step 2: Open and verify changelog pane", this.openChangelogPane);
7432
- await test.test.step("Step 3: Close and reopen changelog pane", async () => {
7433
- await this.page
7434
- .getByTestId(CHANGELOG_WIDGET_SELECTORS.closeButton)
7435
- .click();
7436
- await test.expect(this.page.locator(CHANGELOG_WIDGET_SELECTORS.changelogWrapper)).toBeHidden();
7437
- await this.openHelpCenter();
7438
- await this.openChangelogPane();
7439
- });
7440
- await test.test.step("Step 4: Open and verify public URL", async () => {
7441
- const changelogPagePromise = this.page.waitForEvent("popup");
7442
- await this.page
7443
- .getByTestId(CHANGELOG_WIDGET_SELECTORS.publicUrlLink)
7444
- .click();
7445
- const changelogPage = await changelogPagePromise;
7446
- await this.neetoPlaywrightUtilities.interceptMultipleResponses({
7447
- customPageContext: changelogPage,
7448
- baseUrl: this.changelogBaseURL.split("/site")[0],
7449
- times: 3,
7450
- });
7451
- await test.expect(changelogPage).toHaveURL(this.changelogBaseURL);
7452
- await changelogPage.close();
7453
- });
7454
- };
7455
7360
  this.openAndVerifyChangelogV2 = async () => {
7456
7361
  await test.test.step("Step 1: Open Help Center links and changelog", this.openChangelogPaneV2);
7457
7362
  await test.test.step("Step 2: Close and reopen changelog pane", async () => {
@@ -7484,52 +7389,6 @@ class HelpAndProfilePage {
7484
7389
  ? formattedShortcut.replace(/ctrl/g, "⌘").replace(/alt/g, "opt")
7485
7390
  : formattedShortcut;
7486
7391
  };
7487
- this.openAndVerifyKeyboardShortcutsPane = async (productShortcuts, osPlatform = "windows") => {
7488
- const globalShortcuts = [
7489
- {
7490
- description: this.t("neetoMolecules.keyboardShortcuts.global.openKeyboardShortcutsPane"),
7491
- sequence: "shift+/",
7492
- },
7493
- {
7494
- description: this.t("neetoMolecules.keyboardShortcuts.global.close"),
7495
- sequence: "esc",
7496
- },
7497
- {
7498
- description: this.t("neetoMolecules.keyboardShortcuts.global.submitForm"),
7499
- sequence: "ctrl+enter",
7500
- },
7501
- ];
7502
- const shortcuts = [...globalShortcuts, ...productShortcuts];
7503
- await test.test.step("Step 1: Open Help Center", this.openHelpCenter);
7504
- await test.test.step("Step 2: Open and close keyboard shortcuts from UI", async () => {
7505
- await this.page
7506
- .getByTestId(HELP_CENTER_SELECTORS.keyboardShortcutButton)
7507
- .click();
7508
- await test.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7509
- await this.page
7510
- .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.closePaneButton)
7511
- .click();
7512
- await test.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).toHaveCSS("width", "1px");
7513
- });
7514
- await test.test.step("Step 3: Open and close keyboard shortcuts through shortcut", async () => {
7515
- await this.page.keyboard.press("Shift+/");
7516
- await test.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7517
- await this.page.keyboard.press("Escape");
7518
- await test.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).toHaveCSS("width", "1px");
7519
- });
7520
- await test.test.step("Step 4: Verify all displayed keyboard shortcuts", async () => {
7521
- await this.page.keyboard.press("Shift+/");
7522
- await test.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7523
- await test.expect(this.page
7524
- .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.hotKeyItem)
7525
- .locator("p")).toHaveText(shortcuts.map(shortcut => shortcut.description));
7526
- const formattedSequences = shortcuts.map(shortcut => this.formatKeyboardShortcut(shortcut.sequence, osPlatform));
7527
- await test.expect(this.page
7528
- .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.hotKeyItem)
7529
- .locator("div")).toHaveText(formattedSequences);
7530
- });
7531
- };
7532
- // TODO Remove when all apps have migrated to the new navbar style
7533
7392
  this.openAndVerifyKeyboardShortcutsPaneV2 = async (productShortcuts, osPlatform = "windows") => {
7534
7393
  const globalShortcuts = [
7535
7394
  {
@@ -7575,16 +7434,6 @@ class HelpAndProfilePage {
7575
7434
  .locator("div")).toHaveText(formattedSequences);
7576
7435
  });
7577
7436
  };
7578
- // TODO Remove when all apps have migrated to the new navbar style
7579
- this.openAppSwitcherAndVerify = async () => {
7580
- const appSwitcher = this.page.getByTestId(COMMON_SELECTORS.appSwitcherButton);
7581
- await test.test.step("Step 1: Verify hovering over app switcher opens the app switcher drawer", () => test.expect(async () => {
7582
- await this.hoverOnBody();
7583
- await appSwitcher.scrollIntoViewIfNeeded();
7584
- await appSwitcher.hover();
7585
- await test.expect(this.page.getByTestId(COMMON_SELECTORS.appSwitcherWrapper)).toBeVisible();
7586
- }).toPass({ timeout: 15000 }));
7587
- };
7588
7437
  this.openAppSwitcherAndVerifyV2 = async () => {
7589
7438
  await test.test.step("Step 1: Verify hovering over app switcher opens the app switcher drawer", () => test.expect(async () => {
7590
7439
  await this.openHelpCenterV2();
@@ -7594,13 +7443,6 @@ class HelpAndProfilePage {
7594
7443
  await test.expect(this.page.getByTestId(COMMON_SELECTORS.appSwitcherWrapper)).toBeVisible();
7595
7444
  }).toPass({ timeout: 45000 }));
7596
7445
  };
7597
- // TODO Remove when all apps have migrated to the new navbar style
7598
- this.openProfilePopup = () => test.expect(async () => {
7599
- await this.hoverOnBody();
7600
- await this.profileSectionButton.scrollIntoViewIfNeeded();
7601
- await this.profileSectionButton.hover();
7602
- await test.expect(this.page.getByTestId(PROFILE_SECTION_SELECTORS.profilePopup)).toBeVisible();
7603
- }).toPass({ timeout: 15000 });
7604
7446
  this.openAuthLinkAndVerify = async ({ linkSelector, redirectLink, }) => {
7605
7447
  var _a, _b;
7606
7448
  const profilePagePromise = this.page.waitForEvent("popup");
@@ -7611,19 +7453,6 @@ class HelpAndProfilePage {
7611
7453
  await test.expect(profilePage).toHaveURL(new RegExp(redirectLink));
7612
7454
  await profilePage.close();
7613
7455
  };
7614
- // TODO Remove when all apps have migrated to the new navbar style
7615
- this.verifyProfileAndOrganizationLinks = async () => {
7616
- await test.test.step("Step 1: Open Profile popup and verify", this.openProfilePopup);
7617
- await test.test.step("Step 2: Open My profile link and verify", async () => this.openAuthLinkAndVerify({
7618
- linkSelector: PROFILE_SECTION_SELECTORS.myProfileButton,
7619
- redirectLink: ROUTES.myProfile,
7620
- }));
7621
- await test.test.step("Step 3: Open Profile popup and verify", this.openProfilePopup);
7622
- await test.test.step("Step 4: Open My organization link and verify", async () => this.openAuthLinkAndVerify({
7623
- linkSelector: PROFILE_SECTION_SELECTORS.profileOrganizationSettingsButton,
7624
- redirectLink: ROUTES.authSettings,
7625
- }));
7626
- };
7627
7456
  this.verifyProfileAndOrganizationLinksV2 = async () => {
7628
7457
  await test.test.step("Step 1: Open Help center and verify", this.openHelpCenterV2);
7629
7458
  await test.test.step("Step 2: Open My profile link and verify", async () => this.openAuthLinkAndVerify({
@@ -7636,19 +7465,6 @@ class HelpAndProfilePage {
7636
7465
  redirectLink: ROUTES.authSettings,
7637
7466
  }));
7638
7467
  };
7639
- // TODO Remove when all apps have migrated to the new navbar style
7640
- this.verifyLogout = async () => {
7641
- if (shouldSkipSetupAndTeardown())
7642
- return;
7643
- await test.test.step("Step 1: Open Profile popup and verify", this.openProfilePopup);
7644
- await test.test.step("Step 2: Click logout and verify", async () => {
7645
- await this.page
7646
- .getByTestId(PROFILE_SECTION_SELECTORS.logoutButton)
7647
- .click();
7648
- await test.expect(this.page).toHaveURL(NEETO_AUTH_BASE_URL());
7649
- await test.expect(this.page).toHaveURL(new RegExp(ROUTES.loginLink));
7650
- });
7651
- };
7652
7468
  this.verifyLogoutV2 = async () => {
7653
7469
  if (shouldSkipSetupAndTeardown())
7654
7470
  return;
@@ -7657,8 +7473,13 @@ class HelpAndProfilePage {
7657
7473
  await this.page
7658
7474
  .getByTestId(PROFILE_SECTION_SELECTORS.logoutButton)
7659
7475
  .click();
7660
- await test.expect(this.page).toHaveURL(new RegExp(NEETO_AUTH_BASE_URL()), { timeout: 15000 });
7661
- await test.expect(this.page).toHaveURL(new RegExp(ROUTES.loginLink), { timeout: 15000 });
7476
+ process.env.TEST_ENV === ENVIRONMENT.staging &&
7477
+ (await test.expect(this.page).toHaveURL(new RegExp(NEETO_AUTH_BASE_URL()), {
7478
+ timeout: 15000,
7479
+ }));
7480
+ await test.expect(this.page).toHaveURL(new RegExp(ROUTES.loginLink), {
7481
+ timeout: 15000,
7482
+ });
7662
7483
  });
7663
7484
  };
7664
7485
  this.page = page;