@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.d.ts CHANGED
@@ -111,21 +111,33 @@ declare class HelpAndProfilePage {
111
111
  constructor({ page, neetoPlaywrightUtilities, chatApiBaseURL, kbDocsBaseURL, changelogBaseURL, }: HelpAndProfilePageInitializerProps);
112
112
  private hoverOnBody;
113
113
  openHelpCenter: () => Promise<void>;
114
+ openHelpCenterV2: () => Promise<void>;
114
115
  private openLiveChatAndVerify;
115
116
  openAndVerifyChatWidget: () => Promise<void>;
117
+ openAndVerifyChatWidgetV2: () => Promise<void>;
116
118
  openAndVerifyHelpArticles: () => Promise<void>;
119
+ openAndVerifyHelpArticlesV2: () => Promise<void>;
117
120
  private openChangelogPane;
121
+ private openChangelogPaneV2;
118
122
  openAndVerifyChangelog: () => Promise<void>;
123
+ openAndVerifyChangelogV2: () => Promise<void>;
119
124
  private formatKeyboardShortcut;
120
125
  openAndVerifyKeyboardShortcutsPane: (productShortcuts: {
121
126
  description: string;
122
127
  sequence: string;
123
128
  }[], osPlatform?: "mac" | "windows") => Promise<void>;
129
+ openAndVerifyKeyboardShortcutsPaneV2: (productShortcuts: {
130
+ description: string;
131
+ sequence: string;
132
+ }[], osPlatform?: "mac" | "windows") => Promise<void>;
124
133
  openAppSwitcherAndVerify: () => Promise<void>;
134
+ openAppSwitcherAndVerifyV2: () => Promise<void>;
125
135
  private openProfilePopup;
126
136
  private openAuthLinkAndVerify;
127
137
  verifyProfileAndOrganizationLinks: () => Promise<void>;
138
+ verifyProfileAndOrganizationLinksV2: () => Promise<void>;
128
139
  verifyLogout: () => Promise<void>;
140
+ verifyLogoutV2: () => Promise<void>;
129
141
  }
130
142
 
131
143
  interface CreateOrganizationProps {
@@ -253,6 +265,7 @@ declare const COMMON_SELECTORS: {
253
265
  pageLoader: string;
254
266
  homeButton: string;
255
267
  neetoUiSwitch: string;
268
+ floatingActionMenuButton: string;
256
269
  };
257
270
 
258
271
  declare const NEETO_EDITOR_SELECTORS: {
package/index.js CHANGED
@@ -148,6 +148,7 @@ const COMMON_SELECTORS = {
148
148
  pageLoader: "neeto-molecules-page-loader",
149
149
  homeButton: "home-button",
150
150
  neetoUiSwitch: "nui-switch",
151
+ floatingActionMenuButton: "floating-action-menu-container",
151
152
  };
152
153
 
153
154
  class CustomCommands {
@@ -7234,6 +7235,15 @@ class HelpAndProfilePage {
7234
7235
  await expect(this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton)).toBeVisible();
7235
7236
  }).toPass({ timeout: 15000 });
7236
7237
  };
7238
+ this.openHelpCenterV2 = async () => {
7239
+ await expect(async () => {
7240
+ await this.hoverOnBody();
7241
+ const floatingActionMenuButton = this.page.getByTestId(COMMON_SELECTORS.floatingActionMenuButton);
7242
+ await floatingActionMenuButton.scrollIntoViewIfNeeded();
7243
+ await floatingActionMenuButton.hover();
7244
+ await expect(this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton)).toBeVisible();
7245
+ }).toPass({ timeout: 15000 });
7246
+ };
7237
7247
  this.openLiveChatAndVerify = async () => {
7238
7248
  await this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton).click();
7239
7249
  await expect(this.neetoChatWidget).toBeVisible();
@@ -7278,6 +7288,46 @@ class HelpAndProfilePage {
7278
7288
  await expect(this.neetoChatFrame.getByTestId(CHAT_WIDGET_SELECTORS.chatBubble)).toHaveText(CHAT_WIDGET_TEXTS.welcomeChatBubble);
7279
7289
  });
7280
7290
  };
7291
+ this.openAndVerifyChatWidgetV2 = async () => {
7292
+ const chatInitializationApis = this.neetoPlaywrightUtilities.interceptMultipleResponses({
7293
+ baseUrl: this.chatApiBaseURL,
7294
+ times: 3,
7295
+ timeout: 20 * 1000, // Increased timeout accounting delays in page load
7296
+ });
7297
+ await this.page.reload();
7298
+ await chatInitializationApis;
7299
+ await test$1.step("Step 1: Open Help Center links", this.openHelpCenterV2);
7300
+ await test$1.step("Step 2: Open live chat and verify iframe", this.openLiveChatAndVerify);
7301
+ await test$1.step("Step 3: Close and reopen live chat frame", async () => {
7302
+ await this.page.getByTestId(CHAT_WIDGET_SELECTORS.closeChat).click();
7303
+ await expect(this.neetoChatWidget).toBeHidden();
7304
+ await this.openHelpCenterV2();
7305
+ await this.openLiveChatAndVerify();
7306
+ });
7307
+ await test$1.step("Step 4: Start new conversation", async () => {
7308
+ const newConversationButton = this.neetoChatFrame.getByRole("button", {
7309
+ name: CHAT_WIDGET_TEXTS.newConversation,
7310
+ });
7311
+ await expect(newConversationButton).toBeVisible(); // Adding additional toBeVisible to take advantage of the auto-retrying web-first assertion
7312
+ await newConversationButton.click();
7313
+ await expect(this.neetoChatSpinner).toBeHidden();
7314
+ });
7315
+ await test$1.step("Step 5: Fill and submit email", async () => {
7316
+ var _a, _b;
7317
+ await this.neetoChatFrame
7318
+ .getByTestId(CHAT_WIDGET_SELECTORS.preChatEmailInput)
7319
+ .fill((_b = (_a = readFileSyncIfExists()) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.email);
7320
+ await this.neetoChatFrame
7321
+ .getByTestId(CHAT_WIDGET_SELECTORS.preChatSubmitButton)
7322
+ .getByRole("button")
7323
+ .click();
7324
+ await expect(this.neetoChatSpinner).toBeHidden();
7325
+ });
7326
+ await test$1.step("Step 6: Verify conversation window", async () => {
7327
+ await expect(this.neetoChatFrame.getByTestId(CHAT_WIDGET_SELECTORS.chatBubble)).toHaveText(CHAT_WIDGET_TEXTS.welcomeChatBubble);
7328
+ });
7329
+ };
7330
+ // TODO Remove when all apps have migrated to the new navbar style
7281
7331
  this.openAndVerifyHelpArticles = async () => {
7282
7332
  await test$1.step("Step 1: Open Help Center links", this.openHelpCenter);
7283
7333
  await test$1.step("Step 2: Open and verify help articles link", async () => {
@@ -7291,12 +7341,34 @@ class HelpAndProfilePage {
7291
7341
  await helpArticlesPage.close();
7292
7342
  });
7293
7343
  };
7344
+ this.openAndVerifyHelpArticlesV2 = async () => {
7345
+ await test$1.step("Step 1: Open Help Center links", this.openHelpCenterV2);
7346
+ await test$1.step("Step 2: Open and verify help articles link", async () => {
7347
+ const helpArticlesPromise = this.page.waitForEvent("popup");
7348
+ await this.page
7349
+ .getByTestId(HELP_CENTER_SELECTORS.documentationButton)
7350
+ .click();
7351
+ const helpArticlesPage = await helpArticlesPromise;
7352
+ await helpArticlesPage.waitForLoadState();
7353
+ await expect(helpArticlesPage).toHaveURL(this.kbDocsBaseURL);
7354
+ await helpArticlesPage.close();
7355
+ });
7356
+ };
7357
+ // TODO Remove when all apps have migrated to the new navbar style
7294
7358
  this.openChangelogPane = async () => {
7295
7359
  await expect(async () => {
7296
7360
  await this.page.getByTestId(HELP_CENTER_SELECTORS.whatsNewButton).click();
7297
7361
  await expect(this.page.locator(CHANGELOG_WIDGET_SELECTORS.changelogWrapper)).toBeVisible();
7298
7362
  }).toPass({ timeout: 15000 });
7299
7363
  };
7364
+ this.openChangelogPaneV2 = async () => {
7365
+ await expect(async () => {
7366
+ await this.openHelpCenterV2();
7367
+ await this.page.getByTestId(HELP_CENTER_SELECTORS.whatsNewButton).click();
7368
+ await expect(this.page.locator(CHANGELOG_WIDGET_SELECTORS.changelogWrapper)).toBeVisible();
7369
+ }).toPass({ timeout: 45000 });
7370
+ };
7371
+ // TODO Remove when all apps have migrated to the new navbar style
7300
7372
  this.openAndVerifyChangelog = async () => {
7301
7373
  await test$1.step("Step 1: Open Help Center links", this.openHelpCenter);
7302
7374
  await test$1.step("Step 2: Open and verify changelog pane", this.openChangelogPane);
@@ -7323,6 +7395,30 @@ class HelpAndProfilePage {
7323
7395
  await changelogPage.close();
7324
7396
  });
7325
7397
  };
7398
+ this.openAndVerifyChangelogV2 = async () => {
7399
+ await test$1.step("Step 1: Open Help Center links and changelog", this.openChangelogPaneV2);
7400
+ await test$1.step("Step 2: Close and reopen changelog pane", async () => {
7401
+ await this.page
7402
+ .getByTestId(CHANGELOG_WIDGET_SELECTORS.closeButton)
7403
+ .click();
7404
+ await expect(this.page.locator(CHANGELOG_WIDGET_SELECTORS.changelogWrapper)).toBeHidden();
7405
+ await this.openChangelogPaneV2();
7406
+ });
7407
+ await test$1.step("Step 3: Open and verify public URL", async () => {
7408
+ const changelogPagePromise = this.page.waitForEvent("popup");
7409
+ await this.page
7410
+ .getByTestId(CHANGELOG_WIDGET_SELECTORS.publicUrlLink)
7411
+ .click();
7412
+ const changelogPage = await changelogPagePromise;
7413
+ await this.neetoPlaywrightUtilities.interceptMultipleResponses({
7414
+ customPageContext: changelogPage,
7415
+ baseUrl: this.changelogBaseURL.split("/site")[0],
7416
+ times: 3,
7417
+ });
7418
+ await expect(changelogPage).toHaveURL(this.changelogBaseURL);
7419
+ await changelogPage.close();
7420
+ });
7421
+ };
7326
7422
  this.formatKeyboardShortcut = (shortcut, osPlatform = "windows") => {
7327
7423
  const formattedShortcut = shortcut
7328
7424
  .replaceAll(" ", "then")
@@ -7376,6 +7472,53 @@ class HelpAndProfilePage {
7376
7472
  .locator("div")).toHaveText(formattedSequences);
7377
7473
  });
7378
7474
  };
7475
+ // TODO Remove when all apps have migrated to the new navbar style
7476
+ this.openAndVerifyKeyboardShortcutsPaneV2 = async (productShortcuts, osPlatform = "windows") => {
7477
+ const globalShortcuts = [
7478
+ {
7479
+ description: this.t("neetoMolecules.keyboardShortcuts.global.openKeyboardShortcutsPane"),
7480
+ sequence: "shift+/",
7481
+ },
7482
+ {
7483
+ description: this.t("neetoMolecules.keyboardShortcuts.global.close"),
7484
+ sequence: "esc",
7485
+ },
7486
+ {
7487
+ description: this.t("neetoMolecules.keyboardShortcuts.global.submitForm"),
7488
+ sequence: "ctrl+enter",
7489
+ },
7490
+ ];
7491
+ const shortcuts = [...globalShortcuts, ...productShortcuts];
7492
+ await test$1.step("Step 1: Open Help Center", this.openHelpCenterV2);
7493
+ await test$1.step("Step 2: Open and close keyboard shortcuts from UI", async () => {
7494
+ await this.page
7495
+ .getByTestId(HELP_CENTER_SELECTORS.keyboardShortcutButton)
7496
+ .click();
7497
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7498
+ await this.page
7499
+ .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.closePaneButton)
7500
+ .click();
7501
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).toHaveCSS("width", "1px");
7502
+ });
7503
+ await test$1.step("Step 3: Open and close keyboard shortcuts through shortcut", async () => {
7504
+ await this.page.keyboard.press("Shift+/");
7505
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7506
+ await this.page.keyboard.press("Escape");
7507
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).toHaveCSS("width", "1px");
7508
+ });
7509
+ await test$1.step("Step 4: Verify all displayed keyboard shortcuts", async () => {
7510
+ await this.page.keyboard.press("Shift+/");
7511
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7512
+ await expect(this.page
7513
+ .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.hotKeyItem)
7514
+ .locator("p")).toHaveText(shortcuts.map(shortcut => shortcut.description));
7515
+ const formattedSequences = shortcuts.map(shortcut => this.formatKeyboardShortcut(shortcut.sequence, osPlatform));
7516
+ await expect(this.page
7517
+ .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.hotKeyItem)
7518
+ .locator("div")).toHaveText(formattedSequences);
7519
+ });
7520
+ };
7521
+ // TODO Remove when all apps have migrated to the new navbar style
7379
7522
  this.openAppSwitcherAndVerify = async () => {
7380
7523
  const appSwitcher = this.page.getByTestId(COMMON_SELECTORS.appSwitcherButton);
7381
7524
  await test$1.step("Step 1: Verify hovering over app switcher opens the app switcher drawer", () => expect(async () => {
@@ -7385,6 +7528,16 @@ class HelpAndProfilePage {
7385
7528
  await expect(this.page.getByTestId(COMMON_SELECTORS.appSwitcherWrapper)).toBeVisible();
7386
7529
  }).toPass({ timeout: 15000 }));
7387
7530
  };
7531
+ this.openAppSwitcherAndVerifyV2 = async () => {
7532
+ await test$1.step("Step 1: Verify hovering over app switcher opens the app switcher drawer", () => expect(async () => {
7533
+ await this.openHelpCenterV2();
7534
+ await this.page
7535
+ .getByTestId(COMMON_SELECTORS.appSwitcherButton)
7536
+ .hover();
7537
+ await expect(this.page.getByTestId(COMMON_SELECTORS.appSwitcherWrapper)).toBeVisible();
7538
+ }).toPass({ timeout: 45000 }));
7539
+ };
7540
+ // TODO Remove when all apps have migrated to the new navbar style
7388
7541
  this.openProfilePopup = () => expect(async () => {
7389
7542
  await this.hoverOnBody();
7390
7543
  await this.profileSectionButton.scrollIntoViewIfNeeded();
@@ -7401,6 +7554,7 @@ class HelpAndProfilePage {
7401
7554
  await expect(profilePage).toHaveURL(new RegExp(redirectLink));
7402
7555
  await profilePage.close();
7403
7556
  };
7557
+ // TODO Remove when all apps have migrated to the new navbar style
7404
7558
  this.verifyProfileAndOrganizationLinks = async () => {
7405
7559
  await test$1.step("Step 1: Open Profile popup and verify", this.openProfilePopup);
7406
7560
  await test$1.step("Step 2: Open My profile link and verify", async () => this.openAuthLinkAndVerify({
@@ -7413,6 +7567,19 @@ class HelpAndProfilePage {
7413
7567
  redirectLink: ROUTES.authSettings,
7414
7568
  }));
7415
7569
  };
7570
+ this.verifyProfileAndOrganizationLinksV2 = async () => {
7571
+ await test$1.step("Step 1: Open Help center and verify", this.openHelpCenterV2);
7572
+ await test$1.step("Step 2: Open My profile link and verify", async () => this.openAuthLinkAndVerify({
7573
+ linkSelector: PROFILE_SECTION_SELECTORS.myProfileButton,
7574
+ redirectLink: ROUTES.myProfile,
7575
+ }));
7576
+ await test$1.step("Step 3: Open Help center and verify", this.openHelpCenterV2);
7577
+ await test$1.step("Step 4: Open My organization link and verify", async () => this.openAuthLinkAndVerify({
7578
+ linkSelector: PROFILE_SECTION_SELECTORS.profileOrganizationSettingsButton,
7579
+ redirectLink: ROUTES.authSettings,
7580
+ }));
7581
+ };
7582
+ // TODO Remove when all apps have migrated to the new navbar style
7416
7583
  this.verifyLogout = async () => {
7417
7584
  if (shouldSkipSetupAndTeardown())
7418
7585
  return;
@@ -7425,6 +7592,18 @@ class HelpAndProfilePage {
7425
7592
  await expect(this.page).toHaveURL(new RegExp(ROUTES.loginLink));
7426
7593
  });
7427
7594
  };
7595
+ this.verifyLogoutV2 = async () => {
7596
+ if (shouldSkipSetupAndTeardown())
7597
+ return;
7598
+ await test$1.step("Step 1: Open Help center and verify", this.openHelpCenterV2);
7599
+ await test$1.step("Step 2: Click logout and verify", async () => {
7600
+ await this.page
7601
+ .getByTestId(PROFILE_SECTION_SELECTORS.logoutButton)
7602
+ .click();
7603
+ await expect(this.page).toHaveURL(NEETO_AUTH_BASE_URL());
7604
+ await expect(this.page).toHaveURL(new RegExp(ROUTES.loginLink));
7605
+ });
7606
+ };
7428
7607
  this.page = page;
7429
7608
  this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
7430
7609
  this.chatApiBaseURL = chatApiBaseURL;