@bigbinary/neeto-playwright-commons 1.5.2 → 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.cjs.js +290 -38
- package/index.cjs.js.map +1 -1
- package/index.d.ts +82 -12
- package/index.js +286 -40
- package/index.js.map +1 -1
- package/package.json +1 -1
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:
|
|
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,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
response.
|
|
148
|
-
|
|
149
|
-
.url()
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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;
|
|
@@ -7126,10 +7131,14 @@ const i18nFixture = {
|
|
|
7126
7131
|
};
|
|
7127
7132
|
|
|
7128
7133
|
const BASE_URL = "/api/v1";
|
|
7134
|
+
const NEETO_AUTH_BASE_URL = (subdomain = "app") => `https://${subdomain}.neetoauth.net`;
|
|
7129
7135
|
const ROUTES = {
|
|
7130
|
-
|
|
7131
|
-
|
|
7136
|
+
neetoAuthSignup: `${NEETO_AUTH_BASE_URL()}/signups/new`,
|
|
7137
|
+
neetoAuth: NEETO_AUTH_BASE_URL(),
|
|
7138
|
+
loginLink: "/login",
|
|
7132
7139
|
profile: "/profile",
|
|
7140
|
+
myProfile: "/my/profile",
|
|
7141
|
+
authSettings: "/settings",
|
|
7133
7142
|
login: `${BASE_URL}/login`,
|
|
7134
7143
|
signup: `${BASE_URL}/signups`,
|
|
7135
7144
|
subdomainAvailability: `${BASE_URL}/subdomain_availability`,
|
|
@@ -7143,6 +7152,256 @@ const ROUTES = {
|
|
|
7143
7152
|
},
|
|
7144
7153
|
};
|
|
7145
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
|
+
|
|
7146
7405
|
const SIGNUP_SELECTORS = {
|
|
7147
7406
|
emailTextField: "signup-email-text-field",
|
|
7148
7407
|
firstNameTextField: "signup-profile-first-name-text-field",
|
|
@@ -7178,7 +7437,7 @@ class OrganizationPage {
|
|
|
7178
7437
|
await this.page.getByTestId(SIGNUP_SELECTORS.emailTextField).fill(email);
|
|
7179
7438
|
const signup = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
7180
7439
|
responseUrl: ROUTES.signup,
|
|
7181
|
-
baseUrl:
|
|
7440
|
+
baseUrl: NEETO_AUTH_BASE_URL(),
|
|
7182
7441
|
});
|
|
7183
7442
|
await this.page.getByTestId(SIGNUP_SELECTORS.submitButton).click();
|
|
7184
7443
|
await signup;
|
|
@@ -7213,7 +7472,7 @@ class OrganizationPage {
|
|
|
7213
7472
|
await this.page.getByTestId(COMMON_SELECTORS.checkbox).click();
|
|
7214
7473
|
const submitProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
7215
7474
|
responseUrl: ROUTES.signup,
|
|
7216
|
-
baseUrl:
|
|
7475
|
+
baseUrl: NEETO_AUTH_BASE_URL(),
|
|
7217
7476
|
});
|
|
7218
7477
|
await this.page.getByTestId(SIGNUP_SELECTORS.profileSubmitButton).click();
|
|
7219
7478
|
await submitProfile;
|
|
@@ -7276,6 +7535,11 @@ class OrganizationPage {
|
|
|
7276
7535
|
}
|
|
7277
7536
|
}
|
|
7278
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
|
+
|
|
7279
7543
|
const NEETO_EDITOR_SELECTORS = {
|
|
7280
7544
|
boldOption: "neeto-editor-fixed-menu-bold-option",
|
|
7281
7545
|
italicOption: "neeto-editor-fixed-menu-italic-option",
|
|
@@ -7313,25 +7577,6 @@ const NEETO_FILTERS_SELECTORS = {
|
|
|
7313
7577
|
paneModalCrossIcon: "neeto-filters-close-button",
|
|
7314
7578
|
};
|
|
7315
7579
|
|
|
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
7580
|
const LOGIN_SELECTORS = {
|
|
7336
7581
|
appleAuthenticationButton: "apple-authentication-button",
|
|
7337
7582
|
emailTextField: "login-email-text-field",
|
|
@@ -7934,8 +8179,9 @@ main.expand = expand;
|
|
|
7934
8179
|
|
|
7935
8180
|
// @ts-check
|
|
7936
8181
|
var _a, _b;
|
|
8182
|
+
process.env.TEST_ENV = (_a = process.env.TEST_ENV) !== null && _a !== void 0 ? _a : ENVIRONMENT.development;
|
|
7937
8183
|
const env = main$2.exports.config({
|
|
7938
|
-
path: `./e2e/config/.env.${
|
|
8184
|
+
path: `./e2e/config/.env.${process.env.TEST_ENV}`,
|
|
7939
8185
|
});
|
|
7940
8186
|
main.expand(env);
|
|
7941
8187
|
if (require$$0.existsSync("./e2e/config/.env.local")) {
|
|
@@ -7989,5 +8235,5 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
7989
8235
|
});
|
|
7990
8236
|
};
|
|
7991
8237
|
|
|
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 };
|
|
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 };
|
|
7993
8239
|
//# sourceMappingURL=index.js.map
|