@bigbinary/neeto-playwright-commons 4.12.7 → 5.0.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/README.md +2 -4
- package/index.d.ts +485 -2768
- package/index.js +455 -2436
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isPresent, keysToSnakeCase, hyphenate, humanize, noop as noop$2,
|
|
1
|
+
import { isPresent, keysToSnakeCase, isNotPresent, hyphenate, humanize, noop as noop$2, keysToCamelCase, truncate, isNotEmpty, _findBy, randomPick, findBy } from '@bigbinary/neeto-cist';
|
|
2
2
|
import { faker } from '@faker-js/faker/locale/en';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
4
|
import { readFileSync, writeFileSync, unlinkSync, mkdirSync, rmSync, existsSync, createWriteStream } from 'fs';
|
|
@@ -9,7 +9,7 @@ import path__default from 'path';
|
|
|
9
9
|
import { expect, test, chromium, defineConfig, devices } from '@playwright/test';
|
|
10
10
|
import { stringify } from 'picoquery';
|
|
11
11
|
import { getI18nInstance, initI18n } from 'playwright-i18next-fixture';
|
|
12
|
-
import { isEmpty,
|
|
12
|
+
import { isEmpty, mergeAll, curry, isNotNil, not, pluck, mergeDeepLeft } from 'ramda';
|
|
13
13
|
import { spawn, execSync, spawnSync } from 'child_process';
|
|
14
14
|
import dayjs from 'dayjs';
|
|
15
15
|
import { Redis } from 'ioredis';
|
|
@@ -20,13 +20,11 @@ import { parse as parse$1 } from 'node-html-parser';
|
|
|
20
20
|
import { Jimp } from 'jimp';
|
|
21
21
|
import jsQRModule from 'jsqr';
|
|
22
22
|
import { globSync } from 'node:fs';
|
|
23
|
-
import customParseFormat from 'dayjs/plugin/customParseFormat.js';
|
|
24
23
|
import timezone from 'dayjs/plugin/timezone.js';
|
|
25
24
|
import utc from 'dayjs/plugin/utc.js';
|
|
26
25
|
import https from 'https';
|
|
27
26
|
import { countries } from 'countries-list';
|
|
28
27
|
import { parsePhoneNumberWithError } from 'libphonenumber-js';
|
|
29
|
-
import * as http from 'http';
|
|
30
28
|
import { lock } from 'proper-lockfile';
|
|
31
29
|
import dotenv from 'dotenv';
|
|
32
30
|
|
|
@@ -224,29 +222,6 @@ const APP_RESOURCES = [
|
|
|
224
222
|
"**/neeto_widget_tokens",
|
|
225
223
|
];
|
|
226
224
|
const ALL_RESOURCES = Array.from(new Set([...THIRD_PARTY_RESOURCES, ...APP_RESOURCES]));
|
|
227
|
-
const PRODUCT_ROLES_ROUTE_MAP = {
|
|
228
|
-
crm: "/admin/admin-panel/manageUsers/roles",
|
|
229
|
-
planner: "/admin-panel/general/roles",
|
|
230
|
-
...Object.fromEntries(["code", "runner", "ci", "git", "tower", "quiz"].map(product => [
|
|
231
|
-
product,
|
|
232
|
-
"/admin/admin-panel/roles",
|
|
233
|
-
])),
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
class ApiKeysApi {
|
|
237
|
-
neetoPlaywrightUtilities;
|
|
238
|
-
API_KEYS_BASE_URL = `neeto_api_keys${BASE_URL}`;
|
|
239
|
-
constructor(neetoPlaywrightUtilities) {
|
|
240
|
-
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
241
|
-
}
|
|
242
|
-
create = (label, type = "general") => this.neetoPlaywrightUtilities.apiRequest({
|
|
243
|
-
url: `${this.API_KEYS_BASE_URL}/api_keys`,
|
|
244
|
-
method: "post",
|
|
245
|
-
body: {
|
|
246
|
-
api_key: { has_no_expiry: true, expires_at: null, label, type },
|
|
247
|
-
},
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
225
|
|
|
251
226
|
const CUSTOM_DOMAIN_BASE_URL = `${BASE_URL}/custom_domains`;
|
|
252
227
|
class CustomDomainApi {
|
|
@@ -330,13 +305,10 @@ const SLACK_DEFAULT_CHANNEL = "general";
|
|
|
330
305
|
const CUSTOM_DOMAIN_SUFFIX = "neetoautomation.com";
|
|
331
306
|
const REVIEW_APP_CUSTOM_DOMAIN_SUFFIX = `review.${CUSTOM_DOMAIN_SUFFIX}`;
|
|
332
307
|
const CUSTOM_DOMAIN_EDGE_CERTIFICATE_SUFFIX = process.env.CUSTOM_DOMAIN_EDGE_CERTIFICATE_SUFFIX;
|
|
333
|
-
const ZAPIER_TEST_EMAIL = (product) => `neeto-${product}-zapier-test@${process.env.FASTMAIL_DOMAIN_NAME}`;
|
|
334
308
|
const MAILPIT_BASE_URL = "https://mailpit.neetodeployapp.com";
|
|
335
309
|
const MAILPIT_DOMAIN_NAME = "mail.neetoautomation.com";
|
|
336
|
-
const IS_MAILPIT_ENABLED = isPresent(process.env.MAILPIT_DOMAIN_NAME);
|
|
337
|
-
const IS_SHADCN_UI = isPresent(process.env.IS_SHADCN_UI);
|
|
338
310
|
const mailpitDomainName = () => process.env.MAILPIT_DOMAIN_NAME || MAILPIT_DOMAIN_NAME;
|
|
339
|
-
const
|
|
311
|
+
const ZAPIER_TEST_EMAIL = (product) => `neeto-${product}-zapier-test@${mailpitDomainName()}`;
|
|
340
312
|
// constants for translation
|
|
341
313
|
const SINGULAR = { count: 1 };
|
|
342
314
|
const PLURAL = { count: 2 };
|
|
@@ -466,42 +438,6 @@ class MailpitApi {
|
|
|
466
438
|
};
|
|
467
439
|
}
|
|
468
440
|
|
|
469
|
-
class MemberApis {
|
|
470
|
-
neetoPlaywrightUtilities;
|
|
471
|
-
teamMembersBaseUrl;
|
|
472
|
-
teamsBaseUrl;
|
|
473
|
-
constructor(neetoPlaywrightUtilities) {
|
|
474
|
-
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
475
|
-
this.teamMembersBaseUrl = "/neeto_team_members";
|
|
476
|
-
this.teamsBaseUrl = `${this.teamMembersBaseUrl}/teams`;
|
|
477
|
-
}
|
|
478
|
-
create = (body) => this.neetoPlaywrightUtilities.apiRequest({
|
|
479
|
-
method: "post",
|
|
480
|
-
url: this.teamsBaseUrl,
|
|
481
|
-
body: { user: body },
|
|
482
|
-
});
|
|
483
|
-
jobStatus = (jobId) => this.neetoPlaywrightUtilities.apiRequest({
|
|
484
|
-
url: `${this.teamsBaseUrl}/creation_status/${jobId}`,
|
|
485
|
-
});
|
|
486
|
-
fetch = (params = {}) => this.neetoPlaywrightUtilities.apiRequest({
|
|
487
|
-
url: this.teamsBaseUrl,
|
|
488
|
-
params,
|
|
489
|
-
});
|
|
490
|
-
fetchPermissions = () => this.neetoPlaywrightUtilities.apiRequest({
|
|
491
|
-
url: `${this.teamMembersBaseUrl}/permissions`,
|
|
492
|
-
});
|
|
493
|
-
update = (memberId, body) => this.neetoPlaywrightUtilities.apiRequest({
|
|
494
|
-
method: "put",
|
|
495
|
-
url: `${this.teamsBaseUrl}/${memberId}`,
|
|
496
|
-
body: { team: body },
|
|
497
|
-
});
|
|
498
|
-
bulkUpdate = (body) => this.neetoPlaywrightUtilities.apiRequest({
|
|
499
|
-
method: "patch",
|
|
500
|
-
url: `${this.teamsBaseUrl}/bulk_update`,
|
|
501
|
-
body: { users: body },
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
|
|
505
441
|
class RailsEmailApiClient {
|
|
506
442
|
port = process.env.RAILS_SERVER_PORT;
|
|
507
443
|
subdomain = process.env.SUBDOMAIN ?? "spinkart";
|
|
@@ -563,38 +499,6 @@ class RailsEmailApiClient {
|
|
|
563
499
|
clearStaleEmails = (receivedBefore) => this.fetchJson(`${this.emailsEndpoint}?received_before=${encodeURIComponent(receivedBefore)}`, { method: "DELETE" });
|
|
564
500
|
}
|
|
565
501
|
|
|
566
|
-
class RoleApis {
|
|
567
|
-
neetoPlaywrightUtilities;
|
|
568
|
-
BASE_URL = "/neeto_team_members";
|
|
569
|
-
ORGANIZATION_ROLES_URL = `${this.BASE_URL}/organization_roles`;
|
|
570
|
-
constructor(neetoPlaywrightUtilities) {
|
|
571
|
-
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
572
|
-
}
|
|
573
|
-
fetch = (endpoint) => this.neetoPlaywrightUtilities.apiRequest({
|
|
574
|
-
url: `${this.BASE_URL}/${endpoint}`,
|
|
575
|
-
});
|
|
576
|
-
addRole = (roleName, permissionIds) => this.neetoPlaywrightUtilities.apiRequest({
|
|
577
|
-
url: this.ORGANIZATION_ROLES_URL,
|
|
578
|
-
method: "post",
|
|
579
|
-
data: {
|
|
580
|
-
organization_role: {
|
|
581
|
-
name: roleName,
|
|
582
|
-
permission_ids: permissionIds,
|
|
583
|
-
},
|
|
584
|
-
},
|
|
585
|
-
});
|
|
586
|
-
editRole = (roleId, body) => this.neetoPlaywrightUtilities.apiRequest({
|
|
587
|
-
url: `${this.ORGANIZATION_ROLES_URL}/${roleId}`,
|
|
588
|
-
method: "patch",
|
|
589
|
-
body: { organization_role: body },
|
|
590
|
-
});
|
|
591
|
-
deleteRole = (roleId, standardRoleId) => this.neetoPlaywrightUtilities.apiRequest({
|
|
592
|
-
url: `${this.ORGANIZATION_ROLES_URL}/${roleId}`,
|
|
593
|
-
method: "delete",
|
|
594
|
-
body: { new_role_id: standardRoleId },
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
|
|
598
502
|
const SECURITY_BASE_URL = `/secure${BASE_URL}/configuration`;
|
|
599
503
|
class SecurityApi {
|
|
600
504
|
neetoPlaywrightUtilities;
|
|
@@ -633,18 +537,6 @@ class SecurityApi {
|
|
|
633
537
|
});
|
|
634
538
|
}
|
|
635
539
|
|
|
636
|
-
class TagsApi {
|
|
637
|
-
neetoPlaywrightUtilities;
|
|
638
|
-
constructor(neetoPlaywrightUtilities) {
|
|
639
|
-
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
640
|
-
}
|
|
641
|
-
create = ({ body, tagsRequestUrl, }) => this.neetoPlaywrightUtilities.apiRequest({
|
|
642
|
-
url: tagsRequestUrl,
|
|
643
|
-
body,
|
|
644
|
-
method: "post",
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
|
|
648
540
|
const THANK_YOU_URL = "/neeto_thank_you/thank_you_configurations";
|
|
649
541
|
class ThankYouApi {
|
|
650
542
|
neetoPlaywrightUtilities;
|
|
@@ -676,6 +568,34 @@ class ThankYouApi {
|
|
|
676
568
|
});
|
|
677
569
|
}
|
|
678
570
|
|
|
571
|
+
const formatEnvList = (names) => {
|
|
572
|
+
const last = names[names.length - 1];
|
|
573
|
+
const rest = names.slice(0, -1);
|
|
574
|
+
if (rest.length === 0)
|
|
575
|
+
return last;
|
|
576
|
+
if (rest.length === 1)
|
|
577
|
+
return `${rest[0]} and ${last}`;
|
|
578
|
+
return `${rest.join(", ")}, and ${last}`;
|
|
579
|
+
};
|
|
580
|
+
const missingEnvMessage = (names) => {
|
|
581
|
+
const noun = names.length === 1 ? "ENV variable" : "ENV variables";
|
|
582
|
+
const verb = names.length === 1 ? "is" : "are";
|
|
583
|
+
return `${noun} ${formatEnvList(names)} ${verb} not set`;
|
|
584
|
+
};
|
|
585
|
+
/**
|
|
586
|
+
* Reads the named environment variables. Throws when any value is missing or
|
|
587
|
+
* blank, listing only the names that failed. One name returns the string;
|
|
588
|
+
* several names return an object keyed by those names.
|
|
589
|
+
*/
|
|
590
|
+
const requireEnv = (...names) => {
|
|
591
|
+
const missing = names.filter(name => isNotPresent(process.env[name]));
|
|
592
|
+
if (missing.length > 0)
|
|
593
|
+
throw new Error(missingEnvMessage(missing));
|
|
594
|
+
if (names.length === 1)
|
|
595
|
+
return process.env[names[0]];
|
|
596
|
+
return Object.fromEntries(names.map(name => [name, process.env[name]]));
|
|
597
|
+
};
|
|
598
|
+
|
|
679
599
|
const NEETO_TOWER_BASE_URL = "https://ops.neetotower.com/";
|
|
680
600
|
const DNS_RECORDS_BASE_URL = `${NEETO_TOWER_BASE_URL}api/v1/public/automation_tests/dns_records`;
|
|
681
601
|
class NeetoTowerApi {
|
|
@@ -683,10 +603,7 @@ class NeetoTowerApi {
|
|
|
683
603
|
apiKey;
|
|
684
604
|
constructor(neetoPlaywrightUtilities) {
|
|
685
605
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
686
|
-
|
|
687
|
-
throw new Error("NEETO_TOWER_API_KEY is not set");
|
|
688
|
-
}
|
|
689
|
-
this.apiKey = process.env.NEETO_TOWER_API_KEY;
|
|
606
|
+
this.apiKey = requireEnv("NEETO_TOWER_API_KEY");
|
|
690
607
|
}
|
|
691
608
|
apiRequest = ({ method, dnsDomainId = "", body, }) => this.neetoPlaywrightUtilities.apiRequest({
|
|
692
609
|
url: `${DNS_RECORDS_BASE_URL}${dnsDomainId ? `/${dnsDomainId}` : ""}`,
|
|
@@ -707,10 +624,7 @@ class SlackApi {
|
|
|
707
624
|
botToken;
|
|
708
625
|
constructor(neetoPlaywrightUtilities) {
|
|
709
626
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
710
|
-
|
|
711
|
-
throw new Error("SLACK_BOT_TOKEN is not set");
|
|
712
|
-
}
|
|
713
|
-
this.botToken = process.env.SLACK_BOT_TOKEN;
|
|
627
|
+
this.botToken = requireEnv("SLACK_BOT_TOKEN");
|
|
714
628
|
}
|
|
715
629
|
apiRequest = (endpoint, params) => this.neetoPlaywrightUtilities.apiRequest({
|
|
716
630
|
url: `https://slack.com/api/conversations.${endpoint}`,
|
|
@@ -751,14 +665,10 @@ class TwilioApi {
|
|
|
751
665
|
defaultPhoneSid;
|
|
752
666
|
constructor(neetoPlaywrightUtilities) {
|
|
753
667
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
}
|
|
759
|
-
this.authToken = process.env.TWILIO_AUTH_TOKEN;
|
|
760
|
-
this.sid = process.env.TWILIO_SID;
|
|
761
|
-
this.defaultPhoneSid = process.env.TWILIO_DEFAULT_PHONE_SID;
|
|
668
|
+
const env = requireEnv("TWILIO_AUTH_TOKEN", "TWILIO_SID", "TWILIO_DEFAULT_PHONE_SID");
|
|
669
|
+
this.authToken = env.TWILIO_AUTH_TOKEN;
|
|
670
|
+
this.sid = env.TWILIO_SID;
|
|
671
|
+
this.defaultPhoneSid = env.TWILIO_DEFAULT_PHONE_SID;
|
|
762
672
|
}
|
|
763
673
|
apiRequest = ({ endpoint, params, body, method = "get", }) => this.neetoPlaywrightUtilities.apiRequest({
|
|
764
674
|
method,
|
|
@@ -813,20 +723,6 @@ const CUSTOM_DOMAIN_SELECTORS = {
|
|
|
813
723
|
strategyContinueButton: "custom-domain-strategy-continue-button",
|
|
814
724
|
onlyAddRootRadio: "custom-domain-strategy-only-add-root-radio-input",
|
|
815
725
|
};
|
|
816
|
-
const API_KEYS_SELECTORS = {
|
|
817
|
-
countLabel: "api-keys-count",
|
|
818
|
-
editApiKeyButton: "api-key-edit-button",
|
|
819
|
-
deleteApiKeyButton: "api-key-delete-button",
|
|
820
|
-
addApiKeyButton: "add-api-key-button",
|
|
821
|
-
apiKeysLabelField: "api-keys-label-field",
|
|
822
|
-
apiKeysExpiresAtField: "api-keys-expires-at-field",
|
|
823
|
-
expiryDateInputError: "expiry-date-input-error",
|
|
824
|
-
expiryDateInput: "expiry-date-input",
|
|
825
|
-
apiKeysField: "api-keys-label-field",
|
|
826
|
-
tokenField: "api-keys-token-field",
|
|
827
|
-
expiresAtField: "api-keys-expires-at-field",
|
|
828
|
-
createdAtField: "api-keys-created-at-field",
|
|
829
|
-
};
|
|
830
726
|
const IP_RESTRICTIONS_SELECTORS = {
|
|
831
727
|
enableIPRestrictionChk: "enable-ip-restriction-checkbox",
|
|
832
728
|
saveChanges: "ip-restriction-save-changes",
|
|
@@ -1005,7 +901,7 @@ const COMMON_SELECTORS = {
|
|
|
1005
901
|
emailInputWrapper: "email-input-wrapper",
|
|
1006
902
|
switchWrapper: "nui-switch-wrapper",
|
|
1007
903
|
switchLabel: "nui-switch-item",
|
|
1008
|
-
|
|
904
|
+
slider: '[data-slot="slider"]',
|
|
1009
905
|
card: "neeto-molecules-card",
|
|
1010
906
|
hotkeyDescription: "hotkey-description",
|
|
1011
907
|
columnVisibilityBtn: (action) => `column-visibility-${action}-button`,
|
|
@@ -1038,8 +934,8 @@ const THANK_YOU_SELECTORS = {
|
|
|
1038
934
|
showLinkToSubmitAnotherResponseSwitch: "show-link-to-submit-another-response-switch",
|
|
1039
935
|
submitAnotherResponseLinkTextInputField: "submit-another-response-link-text-input-field",
|
|
1040
936
|
previewEditorContent: "preview-editor-content",
|
|
1041
|
-
redirectToExternalLinkRadioLabel: () => "neeto-thank-you-configuration-redirect-to-url-label",
|
|
1042
|
-
thankYouConfigurationLabel: (label = "custom-message") => `neeto-thank-you-configuration-${label}-label`,
|
|
937
|
+
redirectToExternalLinkRadioLabel: () => "neeto-thank-you-configuration-redirect-to-url-radio-label",
|
|
938
|
+
thankYouConfigurationLabel: (label = "custom-message") => `neeto-thank-you-configuration-${label}-radio-label`,
|
|
1043
939
|
saveChangesButton: "neeto-thank-you-configuration-save-button",
|
|
1044
940
|
cancelButton: "neeto-thank-you-configuration-cancel-button",
|
|
1045
941
|
thankYouPageImage: "thank-you-page-image",
|
|
@@ -1148,13 +1044,6 @@ const CHAT_WIDGET_TEXTS = {
|
|
|
1148
1044
|
welcomeChatBubble: "Hi! I'm here to assist you with any questions you may have. What can I do for you?",
|
|
1149
1045
|
preChatQuestions: "Please fill in the form to start chatting.",
|
|
1150
1046
|
};
|
|
1151
|
-
const MEMBER_TEXTS = {
|
|
1152
|
-
agent: "Agent",
|
|
1153
|
-
admin: "Admin",
|
|
1154
|
-
selectAll: "Select All",
|
|
1155
|
-
hide: "Hide all",
|
|
1156
|
-
show: "Show all",
|
|
1157
|
-
};
|
|
1158
1047
|
const INTEGRATIONS_TEXTS = {
|
|
1159
1048
|
connectHeader: (integration) => `Connect your ${integration} account`,
|
|
1160
1049
|
connectedHeader: (integration) => `${integration} is connected`,
|
|
@@ -1409,24 +1298,29 @@ const startLockRefresh = (redis, provider) => {
|
|
|
1409
1298
|
}, LOCK_REFRESH_INTERVAL_MS);
|
|
1410
1299
|
return () => clearInterval(interval);
|
|
1411
1300
|
};
|
|
1412
|
-
const pollForCookies = (redis, provider, context) => {
|
|
1301
|
+
const pollForCookies = async (redis, provider, context) => {
|
|
1413
1302
|
log$2(`"${provider}" lock held by another shard — waiting for cached cookies`);
|
|
1414
|
-
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
}
|
|
1303
|
+
const controller = new AbortController();
|
|
1304
|
+
const { signal } = controller;
|
|
1305
|
+
const timeout = setTimeout$1(POLL_TIMEOUT_MS, undefined, { signal }).then(() => {
|
|
1306
|
+
throw new Error(`[cookieCache] Timed out waiting for "${provider}" cookies from another shard`);
|
|
1307
|
+
});
|
|
1419
1308
|
const poll = async () => {
|
|
1420
|
-
while (
|
|
1421
|
-
await setTimeout$1(POLL_INTERVAL_MS);
|
|
1309
|
+
while (true) {
|
|
1310
|
+
await setTimeout$1(POLL_INTERVAL_MS, undefined, { signal });
|
|
1422
1311
|
if (await restoreCookies(redis, provider, context))
|
|
1423
1312
|
return true;
|
|
1313
|
+
signal.throwIfAborted();
|
|
1424
1314
|
if (!(await redis.exists(lockKey(provider))))
|
|
1425
1315
|
return false;
|
|
1426
1316
|
}
|
|
1427
|
-
return false;
|
|
1428
1317
|
};
|
|
1429
|
-
|
|
1318
|
+
try {
|
|
1319
|
+
return await Promise.race([poll(), timeout]);
|
|
1320
|
+
}
|
|
1321
|
+
finally {
|
|
1322
|
+
controller.abort();
|
|
1323
|
+
}
|
|
1430
1324
|
};
|
|
1431
1325
|
const cacheCookies = async (redis, provider, context, allowedDomains) => {
|
|
1432
1326
|
const cookies = (await context.cookies()).filter(({ domain }) => allowedDomains.some(d => domain.includes(d)));
|
|
@@ -1540,16 +1434,13 @@ class GooglePage extends IntegrationBase {
|
|
|
1540
1434
|
if (IS_DEV_ENV)
|
|
1541
1435
|
return;
|
|
1542
1436
|
return withCookieCache("google", this.page.context(), async () => {
|
|
1543
|
-
|
|
1544
|
-
isNil(process.env.GOOGLE_LOGIN_PASSWORD)) {
|
|
1545
|
-
throw new Error("ENV variable GOOGLE_LOGIN_EMAIL or GOOGLE_LOGIN_PASSWORD is not properly configured");
|
|
1546
|
-
}
|
|
1437
|
+
const env = requireEnv("GOOGLE_LOGIN_EMAIL", "GOOGLE_LOGIN_PASSWORD");
|
|
1547
1438
|
await this.page.goto(THIRD_PARTY_ROUTES.google.signin, {
|
|
1548
1439
|
timeout: 20_000,
|
|
1549
1440
|
});
|
|
1550
1441
|
await this.page
|
|
1551
1442
|
.getByLabel(GOOGLE_LOGIN_TEXTS.emailOrPhone)
|
|
1552
|
-
.pressSequentially(
|
|
1443
|
+
.pressSequentially(env.GOOGLE_LOGIN_EMAIL, { delay: 10 });
|
|
1553
1444
|
await this.page
|
|
1554
1445
|
.getByRole("button", { name: GOOGLE_LOGIN_TEXTS.next })
|
|
1555
1446
|
.click();
|
|
@@ -1558,7 +1449,7 @@ class GooglePage extends IntegrationBase {
|
|
|
1558
1449
|
await expect(this.page.getByText(GOOGLE_LOGIN_TEXTS.showPassword)).toBeVisible({ timeout: 10_000 });
|
|
1559
1450
|
await this.page
|
|
1560
1451
|
.getByLabel(GOOGLE_LOGIN_TEXTS.enterYourPassword)
|
|
1561
|
-
.pressSequentially(
|
|
1452
|
+
.pressSequentially(env.GOOGLE_LOGIN_PASSWORD, {
|
|
1562
1453
|
delay: 10,
|
|
1563
1454
|
timeout: 20_000,
|
|
1564
1455
|
});
|
|
@@ -1713,12 +1604,10 @@ const createOrganizationViaRake = async ({ email, firstName, lastName, subdomain
|
|
|
1713
1604
|
return stdout.trim();
|
|
1714
1605
|
};
|
|
1715
1606
|
const createOrganizationViaApi = async ({ page, email, firstName, lastName, businessName, subdomainName, redirectUri, timeZone = DEFAULT_TIMEZONE_ID, }) => {
|
|
1716
|
-
|
|
1717
|
-
throw new Error("OTP_BYPASS_KEY environment variable is required to create organizations via the quick setups API.");
|
|
1718
|
-
}
|
|
1607
|
+
const otpBypassKey = requireEnv("OTP_BYPASS_KEY");
|
|
1719
1608
|
const response = await page.request.post(`${NEETO_AUTH_BASE_URL()}/api/v1/internal/quick_setups`, {
|
|
1720
1609
|
headers: {
|
|
1721
|
-
Authorization: `Token token="${
|
|
1610
|
+
Authorization: `Token token="${otpBypassKey}"`,
|
|
1722
1611
|
},
|
|
1723
1612
|
data: {
|
|
1724
1613
|
setup: {
|
|
@@ -1979,12 +1868,6 @@ class OrganizationPage {
|
|
|
1979
1868
|
await this.runLoginStrategy(params, email);
|
|
1980
1869
|
await this.dismissAuthenticatorSetupPromptIfPresent();
|
|
1981
1870
|
};
|
|
1982
|
-
/** @deprecated Use `login({ email, via: "authenticatorApp" })`. */
|
|
1983
|
-
loginViaAuthenticatorApp = email => this.login({ email, via: LOGIN_STRATEGIES.authenticatorApp });
|
|
1984
|
-
/** @deprecated Use `login({ email })`. */
|
|
1985
|
-
loginViaSSO = email => this.login({ email });
|
|
1986
|
-
/** @deprecated Use `login({ email, via: "emailOtp", fetchOtpFromEmail })`. */
|
|
1987
|
-
loginWithFastmailEmail = ({ email, fetchOtpFromEmail, }) => this.login({ email, via: LOGIN_STRATEGIES.emailOtp, fetchOtpFromEmail });
|
|
1988
1871
|
setupProfile = async ({ firstName = faker.person.firstName(), lastName = faker.person.lastName(), country, } = {}) => {
|
|
1989
1872
|
if (IS_DEV_ENV)
|
|
1990
1873
|
return;
|
|
@@ -2121,8 +2004,6 @@ class OrganizationPage {
|
|
|
2121
2004
|
.click();
|
|
2122
2005
|
await expect(countrySelector).toContainText(country);
|
|
2123
2006
|
};
|
|
2124
|
-
/** @deprecated Use `login({ via: "google" })`. */
|
|
2125
|
-
loginViaGoogleAuth = () => this.login({ via: LOGIN_STRATEGIES.google });
|
|
2126
2007
|
completeGoogleAuth = async () => {
|
|
2127
2008
|
const googlePage = new GooglePage({
|
|
2128
2009
|
neetoPlaywrightUtilities: this.neetoPlaywrightUtilities,
|
|
@@ -2172,13 +2053,7 @@ const REVIEW_APP_POLL_INTERVAL = 10_000;
|
|
|
2172
2053
|
const REVIEW_APP_REQUEST_TIMEOUT = 20_000;
|
|
2173
2054
|
// The host is read on each call so that a product importing the package outside
|
|
2174
2055
|
// the review environment never trips the guard.
|
|
2175
|
-
const reviewAppHost = () =>
|
|
2176
|
-
const host = process.env.REVIEW_APP_HOST;
|
|
2177
|
-
if (!host) {
|
|
2178
|
-
throw new Error("REVIEW_APP_HOST must be set when TEST_ENV is review");
|
|
2179
|
-
}
|
|
2180
|
-
return host;
|
|
2181
|
-
};
|
|
2056
|
+
const reviewAppHost = () => requireEnv("REVIEW_APP_HOST");
|
|
2182
2057
|
const isReviewAppServing = async () => {
|
|
2183
2058
|
try {
|
|
2184
2059
|
const response = await fetch(`https://${reviewAppHost()}/?_hs=${Date.now()}`, {
|
|
@@ -2554,8 +2429,8 @@ const EMBED_SELECTORS = {
|
|
|
2554
2429
|
previewTab: "preview-tab",
|
|
2555
2430
|
htmlTab: "html-tab",
|
|
2556
2431
|
buttonTextInput: "button-text-input-field",
|
|
2557
|
-
buttonPositionSelectContainer: "button-position-select-
|
|
2558
|
-
buttonPositionSelectMenu: "button-position-select-menu",
|
|
2432
|
+
buttonPositionSelectContainer: "button-position-select-field-select-container",
|
|
2433
|
+
buttonPositionSelectMenu: "button-position-select-field-select-menu",
|
|
2559
2434
|
buttonColorLabel: "button-color-label",
|
|
2560
2435
|
buttonTextColorLabel: "button-text-color-label",
|
|
2561
2436
|
colorPickerTarget: "color-picker-target",
|
|
@@ -2711,24 +2586,6 @@ const TWILIO_SELECTORS = {
|
|
|
2711
2586
|
authTokenField: "auth-token-input-field",
|
|
2712
2587
|
};
|
|
2713
2588
|
|
|
2714
|
-
const WEBHOOK_SELECTORS = {
|
|
2715
|
-
addNewWebhook: "add-new-webhook-button",
|
|
2716
|
-
endpointInputField: "endpoint-input-field",
|
|
2717
|
-
deliveryResponseCode: "delivery-response-code",
|
|
2718
|
-
deliveryRequestPayload: "delivery-request-payload",
|
|
2719
|
-
addSecretKey: "add-secret-key",
|
|
2720
|
-
newWebhookHeader: "add-new-webhook-pane-header",
|
|
2721
|
-
endpointInputError: "endpoint-input-error",
|
|
2722
|
-
eventsSelectError: "events-select-error",
|
|
2723
|
-
regenerateSecret: "regenerate-secret",
|
|
2724
|
-
deleteSecret: "delete-secret",
|
|
2725
|
-
deliveryRequestHeader: "delivery-request-header",
|
|
2726
|
-
deliveryResponseBody: "delivery-response-body",
|
|
2727
|
-
eventErrorText: "event-error-text",
|
|
2728
|
-
editWebhookButton: "neeto-webhooks-edit-button",
|
|
2729
|
-
deleteWebhookButton: "neeto-webhooks-delete-button",
|
|
2730
|
-
};
|
|
2731
|
-
|
|
2732
2589
|
const ZAPIER_SELECTORS = {
|
|
2733
2590
|
zapTriggerStep: (zapId) => `[data-testid='step-node-${zapId}']`,
|
|
2734
2591
|
zapAccountSubstep: "[data-testid='substep-Account']",
|
|
@@ -2775,53 +2632,6 @@ const LOGIN_SELECTORS = {
|
|
|
2775
2632
|
authenticatorAppLaterButton: "authenticator-app-promo-later-button",
|
|
2776
2633
|
};
|
|
2777
2634
|
|
|
2778
|
-
const MEMBER_SELECTORS = {
|
|
2779
|
-
membersTab: "members-nav-tab",
|
|
2780
|
-
newButton: "ntm-add-member-button",
|
|
2781
|
-
continueButton: "ntm-manage-member-continue-button",
|
|
2782
|
-
submitButton: "ntm-manage-member-submit-button",
|
|
2783
|
-
searchTextField: "ntm-search-members-input",
|
|
2784
|
-
deactivatedAgentsButton: "ntm-members-menubar-deactivated-block",
|
|
2785
|
-
activatedMembersButton: "ntm-members-menubar-active-block",
|
|
2786
|
-
columnCheckBox: "neeto-ui-columns-checkbox",
|
|
2787
|
-
roleLabel: (role) => `${joinHyphenCase(role)}-radio-label`,
|
|
2788
|
-
teamMembersTable: "ntm-members-table",
|
|
2789
|
-
dropDownIcon: "ntm-members-table-row-dropdown-button",
|
|
2790
|
-
editButton: "ntm-edit-member-button",
|
|
2791
|
-
menuBarHeading: "ntm-members-menubar-heading",
|
|
2792
|
-
removeMember: "ntm-deactivate-member-button",
|
|
2793
|
-
columnsButton: "columns-dropdown-button",
|
|
2794
|
-
columnsDropdownContainer: "columns-dropdown-container",
|
|
2795
|
-
emailDropdownItemLabel: "email-checkbox-label",
|
|
2796
|
-
roleDropdownItemLabel: "role-checkbox-label",
|
|
2797
|
-
inviteStatusDropdownItemLabel: "invite-status-checkbox-label",
|
|
2798
|
-
heading: "ntm-manage-members-pane-header",
|
|
2799
|
-
activateButton: "ntm-activate-members-button",
|
|
2800
|
-
deactivateButton: "ntm-deactivate-members-button",
|
|
2801
|
-
rolesButton: "ntm-manage-member-roles-button",
|
|
2802
|
-
statusTag: "ntm-member-status-tag",
|
|
2803
|
-
exportMemberHeading: "export-member-heading",
|
|
2804
|
-
downloadAsRadioItem: (fileType) => `download-as-${fileType}-radio-item`,
|
|
2805
|
-
exportSubmitBtn: "export-submit-button",
|
|
2806
|
-
exportCancelBtn: "export-cancel-button",
|
|
2807
|
-
downloadButton: "download-button",
|
|
2808
|
-
manageAppListChk: "ntm-manage-members-app-list-checkbox",
|
|
2809
|
-
takeActionDropdown: "ntm-members-take-action-dropdown-button",
|
|
2810
|
-
menubarSubLink: (sublink) => `members-${sublink}-block-sub-link`,
|
|
2811
|
-
takeActionStateOption: (option = "") => `ntm-${hyphenate(option)}-members-button`,
|
|
2812
|
-
checkboxLabel: (label) => `${hyphenate(label)}-checkbox-label`,
|
|
2813
|
-
subscriptionPlanTag: "ntm-member-subscription-plan-tag",
|
|
2814
|
-
memberNameCell: (nameOrEmail) => `ntm-member-name-${hyphenate(nameOrEmail)}`,
|
|
2815
|
-
};
|
|
2816
|
-
const MEMBER_FORM_SELECTORS = {
|
|
2817
|
-
emailTextField: "email-select-input-field",
|
|
2818
|
-
firstNameTextField: "ntm-edit-member-first-name-text-field",
|
|
2819
|
-
lastNameTextField: "ntm-edit-member-last-name-text-field",
|
|
2820
|
-
emailInput: "ntm-manage-member-email-input",
|
|
2821
|
-
emailErrorField: "emails-input-error",
|
|
2822
|
-
cancelButton: "ntm-manage-member-cancel-button",
|
|
2823
|
-
};
|
|
2824
|
-
|
|
2825
2635
|
const ONBOARDING_SELECTORS = {
|
|
2826
2636
|
welcomeTitle: "onboarding-welcome-title",
|
|
2827
2637
|
welcomeDescription: "onboarding-welcome-description",
|
|
@@ -2879,33 +2689,6 @@ const PROFILE_SECTION_SELECTORS = {
|
|
|
2879
2689
|
imageRemoveBtn: "profile-image-remove-button",
|
|
2880
2690
|
};
|
|
2881
2691
|
|
|
2882
|
-
const ROLES_SELECTORS = {
|
|
2883
|
-
newButton: "ntm-add-role-button",
|
|
2884
|
-
proceedButton: "ntm-add-role-submit-button",
|
|
2885
|
-
cancelButton: "ntm-add-role-cancel-button",
|
|
2886
|
-
tableHeaderRoleName: "ntm-roles-table-role-header",
|
|
2887
|
-
nameTextField: "ntm-add-role-name-text-field",
|
|
2888
|
-
searchTextField: "ntm-search-roles-input",
|
|
2889
|
-
updateRolePaneHeading: "ntm-add-role-title",
|
|
2890
|
-
updateRoleCancelButton: "ntm-add-role-cancel-button",
|
|
2891
|
-
descriptionTextField: "ntm-add-role-description-text-field",
|
|
2892
|
-
permissionCategoryTitle: "ntm-roles-permission-category-title",
|
|
2893
|
-
headerColumn: "ntm-roles-table-header",
|
|
2894
|
-
dropDownIcon: "ntm-roles-table-header-role-dropdown-button",
|
|
2895
|
-
tableHeaderRoleTitle: "ntm-roles-table-header-role-title",
|
|
2896
|
-
permissionCheckbox: (name) => `ntm-roles-permission-checkbox-${hyphenate(name)}`,
|
|
2897
|
-
editRoleButton: "ntm-roles-table-edit-role-button",
|
|
2898
|
-
deleteRoleButton: "ntm-roles-table-delete-role-button",
|
|
2899
|
-
permissionCard: "ntm-roles-permission-card",
|
|
2900
|
-
searchPermissionsInput: "ntm-search-permissions-input",
|
|
2901
|
-
permissionDescription: "ntm-permission-category-description",
|
|
2902
|
-
rolesEditButton: "ntm-roles-table-edit-role-button",
|
|
2903
|
-
roleCell: (roleName) => `${hyphenate(roleName)}-role-cell`,
|
|
2904
|
-
tablePermissionCheckbox: "ntm-roles-table-permission-checkbox",
|
|
2905
|
-
descriptionInputError: "description-input-error",
|
|
2906
|
-
permissionSubCategoryCard: (index) => `ntm-roles-permission-sub-category-card-${index}`,
|
|
2907
|
-
};
|
|
2908
|
-
|
|
2909
2692
|
const NEETO_SEO_SELECTORS = {
|
|
2910
2693
|
configureButton: "neeto-seo-configure-button",
|
|
2911
2694
|
};
|
|
@@ -2951,37 +2734,6 @@ const TABLE_SELECTORS = {
|
|
|
2951
2734
|
moveColumnBtn: (position) => `move-column-${position}-menu-button`,
|
|
2952
2735
|
};
|
|
2953
2736
|
|
|
2954
|
-
const TAGS_SELECTORS = {
|
|
2955
|
-
newTagButton: "add-new-tag-button",
|
|
2956
|
-
tagNameTextField: "tag-name-text-field",
|
|
2957
|
-
editButton: "tags-edit-button",
|
|
2958
|
-
deleteButton: "tags-delete-button",
|
|
2959
|
-
cancelButton: "neeto-tags-manage-tag-cancel-button",
|
|
2960
|
-
submitButton: "neeto-tags-manage-tag-submit-button",
|
|
2961
|
-
searchTextField: "neeto-tags-search-text-input-field",
|
|
2962
|
-
descriptionTextArea: "tag-description-text-area",
|
|
2963
|
-
addTagButton: "neeto-tags-add-tag-button",
|
|
2964
|
-
tagSearchField: "select-tag-container",
|
|
2965
|
-
deleteTagButton: "tag-close-icon",
|
|
2966
|
-
metaDataCard: "metadata-card",
|
|
2967
|
-
metaDataBlock: "metadata-block",
|
|
2968
|
-
tagContainer: "tag-container",
|
|
2969
|
-
tagsCount: "neeto-tags-filtered-tags-count-text",
|
|
2970
|
-
};
|
|
2971
|
-
const MERGE_TAGS_SELECTORS = {
|
|
2972
|
-
mergeTagsButton: "neeto-tags-merge-tags-button",
|
|
2973
|
-
mergeButton: "neeto-tags-merge-button",
|
|
2974
|
-
sourceSearchTextField: "neeto-tags-merge-source-search-text-input-field",
|
|
2975
|
-
sourceTagsList: "neeto-tags-merge-source-tags-list",
|
|
2976
|
-
destinationTagsList: "neeto-tags-merge-destination-tags-list",
|
|
2977
|
-
destinationSearchTextField: "neeto-tags-merge-destination-search-text-input-field",
|
|
2978
|
-
cancelButton: "neeto-tags-merge-cancel-button",
|
|
2979
|
-
proceedButton: "neeto-tags-merge-proceed-button",
|
|
2980
|
-
disabledTag: ".neeto-ui-cursor-not-allowed",
|
|
2981
|
-
sourceTagRow: "neeto-tags-merge-source-tags",
|
|
2982
|
-
destinationTagRow: "neeto-tags-merge-destination-tags",
|
|
2983
|
-
};
|
|
2984
|
-
|
|
2985
2737
|
const THEMES_SELECTORS = {
|
|
2986
2738
|
colorPickerDropdownContainer: (colorHex) => `${colorHex}-dropdown-container`,
|
|
2987
2739
|
baseThemeStyle: (styleType) => `theme-style-${hyphenate(styleType)}`,
|
|
@@ -3053,10 +2805,9 @@ const generateRandomFile = ({ sizeInKB, fileType, fileName = `sample.${fileType}
|
|
|
3053
2805
|
const file = new File([byteArray], fileName, { type: mimeType });
|
|
3054
2806
|
return { file, fileName };
|
|
3055
2807
|
};
|
|
3056
|
-
const readFileAsBrowserFile = ({ filePath, mimeType, }) => {
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
};
|
|
2808
|
+
const readFileAsBrowserFile = ({ filePath, mimeType, }) => new File([readFileSync(filePath)], path__default.basename(filePath), {
|
|
2809
|
+
type: mimeType,
|
|
2810
|
+
});
|
|
3060
2811
|
|
|
3061
2812
|
const getImagePathAndName = (localImagePath) => {
|
|
3062
2813
|
const imagePath = path__default.join(import.meta.dirname, localImagePath);
|
|
@@ -3096,7 +2847,7 @@ class CustomCommands {
|
|
|
3096
2847
|
this.blockNonEssentialResourceTypes(page),
|
|
3097
2848
|
...ALL_RESOURCES.map(pattern => page.context().route(pattern, route => route.abort())),
|
|
3098
2849
|
]);
|
|
3099
|
-
waitForFloatingMenu = () => expect(
|
|
2850
|
+
waitForFloatingMenu = (customPageContext = this.page) => expect(customPageContext.getByTestId(COMMON_SELECTORS.floatingActionMenuButton)).toBeVisible({ timeout: 30_000 });
|
|
3100
2851
|
interceptMultipleResponses = ({ responseUrl = "", responseStatus = 200, times = 1, baseUrl, customPageContext = this.page, timeout = 35_000, } = {}) => Promise.all([...new Array(times)].map(() => customPageContext.waitForResponse((response) => {
|
|
3101
2852
|
if (response.request().resourceType() === "xhr" &&
|
|
3102
2853
|
response.status() === responseStatus &&
|
|
@@ -3124,38 +2875,7 @@ class CustomCommands {
|
|
|
3124
2875
|
const startTime = Date.now();
|
|
3125
2876
|
return await this.recursiveMethod(callback, condition, timeout, startTime, 1);
|
|
3126
2877
|
};
|
|
3127
|
-
/**
|
|
3128
|
-
* @deprecated Targets the react-toastify-based Toastr from
|
|
3129
|
-
* @bigbinary/neetoui. Use verifyToastV2 instead for apps whose Toastr
|
|
3130
|
-
* comes from @bigbinary/neeto-atoms (sonner-based, e.g. neeto-engage-web).
|
|
3131
|
-
* Kept only for apps still on the legacy neetoui Toastr.
|
|
3132
|
-
*/
|
|
3133
2878
|
verifyToast = async ({ message = "", toastType = "success", closeAfterVerification = true, timeout = 10_000, toastCloseTimeout = 10_000, customPageContext = this.page, } = {}) => {
|
|
3134
|
-
const toastrLocator = customPageContext
|
|
3135
|
-
.locator(COMMON_SELECTORS.neetoUiToastr)
|
|
3136
|
-
.filter({
|
|
3137
|
-
has: customPageContext.getByTestId(COMMON_SELECTORS.toastMessage(toastType)),
|
|
3138
|
-
});
|
|
3139
|
-
const filteredToastrLocator = (isEmpty(message)
|
|
3140
|
-
? toastrLocator
|
|
3141
|
-
: toastrLocator.filter({ hasText: message }))
|
|
3142
|
-
// eslint-disable-next-line playwright/no-nth-methods
|
|
3143
|
-
.first();
|
|
3144
|
-
await expect(filteredToastrLocator).toContainText(isEmpty(message) ? TOAST_DEFAULT_MESSAGE : message, { timeout });
|
|
3145
|
-
if (!closeAfterVerification)
|
|
3146
|
-
return;
|
|
3147
|
-
const toastrCloseButton = filteredToastrLocator.getByTestId(COMMON_SELECTORS.toastCloseButton);
|
|
3148
|
-
const buttonHandle = await toastrCloseButton.elementHandle();
|
|
3149
|
-
if (buttonHandle) {
|
|
3150
|
-
await customPageContext.evaluate(button => {
|
|
3151
|
-
button.dispatchEvent(new Event("click", { bubbles: true }));
|
|
3152
|
-
}, buttonHandle);
|
|
3153
|
-
await expect(toastrCloseButton).toBeHidden({
|
|
3154
|
-
timeout: toastCloseTimeout,
|
|
3155
|
-
});
|
|
3156
|
-
}
|
|
3157
|
-
};
|
|
3158
|
-
verifyToastV2 = async ({ message = "", toastType = "success", closeAfterVerification = true, timeout = 10_000, toastCloseTimeout = 10_000, customPageContext = this.page, } = {}) => {
|
|
3159
2879
|
const toastLocator = customPageContext.getByTestId(COMMON_SELECTORS.toastMessage(toastType));
|
|
3160
2880
|
const filteredToastLocator = (isEmpty(message)
|
|
3161
2881
|
? toastLocator
|
|
@@ -3190,13 +2910,6 @@ class CustomCommands {
|
|
|
3190
2910
|
}
|
|
3191
2911
|
await Promise.all(loaders.map(loader => expect(loader).toHaveCount(0, { timeout: visibilityTimeout })));
|
|
3192
2912
|
};
|
|
3193
|
-
waitForPaneToLoad = async ({ visibilityTimeout = 35_000, customPageContext = this.page, } = {}) => {
|
|
3194
|
-
const pane = customPageContext.getByTestId(COMMON_SELECTORS.paneBody);
|
|
3195
|
-
await expect(pane).toBeVisible({ timeout: visibilityTimeout });
|
|
3196
|
-
await expect(pane.getByTestId(COMMON_SELECTORS.uiSpinner)).toHaveCount(0, {
|
|
3197
|
-
timeout: visibilityTimeout,
|
|
3198
|
-
});
|
|
3199
|
-
};
|
|
3200
2913
|
apiRequest = async ({ url, failOnStatusCode = true, headers: additionalHeaders, body: data, method = "get", params = {}, timeout = 30_000, ...otherOptions }) => {
|
|
3201
2914
|
const csrfToken = this.csrfToken ?? (await this.initializeCsrfToken());
|
|
3202
2915
|
const requestOptions = {
|
|
@@ -3219,54 +2932,28 @@ class CustomCommands {
|
|
|
3219
2932
|
})}`;
|
|
3220
2933
|
return await this.request[method](formattedUrl, requestOptions);
|
|
3221
2934
|
};
|
|
3222
|
-
selectOptionFromDropdown = async ({ label = "nui", value, page = this.page, options = {}, }) => {
|
|
3223
|
-
IS_SHADCN_UI
|
|
3224
|
-
? await this.selectOptionFromDropdownV2({ label, value, page, options })
|
|
3225
|
-
: await this.selectOptionFromDropdownV1({ label, value, page, options });
|
|
3226
|
-
};
|
|
3227
|
-
selectOptionFromDropdownV1 = async ({ label = "nui", value, page = this.page, options = {}, }) => {
|
|
3228
|
-
Object.assign({
|
|
3229
|
-
visibilityTimeout: 2_000,
|
|
3230
|
-
textAssertionTimeout: 1_000,
|
|
3231
|
-
retryTimeout: 20_000,
|
|
3232
|
-
}, options);
|
|
2935
|
+
selectOptionFromDropdown = async ({ label = "nui", value, page = this.page, options: { visibilityTimeout = 5_000, textAssertionTimeout = 5_000, retryTimeout = 60_000, } = {}, }) => {
|
|
3233
2936
|
const menu = page.getByTestId(COMMON_SELECTORS.customDropDownMenu(label));
|
|
3234
|
-
const
|
|
2937
|
+
const optionByName = menu.getByRole("option", { name: value, exact: true });
|
|
2938
|
+
const container = page.getByTestId(COMMON_SELECTORS.customSelectContainer(label));
|
|
3235
2939
|
await expect(async () => {
|
|
3236
2940
|
await container.click();
|
|
3237
|
-
await expect(menu).toBeVisible({
|
|
3238
|
-
timeout: options.visibilityTimeout,
|
|
3239
|
-
});
|
|
2941
|
+
await expect(menu).toBeVisible({ timeout: visibilityTimeout });
|
|
3240
2942
|
await page.keyboard.type(value);
|
|
3241
|
-
|
|
2943
|
+
const option = (await optionByName.count()) > 0
|
|
2944
|
+
? optionByName
|
|
2945
|
+
: menu.getByText(value, { exact: true });
|
|
2946
|
+
await option.click();
|
|
3242
2947
|
await expect(container).toContainText(value, {
|
|
3243
|
-
timeout:
|
|
2948
|
+
timeout: textAssertionTimeout,
|
|
3244
2949
|
});
|
|
3245
|
-
}).toPass({ timeout:
|
|
2950
|
+
}).toPass({ timeout: retryTimeout });
|
|
3246
2951
|
};
|
|
3247
2952
|
waitForSheetOpen = () => expect(this.page.getByTestId(COMMON_SELECTORS.sheetHeader)).toBeInViewport({
|
|
3248
2953
|
timeout: 10_000,
|
|
3249
2954
|
ratio: 1,
|
|
3250
2955
|
});
|
|
3251
2956
|
waitForSheetClose = () => expect(this.page.getByTestId(COMMON_SELECTORS.sheetWrapper)).toHaveCount(0, { timeout: 10_000 });
|
|
3252
|
-
selectOptionFromDropdownV2 = async ({ label = "nui", value, page = this.page, options = {}, }) => {
|
|
3253
|
-
Object.assign({
|
|
3254
|
-
visibilityTimeout: 2_000,
|
|
3255
|
-
textAssertionTimeout: 1_000,
|
|
3256
|
-
retryTimeout: 20_000,
|
|
3257
|
-
}, options);
|
|
3258
|
-
const menu = page.getByTestId(COMMON_SELECTORS.customDropDownMenu(label));
|
|
3259
|
-
const container = page.getByTestId(COMMON_SELECTORS.customSelectContainer(label));
|
|
3260
|
-
await expect(async () => {
|
|
3261
|
-
await container.click();
|
|
3262
|
-
await expect(menu).toBeVisible({ timeout: options.visibilityTimeout });
|
|
3263
|
-
await page.keyboard.type(value);
|
|
3264
|
-
await menu.getByRole("option", { name: value, exact: true }).click();
|
|
3265
|
-
await expect(container).toContainText(value, {
|
|
3266
|
-
timeout: options.textAssertionTimeout,
|
|
3267
|
-
});
|
|
3268
|
-
}).toPass({ timeout: options.retryTimeout });
|
|
3269
|
-
};
|
|
3270
2957
|
verifyFieldValue = values => {
|
|
3271
2958
|
const verifyEachFieldValue = ({ field, value, }) => expect(this.page.getByTestId(field)).toHaveValue(value);
|
|
3272
2959
|
return Array.isArray(values)
|
|
@@ -3320,31 +3007,43 @@ class CustomCommands {
|
|
|
3320
3007
|
await this.hideTooltip(triggerElement, customPageContext);
|
|
3321
3008
|
};
|
|
3322
3009
|
verifyHelpPopover = async ({ triggerElement = this.page.getByTestId(COMMON_SELECTORS.helpPopoverButton), title, content, helpURL, customPageContext = this.page, }) => {
|
|
3323
|
-
const tooltipBox = customPageContext.getByTestId(COMMON_SELECTORS.tooltip);
|
|
3324
3010
|
await triggerElement.hover();
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3011
|
+
const titleLocator = customPageContext.getByTestId(COMMON_SELECTORS.helpPopoverTitle);
|
|
3012
|
+
const descLocator = customPageContext.getByTestId(COMMON_SELECTORS.helpPopoverDesc);
|
|
3013
|
+
const linkLocator = customPageContext.getByTestId(COMMON_SELECTORS.helpPopoverLinkButton);
|
|
3014
|
+
const popoverContentLocator = title
|
|
3015
|
+
? titleLocator
|
|
3016
|
+
: content
|
|
3017
|
+
? descLocator
|
|
3018
|
+
: linkLocator;
|
|
3019
|
+
title && (await expect(titleLocator).toHaveText(title));
|
|
3020
|
+
content && (await expect(descLocator).toContainText(content));
|
|
3328
3021
|
helpURL &&
|
|
3329
3022
|
(await Promise.all([
|
|
3330
3023
|
this.assertHelpURLIsValid(helpURL),
|
|
3331
|
-
expect(
|
|
3024
|
+
expect(linkLocator).toHaveAttribute("href", new RegExp(helpURL, "i")),
|
|
3332
3025
|
]));
|
|
3333
|
-
await this.
|
|
3026
|
+
await this.hidePopoverContent(popoverContentLocator, customPageContext);
|
|
3334
3027
|
};
|
|
3335
|
-
assertHelpURLIsValid = async (
|
|
3336
|
-
const response = await this.request.get(helpURL);
|
|
3028
|
+
assertHelpURLIsValid = (helpURL) => expect(async () => {
|
|
3029
|
+
const response = await this.request.get(helpURL, { timeout: 15_000 });
|
|
3337
3030
|
await expect(response).toBeOK();
|
|
3338
|
-
};
|
|
3031
|
+
}).toPass({ timeout: 45_000, intervals: [3_000] });
|
|
3339
3032
|
verifyHelpText = async (helpURL) => {
|
|
3340
3033
|
const isNoDataTitleHidden = await this.page
|
|
3341
|
-
.getByTestId(COMMON_SELECTORS.
|
|
3034
|
+
.getByTestId(COMMON_SELECTORS.noDataTitleV2)
|
|
3342
3035
|
.isHidden();
|
|
3343
3036
|
if (isNoDataTitleHidden)
|
|
3344
3037
|
return;
|
|
3038
|
+
const helpLink = this.page
|
|
3039
|
+
.getByTestId(COMMON_SELECTORS.noDataHelpTextV2)
|
|
3040
|
+
.getByRole("link")
|
|
3041
|
+
.or(this.page
|
|
3042
|
+
.getByTestId(COMMON_SELECTORS.noDataDescriptionV2)
|
|
3043
|
+
.getByRole("link"));
|
|
3345
3044
|
await Promise.all([
|
|
3346
3045
|
this.assertHelpURLIsValid(helpURL),
|
|
3347
|
-
expect(
|
|
3046
|
+
expect(helpLink).toHaveAttribute("href", new RegExp(helpURL, "i")),
|
|
3348
3047
|
]);
|
|
3349
3048
|
};
|
|
3350
3049
|
verifySearchTermBlock = async (searchTerm) => {
|
|
@@ -3363,7 +3062,7 @@ class CustomCommands {
|
|
|
3363
3062
|
}
|
|
3364
3063
|
};
|
|
3365
3064
|
saveChanges = ({ isPane = false, customPageContext = this.page, closeAfterVerification = true, toastMessage = "", } = {}) => {
|
|
3366
|
-
const pane = customPageContext.getByTestId(COMMON_SELECTORS.
|
|
3065
|
+
const pane = customPageContext.getByTestId(COMMON_SELECTORS.sheetWrapper);
|
|
3367
3066
|
const baseLocator = isPane ? pane : customPageContext;
|
|
3368
3067
|
return Promise.all([
|
|
3369
3068
|
this.clickButtonAndAwaitLoad({
|
|
@@ -3396,13 +3095,16 @@ class CustomCommands {
|
|
|
3396
3095
|
await expect(async () => {
|
|
3397
3096
|
for (const [moveX, moveY] of moves) {
|
|
3398
3097
|
await customPageContext.mouse.move(moveX, moveY);
|
|
3399
|
-
|
|
3400
|
-
if (tooltipCount === 0)
|
|
3098
|
+
if ((await tooltip.count()) === 0)
|
|
3401
3099
|
break;
|
|
3402
3100
|
}
|
|
3403
3101
|
await expect(tooltip).toHaveCount(0);
|
|
3404
3102
|
}).toPass({ timeout: 30_000 });
|
|
3405
3103
|
};
|
|
3104
|
+
hidePopoverContent = async (contentLocator, customPageContext = this.page) => {
|
|
3105
|
+
await customPageContext.mouse.move(0, 0);
|
|
3106
|
+
await expect(contentLocator).toBeHidden();
|
|
3107
|
+
};
|
|
3406
3108
|
verifyBreadcrumbs = async (titlesAndRoutes) => {
|
|
3407
3109
|
const header = this.page.getByTestId(COMMON_SELECTORS.breadcrumbHeader);
|
|
3408
3110
|
const titles = pluck("title", titlesAndRoutes);
|
|
@@ -3410,23 +3112,25 @@ class CustomCommands {
|
|
|
3410
3112
|
await Promise.all([
|
|
3411
3113
|
expect(header).toContainText(titles),
|
|
3412
3114
|
expect(header).toHaveCount(titlesAndRoutes.length),
|
|
3413
|
-
expect(header.getByRole("link", { name: last?.title, exact: true })).
|
|
3115
|
+
expect(header.getByRole("link", { name: last?.title, exact: true })).toHaveAttribute("aria-disabled", "true"),
|
|
3414
3116
|
...links.map(({ title, route }) => expect(header.getByRole("link", { name: title, exact: true })).toHaveAttribute("href", route)),
|
|
3415
3117
|
]);
|
|
3416
3118
|
};
|
|
3417
3119
|
uploadFileViaDispatchV2 = async ({ droppableZone = this.page.getByTestId(COMMON_SELECTORS.fileUploadBody), dispatchEvent = "drop", timeout = 45_000, file, }) => {
|
|
3418
3120
|
const serializedFile = await serializeFileForBrowser(file);
|
|
3419
|
-
const dataTransfer = await
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3121
|
+
const dataTransfer = await droppableZone.evaluateHandle((_, { name, type, buffer, lastModified }) => {
|
|
3122
|
+
const uint8Array = new Uint8Array(buffer);
|
|
3123
|
+
const file = new File([uint8Array], name, { type, lastModified });
|
|
3124
|
+
const dataTransfer = new DataTransfer();
|
|
3125
|
+
dataTransfer.items.add(file);
|
|
3126
|
+
return dataTransfer;
|
|
3127
|
+
}, serializedFile, { timeout });
|
|
3128
|
+
try {
|
|
3129
|
+
await droppableZone.dispatchEvent(dispatchEvent, { dataTransfer });
|
|
3130
|
+
}
|
|
3131
|
+
finally {
|
|
3132
|
+
await dataTransfer.dispose();
|
|
3133
|
+
}
|
|
3430
3134
|
};
|
|
3431
3135
|
verifyUnsavedChangesModal = async (shouldLeavePage = false) => {
|
|
3432
3136
|
const alertBox = this.page.getByTestId(COMMON_SELECTORS.alertBox);
|
|
@@ -3445,7 +3149,8 @@ class CustomCommands {
|
|
|
3445
3149
|
await expect(alertBox).toBeHidden();
|
|
3446
3150
|
};
|
|
3447
3151
|
setSliderValue = async ({ parentLocator = this.page, valueAsPercent, startFromCenter = false, }) => {
|
|
3448
|
-
const sliderLocator = parentLocator.locator(COMMON_SELECTORS.
|
|
3152
|
+
const sliderLocator = parentLocator.locator(COMMON_SELECTORS.slider);
|
|
3153
|
+
await expect(sliderLocator).toBeVisible();
|
|
3449
3154
|
await sliderLocator.evaluate(node => node.scrollIntoView({ behavior: "instant", block: "center" }));
|
|
3450
3155
|
const sliderBoundingBox = await sliderLocator.boundingBox();
|
|
3451
3156
|
let targetX = sliderBoundingBox.width * valueAsPercent;
|
|
@@ -3484,9 +3189,13 @@ class CustomCommands {
|
|
|
3484
3189
|
});
|
|
3485
3190
|
};
|
|
3486
3191
|
toggleElement = ({ locator, shouldBeChecked = true }) => expect(async () => {
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3192
|
+
// Callers often pass an atoms Switch's wrapper (`<prefix>-switch`); the checkable control is the nested `nui-switch-item`.
|
|
3193
|
+
const switchItem = locator.getByTestId(COMMON_SELECTORS.switchLabel);
|
|
3194
|
+
const target =
|
|
3195
|
+
// eslint-disable-next-line playwright/no-nth-methods
|
|
3196
|
+
(await switchItem.count()) > 0 ? switchItem.first() : locator;
|
|
3197
|
+
(await target.isChecked()) !== shouldBeChecked && (await target.click());
|
|
3198
|
+
await expect(target).toBeChecked({ checked: shouldBeChecked });
|
|
3490
3199
|
}).toPass({ timeout: 15_000 });
|
|
3491
3200
|
// Polls the editor's own state, which is what the next key press acts on.
|
|
3492
3201
|
// The DOM selection is not proof: ProseMirror re-applies its stored
|
|
@@ -3519,127 +3228,26 @@ class CustomCommands {
|
|
|
3519
3228
|
await this.page.keyboard.press("Enter");
|
|
3520
3229
|
};
|
|
3521
3230
|
}
|
|
3522
|
-
class CustomCommandsV2 extends CustomCommands {
|
|
3523
|
-
selectOptionFromDropdown = async ({ label = "nui", value, page = this.page, options = {}, }) => {
|
|
3524
|
-
Object.assign({
|
|
3525
|
-
visibilityTimeout: 2_000,
|
|
3526
|
-
textAssertionTimeout: 1_000,
|
|
3527
|
-
retryTimeout: 20_000,
|
|
3528
|
-
}, options);
|
|
3529
|
-
const menu = page.getByTestId(COMMON_SELECTORS.customDropDownMenu(label));
|
|
3530
|
-
const container = page.getByTestId(COMMON_SELECTORS.customSelectContainer(label));
|
|
3531
|
-
await expect(async () => {
|
|
3532
|
-
await container.click();
|
|
3533
|
-
await expect(menu).toBeVisible({
|
|
3534
|
-
timeout: options.visibilityTimeout,
|
|
3535
|
-
});
|
|
3536
|
-
await page.keyboard.type(value);
|
|
3537
|
-
await menu.getByText(value, { exact: true }).click();
|
|
3538
|
-
await expect(container).toContainText(value, {
|
|
3539
|
-
timeout: options.textAssertionTimeout,
|
|
3540
|
-
});
|
|
3541
|
-
}).toPass({ timeout: options.retryTimeout });
|
|
3542
|
-
};
|
|
3543
|
-
verifyHelpPopover = async ({ triggerElement = this.page.getByTestId(COMMON_SELECTORS.helpPopoverButton), title, content, helpURL, customPageContext = this.page, }) => {
|
|
3544
|
-
await triggerElement.hover();
|
|
3545
|
-
const getPopoverContentLocator = () => {
|
|
3546
|
-
if (title) {
|
|
3547
|
-
return customPageContext.getByTestId(COMMON_SELECTORS.helpPopoverTitle);
|
|
3548
|
-
}
|
|
3549
|
-
if (content) {
|
|
3550
|
-
return customPageContext.getByTestId(COMMON_SELECTORS.helpPopoverDesc);
|
|
3551
|
-
}
|
|
3552
|
-
return customPageContext.getByTestId(COMMON_SELECTORS.helpPopoverLinkButton);
|
|
3553
|
-
};
|
|
3554
|
-
const popoverContentLocator = getPopoverContentLocator();
|
|
3555
|
-
title && (await expect(popoverContentLocator).toHaveText(title));
|
|
3556
|
-
content &&
|
|
3557
|
-
(await expect(customPageContext.getByTestId(COMMON_SELECTORS.helpPopoverDesc)).toContainText(content));
|
|
3558
|
-
helpURL &&
|
|
3559
|
-
(await Promise.all([
|
|
3560
|
-
this.assertHelpURLIsValid(helpURL),
|
|
3561
|
-
expect(customPageContext.getByTestId(COMMON_SELECTORS.helpPopoverLinkButton)).toHaveAttribute("href", new RegExp(helpURL, "i")),
|
|
3562
|
-
]));
|
|
3563
|
-
await this.hidePopoverContent(triggerElement, popoverContentLocator, customPageContext);
|
|
3564
|
-
};
|
|
3565
|
-
verifyHelpText = async (helpURL) => {
|
|
3566
|
-
const isNoDataTitleHidden = await this.page
|
|
3567
|
-
.getByTestId(COMMON_SELECTORS.noDataTitleV2)
|
|
3568
|
-
.isHidden();
|
|
3569
|
-
if (isNoDataTitleHidden)
|
|
3570
|
-
return;
|
|
3571
|
-
const helpLink = this.page
|
|
3572
|
-
.getByTestId(COMMON_SELECTORS.noDataHelpTextV2)
|
|
3573
|
-
.getByRole("link")
|
|
3574
|
-
.or(this.page
|
|
3575
|
-
.getByTestId(COMMON_SELECTORS.noDataDescriptionV2)
|
|
3576
|
-
.getByRole("link"));
|
|
3577
|
-
await Promise.all([
|
|
3578
|
-
this.assertHelpURLIsValid(helpURL),
|
|
3579
|
-
expect(helpLink).toHaveAttribute("href", new RegExp(helpURL, "i")),
|
|
3580
|
-
]);
|
|
3581
|
-
};
|
|
3582
|
-
verifyBreadcrumbs = async (titlesAndRoutes) => {
|
|
3583
|
-
const header = this.page.getByTestId(COMMON_SELECTORS.breadcrumbHeader);
|
|
3584
|
-
const titles = pluck("title", titlesAndRoutes);
|
|
3585
|
-
const [last, ...links] = titlesAndRoutes.toReversed();
|
|
3586
|
-
await Promise.all([
|
|
3587
|
-
expect(header).toContainText(titles),
|
|
3588
|
-
expect(header).toHaveCount(titlesAndRoutes.length),
|
|
3589
|
-
expect(header.getByRole("link", { name: last?.title, exact: true })).toHaveAttribute("aria-disabled", "true"),
|
|
3590
|
-
...links.map(({ title, route }) => expect(header.getByRole("link", { name: title, exact: true })).toHaveAttribute("href", route)),
|
|
3591
|
-
]);
|
|
3592
|
-
};
|
|
3593
|
-
hidePopoverContent = async (triggerElement, contentLocator, customPageContext = this.page) => {
|
|
3594
|
-
const boundingBox = await triggerElement.boundingBox();
|
|
3595
|
-
if (!boundingBox) {
|
|
3596
|
-
throw new Error("Trigger element bounding box not found");
|
|
3597
|
-
}
|
|
3598
|
-
const { x, y, width, height } = boundingBox;
|
|
3599
|
-
const moves = [
|
|
3600
|
-
[x + width + 10, y],
|
|
3601
|
-
[x, y + height + 10],
|
|
3602
|
-
[x - 10, y],
|
|
3603
|
-
[x, y - 10],
|
|
3604
|
-
];
|
|
3605
|
-
await expect(async () => {
|
|
3606
|
-
for (const [moveX, moveY] of moves) {
|
|
3607
|
-
await customPageContext.mouse.move(moveX, moveY);
|
|
3608
|
-
const isHidden = await contentLocator.isHidden();
|
|
3609
|
-
if (isHidden)
|
|
3610
|
-
break;
|
|
3611
|
-
}
|
|
3612
|
-
await expect(contentLocator).toBeHidden();
|
|
3613
|
-
}).toPass({ timeout: 30_000 });
|
|
3614
|
-
};
|
|
3615
|
-
}
|
|
3616
3231
|
|
|
3617
3232
|
class Health {
|
|
3618
3233
|
page;
|
|
3619
3234
|
neetoPlaywrightUtilities;
|
|
3620
|
-
email
|
|
3235
|
+
email;
|
|
3621
3236
|
loginPage;
|
|
3622
3237
|
constructor(page, neetoPlaywrightUtilities) {
|
|
3623
3238
|
this.page = page;
|
|
3624
3239
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
throw new Error("One or more required env variables are missing: PLAYWRIGHT_PRODUCTION_EMAIL, PLAYWRIGHT_PRODUCTION_2FA_SECRET_KEY");
|
|
3628
|
-
}
|
|
3240
|
+
const env = requireEnv("PLAYWRIGHT_PRODUCTION_EMAIL", "PLAYWRIGHT_PRODUCTION_2FA_SECRET_KEY");
|
|
3241
|
+
this.email = env.PLAYWRIGHT_PRODUCTION_EMAIL;
|
|
3629
3242
|
this.loginPage = new OrganizationPage(page, neetoPlaywrightUtilities);
|
|
3630
3243
|
}
|
|
3631
|
-
getProductSpecificRolesRoute = () => {
|
|
3632
|
-
const { hostname } = new URL(process.env.PLAYWRIGHT_PRODUCTION_BASE_URL);
|
|
3633
|
-
const domain = hostname
|
|
3634
|
-
.split(".")
|
|
3635
|
-
.find(domain => domain.startsWith("neeto"));
|
|
3636
|
-
const product = domain.replace(/^neeto/, "").toLowerCase();
|
|
3637
|
-
return PRODUCT_ROLES_ROUTE_MAP[product] ?? ROUTES.adminPanel.roles;
|
|
3638
|
-
};
|
|
3639
3244
|
loginToApp = async (route = ROUTES.adminPanel.index) => {
|
|
3640
3245
|
await this.page.goto(route);
|
|
3641
3246
|
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
3642
|
-
await this.loginPage.
|
|
3247
|
+
await this.loginPage.login({
|
|
3248
|
+
email: this.email,
|
|
3249
|
+
via: "authenticatorApp",
|
|
3250
|
+
});
|
|
3643
3251
|
};
|
|
3644
3252
|
verifyAppUI = async () => {
|
|
3645
3253
|
await this.neetoPlaywrightUtilities.waitForFloatingMenu();
|
|
@@ -3649,82 +3257,10 @@ class Health {
|
|
|
3649
3257
|
verifyAppIsLive = async (customSteps) => {
|
|
3650
3258
|
await test.step("1: Login to the application", () => this.loginToApp());
|
|
3651
3259
|
await test.step("2: Verify application UI", this.verifyAppUI);
|
|
3652
|
-
await test.step("3: Navigate to roles page", async () => {
|
|
3653
|
-
await this.page.goto(this.getProductSpecificRolesRoute());
|
|
3654
|
-
await this.neetoPlaywrightUtilities.waitForFloatingMenu();
|
|
3655
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
3656
|
-
});
|
|
3657
|
-
await test.step("4: Verify adding & removing roles", async () => {
|
|
3658
|
-
const roleName = faker.string.alphanumeric(8);
|
|
3659
|
-
await this.page.getByTestId(ROLES_SELECTORS.newButton).click();
|
|
3660
|
-
await this.page.getByTestId(ROLES_SELECTORS.nameTextField).fill(roleName);
|
|
3661
|
-
await this.neetoPlaywrightUtilities.clickButtonAndAwaitLoad({
|
|
3662
|
-
locator: this.page.getByTestId(ROLES_SELECTORS.proceedButton),
|
|
3663
|
-
});
|
|
3664
|
-
await this.neetoPlaywrightUtilities.verifyToast();
|
|
3665
|
-
const roleHeaderDropDown = this.page
|
|
3666
|
-
.getByTestId(ROLES_SELECTORS.tableHeaderRoleName)
|
|
3667
|
-
.filter({ hasText: roleName })
|
|
3668
|
-
.getByTestId(ROLES_SELECTORS.dropDownIcon);
|
|
3669
|
-
await roleHeaderDropDown.click();
|
|
3670
|
-
await this.page.getByTestId(ROLES_SELECTORS.deleteRoleButton).click();
|
|
3671
|
-
await this.neetoPlaywrightUtilities.clickButtonAndAwaitLoad({
|
|
3672
|
-
locator: this.page.getByTestId(COMMON_SELECTORS.alertModalSubmitButton),
|
|
3673
|
-
});
|
|
3674
|
-
await this.neetoPlaywrightUtilities.verifyToast();
|
|
3675
|
-
await expect(roleHeaderDropDown).toBeHidden({ timeout: 10_000 });
|
|
3676
|
-
});
|
|
3677
3260
|
await customSteps?.();
|
|
3678
3261
|
};
|
|
3679
3262
|
}
|
|
3680
3263
|
|
|
3681
|
-
class FastmailApi {
|
|
3682
|
-
neetoPlaywrightUtilities;
|
|
3683
|
-
headers;
|
|
3684
|
-
accountId;
|
|
3685
|
-
constructor(neetoPlaywrightUtilities) {
|
|
3686
|
-
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
3687
|
-
this.headers = {
|
|
3688
|
-
"Content-Type": "application/json",
|
|
3689
|
-
Authorization: `Bearer ${process.env.NEETO_AUTOMATION_FASTMAIL_API_KEY}`,
|
|
3690
|
-
};
|
|
3691
|
-
}
|
|
3692
|
-
assertApiKey = () => {
|
|
3693
|
-
if (!process.env.NEETO_AUTOMATION_FASTMAIL_API_KEY)
|
|
3694
|
-
throw new Error("Please set the environment variable NEETO_AUTOMATION_FASTMAIL_API_KEY. Credentials can be found in the Automation Credentials vault in the BigBinary 1Password account.");
|
|
3695
|
-
};
|
|
3696
|
-
authorizeAndSetAccountId = async () => {
|
|
3697
|
-
if (IS_DEV_ENV)
|
|
3698
|
-
return;
|
|
3699
|
-
this.assertApiKey();
|
|
3700
|
-
const response = await this.neetoPlaywrightUtilities.apiRequest({
|
|
3701
|
-
method: "get",
|
|
3702
|
-
url: "https://api.fastmail.com/.well-known/jmap",
|
|
3703
|
-
headers: this.headers,
|
|
3704
|
-
});
|
|
3705
|
-
const { primaryAccounts: { "urn:ietf:params:jmap:mail": accountId }, } = await response.json();
|
|
3706
|
-
this.accountId = accountId;
|
|
3707
|
-
};
|
|
3708
|
-
apiRequest = async (method, body) => {
|
|
3709
|
-
this.assertApiKey();
|
|
3710
|
-
const response = await this.neetoPlaywrightUtilities.apiRequest({
|
|
3711
|
-
method: "post",
|
|
3712
|
-
url: "https://api.fastmail.com/jmap/api/",
|
|
3713
|
-
headers: this.headers,
|
|
3714
|
-
timeout: 2_000,
|
|
3715
|
-
data: {
|
|
3716
|
-
using: ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail"],
|
|
3717
|
-
methodCalls: [[method, { accountId: this.accountId, ...body }, "0"]],
|
|
3718
|
-
},
|
|
3719
|
-
});
|
|
3720
|
-
return response?.json();
|
|
3721
|
-
};
|
|
3722
|
-
fetchAttachments = (blobId, attachmentName) => this.neetoPlaywrightUtilities.apiRequest({
|
|
3723
|
-
url: `https://www.fastmailusercontent.com/jmap/download/${this.accountId}/${blobId}/${attachmentName}`,
|
|
3724
|
-
headers: this.headers,
|
|
3725
|
-
});
|
|
3726
|
-
}
|
|
3727
|
-
|
|
3728
3264
|
const basicHTMLContent = (content) => `
|
|
3729
3265
|
<!DOCTYPE html>
|
|
3730
3266
|
<html lang="en">
|
|
@@ -3940,39 +3476,13 @@ const toMailpitSearchTerm = (value) => `"${value.replace(/"/g, "")}"`;
|
|
|
3940
3476
|
const mailpitTimeoutError = (messageSearchCriteria, receivedAfter, expectedEmailCount) => new Error(`Timed out waiting for matching message. Searched Mailpit for ${JSON.stringify(messageSearchCriteria)} received after ${receivedAfter.toISOString()}, expecting at least ${expectedEmailCount}.`);
|
|
3941
3477
|
class MailerUtils {
|
|
3942
3478
|
neetoPlaywrightUtilities;
|
|
3943
|
-
accountId;
|
|
3944
|
-
fastmailApi;
|
|
3945
3479
|
mailpitApi;
|
|
3946
3480
|
railsEmailUtils;
|
|
3947
3481
|
constructor(neetoPlaywrightUtilities) {
|
|
3948
3482
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
3949
|
-
this.fastmailApi = new FastmailApi(neetoPlaywrightUtilities);
|
|
3950
3483
|
this.mailpitApi = new MailpitApi(neetoPlaywrightUtilities);
|
|
3951
3484
|
this.railsEmailUtils = new RailsEmailUtils(neetoPlaywrightUtilities);
|
|
3952
3485
|
}
|
|
3953
|
-
queryEmail = async (messageSearchCriteria, { receivedAfter = dateTimeOneHourAgo(), page = 1, itemsPerPage = 50, }) => {
|
|
3954
|
-
const limit = itemsPerPage;
|
|
3955
|
-
const position = (page - 1) * itemsPerPage;
|
|
3956
|
-
if (itemsPerPage > 100 || itemsPerPage < 1)
|
|
3957
|
-
throw new Error("itemsPerPage should be in the range of 1-100");
|
|
3958
|
-
const body = {
|
|
3959
|
-
filter: { ...messageSearchCriteria, after: receivedAfter.toISOString() },
|
|
3960
|
-
sort: [{ property: "receivedAt", isAscending: false }],
|
|
3961
|
-
limit,
|
|
3962
|
-
position,
|
|
3963
|
-
};
|
|
3964
|
-
let ids = [], total = 0;
|
|
3965
|
-
try {
|
|
3966
|
-
({
|
|
3967
|
-
methodResponses: [[, { ids, total }]],
|
|
3968
|
-
} = await this.fastmailApi.apiRequest("Email/query", body));
|
|
3969
|
-
}
|
|
3970
|
-
catch {
|
|
3971
|
-
ids = [];
|
|
3972
|
-
total = 0;
|
|
3973
|
-
}
|
|
3974
|
-
return { ids, total };
|
|
3975
|
-
};
|
|
3976
3486
|
buildMessageBodies = (emailBody, { stripInjectedLinks = false } = {}) => {
|
|
3977
3487
|
const LINK_REGEX = /(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])/g;
|
|
3978
3488
|
const CODE_REGEX = /(?<![#/])\b\d{4,}\b/g;
|
|
@@ -3995,71 +3505,10 @@ class MailerUtils {
|
|
|
3995
3505
|
const text = { body: textBody, ...contentRecognitions };
|
|
3996
3506
|
return { html, text };
|
|
3997
3507
|
};
|
|
3998
|
-
|
|
3999
|
-
const
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
fetchHTMLBodyValues: true,
|
|
4003
|
-
};
|
|
4004
|
-
const { methodResponses: [[, { list }]], } = await this.fastmailApi.apiRequest("Email/get", messageDetailsBody);
|
|
4005
|
-
const formattedList = list.map((listItem) => {
|
|
4006
|
-
const { id, from, to, bodyValues, cc, bcc, replyTo, receivedAt, subject, messageId, attachments, blobId, } = listItem;
|
|
4007
|
-
const emailBody = Object.values(pluck("value", bodyValues)).join(" ");
|
|
4008
|
-
const { html, text } = this.buildMessageBodies(emailBody, {
|
|
4009
|
-
stripInjectedLinks: true,
|
|
4010
|
-
});
|
|
4011
|
-
return {
|
|
4012
|
-
html,
|
|
4013
|
-
text,
|
|
4014
|
-
id,
|
|
4015
|
-
from,
|
|
4016
|
-
to,
|
|
4017
|
-
cc,
|
|
4018
|
-
bcc,
|
|
4019
|
-
replyTo,
|
|
4020
|
-
received: new Date(receivedAt),
|
|
4021
|
-
subject,
|
|
4022
|
-
attachments,
|
|
4023
|
-
blobId,
|
|
4024
|
-
...(messageId?.[0] && { messageId: messageId[0] }),
|
|
4025
|
-
};
|
|
4026
|
-
});
|
|
4027
|
-
return formattedList;
|
|
4028
|
-
};
|
|
4029
|
-
listMessages = async (messageSearchCriteria = {}, listMessagesFilterCriteria = {}) => {
|
|
4030
|
-
if (IS_DEV_ENV) {
|
|
4031
|
-
return this.railsEmailUtils.listMessages(messageSearchCriteria, listMessagesFilterCriteria);
|
|
4032
|
-
}
|
|
4033
|
-
const { ids } = await this.queryEmail(messageSearchCriteria, listMessagesFilterCriteria);
|
|
4034
|
-
return this.getEmails(ids);
|
|
4035
|
-
};
|
|
4036
|
-
getEmailIds = async (messageSearchCriteria = {}, { timeout = 10_000, receivedAfter = dateTimeOneHourAgo(), expectedEmailCount = 1, } = {}, shouldThrowErrorOnTimeout = true) => {
|
|
4037
|
-
const ids = (await this.neetoPlaywrightUtilities.executeRecursively({
|
|
4038
|
-
callback: async () => {
|
|
4039
|
-
const { ids } = await this.queryEmail(messageSearchCriteria, {
|
|
4040
|
-
receivedAfter,
|
|
4041
|
-
});
|
|
4042
|
-
return ids;
|
|
4043
|
-
},
|
|
4044
|
-
condition: async () => {
|
|
4045
|
-
const { ids } = await this.queryEmail(messageSearchCriteria, {
|
|
4046
|
-
receivedAfter,
|
|
4047
|
-
});
|
|
4048
|
-
return ids.length >= expectedEmailCount;
|
|
4049
|
-
},
|
|
4050
|
-
timeout,
|
|
4051
|
-
}));
|
|
4052
|
-
if (!ids) {
|
|
4053
|
-
if (shouldThrowErrorOnTimeout)
|
|
4054
|
-
throw new Error("Timed out waiting for matching message");
|
|
4055
|
-
return [];
|
|
4056
|
-
}
|
|
4057
|
-
return ids;
|
|
4058
|
-
};
|
|
4059
|
-
matchesCriteria(email, criteria) {
|
|
4060
|
-
const { to, from, subject, body } = criteria;
|
|
4061
|
-
if (to && !email.to.some(r => r.email.toLowerCase() === to.toLowerCase())) {
|
|
4062
|
-
return false;
|
|
3508
|
+
matchesCriteria(email, criteria) {
|
|
3509
|
+
const { to, from, subject, body } = criteria;
|
|
3510
|
+
if (to && !email.to.some(r => r.email.toLowerCase() === to.toLowerCase())) {
|
|
3511
|
+
return false;
|
|
4063
3512
|
}
|
|
4064
3513
|
if (from &&
|
|
4065
3514
|
!email.from.some(s => s.email.toLowerCase() === from.toLowerCase())) {
|
|
@@ -4076,93 +3525,6 @@ class MailerUtils {
|
|
|
4076
3525
|
}
|
|
4077
3526
|
return true;
|
|
4078
3527
|
}
|
|
4079
|
-
findMessage = async (messageSearchCriteria = {}, { timeout = 10_000, receivedAfter = dateTimeOneHourAgo(), expectedEmailCount = 1, } = {}, shouldThrowErrorOnTimeout = true) => {
|
|
4080
|
-
if (IS_DEV_ENV) {
|
|
4081
|
-
return this.railsEmailUtils.findMessage(messageSearchCriteria, { receivedAfter, expectedEmailCount, timeout: timeout / 3 }, shouldThrowErrorOnTimeout);
|
|
4082
|
-
}
|
|
4083
|
-
const ids = await this.getEmailIds(messageSearchCriteria, { expectedEmailCount, receivedAfter, timeout }, shouldThrowErrorOnTimeout);
|
|
4084
|
-
const emails = await this.getEmails(ids);
|
|
4085
|
-
const filteredEmails = emails.filter(email => this.matchesCriteria(email, messageSearchCriteria));
|
|
4086
|
-
return filteredEmails[0] || {};
|
|
4087
|
-
};
|
|
4088
|
-
findOtpFromEmail = async ({ email, subjectSubstring = OTP_EMAIL_PATTERN, timeout = 2 * 60 * 1000, receivedAfter = new Date(Date.now() - 3000), expectedEmailCount = 1, }) => {
|
|
4089
|
-
if (IS_DEV_ENV) {
|
|
4090
|
-
return this.railsEmailUtils.findOtpFromEmail({
|
|
4091
|
-
email,
|
|
4092
|
-
subjectSubstring,
|
|
4093
|
-
receivedAfter,
|
|
4094
|
-
expectedEmailCount,
|
|
4095
|
-
timeout: timeout / 3,
|
|
4096
|
-
});
|
|
4097
|
-
}
|
|
4098
|
-
if (!this.accountId) {
|
|
4099
|
-
await this.fastmailApi.authorizeAndSetAccountId();
|
|
4100
|
-
}
|
|
4101
|
-
const { html: { codes }, } = await this.findMessage({ to: email, subject: subjectSubstring }, { timeout, receivedAfter, expectedEmailCount });
|
|
4102
|
-
return codes?.[0];
|
|
4103
|
-
};
|
|
4104
|
-
generateRandomEmail = () => faker.internet.email({ provider: process.env.FASTMAIL_DOMAIN_NAME });
|
|
4105
|
-
getLatestMessageId = async (subject, { timeout = 10_000, receivedAfter = dateTimeOneHourAgo(), } = {}) => {
|
|
4106
|
-
if (IS_DEV_ENV) {
|
|
4107
|
-
return this.railsEmailUtils.getLatestMessageId(subject, {
|
|
4108
|
-
timeout: timeout / 3,
|
|
4109
|
-
receivedAfter,
|
|
4110
|
-
});
|
|
4111
|
-
}
|
|
4112
|
-
if (!this.accountId) {
|
|
4113
|
-
await this.fastmailApi.authorizeAndSetAccountId();
|
|
4114
|
-
}
|
|
4115
|
-
const messageId = (await this.neetoPlaywrightUtilities.executeRecursively({
|
|
4116
|
-
callback: async () => {
|
|
4117
|
-
const { methodResponses: [[, { ids }]], } = await this.fastmailApi.apiRequest("Email/query", {
|
|
4118
|
-
filter: { subject, after: receivedAfter.toISOString() },
|
|
4119
|
-
sort: [{ property: "receivedAt", isAscending: false }],
|
|
4120
|
-
limit: 1,
|
|
4121
|
-
});
|
|
4122
|
-
const emailId = ids?.[0];
|
|
4123
|
-
if (!emailId)
|
|
4124
|
-
return null;
|
|
4125
|
-
const { methodResponses: [[, { list }]], } = await this.fastmailApi.apiRequest("Email/get", {
|
|
4126
|
-
ids: [emailId],
|
|
4127
|
-
properties: ["messageId"],
|
|
4128
|
-
});
|
|
4129
|
-
const rawMessageId = list?.[0]?.messageId?.[0];
|
|
4130
|
-
if (!rawMessageId)
|
|
4131
|
-
return null;
|
|
4132
|
-
return rawMessageId.replace(/^<|>$/g, "");
|
|
4133
|
-
},
|
|
4134
|
-
condition: async () => {
|
|
4135
|
-
const { methodResponses: [[, { ids }]], } = await this.fastmailApi.apiRequest("Email/query", {
|
|
4136
|
-
filter: { subject, after: receivedAfter.toISOString() },
|
|
4137
|
-
limit: 1,
|
|
4138
|
-
});
|
|
4139
|
-
return ids.length >= 1;
|
|
4140
|
-
},
|
|
4141
|
-
timeout,
|
|
4142
|
-
}));
|
|
4143
|
-
return messageId || undefined;
|
|
4144
|
-
};
|
|
4145
|
-
getEmailAttachment = async ({ name, type }, messageSearchCriteria = {}, { timeout = 10_000, receivedAfter = dateTimeOneHourAgo(), expectedEmailCount = 1, } = {}, shouldThrowErrorOnTimeout = true) => {
|
|
4146
|
-
if (IS_DEV_ENV)
|
|
4147
|
-
return this.railsEmailUtils.getEmailAttachment({ name, type }, messageSearchCriteria, { receivedAfter, expectedEmailCount, timeout: timeout / 3 }, shouldThrowErrorOnTimeout);
|
|
4148
|
-
const { blobId, attachments: attachmentNameAndTypes } = await this.findMessage(messageSearchCriteria, { expectedEmailCount, receivedAfter, timeout }, shouldThrowErrorOnTimeout);
|
|
4149
|
-
const attachment = attachmentNameAndTypes.find(att => {
|
|
4150
|
-
const matchesName = name ? att.name?.includes(name) : true;
|
|
4151
|
-
const matchesType = type ? att.type?.startsWith(type) : true;
|
|
4152
|
-
return matchesName && matchesType;
|
|
4153
|
-
});
|
|
4154
|
-
if (!attachment)
|
|
4155
|
-
throw new Error("No such attachment exists");
|
|
4156
|
-
const emailAttachment = await this.fastmailApi.fetchAttachments(blobId, attachment.name);
|
|
4157
|
-
const buffer = await emailAttachment.body();
|
|
4158
|
-
const parsedEmail = await simpleParser(buffer);
|
|
4159
|
-
const attachments = parsedEmail.attachments;
|
|
4160
|
-
return attachments.find(att => {
|
|
4161
|
-
const matchesName = name ? att.filename?.includes(name) : true;
|
|
4162
|
-
const matchesType = type ? att.contentType?.startsWith(type) : true;
|
|
4163
|
-
return matchesName && matchesType;
|
|
4164
|
-
});
|
|
4165
|
-
};
|
|
4166
3528
|
toIdentifiers = (addresses) => {
|
|
4167
3529
|
if (!addresses)
|
|
4168
3530
|
return [];
|
|
@@ -4212,7 +3574,7 @@ class MailerUtils {
|
|
|
4212
3574
|
warnOnNonMailpitRecipient = ({ to, }) => {
|
|
4213
3575
|
const domain = mailpitDomainName().toLowerCase();
|
|
4214
3576
|
if (to && !to.toLowerCase().endsWith(`@${domain}`))
|
|
4215
|
-
console.warn(`MailerUtils
|
|
3577
|
+
console.warn(`MailerUtils reads from Mailpit, but "${to}" is not on the Mailpit domain "${domain}". Unless mail for that address is relayed to Mailpit, this lookup will poll until it times out. Generate recipients with generateRandomEmail().`);
|
|
4216
3578
|
};
|
|
4217
3579
|
queryMailpitEmails = async (messageSearchCriteria, { receivedAfter = dateTimeOneHourAgo(), page = 1, itemsPerPage = 50, }) => {
|
|
4218
3580
|
if (itemsPerPage > 100 || itemsPerPage < 1)
|
|
@@ -4231,7 +3593,7 @@ class MailerUtils {
|
|
|
4231
3593
|
return messages.filter(summary => new Date(summary.Created).valueOf() >= receivedAfter.valueOf() &&
|
|
4232
3594
|
this.matchesSummaryCriteria(summary, messageSearchCriteria));
|
|
4233
3595
|
};
|
|
4234
|
-
|
|
3596
|
+
getEmails = async (summaries) => {
|
|
4235
3597
|
const emails = await Promise.all(summaries.map(async (summary) => {
|
|
4236
3598
|
const message = await this.mailpitApi.getMessage(summary.ID);
|
|
4237
3599
|
return message && this.toFormattedList(summary, message);
|
|
@@ -4246,7 +3608,7 @@ class MailerUtils {
|
|
|
4246
3608
|
condition: async () => {
|
|
4247
3609
|
const candidates = await this.queryMailpitEmails(messageSearchCriteria, { receivedAfter });
|
|
4248
3610
|
if (requiresBodyMatch) {
|
|
4249
|
-
const emails = await this.
|
|
3611
|
+
const emails = await this.getEmails(candidates);
|
|
4250
3612
|
const matchedIds = new Set(emails
|
|
4251
3613
|
.filter(email => this.matchesCriteria(email, messageSearchCriteria))
|
|
4252
3614
|
.map(({ id }) => id));
|
|
@@ -4261,16 +3623,16 @@ class MailerUtils {
|
|
|
4261
3623
|
});
|
|
4262
3624
|
return summaries === false ? null : summaries;
|
|
4263
3625
|
};
|
|
4264
|
-
|
|
3626
|
+
listMessages = async (messageSearchCriteria = {}, listMessagesFilterCriteria = {}) => {
|
|
4265
3627
|
if (IS_DEV_ENV) {
|
|
4266
3628
|
return this.railsEmailUtils.listMessages(messageSearchCriteria, listMessagesFilterCriteria);
|
|
4267
3629
|
}
|
|
4268
3630
|
this.warnOnNonMailpitRecipient(messageSearchCriteria);
|
|
4269
3631
|
const summaries = await this.queryMailpitEmails(messageSearchCriteria, listMessagesFilterCriteria);
|
|
4270
|
-
const emails = await this.
|
|
3632
|
+
const emails = await this.getEmails(summaries);
|
|
4271
3633
|
return emails.filter(email => this.matchesCriteria(email, messageSearchCriteria));
|
|
4272
3634
|
};
|
|
4273
|
-
|
|
3635
|
+
getEmailIds = async (messageSearchCriteria = {}, { timeout = 10_000, receivedAfter = dateTimeOneHourAgo(), expectedEmailCount = 1, } = {}, shouldThrowErrorOnTimeout = true) => {
|
|
4274
3636
|
if (IS_DEV_ENV) {
|
|
4275
3637
|
const emails = await this.railsEmailUtils.listMessages(messageSearchCriteria, { receivedAfter });
|
|
4276
3638
|
return emails.map(({ id }) => id);
|
|
@@ -4284,7 +3646,7 @@ class MailerUtils {
|
|
|
4284
3646
|
}
|
|
4285
3647
|
return summaries.map(({ ID }) => ID);
|
|
4286
3648
|
};
|
|
4287
|
-
|
|
3649
|
+
findMessage = async (messageSearchCriteria = {}, { timeout = 10_000, receivedAfter = dateTimeOneHourAgo(), expectedEmailCount = 1, } = {}, shouldThrowErrorOnTimeout = true) => {
|
|
4288
3650
|
if (IS_DEV_ENV) {
|
|
4289
3651
|
return this.railsEmailUtils.findMessage(messageSearchCriteria, { receivedAfter, expectedEmailCount, timeout: timeout / 3 }, shouldThrowErrorOnTimeout);
|
|
4290
3652
|
}
|
|
@@ -4295,11 +3657,11 @@ class MailerUtils {
|
|
|
4295
3657
|
throw mailpitTimeoutError(messageSearchCriteria, receivedAfter, expectedEmailCount);
|
|
4296
3658
|
return {};
|
|
4297
3659
|
}
|
|
4298
|
-
const emails = await this.
|
|
3660
|
+
const emails = await this.getEmails(summaries);
|
|
4299
3661
|
const filteredEmails = emails.filter(email => this.matchesCriteria(email, messageSearchCriteria));
|
|
4300
3662
|
return filteredEmails[0] || {};
|
|
4301
3663
|
};
|
|
4302
|
-
|
|
3664
|
+
findOtpFromEmail = async ({ email, subjectSubstring = OTP_EMAIL_PATTERN, timeout = 2 * 60 * 1000, receivedAfter = new Date(Date.now() - 3000), expectedEmailCount = 1, }) => {
|
|
4303
3665
|
if (IS_DEV_ENV) {
|
|
4304
3666
|
return this.railsEmailUtils.findOtpFromEmail({
|
|
4305
3667
|
email,
|
|
@@ -4309,17 +3671,17 @@ class MailerUtils {
|
|
|
4309
3671
|
timeout: timeout / 3,
|
|
4310
3672
|
});
|
|
4311
3673
|
}
|
|
4312
|
-
const message = await this.
|
|
3674
|
+
const message = await this.findMessage({ to: email, subject: subjectSubstring }, { timeout, receivedAfter, expectedEmailCount });
|
|
4313
3675
|
return message.html?.codes?.[0];
|
|
4314
3676
|
};
|
|
4315
|
-
|
|
3677
|
+
generateRandomEmail = () => {
|
|
4316
3678
|
const domain = mailpitDomainName();
|
|
4317
3679
|
const [localPart] = faker.internet
|
|
4318
3680
|
.email({ provider: domain, allowSpecialCharacters: false })
|
|
4319
3681
|
.split("@");
|
|
4320
3682
|
return `${localPart}.${faker.string.alpha(8).toLowerCase()}@${domain}`;
|
|
4321
3683
|
};
|
|
4322
|
-
|
|
3684
|
+
getLatestMessageId = async (subject, { timeout = 10_000, receivedAfter = dateTimeOneHourAgo(), } = {}) => {
|
|
4323
3685
|
if (IS_DEV_ENV) {
|
|
4324
3686
|
return this.railsEmailUtils.getLatestMessageId(subject, {
|
|
4325
3687
|
timeout: timeout / 3,
|
|
@@ -4330,10 +3692,10 @@ class MailerUtils {
|
|
|
4330
3692
|
const messageId = summaries?.[0]?.MessageID;
|
|
4331
3693
|
return messageId ? messageId.replace(/^<|>$/g, "") : undefined;
|
|
4332
3694
|
};
|
|
4333
|
-
|
|
3695
|
+
getEmailAttachment = async ({ name, type }, messageSearchCriteria = {}, { timeout = 10_000, receivedAfter = dateTimeOneHourAgo(), expectedEmailCount = 1, } = {}, shouldThrowErrorOnTimeout = true) => {
|
|
4334
3696
|
if (IS_DEV_ENV)
|
|
4335
3697
|
return this.railsEmailUtils.getEmailAttachment({ name, type }, messageSearchCriteria, { receivedAfter, expectedEmailCount, timeout: timeout / 3 }, shouldThrowErrorOnTimeout);
|
|
4336
|
-
const { id } = await this.
|
|
3698
|
+
const { id } = await this.findMessage(messageSearchCriteria, { expectedEmailCount, receivedAfter, timeout }, shouldThrowErrorOnTimeout);
|
|
4337
3699
|
const rawMessage = id ? await this.mailpitApi.fetchRawMessage(id) : null;
|
|
4338
3700
|
if (!rawMessage)
|
|
4339
3701
|
throw new Error("No such attachment exists");
|
|
@@ -4500,74 +3862,11 @@ class ColorPickerUtils {
|
|
|
4500
3862
|
await expect(colorPickerInput).toBeHidden();
|
|
4501
3863
|
}).toPass({ timeout: 40_000 });
|
|
4502
3864
|
};
|
|
4503
|
-
hexToRGBA =
|
|
4504
|
-
let r = 0, g = 0, b = 0, a = 1;
|
|
4505
|
-
if (hex.length === 5) {
|
|
4506
|
-
r = parseInt(`${hex[1]}${hex[1]}`, 16);
|
|
4507
|
-
g = parseInt(`${hex[2]}${hex[2]}`, 16);
|
|
4508
|
-
b = parseInt(`${hex[3]}${hex[3]}`, 16);
|
|
4509
|
-
a = parseInt(`${hex[4]}${hex[4]}`, 16) / 255;
|
|
4510
|
-
}
|
|
4511
|
-
else if (hex.length === 9) {
|
|
4512
|
-
r = parseInt(`${hex[1]}${hex[2]}`, 16);
|
|
4513
|
-
g = parseInt(`${hex[3]}${hex[4]}`, 16);
|
|
4514
|
-
b = parseInt(`${hex[5]}${hex[6]}`, 16);
|
|
4515
|
-
a = parseInt(`${hex[7]}${hex[8]}`, 16) / 255;
|
|
4516
|
-
}
|
|
4517
|
-
return `rgba(${r}, ${g}, ${b}, ${a.toFixed(2)})`;
|
|
4518
|
-
};
|
|
3865
|
+
hexToRGBA = hexToRGBA;
|
|
4519
3866
|
}
|
|
4520
3867
|
|
|
4521
|
-
const STATIC_ASSET_PATTERN = /\.(js|css|woff2?|ttf|eot|png|svg|ico|gif|webp)(\?.*)?$/;
|
|
4522
|
-
const EXCLUDED_RESPONSE_HEADERS = [
|
|
4523
|
-
"content-encoding",
|
|
4524
|
-
"content-length",
|
|
4525
|
-
"transfer-encoding",
|
|
4526
|
-
];
|
|
4527
|
-
const assetCache = new Map();
|
|
4528
3868
|
const commands = {
|
|
4529
|
-
|
|
4530
|
-
if (IS_DEV_ENV && IS_CI && !IS_PLAYWRIGHT_RUN) {
|
|
4531
|
-
await context.route(STATIC_ASSET_PATTERN, async (route) => {
|
|
4532
|
-
const url = route.request().url();
|
|
4533
|
-
const hit = assetCache.get(url);
|
|
4534
|
-
if (hit)
|
|
4535
|
-
return route.fulfill(hit);
|
|
4536
|
-
try {
|
|
4537
|
-
// Use Node's native fetch instead of route.fetch() to keep these
|
|
4538
|
-
// requests out of the Playwright trace's Actions tab. Forward the
|
|
4539
|
-
// browser's request headers so cookie/session-scoped assets still
|
|
4540
|
-
// resolve; drop accept-encoding so we only get encodings Node can
|
|
4541
|
-
// decode, and HTTP/2 pseudo-headers which fetch rejects.
|
|
4542
|
-
const requestHeaders = Object.entries(await route.request().allHeaders()).filter(([name]) => name !== "accept-encoding" && !name.startsWith(":"));
|
|
4543
|
-
const response = await fetch(url, {
|
|
4544
|
-
headers: Object.fromEntries(requestHeaders),
|
|
4545
|
-
});
|
|
4546
|
-
const body = Buffer.from(await response.arrayBuffer());
|
|
4547
|
-
// Node's fetch decompresses the body but keeps the original
|
|
4548
|
-
// content-encoding/content-length headers; drop them so the
|
|
4549
|
-
// browser doesn't try to decode the already-decoded body.
|
|
4550
|
-
const headers = {};
|
|
4551
|
-
response.headers.forEach((value, key) => {
|
|
4552
|
-
if (!EXCLUDED_RESPONSE_HEADERS.includes(key))
|
|
4553
|
-
headers[key] = value;
|
|
4554
|
-
});
|
|
4555
|
-
const entry = { body, status: response.status, headers };
|
|
4556
|
-
if (response.ok)
|
|
4557
|
-
assetCache.set(url, entry);
|
|
4558
|
-
return route.fulfill(entry);
|
|
4559
|
-
}
|
|
4560
|
-
catch {
|
|
4561
|
-
return route.continue();
|
|
4562
|
-
}
|
|
4563
|
-
});
|
|
4564
|
-
}
|
|
4565
|
-
await use(context);
|
|
4566
|
-
},
|
|
4567
|
-
neetoPlaywrightUtilities: async ({ page, request, baseURL }, use) => {
|
|
4568
|
-
const commands = new CustomCommands(page, request, baseURL);
|
|
4569
|
-
await use(commands);
|
|
4570
|
-
},
|
|
3869
|
+
neetoPlaywrightUtilities: ({ page, request, baseURL }, use) => use(new CustomCommands(page, request, baseURL)),
|
|
4571
3870
|
page: async ({ page }, use) => {
|
|
4572
3871
|
await page.goto("/");
|
|
4573
3872
|
await page.waitForLoadState();
|
|
@@ -4575,8 +3874,6 @@ const commands = {
|
|
|
4575
3874
|
},
|
|
4576
3875
|
mailerUtils: async ({ neetoPlaywrightUtilities }, use) => {
|
|
4577
3876
|
const mailerUtils = new MailerUtils(neetoPlaywrightUtilities);
|
|
4578
|
-
if (!IS_MAILPIT_ENABLED)
|
|
4579
|
-
await mailerUtils.fastmailApi.authorizeAndSetAccountId();
|
|
4580
3877
|
await use(mailerUtils);
|
|
4581
3878
|
IS_DEV_ENV && (await mailerUtils.railsEmailUtils.clearStaleEmails());
|
|
4582
3879
|
},
|
|
@@ -4593,18 +3890,9 @@ const commands = {
|
|
|
4593
3890
|
}
|
|
4594
3891
|
}
|
|
4595
3892
|
},
|
|
4596
|
-
colorPicker:
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
},
|
|
4600
|
-
qrCodeUtils: async ({ page }, use) => {
|
|
4601
|
-
const qrCodeUtils = new QRCodeUtils(page);
|
|
4602
|
-
await use(qrCodeUtils);
|
|
4603
|
-
},
|
|
4604
|
-
health: async ({ page, neetoPlaywrightUtilities }, use) => {
|
|
4605
|
-
const health = new Health(page, neetoPlaywrightUtilities);
|
|
4606
|
-
await use(health);
|
|
4607
|
-
},
|
|
3893
|
+
colorPicker: ({ page }, use) => use(new ColorPickerUtils(page)),
|
|
3894
|
+
qrCodeUtils: ({ page }, use) => use(new QRCodeUtils(page)),
|
|
3895
|
+
health: ({ page, neetoPlaywrightUtilities }, use) => use(new Health(page, neetoPlaywrightUtilities)),
|
|
4608
3896
|
};
|
|
4609
3897
|
|
|
4610
3898
|
const loadPlaywrightExtra = () => import('playwright-extra');
|
|
@@ -4935,8 +4223,8 @@ class EmbedBase {
|
|
|
4935
4223
|
const showIconCheckbox = this.page.getByTestId(EMBED_SELECTORS.showIconCheckbox);
|
|
4936
4224
|
if (isPresent(customizationOptions.showIcon)) {
|
|
4937
4225
|
const shouldShowIcon = customizationOptions.showIcon;
|
|
4938
|
-
|
|
4939
|
-
|
|
4226
|
+
(await showIconCheckbox.isChecked()) !== shouldShowIcon &&
|
|
4227
|
+
(await showIconCheckbox.click());
|
|
4940
4228
|
await expect(this.codeBlock).toContainText(`showIcon: ${shouldShowIcon}`);
|
|
4941
4229
|
}
|
|
4942
4230
|
await this.expectMultipleTextsInCodeblock([
|
|
@@ -4949,9 +4237,11 @@ class EmbedBase {
|
|
|
4949
4237
|
const floatingButton = this.page.getByRole("button", {
|
|
4950
4238
|
name: customizationOptions.buttonText,
|
|
4951
4239
|
});
|
|
4952
|
-
const
|
|
4953
|
-
.
|
|
4954
|
-
.
|
|
4240
|
+
const [vertical, horizontal] = customizationOptions.buttonPosition
|
|
4241
|
+
.toLowerCase()
|
|
4242
|
+
.split(" ");
|
|
4243
|
+
const logicalSide = horizontal === "left" ? "start" : "end";
|
|
4244
|
+
const classRegExp = `${vertical}-0.*${logicalSide}-0|${vertical}.*${horizontal}`;
|
|
4955
4245
|
await Promise.all([
|
|
4956
4246
|
expect(floatingButton).toHaveClass(RegExp(classRegExp)),
|
|
4957
4247
|
expect(floatingButton).toHaveCSS("background-color", hexToRGB(customizationOptions.buttonColorHex)),
|
|
@@ -5019,7 +4309,7 @@ class HelpAndProfilePage {
|
|
|
5019
4309
|
const floatingActionMenuBtn = this.page.getByTestId(COMMON_SELECTORS.floatingActionMenuButton);
|
|
5020
4310
|
await expect(async () => {
|
|
5021
4311
|
await floatingActionMenuBtn.scrollIntoViewIfNeeded();
|
|
5022
|
-
await floatingActionMenuBtn.
|
|
4312
|
+
await floatingActionMenuBtn.click();
|
|
5023
4313
|
await expect(this.helpMenuBtn).toBeVisible();
|
|
5024
4314
|
}).toPass({ timeout: 60_000 });
|
|
5025
4315
|
};
|
|
@@ -5105,28 +4395,28 @@ class HelpAndProfilePage {
|
|
|
5105
4395
|
await this.page
|
|
5106
4396
|
.getByTestId(HELP_CENTER_SELECTORS.keyboardShortcutButton)
|
|
5107
4397
|
.click();
|
|
5108
|
-
await expect(keyboardShortcutsPane).not.toHaveCSS("width", "
|
|
4398
|
+
await expect(keyboardShortcutsPane).not.toHaveCSS("width", "0px");
|
|
5109
4399
|
await this.page
|
|
5110
4400
|
.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.closePaneButton)
|
|
5111
4401
|
.click();
|
|
5112
|
-
await expect(keyboardShortcutsPane).toHaveCSS("width", "
|
|
4402
|
+
await expect(keyboardShortcutsPane).toHaveCSS("width", "0px");
|
|
5113
4403
|
});
|
|
5114
4404
|
await test.step("3: Open and close keyboard shortcuts through shortcut", async () => {
|
|
5115
4405
|
await this.page.keyboard.press(openKeyboardShortcut);
|
|
5116
|
-
await expect(keyboardShortcutsPane).not.toHaveCSS("width", "
|
|
4406
|
+
await expect(keyboardShortcutsPane).not.toHaveCSS("width", "0px");
|
|
5117
4407
|
await this.page.keyboard.press("Escape");
|
|
5118
|
-
await expect(keyboardShortcutsPane).toHaveCSS("width", "
|
|
4408
|
+
await expect(keyboardShortcutsPane).toHaveCSS("width", "0px");
|
|
5119
4409
|
});
|
|
5120
4410
|
await test.step("4: Verify all displayed keyboard shortcuts", async () => {
|
|
5121
4411
|
await this.page.keyboard.press(openKeyboardShortcut);
|
|
5122
|
-
await expect(keyboardShortcutsPane).not.toHaveCSS("width", "
|
|
4412
|
+
await expect(keyboardShortcutsPane).not.toHaveCSS("width", "0px");
|
|
5123
4413
|
await Promise.all([
|
|
5124
|
-
expect(keyItem.
|
|
4414
|
+
expect(keyItem.getByTestId(COMMON_SELECTORS.hotkeyDescription)).toHaveText(shortcuts.map(shortcut => shortcut.description)),
|
|
5125
4415
|
expect(keyItem.locator("div")).toHaveText(formattedSequences),
|
|
5126
4416
|
]);
|
|
5127
4417
|
});
|
|
5128
4418
|
};
|
|
5129
|
-
openAppSwitcher = () => this.page.getByTestId(COMMON_SELECTORS.appSwitcherButton).
|
|
4419
|
+
openAppSwitcher = () => this.page.getByTestId(COMMON_SELECTORS.appSwitcherButton).click();
|
|
5130
4420
|
openAppSwitcherAndVerify = async () => {
|
|
5131
4421
|
const productName = "Cal";
|
|
5132
4422
|
const searchQueryPartial = productName.slice(0, 1).toLowerCase();
|
|
@@ -5166,18 +4456,21 @@ class HelpAndProfilePage {
|
|
|
5166
4456
|
});
|
|
5167
4457
|
});
|
|
5168
4458
|
};
|
|
5169
|
-
openAuthLinkAndVerify = async ({ linkTestId, redirectLink, }) => {
|
|
5170
|
-
await this.page
|
|
5171
|
-
.getByTestId(COMMON_SELECTORS.pane)
|
|
5172
|
-
.getByTestId(COMMON_SELECTORS.dropdownIcon)
|
|
5173
|
-
.click();
|
|
4459
|
+
openAuthLinkAndVerify = async ({ linkTestId, redirectLink, appPath, }) => {
|
|
5174
4460
|
await this.page
|
|
5175
|
-
.getByTestId(
|
|
5176
|
-
.getByTestId(linkTestId)
|
|
4461
|
+
.getByTestId(PROFILE_SECTION_SELECTORS.profileMoreDropdownButton)
|
|
5177
4462
|
.click();
|
|
5178
|
-
|
|
5179
|
-
await
|
|
5180
|
-
|
|
4463
|
+
const appUrl = this.page.url();
|
|
4464
|
+
await Promise.all([
|
|
4465
|
+
this.page.waitForRequest(request => new URL(request.url()).pathname === appPath),
|
|
4466
|
+
this.page.getByTestId(linkTestId).click(),
|
|
4467
|
+
]);
|
|
4468
|
+
// NeetoAuth runs only on staging
|
|
4469
|
+
if (IS_STAGING_ENV) {
|
|
4470
|
+
await expect(this.page).toHaveURL(new RegExp(NEETO_AUTH_BASE_URL(readFileSyncIfExists()?.user?.subdomainName)));
|
|
4471
|
+
await expect(this.page).toHaveURL(new RegExp(redirectLink));
|
|
4472
|
+
}
|
|
4473
|
+
await this.page.goto(appUrl);
|
|
5181
4474
|
};
|
|
5182
4475
|
fillTextFields = async ({ firstName, lastName, phoneNumber, }) => {
|
|
5183
4476
|
const firstNameField = this.page.getByTestId(PROFILE_SECTION_SELECTORS.firstNameTextField);
|
|
@@ -5218,9 +4511,10 @@ class HelpAndProfilePage {
|
|
|
5218
4511
|
});
|
|
5219
4512
|
};
|
|
5220
4513
|
uploadImage = async (imageName) => {
|
|
4514
|
+
if (!IS_STAGING_ENV)
|
|
4515
|
+
return; // Image upload needs ImageKit, which is configured only on staging
|
|
5221
4516
|
await this.page
|
|
5222
|
-
.getByTestId(
|
|
5223
|
-
.getByTestId(COMMON_SELECTORS.dropdownIcon)
|
|
4517
|
+
.getByTestId(PROFILE_SECTION_SELECTORS.profileImageDropdownButton)
|
|
5224
4518
|
.click();
|
|
5225
4519
|
await this.page
|
|
5226
4520
|
.getByTestId(PROFILE_SECTION_SELECTORS.imageUploadBtn)
|
|
@@ -5229,12 +4523,12 @@ class HelpAndProfilePage {
|
|
|
5229
4523
|
fileNameWithType: `images/${imageName}`,
|
|
5230
4524
|
droppableZone: this.page.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.fileInput),
|
|
5231
4525
|
});
|
|
5232
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.
|
|
4526
|
+
await expect(this.page.getByTestId(COMMON_SELECTORS.dialogHeader)).toBeHidden({ timeout: 10_000 });
|
|
5233
4527
|
await expect(this.page.getByTestId(COMMON_SELECTORS.avatar).locator("img")).toHaveAttribute("src", imageRegex(imageName));
|
|
5234
4528
|
};
|
|
5235
4529
|
updateBasicInfo = async ({ contact, settings, imageName, }) => {
|
|
5236
4530
|
await expect(this.page
|
|
5237
|
-
.getByTestId(COMMON_SELECTORS.
|
|
4531
|
+
.getByTestId(COMMON_SELECTORS.sheetBody)
|
|
5238
4532
|
.getByTestId(COMMON_SELECTORS.uiSpinner)).toBeHidden();
|
|
5239
4533
|
await this.uploadImage(imageName);
|
|
5240
4534
|
await this.fillTextFields(contact);
|
|
@@ -5244,7 +4538,7 @@ class HelpAndProfilePage {
|
|
|
5244
4538
|
.or(this.page.getByTestId(PROFILE_SECTION_SELECTORS.profileSubmitBtn))
|
|
5245
4539
|
.click();
|
|
5246
4540
|
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
5247
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.
|
|
4541
|
+
await expect(this.page.getByTestId(COMMON_SELECTORS.sheetCloseButton)).toBeHidden();
|
|
5248
4542
|
};
|
|
5249
4543
|
openProfile = async () => {
|
|
5250
4544
|
await this.openHelpCenter();
|
|
@@ -5254,7 +4548,7 @@ class HelpAndProfilePage {
|
|
|
5254
4548
|
await this.page
|
|
5255
4549
|
.getByTestId(PROFILE_SECTION_SELECTORS.myProfileButton)
|
|
5256
4550
|
.click();
|
|
5257
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.
|
|
4551
|
+
await expect(this.page.getByTestId(COMMON_SELECTORS.sheetHeader)).toContainText(this.t("neetoTeamMembers.profile.common.myProfile"));
|
|
5258
4552
|
};
|
|
5259
4553
|
verifyProfileSidePane = async ({ contact, settings, imageName, }) => {
|
|
5260
4554
|
const timeZone = settings?.timeZone;
|
|
@@ -5302,8 +4596,7 @@ class HelpAndProfilePage {
|
|
|
5302
4596
|
await test.step("3: Verify basic info", async () => {
|
|
5303
4597
|
await this.openProfile();
|
|
5304
4598
|
await this.page
|
|
5305
|
-
.getByTestId(
|
|
5306
|
-
.getByTestId(COMMON_SELECTORS.dropdownIcon)
|
|
4599
|
+
.getByTestId(PROFILE_SECTION_SELECTORS.profileMoreDropdownButton)
|
|
5307
4600
|
.click();
|
|
5308
4601
|
await this.page
|
|
5309
4602
|
.getByTestId(PROFILE_SECTION_SELECTORS.editBasicInfoMenuBtn)
|
|
@@ -5336,26 +4629,6 @@ class HelpAndProfilePage {
|
|
|
5336
4629
|
await workspacePage.close();
|
|
5337
4630
|
});
|
|
5338
4631
|
};
|
|
5339
|
-
/**
|
|
5340
|
-
* @deprecated This method is deprecated. Use verifyWorkspace instead.
|
|
5341
|
-
*/
|
|
5342
|
-
verifyProfileAndOrganizationLinks = async () => {
|
|
5343
|
-
await test.step("1: Open Help center and verify", this.openHelpCenter);
|
|
5344
|
-
await test.step("2: Open My organization link and verify", async () => {
|
|
5345
|
-
await this.page
|
|
5346
|
-
.getByTestId(PROFILE_SECTION_SELECTORS.workspaceDisplay)
|
|
5347
|
-
.click();
|
|
5348
|
-
const [workspacePage] = await Promise.all([
|
|
5349
|
-
this.page.waitForEvent("popup"),
|
|
5350
|
-
this.page
|
|
5351
|
-
.getByTestId(PROFILE_SECTION_SELECTORS.profileOrganizationSettingsButton)
|
|
5352
|
-
.click(),
|
|
5353
|
-
]);
|
|
5354
|
-
await workspacePage.waitForLoadState();
|
|
5355
|
-
await expect(workspacePage).toHaveURL(new RegExp(ROUTES.auth.adminPanel));
|
|
5356
|
-
await workspacePage.close();
|
|
5357
|
-
});
|
|
5358
|
-
};
|
|
5359
4632
|
openAndVerifyStatus = async () => {
|
|
5360
4633
|
await test.step("1: Open Help Center links", this.openHelpCenter);
|
|
5361
4634
|
await test.step("2: Open and verify status page", async () => {
|
|
@@ -5438,208 +4711,74 @@ class HelpAndProfilePage {
|
|
|
5438
4711
|
});
|
|
5439
4712
|
};
|
|
5440
4713
|
}
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
openAndVerifyKeyboardShortcutsPane = async (productShortcuts, osPlatform = "windows") => {
|
|
5452
|
-
const keyboardShortcutsPane = this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane);
|
|
5453
|
-
const keyItem = this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.hotKeyItem);
|
|
5454
|
-
const openKeyboardShortcut = osPlatform === "mac" ? "Meta+/" : "Control+/";
|
|
5455
|
-
const shortcuts = [...globalShortcuts(this.t), ...productShortcuts];
|
|
5456
|
-
const formattedSequences = shortcuts.map(shortcut => this.formatKeyboardShortcut(shortcut.sequence, osPlatform));
|
|
5457
|
-
await test.step("1: Open Help Center", this.openHelpCenter);
|
|
5458
|
-
await test.step("2: Open and close keyboard shortcuts from UI", async () => {
|
|
5459
|
-
await this.page
|
|
5460
|
-
.getByTestId(HELP_CENTER_SELECTORS.keyboardShortcutButton)
|
|
5461
|
-
.click();
|
|
5462
|
-
await expect(keyboardShortcutsPane).not.toHaveCSS("width", "0px");
|
|
5463
|
-
await this.page
|
|
5464
|
-
.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.closePaneButton)
|
|
5465
|
-
.click();
|
|
5466
|
-
await expect(keyboardShortcutsPane).toHaveCSS("width", "0px");
|
|
5467
|
-
});
|
|
5468
|
-
await test.step("3: Open and close keyboard shortcuts through shortcut", async () => {
|
|
5469
|
-
await this.page.keyboard.press(openKeyboardShortcut);
|
|
5470
|
-
await expect(keyboardShortcutsPane).not.toHaveCSS("width", "0px");
|
|
5471
|
-
await this.page.keyboard.press("Escape");
|
|
5472
|
-
await expect(keyboardShortcutsPane).toHaveCSS("width", "0px");
|
|
4714
|
+
|
|
4715
|
+
class MicrosoftPage extends IntegrationBase {
|
|
4716
|
+
totp;
|
|
4717
|
+
mailerUtils;
|
|
4718
|
+
constructor({ page, neetoPlaywrightUtilities, integrationRouteIndex, integration = "", }) {
|
|
4719
|
+
super({
|
|
4720
|
+
page,
|
|
4721
|
+
neetoPlaywrightUtilities,
|
|
4722
|
+
integrationRouteIndex,
|
|
4723
|
+
integration,
|
|
5473
4724
|
});
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
expect(keyItem.getByTestId(COMMON_SELECTORS.hotkeyDescription)).toHaveText(shortcuts.map(shortcut => shortcut.description)),
|
|
5479
|
-
expect(keyItem.locator("div")).toHaveText(formattedSequences),
|
|
5480
|
-
]);
|
|
4725
|
+
this.mailerUtils = new MailerUtils(neetoPlaywrightUtilities);
|
|
4726
|
+
this.totp = initializeTotp({
|
|
4727
|
+
issuer: "Microsoft",
|
|
4728
|
+
secret: process.env.MICROSOFT_2FA_SECRET_KEY,
|
|
5481
4729
|
});
|
|
5482
|
-
}
|
|
5483
|
-
|
|
4730
|
+
}
|
|
4731
|
+
stagingConsentFlow = async (abortFlow = false) => {
|
|
4732
|
+
await this.page.waitForLoadState("load", { timeout: 25_000 });
|
|
4733
|
+
await expect(this.page.getByRole("heading", {
|
|
4734
|
+
name: MICROSOFT_LOGIN_TEXTS.permissionsRequested,
|
|
4735
|
+
})).toBeVisible({ timeout: 20_000 });
|
|
5484
4736
|
await this.page
|
|
5485
|
-
.
|
|
4737
|
+
.locator(abortFlow
|
|
4738
|
+
? MICROSOFT_LOGIN_SELECTORS.cancelButton
|
|
4739
|
+
: MICROSOFT_LOGIN_SELECTORS.acceptButton)
|
|
5486
4740
|
.click();
|
|
5487
|
-
|
|
5488
|
-
await
|
|
5489
|
-
this.page.waitForRequest(request => new URL(request.url()).pathname === appPath),
|
|
5490
|
-
this.page.getByTestId(linkTestId).click(),
|
|
5491
|
-
]);
|
|
5492
|
-
// NeetoAuth runs only on staging
|
|
5493
|
-
if (IS_STAGING_ENV) {
|
|
5494
|
-
await expect(this.page).toHaveURL(new RegExp(NEETO_AUTH_BASE_URL(readFileSyncIfExists()?.user?.subdomainName)));
|
|
5495
|
-
await expect(this.page).toHaveURL(new RegExp(redirectLink));
|
|
5496
|
-
}
|
|
5497
|
-
await this.page.goto(appUrl);
|
|
4741
|
+
await this.page.waitForLoadState("load", { timeout: 25_000 });
|
|
4742
|
+
await this.neetoPlaywrightUtilities.waitForFloatingMenu();
|
|
5498
4743
|
};
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
await this.page
|
|
5503
|
-
.getByTestId(PROFILE_SECTION_SELECTORS.profileImageDropdownButton)
|
|
5504
|
-
.click();
|
|
4744
|
+
enterEmail = async (email) => {
|
|
4745
|
+
await this.page.waitForLoadState("load", { timeout: 25_000 });
|
|
4746
|
+
await expect(this.page.getByRole("heading", { name: MICROSOFT_LOGIN_TEXTS.signIn })).toBeVisible({ timeout: 20_000 });
|
|
5505
4747
|
await this.page
|
|
5506
|
-
.
|
|
5507
|
-
.
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.dialogHeader)).toBeHidden({ timeout: 10_000 });
|
|
5513
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.avatar).locator("img")).toHaveAttribute("src", imageRegex(imageName));
|
|
4748
|
+
.locator(MICROSOFT_LOGIN_SELECTORS.emailInput)
|
|
4749
|
+
.or(this.page.locator(MICROSOFT_LOGIN_SELECTORS.placeholder))
|
|
4750
|
+
.or(this.page.getByRole("textbox", {
|
|
4751
|
+
name: MICROSOFT_LOGIN_TEXTS.emailInput,
|
|
4752
|
+
}))
|
|
4753
|
+
.pressSequentially(email, { delay: 25 });
|
|
5514
4754
|
};
|
|
5515
|
-
|
|
5516
|
-
await
|
|
5517
|
-
|
|
5518
|
-
.
|
|
5519
|
-
|
|
5520
|
-
await this.fillTextFields(contact);
|
|
5521
|
-
await this.selectDropdownFields(settings);
|
|
4755
|
+
enterPassword = async (password) => {
|
|
4756
|
+
await this.page.waitForLoadState("load", { timeout: 25_000 });
|
|
4757
|
+
await expect(this.page.getByRole("heading", {
|
|
4758
|
+
name: MICROSOFT_LOGIN_TEXTS.enterPassword,
|
|
4759
|
+
})).toBeVisible({ timeout: 10_000 });
|
|
5522
4760
|
await this.page
|
|
5523
|
-
.
|
|
5524
|
-
.or(this.page.
|
|
5525
|
-
.
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
openProfile = async () => {
|
|
5530
|
-
await this.openHelpCenter();
|
|
5531
|
-
await this.page
|
|
5532
|
-
.getByTestId(PROFILE_SECTION_SELECTORS.profileExpandMenuBtn)
|
|
5533
|
-
.click();
|
|
5534
|
-
await this.page
|
|
5535
|
-
.getByTestId(PROFILE_SECTION_SELECTORS.myProfileButton)
|
|
5536
|
-
.click();
|
|
5537
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.sheetHeader)).toContainText(this.t("neetoTeamMembers.profile.common.myProfile"));
|
|
5538
|
-
};
|
|
5539
|
-
verifyProfile = async () => {
|
|
5540
|
-
await test.step("1: Open Manage billing and subscriptions link and verify", async () => {
|
|
5541
|
-
await this.openProfile();
|
|
5542
|
-
await this.openAuthLinkAndVerify({
|
|
5543
|
-
redirectLink: ROUTES.myProfile,
|
|
5544
|
-
appPath: ROUTES.auth.editBilling,
|
|
5545
|
-
linkTestId: PROFILE_SECTION_SELECTORS.manageBillingAndSubscriptionsButton,
|
|
5546
|
-
});
|
|
5547
|
-
});
|
|
5548
|
-
await test.step("2: Open Update email link and verify", async () => {
|
|
5549
|
-
await this.openProfile();
|
|
5550
|
-
await this.openAuthLinkAndVerify({
|
|
5551
|
-
redirectLink: ROUTES.updateEmail,
|
|
5552
|
-
appPath: ROUTES.auth.editEmail,
|
|
5553
|
-
linkTestId: PROFILE_SECTION_SELECTORS.updateEmailMenuBtn,
|
|
5554
|
-
});
|
|
5555
|
-
});
|
|
5556
|
-
await test.step("3: Verify basic info", async () => {
|
|
5557
|
-
await this.openProfile();
|
|
5558
|
-
await this.page
|
|
5559
|
-
.getByTestId(PROFILE_SECTION_SELECTORS.profileMoreDropdownButton)
|
|
5560
|
-
.click();
|
|
5561
|
-
await this.page
|
|
5562
|
-
.getByTestId(PROFILE_SECTION_SELECTORS.editBasicInfoMenuBtn)
|
|
5563
|
-
.click();
|
|
5564
|
-
const basicInfoParams = getBasicInfoTestData();
|
|
5565
|
-
await this.updateBasicInfo(basicInfoParams);
|
|
5566
|
-
await this.openProfile();
|
|
5567
|
-
await this.verifyProfileSidePane(basicInfoParams);
|
|
5568
|
-
});
|
|
5569
|
-
};
|
|
5570
|
-
}
|
|
5571
|
-
|
|
5572
|
-
class MicrosoftPage extends IntegrationBase {
|
|
5573
|
-
totp;
|
|
5574
|
-
mailerUtils;
|
|
5575
|
-
constructor({ page, neetoPlaywrightUtilities, integrationRouteIndex, integration = "", }) {
|
|
5576
|
-
super({
|
|
5577
|
-
page,
|
|
5578
|
-
neetoPlaywrightUtilities,
|
|
5579
|
-
integrationRouteIndex,
|
|
5580
|
-
integration,
|
|
5581
|
-
});
|
|
5582
|
-
this.mailerUtils = new MailerUtils(neetoPlaywrightUtilities);
|
|
5583
|
-
this.totp = initializeTotp({
|
|
5584
|
-
issuer: "Microsoft",
|
|
5585
|
-
secret: process.env.MICROSOFT_2FA_SECRET_KEY,
|
|
5586
|
-
});
|
|
5587
|
-
}
|
|
5588
|
-
stagingConsentFlow = async (abortFlow = false) => {
|
|
5589
|
-
await this.page.waitForLoadState("load", { timeout: 25_000 });
|
|
5590
|
-
await expect(this.page.getByRole("heading", {
|
|
5591
|
-
name: MICROSOFT_LOGIN_TEXTS.permissionsRequested,
|
|
5592
|
-
})).toBeVisible({ timeout: 20_000 });
|
|
5593
|
-
await this.page
|
|
5594
|
-
.locator(abortFlow
|
|
5595
|
-
? MICROSOFT_LOGIN_SELECTORS.cancelButton
|
|
5596
|
-
: MICROSOFT_LOGIN_SELECTORS.acceptButton)
|
|
5597
|
-
.click();
|
|
5598
|
-
await this.page.waitForLoadState("load", { timeout: 25_000 });
|
|
5599
|
-
await this.neetoPlaywrightUtilities.waitForFloatingMenu();
|
|
5600
|
-
};
|
|
5601
|
-
enterEmail = async () => {
|
|
5602
|
-
await this.page.waitForLoadState("load", { timeout: 25_000 });
|
|
5603
|
-
await expect(this.page.getByRole("heading", { name: MICROSOFT_LOGIN_TEXTS.signIn })).toBeVisible({ timeout: 20_000 });
|
|
5604
|
-
await this.page
|
|
5605
|
-
.locator(MICROSOFT_LOGIN_SELECTORS.emailInput)
|
|
5606
|
-
.or(this.page.locator(MICROSOFT_LOGIN_SELECTORS.placeholder))
|
|
5607
|
-
.or(this.page.getByRole("textbox", {
|
|
5608
|
-
name: MICROSOFT_LOGIN_TEXTS.emailInput,
|
|
5609
|
-
}))
|
|
5610
|
-
.pressSequentially(process.env.MICROSOFT_LOGIN_EMAIL, { delay: 25 });
|
|
5611
|
-
};
|
|
5612
|
-
enterPassword = async () => {
|
|
5613
|
-
await this.page.waitForLoadState("load", { timeout: 25_000 });
|
|
5614
|
-
await expect(this.page.getByRole("heading", {
|
|
5615
|
-
name: MICROSOFT_LOGIN_TEXTS.enterPassword,
|
|
5616
|
-
})).toBeVisible({ timeout: 10_000 });
|
|
5617
|
-
await this.page
|
|
5618
|
-
.getByPlaceholder(MICROSOFT_LOGIN_TEXTS.password)
|
|
5619
|
-
.or(this.page.locator(MICROSOFT_LOGIN_SELECTORS.placeholder))
|
|
5620
|
-
.or(this.page.getByRole("textbox", {
|
|
5621
|
-
name: MICROSOFT_LOGIN_TEXTS.passwordInput,
|
|
5622
|
-
}))
|
|
5623
|
-
.pressSequentially(process.env.MICROSOFT_LOGIN_PASSWORD, { delay: 15 });
|
|
4761
|
+
.getByPlaceholder(MICROSOFT_LOGIN_TEXTS.password)
|
|
4762
|
+
.or(this.page.locator(MICROSOFT_LOGIN_SELECTORS.placeholder))
|
|
4763
|
+
.or(this.page.getByRole("textbox", {
|
|
4764
|
+
name: MICROSOFT_LOGIN_TEXTS.passwordInput,
|
|
4765
|
+
}))
|
|
4766
|
+
.pressSequentially(password, { delay: 15 });
|
|
5624
4767
|
};
|
|
5625
4768
|
loginToMicrosoft = async () => {
|
|
5626
4769
|
if (IS_DEV_ENV)
|
|
5627
4770
|
return;
|
|
5628
4771
|
return withCookieCache("microsoft", this.page.context(), async () => {
|
|
5629
|
-
|
|
5630
|
-
isNil(process.env.MICROSOFT_LOGIN_PASSWORD) ||
|
|
5631
|
-
isNil(process.env.MICROSOFT_2FA_SECRET_KEY)) {
|
|
5632
|
-
throw new Error("ENV variable MICROSOFT_LOGIN_EMAIL or MICROSOFT_LOGIN_PASSWORD or MICROSOFT_2FA_SECRET_KEY is not properly configured");
|
|
5633
|
-
}
|
|
4772
|
+
const env = requireEnv("MICROSOFT_LOGIN_EMAIL", "MICROSOFT_LOGIN_PASSWORD", "MICROSOFT_2FA_SECRET_KEY");
|
|
5634
4773
|
const useVerificationCodeButton = this.page.getByRole("button", {
|
|
5635
4774
|
name: MICROSOFT_LOGIN_TEXTS.useVerificationCode,
|
|
5636
4775
|
});
|
|
5637
4776
|
await this.page.goto(THIRD_PARTY_ROUTES.microsoft.login);
|
|
5638
|
-
await this.enterEmail();
|
|
4777
|
+
await this.enterEmail(env.MICROSOFT_LOGIN_EMAIL);
|
|
5639
4778
|
await this.page
|
|
5640
4779
|
.getByRole("button", { name: MICROSOFT_LOGIN_TEXTS.next })
|
|
5641
4780
|
.click();
|
|
5642
|
-
await this.enterPassword();
|
|
4781
|
+
await this.enterPassword(env.MICROSOFT_LOGIN_PASSWORD);
|
|
5643
4782
|
const signInButton = this.page.getByRole("button", {
|
|
5644
4783
|
name: MICROSOFT_LOGIN_TEXTS.signIn,
|
|
5645
4784
|
});
|
|
@@ -5830,33 +4969,27 @@ class SlackPage extends IntegrationBase {
|
|
|
5830
4969
|
loginToSlackWebapp = async (slackWebappPage, customCredentials) => {
|
|
5831
4970
|
this.slackWebappPage = slackWebappPage;
|
|
5832
4971
|
this.slackWebappPageDataQa = getByDataQA(this.slackWebappPage);
|
|
5833
|
-
const slackWorkspace = customCredentials?.workspace ||
|
|
5834
|
-
const slackLoginPassword = customCredentials?.loginPassword ||
|
|
5835
|
-
const slackLoginEmail = customCredentials?.loginEmail ||
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
await expect(redirectOpenInBrowser).toBeVisible({ timeout: 25_000 });
|
|
5855
|
-
await redirectOpenInBrowser.click();
|
|
5856
|
-
await this.setupCloseHandlers(slackWebappPage);
|
|
5857
|
-
return;
|
|
5858
|
-
}
|
|
5859
|
-
throw new Error("ENV variable SLACK_LOGIN_EMAIL or SLACK_LOGIN_PASSWORD or SLACK_WORKSPACE is not defined.");
|
|
4972
|
+
const slackWorkspace = customCredentials?.workspace || requireEnv("SLACK_WORKSPACE");
|
|
4973
|
+
const slackLoginPassword = customCredentials?.loginPassword || requireEnv("SLACK_LOGIN_PASSWORD");
|
|
4974
|
+
const slackLoginEmail = customCredentials?.loginEmail || requireEnv("SLACK_LOGIN_EMAIL");
|
|
4975
|
+
await slackWebappPage.goto(THIRD_PARTY_ROUTES.slack.loginWithPassword(slackWorkspace), { timeout: 20_000 });
|
|
4976
|
+
await slackWebappPage.waitForLoadState("load", { timeout: 25_000 });
|
|
4977
|
+
await slackWebappPage
|
|
4978
|
+
.locator(SLACK_SELECTORS.loginEmail)
|
|
4979
|
+
.pressSequentially(slackLoginEmail, { delay: 10 });
|
|
4980
|
+
await slackWebappPage
|
|
4981
|
+
.locator(SLACK_SELECTORS.loginPassword)
|
|
4982
|
+
.pressSequentially(slackLoginPassword, { delay: 10 });
|
|
4983
|
+
await slackWebappPage
|
|
4984
|
+
.locator(SLACK_SELECTORS.signInButton)
|
|
4985
|
+
.click({ timeout: 35_000 });
|
|
4986
|
+
await slackWebappPage.waitForLoadState("domcontentloaded", {
|
|
4987
|
+
timeout: 25_000,
|
|
4988
|
+
});
|
|
4989
|
+
const redirectOpenInBrowser = slackWebappPage.locator(SLACK_SELECTORS.redirectOpenInBrowser);
|
|
4990
|
+
await expect(redirectOpenInBrowser).toBeVisible({ timeout: 25_000 });
|
|
4991
|
+
await redirectOpenInBrowser.click();
|
|
4992
|
+
await this.setupCloseHandlers(slackWebappPage);
|
|
5860
4993
|
};
|
|
5861
4994
|
logoutFromSlackWebApp = async () => {
|
|
5862
4995
|
await this.slackWebappPage
|
|
@@ -5899,73 +5032,6 @@ class SlackPage extends IntegrationBase {
|
|
|
5899
5032
|
};
|
|
5900
5033
|
}
|
|
5901
5034
|
|
|
5902
|
-
class WebhooksPage {
|
|
5903
|
-
page;
|
|
5904
|
-
neetoPlaywrightUtilities;
|
|
5905
|
-
webhookSiteApi;
|
|
5906
|
-
t;
|
|
5907
|
-
constructor({ page, neetoPlaywrightUtilities }) {
|
|
5908
|
-
this.page = page;
|
|
5909
|
-
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
5910
|
-
this.t = getI18nInstance().t;
|
|
5911
|
-
this.webhookSiteApi = new WebhookSiteApi(page.request);
|
|
5912
|
-
}
|
|
5913
|
-
getTokenViaAPI = async () => {
|
|
5914
|
-
let webhookToken = null;
|
|
5915
|
-
await expect(async () => {
|
|
5916
|
-
const response = await this.webhookSiteApi.create();
|
|
5917
|
-
await expect(response).toBeOK();
|
|
5918
|
-
webhookToken = (await response.json())?.uuid;
|
|
5919
|
-
}).toPass({ timeout: 15_000 });
|
|
5920
|
-
if (!webhookToken)
|
|
5921
|
-
throw new Error("Failed to get webhook token");
|
|
5922
|
-
return {
|
|
5923
|
-
webhookToken,
|
|
5924
|
-
webhookSiteURL: `${THIRD_PARTY_ROUTES.webhooks.site}${webhookToken}`,
|
|
5925
|
-
};
|
|
5926
|
-
};
|
|
5927
|
-
addWebhook = async ({ webhookSiteURL }) => {
|
|
5928
|
-
await this.page.getByTestId(WEBHOOK_SELECTORS.addNewWebhook).click();
|
|
5929
|
-
await this.page
|
|
5930
|
-
.getByTestId(WEBHOOK_SELECTORS.endpointInputField)
|
|
5931
|
-
.fill(webhookSiteURL);
|
|
5932
|
-
await Promise.all([
|
|
5933
|
-
this.page.getByTestId(COMMON_SELECTORS.saveChangesButton).click(),
|
|
5934
|
-
this.neetoPlaywrightUtilities.verifyToast({
|
|
5935
|
-
message: this.t("resource.add", {
|
|
5936
|
-
entity: "webhook",
|
|
5937
|
-
count: 1,
|
|
5938
|
-
}),
|
|
5939
|
-
}),
|
|
5940
|
-
]);
|
|
5941
|
-
await expect(this.page.getByRole("row", { name: webhookSiteURL })).toBeVisible();
|
|
5942
|
-
};
|
|
5943
|
-
verifyLatestWebhookResponse = ({ callback = () => { }, webhookToken, parseFullResponseContent = false, timeout = 20_000, ...otherParams }) => expect(async () => {
|
|
5944
|
-
const response = await this.webhookSiteApi.fetch(webhookToken);
|
|
5945
|
-
await expect(response).toBeOK();
|
|
5946
|
-
const { content } = await response.json();
|
|
5947
|
-
const parsedResponse = parseFullResponseContent
|
|
5948
|
-
? JSON.parse(content)
|
|
5949
|
-
: JSON.parse(content).webhook;
|
|
5950
|
-
callback({ parsedResponse, ...otherParams });
|
|
5951
|
-
}).toPass({ timeout });
|
|
5952
|
-
verifyWebhookDeliveries = async ({ callback = () => { }, ...otherParams }) => {
|
|
5953
|
-
await expect(this.page.getByTestId(WEBHOOK_SELECTORS.deliveryResponseCode)).toHaveText("200");
|
|
5954
|
-
const requestPayload = (await this.page
|
|
5955
|
-
.getByTestId(WEBHOOK_SELECTORS.deliveryRequestPayload)
|
|
5956
|
-
.textContent());
|
|
5957
|
-
const parsedResponse = JSON.parse(requestPayload).webhook;
|
|
5958
|
-
callback({ parsedResponse, ...otherParams });
|
|
5959
|
-
};
|
|
5960
|
-
verifyWebhookDeliveryByEvent = async ({ event, callbackToVerifyDeliveries, ...fieldsToBeVerified }) => {
|
|
5961
|
-
await this.page.getByRole("row", { name: event }).getByRole("link").click();
|
|
5962
|
-
await this.verifyWebhookDeliveries({
|
|
5963
|
-
callback: callbackToVerifyDeliveries,
|
|
5964
|
-
...fieldsToBeVerified,
|
|
5965
|
-
});
|
|
5966
|
-
};
|
|
5967
|
-
}
|
|
5968
|
-
|
|
5969
5035
|
const simulateTypingWithDelay = async ({ field, value, delay = 500, }) => {
|
|
5970
5036
|
const minSliceLength = Math.max(3, Math.floor(value.length * 0.6));
|
|
5971
5037
|
const maxSliceLength = Math.max(4, Math.floor(value.length * 0.8));
|
|
@@ -6005,6 +5071,9 @@ class ZapierPage extends IntegrationBase {
|
|
|
6005
5071
|
zapierWebPage;
|
|
6006
5072
|
continueButton;
|
|
6007
5073
|
mailerUtils;
|
|
5074
|
+
zapId;
|
|
5075
|
+
zapierLoginEmail;
|
|
5076
|
+
zapierLoginPassword;
|
|
6008
5077
|
stepBlock;
|
|
6009
5078
|
navbar;
|
|
6010
5079
|
zapToggle;
|
|
@@ -6018,15 +5087,14 @@ class ZapierPage extends IntegrationBase {
|
|
|
6018
5087
|
neetoPlaywrightUtilities,
|
|
6019
5088
|
integrationRouteIndex,
|
|
6020
5089
|
});
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
}
|
|
5090
|
+
const env = requireEnv("ZAPIER_LOGIN_EMAIL", "ZAPIER_LOGIN_PASSWORD", "ZAP_ID");
|
|
5091
|
+
this.zapierLoginEmail = env.ZAPIER_LOGIN_EMAIL;
|
|
5092
|
+
this.zapierLoginPassword = env.ZAPIER_LOGIN_PASSWORD;
|
|
5093
|
+
this.zapId = env.ZAP_ID;
|
|
6026
5094
|
this.mailerUtils = mailerUtils;
|
|
6027
5095
|
}
|
|
6028
5096
|
gotoZapEditor = async () => {
|
|
6029
|
-
await this.zapierWebPage.goto(THIRD_PARTY_ROUTES.zapier.zapEditor(
|
|
5097
|
+
await this.zapierWebPage.goto(THIRD_PARTY_ROUTES.zapier.zapEditor(this.zapId));
|
|
6030
5098
|
await this.zapierWebPage.waitForLoadState();
|
|
6031
5099
|
await expect(this.firstStepBlock).toBeVisible({ timeout: 25_000 });
|
|
6032
5100
|
};
|
|
@@ -6136,16 +5204,16 @@ class ZapierPage extends IntegrationBase {
|
|
|
6136
5204
|
});
|
|
6137
5205
|
await simulateTypingWithDelay({
|
|
6138
5206
|
field: emailField,
|
|
6139
|
-
value:
|
|
5207
|
+
value: this.zapierLoginEmail,
|
|
6140
5208
|
});
|
|
6141
5209
|
await simulateClickWithDelay({
|
|
6142
5210
|
element: this.continueButton,
|
|
6143
5211
|
page: zapierWebPage,
|
|
6144
5212
|
});
|
|
6145
|
-
await expect(zapierWebPage.getByText(ZAPIER_WEB_TEXTS.welcomeText(
|
|
5213
|
+
await expect(zapierWebPage.getByText(ZAPIER_WEB_TEXTS.welcomeText(this.zapierLoginEmail))).toBeVisible({ timeout: 15_000 });
|
|
6146
5214
|
await simulateTypingWithDelay({
|
|
6147
5215
|
field: passwordField,
|
|
6148
|
-
value:
|
|
5216
|
+
value: this.zapierLoginPassword,
|
|
6149
5217
|
});
|
|
6150
5218
|
await simulateClickWithDelay({
|
|
6151
5219
|
element: this.continueButton,
|
|
@@ -6161,9 +5229,7 @@ class ZapierPage extends IntegrationBase {
|
|
|
6161
5229
|
});
|
|
6162
5230
|
await this.zapierWebPage.close();
|
|
6163
5231
|
};
|
|
6164
|
-
verifyZapIsTriggered = ({ productName, submittedEmail, zapTriggeredAfter, timeout = 2 * 60_000, }) =>
|
|
6165
|
-
? this.mailerUtils.findMessageV2({ to: ZAPIER_TEST_EMAIL_V2(productName), body: submittedEmail }, { timeout, receivedAfter: zapTriggeredAfter })
|
|
6166
|
-
: this.mailerUtils.findMessage({ to: ZAPIER_TEST_EMAIL(productName), body: submittedEmail }, { timeout, receivedAfter: zapTriggeredAfter });
|
|
5232
|
+
verifyZapIsTriggered = ({ productName, submittedEmail, zapTriggeredAfter, timeout = 2 * 60_000, }) => this.mailerUtils.findMessage({ to: ZAPIER_TEST_EMAIL(productName), body: submittedEmail }, { timeout, receivedAfter: zapTriggeredAfter });
|
|
6167
5233
|
skipIfTaskLimitIsExhausted = async () => {
|
|
6168
5234
|
// Zapier provides 100 free task limit for free account; skip test if it's exhausted
|
|
6169
5235
|
const universalSidebar = this.zapierWebPage.locator(ZAPIER_SELECTORS.universalSidebar);
|
|
@@ -6219,111 +5285,6 @@ class ZapierPage extends IntegrationBase {
|
|
|
6219
5285
|
await this.neetoPlaywrightUtilities.verifyToast({ message: toastMessage });
|
|
6220
5286
|
await this.verifyIntegrationStatus("disconnected");
|
|
6221
5287
|
};
|
|
6222
|
-
generateAPIKey = async (apiKeyLabel) => {
|
|
6223
|
-
await this.page.getByTestId(API_KEYS_SELECTORS.addApiKeyButton).click();
|
|
6224
|
-
await this.page
|
|
6225
|
-
.getByTestId(COMMON_SELECTORS.paneBody)
|
|
6226
|
-
.getByTestId(COMMON_SELECTORS.customInputField("label"))
|
|
6227
|
-
.fill(apiKeyLabel);
|
|
6228
|
-
await this.page.getByTestId(COMMON_SELECTORS.radioInput("zapier")).check();
|
|
6229
|
-
await this.neetoPlaywrightUtilities.saveChanges({ isPane: true });
|
|
6230
|
-
await this.page
|
|
6231
|
-
.getByRole("row", { name: apiKeyLabel })
|
|
6232
|
-
.getByTestId(COMMON_SELECTORS.copyToClipboardButton)
|
|
6233
|
-
.click();
|
|
6234
|
-
return getClipboardContent(this.page);
|
|
6235
|
-
};
|
|
6236
|
-
}
|
|
6237
|
-
|
|
6238
|
-
const MEMBER_PAGE_SIZE = 200;
|
|
6239
|
-
const NAME_SYNC_WAIT = 5_000;
|
|
6240
|
-
class Member {
|
|
6241
|
-
memberApis;
|
|
6242
|
-
constructor(neetoPlaywrightUtilities) {
|
|
6243
|
-
this.memberApis = new MemberApis(neetoPlaywrightUtilities);
|
|
6244
|
-
}
|
|
6245
|
-
addMemberViaRequest = async ({ email, role = MEMBER_TEXTS.agent, appName, subscriptionPlan = "free", }) => {
|
|
6246
|
-
let response;
|
|
6247
|
-
await expect
|
|
6248
|
-
.poll(async () => {
|
|
6249
|
-
response = await this.memberApis.create({
|
|
6250
|
-
emails: [email],
|
|
6251
|
-
organization_role: role,
|
|
6252
|
-
app_roles: [
|
|
6253
|
-
{ app_name: appName, active_role: role, is_enabled: true },
|
|
6254
|
-
],
|
|
6255
|
-
subscription_plan: subscriptionPlan,
|
|
6256
|
-
});
|
|
6257
|
-
return response?.status();
|
|
6258
|
-
}, { timeout: 30_000 })
|
|
6259
|
-
.toBe(200);
|
|
6260
|
-
const responseBodyBuffer = await response?.body();
|
|
6261
|
-
const { job_id: jobId } = JSON.parse(String(responseBodyBuffer));
|
|
6262
|
-
await expect
|
|
6263
|
-
.poll(async () => {
|
|
6264
|
-
const jobResponse = await this.memberApis.jobStatus(jobId);
|
|
6265
|
-
const responseBodyBuffer = await jobResponse?.body();
|
|
6266
|
-
const { is_completed: isCompleted, is_successful: isSuccessful, error, } = JSON.parse(String(responseBodyBuffer));
|
|
6267
|
-
if (isCompleted && !isSuccessful) {
|
|
6268
|
-
throw new Error(`Member creation failed: ${error}`);
|
|
6269
|
-
}
|
|
6270
|
-
return isCompleted;
|
|
6271
|
-
}, { timeout: 60_000 })
|
|
6272
|
-
.toBe(true);
|
|
6273
|
-
};
|
|
6274
|
-
editMemberViaRequest = async ({ email, newEmail, firstName, lastName, newRole, subscriptionPlan, }) => {
|
|
6275
|
-
const findMember = async (isRequestedMember) => {
|
|
6276
|
-
for (let page = 1;; page++) {
|
|
6277
|
-
const { members } = (await this.memberApis
|
|
6278
|
-
.fetch({ page, page_size: MEMBER_PAGE_SIZE })
|
|
6279
|
-
.then(response => response?.json()));
|
|
6280
|
-
const member = members.find(isRequestedMember);
|
|
6281
|
-
if (member || members.length < MEMBER_PAGE_SIZE)
|
|
6282
|
-
return member;
|
|
6283
|
-
}
|
|
6284
|
-
};
|
|
6285
|
-
const memberDetails = await findMember(member => member.email.toLowerCase() === email.toLowerCase());
|
|
6286
|
-
if (!memberDetails)
|
|
6287
|
-
throw new Error(`Member ${email} was not found`);
|
|
6288
|
-
await expect(async () => {
|
|
6289
|
-
await this.memberApis.update(memberDetails.id, keysToSnakeCase({
|
|
6290
|
-
active: true,
|
|
6291
|
-
firstName,
|
|
6292
|
-
lastName,
|
|
6293
|
-
organizationRole: newRole,
|
|
6294
|
-
email: newEmail,
|
|
6295
|
-
subscriptionPlan,
|
|
6296
|
-
}));
|
|
6297
|
-
if (!firstName && !lastName)
|
|
6298
|
-
return;
|
|
6299
|
-
await new Promise(resolve => setTimeout(resolve, NAME_SYNC_WAIT));
|
|
6300
|
-
const updatedMember = await findMember(({ id }) => id === memberDetails.id);
|
|
6301
|
-
expect(updatedMember, `Member ${email} was not found`).toBeDefined();
|
|
6302
|
-
firstName && expect(updatedMember?.first_name).toBe(firstName);
|
|
6303
|
-
lastName && expect(updatedMember?.last_name).toBe(lastName);
|
|
6304
|
-
}).toPass({ timeout: 60_000 });
|
|
6305
|
-
};
|
|
6306
|
-
deactivateMemberViaRequest = (email) => this.memberApis.bulkUpdate({ active: false, emails: [email] });
|
|
6307
|
-
generateRandomTeamMembers = ({ count = 1, role = "standard" }) => dynamicArray(count, () => ({
|
|
6308
|
-
firstName: faker.person.firstName(),
|
|
6309
|
-
lastName: faker.person.lastName(),
|
|
6310
|
-
email: exampleEmail(),
|
|
6311
|
-
role,
|
|
6312
|
-
}));
|
|
6313
|
-
getUserIdViaAPI = async (email) => {
|
|
6314
|
-
const response = await this.memberApis.fetch();
|
|
6315
|
-
const { members } = (await response?.json());
|
|
6316
|
-
const member = findBy({ email }, members);
|
|
6317
|
-
return member?.id;
|
|
6318
|
-
};
|
|
6319
|
-
updateEmailViaAPI = async ({ oldEmail, newEmail, role = "Admin", }) => {
|
|
6320
|
-
const userId = await this.getUserIdViaAPI(oldEmail);
|
|
6321
|
-
await this.memberApis.update(userId, keysToSnakeCase({
|
|
6322
|
-
organizationRole: role,
|
|
6323
|
-
email: newEmail,
|
|
6324
|
-
active: true,
|
|
6325
|
-
}));
|
|
6326
|
-
};
|
|
6327
5288
|
}
|
|
6328
5289
|
|
|
6329
5290
|
const DESCRIPTION_EDITOR_TEXTS = {
|
|
@@ -6614,13 +5575,7 @@ class EditorPage {
|
|
|
6614
5575
|
this.videoWrapperSelector = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.videoWrapper);
|
|
6615
5576
|
this.emojiSelector = this.toolbarOption(NEETO_EDITOR_SELECTORS.emojiOption);
|
|
6616
5577
|
const fixedMenuWrapper = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.fixedMenuWrapper);
|
|
6617
|
-
|
|
6618
|
-
const legacyMoreIcon = this.page.getByTestId(COMMON_SELECTORS.dropdownIcon);
|
|
6619
|
-
this.moreMenuSelector = IS_SHADCN_UI
|
|
6620
|
-
? fixedMenuWrapper.getByTestId(NEETO_EDITOR_SELECTORS.moreMenuOption)
|
|
6621
|
-
: fixedMenuButtons
|
|
6622
|
-
.and(legacyMoreIcon)
|
|
6623
|
-
.or(fixedMenuButtons.filter({ has: legacyMoreIcon }));
|
|
5578
|
+
this.moreMenuSelector = fixedMenuWrapper.getByTestId(NEETO_EDITOR_SELECTORS.moreMenuOption);
|
|
6624
5579
|
this.contentField = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.contentField);
|
|
6625
5580
|
this.dynamicVariablesButton = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariablesButton);
|
|
6626
5581
|
this.calloutSelector = this.toolbarOption(NEETO_EDITOR_SELECTORS.calloutOption);
|
|
@@ -6664,9 +5619,6 @@ class EditorPage {
|
|
|
6664
5619
|
if (await expandedMenuTrigger.isVisible()) {
|
|
6665
5620
|
await expandedMenuTrigger.click({ timeout: 1_000 });
|
|
6666
5621
|
}
|
|
6667
|
-
else if (!IS_SHADCN_UI) {
|
|
6668
|
-
await this.contentField.click();
|
|
6669
|
-
}
|
|
6670
5622
|
await expect(dropdownContainer).toBeHidden({ timeout: 1_000 });
|
|
6671
5623
|
}).toPass({ timeout: 10_000 });
|
|
6672
5624
|
};
|
|
@@ -6694,9 +5646,7 @@ class EditorPage {
|
|
|
6694
5646
|
await this.moreMenuSelector.click();
|
|
6695
5647
|
const dropdownContainer = this.page.getByTestId(COMMON_SELECTORS.dropdownContainer);
|
|
6696
5648
|
await expect(dropdownContainer).toBeVisible();
|
|
6697
|
-
const moreMenuButtons = await dropdownContainer
|
|
6698
|
-
.getByRole(IS_SHADCN_UI ? "menuitem" : "button")
|
|
6699
|
-
.all();
|
|
5649
|
+
const moreMenuButtons = await dropdownContainer.getByRole("menuitem").all();
|
|
6700
5650
|
const moreMenuButtonLocators = await Promise.all(moreMenuButtons.map(async (button) => {
|
|
6701
5651
|
const dataTestid = await button.getAttribute("data-testid");
|
|
6702
5652
|
return this.cleanString(dataTestid);
|
|
@@ -6705,37 +5655,7 @@ class EditorPage {
|
|
|
6705
5655
|
await expect(dropdownContainer).toBeHidden();
|
|
6706
5656
|
return moreMenuButtonLocators;
|
|
6707
5657
|
};
|
|
6708
|
-
verifyFontSize = async (isButtonInMoreMenu
|
|
6709
|
-
? this.verifyFontSizeV2(isButtonInMoreMenu)
|
|
6710
|
-
: this.verifyFontSizeV1(isButtonInMoreMenu);
|
|
6711
|
-
verifyFontSizeV1 = async (isButtonInMoreMenu) => {
|
|
6712
|
-
const fontsAndTexts = [];
|
|
6713
|
-
const fontSizeDropdown = this.page.getByTestId(NEETO_EDITOR_SELECTORS.fontSize);
|
|
6714
|
-
await this.clickToolbarOption(fontSizeDropdown, isButtonInMoreMenu);
|
|
6715
|
-
const headingButtons = await this.page
|
|
6716
|
-
.getByTestId(NEETO_EDITOR_SELECTORS.fontSizeHeadingOptions)
|
|
6717
|
-
.and(this.page.getByRole("button"))
|
|
6718
|
-
.all();
|
|
6719
|
-
const headingLevels = (await Promise.all(headingButtons.map(async (button) => {
|
|
6720
|
-
const dataTestid = await button.getAttribute("data-testid");
|
|
6721
|
-
const headingLevel = dataTestid?.split("-").pop();
|
|
6722
|
-
return /^h[1-5]$/.test(headingLevel || "") ? headingLevel : null;
|
|
6723
|
-
}))).filter(Boolean);
|
|
6724
|
-
await this.dismissToolbarMenu();
|
|
6725
|
-
for (const headingLevel of headingLevels) {
|
|
6726
|
-
const fontKey = headingLevel;
|
|
6727
|
-
const randomText = await this.fillRandomText();
|
|
6728
|
-
await this.clickToolbarOption(fontSizeDropdown, isButtonInMoreMenu);
|
|
6729
|
-
await this.page.getByTestId(FONT_SIZE_SELECTORS[fontKey]).click();
|
|
6730
|
-
await expect(this.contentField.getByRole("heading", {
|
|
6731
|
-
level: Number(headingLevel?.slice(1)),
|
|
6732
|
-
name: randomText,
|
|
6733
|
-
})).toBeVisible();
|
|
6734
|
-
fontsAndTexts.push({ key: fontKey, value: randomText });
|
|
6735
|
-
}
|
|
6736
|
-
return fontsAndTexts;
|
|
6737
|
-
};
|
|
6738
|
-
verifyFontSizeV2 = async (isButtonInMoreMenu) => {
|
|
5658
|
+
verifyFontSize = async (isButtonInMoreMenu) => {
|
|
6739
5659
|
const fontsAndTexts = [];
|
|
6740
5660
|
const fontSizeDropdown = this.page.getByTestId(NEETO_EDITOR_SELECTORS.fontSize);
|
|
6741
5661
|
await this.clickToolbarOption(fontSizeDropdown, isButtonInMoreMenu);
|
|
@@ -7073,9 +5993,7 @@ class EditorPage {
|
|
|
7073
5993
|
verifyCalloutSelector = async (isButtonInMoreMenu) => {
|
|
7074
5994
|
const calloutTypes = ["default", "info", "warning", "error", "success"];
|
|
7075
5995
|
const calloutContentField = this.contentField.locator(NEETO_EDITOR_SELECTORS.calloutContent);
|
|
7076
|
-
const calloutTypeOption =
|
|
7077
|
-
? this.page.getByTestId(NEETO_EDITOR_SELECTORS.calloutTypeOptionV2)
|
|
7078
|
-
: this.page.locator(NEETO_EDITOR_SELECTORS.calloutTypeOption);
|
|
5996
|
+
const calloutTypeOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.calloutTypeOptionV2);
|
|
7079
5997
|
await this.moveCursorAtBottom();
|
|
7080
5998
|
for (const [index, type] of calloutTypes.entries()) {
|
|
7081
5999
|
await this.clickToolbarOption(this.calloutSelector, isButtonInMoreMenu);
|
|
@@ -7289,673 +6207,70 @@ class ImageUploader {
|
|
|
7289
6207
|
aspectRatioHeight,
|
|
7290
6208
|
aspectRatioWidth,
|
|
7291
6209
|
width,
|
|
7292
|
-
height,
|
|
7293
|
-
});
|
|
7294
|
-
await this.submitCroppedImage();
|
|
7295
|
-
};
|
|
7296
|
-
selectImageFromWeb = async ({ nthImage = 0, searchTerm = "", toggleOrginalImage = false, toggleAspectRatioLock = false, aspectRatioHeight = "9", aspectRatioWidth = "16", width = "100", height = "100", } = {}) => {
|
|
7297
|
-
await this.openImageLibrary();
|
|
7298
|
-
await this.page
|
|
7299
|
-
.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.unsplashTab)
|
|
7300
|
-
.click();
|
|
7301
|
-
if (isNotEmpty(searchTerm)) {
|
|
7302
|
-
await this.page
|
|
7303
|
-
.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.unsplashSearchInput)
|
|
7304
|
-
.fill(searchTerm);
|
|
7305
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
|
|
7306
|
-
timeout: 10_000,
|
|
7307
|
-
});
|
|
7308
|
-
}
|
|
7309
|
-
await this.page
|
|
7310
|
-
.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.nthUnsplashImage(nthImage))
|
|
7311
|
-
.click();
|
|
7312
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
|
|
7313
|
-
timeout: 10_000,
|
|
7314
|
-
});
|
|
7315
|
-
toggleOrginalImage
|
|
7316
|
-
? await this.page
|
|
7317
|
-
.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.selectOriginalImageSwitch)
|
|
7318
|
-
.click()
|
|
7319
|
-
: await this.cropImage({
|
|
7320
|
-
toggleAspectRatioLock,
|
|
7321
|
-
aspectRatioHeight,
|
|
7322
|
-
aspectRatioWidth,
|
|
7323
|
-
width,
|
|
7324
|
-
height,
|
|
7325
|
-
});
|
|
7326
|
-
await this.submitCroppedImage();
|
|
7327
|
-
};
|
|
7328
|
-
selectImageFromLibrary = async ({ nthImage = 0, searchTerm = "", toggleOrginalImage = false, toggleAspectRatioLock = false, aspectRatioHeight = "9", aspectRatioWidth = "16", width = "100", height = "100", } = {}) => {
|
|
7329
|
-
await this.openImageLibrary();
|
|
7330
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
|
|
7331
|
-
timeout: 10_000,
|
|
7332
|
-
});
|
|
7333
|
-
if (isNotEmpty(searchTerm)) {
|
|
7334
|
-
await this.page
|
|
7335
|
-
.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.unsplashSearchInput)
|
|
7336
|
-
.fill(searchTerm);
|
|
7337
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
|
|
7338
|
-
timeout: 10_000,
|
|
7339
|
-
});
|
|
7340
|
-
}
|
|
7341
|
-
await this.page
|
|
7342
|
-
.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.nthLibraryImage(nthImage))
|
|
7343
|
-
.click();
|
|
7344
|
-
toggleOrginalImage
|
|
7345
|
-
? await this.page
|
|
7346
|
-
.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.selectOriginalImageSwitch)
|
|
7347
|
-
.click()
|
|
7348
|
-
: await this.cropImage({
|
|
7349
|
-
toggleAspectRatioLock,
|
|
7350
|
-
aspectRatioHeight,
|
|
7351
|
-
aspectRatioWidth,
|
|
7352
|
-
width,
|
|
7353
|
-
height,
|
|
7354
|
-
});
|
|
7355
|
-
await this.submitCroppedImage();
|
|
7356
|
-
};
|
|
7357
|
-
}
|
|
7358
|
-
|
|
7359
|
-
const openFilterPane = async (page) => {
|
|
7360
|
-
await page
|
|
7361
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.filterButton)
|
|
7362
|
-
.or(page.getByTestId(COMMON_SELECTORS.filterButon))
|
|
7363
|
-
.click();
|
|
7364
|
-
await expect(page.getByTestId(COMMON_SELECTORS.paneHeader)).toHaveText(getI18nInstance().t("neetoFilters.common.filters"));
|
|
7365
|
-
};
|
|
7366
|
-
const openFilterPaneV2 = async (page) => {
|
|
7367
|
-
await page
|
|
7368
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.filterButton)
|
|
7369
|
-
.or(page.getByTestId(COMMON_SELECTORS.filterButon))
|
|
7370
|
-
.click();
|
|
7371
|
-
await expect(page.getByTestId(NEETO_FILTERS_SELECTORS.filterPaneHeading)).toHaveText(getI18nInstance().t("neetoFilters.common.filters"));
|
|
7372
|
-
};
|
|
7373
|
-
const clearFiltersFromActionBlock = async (page) => {
|
|
7374
|
-
const isClearButtonVisible = await page
|
|
7375
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)
|
|
7376
|
-
.isVisible();
|
|
7377
|
-
if (isClearButtonVisible) {
|
|
7378
|
-
await page
|
|
7379
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)
|
|
7380
|
-
.click();
|
|
7381
|
-
await Promise.all([
|
|
7382
|
-
expect(page.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)).toBeHidden(),
|
|
7383
|
-
expect(page.locator(COMMON_SELECTORS.tableSpinner)).toHaveCount(0, {
|
|
7384
|
-
timeout: 15_000,
|
|
7385
|
-
}),
|
|
7386
|
-
]);
|
|
7387
|
-
}
|
|
7388
|
-
};
|
|
7389
|
-
const filterUtils = {
|
|
7390
|
-
openFilterPane,
|
|
7391
|
-
openFilterPaneV2,
|
|
7392
|
-
clearFiltersFromActionBlock,
|
|
7393
|
-
};
|
|
7394
|
-
|
|
7395
|
-
class TeamMembers {
|
|
7396
|
-
page;
|
|
7397
|
-
neetoPlaywrightUtilities;
|
|
7398
|
-
t;
|
|
7399
|
-
constructor({ page, neetoPlaywrightUtilities, }) {
|
|
7400
|
-
this.page = page;
|
|
7401
|
-
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
7402
|
-
this.t = getI18nInstance().t;
|
|
7403
|
-
}
|
|
7404
|
-
navigateToTeamMembers = async () => {
|
|
7405
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7406
|
-
await this.page.getByTestId(MEMBER_SELECTORS.membersTab).click();
|
|
7407
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7408
|
-
};
|
|
7409
|
-
openMemberPane = async () => {
|
|
7410
|
-
await this.page.getByTestId(MEMBER_SELECTORS.newButton).click();
|
|
7411
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7412
|
-
const continueButton = this.page.getByTestId(MEMBER_SELECTORS.continueButton);
|
|
7413
|
-
await expect(continueButton).toBeVisible();
|
|
7414
|
-
await expect(continueButton.getByTestId(COMMON_SELECTORS.uiSpinner)).toBeHidden({ timeout: 35_000 });
|
|
7415
|
-
};
|
|
7416
|
-
fillMemberForm = async (emails, role) => {
|
|
7417
|
-
await this.page
|
|
7418
|
-
.getByTestId(MEMBER_FORM_SELECTORS.emailTextField)
|
|
7419
|
-
.fill(emails.join(", "));
|
|
7420
|
-
await this.page.keyboard.press("Enter");
|
|
7421
|
-
role &&
|
|
7422
|
-
(await this.neetoPlaywrightUtilities.toggleElement({
|
|
7423
|
-
locator: this.page.getByTestId(MEMBER_SELECTORS.roleLabel(role)),
|
|
7424
|
-
}));
|
|
7425
|
-
const continueBtn = this.page.getByTestId(MEMBER_SELECTORS.continueButton);
|
|
7426
|
-
await continueBtn.click();
|
|
7427
|
-
if (IS_DEV_ENV)
|
|
7428
|
-
return;
|
|
7429
|
-
await this.page
|
|
7430
|
-
.getByTestId(COMMON_SELECTORS.paneBody)
|
|
7431
|
-
.getByTestId(COMMON_SELECTORS.checkboxLabel)
|
|
7432
|
-
.click();
|
|
7433
|
-
await continueBtn.click();
|
|
7434
|
-
};
|
|
7435
|
-
addMemberViaUI = async ({ emails = [exampleEmail()], role = "standard", } = {}) => {
|
|
7436
|
-
await this.openMemberPane();
|
|
7437
|
-
await this.fillMemberForm(emails, role);
|
|
7438
|
-
await this.submit();
|
|
7439
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7440
|
-
};
|
|
7441
|
-
submit = async () => {
|
|
7442
|
-
const pane = this.page.getByTestId(COMMON_SELECTORS.paneBody);
|
|
7443
|
-
const submitBtn = this.page.getByTestId(MEMBER_SELECTORS.submitButton);
|
|
7444
|
-
const buttonSpinner = submitBtn.getByTestId(COMMON_SELECTORS.uiSpinner);
|
|
7445
|
-
await expect(submitBtn).toBeVisible({ timeout: 10_000 });
|
|
7446
|
-
await expect(async () => {
|
|
7447
|
-
if (await pane.isHidden())
|
|
7448
|
-
return;
|
|
7449
|
-
(await buttonSpinner.isHidden()) && (await submitBtn.click());
|
|
7450
|
-
await expect(buttonSpinner).toHaveCount(0, { timeout: 10_000 });
|
|
7451
|
-
await expect(pane).toBeHidden();
|
|
7452
|
-
}).toPass({ timeout: 60_000 });
|
|
7453
|
-
await this.neetoPlaywrightUtilities.verifyToast();
|
|
7454
|
-
};
|
|
7455
|
-
searchAndVerifyMemberByEmail = async ({ email }) => {
|
|
7456
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7457
|
-
await this.page.getByTestId(MEMBER_SELECTORS.searchTextField).fill(email);
|
|
7458
|
-
const emailSubstr = email.length > 20 ? email.substring(0, 20) : email;
|
|
7459
|
-
await expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.searchTermBlock)).toContainText(emailSubstr);
|
|
7460
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7461
|
-
await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden();
|
|
7462
|
-
await expect(this.page.getByRole("cell", { name: email, exact: true })).toBeVisible();
|
|
7463
|
-
};
|
|
7464
|
-
editMemberViaUI = async ({ email = "", firstName = "", lastName = "", role = "standard", } = {}) => {
|
|
7465
|
-
await this.page.getByTestId(MEMBER_SELECTORS.dropDownIcon).click();
|
|
7466
|
-
await this.page.getByTestId(MEMBER_SELECTORS.editButton).click();
|
|
7467
|
-
await this.neetoPlaywrightUtilities.waitForPaneToLoad();
|
|
7468
|
-
await expect(this.page
|
|
7469
|
-
.getByTestId(MEMBER_SELECTORS.submitButton)
|
|
7470
|
-
.getByTestId(COMMON_SELECTORS.uiSpinner)).toHaveCount(0, { timeout: 35_000 });
|
|
7471
|
-
isPresent(email) &&
|
|
7472
|
-
(await this.page
|
|
7473
|
-
.getByTestId(MEMBER_FORM_SELECTORS.emailInput)
|
|
7474
|
-
.fill(email));
|
|
7475
|
-
isPresent(firstName) &&
|
|
7476
|
-
(await this.page
|
|
7477
|
-
.getByTestId(MEMBER_FORM_SELECTORS.firstNameTextField)
|
|
7478
|
-
.fill(firstName));
|
|
7479
|
-
isPresent(lastName) &&
|
|
7480
|
-
(await this.page
|
|
7481
|
-
.getByTestId(MEMBER_FORM_SELECTORS.lastNameTextField)
|
|
7482
|
-
.fill(lastName));
|
|
7483
|
-
await this.neetoPlaywrightUtilities.toggleElement({
|
|
7484
|
-
locator: this.page.getByTestId(MEMBER_SELECTORS.roleLabel(role)),
|
|
7485
|
-
});
|
|
7486
|
-
await this.submit();
|
|
7487
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7488
|
-
};
|
|
7489
|
-
removeMemberViaUI = async (parentLocator = this.page) => {
|
|
7490
|
-
await parentLocator.getByTestId(MEMBER_SELECTORS.dropDownIcon).click();
|
|
7491
|
-
await this.page.getByTestId(MEMBER_SELECTORS.removeMember).click();
|
|
7492
|
-
await this.page
|
|
7493
|
-
.getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
|
|
7494
|
-
.click();
|
|
7495
|
-
await this.neetoPlaywrightUtilities.verifyToast();
|
|
7496
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7497
|
-
};
|
|
7498
|
-
openFilterPane = async () => {
|
|
7499
|
-
await this.page
|
|
7500
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.filterButton)
|
|
7501
|
-
.or(this.page.getByTestId(COMMON_SELECTORS.filterButon))
|
|
7502
|
-
.click();
|
|
7503
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.paneHeader)).toHaveText(this.t("neetoFilters.common.filters"));
|
|
7504
|
-
};
|
|
7505
|
-
filterMembersByMultiSelect = async ({ selectedOptions = [], selectContainerLocator = NEETO_FILTERS_SELECTORS.roleSelectContainer, }) => {
|
|
7506
|
-
await this.page
|
|
7507
|
-
.getByTestId(selectContainerLocator)
|
|
7508
|
-
.getByTestId(COMMON_SELECTORS.actionSelectIndicator)
|
|
7509
|
-
.click();
|
|
7510
|
-
for (const option of selectedOptions) {
|
|
7511
|
-
await this.page
|
|
7512
|
-
.getByTestId(COMMON_SELECTORS.selectOption(option))
|
|
7513
|
-
.click();
|
|
7514
|
-
}
|
|
7515
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7516
|
-
await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden();
|
|
7517
|
-
};
|
|
7518
|
-
filterMembers = async ({ email = { id: "", condition: "Is" }, roles = [], name = "", }) => {
|
|
7519
|
-
await filterUtils.clearFiltersFromActionBlock(this.page);
|
|
7520
|
-
await filterUtils.openFilterPane(this.page);
|
|
7521
|
-
if (isPresent(email.id)) {
|
|
7522
|
-
await this.page
|
|
7523
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.emailSelectContainer)
|
|
7524
|
-
.getByTestId(COMMON_SELECTORS.actionSelectIndicator)
|
|
7525
|
-
.click();
|
|
7526
|
-
await this.page
|
|
7527
|
-
.getByTestId(COMMON_SELECTORS.selectOption(email.condition))
|
|
7528
|
-
.click();
|
|
7529
|
-
await this.page
|
|
7530
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.filtersEmailFilter)
|
|
7531
|
-
.fill(email.id);
|
|
7532
|
-
}
|
|
7533
|
-
isPresent(name) &&
|
|
7534
|
-
(await this.page
|
|
7535
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersNameFilterField)
|
|
7536
|
-
.fill(name));
|
|
7537
|
-
isPresent(roles) &&
|
|
7538
|
-
(await this.filterMembersByMultiSelect({ selectedOptions: roles }));
|
|
7539
|
-
await this.applyFilter();
|
|
7540
|
-
};
|
|
7541
|
-
getMemberRowByName = (name) => this.page.getByRole("row").filter({
|
|
7542
|
-
has: this.page.getByTestId(MEMBER_SELECTORS.memberNameCell(name)),
|
|
7543
|
-
});
|
|
7544
|
-
takeActionOnMembers = async ({ names = [], state, action, }) => {
|
|
7545
|
-
if (isPresent(names)) {
|
|
7546
|
-
for (const name of names) {
|
|
7547
|
-
await this.getMemberRowByName(name).getByRole("checkbox").click();
|
|
7548
|
-
}
|
|
7549
|
-
}
|
|
7550
|
-
else {
|
|
7551
|
-
await this.page
|
|
7552
|
-
.getByRole("columnheader", { name: MEMBER_TEXTS.selectAll })
|
|
7553
|
-
.click();
|
|
7554
|
-
}
|
|
7555
|
-
await this.page.getByTestId(COMMON_SELECTORS.takeActionDropdown).click();
|
|
7556
|
-
if (isPresent(state)) {
|
|
7557
|
-
await this.page
|
|
7558
|
-
.getByTestId(MEMBER_SELECTORS.takeActionStateOption(state))
|
|
7559
|
-
.click();
|
|
7560
|
-
}
|
|
7561
|
-
else {
|
|
7562
|
-
await this.page
|
|
7563
|
-
.getByRole("button", { name: action?.actionButtonText })
|
|
7564
|
-
.click();
|
|
7565
|
-
await this.page
|
|
7566
|
-
.getByRole("button", { name: action?.valueButtonText })
|
|
7567
|
-
.click();
|
|
7568
|
-
}
|
|
7569
|
-
await this.page
|
|
7570
|
-
.getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
|
|
7571
|
-
.click();
|
|
7572
|
-
await this.neetoPlaywrightUtilities.verifyToast();
|
|
7573
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7574
|
-
};
|
|
7575
|
-
performColumnAction = async ({ columnName = "Name", actionButtonText = "Ascending", } = {}) => {
|
|
7576
|
-
await this.page
|
|
7577
|
-
.getByTestId(MEMBER_SELECTORS.teamMembersTable)
|
|
7578
|
-
.getByLabel(columnName)
|
|
7579
|
-
.getByTestId(TABLE_SELECTORS.columnMenuButton)
|
|
7580
|
-
.click();
|
|
7581
|
-
await this.page.getByRole("button", { name: actionButtonText }).click();
|
|
7582
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7583
|
-
await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden();
|
|
7584
|
-
};
|
|
7585
|
-
toggleMemberColumns = async ({ columns = [], bulkAction, }) => {
|
|
7586
|
-
await expect(async () => {
|
|
7587
|
-
await this.page
|
|
7588
|
-
.getByTestId(COMMON_SELECTORS.columnsDropdownButton)
|
|
7589
|
-
.click();
|
|
7590
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.columnsSearchInput)).toBeVisible();
|
|
7591
|
-
}).toPass({ timeout: 15_000 });
|
|
7592
|
-
if (isPresent(bulkAction)) {
|
|
7593
|
-
await this.page
|
|
7594
|
-
.getByTestId(COMMON_SELECTORS.columnVisibilityBtn(bulkAction === "hide" ? "hide-all" : "reset"))
|
|
7595
|
-
.click();
|
|
7596
|
-
}
|
|
7597
|
-
else {
|
|
7598
|
-
for (const column of columns) {
|
|
7599
|
-
await this.page
|
|
7600
|
-
.getByTestId(COMMON_SELECTORS.columnsSearchInput)
|
|
7601
|
-
.fill(column);
|
|
7602
|
-
const columnCheckbox = this.page
|
|
7603
|
-
.getByTestId(COMMON_SELECTORS.nuiCheckboxContainer)
|
|
7604
|
-
.filter({ hasText: column })
|
|
7605
|
-
.getByTestId(MEMBER_SELECTORS.columnCheckBox);
|
|
7606
|
-
const isChecked = await columnCheckbox.isChecked();
|
|
7607
|
-
await columnCheckbox.click();
|
|
7608
|
-
await expect(columnCheckbox).toBeChecked({ checked: !isChecked });
|
|
7609
|
-
}
|
|
7610
|
-
}
|
|
7611
|
-
await this.page.getByTestId(COMMON_SELECTORS.columnsDropdownButton).click();
|
|
7612
|
-
};
|
|
7613
|
-
verifyMemberInTable = ({ name, email }) => expect(this.getMemberRowByName(name).getByRole("cell", {
|
|
7614
|
-
name: email,
|
|
7615
|
-
exact: true,
|
|
7616
|
-
})).toBeVisible();
|
|
7617
|
-
applyFilter = async () => {
|
|
7618
|
-
await expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)).toBeVisible();
|
|
7619
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7620
|
-
await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden({
|
|
7621
|
-
timeout: 30_000,
|
|
7622
|
-
});
|
|
7623
|
-
await this.page
|
|
7624
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.filterDoneButton)
|
|
7625
|
-
.click();
|
|
7626
|
-
};
|
|
7627
|
-
exportDetails = async (fileType, adminEmail) => {
|
|
7628
|
-
await this.page.getByTestId(MEMBER_SELECTORS.downloadButton).click();
|
|
7629
|
-
await expect(this.page.getByTestId(MEMBER_SELECTORS.exportMemberHeading)).toHaveText(this.t("neetoTeamMembers.exportPane.title"));
|
|
7630
|
-
await this.page
|
|
7631
|
-
.getByTestId(MEMBER_SELECTORS.downloadAsRadioItem(fileType))
|
|
7632
|
-
.check();
|
|
7633
|
-
const exportStartTime = new Date();
|
|
7634
|
-
await this.page.getByTestId(MEMBER_SELECTORS.exportSubmitBtn).click();
|
|
7635
|
-
await this.neetoPlaywrightUtilities.verifyToast({
|
|
7636
|
-
message: this.t("toastr.success.exportMembers", { email: adminEmail }),
|
|
7637
|
-
});
|
|
7638
|
-
return exportStartTime;
|
|
7639
|
-
};
|
|
7640
|
-
verifyNoDataTitle = async (email) => {
|
|
7641
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7642
|
-
await this.page.getByTestId(MEMBER_SELECTORS.searchTextField).fill(email);
|
|
7643
|
-
await expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)).toBeVisible();
|
|
7644
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.noDataTitle)).toBeVisible({ timeout: 10_000 });
|
|
7645
|
-
await filterUtils.clearFiltersFromActionBlock(this.page);
|
|
7646
|
-
};
|
|
7647
|
-
}
|
|
7648
|
-
class TeamMembersV2 extends TeamMembers {
|
|
7649
|
-
fillMemberForm = async (emails, role) => {
|
|
7650
|
-
await this.page
|
|
7651
|
-
.getByTestId(MEMBER_FORM_SELECTORS.emailTextField)
|
|
7652
|
-
.pressSequentially(emails.join(", "));
|
|
7653
|
-
const continueBtn = this.page.getByTestId(MEMBER_SELECTORS.continueButton);
|
|
7654
|
-
await this.page.keyboard.press("Enter");
|
|
7655
|
-
await expect(continueBtn).toBeEnabled();
|
|
7656
|
-
role &&
|
|
7657
|
-
(await this.neetoPlaywrightUtilities.toggleElement({
|
|
7658
|
-
locator: this.page.getByRole("radio", { name: role, exact: true }),
|
|
7659
|
-
}));
|
|
7660
|
-
await continueBtn.click();
|
|
7661
|
-
if (IS_DEV_ENV)
|
|
7662
|
-
return;
|
|
7663
|
-
await this.page.getByTestId(MEMBER_SELECTORS.manageAppListChk).click();
|
|
7664
|
-
await continueBtn.click();
|
|
7665
|
-
};
|
|
7666
|
-
openMemberPane = async () => {
|
|
7667
|
-
await this.page.getByTestId(MEMBER_SELECTORS.newButton).click();
|
|
7668
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7669
|
-
const continueButton = this.page.getByTestId(MEMBER_SELECTORS.continueButton);
|
|
7670
|
-
await expect(continueButton).toBeVisible();
|
|
7671
|
-
await this.neetoPlaywrightUtilities.waitForSheetOpen();
|
|
7672
|
-
await expect(continueButton.getByTestId(COMMON_SELECTORS.uiSpinner)).toBeHidden({ timeout: 35_000 });
|
|
7673
|
-
};
|
|
7674
|
-
addMemberViaUI = async ({ emails = [exampleEmail()], role = "standard", } = {}) => {
|
|
7675
|
-
await this.openMemberPane();
|
|
7676
|
-
await this.fillMemberForm(emails, role);
|
|
7677
|
-
await this.submit();
|
|
7678
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7679
|
-
};
|
|
7680
|
-
submit = async () => {
|
|
7681
|
-
const pane = this.page.getByRole("dialog");
|
|
7682
|
-
const submitBtn = this.page.getByTestId(MEMBER_SELECTORS.submitButton);
|
|
7683
|
-
const buttonSpinner = submitBtn.getByTestId(COMMON_SELECTORS.uiSpinner);
|
|
7684
|
-
await expect(submitBtn).toBeVisible({ timeout: 10_000 });
|
|
7685
|
-
await expect(async () => {
|
|
7686
|
-
if (await pane.isHidden())
|
|
7687
|
-
return;
|
|
7688
|
-
(await buttonSpinner.isHidden()) && (await submitBtn.click());
|
|
7689
|
-
await expect(buttonSpinner).toHaveCount(0, { timeout: 10_000 });
|
|
7690
|
-
await expect(pane).toBeHidden();
|
|
7691
|
-
}).toPass({ timeout: 60_000 });
|
|
7692
|
-
await this.neetoPlaywrightUtilities.verifyToast();
|
|
7693
|
-
};
|
|
7694
|
-
editMemberViaUI = async ({ email = "", firstName = "", lastName = "", role = "standard", } = {}) => {
|
|
7695
|
-
await expect(this.page.getByTestId(MEMBER_SELECTORS.dropDownIcon)).toHaveCount(1);
|
|
7696
|
-
await this.page.getByTestId(MEMBER_SELECTORS.dropDownIcon).click();
|
|
7697
|
-
await this.page.getByTestId(MEMBER_SELECTORS.editButton).click();
|
|
7698
|
-
const editPane = this.page.getByRole("dialog");
|
|
7699
|
-
await expect(editPane).toBeVisible({ timeout: 35_000 });
|
|
7700
|
-
await expect(editPane.getByTestId(COMMON_SELECTORS.uiSpinner)).toHaveCount(0, { timeout: 35_000 });
|
|
7701
|
-
await expect(this.page
|
|
7702
|
-
.getByTestId(MEMBER_SELECTORS.submitButton)
|
|
7703
|
-
.getByTestId(COMMON_SELECTORS.uiSpinner)).toHaveCount(0, { timeout: 35_000 });
|
|
7704
|
-
await this.neetoPlaywrightUtilities.waitForSheetOpen();
|
|
7705
|
-
isPresent(email) &&
|
|
7706
|
-
(await this.page
|
|
7707
|
-
.getByTestId(MEMBER_FORM_SELECTORS.emailInput)
|
|
7708
|
-
.fill(email));
|
|
7709
|
-
isPresent(firstName) &&
|
|
7710
|
-
(await this.page
|
|
7711
|
-
.getByTestId(MEMBER_FORM_SELECTORS.firstNameTextField)
|
|
7712
|
-
.fill(firstName));
|
|
7713
|
-
isPresent(lastName) &&
|
|
7714
|
-
(await this.page
|
|
7715
|
-
.getByTestId(MEMBER_FORM_SELECTORS.lastNameTextField)
|
|
7716
|
-
.fill(lastName));
|
|
7717
|
-
await this.neetoPlaywrightUtilities.toggleElement({
|
|
7718
|
-
locator: this.page.getByRole("radio", { name: role, exact: true }),
|
|
7719
|
-
});
|
|
7720
|
-
await this.submit();
|
|
7721
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7722
|
-
};
|
|
7723
|
-
openFilterPane = async () => {
|
|
7724
|
-
await this.page
|
|
7725
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.filterButton)
|
|
7726
|
-
.or(this.page.getByTestId(COMMON_SELECTORS.filterButon))
|
|
7727
|
-
.click();
|
|
7728
|
-
await expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.filterPaneHeading)).toHaveText(this.t("neetoFilters.common.filters"));
|
|
7729
|
-
};
|
|
7730
|
-
filterMembersByMultiSelect = async ({ selectedOptions = [], selectContainerLocator = NEETO_FILTERS_SELECTORS.roleSelectContainer, }) => {
|
|
7731
|
-
await this.page
|
|
7732
|
-
.getByTestId(selectContainerLocator)
|
|
7733
|
-
.getByRole("combobox")
|
|
7734
|
-
.click({ timeout: 30_000 });
|
|
7735
|
-
for (const option of selectedOptions) {
|
|
7736
|
-
await this.page
|
|
7737
|
-
.getByRole("option", { name: option, exact: true })
|
|
7738
|
-
.click();
|
|
7739
|
-
}
|
|
7740
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7741
|
-
await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden();
|
|
7742
|
-
};
|
|
7743
|
-
filterMembers = async ({ email = { id: "", condition: "Is" }, roles = [], name = "", }) => {
|
|
7744
|
-
await filterUtils.clearFiltersFromActionBlock(this.page);
|
|
7745
|
-
await this.openFilterPane();
|
|
7746
|
-
if (isPresent(email.id)) {
|
|
7747
|
-
await this.page
|
|
7748
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.emailSelectContainer)
|
|
7749
|
-
.getByRole("combobox")
|
|
7750
|
-
.click();
|
|
7751
|
-
await this.page
|
|
7752
|
-
.getByRole("option", { name: email.condition, exact: true })
|
|
7753
|
-
.click();
|
|
7754
|
-
await this.page
|
|
7755
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.filtersEmailFilter)
|
|
7756
|
-
.fill(email.id);
|
|
7757
|
-
}
|
|
7758
|
-
isPresent(name) &&
|
|
7759
|
-
(await this.page
|
|
7760
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersNameFilterField)
|
|
7761
|
-
.fill(name));
|
|
7762
|
-
isPresent(roles) &&
|
|
7763
|
-
(await this.filterMembersByMultiSelect({ selectedOptions: roles }));
|
|
7764
|
-
await this.applyFilter();
|
|
7765
|
-
};
|
|
7766
|
-
verifyNoDataTitle = async (email) => {
|
|
7767
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7768
|
-
await this.page.getByTestId(MEMBER_SELECTORS.searchTextField).fill(email);
|
|
7769
|
-
await expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)).toBeVisible();
|
|
7770
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.noDataTitleV2)).toBeVisible({ timeout: 10_000 });
|
|
7771
|
-
await filterUtils.clearFiltersFromActionBlock(this.page);
|
|
7772
|
-
};
|
|
7773
|
-
applyFilter = async () => {
|
|
7774
|
-
await expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)).toBeVisible();
|
|
7775
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7776
|
-
await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden({
|
|
7777
|
-
timeout: 30_000,
|
|
7778
|
-
});
|
|
7779
|
-
await this.page
|
|
7780
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.filterDoneButton)
|
|
7781
|
-
.click();
|
|
7782
|
-
await this.neetoPlaywrightUtilities.waitForSheetClose();
|
|
7783
|
-
};
|
|
7784
|
-
performColumnAction = async ({ columnName = "Name", actionButtonText = "Ascending", } = {}) => {
|
|
7785
|
-
await this.page
|
|
7786
|
-
.getByTestId(TABLE_SELECTORS.columnHeaderTitle(hyphenate(columnName)))
|
|
7787
|
-
.getByTestId(TABLE_SELECTORS.columnMenuButton)
|
|
7788
|
-
.click();
|
|
7789
|
-
await this.page.getByRole("menuitem", { name: actionButtonText }).click();
|
|
7790
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7791
|
-
await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden();
|
|
7792
|
-
};
|
|
7793
|
-
takeActionOnMembers = async ({ names = [], state, action, }) => {
|
|
7794
|
-
if (isPresent(names)) {
|
|
7795
|
-
for (const name of names) {
|
|
7796
|
-
await this.getMemberRowByName(name).getByRole("checkbox").click();
|
|
7797
|
-
}
|
|
7798
|
-
}
|
|
7799
|
-
else {
|
|
7800
|
-
await this.page
|
|
7801
|
-
.getByRole("columnheader", { name: MEMBER_TEXTS.selectAll })
|
|
7802
|
-
.click();
|
|
7803
|
-
}
|
|
7804
|
-
await this.page.getByTestId(MEMBER_SELECTORS.takeActionDropdown).click();
|
|
7805
|
-
if (isPresent(state)) {
|
|
7806
|
-
await this.page
|
|
7807
|
-
.getByTestId(MEMBER_SELECTORS.takeActionStateOption(state))
|
|
7808
|
-
.click();
|
|
7809
|
-
}
|
|
7810
|
-
else {
|
|
7811
|
-
await this.page
|
|
7812
|
-
.getByRole("menuitem", { name: action?.actionButtonText })
|
|
7813
|
-
.click();
|
|
7814
|
-
await this.page
|
|
7815
|
-
.getByRole("menuitem", { name: action?.valueButtonText })
|
|
7816
|
-
.click();
|
|
7817
|
-
}
|
|
7818
|
-
await this.page
|
|
7819
|
-
.getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
|
|
7820
|
-
.click();
|
|
7821
|
-
await this.neetoPlaywrightUtilities.verifyToast();
|
|
7822
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
7823
|
-
};
|
|
7824
|
-
}
|
|
7825
|
-
|
|
7826
|
-
dayjs.extend(customParseFormat);
|
|
7827
|
-
class ApiKeysPage {
|
|
7828
|
-
page;
|
|
7829
|
-
neetoPlaywrightUtilities;
|
|
7830
|
-
t;
|
|
7831
|
-
constructor(page, neetoPlaywrightUtilities) {
|
|
7832
|
-
this.page = page;
|
|
7833
|
-
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
7834
|
-
this.t = getI18nInstance().t;
|
|
7835
|
-
}
|
|
7836
|
-
enableExpiryDate = async (expiryDate) => {
|
|
7837
|
-
const userProps = await getGlobalUserProps(this.page);
|
|
7838
|
-
const normalizedDate = dayjs(expiryDate, DATE_FORMATS.date);
|
|
7839
|
-
const formattedExpiryDate = normalizedDate.format(userProps?.dateFormat);
|
|
7840
|
-
const expiryDateInput = this.page
|
|
7841
|
-
.getByTestId(COMMON_SELECTORS.paneBody)
|
|
7842
|
-
.getByTestId(ADMIN_PANEL_SELECTORS.expiryDateInput);
|
|
7843
|
-
const nextYearBtn = this.page.getByLabel(DATE_TEXTS.nextYear, {
|
|
7844
|
-
exact: true,
|
|
7845
|
-
});
|
|
7846
|
-
await this.page
|
|
7847
|
-
.getByTestId(COMMON_SELECTORS.checkboxInput("never-expires"))
|
|
7848
|
-
.uncheck();
|
|
7849
|
-
await expiryDateInput.click();
|
|
7850
|
-
await expect(nextYearBtn).toBeVisible();
|
|
7851
|
-
await expiryDateInput.pressSequentially(formattedExpiryDate, {
|
|
7852
|
-
delay: 250,
|
|
7853
|
-
});
|
|
7854
|
-
await Promise.all([
|
|
7855
|
-
expect(expiryDateInput).toHaveValue(formattedExpiryDate),
|
|
7856
|
-
expect(this.page.getByRole("button", { name: CALENDAR_LABELS.month })).toHaveText(normalizedDate.format(DATE_FORMATS.month)),
|
|
7857
|
-
expect(this.page.getByRole("button", { name: CALENDAR_LABELS.year })).toHaveText(normalizedDate.format(DATE_FORMATS.year)),
|
|
7858
|
-
expect(this.page.getByTitle(normalizedDate.format(DATE_FORMATS.calendarDate))).toHaveClass(RegExp(DATE_PICKER_SELECTORS.selectedDateInCalendarClass)),
|
|
7859
|
-
]);
|
|
7860
|
-
await this.page.keyboard.press("Enter");
|
|
7861
|
-
await expect(nextYearBtn).toBeHidden({ timeout: 15_000 });
|
|
7862
|
-
};
|
|
7863
|
-
fillApiKeyDetails = async ({ label, expiryDate }) => {
|
|
7864
|
-
await this.page
|
|
7865
|
-
.getByTestId(COMMON_SELECTORS.paneBody)
|
|
7866
|
-
.getByTestId(COMMON_SELECTORS.customInputField("name"))
|
|
7867
|
-
.fill(label);
|
|
7868
|
-
isPresent(expiryDate) && (await this.enableExpiryDate(expiryDate));
|
|
7869
|
-
await this.neetoPlaywrightUtilities.saveChanges({ isPane: true });
|
|
7870
|
-
};
|
|
7871
|
-
verifyApiKey = ({ targetRow, label, date }) => Promise.all([
|
|
7872
|
-
expect(targetRow.getByRole("cell", { name: label })).toBeVisible(),
|
|
7873
|
-
expect(targetRow.getByRole("cell", { name: date })).toBeVisible(),
|
|
7874
|
-
expect(targetRow.getByRole("cell", {
|
|
7875
|
-
name: this.t("neetoApiKeys.common.never"),
|
|
7876
|
-
})).toBeVisible(),
|
|
7877
|
-
expect(targetRow.getByTestId(TAGS_SELECTORS.tagContainer)).toHaveText(this.t("neetoApiKeys.tags.active")),
|
|
7878
|
-
]);
|
|
7879
|
-
editApiKey = async ({ label, expiryDate }) => {
|
|
7880
|
-
await this.page
|
|
7881
|
-
.getByTestId(COMMON_SELECTORS.dropdownContainer)
|
|
7882
|
-
.getByTestId(API_KEYS_SELECTORS.editApiKeyButton)
|
|
7883
|
-
.click();
|
|
7884
|
-
await this.fillApiKeyDetails({ label, expiryDate });
|
|
6210
|
+
height,
|
|
6211
|
+
});
|
|
6212
|
+
await this.submitCroppedImage();
|
|
7885
6213
|
};
|
|
7886
|
-
|
|
7887
|
-
await
|
|
6214
|
+
selectImageFromWeb = async ({ nthImage = 0, searchTerm = "", toggleOrginalImage = false, toggleAspectRatioLock = false, aspectRatioHeight = "9", aspectRatioWidth = "16", width = "100", height = "100", } = {}) => {
|
|
6215
|
+
await this.openImageLibrary();
|
|
7888
6216
|
await this.page
|
|
7889
|
-
.getByTestId(
|
|
7890
|
-
.getByTestId(API_KEYS_SELECTORS.deleteApiKeyButton)
|
|
6217
|
+
.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.unsplashTab)
|
|
7891
6218
|
.click();
|
|
6219
|
+
if (isNotEmpty(searchTerm)) {
|
|
6220
|
+
await this.page
|
|
6221
|
+
.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.unsplashSearchInput)
|
|
6222
|
+
.fill(searchTerm);
|
|
6223
|
+
await expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
|
|
6224
|
+
timeout: 10_000,
|
|
6225
|
+
});
|
|
6226
|
+
}
|
|
7892
6227
|
await this.page
|
|
7893
|
-
.getByTestId(
|
|
6228
|
+
.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.nthUnsplashImage(nthImage))
|
|
7894
6229
|
.click();
|
|
7895
|
-
await this.
|
|
7896
|
-
|
|
7897
|
-
};
|
|
7898
|
-
}
|
|
7899
|
-
class ApiKeysPageV2 extends ApiKeysPage {
|
|
7900
|
-
enableExpiryDate = async (expiryDate) => {
|
|
7901
|
-
const dialog = this.page.getByRole("dialog");
|
|
7902
|
-
const neverExpiresCheckbox = dialog.getByRole("checkbox", {
|
|
7903
|
-
name: this.t("neetoApiKeys.fields.neverExpire"),
|
|
7904
|
-
});
|
|
7905
|
-
await expect(async () => {
|
|
7906
|
-
await neverExpiresCheckbox.uncheck();
|
|
7907
|
-
await expect(neverExpiresCheckbox).not.toBeChecked();
|
|
7908
|
-
}).toPass({ timeout: 10_000 });
|
|
7909
|
-
const userProps = await getGlobalUserProps(this.page);
|
|
7910
|
-
const formattedExpiryDate = dayjs(expiryDate, DATE_FORMATS.date).format(userProps?.dateFormat);
|
|
7911
|
-
const expiryDateInput = dialog.getByRole("textbox", {
|
|
7912
|
-
name: this.t("neetoApiKeys.fields.expiryDate"),
|
|
6230
|
+
await expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
|
|
6231
|
+
timeout: 10_000,
|
|
7913
6232
|
});
|
|
7914
|
-
|
|
7915
|
-
await
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
await expect(saveChangesButton).toBeEnabled({ timeout: 10_000 });
|
|
7927
|
-
await saveChangesButton.click();
|
|
7928
|
-
await Promise.all([
|
|
7929
|
-
expect(dialog).toBeHidden(),
|
|
7930
|
-
this.neetoPlaywrightUtilities.verifyToast(),
|
|
7931
|
-
]);
|
|
7932
|
-
};
|
|
7933
|
-
verifyApiKey = ({ targetRow, label, date }) => Promise.all([
|
|
7934
|
-
expect(targetRow.getByRole("cell", { name: label })).toBeVisible(),
|
|
7935
|
-
expect(targetRow.getByRole("cell", { name: date })).toBeVisible(),
|
|
7936
|
-
expect(targetRow.getByRole("cell", {
|
|
7937
|
-
name: this.t("neetoApiKeys.common.never"),
|
|
7938
|
-
})).toBeVisible(),
|
|
7939
|
-
expect(targetRow.getByTestId(COMMON_SELECTORS.badgeContainer)).toHaveText(this.t("neetoApiKeys.tags.active")),
|
|
7940
|
-
]);
|
|
7941
|
-
editApiKey = async ({ label, expiryDate }) => {
|
|
7942
|
-
await this.page
|
|
7943
|
-
.getByRole("menu")
|
|
7944
|
-
.getByTestId(API_KEYS_SELECTORS.editApiKeyButton)
|
|
7945
|
-
.click();
|
|
7946
|
-
await this.fillApiKeyDetails({ label, expiryDate });
|
|
6233
|
+
toggleOrginalImage
|
|
6234
|
+
? await this.page
|
|
6235
|
+
.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.selectOriginalImageSwitch)
|
|
6236
|
+
.click()
|
|
6237
|
+
: await this.cropImage({
|
|
6238
|
+
toggleAspectRatioLock,
|
|
6239
|
+
aspectRatioHeight,
|
|
6240
|
+
aspectRatioWidth,
|
|
6241
|
+
width,
|
|
6242
|
+
height,
|
|
6243
|
+
});
|
|
6244
|
+
await this.submitCroppedImage();
|
|
7947
6245
|
};
|
|
7948
|
-
|
|
7949
|
-
await
|
|
7950
|
-
await this.page
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
6246
|
+
selectImageFromLibrary = async ({ nthImage = 0, searchTerm = "", toggleOrginalImage = false, toggleAspectRatioLock = false, aspectRatioHeight = "9", aspectRatioWidth = "16", width = "100", height = "100", } = {}) => {
|
|
6247
|
+
await this.openImageLibrary();
|
|
6248
|
+
await expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
|
|
6249
|
+
timeout: 10_000,
|
|
6250
|
+
});
|
|
6251
|
+
if (isNotEmpty(searchTerm)) {
|
|
6252
|
+
await this.page
|
|
6253
|
+
.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.unsplashSearchInput)
|
|
6254
|
+
.fill(searchTerm);
|
|
6255
|
+
await expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
|
|
6256
|
+
timeout: 10_000,
|
|
6257
|
+
});
|
|
6258
|
+
}
|
|
7954
6259
|
await this.page
|
|
7955
|
-
.getByTestId(
|
|
6260
|
+
.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.nthLibraryImage(nthImage))
|
|
7956
6261
|
.click();
|
|
7957
|
-
|
|
7958
|
-
|
|
6262
|
+
toggleOrginalImage
|
|
6263
|
+
? await this.page
|
|
6264
|
+
.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.selectOriginalImageSwitch)
|
|
6265
|
+
.click()
|
|
6266
|
+
: await this.cropImage({
|
|
6267
|
+
toggleAspectRatioLock,
|
|
6268
|
+
aspectRatioHeight,
|
|
6269
|
+
aspectRatioWidth,
|
|
6270
|
+
width,
|
|
6271
|
+
height,
|
|
6272
|
+
});
|
|
6273
|
+
await this.submitCroppedImage();
|
|
7959
6274
|
};
|
|
7960
6275
|
}
|
|
7961
6276
|
|
|
@@ -7978,15 +6293,11 @@ dayjs.extend(timezone);
|
|
|
7978
6293
|
class AuditLogsPage {
|
|
7979
6294
|
page;
|
|
7980
6295
|
neetoPlaywrightUtilities;
|
|
7981
|
-
currentDate;
|
|
7982
6296
|
messageBuilders;
|
|
7983
6297
|
admin;
|
|
7984
|
-
constructor(page, neetoPlaywrightUtilities
|
|
7985
|
-
/** @deprecated Audit log messages no longer include the product name. */
|
|
7986
|
-
_product, timeZone = "Asia/Kolkata") {
|
|
6298
|
+
constructor(page, neetoPlaywrightUtilities) {
|
|
7987
6299
|
this.page = page;
|
|
7988
6300
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
7989
|
-
this.currentDate = dayjs().tz(timeZone).format("MMM D, YYYY");
|
|
7990
6301
|
this.messageBuilders = {
|
|
7991
6302
|
[ACTIONS.inviteUsers]: (data) => `${this.admin} added ${data.emails.join(", ").toLowerCase()}.`,
|
|
7992
6303
|
[ACTIONS.updatedUser]: (data) => `${this.admin} changed ${data.emails[0].toLowerCase()}'s email from ${data.emails[0].toLowerCase()} to ${data.emails[1].toLowerCase()}.`,
|
|
@@ -8017,8 +6328,10 @@ class AuditLogsPage {
|
|
|
8017
6328
|
// eslint-disable-next-line playwright/no-nth-methods
|
|
8018
6329
|
const card = this.page.getByTestId(AUDIT_LOGS_SELECTORS.card).first();
|
|
8019
6330
|
const content = card.getByTestId(AUDIT_LOGS_SELECTORS.content);
|
|
6331
|
+
const { timeZone } = await getGlobalUserProps(this.page);
|
|
6332
|
+
const currentDate = dayjs().tz(timeZone).format("MMM D, YYYY");
|
|
8020
6333
|
await Promise.all([
|
|
8021
|
-
expect(content.getByTestId(AUDIT_LOGS_SELECTORS.timestamp)).toContainText(
|
|
6334
|
+
expect(content.getByTestId(AUDIT_LOGS_SELECTORS.timestamp)).toContainText(currentDate),
|
|
8022
6335
|
expect(content.getByTestId(AUDIT_LOGS_SELECTORS.text)).toHaveText(expectedMessage),
|
|
8023
6336
|
]);
|
|
8024
6337
|
};
|
|
@@ -8110,9 +6423,7 @@ class CustomDomainPage {
|
|
|
8110
6423
|
const validateButton = this.page.getByTestId(CUSTOM_DOMAIN_SELECTORS.customDomainValidateButton);
|
|
8111
6424
|
await Promise.all([
|
|
8112
6425
|
expect(validateButton).toBeVisible(),
|
|
8113
|
-
expect(this.
|
|
8114
|
-
name: domain.split(".")[0],
|
|
8115
|
-
})).toBeVisible(),
|
|
6426
|
+
expect(this.validationSheet.getByRole("cell", { name: domain.split(".")[0] })).toBeVisible(),
|
|
8116
6427
|
]);
|
|
8117
6428
|
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
8118
6429
|
await validateButton.click();
|
|
@@ -8157,7 +6468,7 @@ class CustomDomainPage {
|
|
|
8157
6468
|
const organizationPage = new OrganizationPage(loginPage, playwrightUtils);
|
|
8158
6469
|
await loginPage.goto(loginUrl);
|
|
8159
6470
|
await playwrightUtils.waitForPageLoad();
|
|
8160
|
-
await organizationPage.
|
|
6471
|
+
await organizationPage.login({ email });
|
|
8161
6472
|
await expect(loginPage).toHaveURL(RegExp(loginUrl), { timeout: 15_000 });
|
|
8162
6473
|
await playwrightUtils.waitForPageLoad();
|
|
8163
6474
|
};
|
|
@@ -8311,19 +6622,19 @@ class CustomDomainPage {
|
|
|
8311
6622
|
waitUntil: "load",
|
|
8312
6623
|
}));
|
|
8313
6624
|
};
|
|
8314
|
-
|
|
8315
|
-
|
|
6625
|
+
get validationSheet() {
|
|
6626
|
+
return this.page.getByTestId(COMMON_SELECTORS.sheetWrapper);
|
|
6627
|
+
}
|
|
8316
6628
|
getCertificateInfrastructureSkipReason = async () => {
|
|
8317
|
-
|
|
8318
|
-
if (await pane
|
|
6629
|
+
if (await this.validationSheet
|
|
8319
6630
|
.getByText(RegExp(CERTIFICATE_LIMIT_EXCEEDED_REGEXP, "i"))
|
|
8320
6631
|
.isVisible()) {
|
|
8321
6632
|
return CERTIFICATE_LIMIT_EXCEEDED_MESSAGE;
|
|
8322
6633
|
}
|
|
8323
6634
|
const message = this.t("neetoCustomDomains.certificateProvisionFailed");
|
|
8324
6635
|
const [hasProvisionFailedMessage, hasProvisionFailedFallback] = await Promise.all([
|
|
8325
|
-
|
|
8326
|
-
|
|
6636
|
+
this.validationSheet.getByText(message).isVisible(),
|
|
6637
|
+
this.validationSheet
|
|
8327
6638
|
.getByText(RegExp(CERTIFICATE_PROVISION_FAILED_REGEXP, "i"))
|
|
8328
6639
|
.isVisible(),
|
|
8329
6640
|
]);
|
|
@@ -8333,7 +6644,7 @@ class CustomDomainPage {
|
|
|
8333
6644
|
return null;
|
|
8334
6645
|
};
|
|
8335
6646
|
closeValidationPane = async () => {
|
|
8336
|
-
const cancelButton = this.
|
|
6647
|
+
const cancelButton = this.validationSheet.getByTestId(COMMON_SELECTORS.cancelButton);
|
|
8337
6648
|
if (await cancelButton.isVisible())
|
|
8338
6649
|
await cancelButton.click();
|
|
8339
6650
|
};
|
|
@@ -8404,145 +6715,6 @@ class IPRestrictionsPage {
|
|
|
8404
6715
|
};
|
|
8405
6716
|
}
|
|
8406
6717
|
|
|
8407
|
-
class RolesPage {
|
|
8408
|
-
page;
|
|
8409
|
-
neetoPlaywrightUtilities;
|
|
8410
|
-
roleApis;
|
|
8411
|
-
t;
|
|
8412
|
-
constructor(page, neetoPlaywrightUtilities) {
|
|
8413
|
-
this.page = page;
|
|
8414
|
-
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
8415
|
-
this.roleApis = new RoleApis(neetoPlaywrightUtilities);
|
|
8416
|
-
this.t = getI18nInstance().t;
|
|
8417
|
-
}
|
|
8418
|
-
getPermissionIds = async (targetPermissions, isGranularPermission = false) => {
|
|
8419
|
-
const { permissions } = await this.roleApis
|
|
8420
|
-
.fetch("permissions")
|
|
8421
|
-
.then(response => response?.json());
|
|
8422
|
-
const permissionObjects = targetPermissions.flatMap(permission => permissions.filter((p) => isGranularPermission
|
|
8423
|
-
? p.description === permission
|
|
8424
|
-
: p.category === permission));
|
|
8425
|
-
return pluck("id", permissionObjects);
|
|
8426
|
-
};
|
|
8427
|
-
getRoleIdAndOrganizationId = async (roleName) => {
|
|
8428
|
-
const roles = await this.roleApis
|
|
8429
|
-
.fetch("organization_roles")
|
|
8430
|
-
.then(response => response?.json());
|
|
8431
|
-
const { id: roleId, organization_id: organizationId } = findBy({ name: roleName }, roles.organization_roles);
|
|
8432
|
-
return { roleId, organizationId };
|
|
8433
|
-
};
|
|
8434
|
-
addCustomRoleViaRequest = async (roleName, targetPermissions, isGranularPermission = false) => {
|
|
8435
|
-
const permissionIds = await this.getPermissionIds(targetPermissions, isGranularPermission);
|
|
8436
|
-
return this.roleApis.addRole(roleName, permissionIds);
|
|
8437
|
-
};
|
|
8438
|
-
editRoleViaRequest = async (roleName, targetPermissions, isGranularPermission = false) => {
|
|
8439
|
-
const [permissionIds, { roleId, organizationId }] = await Promise.all([
|
|
8440
|
-
this.getPermissionIds(targetPermissions, isGranularPermission),
|
|
8441
|
-
this.getRoleIdAndOrganizationId(roleName),
|
|
8442
|
-
]);
|
|
8443
|
-
return this.roleApis.editRole(roleId, {
|
|
8444
|
-
id: roleId,
|
|
8445
|
-
kind: "custom",
|
|
8446
|
-
name: roleName,
|
|
8447
|
-
organization_id: organizationId,
|
|
8448
|
-
permission_ids: permissionIds,
|
|
8449
|
-
});
|
|
8450
|
-
};
|
|
8451
|
-
deleteRoleViaRequest = async (roleName, secondaryRoleName = "Editor") => {
|
|
8452
|
-
const [{ roleId }, { roleId: secondaryRoleId }] = await Promise.all([roleName, secondaryRoleName].map(this.getRoleIdAndOrganizationId));
|
|
8453
|
-
return this.roleApis.deleteRole(roleId, secondaryRoleId);
|
|
8454
|
-
};
|
|
8455
|
-
addRoleViaUI = async ({ roleName, permissions, parentPermission = "", hierarchyLevelOfPermissions = 2, }) => {
|
|
8456
|
-
await this.page.getByTestId(ROLES_SELECTORS.newButton).click();
|
|
8457
|
-
await this.page.getByTestId(ROLES_SELECTORS.nameTextField).fill(roleName);
|
|
8458
|
-
await this.selectAndSubmitPermissions(permissions, parentPermission, hierarchyLevelOfPermissions);
|
|
8459
|
-
};
|
|
8460
|
-
editRoleViaUI = async ({ roleName, permissions, parentPermission = "", hierarchyLevelOfPermissions = 2, }) => {
|
|
8461
|
-
await this.page
|
|
8462
|
-
.getByTestId(ROLES_SELECTORS.tableHeaderRoleName)
|
|
8463
|
-
.filter({ hasText: roleName })
|
|
8464
|
-
.getByTestId(ROLES_SELECTORS.dropDownIcon)
|
|
8465
|
-
.click();
|
|
8466
|
-
await this.page.getByTestId(ROLES_SELECTORS.editRoleButton).click();
|
|
8467
|
-
await expect(this.page.getByTestId(ROLES_SELECTORS.updateRolePaneHeading)).toBeVisible();
|
|
8468
|
-
await this.selectAndSubmitPermissions(permissions, parentPermission, hierarchyLevelOfPermissions);
|
|
8469
|
-
};
|
|
8470
|
-
selectAndSubmitPermissions = async (permissions, parentPermission = "", hierarchyLevelOfPermissions = 2) => {
|
|
8471
|
-
const parentPermissionSelector = parentPermission
|
|
8472
|
-
? this.page
|
|
8473
|
-
.getByTestId(ROLES_SELECTORS.permissionSubCategoryCard(hierarchyLevelOfPermissions - 1))
|
|
8474
|
-
.filter({ hasText: parentPermission })
|
|
8475
|
-
: this.page;
|
|
8476
|
-
parentPermission &&
|
|
8477
|
-
(await parentPermissionSelector
|
|
8478
|
-
.getByTestId(COMMON_SELECTORS.customCheckboxLabel(parentPermission))
|
|
8479
|
-
.click({ force: true }));
|
|
8480
|
-
for (const permission of permissions) {
|
|
8481
|
-
await parentPermissionSelector
|
|
8482
|
-
.getByTestId(COMMON_SELECTORS.customCheckboxLabel(permission))
|
|
8483
|
-
.click({ force: true }); // Used force: true because disabling the parent permission disables the child permissions means the checkboxes label become disable
|
|
8484
|
-
}
|
|
8485
|
-
await Promise.all([
|
|
8486
|
-
this.page.getByTestId(ROLES_SELECTORS.proceedButton).click(),
|
|
8487
|
-
this.neetoPlaywrightUtilities.verifyToast(),
|
|
8488
|
-
]);
|
|
8489
|
-
};
|
|
8490
|
-
deleteRoleViaUI = async (roleName) => {
|
|
8491
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
8492
|
-
await this.page
|
|
8493
|
-
.getByTestId(ROLES_SELECTORS.tableHeaderRoleName)
|
|
8494
|
-
.filter({ hasText: roleName })
|
|
8495
|
-
.getByTestId(ROLES_SELECTORS.dropDownIcon)
|
|
8496
|
-
.click();
|
|
8497
|
-
await this.page.getByTestId(ROLES_SELECTORS.deleteRoleButton).click();
|
|
8498
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.alertTitle)).toHaveText(this.t("neetoTeamMembers.labels.deleteRole"));
|
|
8499
|
-
await this.neetoPlaywrightUtilities.clickButtonAndAwaitLoad({
|
|
8500
|
-
locator: this.page.getByTestId(COMMON_SELECTORS.alertModalSubmitButton),
|
|
8501
|
-
});
|
|
8502
|
-
await this.neetoPlaywrightUtilities.verifyToast();
|
|
8503
|
-
await expect(this.page
|
|
8504
|
-
.getByTestId(ROLES_SELECTORS.tableHeaderRoleTitle)
|
|
8505
|
-
.filter({ hasText: roleName })).toBeHidden();
|
|
8506
|
-
};
|
|
8507
|
-
verifyPermissions = ({ allPermissions, rolePermissions, }) => Promise.all(Object.values(allPermissions).map(async (permission) => rolePermissions.includes(permission)
|
|
8508
|
-
? await expect(this.page.getByTestId(permission)).toBeVisible()
|
|
8509
|
-
: await expect(this.page.getByTestId(permission)).toBeHidden()));
|
|
8510
|
-
verifyRoleSpecificLinkAccess = async ({ roleAccessableLinks = [], adminAccessableLinks = [], }) => {
|
|
8511
|
-
if (isNotEqualDeep(roleAccessableLinks, adminAccessableLinks)) {
|
|
8512
|
-
for (const link of adminAccessableLinks) {
|
|
8513
|
-
await this.page.goto(link);
|
|
8514
|
-
await this.neetoPlaywrightUtilities.waitForFloatingMenu();
|
|
8515
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
8516
|
-
await expect(this.page.getByRole("heading", {
|
|
8517
|
-
name: this.t("neetoMolecules.errorPage.unauthorized"),
|
|
8518
|
-
}))[roleAccessableLinks.includes(link) ? "toBeHidden" : "toBeVisible"]();
|
|
8519
|
-
}
|
|
8520
|
-
}
|
|
8521
|
-
};
|
|
8522
|
-
}
|
|
8523
|
-
class RolesPageV2 extends RolesPage {
|
|
8524
|
-
selectAndSubmitPermissions = async (permissions, parentPermission = "", hierarchyLevelOfPermissions = 2) => {
|
|
8525
|
-
const parentPermissionSelector = parentPermission
|
|
8526
|
-
? this.page
|
|
8527
|
-
.getByTestId(ROLES_SELECTORS.permissionSubCategoryCard(hierarchyLevelOfPermissions - 1))
|
|
8528
|
-
.filter({ hasText: parentPermission })
|
|
8529
|
-
: this.page;
|
|
8530
|
-
parentPermission &&
|
|
8531
|
-
(await parentPermissionSelector
|
|
8532
|
-
.getByLabel(parentPermission, { exact: true })
|
|
8533
|
-
.click());
|
|
8534
|
-
for (const permission of permissions) {
|
|
8535
|
-
await parentPermissionSelector
|
|
8536
|
-
.getByLabel(permission, { exact: true })
|
|
8537
|
-
.click();
|
|
8538
|
-
}
|
|
8539
|
-
await Promise.all([
|
|
8540
|
-
this.page.getByTestId(ROLES_SELECTORS.proceedButton).click(),
|
|
8541
|
-
this.neetoPlaywrightUtilities.verifyToast(),
|
|
8542
|
-
]);
|
|
8543
|
-
};
|
|
8544
|
-
}
|
|
8545
|
-
|
|
8546
6718
|
class SidebarSection {
|
|
8547
6719
|
page;
|
|
8548
6720
|
neetoPlaywrightUtilities;
|
|
@@ -8556,123 +6728,6 @@ class SidebarSection {
|
|
|
8556
6728
|
clickOnGoBackButton = (label) => this.page.getByTestId(COMMON_SELECTORS.sidebarGoBackButton(label)).click();
|
|
8557
6729
|
}
|
|
8558
6730
|
|
|
8559
|
-
class TagsPage {
|
|
8560
|
-
page;
|
|
8561
|
-
neetoPlaywrightUtilities;
|
|
8562
|
-
t;
|
|
8563
|
-
tagsApi;
|
|
8564
|
-
constructor(page, neetoPlaywrightUtilities) {
|
|
8565
|
-
this.page = page;
|
|
8566
|
-
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
8567
|
-
this.t = getI18nInstance().t;
|
|
8568
|
-
this.tagsApi = new TagsApi(neetoPlaywrightUtilities);
|
|
8569
|
-
}
|
|
8570
|
-
searchAndVerifyTags = async (tagName) => {
|
|
8571
|
-
await this.page.getByTestId(TAGS_SELECTORS.searchTextField).fill(tagName);
|
|
8572
|
-
await expect(this.page.getByRole("row", { name: tagName })).toBeVisible();
|
|
8573
|
-
};
|
|
8574
|
-
addTagViaUI = async ({ tagName, addTagsLabel, }) => {
|
|
8575
|
-
await this.page
|
|
8576
|
-
.getByTestId(COMMON_SELECTORS.header)
|
|
8577
|
-
.getByTestId(TAGS_SELECTORS.newTagButton)
|
|
8578
|
-
.click();
|
|
8579
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.sheetHeader)).toHaveText(addTagsLabel);
|
|
8580
|
-
await this.page.getByTestId(TAGS_SELECTORS.tagNameTextField).fill(tagName);
|
|
8581
|
-
await this.page
|
|
8582
|
-
.getByTestId(TAGS_SELECTORS.descriptionTextArea)
|
|
8583
|
-
.fill(faker.lorem.word(7));
|
|
8584
|
-
await this.page.getByTestId(TAGS_SELECTORS.submitButton).click();
|
|
8585
|
-
await this.neetoPlaywrightUtilities.verifyToast();
|
|
8586
|
-
await this.neetoPlaywrightUtilities.waitForSheetClose();
|
|
8587
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
8588
|
-
};
|
|
8589
|
-
filterTagsViaUI = async (tagName) => {
|
|
8590
|
-
const nameBlock = this.page.getByTestId(NEETO_FILTERS_SELECTORS.neetoFilterNameBlock);
|
|
8591
|
-
const rows = this.page.getByRole("row");
|
|
8592
|
-
const tagRow = this.page.getByRole("row", { name: tagName });
|
|
8593
|
-
await filterUtils.openFilterPaneV2(this.page);
|
|
8594
|
-
await this.page
|
|
8595
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersNameFilterField)
|
|
8596
|
-
.fill(tagName);
|
|
8597
|
-
await this.page.waitForURL(new RegExp(tagName));
|
|
8598
|
-
await this.page
|
|
8599
|
-
.getByTestId(NEETO_FILTERS_SELECTORS.filterDoneButton)
|
|
8600
|
-
.click();
|
|
8601
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
8602
|
-
await Promise.all([
|
|
8603
|
-
expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.filterPaneHeading)).toBeHidden(),
|
|
8604
|
-
expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)).toBeVisible(),
|
|
8605
|
-
expect(nameBlock).toContainText(tagName),
|
|
8606
|
-
expect(tagRow).toBeVisible(),
|
|
8607
|
-
expect(rows).toHaveCount(2),
|
|
8608
|
-
]);
|
|
8609
|
-
await filterUtils.clearFiltersFromActionBlock(this.page);
|
|
8610
|
-
await Promise.all([
|
|
8611
|
-
expect(nameBlock).toBeHidden(),
|
|
8612
|
-
expect(tagRow).toBeVisible(),
|
|
8613
|
-
expect(rows).not.toHaveCount(2),
|
|
8614
|
-
]);
|
|
8615
|
-
};
|
|
8616
|
-
editTagViaUI = async ({ tagName, newTagName, }) => {
|
|
8617
|
-
await this.page
|
|
8618
|
-
.getByRole("row", { name: tagName })
|
|
8619
|
-
.getByTestId(COMMON_SELECTORS.dropdownIcon)
|
|
8620
|
-
.click();
|
|
8621
|
-
await this.page.getByTestId(TAGS_SELECTORS.editButton).click();
|
|
8622
|
-
await this.page
|
|
8623
|
-
.getByTestId(TAGS_SELECTORS.tagNameTextField)
|
|
8624
|
-
.fill(newTagName);
|
|
8625
|
-
await this.page.getByTestId(TAGS_SELECTORS.submitButton).click();
|
|
8626
|
-
await this.neetoPlaywrightUtilities.verifyToast();
|
|
8627
|
-
await expect(this.page.getByRole("row", { name: tagName })).toBeHidden();
|
|
8628
|
-
await expect(this.page.getByRole("row", { name: newTagName })).toBeVisible();
|
|
8629
|
-
};
|
|
8630
|
-
deleteTagViaUI = async (tagName) => {
|
|
8631
|
-
await this.page
|
|
8632
|
-
.getByRole("row", { name: tagName })
|
|
8633
|
-
.getByTestId(COMMON_SELECTORS.dropdownIcon)
|
|
8634
|
-
.click();
|
|
8635
|
-
await this.page.getByTestId(TAGS_SELECTORS.deleteButton).click();
|
|
8636
|
-
await this.page
|
|
8637
|
-
.getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
|
|
8638
|
-
.click();
|
|
8639
|
-
await this.neetoPlaywrightUtilities.verifyToast();
|
|
8640
|
-
await expect(this.page.getByRole("row", { name: tagName })).toBeHidden();
|
|
8641
|
-
};
|
|
8642
|
-
addTagsViaRequest = ({ name, description = "", tagsRequestUrl, }) => this.tagsApi.create({ body: { name, description }, tagsRequestUrl });
|
|
8643
|
-
navigateToMergeTagsPage = async () => {
|
|
8644
|
-
await this.page.getByTestId(MERGE_TAGS_SELECTORS.mergeTagsButton).click();
|
|
8645
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
8646
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.heading)).toHaveText(this.t("neetoTags.common.mergeTag_other"));
|
|
8647
|
-
};
|
|
8648
|
-
searchAndSelect = async ({ selector, tagName, rowSelector, }) => {
|
|
8649
|
-
await this.page.getByTestId(selector).fill(tagName);
|
|
8650
|
-
await this.page
|
|
8651
|
-
.getByTestId(rowSelector)
|
|
8652
|
-
.filter({ hasText: tagName })
|
|
8653
|
-
.click();
|
|
8654
|
-
};
|
|
8655
|
-
mergeAndVerifyTagsViaUI = async ({ sourceTagName, destinationTagName, tagsBreadcrumbSelector, }) => {
|
|
8656
|
-
await this.searchAndSelect({
|
|
8657
|
-
selector: MERGE_TAGS_SELECTORS.sourceSearchTextField,
|
|
8658
|
-
tagName: sourceTagName,
|
|
8659
|
-
rowSelector: MERGE_TAGS_SELECTORS.sourceTagRow,
|
|
8660
|
-
});
|
|
8661
|
-
await this.searchAndSelect({
|
|
8662
|
-
selector: MERGE_TAGS_SELECTORS.destinationSearchTextField,
|
|
8663
|
-
tagName: destinationTagName,
|
|
8664
|
-
rowSelector: MERGE_TAGS_SELECTORS.destinationTagRow,
|
|
8665
|
-
});
|
|
8666
|
-
await this.page.getByTestId(MERGE_TAGS_SELECTORS.mergeButton).click();
|
|
8667
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS.dialogHeader)).toHaveText(this.t("neetoTags.common.mergeTag_other"));
|
|
8668
|
-
await this.page.getByTestId(MERGE_TAGS_SELECTORS.proceedButton).click();
|
|
8669
|
-
await this.neetoPlaywrightUtilities.verifyToast();
|
|
8670
|
-
await this.page.getByTestId(tagsBreadcrumbSelector).click();
|
|
8671
|
-
await expect(this.page.getByText(sourceTagName)).toBeHidden();
|
|
8672
|
-
await expect(this.page.getByText(destinationTagName)).toBeVisible();
|
|
8673
|
-
};
|
|
8674
|
-
}
|
|
8675
|
-
|
|
8676
6731
|
const USER_AGENTS = {
|
|
8677
6732
|
windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/154.0.0.0 Safari/537.36",
|
|
8678
6733
|
mac: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/154.0.0.0 Safari/537.36",
|
|
@@ -8730,10 +6785,6 @@ const FILE_FORMATS = {
|
|
|
8730
6785
|
gif: "gif",
|
|
8731
6786
|
};
|
|
8732
6787
|
|
|
8733
|
-
const TEAM_MEMBER_TEXTS = {
|
|
8734
|
-
emailSubject: "Your team members export is here",
|
|
8735
|
-
};
|
|
8736
|
-
|
|
8737
6788
|
const KEYBOARD_SHORTCUT_TEST_CASES = [
|
|
8738
6789
|
{ os: "windows", agent: USER_AGENTS.windows },
|
|
8739
6790
|
{ os: "mac", agent: USER_AGENTS.mac },
|
|
@@ -9099,128 +7150,83 @@ const toggleColumnCheckboxAndVerifyVisibility = async ({ page, tableColumns, sho
|
|
|
9099
7150
|
});
|
|
9100
7151
|
}
|
|
9101
7152
|
};
|
|
7153
|
+
// The checkbox column and some product columns render no column menu, so only
|
|
7154
|
+
// the columns between the first and last menu are frozen and unfrozen.
|
|
9102
7155
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9103
7156
|
const verifyFreezeColumnAction = async (page, _t) => {
|
|
9104
7157
|
const columnHeader = page.getByRole("columnheader");
|
|
9105
|
-
const
|
|
7158
|
+
const columnsDropdown = page.getByTestId(COMMON_SELECTORS.columnsDropdownContainer);
|
|
7159
|
+
(await columnsDropdown.isVisible()) && (await page.keyboard.press("Escape"));
|
|
7160
|
+
await expect(columnsDropdown).toBeHidden();
|
|
7161
|
+
// A column menu only appears once the real header row has rendered, so wait
|
|
7162
|
+
// for one before reading the headers.
|
|
7163
|
+
await expect(
|
|
7164
|
+
// eslint-disable-next-line playwright/no-nth-methods
|
|
7165
|
+
columnHeader.getByTestId(TABLE_SELECTORS.columnMenuButton).first()).toBeAttached();
|
|
7166
|
+
const [columnHeaders, originalColumnNames] = await Promise.all([
|
|
9106
7167
|
columnHeader.all(),
|
|
9107
7168
|
columnHeader.allTextContents(),
|
|
9108
|
-
columnHeader.getByRole("checkbox").isVisible(),
|
|
9109
7169
|
]);
|
|
9110
|
-
const
|
|
9111
|
-
const
|
|
9112
|
-
moreThanFiveColumns &&
|
|
9113
|
-
(await page.evaluate(() => {
|
|
9114
|
-
document.body.style.zoom = "0.25";
|
|
9115
|
-
}));
|
|
9116
|
-
await unFreezeAllColumns({ columnHeaders, columnOffset, page });
|
|
9117
|
-
await toggleColumnState({ columnHeaders, columnOffset, page });
|
|
9118
|
-
await validateColumnNames(columnHeaders, columnOffset, originalColumnNames);
|
|
9119
|
-
await toggleColumnState({
|
|
7170
|
+
const hasMenu = await Promise.all(columnHeaders.map(async (header) => (await header.getByTestId(TABLE_SELECTORS.columnMenuButton).count()) > 0));
|
|
7171
|
+
const range = {
|
|
9120
7172
|
columnHeaders,
|
|
9121
|
-
|
|
9122
|
-
|
|
7173
|
+
firstIndex: hasMenu.indexOf(true),
|
|
7174
|
+
lastIndex: hasMenu.lastIndexOf(true),
|
|
9123
7175
|
page,
|
|
9124
|
-
}
|
|
9125
|
-
|
|
9126
|
-
moreThanFiveColumns &&
|
|
9127
|
-
(await page.evaluate(() => {
|
|
9128
|
-
document.body.style.zoom = "1";
|
|
9129
|
-
}));
|
|
9130
|
-
};
|
|
9131
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9132
|
-
const verifyFreezeColumnActionV2 = async (page, _t) => {
|
|
9133
|
-
const columnHeader = page.getByRole("columnheader");
|
|
9134
|
-
const [columnHeaders, originalColumnNames, checkboxVisible] = await Promise.all([
|
|
9135
|
-
columnHeader.all(),
|
|
9136
|
-
columnHeader.allTextContents(),
|
|
9137
|
-
columnHeader.getByRole("checkbox").isVisible(),
|
|
9138
|
-
]);
|
|
9139
|
-
const columnOffset = checkboxVisible ? 1 : 0;
|
|
7176
|
+
};
|
|
7177
|
+
expect(range.firstIndex, "No column renders a column menu, so this table offers no column freeze").toBeGreaterThan(-1);
|
|
9140
7178
|
const moreThanFiveColumns = columnHeaders.length > 5;
|
|
9141
7179
|
moreThanFiveColumns &&
|
|
9142
7180
|
(await page.evaluate(() => {
|
|
9143
7181
|
document.body.style.zoom = "0.25";
|
|
9144
7182
|
}));
|
|
9145
|
-
await
|
|
9146
|
-
await
|
|
9147
|
-
await
|
|
9148
|
-
await
|
|
9149
|
-
columnHeaders,
|
|
9150
|
-
columnOffset,
|
|
9151
|
-
action: "Unfreeze",
|
|
9152
|
-
page,
|
|
9153
|
-
});
|
|
7183
|
+
await unFreezeAllColumns(range);
|
|
7184
|
+
await toggleColumnState(range);
|
|
7185
|
+
await validateColumnNames(range, originalColumnNames);
|
|
7186
|
+
await toggleColumnState({ ...range, action: "Unfreeze" });
|
|
9154
7187
|
await expect(columnHeader).toHaveText(originalColumnNames);
|
|
9155
7188
|
moreThanFiveColumns &&
|
|
9156
7189
|
(await page.evaluate(() => {
|
|
9157
7190
|
document.body.style.zoom = "1";
|
|
9158
7191
|
}));
|
|
9159
7192
|
};
|
|
9160
|
-
const
|
|
9161
|
-
const
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
: await currentHeader
|
|
9169
|
-
.getByTestId(TABLE_SELECTORS.columnMenuButton)
|
|
9170
|
-
.click();
|
|
9171
|
-
}
|
|
7193
|
+
const openColumnMenu = async (page, columnHeader) => {
|
|
7194
|
+
const menu = page.getByRole("menu");
|
|
7195
|
+
(await page.getByTestId(COMMON_SELECTORS.tooltip).isVisible()) &&
|
|
7196
|
+
(await page.mouse.move(0, 0));
|
|
7197
|
+
// Let the previous menu finish its close animation, or two menus match below.
|
|
7198
|
+
await expect(menu).toHaveCount(0);
|
|
7199
|
+
await columnHeader.getByTestId(TABLE_SELECTORS.columnMenuButton).click();
|
|
7200
|
+
await expect(menu).toBeVisible();
|
|
9172
7201
|
};
|
|
9173
|
-
const
|
|
7202
|
+
const unFreezeAllColumns = async ({ columnHeaders, firstIndex, lastIndex, page, }) => {
|
|
9174
7203
|
const unFreezeColumnButton = freezeUnfreezeMenuItem(page, TABLE_COLUMN_TEXTS.unfreezeColumn);
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
7204
|
+
// Escape closes the Radix menu visually but can leave `body` with
|
|
7205
|
+
// `pointer-events: none`, blocking the next column; closing it through its
|
|
7206
|
+
// trigger lets Radix clean up.
|
|
7207
|
+
const openColumnMenuButton = page
|
|
7208
|
+
.getByTestId(TABLE_SELECTORS.columnMenuButton)
|
|
7209
|
+
.and(page.locator('[aria-expanded="true"]'));
|
|
7210
|
+
for (let i = lastIndex; i >= firstIndex; i--) {
|
|
7211
|
+
await openColumnMenu(page, columnHeaders[i]);
|
|
9179
7212
|
(await unFreezeColumnButton.isVisible())
|
|
9180
7213
|
? await unFreezeColumnButton.click()
|
|
9181
|
-
: await
|
|
9182
|
-
}
|
|
9183
|
-
};
|
|
9184
|
-
const toggleColumnState = async ({ columnHeaders, columnOffset, action = "Freeze", page, }) => {
|
|
9185
|
-
const firstColumnIndex = columnOffset;
|
|
9186
|
-
const lastColumnIndex = columnHeaders.length - 1;
|
|
9187
|
-
const targetIndex = action === "Freeze" ? lastColumnIndex : firstColumnIndex;
|
|
9188
|
-
const toggleButton = freezeUnfreezeMenuItem(page, action === "Freeze"
|
|
9189
|
-
? TABLE_COLUMN_TEXTS.freezeColumn
|
|
9190
|
-
: TABLE_COLUMN_TEXTS.unfreezeColumn);
|
|
9191
|
-
for (let i = firstColumnIndex; i < lastColumnIndex; i++) {
|
|
9192
|
-
const columnHeader = columnHeaders[targetIndex];
|
|
9193
|
-
(await page.getByTestId(COMMON_SELECTORS.tooltip).isVisible()) &&
|
|
9194
|
-
(await page.mouse.move(0, 0));
|
|
9195
|
-
await columnHeader.getByTestId(TABLE_SELECTORS.columnMenuButton).click();
|
|
9196
|
-
await toggleButton.click();
|
|
7214
|
+
: await openColumnMenuButton.click({ force: true });
|
|
9197
7215
|
}
|
|
9198
7216
|
};
|
|
9199
|
-
const
|
|
9200
|
-
const
|
|
9201
|
-
const lastColumnIndex = columnHeaders.length - 1;
|
|
9202
|
-
const targetIndex = action === "Freeze" ? lastColumnIndex : firstColumnIndex;
|
|
7217
|
+
const toggleColumnState = async ({ columnHeaders, firstIndex, lastIndex, action = "Freeze", page, }) => {
|
|
7218
|
+
const targetIndex = action === "Freeze" ? lastIndex : firstIndex;
|
|
9203
7219
|
const toggleButton = freezeUnfreezeMenuItem(page, action === "Freeze"
|
|
9204
7220
|
? TABLE_COLUMN_TEXTS.freezeColumn
|
|
9205
7221
|
: TABLE_COLUMN_TEXTS.unfreezeColumn);
|
|
9206
|
-
for (let i =
|
|
9207
|
-
|
|
9208
|
-
(await page.getByTestId(COMMON_SELECTORS.tooltip).isVisible()) &&
|
|
9209
|
-
(await page.mouse.move(0, 0));
|
|
9210
|
-
await columnHeader.getByTestId(TABLE_SELECTORS.columnMenuButton).click();
|
|
7222
|
+
for (let i = firstIndex; i < lastIndex; i++) {
|
|
7223
|
+
await openColumnMenu(page, columnHeaders[targetIndex]);
|
|
9211
7224
|
await toggleButton.click();
|
|
9212
7225
|
}
|
|
9213
7226
|
};
|
|
9214
|
-
const validateColumnNames = async (columnHeaders,
|
|
9215
|
-
for (let i =
|
|
9216
|
-
|
|
9217
|
-
await expect(columnHeaders[i]).toHaveText(expectedName);
|
|
9218
|
-
}
|
|
9219
|
-
};
|
|
9220
|
-
const validateColumnNamesV2 = async (columnHeaders, columnOffset, originalColumnNames) => {
|
|
9221
|
-
const lastColumnIndex = columnHeaders.length - 1;
|
|
9222
|
-
for (let i = columnOffset; i < lastColumnIndex; i++) {
|
|
9223
|
-
await expect(columnHeaders[i]).toHaveText(originalColumnNames[columnOffset + lastColumnIndex - i]);
|
|
7227
|
+
const validateColumnNames = async ({ columnHeaders, firstIndex, lastIndex }, originalColumnNames) => {
|
|
7228
|
+
for (let i = firstIndex; i < lastIndex; i++) {
|
|
7229
|
+
await expect(columnHeaders[i]).toHaveText(originalColumnNames[firstIndex + lastIndex - i]);
|
|
9224
7230
|
}
|
|
9225
7231
|
};
|
|
9226
7232
|
const verifyReorderColumns = async (page) => {
|
|
@@ -9263,7 +7269,6 @@ const tableUtils = {
|
|
|
9263
7269
|
assertColumnHeaderVisibility,
|
|
9264
7270
|
toggleColumnCheckboxAndVerifyVisibility,
|
|
9265
7271
|
verifyFreezeColumnAction,
|
|
9266
|
-
verifyFreezeColumnActionV2,
|
|
9267
7272
|
verifyReorderColumns,
|
|
9268
7273
|
};
|
|
9269
7274
|
|
|
@@ -9298,6 +7303,34 @@ const executeWithThrottledResources = async ({ code: emulatedCode, kind = "both"
|
|
|
9298
7303
|
await cpuThrottlingUsingCDP({ cdpSession, rate: 1 });
|
|
9299
7304
|
};
|
|
9300
7305
|
|
|
7306
|
+
const openFilterPane = async (page) => {
|
|
7307
|
+
await page
|
|
7308
|
+
.getByTestId(NEETO_FILTERS_SELECTORS.filterButton)
|
|
7309
|
+
.or(page.getByTestId(COMMON_SELECTORS.filterButon))
|
|
7310
|
+
.click();
|
|
7311
|
+
await expect(page.getByTestId(NEETO_FILTERS_SELECTORS.filterPaneHeading)).toHaveText(getI18nInstance().t("neetoFilters.common.filters"));
|
|
7312
|
+
};
|
|
7313
|
+
const clearFiltersFromActionBlock = async (page) => {
|
|
7314
|
+
const isClearButtonVisible = await page
|
|
7315
|
+
.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)
|
|
7316
|
+
.isVisible();
|
|
7317
|
+
if (isClearButtonVisible) {
|
|
7318
|
+
await page
|
|
7319
|
+
.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)
|
|
7320
|
+
.click();
|
|
7321
|
+
await Promise.all([
|
|
7322
|
+
expect(page.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)).toBeHidden(),
|
|
7323
|
+
expect(page.locator(COMMON_SELECTORS.tableSpinner)).toHaveCount(0, {
|
|
7324
|
+
timeout: 15_000,
|
|
7325
|
+
}),
|
|
7326
|
+
]);
|
|
7327
|
+
}
|
|
7328
|
+
};
|
|
7329
|
+
const filterUtils = {
|
|
7330
|
+
openFilterPane,
|
|
7331
|
+
clearFiltersFromActionBlock,
|
|
7332
|
+
};
|
|
7333
|
+
|
|
9301
7334
|
const getAmountWithSymbol = (amount, options) => {
|
|
9302
7335
|
const formatter = new Intl.NumberFormat(dayjs.locale(), {
|
|
9303
7336
|
...options,
|
|
@@ -12291,11 +10324,9 @@ const DEFAULT_WARMUP_URLS = ["/login"];
|
|
|
12291
10324
|
async function warmup({ urls = DEFAULT_WARMUP_URLS, timeout = 60_000, } = {}) {
|
|
12292
10325
|
if (!IS_DEV_ENV)
|
|
12293
10326
|
return;
|
|
12294
|
-
const
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
}
|
|
12298
|
-
const baseURL = `http://${SUBDOMAIN}.lvh.me:${RAILS_SERVER_PORT}`;
|
|
10327
|
+
const railsServerPort = requireEnv("RAILS_SERVER_PORT");
|
|
10328
|
+
const subdomain = process.env.SUBDOMAIN ?? "spinkart";
|
|
10329
|
+
const baseURL = `http://${subdomain}.lvh.me:${railsServerPort}`;
|
|
12299
10330
|
const browser = await chromium.launch();
|
|
12300
10331
|
const page = await browser.newPage();
|
|
12301
10332
|
try {
|
|
@@ -12310,6 +10341,22 @@ async function warmup({ urls = DEFAULT_WARMUP_URLS, timeout = 60_000, } = {}) {
|
|
|
12310
10341
|
}
|
|
12311
10342
|
}
|
|
12312
10343
|
|
|
10344
|
+
/** Check for an HTTP response without following redirects or downloading its body. */
|
|
10345
|
+
const httpCheck = async (url, timeout = 3000) => {
|
|
10346
|
+
try {
|
|
10347
|
+
const response = await fetch(url, {
|
|
10348
|
+
redirect: "manual",
|
|
10349
|
+
signal: AbortSignal.timeout(timeout),
|
|
10350
|
+
});
|
|
10351
|
+
// Any status means the server is listening, including redirects and errors.
|
|
10352
|
+
await response.body?.cancel();
|
|
10353
|
+
return true;
|
|
10354
|
+
}
|
|
10355
|
+
catch {
|
|
10356
|
+
return false;
|
|
10357
|
+
}
|
|
10358
|
+
};
|
|
10359
|
+
|
|
12313
10360
|
const DIR = "/tmp/neeto-auth-web";
|
|
12314
10361
|
const CONFIG$1 = {
|
|
12315
10362
|
DIR,
|
|
@@ -12342,14 +10389,7 @@ const buildEmailCaptureInitializer = (targetApp) => {
|
|
|
12342
10389
|
return template.replace("{{TARGET_APP}}", escapeRubyString(targetApp));
|
|
12343
10390
|
};
|
|
12344
10391
|
const log$1 = (msg) => console.log(`[NeetoAuth] ${msg}`);
|
|
12345
|
-
const
|
|
12346
|
-
const req = http.get(`http://localhost:${port}/`, () => resolve(true));
|
|
12347
|
-
req.on("error", () => resolve(false));
|
|
12348
|
-
req.setTimeout(timeout, () => {
|
|
12349
|
-
req.destroy();
|
|
12350
|
-
resolve(false);
|
|
12351
|
-
});
|
|
12352
|
-
});
|
|
10392
|
+
const isServerListening$1 = () => httpCheck(`http://localhost:${CONFIG$1.PORT}/`);
|
|
12353
10393
|
const pollUntil = async (check, timeoutMs, intervalMs) => {
|
|
12354
10394
|
const deadline = Date.now() + timeoutMs;
|
|
12355
10395
|
while (Date.now() < deadline) {
|
|
@@ -12516,7 +10556,7 @@ class NeetoAuthServer {
|
|
|
12516
10556
|
if (this.process !== null && this.process.exitCode !== null) {
|
|
12517
10557
|
throw new Error(`[NeetoAuth] Server process exited unexpectedly with code ${this.process.exitCode}.\nLog:\n${readServerLog()}`);
|
|
12518
10558
|
}
|
|
12519
|
-
return
|
|
10559
|
+
return isServerListening$1();
|
|
12520
10560
|
}, timeoutMs, CONFIG$1.WAIT_FOR_SERVER_POLL_MS);
|
|
12521
10561
|
if (started)
|
|
12522
10562
|
return;
|
|
@@ -12556,7 +10596,7 @@ class NeetoAuthServer {
|
|
|
12556
10596
|
const currentContent = fs.readFileSync(CONFIG$1.EMAIL_INIT, "utf-8");
|
|
12557
10597
|
return currentContent === buildEmailCaptureInitializer(this.targetApp);
|
|
12558
10598
|
};
|
|
12559
|
-
isServingCurrentApp = async () => (await
|
|
10599
|
+
isServingCurrentApp = async () => (await isServerListening$1()) && this.isRunningForCurrentApp();
|
|
12560
10600
|
start = async () => {
|
|
12561
10601
|
if (IS_STAGING_ENV)
|
|
12562
10602
|
return;
|
|
@@ -12577,7 +10617,7 @@ class NeetoAuthServer {
|
|
|
12577
10617
|
log$1("Server already running for this app.");
|
|
12578
10618
|
return;
|
|
12579
10619
|
}
|
|
12580
|
-
if (await
|
|
10620
|
+
if (await isServerListening$1()) {
|
|
12581
10621
|
log$1("Server running for a different app — restarting...");
|
|
12582
10622
|
await this.killServerOnPort();
|
|
12583
10623
|
}
|
|
@@ -12629,14 +10669,7 @@ const DEFAULT_STATE = { pid: null, refCount: 0 };
|
|
|
12629
10669
|
const WIDGET_BASE_URL = `http://localhost:${CONFIG.PORT}`;
|
|
12630
10670
|
const SCRIPTS_DIR = path.join(import.meta.dirname, "scripts", "neeto-chat-widget");
|
|
12631
10671
|
const log = (msg) => console.log(`[NeetoChatWidget] ${msg}`);
|
|
12632
|
-
const
|
|
12633
|
-
const req = http.get(`${WIDGET_BASE_URL}/main.js`, () => resolve(true));
|
|
12634
|
-
req.on("error", () => resolve(false));
|
|
12635
|
-
req.setTimeout(timeout, () => {
|
|
12636
|
-
req.destroy();
|
|
12637
|
-
resolve(false);
|
|
12638
|
-
});
|
|
12639
|
-
});
|
|
10672
|
+
const isServerListening = () => httpCheck(`${WIDGET_BASE_URL}/main.js`);
|
|
12640
10673
|
class NeetoChatWidget {
|
|
12641
10674
|
process = null;
|
|
12642
10675
|
hasLease = false;
|
|
@@ -12776,7 +10809,7 @@ class NeetoChatWidget {
|
|
|
12776
10809
|
if (this.process !== null && this.process.exitCode !== null) {
|
|
12777
10810
|
throw new Error(`[NeetoChatWidget] Server process exited unexpectedly with code ${this.process.exitCode}.\nLog:\n${this.getLogContent()}`);
|
|
12778
10811
|
}
|
|
12779
|
-
if (await
|
|
10812
|
+
if (await isServerListening())
|
|
12780
10813
|
return;
|
|
12781
10814
|
await setTimeout$1(CONFIG.SERVER_POLL_INTERVAL_MS);
|
|
12782
10815
|
}
|
|
@@ -12787,7 +10820,7 @@ class NeetoChatWidget {
|
|
|
12787
10820
|
return;
|
|
12788
10821
|
await this.withLock(async () => {
|
|
12789
10822
|
const state = this.readState();
|
|
12790
|
-
if (await
|
|
10823
|
+
if (await isServerListening()) {
|
|
12791
10824
|
this.hasLease = true;
|
|
12792
10825
|
this.writeState({ ...state, refCount: state.refCount + 1 });
|
|
12793
10826
|
log("Server already running.");
|
|
@@ -12809,7 +10842,7 @@ class NeetoChatWidget {
|
|
|
12809
10842
|
const pid = this.process?.pid;
|
|
12810
10843
|
this.killServer(pid);
|
|
12811
10844
|
pid && (await this.waitForProcessExit(pid));
|
|
12812
|
-
(await
|
|
10845
|
+
(await isServerListening()) && (await this.killProcessOnWidgetPort());
|
|
12813
10846
|
this.process = null;
|
|
12814
10847
|
this.closeLogStream();
|
|
12815
10848
|
throw error;
|
|
@@ -12837,7 +10870,7 @@ class NeetoChatWidget {
|
|
|
12837
10870
|
log("Stopping server...");
|
|
12838
10871
|
this.killServer(state.pid);
|
|
12839
10872
|
await this.waitForProcessExit(state.pid);
|
|
12840
|
-
(await
|
|
10873
|
+
(await isServerListening()) && (await this.killProcessOnWidgetPort());
|
|
12841
10874
|
}
|
|
12842
10875
|
this.process = null;
|
|
12843
10876
|
this.closeLogStream();
|
|
@@ -12881,11 +10914,7 @@ class EmailDeliveryUtils {
|
|
|
12881
10914
|
}
|
|
12882
10915
|
connectViaRequest = async ({ provider, ownerId }) => {
|
|
12883
10916
|
if (provider === "sparkpost") {
|
|
12884
|
-
const
|
|
12885
|
-
const email = process.env[sparkpostEmailEnvKey];
|
|
12886
|
-
if (isNil(email)) {
|
|
12887
|
-
throw new Error(`ENV variable ${sparkpostEmailEnvKey} is not properly configured`);
|
|
12888
|
-
}
|
|
10917
|
+
const email = requireEnv(FROM_EMAIL_ENV_KEYS.sparkpost);
|
|
12889
10918
|
const response = await this.emailDeliveryApi.connect({
|
|
12890
10919
|
emailProvider: "sparkpost",
|
|
12891
10920
|
email,
|
|
@@ -12894,11 +10923,7 @@ class EmailDeliveryUtils {
|
|
|
12894
10923
|
expect(response?.ok()).toBeTruthy();
|
|
12895
10924
|
return response;
|
|
12896
10925
|
}
|
|
12897
|
-
const
|
|
12898
|
-
const refreshToken = process.env[refreshTokenEnvKey];
|
|
12899
|
-
if (isNil(refreshToken)) {
|
|
12900
|
-
throw new Error(`ENV variable ${refreshTokenEnvKey} is not properly configured`);
|
|
12901
|
-
}
|
|
10926
|
+
const refreshToken = requireEnv(REFRESH_TOKEN_ENV_KEYS[provider]);
|
|
12902
10927
|
const response = await this.emailDeliveryApi.connect({
|
|
12903
10928
|
emailProvider: provider,
|
|
12904
10929
|
refreshToken,
|
|
@@ -12908,10 +10933,7 @@ class EmailDeliveryUtils {
|
|
|
12908
10933
|
return response;
|
|
12909
10934
|
};
|
|
12910
10935
|
verifyEmailViaRequest = async ({ subject, to, partialBody, from }, { provider, ownerId, timeout = 30 * 1000, shouldThrowErrorOnTimeout = true, }) => {
|
|
12911
|
-
const fromEmail = from ??
|
|
12912
|
-
if (isNil(fromEmail)) {
|
|
12913
|
-
throw new Error(`ENV variable ${FROM_EMAIL_ENV_KEYS[provider]} is not properly configured`);
|
|
12914
|
-
}
|
|
10936
|
+
const fromEmail = from ?? requireEnv(FROM_EMAIL_ENV_KEYS[provider]);
|
|
12915
10937
|
const verifyParams = {
|
|
12916
10938
|
emailProvider: provider,
|
|
12917
10939
|
subject,
|
|
@@ -13296,10 +11318,7 @@ class InboundEmailApis {
|
|
|
13296
11318
|
: this.deliverViaMailgunIngress(source);
|
|
13297
11319
|
};
|
|
13298
11320
|
deliverViaMailgunIngress = (source) => {
|
|
13299
|
-
const signingKey =
|
|
13300
|
-
if (!signingKey) {
|
|
13301
|
-
throw new Error("MAILGUN_INGRESS_SIGNING_KEY is required to inject inbound emails outside development");
|
|
13302
|
-
}
|
|
11321
|
+
const signingKey = requireEnv("MAILGUN_INGRESS_SIGNING_KEY");
|
|
13303
11322
|
const timestamp = Math.floor(Date.now() / 1000).toString();
|
|
13304
11323
|
const token = randomBytes(25).toString("hex");
|
|
13305
11324
|
const signature = createHmac("sha256", signingKey)
|
|
@@ -13313,4 +11332,4 @@ class InboundEmailApis {
|
|
|
13313
11332
|
};
|
|
13314
11333
|
}
|
|
13315
11334
|
|
|
13316
|
-
export { ACME_SUBDOMAIN, ACTIONS, ADMIN_PANEL_SELECTORS, ALL_RESOURCES, ANALYTICS_RESOURCES,
|
|
11335
|
+
export { ACME_SUBDOMAIN, ACTIONS, ADMIN_PANEL_SELECTORS, ALL_RESOURCES, ANALYTICS_RESOURCES, API_ROUTES, APP_RESOURCES, AUDIT_LOGS_SELECTORS, AuditLogsPage, BASE_URL, CALENDAR_LABELS, CERTIFICATE_LIMIT_EXCEEDED_MESSAGE, CERTIFICATE_LIMIT_EXCEEDED_REGEXP, CERTIFICATE_PROVISION_FAILED_MESSAGE, CERTIFICATE_PROVISION_FAILED_REGEXP, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COLOR, COMMON_SELECTORS, COMMON_TEXTS, COMMUNITY_TEXTS, CREDENTIALS, CURRENT_TIME_RANGES, CUSTOM_DOMAIN_EDGE_CERTIFICATE_SUFFIX, CUSTOM_DOMAIN_SELECTORS, CUSTOM_DOMAIN_SUFFIX, ColorPickerUtils, CustomCommands, CustomDomainApi, CustomDomainPage, DATE_FORMATS, DATE_PICKER_SELECTORS, DATE_RANGES, DATE_TEXTS, DEFAULT_TIMEZONE_ID, DEFAULT_WEBHOOKS_RESPONSE_TEXT, DESCRIPTION_EDITOR_TEXTS, EDITOR_VERIFY_TEXT_COLOR, EMBED_SELECTORS, EMOJI_LABEL, EMPTY_STORAGE_STATE, ENGAGE_TEXTS, ENVIRONMENT, EXAMPLE_URL, EXPANDED_FONT_SIZE, EXPORT_FILE_TYPES, EditorPage, EmailDeliveryUtils, EmbedBase, FILE_FORMATS, FONTS_RESOURCES, FONT_SIZE_SELECTORS, FROM_EMAIL_ENV_KEYS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_ANALYTICS_SELECTORS, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GOOGLE_SHEETS_SELECTORS, GooglePage, HELP_CENTER_ROUTES, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IPRestrictionsPage, IP_RESTRICTIONS_SELECTORS, IS_CI, IS_DEV_CI, IS_DEV_ENV, IS_PLAYWRIGHT_RUN, IS_REVIEW_ENV, IS_STAGING_ENV, IS_WEBKIT, ImageUploader, InboundEmailApis, IntegrationBase, IpRestrictionsApi, KEYBOARD_SHORTCUTS_SELECTORS, KEYBOARD_SHORTCUT_TEST_CASES, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_DEFAULTS, LOGIN_SELECTORS, LOGIN_STRATEGIES, LOGIN_TIMEOUT, MAILPIT_BASE_URL, MAILPIT_DOMAIN_NAME, MICROSOFT_LOGIN_SELECTORS, MICROSOFT_LOGIN_TEXTS, MailerUtils, MailpitApi, MicrosoftPage, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_SEO_SELECTORS, NEETO_TEXT_MODIFIER_SELECTORS, NeetoAuthServer, NeetoChatWidget, NeetoEmailDeliveryApi, NeetoTowerApi, ONBOARDING_SELECTORS, ORGANIZATION_TEXTS, OTP_EMAIL_PATTERN, OTP_FETCH_TIMEOUT, OrganizationPage, PAST_TIME_RANGES, PHONE_NUMBER_FORMATS, PLURAL, PROFILE_LINKS, PROFILE_SECTION_SELECTORS, PROJECT_NAMES, PROJECT_TRANSLATIONS_PATH, REVIEW_APP_CUSTOM_DOMAIN_SUFFIX, ROUTES, RailsEmailApiClient, RailsEmailUtils, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STATUS_TEXTS, STORAGE_STATE, SecurityApi, SidebarSection, SlackApi, SlackPage, SmsApi, SmsUtils, TABLE_SELECTORS, TAB_SELECTORS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THEMES_SELECTORS, THEMES_TEXTS, THIRD_PARTY_RESOURCES, THIRD_PARTY_ROUTES, TIME_RANGES, TOASTR_MESSAGES, TRAEFIK_NOT_FOUND_TEXT, TWILIO_SELECTORS, ThankYouApi, ThankYouPage, TwilioApi, USER_AGENTS, WebhookSiteApi, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_WEB_TEXTS, ZapierPage, authenticateUser, baseURLGenerator, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, createOrganizationViaApi, createOrganizationViaRake, currencyUtils, dataQa, decodeQRCodeFromFile, definePlaywrightConfig, exampleEmail, executeWithThrottledResources, extractSubdomainFromError, filterUtils, fixedMenuSelector, generatePhoneNumber, generatePhoneNumberDetails, generateRandomBypassEmail, generateRandomFile, generateStagingData, getByDataQA, getClipboardContent, getFormattedPhoneNumber, getFullUrl, getGithubToken, getGlobalUserProps, getGlobalUserState, getImagePathAndName, getIsoCodeFromPhoneCode, getListCount, globalShortcuts, grantClipboardPermissions, hexToRGB, hexToRGBA, i18nFixture, imageRegex, initializeCredentials, initializeReviewAppCredentials, initializeTestData, initializeTotp, isGithubIssueOpen, isStagingOrganizationExpired, joinHyphenCase, joinString, login, loginToReviewApp, mailpitDomainName, minutesAgo, networkConditions, networkThrottlingUsingCDP, optionSelector, readFileAsBrowserFile, readFileSyncIfExists, removeCredentialFile, requireEnv, reviewAppBaseURL, reviewAppOrganizationOptions, serializeFileForBrowser, shouldSkipCustomDomainSetup, shouldSkipSetupAndTeardown, simulateClickWithDelay, simulateTypingWithDelay, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, waitForReviewApp, warmup, withCookieCache, writeDataToFile };
|