@bigbinary/neeto-playwright-commons 1.5.1 → 1.6.0

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
@@ -1,15 +1,17 @@
1
1
  import * as _playwright_test from '@playwright/test';
2
- import { Page, APIRequestContext, Response, APIResponse, Fixtures, PlaywrightWorkerArgs, PlaywrightWorkerOptions, PlaywrightTestArgs, PlaywrightTestOptions } from '@playwright/test';
2
+ import { Page, APIRequestContext, Response, APIResponse, Fixtures, PlaywrightWorkerArgs, PlaywrightWorkerOptions, PlaywrightTestArgs, PlaywrightTestOptions, Locator, FrameLocator } from '@playwright/test';
3
3
  import MailosaurClient from 'mailosaur';
4
4
  import { I18nPlaywrightFixture } from 'playwright-i18next-fixture';
5
+ import { TFunction } from 'i18next';
5
6
 
6
7
  interface InterceptMultipleResponsesParams {
7
8
  responseUrl: string;
8
9
  times: number;
9
10
  baseUrl: string;
11
+ customPageContext: Page | undefined;
12
+ timeout: number;
10
13
  }
11
14
  type GenericCallback = (...params: any[]) => Promise<unknown> | unknown;
12
- type InterceptMultipleResponses = (params: Partial<InterceptMultipleResponsesParams>) => Promise<Response[]>;
13
15
  interface ExecuteRecursivelyParams {
14
16
  callback: GenericCallback;
15
17
  condition: GenericCallback;
@@ -41,7 +43,7 @@ declare class CustomCommands {
41
43
  responses: string[];
42
44
  request: APIRequestContext;
43
45
  constructor(page: Page, request: APIRequestContext);
44
- interceptMultipleResponses: InterceptMultipleResponses;
46
+ interceptMultipleResponses: ({ responseUrl, times, baseUrl, customPageContext, timeout, }?: Partial<InterceptMultipleResponsesParams>) => Promise<Response[]>;
45
47
  private recursiveMethod;
46
48
  executeRecursively: ExecuteRecursively;
47
49
  verifySuccessToast: VerifySuccessToast;
@@ -87,6 +89,43 @@ declare const generateStagingData: (product?: string) => {
87
89
 
88
90
  declare const i18nFixture: Fixtures<I18nPlaywrightFixture, PlaywrightWorkerArgs & PlaywrightWorkerOptions, PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
89
91
 
92
+ interface HelpAndProfilePageInitializerProps {
93
+ page: Page;
94
+ neetoPlaywrightUtilities: CustomCommands;
95
+ chatApiBaseURL: string;
96
+ kbDocsBaseURL: string;
97
+ changelogBaseURL: string;
98
+ }
99
+ declare class HelpAndProfilePage {
100
+ page: Page;
101
+ neetoPlaywrightUtilities: CustomCommands;
102
+ chatApiBaseURL: string;
103
+ kbDocsBaseURL: string;
104
+ changelogBaseURL: string;
105
+ neetoChatWidget: Locator;
106
+ neetoChatFrame: FrameLocator;
107
+ neetoChatSpinner: Locator;
108
+ t: TFunction;
109
+ profileSectionButton: Locator;
110
+ constructor({ page, neetoPlaywrightUtilities, chatApiBaseURL, kbDocsBaseURL, changelogBaseURL, }: HelpAndProfilePageInitializerProps);
111
+ openHelpCenter: () => Promise<void>;
112
+ private openLiveChatAndVerify;
113
+ openAndVerifyChatWidget: () => Promise<void>;
114
+ openAndVerifyHelpArticles: () => Promise<void>;
115
+ private openChangelogPane;
116
+ openAndVerifyChangelog: () => Promise<void>;
117
+ private formatKeyboardShortcut;
118
+ openAndVerifyKeyboardShortcutsPane: (productShortcuts: {
119
+ description: string;
120
+ sequence: string;
121
+ }[], osPlatform?: "mac" | "windows") => Promise<void>;
122
+ openAppSwitcherAndVerify: () => Promise<void>;
123
+ private openProfilePopup;
124
+ private openAuthLinkAndVerify;
125
+ verifyProfileAndOrganizationLinks: () => Promise<void>;
126
+ verifyLogout: () => Promise<void>;
127
+ }
128
+
90
129
  interface CreateOrganizationProps {
91
130
  email: string;
92
131
  businessName: string;
@@ -120,11 +159,20 @@ declare const CREDENTIALS: {
120
159
  };
121
160
  declare const OTP_EMAIL_PATTERN = "is your login code";
122
161
 
162
+ declare const USER_AGENTS: {
163
+ windows: string;
164
+ mac: string;
165
+ };
166
+
123
167
  declare const BASE_URL = "/api/v1";
168
+ declare const NEETO_AUTH_BASE_URL: (subdomain?: string) => string;
124
169
  declare const ROUTES: {
125
- neetoAuth: string;
126
170
  neetoAuthSignup: string;
171
+ neetoAuth: string;
172
+ loginLink: string;
127
173
  profile: string;
174
+ myProfile: string;
175
+ authSettings: string;
128
176
  login: string;
129
177
  signup: string;
130
178
  subdomainAvailability: string;
@@ -188,6 +236,9 @@ declare const COMMON_SELECTORS: {
188
236
  subheader: string;
189
237
  settingsLink: string;
190
238
  ticketFieldTextInput: (label: string | number) => string;
239
+ appSwitcherButton: string;
240
+ appSwitcherWrapper: string;
241
+ tableSpinner: string;
191
242
  };
192
243
 
193
244
  declare const NEETO_EDITOR_SELECTORS: {
@@ -238,13 +289,6 @@ declare const HELP_CENTER_SELECTORS: {
238
289
  keyboardShortcutPaneHeading: string;
239
290
  keyboardShortcutPaneCrossIcon: string;
240
291
  };
241
- declare const CHAT_WIDGET_SELECTORS: {
242
- chatWidgetHomeCard: string;
243
- widgetSubmitButton: string;
244
- chatBubbleMessage: string;
245
- chatCloseButton: string;
246
- widgetIframe: string;
247
- };
248
292
 
249
293
  declare const LOGIN_SELECTORS: {
250
294
  appleAuthenticationButton: string;
@@ -345,6 +389,33 @@ declare const MERGE_TAGS_SELECTORS: {
345
389
  disabledTag: string;
346
390
  };
347
391
 
392
+ declare const CHAT_WIDGET_SELECTORS: {
393
+ iframe: string;
394
+ spinner: string;
395
+ helpButton: string;
396
+ preChatEmailInput: string;
397
+ preChatSubmitButton: string;
398
+ chatBubble: string;
399
+ closeChat: string;
400
+ };
401
+ declare const CHANGELOG_WIDGET_SELECTORS: {
402
+ changelogWrapper: string;
403
+ closeButton: string;
404
+ publicUrlLink: string;
405
+ };
406
+ declare const KEYBOARD_SHORTCUTS_SELECTORS: {
407
+ keyboardShortcutsPane: string;
408
+ closePaneButton: string;
409
+ hotKeyItem: string;
410
+ };
411
+
412
+ declare const PROFILE_SECTION_SELECTORS: {
413
+ profileSectionButton: string;
414
+ myProfileButton: string;
415
+ profileOrganizationSettingsButton: string;
416
+ logoutButton: string;
417
+ };
418
+
348
419
  declare const initializeCredentials: (product: string) => void;
349
420
 
350
421
  interface KeyValue {
@@ -397,4 +468,4 @@ interface Overrides {
397
468
  }
398
469
  declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
399
470
 
400
- export { BASE_URL, CHAT_WIDGET_SELECTORS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, IS_STAGING_ENV, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, TAGS_SELECTORS, clearCredentials, commands, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, readFileSyncIfExists, skipTest, updateCredentials, writeDataToFile };
471
+ export { BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, IS_STAGING_ENV, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, TAGS_SELECTORS, USER_AGENTS, clearCredentials, commands, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, readFileSyncIfExists, skipTest, updateCredentials, writeDataToFile };
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import test, { expect, defineConfig, devices } from '@playwright/test';
1
+ import test, { expect, test as test$1, defineConfig, devices } from '@playwright/test';
2
2
  import * as require$$0 from 'fs';
3
3
  import require$$0__default from 'fs';
4
4
  import { faker } from '@faker-js/faker';
@@ -135,24 +135,30 @@ const COMMON_SELECTORS = {
135
135
  subheader: "subheader",
136
136
  settingsLink: "Settings",
137
137
  ticketFieldTextInput: (label) => `${hyphenize(label)}-text-input`,
138
+ appSwitcherButton: "app-switcher-button",
139
+ appSwitcherWrapper: "switcher-wrapper",
140
+ tableSpinner: ".ant-spin",
138
141
  };
139
142
 
140
143
  class CustomCommands {
141
144
  constructor(page, request) {
142
- this.interceptMultipleResponses = ({ responseUrl = "", times = 1, baseUrl, }) => Promise.all([...new Array(times)].map(() => this.page.waitForResponse((response) => {
143
- var _a, _b, _c;
144
- if (response.request().resourceType() === "xhr" &&
145
- response.status() === 200 &&
146
- response.url().includes(responseUrl) &&
147
- response
148
- .url()
149
- .startsWith((_a = baseUrl !== null && baseUrl !== void 0 ? baseUrl : process.env.BASE_URL) !== null && _a !== void 0 ? _a : "") &&
150
- !this.responses.includes((_b = response.headers()) === null || _b === void 0 ? void 0 : _b["x-request-id"])) {
151
- this.responses.push((_c = response.headers()) === null || _c === void 0 ? void 0 : _c["x-request-id"]);
152
- return true;
153
- }
154
- return false;
155
- }, { timeout: 10000 })));
145
+ this.interceptMultipleResponses = ({ responseUrl = "", times = 1, baseUrl, customPageContext, timeout = 10000, } = {}) => {
146
+ const pageContext = customPageContext !== null && customPageContext !== void 0 ? customPageContext : this.page;
147
+ return Promise.all([...new Array(times)].map(() => pageContext.waitForResponse((response) => {
148
+ var _a, _b, _c;
149
+ if (response.request().resourceType() === "xhr" &&
150
+ response.status() === 200 &&
151
+ response.url().includes(responseUrl) &&
152
+ response
153
+ .url()
154
+ .startsWith((_a = baseUrl !== null && baseUrl !== void 0 ? baseUrl : process.env.BASE_URL) !== null && _a !== void 0 ? _a : "") &&
155
+ !this.responses.includes((_b = response.headers()) === null || _b === void 0 ? void 0 : _b["x-request-id"])) {
156
+ this.responses.push((_c = response.headers()) === null || _c === void 0 ? void 0 : _c["x-request-id"]);
157
+ return true;
158
+ }
159
+ return false;
160
+ }, { timeout })));
161
+ };
156
162
  this.recursiveMethod = async (callback, condition, timeout, startTime) => {
157
163
  if (Date.now() - timeout >= startTime) {
158
164
  return false;
@@ -7125,10 +7131,14 @@ const i18nFixture = {
7125
7131
  };
7126
7132
 
7127
7133
  const BASE_URL = "/api/v1";
7134
+ const NEETO_AUTH_BASE_URL = (subdomain = "app") => `https://${subdomain}.neetoauth.net`;
7128
7135
  const ROUTES = {
7129
- neetoAuth: "https://app.neetoauth.net",
7130
- neetoAuthSignup: "https://app.neetoauth.net/signups/new",
7136
+ neetoAuthSignup: `${NEETO_AUTH_BASE_URL()}/signups/new`,
7137
+ neetoAuth: NEETO_AUTH_BASE_URL(),
7138
+ loginLink: "/login",
7131
7139
  profile: "/profile",
7140
+ myProfile: "/my/profile",
7141
+ authSettings: "/settings",
7132
7142
  login: `${BASE_URL}/login`,
7133
7143
  signup: `${BASE_URL}/signups`,
7134
7144
  subdomainAvailability: `${BASE_URL}/subdomain_availability`,
@@ -7142,6 +7152,256 @@ const ROUTES = {
7142
7152
  },
7143
7153
  };
7144
7154
 
7155
+ const CHAT_WIDGET_TEXTS = {
7156
+ newConversation: "New Conversation",
7157
+ welcomeChatBubble: "Hi! I'm here to assist you with any questions you may have. What can I do for you?",
7158
+ };
7159
+
7160
+ const HELP_CENTER_SELECTORS = {
7161
+ helpButton: "help-button",
7162
+ documentationButton: "help-link-help-center-button",
7163
+ keyboardShortcutButton: "help-link-keyboard-shortcut-button",
7164
+ chatButton: "help-link-live-chat-button",
7165
+ whatsNewButton: "help-link-changelog-button",
7166
+ whatsNewWidgetInfo: "h1",
7167
+ whatsNewWidgetCloseButton: ".nc-widget-header__btn",
7168
+ keyboardShortcutPaneHeading: "keyboard-shortcuts-pane-title",
7169
+ keyboardShortcutPaneCrossIcon: "keyboard-shortcuts-pane-close-button",
7170
+ };
7171
+
7172
+ const PROFILE_SECTION_SELECTORS = {
7173
+ profileSectionButton: "profile-section",
7174
+ myProfileButton: "my-profile-button",
7175
+ profileOrganizationSettingsButton: "profile-organization-settings-button",
7176
+ logoutButton: "profile-logout-button",
7177
+ };
7178
+
7179
+ const CHAT_WIDGET_SELECTORS = {
7180
+ iframe: "#neetochat-iframe",
7181
+ spinner: ".neeto-chat-widget-spinner",
7182
+ helpButton: "help-button",
7183
+ preChatEmailInput: "neeto-chat-widget-input",
7184
+ preChatSubmitButton: "neeto-chat-widget-pre-chat-submit-btn",
7185
+ chatBubble: "neeto-chat-widget-chat-message-bubble",
7186
+ closeChat: "neeto-chat-widget-close-btn",
7187
+ };
7188
+ const CHANGELOG_WIDGET_SELECTORS = {
7189
+ changelogWrapper: ".nc-widget__wrapper",
7190
+ closeButton: "nc-widget-close-btn",
7191
+ publicUrlLink: "nc-widget-public-url",
7192
+ };
7193
+ const KEYBOARD_SHORTCUTS_SELECTORS = {
7194
+ keyboardShortcutsPane: "keyboard-shortcuts-pane",
7195
+ closePaneButton: "keyboard-shortcuts-pane-close-button",
7196
+ hotKeyItem: "hotkey-item",
7197
+ };
7198
+
7199
+ /* eslint-disable playwright/require-top-level-describe */
7200
+ class HelpAndProfilePage {
7201
+ constructor({ page, neetoPlaywrightUtilities, chatApiBaseURL, kbDocsBaseURL, changelogBaseURL, }) {
7202
+ this.openHelpCenter = async () => {
7203
+ await expect(async () => {
7204
+ const helpButton = this.page.getByTestId(CHAT_WIDGET_SELECTORS.helpButton);
7205
+ await helpButton.scrollIntoViewIfNeeded();
7206
+ await helpButton.hover();
7207
+ await expect(this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton)).toBeVisible();
7208
+ }).toPass({ timeout: 15000 });
7209
+ };
7210
+ this.openLiveChatAndVerify = async () => {
7211
+ await this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton).click();
7212
+ await expect(this.neetoChatWidget).toBeVisible();
7213
+ await expect(this.neetoChatSpinner).toBeHidden();
7214
+ };
7215
+ this.openAndVerifyChatWidget = async () => {
7216
+ await this.neetoPlaywrightUtilities.interceptMultipleResponses({
7217
+ baseUrl: this.chatApiBaseURL,
7218
+ times: 3,
7219
+ });
7220
+ await test$1.step("Step 1: Open Help Center links", this.openHelpCenter);
7221
+ await test$1.step("Step 2: Open live chat and verify iframe", this.openLiveChatAndVerify);
7222
+ await test$1.step("Step 3: Close and reopen live chat frame", async () => {
7223
+ await this.page.getByTestId(CHAT_WIDGET_SELECTORS.closeChat).click();
7224
+ await expect(this.neetoChatWidget).toBeHidden();
7225
+ await this.openHelpCenter();
7226
+ await this.openLiveChatAndVerify();
7227
+ });
7228
+ await test$1.step("Step 4: Start new conversation", async () => {
7229
+ const newConversationButton = this.neetoChatFrame.getByRole("button", {
7230
+ name: CHAT_WIDGET_TEXTS.newConversation,
7231
+ });
7232
+ await expect(newConversationButton).toBeVisible(); // Adding additional toBeVisible to take advantage of the auto-retrying web-first assertion
7233
+ await newConversationButton.click();
7234
+ await expect(this.neetoChatSpinner).toBeHidden();
7235
+ });
7236
+ await test$1.step("Step 5: Fill and submit email", async () => {
7237
+ var _a, _b;
7238
+ await this.neetoChatFrame
7239
+ .getByTestId(CHAT_WIDGET_SELECTORS.preChatEmailInput)
7240
+ .fill((_b = (_a = readFileSyncIfExists()) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.email);
7241
+ await this.neetoChatFrame
7242
+ .getByTestId(CHAT_WIDGET_SELECTORS.preChatSubmitButton)
7243
+ .getByRole("button")
7244
+ .click();
7245
+ await expect(this.neetoChatSpinner).toBeHidden();
7246
+ });
7247
+ await test$1.step("Step 6: Verify conversation window", async () => {
7248
+ await expect(this.neetoChatFrame.getByTestId(CHAT_WIDGET_SELECTORS.chatBubble)).toHaveText(CHAT_WIDGET_TEXTS.welcomeChatBubble);
7249
+ });
7250
+ };
7251
+ this.openAndVerifyHelpArticles = async () => {
7252
+ await test$1.step("Step 1: Open Help Center links", this.openHelpCenter);
7253
+ await test$1.step("Step 2: Open and verify help articles link", async () => {
7254
+ const helpArticlesPromise = this.page.waitForEvent("popup");
7255
+ await this.page
7256
+ .getByTestId(HELP_CENTER_SELECTORS.documentationButton)
7257
+ .click();
7258
+ const helpArticlesPage = await helpArticlesPromise;
7259
+ await helpArticlesPage.waitForLoadState();
7260
+ await expect(helpArticlesPage).toHaveURL(this.kbDocsBaseURL);
7261
+ await helpArticlesPage.close();
7262
+ });
7263
+ };
7264
+ this.openChangelogPane = async () => {
7265
+ await this.page.getByTestId(HELP_CENTER_SELECTORS.whatsNewButton).click();
7266
+ await expect(this.page.locator(CHANGELOG_WIDGET_SELECTORS.changelogWrapper)).toBeVisible();
7267
+ };
7268
+ this.openAndVerifyChangelog = async () => {
7269
+ await test$1.step("Step 1: Open Help Center links", this.openHelpCenter);
7270
+ await test$1.step("Step 2: Open and verify changelog pane", this.openChangelogPane);
7271
+ await test$1.step("Step 3: Close and reopen changelog pane", async () => {
7272
+ await this.page
7273
+ .getByTestId(CHANGELOG_WIDGET_SELECTORS.closeButton)
7274
+ .click();
7275
+ await expect(this.page.locator(CHANGELOG_WIDGET_SELECTORS.changelogWrapper)).toBeHidden();
7276
+ await this.openHelpCenter();
7277
+ await this.openChangelogPane();
7278
+ });
7279
+ await test$1.step("Step 4: Open and verify public URL", async () => {
7280
+ const changelogPagePromise = this.page.waitForEvent("popup");
7281
+ await this.page
7282
+ .getByTestId(CHANGELOG_WIDGET_SELECTORS.publicUrlLink)
7283
+ .click();
7284
+ const changelogPage = await changelogPagePromise;
7285
+ await this.neetoPlaywrightUtilities.interceptMultipleResponses({
7286
+ customPageContext: changelogPage,
7287
+ baseUrl: this.changelogBaseURL.split("/site")[0],
7288
+ times: 3,
7289
+ });
7290
+ await expect(changelogPage).toHaveURL(this.changelogBaseURL);
7291
+ await changelogPage.close();
7292
+ });
7293
+ };
7294
+ this.formatKeyboardShortcut = (shortcut, osPlatform = "windows") => {
7295
+ const formattedShortcut = shortcut
7296
+ .replaceAll(" ", "then")
7297
+ .replaceAll("+", "");
7298
+ return osPlatform === "mac"
7299
+ ? formattedShortcut.replace(/ctrl/g, "⌘")
7300
+ : formattedShortcut;
7301
+ };
7302
+ this.openAndVerifyKeyboardShortcutsPane = async (productShortcuts, osPlatform = "windows") => {
7303
+ const globalShortcuts = [
7304
+ {
7305
+ description: this.t("neetoMolecules.keyboardShortcuts.global.openKeyboardShortcutsPane"),
7306
+ sequence: "shift+/",
7307
+ },
7308
+ {
7309
+ description: this.t("neetoMolecules.keyboardShortcuts.global.close"),
7310
+ sequence: "esc",
7311
+ },
7312
+ {
7313
+ description: this.t("neetoMolecules.keyboardShortcuts.global.submitForm"),
7314
+ sequence: "ctrl+enter",
7315
+ },
7316
+ ];
7317
+ const shortcuts = [...globalShortcuts, ...productShortcuts];
7318
+ await test$1.step("Step 1: Open Help Center", this.openHelpCenter);
7319
+ await test$1.step("Step 2: Open and close keyboard shortcuts from UI", async () => {
7320
+ await this.page
7321
+ .getByTestId(HELP_CENTER_SELECTORS.keyboardShortcutButton)
7322
+ .click();
7323
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7324
+ await this.page
7325
+ .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.closePaneButton)
7326
+ .click();
7327
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).toHaveCSS("width", "1px");
7328
+ });
7329
+ await test$1.step("Step 3: Open and close keyboard shortcuts through shortcut", async () => {
7330
+ await this.page.keyboard.press("Shift+/");
7331
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7332
+ await this.page.keyboard.press("Escape");
7333
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).toHaveCSS("width", "1px");
7334
+ });
7335
+ await test$1.step("Step 4: Verify all displayed keyboard shortcuts", async () => {
7336
+ await this.page.keyboard.press("Shift+/");
7337
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7338
+ await expect(this.page
7339
+ .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.hotKeyItem)
7340
+ .locator("p")).toHaveText(shortcuts.map(shortcut => shortcut.description));
7341
+ const formattedSequences = shortcuts.map(shortcut => this.formatKeyboardShortcut(shortcut.sequence, osPlatform));
7342
+ await expect(this.page
7343
+ .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.hotKeyItem)
7344
+ .locator("div")).toHaveText(formattedSequences);
7345
+ });
7346
+ };
7347
+ this.openAppSwitcherAndVerify = async () => {
7348
+ const appSwitcher = this.page.getByTestId(COMMON_SELECTORS.appSwitcherButton);
7349
+ await test$1.step("Step 1: Verify hovering over app switcher opens the app switcher drawer", () => expect(async () => {
7350
+ await appSwitcher.scrollIntoViewIfNeeded();
7351
+ await appSwitcher.hover();
7352
+ await expect(this.page.getByTestId(COMMON_SELECTORS.appSwitcherWrapper)).toBeVisible();
7353
+ }).toPass({ timeout: 15000 }));
7354
+ };
7355
+ this.openProfilePopup = () => expect(async () => {
7356
+ await this.profileSectionButton.scrollIntoViewIfNeeded();
7357
+ await this.profileSectionButton.hover();
7358
+ await expect(this.profileSectionButton).toBeVisible();
7359
+ }).toPass({ timeout: 15000 });
7360
+ this.openAuthLinkAndVerify = async ({ linkSelector, redirectLink, }) => {
7361
+ var _a, _b;
7362
+ const profilePagePromise = this.page.waitForEvent("popup");
7363
+ await this.page.getByTestId(linkSelector).click();
7364
+ const profilePage = await profilePagePromise;
7365
+ await profilePage.waitForLoadState();
7366
+ await expect(profilePage).toHaveURL(new RegExp(NEETO_AUTH_BASE_URL((_b = (_a = readFileSyncIfExists()) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.subdomainName)));
7367
+ await expect(profilePage).toHaveURL(new RegExp(redirectLink));
7368
+ await profilePage.close();
7369
+ };
7370
+ this.verifyProfileAndOrganizationLinks = async () => {
7371
+ await test$1.step("Step 1: Open Profile popup and verify", this.openProfilePopup);
7372
+ await test$1.step("Step 2: Open My profile link and verify", async () => this.openAuthLinkAndVerify({
7373
+ linkSelector: PROFILE_SECTION_SELECTORS.myProfileButton,
7374
+ redirectLink: ROUTES.myProfile,
7375
+ }));
7376
+ await test$1.step("Step 3: Open Profile popup and verify", this.openProfilePopup);
7377
+ await test$1.step("Step 4: Open My organization link and verify", async () => this.openAuthLinkAndVerify({
7378
+ linkSelector: PROFILE_SECTION_SELECTORS.profileOrganizationSettingsButton,
7379
+ redirectLink: ROUTES.authSettings,
7380
+ }));
7381
+ };
7382
+ this.verifyLogout = async () => {
7383
+ await test$1.step("Step 1: Open Profile popup and verify", this.openProfilePopup);
7384
+ await test$1.step("Step 2: Click logout and verify", async () => {
7385
+ await this.page
7386
+ .getByTestId(PROFILE_SECTION_SELECTORS.logoutButton)
7387
+ .click();
7388
+ await expect(this.page).toHaveURL(NEETO_AUTH_BASE_URL());
7389
+ await expect(this.page).toHaveURL(new RegExp(ROUTES.loginLink));
7390
+ });
7391
+ };
7392
+ this.page = page;
7393
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
7394
+ this.chatApiBaseURL = chatApiBaseURL;
7395
+ this.kbDocsBaseURL = kbDocsBaseURL;
7396
+ this.changelogBaseURL = changelogBaseURL;
7397
+ this.neetoChatWidget = this.page.locator(CHAT_WIDGET_SELECTORS.iframe);
7398
+ this.neetoChatFrame = this.neetoChatWidget.frameLocator(":scope"); // Converting locator to a framelocator
7399
+ this.neetoChatSpinner = this.neetoChatFrame.locator(CHAT_WIDGET_SELECTORS.spinner);
7400
+ this.profileSectionButton = this.page.getByTestId(PROFILE_SECTION_SELECTORS.profileSectionButton);
7401
+ this.t = getI18nInstance().t;
7402
+ }
7403
+ }
7404
+
7145
7405
  const SIGNUP_SELECTORS = {
7146
7406
  emailTextField: "signup-email-text-field",
7147
7407
  firstNameTextField: "signup-profile-first-name-text-field",
@@ -7177,7 +7437,7 @@ class OrganizationPage {
7177
7437
  await this.page.getByTestId(SIGNUP_SELECTORS.emailTextField).fill(email);
7178
7438
  const signup = this.neetoPlaywrightUtilities.interceptMultipleResponses({
7179
7439
  responseUrl: ROUTES.signup,
7180
- baseUrl: ROUTES.neetoAuth,
7440
+ baseUrl: NEETO_AUTH_BASE_URL(),
7181
7441
  });
7182
7442
  await this.page.getByTestId(SIGNUP_SELECTORS.submitButton).click();
7183
7443
  await signup;
@@ -7212,7 +7472,7 @@ class OrganizationPage {
7212
7472
  await this.page.getByTestId(COMMON_SELECTORS.checkbox).click();
7213
7473
  const submitProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
7214
7474
  responseUrl: ROUTES.signup,
7215
- baseUrl: ROUTES.neetoAuth,
7475
+ baseUrl: NEETO_AUTH_BASE_URL(),
7216
7476
  });
7217
7477
  await this.page.getByTestId(SIGNUP_SELECTORS.profileSubmitButton).click();
7218
7478
  await submitProfile;
@@ -7275,6 +7535,11 @@ class OrganizationPage {
7275
7535
  }
7276
7536
  }
7277
7537
 
7538
+ const USER_AGENTS = {
7539
+ windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
7540
+ mac: "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
7541
+ };
7542
+
7278
7543
  const NEETO_EDITOR_SELECTORS = {
7279
7544
  boldOption: "neeto-editor-fixed-menu-bold-option",
7280
7545
  italicOption: "neeto-editor-fixed-menu-italic-option",
@@ -7312,25 +7577,6 @@ const NEETO_FILTERS_SELECTORS = {
7312
7577
  paneModalCrossIcon: "neeto-filters-close-button",
7313
7578
  };
7314
7579
 
7315
- const HELP_CENTER_SELECTORS = {
7316
- helpButton: "help-button",
7317
- documentationButton: "help-link-help-center-button",
7318
- keyboardShortcutButton: "help-link-keyboard-shortcut-button",
7319
- chatButton: "help-link-live-chat-button",
7320
- whatsNewButton: "help-link-changelog-button",
7321
- whatsNewWidgetInfo: "h1",
7322
- whatsNewWidgetCloseButton: ".nc-widget-header__btn",
7323
- keyboardShortcutPaneHeading: "keyboard-shortcuts-pane-title",
7324
- keyboardShortcutPaneCrossIcon: "keyboard-shortcuts-pane-close-button",
7325
- };
7326
- const CHAT_WIDGET_SELECTORS = {
7327
- chatWidgetHomeCard: "neeto-chat-widget-cta-title",
7328
- widgetSubmitButton: "neeto-chat-widget-pre-chat-submit-btn",
7329
- chatBubbleMessage: "neeto-chat-widget-chat-message-bubble",
7330
- chatCloseButton: ".neeto-chat-widget-icon--close",
7331
- widgetIframe: "#neetochat-iframe",
7332
- };
7333
-
7334
7580
  const LOGIN_SELECTORS = {
7335
7581
  appleAuthenticationButton: "apple-authentication-button",
7336
7582
  emailTextField: "login-email-text-field",
@@ -7933,8 +8179,9 @@ main.expand = expand;
7933
8179
 
7934
8180
  // @ts-check
7935
8181
  var _a, _b;
8182
+ process.env.TEST_ENV = (_a = process.env.TEST_ENV) !== null && _a !== void 0 ? _a : ENVIRONMENT.development;
7936
8183
  const env = main$2.exports.config({
7937
- path: `./e2e/config/.env.${(_a = process.env.TEST_ENV) !== null && _a !== void 0 ? _a : "development"}`,
8184
+ path: `./e2e/config/.env.${process.env.TEST_ENV}`,
7938
8185
  });
7939
8186
  main.expand(env);
7940
8187
  if (require$$0.existsSync("./e2e/config/.env.local")) {
@@ -7988,5 +8235,5 @@ const definePlaywrightConfig = (overrides) => {
7988
8235
  });
7989
8236
  };
7990
8237
 
7991
- export { BASE_URL, CHAT_WIDGET_SELECTORS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, IS_STAGING_ENV, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, TAGS_SELECTORS, clearCredentials, commands, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, readFileSyncIfExists, skipTest, updateCredentials, writeDataToFile };
8238
+ export { BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, IS_STAGING_ENV, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, TAGS_SELECTORS, USER_AGENTS, clearCredentials, commands, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, readFileSyncIfExists, skipTest, updateCredentials, writeDataToFile };
7992
8239
  //# sourceMappingURL=index.js.map