@bigbinary/neeto-playwright-commons 1.5.2 → 1.6.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.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;
@@ -22,7 +24,7 @@ interface VerifySuccessToastParams {
22
24
  }
23
25
  type VerifySuccessToast = (params: VerifySuccessToastParams) => Promise<void>;
24
26
  type BasicTypesInterface = Record<string, number | string | boolean>;
25
- type HttpMethods = "get" | "post" | "put" | "delete";
27
+ type HttpMethods = "get" | "patch" | "post" | "put" | "delete";
26
28
  interface ApiRequestProps {
27
29
  url: string;
28
30
  headers?: BasicTypesInterface;
@@ -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,8 @@ 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;
191
241
  tableSpinner: string;
192
242
  };
193
243
 
@@ -239,13 +289,6 @@ declare const HELP_CENTER_SELECTORS: {
239
289
  keyboardShortcutPaneHeading: string;
240
290
  keyboardShortcutPaneCrossIcon: string;
241
291
  };
242
- declare const CHAT_WIDGET_SELECTORS: {
243
- chatWidgetHomeCard: string;
244
- widgetSubmitButton: string;
245
- chatBubbleMessage: string;
246
- chatCloseButton: string;
247
- widgetIframe: string;
248
- };
249
292
 
250
293
  declare const LOGIN_SELECTORS: {
251
294
  appleAuthenticationButton: string;
@@ -346,6 +389,33 @@ declare const MERGE_TAGS_SELECTORS: {
346
389
  disabledTag: string;
347
390
  };
348
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
+
349
419
  declare const initializeCredentials: (product: string) => void;
350
420
 
351
421
  interface KeyValue {
@@ -398,4 +468,4 @@ interface Overrides {
398
468
  }
399
469
  declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
400
470
 
401
- 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,25 +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",
138
140
  tableSpinner: ".ant-spin",
139
141
  };
140
142
 
141
143
  class CustomCommands {
142
144
  constructor(page, request) {
143
- this.interceptMultipleResponses = ({ responseUrl = "", times = 1, baseUrl, }) => Promise.all([...new Array(times)].map(() => this.page.waitForResponse((response) => {
144
- var _a, _b, _c;
145
- if (response.request().resourceType() === "xhr" &&
146
- response.status() === 200 &&
147
- response.url().includes(responseUrl) &&
148
- response
149
- .url()
150
- .startsWith((_a = baseUrl !== null && baseUrl !== void 0 ? baseUrl : process.env.BASE_URL) !== null && _a !== void 0 ? _a : "") &&
151
- !this.responses.includes((_b = response.headers()) === null || _b === void 0 ? void 0 : _b["x-request-id"])) {
152
- this.responses.push((_c = response.headers()) === null || _c === void 0 ? void 0 : _c["x-request-id"]);
153
- return true;
154
- }
155
- return false;
156
- }, { 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
+ };
157
162
  this.recursiveMethod = async (callback, condition, timeout, startTime) => {
158
163
  if (Date.now() - timeout >= startTime) {
159
164
  return false;
@@ -201,6 +206,7 @@ class CustomCommands {
201
206
  };
202
207
  const httpMethodsHandlers = {
203
208
  get: () => this.request.get(url, requestOptions),
209
+ patch: () => this.request.patch(url, requestOptions),
204
210
  post: () => this.request.post(url, requestOptions),
205
211
  put: () => this.request.put(url, requestOptions),
206
212
  delete: () => this.request.delete(url, requestOptions),
@@ -7126,10 +7132,14 @@ const i18nFixture = {
7126
7132
  };
7127
7133
 
7128
7134
  const BASE_URL = "/api/v1";
7135
+ const NEETO_AUTH_BASE_URL = (subdomain = "app") => `https://${subdomain}.neetoauth.net`;
7129
7136
  const ROUTES = {
7130
- neetoAuth: "https://app.neetoauth.net",
7131
- neetoAuthSignup: "https://app.neetoauth.net/signups/new",
7137
+ neetoAuthSignup: `${NEETO_AUTH_BASE_URL()}/signups/new`,
7138
+ neetoAuth: NEETO_AUTH_BASE_URL(),
7139
+ loginLink: "/login",
7132
7140
  profile: "/profile",
7141
+ myProfile: "/my/profile",
7142
+ authSettings: "/settings",
7133
7143
  login: `${BASE_URL}/login`,
7134
7144
  signup: `${BASE_URL}/signups`,
7135
7145
  subdomainAvailability: `${BASE_URL}/subdomain_availability`,
@@ -7143,6 +7153,256 @@ const ROUTES = {
7143
7153
  },
7144
7154
  };
7145
7155
 
7156
+ const CHAT_WIDGET_TEXTS = {
7157
+ newConversation: "New Conversation",
7158
+ welcomeChatBubble: "Hi! I'm here to assist you with any questions you may have. What can I do for you?",
7159
+ };
7160
+
7161
+ const HELP_CENTER_SELECTORS = {
7162
+ helpButton: "help-button",
7163
+ documentationButton: "help-link-help-center-button",
7164
+ keyboardShortcutButton: "help-link-keyboard-shortcut-button",
7165
+ chatButton: "help-link-live-chat-button",
7166
+ whatsNewButton: "help-link-changelog-button",
7167
+ whatsNewWidgetInfo: "h1",
7168
+ whatsNewWidgetCloseButton: ".nc-widget-header__btn",
7169
+ keyboardShortcutPaneHeading: "keyboard-shortcuts-pane-title",
7170
+ keyboardShortcutPaneCrossIcon: "keyboard-shortcuts-pane-close-button",
7171
+ };
7172
+
7173
+ const PROFILE_SECTION_SELECTORS = {
7174
+ profileSectionButton: "profile-section",
7175
+ myProfileButton: "my-profile-button",
7176
+ profileOrganizationSettingsButton: "profile-organization-settings-button",
7177
+ logoutButton: "profile-logout-button",
7178
+ };
7179
+
7180
+ const CHAT_WIDGET_SELECTORS = {
7181
+ iframe: "#neetochat-iframe",
7182
+ spinner: ".neeto-chat-widget-spinner",
7183
+ helpButton: "help-button",
7184
+ preChatEmailInput: "neeto-chat-widget-input",
7185
+ preChatSubmitButton: "neeto-chat-widget-pre-chat-submit-btn",
7186
+ chatBubble: "neeto-chat-widget-chat-message-bubble",
7187
+ closeChat: "neeto-chat-widget-close-btn",
7188
+ };
7189
+ const CHANGELOG_WIDGET_SELECTORS = {
7190
+ changelogWrapper: ".nc-widget__wrapper",
7191
+ closeButton: "nc-widget-close-btn",
7192
+ publicUrlLink: "nc-widget-public-url",
7193
+ };
7194
+ const KEYBOARD_SHORTCUTS_SELECTORS = {
7195
+ keyboardShortcutsPane: "keyboard-shortcuts-pane",
7196
+ closePaneButton: "keyboard-shortcuts-pane-close-button",
7197
+ hotKeyItem: "hotkey-item",
7198
+ };
7199
+
7200
+ /* eslint-disable playwright/require-top-level-describe */
7201
+ class HelpAndProfilePage {
7202
+ constructor({ page, neetoPlaywrightUtilities, chatApiBaseURL, kbDocsBaseURL, changelogBaseURL, }) {
7203
+ this.openHelpCenter = async () => {
7204
+ await expect(async () => {
7205
+ const helpButton = this.page.getByTestId(CHAT_WIDGET_SELECTORS.helpButton);
7206
+ await helpButton.scrollIntoViewIfNeeded();
7207
+ await helpButton.hover();
7208
+ await expect(this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton)).toBeVisible();
7209
+ }).toPass({ timeout: 15000 });
7210
+ };
7211
+ this.openLiveChatAndVerify = async () => {
7212
+ await this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton).click();
7213
+ await expect(this.neetoChatWidget).toBeVisible();
7214
+ await expect(this.neetoChatSpinner).toBeHidden();
7215
+ };
7216
+ this.openAndVerifyChatWidget = async () => {
7217
+ await this.neetoPlaywrightUtilities.interceptMultipleResponses({
7218
+ baseUrl: this.chatApiBaseURL,
7219
+ times: 3,
7220
+ });
7221
+ await test$1.step("Step 1: Open Help Center links", this.openHelpCenter);
7222
+ await test$1.step("Step 2: Open live chat and verify iframe", this.openLiveChatAndVerify);
7223
+ await test$1.step("Step 3: Close and reopen live chat frame", async () => {
7224
+ await this.page.getByTestId(CHAT_WIDGET_SELECTORS.closeChat).click();
7225
+ await expect(this.neetoChatWidget).toBeHidden();
7226
+ await this.openHelpCenter();
7227
+ await this.openLiveChatAndVerify();
7228
+ });
7229
+ await test$1.step("Step 4: Start new conversation", async () => {
7230
+ const newConversationButton = this.neetoChatFrame.getByRole("button", {
7231
+ name: CHAT_WIDGET_TEXTS.newConversation,
7232
+ });
7233
+ await expect(newConversationButton).toBeVisible(); // Adding additional toBeVisible to take advantage of the auto-retrying web-first assertion
7234
+ await newConversationButton.click();
7235
+ await expect(this.neetoChatSpinner).toBeHidden();
7236
+ });
7237
+ await test$1.step("Step 5: Fill and submit email", async () => {
7238
+ var _a, _b;
7239
+ await this.neetoChatFrame
7240
+ .getByTestId(CHAT_WIDGET_SELECTORS.preChatEmailInput)
7241
+ .fill((_b = (_a = readFileSyncIfExists()) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.email);
7242
+ await this.neetoChatFrame
7243
+ .getByTestId(CHAT_WIDGET_SELECTORS.preChatSubmitButton)
7244
+ .getByRole("button")
7245
+ .click();
7246
+ await expect(this.neetoChatSpinner).toBeHidden();
7247
+ });
7248
+ await test$1.step("Step 6: Verify conversation window", async () => {
7249
+ await expect(this.neetoChatFrame.getByTestId(CHAT_WIDGET_SELECTORS.chatBubble)).toHaveText(CHAT_WIDGET_TEXTS.welcomeChatBubble);
7250
+ });
7251
+ };
7252
+ this.openAndVerifyHelpArticles = async () => {
7253
+ await test$1.step("Step 1: Open Help Center links", this.openHelpCenter);
7254
+ await test$1.step("Step 2: Open and verify help articles link", async () => {
7255
+ const helpArticlesPromise = this.page.waitForEvent("popup");
7256
+ await this.page
7257
+ .getByTestId(HELP_CENTER_SELECTORS.documentationButton)
7258
+ .click();
7259
+ const helpArticlesPage = await helpArticlesPromise;
7260
+ await helpArticlesPage.waitForLoadState();
7261
+ await expect(helpArticlesPage).toHaveURL(this.kbDocsBaseURL);
7262
+ await helpArticlesPage.close();
7263
+ });
7264
+ };
7265
+ this.openChangelogPane = async () => {
7266
+ await this.page.getByTestId(HELP_CENTER_SELECTORS.whatsNewButton).click();
7267
+ await expect(this.page.locator(CHANGELOG_WIDGET_SELECTORS.changelogWrapper)).toBeVisible();
7268
+ };
7269
+ this.openAndVerifyChangelog = async () => {
7270
+ await test$1.step("Step 1: Open Help Center links", this.openHelpCenter);
7271
+ await test$1.step("Step 2: Open and verify changelog pane", this.openChangelogPane);
7272
+ await test$1.step("Step 3: Close and reopen changelog pane", async () => {
7273
+ await this.page
7274
+ .getByTestId(CHANGELOG_WIDGET_SELECTORS.closeButton)
7275
+ .click();
7276
+ await expect(this.page.locator(CHANGELOG_WIDGET_SELECTORS.changelogWrapper)).toBeHidden();
7277
+ await this.openHelpCenter();
7278
+ await this.openChangelogPane();
7279
+ });
7280
+ await test$1.step("Step 4: Open and verify public URL", async () => {
7281
+ const changelogPagePromise = this.page.waitForEvent("popup");
7282
+ await this.page
7283
+ .getByTestId(CHANGELOG_WIDGET_SELECTORS.publicUrlLink)
7284
+ .click();
7285
+ const changelogPage = await changelogPagePromise;
7286
+ await this.neetoPlaywrightUtilities.interceptMultipleResponses({
7287
+ customPageContext: changelogPage,
7288
+ baseUrl: this.changelogBaseURL.split("/site")[0],
7289
+ times: 3,
7290
+ });
7291
+ await expect(changelogPage).toHaveURL(this.changelogBaseURL);
7292
+ await changelogPage.close();
7293
+ });
7294
+ };
7295
+ this.formatKeyboardShortcut = (shortcut, osPlatform = "windows") => {
7296
+ const formattedShortcut = shortcut
7297
+ .replaceAll(" ", "then")
7298
+ .replaceAll("+", "");
7299
+ return osPlatform === "mac"
7300
+ ? formattedShortcut.replace(/ctrl/g, "⌘")
7301
+ : formattedShortcut;
7302
+ };
7303
+ this.openAndVerifyKeyboardShortcutsPane = async (productShortcuts, osPlatform = "windows") => {
7304
+ const globalShortcuts = [
7305
+ {
7306
+ description: this.t("neetoMolecules.keyboardShortcuts.global.openKeyboardShortcutsPane"),
7307
+ sequence: "shift+/",
7308
+ },
7309
+ {
7310
+ description: this.t("neetoMolecules.keyboardShortcuts.global.close"),
7311
+ sequence: "esc",
7312
+ },
7313
+ {
7314
+ description: this.t("neetoMolecules.keyboardShortcuts.global.submitForm"),
7315
+ sequence: "ctrl+enter",
7316
+ },
7317
+ ];
7318
+ const shortcuts = [...globalShortcuts, ...productShortcuts];
7319
+ await test$1.step("Step 1: Open Help Center", this.openHelpCenter);
7320
+ await test$1.step("Step 2: Open and close keyboard shortcuts from UI", async () => {
7321
+ await this.page
7322
+ .getByTestId(HELP_CENTER_SELECTORS.keyboardShortcutButton)
7323
+ .click();
7324
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7325
+ await this.page
7326
+ .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.closePaneButton)
7327
+ .click();
7328
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).toHaveCSS("width", "1px");
7329
+ });
7330
+ await test$1.step("Step 3: Open and close keyboard shortcuts through shortcut", async () => {
7331
+ await this.page.keyboard.press("Shift+/");
7332
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7333
+ await this.page.keyboard.press("Escape");
7334
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).toHaveCSS("width", "1px");
7335
+ });
7336
+ await test$1.step("Step 4: Verify all displayed keyboard shortcuts", async () => {
7337
+ await this.page.keyboard.press("Shift+/");
7338
+ await expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
7339
+ await expect(this.page
7340
+ .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.hotKeyItem)
7341
+ .locator("p")).toHaveText(shortcuts.map(shortcut => shortcut.description));
7342
+ const formattedSequences = shortcuts.map(shortcut => this.formatKeyboardShortcut(shortcut.sequence, osPlatform));
7343
+ await expect(this.page
7344
+ .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.hotKeyItem)
7345
+ .locator("div")).toHaveText(formattedSequences);
7346
+ });
7347
+ };
7348
+ this.openAppSwitcherAndVerify = async () => {
7349
+ const appSwitcher = this.page.getByTestId(COMMON_SELECTORS.appSwitcherButton);
7350
+ await test$1.step("Step 1: Verify hovering over app switcher opens the app switcher drawer", () => expect(async () => {
7351
+ await appSwitcher.scrollIntoViewIfNeeded();
7352
+ await appSwitcher.hover();
7353
+ await expect(this.page.getByTestId(COMMON_SELECTORS.appSwitcherWrapper)).toBeVisible();
7354
+ }).toPass({ timeout: 15000 }));
7355
+ };
7356
+ this.openProfilePopup = () => expect(async () => {
7357
+ await this.profileSectionButton.scrollIntoViewIfNeeded();
7358
+ await this.profileSectionButton.hover();
7359
+ await expect(this.profileSectionButton).toBeVisible();
7360
+ }).toPass({ timeout: 15000 });
7361
+ this.openAuthLinkAndVerify = async ({ linkSelector, redirectLink, }) => {
7362
+ var _a, _b;
7363
+ const profilePagePromise = this.page.waitForEvent("popup");
7364
+ await this.page.getByTestId(linkSelector).click();
7365
+ const profilePage = await profilePagePromise;
7366
+ await profilePage.waitForLoadState();
7367
+ 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)));
7368
+ await expect(profilePage).toHaveURL(new RegExp(redirectLink));
7369
+ await profilePage.close();
7370
+ };
7371
+ this.verifyProfileAndOrganizationLinks = async () => {
7372
+ await test$1.step("Step 1: Open Profile popup and verify", this.openProfilePopup);
7373
+ await test$1.step("Step 2: Open My profile link and verify", async () => this.openAuthLinkAndVerify({
7374
+ linkSelector: PROFILE_SECTION_SELECTORS.myProfileButton,
7375
+ redirectLink: ROUTES.myProfile,
7376
+ }));
7377
+ await test$1.step("Step 3: Open Profile popup and verify", this.openProfilePopup);
7378
+ await test$1.step("Step 4: Open My organization link and verify", async () => this.openAuthLinkAndVerify({
7379
+ linkSelector: PROFILE_SECTION_SELECTORS.profileOrganizationSettingsButton,
7380
+ redirectLink: ROUTES.authSettings,
7381
+ }));
7382
+ };
7383
+ this.verifyLogout = async () => {
7384
+ await test$1.step("Step 1: Open Profile popup and verify", this.openProfilePopup);
7385
+ await test$1.step("Step 2: Click logout and verify", async () => {
7386
+ await this.page
7387
+ .getByTestId(PROFILE_SECTION_SELECTORS.logoutButton)
7388
+ .click();
7389
+ await expect(this.page).toHaveURL(NEETO_AUTH_BASE_URL());
7390
+ await expect(this.page).toHaveURL(new RegExp(ROUTES.loginLink));
7391
+ });
7392
+ };
7393
+ this.page = page;
7394
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
7395
+ this.chatApiBaseURL = chatApiBaseURL;
7396
+ this.kbDocsBaseURL = kbDocsBaseURL;
7397
+ this.changelogBaseURL = changelogBaseURL;
7398
+ this.neetoChatWidget = this.page.locator(CHAT_WIDGET_SELECTORS.iframe);
7399
+ this.neetoChatFrame = this.neetoChatWidget.frameLocator(":scope"); // Converting locator to a framelocator
7400
+ this.neetoChatSpinner = this.neetoChatFrame.locator(CHAT_WIDGET_SELECTORS.spinner);
7401
+ this.profileSectionButton = this.page.getByTestId(PROFILE_SECTION_SELECTORS.profileSectionButton);
7402
+ this.t = getI18nInstance().t;
7403
+ }
7404
+ }
7405
+
7146
7406
  const SIGNUP_SELECTORS = {
7147
7407
  emailTextField: "signup-email-text-field",
7148
7408
  firstNameTextField: "signup-profile-first-name-text-field",
@@ -7178,7 +7438,7 @@ class OrganizationPage {
7178
7438
  await this.page.getByTestId(SIGNUP_SELECTORS.emailTextField).fill(email);
7179
7439
  const signup = this.neetoPlaywrightUtilities.interceptMultipleResponses({
7180
7440
  responseUrl: ROUTES.signup,
7181
- baseUrl: ROUTES.neetoAuth,
7441
+ baseUrl: NEETO_AUTH_BASE_URL(),
7182
7442
  });
7183
7443
  await this.page.getByTestId(SIGNUP_SELECTORS.submitButton).click();
7184
7444
  await signup;
@@ -7213,7 +7473,7 @@ class OrganizationPage {
7213
7473
  await this.page.getByTestId(COMMON_SELECTORS.checkbox).click();
7214
7474
  const submitProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
7215
7475
  responseUrl: ROUTES.signup,
7216
- baseUrl: ROUTES.neetoAuth,
7476
+ baseUrl: NEETO_AUTH_BASE_URL(),
7217
7477
  });
7218
7478
  await this.page.getByTestId(SIGNUP_SELECTORS.profileSubmitButton).click();
7219
7479
  await submitProfile;
@@ -7276,6 +7536,11 @@ class OrganizationPage {
7276
7536
  }
7277
7537
  }
7278
7538
 
7539
+ const USER_AGENTS = {
7540
+ windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
7541
+ 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",
7542
+ };
7543
+
7279
7544
  const NEETO_EDITOR_SELECTORS = {
7280
7545
  boldOption: "neeto-editor-fixed-menu-bold-option",
7281
7546
  italicOption: "neeto-editor-fixed-menu-italic-option",
@@ -7313,25 +7578,6 @@ const NEETO_FILTERS_SELECTORS = {
7313
7578
  paneModalCrossIcon: "neeto-filters-close-button",
7314
7579
  };
7315
7580
 
7316
- const HELP_CENTER_SELECTORS = {
7317
- helpButton: "help-button",
7318
- documentationButton: "help-link-help-center-button",
7319
- keyboardShortcutButton: "help-link-keyboard-shortcut-button",
7320
- chatButton: "help-link-live-chat-button",
7321
- whatsNewButton: "help-link-changelog-button",
7322
- whatsNewWidgetInfo: "h1",
7323
- whatsNewWidgetCloseButton: ".nc-widget-header__btn",
7324
- keyboardShortcutPaneHeading: "keyboard-shortcuts-pane-title",
7325
- keyboardShortcutPaneCrossIcon: "keyboard-shortcuts-pane-close-button",
7326
- };
7327
- const CHAT_WIDGET_SELECTORS = {
7328
- chatWidgetHomeCard: "neeto-chat-widget-cta-title",
7329
- widgetSubmitButton: "neeto-chat-widget-pre-chat-submit-btn",
7330
- chatBubbleMessage: "neeto-chat-widget-chat-message-bubble",
7331
- chatCloseButton: ".neeto-chat-widget-icon--close",
7332
- widgetIframe: "#neetochat-iframe",
7333
- };
7334
-
7335
7581
  const LOGIN_SELECTORS = {
7336
7582
  appleAuthenticationButton: "apple-authentication-button",
7337
7583
  emailTextField: "login-email-text-field",
@@ -7934,8 +8180,9 @@ main.expand = expand;
7934
8180
 
7935
8181
  // @ts-check
7936
8182
  var _a, _b;
8183
+ process.env.TEST_ENV = (_a = process.env.TEST_ENV) !== null && _a !== void 0 ? _a : ENVIRONMENT.development;
7937
8184
  const env = main$2.exports.config({
7938
- path: `./e2e/config/.env.${(_a = process.env.TEST_ENV) !== null && _a !== void 0 ? _a : "development"}`,
8185
+ path: `./e2e/config/.env.${process.env.TEST_ENV}`,
7939
8186
  });
7940
8187
  main.expand(env);
7941
8188
  if (require$$0.existsSync("./e2e/config/.env.local")) {
@@ -7989,5 +8236,5 @@ const definePlaywrightConfig = (overrides) => {
7989
8236
  });
7990
8237
  };
7991
8238
 
7992
- 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 };
8239
+ 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 };
7993
8240
  //# sourceMappingURL=index.js.map