@bigbinary/neeto-playwright-commons 1.19.5 → 1.19.7
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 +215 -146
- package/index.cjs.js.map +1 -1
- package/index.d.ts +173 -7
- package/index.js +215 -147
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -6,6 +6,7 @@ var test$1 = require('@playwright/test');
|
|
|
6
6
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
7
7
|
var child_process = require('child_process');
|
|
8
8
|
var ramda = require('ramda');
|
|
9
|
+
var playwrightI18nextFixture = require('playwright-i18next-fixture');
|
|
9
10
|
var require$$0$2 = require('util');
|
|
10
11
|
var faker = require('@faker-js/faker');
|
|
11
12
|
var Stream$4 = require('stream');
|
|
@@ -27,7 +28,6 @@ var dayjs = require('dayjs');
|
|
|
27
28
|
var require$$0$9 = require('tty');
|
|
28
29
|
var require$$0$8 = require('os');
|
|
29
30
|
var stealth$1 = require('puppeteer-extra-plugin-stealth');
|
|
30
|
-
var playwrightI18nextFixture = require('playwright-i18next-fixture');
|
|
31
31
|
|
|
32
32
|
function _interopNamespaceDefault(e) {
|
|
33
33
|
var n = Object.create(null);
|
|
@@ -79,138 +79,6 @@ let MemberApis$1 = class MemberApis {
|
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
const ENVIRONMENT = {
|
|
83
|
-
development: "development",
|
|
84
|
-
staging: "staging",
|
|
85
|
-
review: "review",
|
|
86
|
-
};
|
|
87
|
-
const IS_STAGING_ENV = process.env.TEST_ENV === "staging";
|
|
88
|
-
const STORAGE_STATE = "./e2e/auth/user.json";
|
|
89
|
-
const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
|
|
90
|
-
const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
|
|
91
|
-
const CREDENTIALS = {
|
|
92
|
-
name: "Oliver Smith",
|
|
93
|
-
email: "oliver@example.com",
|
|
94
|
-
password: "welcome",
|
|
95
|
-
};
|
|
96
|
-
const OTP_EMAIL_PATTERN = "is your login code";
|
|
97
|
-
const SLACK_DEFAULT_CHANNEL = "general";
|
|
98
|
-
const ZAPIER_TEST_EMAIL = (product) => `neeto-${product}-zapier-test@${process.env.FASTMAIL_DOMAIN_NAME}`;
|
|
99
|
-
// constants for translation
|
|
100
|
-
const SINGULAR = { count: 1 };
|
|
101
|
-
const PLURAL = { count: 2 };
|
|
102
|
-
const COLOR = {
|
|
103
|
-
transparent: "rgba(0, 0, 0, 0)",
|
|
104
|
-
softBlue: "rgb(230, 244, 255)",
|
|
105
|
-
};
|
|
106
|
-
const DATE_TEXTS = { now: "Now", nextYear: "next-year" };
|
|
107
|
-
const EMPTY_STORAGE_STATE = {
|
|
108
|
-
storageState: { cookies: [], origins: [] },
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
/* eslint-disable playwright/no-skipped-test */
|
|
112
|
-
const execCommand = (command) => child_process.execSync(command)
|
|
113
|
-
.toString("utf-8")
|
|
114
|
-
.replace(/[\n\r\s]+$/, "");
|
|
115
|
-
const joinString = (string1, string2, string3 = "", separator = " ") => {
|
|
116
|
-
if (string3 === "") {
|
|
117
|
-
return string1 + separator + string2;
|
|
118
|
-
}
|
|
119
|
-
return string1 + separator + string2 + separator + string3;
|
|
120
|
-
};
|
|
121
|
-
const readFileSyncIfExists = (path = STORAGE_STATE) => {
|
|
122
|
-
try {
|
|
123
|
-
return JSON.parse(fs__namespace.readFileSync(path, "utf8"));
|
|
124
|
-
}
|
|
125
|
-
catch (error) {
|
|
126
|
-
return {};
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
const getGlobalUserState = () => { var _a; return (_a = readFileSyncIfExists()) === null || _a === void 0 ? void 0 : _a.user; };
|
|
130
|
-
const writeDataToFile = data => {
|
|
131
|
-
try {
|
|
132
|
-
fs__namespace.writeFileSync(STORAGE_STATE, data, "utf8");
|
|
133
|
-
}
|
|
134
|
-
catch (error) {
|
|
135
|
-
console.log(error); // eslint-disable-line
|
|
136
|
-
}
|
|
137
|
-
return true;
|
|
138
|
-
};
|
|
139
|
-
const updateCredentials = ({ key, value }) => {
|
|
140
|
-
const data = readFileSyncIfExists();
|
|
141
|
-
data["user"][key] = value;
|
|
142
|
-
return writeDataToFile(JSON.stringify(data));
|
|
143
|
-
};
|
|
144
|
-
const removeCredentialFile = () => {
|
|
145
|
-
fs__namespace.unlink(STORAGE_STATE, error => {
|
|
146
|
-
if (!error)
|
|
147
|
-
return;
|
|
148
|
-
console.log(error); // eslint-disable-line
|
|
149
|
-
});
|
|
150
|
-
};
|
|
151
|
-
const clearCredentials = () => {
|
|
152
|
-
if (shouldSkipSetupAndTeardown())
|
|
153
|
-
return;
|
|
154
|
-
removeCredentialFile();
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* @deprecated Use hyphenate from neeto-cist instead.
|
|
158
|
-
*/
|
|
159
|
-
const hyphenize = input => {
|
|
160
|
-
const fallbackString = "";
|
|
161
|
-
if (typeof input === "number")
|
|
162
|
-
return String(input);
|
|
163
|
-
if (input && typeof input === "string" && input.replace) {
|
|
164
|
-
return input
|
|
165
|
-
.replace(/[\s_]/g, "-")
|
|
166
|
-
.replace(/([a-z])([A-Z])/g, "$1-$2")
|
|
167
|
-
.replace(/-+/g, "-")
|
|
168
|
-
.toLowerCase();
|
|
169
|
-
}
|
|
170
|
-
return fallbackString;
|
|
171
|
-
};
|
|
172
|
-
const joinHyphenCase = (...args) => args.join(" ").replace(/\s+/g, "-").toLowerCase();
|
|
173
|
-
const skipTest = {
|
|
174
|
-
forDevelopmentEnv: () => test$1.skip(process.env.TEST_ENV === ENVIRONMENT.development),
|
|
175
|
-
forReviewEnv: () => test$1.skip(process.env.TEST_ENV === ENVIRONMENT.review),
|
|
176
|
-
forAllExceptStagingEnv: () => test$1.skip(process.env.TEST_ENV !== ENVIRONMENT.staging),
|
|
177
|
-
forNonNightlyRun: () => {
|
|
178
|
-
const currentBranch = execCommand("git rev-parse --abbrev-ref HEAD");
|
|
179
|
-
const isNightlyRun = currentBranch === "main" &&
|
|
180
|
-
process.env.TEST_ENV === ENVIRONMENT.staging &&
|
|
181
|
-
!!process.env.NEETO_CI_JOB_ID;
|
|
182
|
-
return test$1.skip(ramda.not(isNightlyRun), "Run test only in playwright-nightly");
|
|
183
|
-
},
|
|
184
|
-
ifNotWithinAllowedNightlyHours: ({ reason, allowedNightlyRunHours = [0, 6, 12, 18], }) => {
|
|
185
|
-
skipTest.forNonNightlyRun();
|
|
186
|
-
const currentDate = new Date();
|
|
187
|
-
const day = currentDate.getUTCDay();
|
|
188
|
-
const hour = currentDate.getUTCHours();
|
|
189
|
-
const isAllowedNightlyRun = 0 < day && day < 6 && allowedNightlyRunHours.includes(hour);
|
|
190
|
-
test$1.skip(ramda.not(isAllowedNightlyRun), `Nightly run is skipped due to ${reason}`);
|
|
191
|
-
},
|
|
192
|
-
};
|
|
193
|
-
const shouldSkipSetupAndTeardown = () => { var _a; return ((_a = getGlobalUserState()) === null || _a === void 0 ? void 0 : _a.isLoggedIn) && process.env.SKIP_SETUP === "true"; };
|
|
194
|
-
// trims and replaces multiple whitespace characters in a string with a single space
|
|
195
|
-
const squish = (text) => text.trim().replace(/\s+/g, " ");
|
|
196
|
-
const toCamelCase = (string) => string.toLowerCase().replace(/( \w)/g, letter => letter[1].toUpperCase());
|
|
197
|
-
const getByDataQA = ramda.curry((page, dataQa) => {
|
|
198
|
-
if (typeof dataQa === "string") {
|
|
199
|
-
// eslint-disable-next-line playwright/no-raw-locators
|
|
200
|
-
return page.locator(`[data-qa='${dataQa}']`);
|
|
201
|
-
}
|
|
202
|
-
// eslint-disable-next-line playwright/no-raw-locators
|
|
203
|
-
return page
|
|
204
|
-
.locator(`[data-qa='${dataQa[0]}']`)
|
|
205
|
-
.locator(`[data-qa='${dataQa[1]}']`);
|
|
206
|
-
});
|
|
207
|
-
const getListCount = async ({ page, countSelector, }) => {
|
|
208
|
-
const countText = await page.getByTestId(countSelector).textContent();
|
|
209
|
-
return Number(countText === null || countText === void 0 ? void 0 : countText.trim().split(" ")[0]);
|
|
210
|
-
};
|
|
211
|
-
const getGlobalUserProps = async (page) => (await page.evaluate(() => window.globalProps.user));
|
|
212
|
-
const getClipboardContent = (page) => page.evaluate(() => navigator.clipboard.readText());
|
|
213
|
-
|
|
214
82
|
const COMMON_SELECTORS = {
|
|
215
83
|
emailInputError: "email-input-error",
|
|
216
84
|
pane: "pane-wrapper",
|
|
@@ -231,8 +99,8 @@ const COMMON_SELECTORS = {
|
|
|
231
99
|
paneBody: "pane-body",
|
|
232
100
|
paneHeader: "pane-header",
|
|
233
101
|
profileSidebar: "profile-section",
|
|
234
|
-
selectOption: (label) => `${
|
|
235
|
-
radioLabel: (embedLabel) => `${
|
|
102
|
+
selectOption: (label) => `${neetoCist.hyphenate(label)}-select-option`,
|
|
103
|
+
radioLabel: (embedLabel) => `${neetoCist.hyphenate(embedLabel)}-radio-label`,
|
|
236
104
|
toastMessage: (type) => `toastr-${type}-container`,
|
|
237
105
|
toastCloseButton: "toastr-close-button",
|
|
238
106
|
windowAlert: "#alert-box",
|
|
@@ -271,7 +139,7 @@ const COMMON_SELECTORS = {
|
|
|
271
139
|
sidebarToggle: "neeto-molecules-sidebar-toggler",
|
|
272
140
|
subheader: "subheader",
|
|
273
141
|
settingsLink: "Settings",
|
|
274
|
-
ticketFieldTextInput: (label) => `${
|
|
142
|
+
ticketFieldTextInput: (label) => `${neetoCist.hyphenate(label)}-text-input`,
|
|
275
143
|
appSwitcherButton: "product-switcher-button",
|
|
276
144
|
appSwitcherWrapper: "switcher-wrapper",
|
|
277
145
|
tableSpinner: ".ant-spin",
|
|
@@ -283,8 +151,8 @@ const COMMON_SELECTORS = {
|
|
|
283
151
|
columnsDropdownButton: "columns-dropdown-button",
|
|
284
152
|
breadcrumbHeader: "header-breadcrumb",
|
|
285
153
|
header: "neeto-molecules-header",
|
|
286
|
-
sidebarSubLink: (label) => `${
|
|
287
|
-
sidebarGoBackButton: (label) => `${
|
|
154
|
+
sidebarSubLink: (label) => `${neetoCist.hyphenate(label)}-sub-link`,
|
|
155
|
+
sidebarGoBackButton: (label) => `${neetoCist.hyphenate(label)}-go-back-button`,
|
|
288
156
|
selectSingleValue: "select-single-value",
|
|
289
157
|
actionSelectIndicator: "action-select-indicator",
|
|
290
158
|
takeActionDropdown: "take-action-dropdown-icon",
|
|
@@ -301,17 +169,31 @@ const COMMON_SELECTORS = {
|
|
|
301
169
|
buttonSpinner: ".neeto-ui-btn__spinner",
|
|
302
170
|
pendingTagContainer: "pending-tag-container",
|
|
303
171
|
nextYearButton: "next-year-button",
|
|
304
|
-
customSelectValueContainer: (label = "nui") => `${hyphenize(label)}-select-value-container`,
|
|
305
|
-
customDropDownMenu: (label = "nui") => `${hyphenize(label)}-select-menu`,
|
|
306
172
|
popoverTitle: "popover-title",
|
|
307
173
|
helpPopoverButton: "help-popover-button",
|
|
308
174
|
helpPopoverDesc: "help-popover-description",
|
|
309
175
|
helpPopoverLinkButton: "help-popover-link-button",
|
|
310
176
|
copyToClipboardButton: "copy-to-clipboard-button",
|
|
311
177
|
subheaderRight: "subheader-right",
|
|
178
|
+
secretKeyInputField: "secret-key-input-field",
|
|
179
|
+
activeSwitch: "active-switch",
|
|
180
|
+
labelInputField: "label-input-field",
|
|
181
|
+
imageUploadModal: "tab-container",
|
|
182
|
+
neetoLogo: "sidebar-info",
|
|
183
|
+
clearSelectIndicator: "clear-select-indicator",
|
|
184
|
+
menubarContainer: "menubar-container",
|
|
185
|
+
multiEmailInputContainer: "multi-email-input-container",
|
|
186
|
+
linkInputError: "link-input-error",
|
|
187
|
+
continueButton: "continue-button",
|
|
188
|
+
clearAllButton: "clear-all-button",
|
|
189
|
+
requiredSwitch: "required-switch",
|
|
190
|
+
customSwitch: (switchLabel) => ` ${neetoCist.hyphenate(switchLabel)}-switch`,
|
|
191
|
+
customMenuItem: (label) => `${neetoCist.hyphenate(label)}-menu-item`,
|
|
312
192
|
customInputLabel: (name = "nui") => `${neetoCist.hyphenate(name)}-input-label`,
|
|
313
193
|
customInputField: (name = "nui") => `${neetoCist.hyphenate(name)}-input-field`,
|
|
314
194
|
customSelectContainer: (name) => `${neetoCist.hyphenate(name)}-select-container`,
|
|
195
|
+
customSelectContainerWrapper: (label) => `${neetoCist.hyphenate(label)}-select-container-wrapper`,
|
|
196
|
+
customSelectValueContainer: (label = "nui") => `${neetoCist.hyphenate(label)}-select-value-container`,
|
|
315
197
|
customCheckboxLabel: (name) => `${neetoCist.hyphenate(name)}-checkbox-label`,
|
|
316
198
|
errorImage: "error-image",
|
|
317
199
|
customDropdownIcon: (label = "nui") => `${neetoCist.hyphenate(label)}-dropdown-icon`,
|
|
@@ -319,6 +201,7 @@ const COMMON_SELECTORS = {
|
|
|
319
201
|
checkboxInput: (option = "i-agree") => `${neetoCist.hyphenate(option)}-checkbox-input`,
|
|
320
202
|
radioInput: (option = "i-agree") => `${neetoCist.hyphenate(option)}-radio-input`,
|
|
321
203
|
selectOptionError: (option) => `${neetoCist.hyphenate(option)}-select-error`,
|
|
204
|
+
customDropDownMenu: (label = "nui") => `${neetoCist.hyphenate(label)}-select-menu`,
|
|
322
205
|
};
|
|
323
206
|
|
|
324
207
|
const THANK_YOU_SELECTORS = {
|
|
@@ -396,7 +279,12 @@ const NEETO_EDITOR_SELECTORS = {
|
|
|
396
279
|
dynamicVariablesButton: "dynamic-variables-button",
|
|
397
280
|
emojiContainer: "neeto-editor-emoji-picker",
|
|
398
281
|
characterCount: "neeto-editor-character-count",
|
|
399
|
-
|
|
282
|
+
tableOption: optionSelector("table"),
|
|
283
|
+
tableCreateButton: "neeto-editor-fixed-menu-table-option-create-button",
|
|
284
|
+
videoUploadOption: optionSelector("video-upload"),
|
|
285
|
+
editorMenuWrapper: "neeto-editor-fixed-menu-wrapper",
|
|
286
|
+
editorMediaUploaderTab: "neeto-editor-media-uploader-local-tab",
|
|
287
|
+
dynamicVariableSelector: (variable) => `dynamic-variables-list-item-${neetoCist.hyphenate(variable)}`,
|
|
400
288
|
};
|
|
401
289
|
const NEETO_TEXT_MODIFIER_SELECTORS = {
|
|
402
290
|
strike: optionSelector("strike"),
|
|
@@ -422,6 +310,138 @@ const FONT_SIZE_SELECTORS = {
|
|
|
422
310
|
h5: fixedMenuSelector("font-size-option-h5"),
|
|
423
311
|
};
|
|
424
312
|
|
|
313
|
+
const ENVIRONMENT = {
|
|
314
|
+
development: "development",
|
|
315
|
+
staging: "staging",
|
|
316
|
+
review: "review",
|
|
317
|
+
};
|
|
318
|
+
const IS_STAGING_ENV = process.env.TEST_ENV === "staging";
|
|
319
|
+
const STORAGE_STATE = "./e2e/auth/user.json";
|
|
320
|
+
const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
|
|
321
|
+
const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
|
|
322
|
+
const CREDENTIALS = {
|
|
323
|
+
name: "Oliver Smith",
|
|
324
|
+
email: "oliver@example.com",
|
|
325
|
+
password: "welcome",
|
|
326
|
+
};
|
|
327
|
+
const OTP_EMAIL_PATTERN = "is your login code";
|
|
328
|
+
const SLACK_DEFAULT_CHANNEL = "general";
|
|
329
|
+
const ZAPIER_TEST_EMAIL = (product) => `neeto-${product}-zapier-test@${process.env.FASTMAIL_DOMAIN_NAME}`;
|
|
330
|
+
// constants for translation
|
|
331
|
+
const SINGULAR = { count: 1 };
|
|
332
|
+
const PLURAL = { count: 2 };
|
|
333
|
+
const COLOR = {
|
|
334
|
+
transparent: "rgba(0, 0, 0, 0)",
|
|
335
|
+
softBlue: "rgb(230, 244, 255)",
|
|
336
|
+
};
|
|
337
|
+
const DATE_TEXTS = { now: "Now", nextYear: "next-year" };
|
|
338
|
+
const EMPTY_STORAGE_STATE = {
|
|
339
|
+
storageState: { cookies: [], origins: [] },
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
/* eslint-disable playwright/no-skipped-test */
|
|
343
|
+
const execCommand = (command) => child_process.execSync(command)
|
|
344
|
+
.toString("utf-8")
|
|
345
|
+
.replace(/[\n\r\s]+$/, "");
|
|
346
|
+
const joinString = (string1, string2, string3 = "", separator = " ") => {
|
|
347
|
+
if (string3 === "") {
|
|
348
|
+
return string1 + separator + string2;
|
|
349
|
+
}
|
|
350
|
+
return string1 + separator + string2 + separator + string3;
|
|
351
|
+
};
|
|
352
|
+
const readFileSyncIfExists = (path = STORAGE_STATE) => {
|
|
353
|
+
try {
|
|
354
|
+
return JSON.parse(fs__namespace.readFileSync(path, "utf8"));
|
|
355
|
+
}
|
|
356
|
+
catch (error) {
|
|
357
|
+
return {};
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
const getGlobalUserState = () => { var _a; return (_a = readFileSyncIfExists()) === null || _a === void 0 ? void 0 : _a.user; };
|
|
361
|
+
const writeDataToFile = data => {
|
|
362
|
+
try {
|
|
363
|
+
fs__namespace.writeFileSync(STORAGE_STATE, data, "utf8");
|
|
364
|
+
}
|
|
365
|
+
catch (error) {
|
|
366
|
+
console.log(error); // eslint-disable-line
|
|
367
|
+
}
|
|
368
|
+
return true;
|
|
369
|
+
};
|
|
370
|
+
const updateCredentials = ({ key, value }) => {
|
|
371
|
+
const data = readFileSyncIfExists();
|
|
372
|
+
data["user"][key] = value;
|
|
373
|
+
return writeDataToFile(JSON.stringify(data));
|
|
374
|
+
};
|
|
375
|
+
const removeCredentialFile = () => {
|
|
376
|
+
fs__namespace.unlink(STORAGE_STATE, error => {
|
|
377
|
+
if (!error)
|
|
378
|
+
return;
|
|
379
|
+
console.log(error); // eslint-disable-line
|
|
380
|
+
});
|
|
381
|
+
};
|
|
382
|
+
const clearCredentials = () => {
|
|
383
|
+
if (shouldSkipSetupAndTeardown())
|
|
384
|
+
return;
|
|
385
|
+
removeCredentialFile();
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* @deprecated Use hyphenate from neeto-cist instead.
|
|
389
|
+
*/
|
|
390
|
+
const hyphenize = input => {
|
|
391
|
+
const fallbackString = "";
|
|
392
|
+
if (typeof input === "number")
|
|
393
|
+
return String(input);
|
|
394
|
+
if (input && typeof input === "string" && input.replace) {
|
|
395
|
+
return input
|
|
396
|
+
.replace(/[\s_]/g, "-")
|
|
397
|
+
.replace(/([a-z])([A-Z])/g, "$1-$2")
|
|
398
|
+
.replace(/-+/g, "-")
|
|
399
|
+
.toLowerCase();
|
|
400
|
+
}
|
|
401
|
+
return fallbackString;
|
|
402
|
+
};
|
|
403
|
+
const joinHyphenCase = (...args) => args.join(" ").replace(/\s+/g, "-").toLowerCase();
|
|
404
|
+
const skipTest = {
|
|
405
|
+
forDevelopmentEnv: () => test$1.skip(process.env.TEST_ENV === ENVIRONMENT.development),
|
|
406
|
+
forReviewEnv: () => test$1.skip(process.env.TEST_ENV === ENVIRONMENT.review),
|
|
407
|
+
forAllExceptStagingEnv: () => test$1.skip(process.env.TEST_ENV !== ENVIRONMENT.staging),
|
|
408
|
+
forNonNightlyRun: () => {
|
|
409
|
+
const currentBranch = execCommand("git rev-parse --abbrev-ref HEAD");
|
|
410
|
+
const isNightlyRun = currentBranch === "main" &&
|
|
411
|
+
process.env.TEST_ENV === ENVIRONMENT.staging &&
|
|
412
|
+
!!process.env.NEETO_CI_JOB_ID;
|
|
413
|
+
return test$1.skip(ramda.not(isNightlyRun), "Run test only in playwright-nightly");
|
|
414
|
+
},
|
|
415
|
+
ifNotWithinAllowedNightlyHours: ({ reason, allowedNightlyRunHours = [0, 6, 12, 18], }) => {
|
|
416
|
+
skipTest.forNonNightlyRun();
|
|
417
|
+
const currentDate = new Date();
|
|
418
|
+
const day = currentDate.getUTCDay();
|
|
419
|
+
const hour = currentDate.getUTCHours();
|
|
420
|
+
const isAllowedNightlyRun = 0 < day && day < 6 && allowedNightlyRunHours.includes(hour);
|
|
421
|
+
test$1.skip(ramda.not(isAllowedNightlyRun), `Nightly run is skipped due to ${reason}`);
|
|
422
|
+
},
|
|
423
|
+
};
|
|
424
|
+
const shouldSkipSetupAndTeardown = () => { var _a; return ((_a = getGlobalUserState()) === null || _a === void 0 ? void 0 : _a.isLoggedIn) && process.env.SKIP_SETUP === "true"; };
|
|
425
|
+
// trims and replaces multiple whitespace characters in a string with a single space
|
|
426
|
+
const squish = (text) => text.trim().replace(/\s+/g, " ");
|
|
427
|
+
const toCamelCase = (string) => string.toLowerCase().replace(/( \w)/g, letter => letter[1].toUpperCase());
|
|
428
|
+
const getByDataQA = ramda.curry((page, dataQa) => {
|
|
429
|
+
if (typeof dataQa === "string") {
|
|
430
|
+
// eslint-disable-next-line playwright/no-raw-locators
|
|
431
|
+
return page.locator(`[data-qa='${dataQa}']`);
|
|
432
|
+
}
|
|
433
|
+
// eslint-disable-next-line playwright/no-raw-locators
|
|
434
|
+
return page
|
|
435
|
+
.locator(`[data-qa='${dataQa[0]}']`)
|
|
436
|
+
.locator(`[data-qa='${dataQa[1]}']`);
|
|
437
|
+
});
|
|
438
|
+
const getListCount = async ({ page, countSelector, }) => {
|
|
439
|
+
const countText = await page.getByTestId(countSelector).textContent();
|
|
440
|
+
return Number(countText === null || countText === void 0 ? void 0 : countText.trim().split(" ")[0]);
|
|
441
|
+
};
|
|
442
|
+
const getGlobalUserProps = async (page) => (await page.evaluate(() => window.globalProps.user));
|
|
443
|
+
const getClipboardContent = (page) => page.evaluate(() => navigator.clipboard.readText());
|
|
444
|
+
|
|
425
445
|
const EMBED_SELECTORS = {
|
|
426
446
|
iframe: (appName) => `#${appName}-iframe`,
|
|
427
447
|
modal: (appName) => `#${appName}-modal`,
|
|
@@ -466,8 +486,12 @@ const NEETO_FILTERS_SELECTORS = {
|
|
|
466
486
|
paneModalCrossIcon: "neeto-filters-close-button",
|
|
467
487
|
searchTermBlock: "neeto-filters-search-term-block",
|
|
468
488
|
categoriesFilter: "neeto-filters-categories-filter",
|
|
469
|
-
|
|
470
|
-
|
|
489
|
+
filtersSegmentName: "neeto-filters-segment-name",
|
|
490
|
+
activeSelectContainer: "neeto-filters-status-filter",
|
|
491
|
+
neetoFiltersFilter: (filterName) => `neeto-filters-${neetoCist.hyphenate(filterName)}-filter`,
|
|
492
|
+
filtersTermBlock: (filterType = "search-term") => `neeto-filters-${neetoCist.hyphenate(filterType)}-block`,
|
|
493
|
+
dateRange: (filterName) => `neeto-filters-${neetoCist.hyphenate(filterName)}-date-range`,
|
|
494
|
+
segmentLabel: (label) => `neeto-filters-segment-block-${neetoCist.hyphenate(label)}`,
|
|
471
495
|
};
|
|
472
496
|
|
|
473
497
|
const HELP_CENTER_SELECTORS = {
|
|
@@ -639,6 +663,7 @@ const TAGS_SELECTORS = {
|
|
|
639
663
|
metaDataCard: "metadata-card",
|
|
640
664
|
metaDataBlock: "metadata-block",
|
|
641
665
|
tagContainer: "tag-container",
|
|
666
|
+
tagsCount: "neeto-tags-filtered-tags-count-text",
|
|
642
667
|
};
|
|
643
668
|
const MERGE_TAGS_SELECTORS = {
|
|
644
669
|
mergeTagsButton: "neeto-tags-merge-tags-button",
|
|
@@ -664,6 +689,7 @@ const CHAT_WIDGET_SELECTORS = {
|
|
|
664
689
|
closeChat: "neeto-chat-widget-close-btn",
|
|
665
690
|
chatQuestionHeader: "chat-question-header",
|
|
666
691
|
openChat: "neeto-chat-widget-open-btn",
|
|
692
|
+
homeScreenSubtitle: "neeto-chat-widget-home-screen-subtitle",
|
|
667
693
|
};
|
|
668
694
|
const CHANGELOG_WIDGET_SELECTORS = {
|
|
669
695
|
changelogWrapper: ".ne-widget__wrapper",
|
|
@@ -682,6 +708,7 @@ const INTEGRATION_SELECTORS = {
|
|
|
682
708
|
integrationStatusTag: "integration-status-tag",
|
|
683
709
|
disconnectButton: "disconnect-button",
|
|
684
710
|
manageButton: "manage-button",
|
|
711
|
+
integrationConnectedTag: "integration-connected-tag",
|
|
685
712
|
};
|
|
686
713
|
|
|
687
714
|
const GOOGLE_LOGIN_SELECTORS = {
|
|
@@ -737,6 +764,8 @@ const WEBHOOK_SELECTORS = {
|
|
|
737
764
|
eventsSelectError: "events-select-error",
|
|
738
765
|
regenerateSecret: "regenerate-secret",
|
|
739
766
|
deleteSecret: "delete-secret",
|
|
767
|
+
editWebhookButton: "neeto-webhooks-edit-button",
|
|
768
|
+
deleteWebhookButton: "neeto-webhooks-delete-button",
|
|
740
769
|
};
|
|
741
770
|
|
|
742
771
|
const ZAPIER_SELECTORS = {
|
|
@@ -794,6 +823,22 @@ const API_KEYS_SELECTORS = {
|
|
|
794
823
|
editApiKeyButton: "api-key-edit-button",
|
|
795
824
|
deleteApiKeyButton: "api-key-delete-button",
|
|
796
825
|
addApiKeyButton: "add-api-key-button",
|
|
826
|
+
apiKeysLabelField: "api-keys-label-field",
|
|
827
|
+
apiKeysExpiresAtField: "api-keys-expires-at-field",
|
|
828
|
+
expiryDateInputError: "expiry-date-input-error",
|
|
829
|
+
expiryDateInput: "expiry-date-input",
|
|
830
|
+
apiKeysField: "api-keys-label-field",
|
|
831
|
+
tokenField: "api-keys-token-field",
|
|
832
|
+
expiresAtField: "api-keys-expires-at-field",
|
|
833
|
+
createdAtField: "api-keys-created-at-field",
|
|
834
|
+
};
|
|
835
|
+
|
|
836
|
+
const DATE_PICKER_SELECTORS = {
|
|
837
|
+
pickerInput: "picker-input",
|
|
838
|
+
datePicker: "date-picker",
|
|
839
|
+
timePicker: "time-picker",
|
|
840
|
+
nextYearButton: "next-year-button",
|
|
841
|
+
prevYearButton: "prev-year-button",
|
|
797
842
|
};
|
|
798
843
|
|
|
799
844
|
const mimeTypeMap = {
|
|
@@ -4124,6 +4169,14 @@ class CustomCommands {
|
|
|
4124
4169
|
(await test$1.expect(tooltipBox.getByTestId(COMMON_SELECTORS.helpPopoverLinkButton)).toHaveAttribute("href", new RegExp(helpURL, "i")));
|
|
4125
4170
|
await this.hideTooltip(triggerElement, customPageContext);
|
|
4126
4171
|
};
|
|
4172
|
+
this.verifyHelpText = async (helpURL) => {
|
|
4173
|
+
const isNoDataTitleHidden = await this.page
|
|
4174
|
+
.getByTestId(COMMON_SELECTORS.noDataTitle)
|
|
4175
|
+
.isHidden();
|
|
4176
|
+
if (isNoDataTitleHidden)
|
|
4177
|
+
return;
|
|
4178
|
+
await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.noDataHelpText).getByRole("link")).toHaveAttribute("href", new RegExp(helpURL, "i"));
|
|
4179
|
+
};
|
|
4127
4180
|
this.verifySearchTermBlock = async (searchTerm) => {
|
|
4128
4181
|
const filtersSearchTermBlock = this.page.getByTestId(NEETO_FILTERS_SELECTORS.filtersTermBlock());
|
|
4129
4182
|
if (searchTerm) {
|
|
@@ -4197,10 +4250,23 @@ class CustomCommands {
|
|
|
4197
4250
|
}, serializedFile);
|
|
4198
4251
|
await droppableZone.dispatchEvent(dispatchEvent, { dataTransfer });
|
|
4199
4252
|
};
|
|
4253
|
+
this.verifyUnsavedChangesModal = async (shouldLeavePage = false) => {
|
|
4254
|
+
const alertBox = this.page.getByTestId(COMMON_SELECTORS.alertBox);
|
|
4255
|
+
await Promise.all([
|
|
4256
|
+
test$1.expect(this.page.getByTestId(COMMON_SELECTORS.alertModalMessage)).toHaveText(this.t("neetoui.blockNavigation.alertMessage")),
|
|
4257
|
+
test$1.expect(this.page.getByTestId(COMMON_SELECTORS.alertTitle)).toHaveText(this.t("neetoui.blockNavigation.alertTitle")),
|
|
4258
|
+
]);
|
|
4259
|
+
const buttonSelector = shouldLeavePage
|
|
4260
|
+
? COMMON_SELECTORS.alertCancelButton
|
|
4261
|
+
: COMMON_SELECTORS.alertModalSubmitButton;
|
|
4262
|
+
await alertBox.getByTestId(buttonSelector).click();
|
|
4263
|
+
await test$1.expect(alertBox).toBeHidden();
|
|
4264
|
+
};
|
|
4200
4265
|
this.page = page;
|
|
4201
4266
|
this.responses = [];
|
|
4202
4267
|
this.request = request;
|
|
4203
4268
|
this.baseURL = baseURL;
|
|
4269
|
+
this.t = playwrightI18nextFixture.getI18nInstance().t;
|
|
4204
4270
|
}
|
|
4205
4271
|
}
|
|
4206
4272
|
|
|
@@ -192514,7 +192580,7 @@ class OrganizationPage {
|
|
|
192514
192580
|
await this.page.getByTestId(COMMON_SELECTORS.checkbox).click();
|
|
192515
192581
|
const profileSubmitButton = this.page.getByTestId(SIGNUP_SELECTORS.profileSubmitButton);
|
|
192516
192582
|
await profileSubmitButton.click();
|
|
192517
|
-
await test$1.expect(profileSubmitButton).toBeHidden({ timeout: 60000 });
|
|
192583
|
+
await test$1.expect(profileSubmitButton).toBeHidden({ timeout: 5 * 60000 });
|
|
192518
192584
|
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
192519
192585
|
};
|
|
192520
192586
|
this.loginAndOnboard = async ({ email, firstName, lastName, country, handleOnboarding, baseURL = process.env.BASE_URL, fetchOtpFromEmail, }) => {
|
|
@@ -192700,13 +192766,15 @@ class CustomDomainPage {
|
|
|
192700
192766
|
await this.page
|
|
192701
192767
|
.getByTestId(CUSTOM_DOMAIN_SELECTORS.submitCustomDomainButton)
|
|
192702
192768
|
.click();
|
|
192703
|
-
await
|
|
192769
|
+
await Promise.all([
|
|
192770
|
+
test$1.expect(this.page.getByTestId(COMMON_SELECTORS.paneBody).getByText(domainName)).toBeVisible(),
|
|
192771
|
+
test$1.expect(this.page.getByTestId(CUSTOM_DOMAIN_SELECTORS.customDomainValidateButton)).toBeVisible(),
|
|
192772
|
+
]);
|
|
192704
192773
|
await this.page.getByTestId(COMMON_SELECTORS.paneModalCrossIcon).click();
|
|
192705
192774
|
await Promise.all([
|
|
192706
192775
|
test$1.expect(this.page.getByTestId(COMMON_SELECTORS.paneBody)).toBeHidden(),
|
|
192707
192776
|
test$1.expect(addCustomDomainButton).toBeDisabled(),
|
|
192708
192777
|
test$1.expect(this.page.getByTestId(COMMON_SELECTORS.pendingTagContainer)).toBeVisible(),
|
|
192709
|
-
test$1.expect(this.page.getByTestId(COMMON_SELECTORS.paneBody).getByText(domainName)).toBeVisible(),
|
|
192710
192778
|
]);
|
|
192711
192779
|
};
|
|
192712
192780
|
this.deleteCustomDomainViaUI = async () => {
|
|
@@ -194916,6 +194984,7 @@ exports.CREDENTIALS = CREDENTIALS;
|
|
|
194916
194984
|
exports.CUSTOM_DOMAIN_SELECTORS = CUSTOM_DOMAIN_SELECTORS;
|
|
194917
194985
|
exports.CustomCommands = CustomCommands;
|
|
194918
194986
|
exports.CustomDomainsPage = CustomDomainPage;
|
|
194987
|
+
exports.DATE_PICKER_SELECTORS = DATE_PICKER_SELECTORS;
|
|
194919
194988
|
exports.DATE_TEXTS = DATE_TEXTS;
|
|
194920
194989
|
exports.DESCRIPTION_EDITOR_TEXTS = DESCRIPTION_EDITOR_TEXTS;
|
|
194921
194990
|
exports.EMBED_SELECTORS = EMBED_SELECTORS;
|