@bigbinary/neeto-playwright-commons 1.14.3 → 1.15.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 +6 -25
- package/index.cjs.js +0 -45
- package/index.cjs.js.map +1 -1
- package/index.d.ts +5 -100
- package/index.js +2 -46
- package/index.js.map +1 -1
- package/package.json +1 -3
package/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as _playwright_test from '@playwright/test';
|
|
2
2
|
import { Page, APIRequestContext, Response, Locator, APIResponse, Fixtures, PlaywrightWorkerArgs, PlaywrightWorkerOptions, PlaywrightTestArgs, PlaywrightTestOptions, Browser, BrowserContext, FrameLocator, CDPSession } from '@playwright/test';
|
|
3
3
|
import { FastmailApi } from 'apis/fastmail';
|
|
4
|
-
import * as mailosaur_lib_models from 'mailosaur/lib/models';
|
|
5
|
-
import MailosaurClient from 'mailosaur';
|
|
6
4
|
import { I18nPlaywrightFixture } from 'playwright-i18next-fixture';
|
|
7
5
|
import { TFunction } from 'i18next';
|
|
8
6
|
import { TOTP, Secret } from 'otpauth';
|
|
@@ -675,104 +673,9 @@ declare class MailerUtils {
|
|
|
675
673
|
*/
|
|
676
674
|
generateRandomEmail: () => string;
|
|
677
675
|
}
|
|
678
|
-
interface EmailContentParams {
|
|
679
|
-
email: string;
|
|
680
|
-
subjectSubstring?: string;
|
|
681
|
-
timeout?: number;
|
|
682
|
-
receivedAfter?: Date;
|
|
683
|
-
}
|
|
684
|
-
type FetchOtpFromEmail = (props: EmailContentParams) => Promise<string | undefined>;
|
|
685
|
-
declare class MailosaurUtils {
|
|
686
|
-
mailosaur: MailosaurClient;
|
|
687
|
-
serverId: string;
|
|
688
|
-
constructor(mailosaur: MailosaurClient);
|
|
689
|
-
/**
|
|
690
|
-
*
|
|
691
|
-
* Used to extract the email content. It takes the following parameters:
|
|
692
|
-
*
|
|
693
|
-
* email (required): The Mailosaur email to which the OTP was sent to.
|
|
694
|
-
*
|
|
695
|
-
* subjectSubstring (optional): A substring of the email subject to filter it.
|
|
696
|
-
*
|
|
697
|
-
* timeout (optional): The timeout time in milliseconds after which the method
|
|
698
|
-
*
|
|
699
|
-
* throws an error if an email is not found. Defaults to 2 minutes
|
|
700
|
-
*
|
|
701
|
-
* receivedAfter: A date object used to filter the emails based on the time of
|
|
702
|
-
*
|
|
703
|
-
* receiving it. Only emails incoming after this timestamp will be taken into
|
|
704
|
-
*
|
|
705
|
-
* account. Defaults to the timestamp of invoking this method.
|
|
706
|
-
*
|
|
707
|
-
* @example
|
|
708
|
-
*
|
|
709
|
-
* test("sample test", async ({ mailosaurUtils }) => {
|
|
710
|
-
* const email = mailosaurUtils.getEmailContent({
|
|
711
|
-
* email: `someone@${process.env.MAILOSAUR_SERVER_ID}.mailosaur.net`,
|
|
712
|
-
* subjectSubstring: "is your OTP",
|
|
713
|
-
* timeout: 60 * 1000,
|
|
714
|
-
* receivedAfter: new Date(),
|
|
715
|
-
* });
|
|
716
|
-
* });
|
|
717
|
-
* @endexample
|
|
718
|
-
*/
|
|
719
|
-
getEmailContent: ({
|
|
720
|
-
email,
|
|
721
|
-
subjectSubstring,
|
|
722
|
-
timeout,
|
|
723
|
-
receivedAfter
|
|
724
|
-
}: EmailContentParams) => Promise<mailosaur_lib_models.Message>;
|
|
725
|
-
/**
|
|
726
|
-
*
|
|
727
|
-
* Used to extract the OTP from the neeto OTP emails. It takes the following parameters:
|
|
728
|
-
*
|
|
729
|
-
* email(required): The Mailosaur email to which the OTP was sent to.
|
|
730
|
-
*
|
|
731
|
-
* subjectSubstring (optional): A substring of the email subject to filter it.
|
|
732
|
-
*
|
|
733
|
-
* Defaults to "is your login code"
|
|
734
|
-
*
|
|
735
|
-
* timeout (optional): The timeout time in milliseconds after which the method
|
|
736
|
-
*
|
|
737
|
-
* throws an error if an email is not found. Defaults to 2 minutes
|
|
738
|
-
*
|
|
739
|
-
* receivedAfter: A date object used to filter the emails based on the time of
|
|
740
|
-
*
|
|
741
|
-
* receiving it. Only emails incoming after this timestamp will be taken into
|
|
742
|
-
*
|
|
743
|
-
* account. Defaults to the timestamp of invoking this method.
|
|
744
|
-
*
|
|
745
|
-
* @example
|
|
746
|
-
*
|
|
747
|
-
* test("sample test", async ({ mailosaurUtils }) => {
|
|
748
|
-
* mailosaurUtils.fetchOtpFromEmail({
|
|
749
|
-
* email: `someone@${process.env.MAILOSAUR_SERVER_ID}.mailosaur.net`,
|
|
750
|
-
* subjectSubstring: "is your OTP",
|
|
751
|
-
* timeout: 60 * 1000,
|
|
752
|
-
* receivedAfter: new Date(),
|
|
753
|
-
* });
|
|
754
|
-
* });
|
|
755
|
-
* @endexample
|
|
756
|
-
*/
|
|
757
|
-
fetchOtpFromEmail: FetchOtpFromEmail;
|
|
758
|
-
/**
|
|
759
|
-
*
|
|
760
|
-
* Used to generate a random Email ID to the Mailosaur Server.
|
|
761
|
-
*
|
|
762
|
-
* @example
|
|
763
|
-
*
|
|
764
|
-
* test("sample test", async ({ mailosaurUtils }) => {
|
|
765
|
-
* const email = mailosaurUtils.generateRandomMailosaurEmail();
|
|
766
|
-
* });
|
|
767
|
-
* @endexample
|
|
768
|
-
*/
|
|
769
|
-
generateRandomMailosaurEmail: () => string;
|
|
770
|
-
}
|
|
771
676
|
interface CustomFixture {
|
|
772
677
|
neetoPlaywrightUtilities: CustomCommands;
|
|
773
678
|
page: Page;
|
|
774
|
-
mailosaur: MailosaurClient;
|
|
775
|
-
mailosaurUtils: MailosaurUtils;
|
|
776
679
|
mailerUtils: MailerUtils;
|
|
777
680
|
}
|
|
778
681
|
type Commands = Fixtures<CustomFixture, PlaywrightWorkerArgs & PlaywrightWorkerOptions, PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
|
|
@@ -1894,7 +1797,9 @@ declare class ZapierPage extends IntegrationBase {
|
|
|
1894
1797
|
*
|
|
1895
1798
|
* @example
|
|
1896
1799
|
*
|
|
1897
|
-
* const apiKey = await zapierPage.connectAndVerify({
|
|
1800
|
+
* const apiKey = await zapierPage.connectAndVerify({
|
|
1801
|
+
* apiKeyLabel: "Your API Key",
|
|
1802
|
+
* });
|
|
1898
1803
|
* @endexample
|
|
1899
1804
|
*/
|
|
1900
1805
|
connectAndVerify: ({
|
|
@@ -3328,7 +3233,7 @@ declare const SLACK_DEFAULT_CHANNEL = "general";
|
|
|
3328
3233
|
*
|
|
3329
3234
|
* const testEmail = ZAPIER_TEST_EMAIL("neetoChat");
|
|
3330
3235
|
*
|
|
3331
|
-
* console.log(testEmail) // `neeto-neetoChat-zapier-test@${process.env.
|
|
3236
|
+
* console.log(testEmail) // `neeto-neetoChat-zapier-test@${process.env.FASTMAIL_DOMAIN_NAME}`
|
|
3332
3237
|
* @endexample
|
|
3333
3238
|
*/
|
|
3334
3239
|
declare const ZAPIER_TEST_EMAIL: (product: string) => string;
|
|
@@ -6131,4 +6036,4 @@ interface Overrides {
|
|
|
6131
6036
|
* @endexample
|
|
6132
6037
|
*/
|
|
6133
6038
|
declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
|
|
6134
|
-
export { API_ROUTES, AUDIT_LOGS_TEXTS, AuditLogsPage, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, DESCRIPTION_EDITOR_TEXTS, EMBED_SELECTORS, EMOJI_LABEL, ENGAGE_TEXTS, ENVIRONMENT, EXPANDED_FONT_SIZE, EditorPage, EmbedBase, FONT_SIZE_SELECTORS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GooglePage, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, ImageUploader, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailerUtils,
|
|
6039
|
+
export { API_ROUTES, AUDIT_LOGS_TEXTS, AuditLogsPage, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, DESCRIPTION_EDITOR_TEXTS, EMBED_SELECTORS, EMOJI_LABEL, ENGAGE_TEXTS, ENVIRONMENT, EXPANDED_FONT_SIZE, EditorPage, EmbedBase, FONT_SIZE_SELECTORS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GooglePage, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, ImageUploader, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailerUtils, Member, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_TEXT_MODIFIER_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PLURAL, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SELECT_COUNTRY, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SidebarSection, SlackPage, TAB_SELECTORS, TAGS_SELECTORS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THIRD_PARTY_ROUTES, TOASTR_MESSAGES, TagsPage, TeamMembers, ThankYouPage, USER_AGENTS, WEBHOOK_SELECTORS, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_WEB_TEXTS, ZapierPage, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, currencyUtils, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, filterUtils, generateRandomBypassEmail, generateStagingData, getByDataQA, getGlobalUserState, getImagePathAndName, getListCount, headerUtils, hexToRGB, hexToRGBA, hyphenize, i18nFixture, initializeCredentials, initializeTotp, isGithubIssueOpen, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, _default as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
|
package/index.js
CHANGED
|
@@ -4,10 +4,9 @@ import * as Path from 'path';
|
|
|
4
4
|
import Path__default from 'path';
|
|
5
5
|
import test$1, { expect, test as test$2, chromium as chromium$1, defineConfig, devices } from '@playwright/test';
|
|
6
6
|
import { execSync } from 'child_process';
|
|
7
|
-
import { curry, not, isEmpty as isEmpty$1, pluck,
|
|
7
|
+
import { curry, not, isEmpty as isEmpty$1, pluck, mergeDeepLeft, isNotNil, isNil, mergeAll } from 'ramda';
|
|
8
8
|
import require$$0$1 from 'util';
|
|
9
9
|
import { faker } from '@faker-js/faker';
|
|
10
|
-
import MailosaurClient from 'mailosaur';
|
|
11
10
|
import dayjs from 'dayjs';
|
|
12
11
|
import require$$0$3 from 'tty';
|
|
13
12
|
import require$$0$2 from 'os';
|
|
@@ -12162,59 +12161,16 @@ class MailerUtils {
|
|
|
12162
12161
|
}
|
|
12163
12162
|
}
|
|
12164
12163
|
|
|
12165
|
-
class MailosaurUtils {
|
|
12166
|
-
constructor(mailosaur) {
|
|
12167
|
-
this.getEmailContent = ({ email, subjectSubstring = "", timeout = 2 * 60 * 1000, receivedAfter = new Date(), }) => this.mailosaur.messages.get(this.serverId, { sentTo: email, subject: subjectSubstring }, { timeout, receivedAfter });
|
|
12168
|
-
this.fetchOtpFromEmail = async ({ email, subjectSubstring = OTP_EMAIL_PATTERN, timeout = 2 * 60 * 1000, receivedAfter = new Date(), }) => {
|
|
12169
|
-
var _a, _b, _c;
|
|
12170
|
-
const receivedEmail = await this.getEmailContent({
|
|
12171
|
-
email,
|
|
12172
|
-
subjectSubstring,
|
|
12173
|
-
timeout,
|
|
12174
|
-
receivedAfter,
|
|
12175
|
-
});
|
|
12176
|
-
const otp = (_c = (_b = (_a = receivedEmail === null || receivedEmail === void 0 ? void 0 : receivedEmail.text) === null || _a === void 0 ? void 0 : _a.codes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.value;
|
|
12177
|
-
if (isNil(otp)) {
|
|
12178
|
-
throw new Error(`No codes found in the email with subject: ${receivedEmail === null || receivedEmail === void 0 ? void 0 : receivedEmail.subject}. Please re-evaluate the filtering parameters.`);
|
|
12179
|
-
}
|
|
12180
|
-
return otp;
|
|
12181
|
-
};
|
|
12182
|
-
this.generateRandomMailosaurEmail = () => faker.internet.email({ provider: `${this.serverId}.mailosaur.net` });
|
|
12183
|
-
this.mailosaur = mailosaur;
|
|
12184
|
-
if (isNotNil(process.env.MAILOSAUR_SERVER_ID)) {
|
|
12185
|
-
this.serverId = process.env.MAILOSAUR_SERVER_ID;
|
|
12186
|
-
}
|
|
12187
|
-
else {
|
|
12188
|
-
throw new Error("ENV variable MAILOSAUR_SERVER_ID is not defined. Please add the Server ID to use this method. Please visit https://mailosaur.com/app/servers to find the Server ID.");
|
|
12189
|
-
}
|
|
12190
|
-
}
|
|
12191
|
-
}
|
|
12192
|
-
|
|
12193
12164
|
const commands = {
|
|
12194
12165
|
neetoPlaywrightUtilities: async ({ page, request, baseURL }, use) => {
|
|
12195
12166
|
const commands = new CustomCommands(page, request, baseURL);
|
|
12196
12167
|
await use(commands);
|
|
12197
12168
|
},
|
|
12198
|
-
mailosaur: async ({}, use) => {
|
|
12199
|
-
skipTest.forAllExceptStagingEnv();
|
|
12200
|
-
if (isNotNil(process.env.MAILOSAUR_API_KEY)) {
|
|
12201
|
-
const mailosaur = new MailosaurClient(process.env.MAILOSAUR_API_KEY);
|
|
12202
|
-
await use(mailosaur);
|
|
12203
|
-
}
|
|
12204
|
-
else {
|
|
12205
|
-
throw new Error("ENV variable MAILOSAUR_API_KEY is not defined. Please add the API key to use this fixture. Please visit https://mailosaur.com/app/account/keys to find the API key.");
|
|
12206
|
-
}
|
|
12207
|
-
},
|
|
12208
12169
|
page: async ({ page }, use) => {
|
|
12209
12170
|
await page.goto("/", { timeout: 20000 });
|
|
12210
12171
|
await page.waitForLoadState();
|
|
12211
12172
|
await use(page);
|
|
12212
12173
|
},
|
|
12213
|
-
mailosaurUtils: async ({ mailosaur }, use) => {
|
|
12214
|
-
skipTest.forAllExceptStagingEnv();
|
|
12215
|
-
const mailosaurUtils = new MailosaurUtils(mailosaur);
|
|
12216
|
-
await use(mailosaurUtils);
|
|
12217
|
-
},
|
|
12218
12174
|
mailerUtils: async ({ neetoPlaywrightUtilities }, use) => {
|
|
12219
12175
|
const mailerUtils = new MailerUtils(neetoPlaywrightUtilities);
|
|
12220
12176
|
await mailerUtils.fastmailApi.authorizeAndSetAccountId();
|
|
@@ -158589,5 +158545,5 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
158589
158545
|
});
|
|
158590
158546
|
};
|
|
158591
158547
|
|
|
158592
|
-
export { API_ROUTES, AUDIT_LOGS_TEXTS, AuditLogsPage, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, DESCRIPTION_EDITOR_TEXTS, EMBED_SELECTORS, EMOJI_LABEL, ENGAGE_TEXTS, ENVIRONMENT, EXPANDED_FONT_SIZE, EditorPage, EmbedBase, FONT_SIZE_SELECTORS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GooglePage, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, ImageUploader, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailerUtils,
|
|
158548
|
+
export { API_ROUTES, AUDIT_LOGS_TEXTS, AuditLogsPage, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, DESCRIPTION_EDITOR_TEXTS, EMBED_SELECTORS, EMOJI_LABEL, ENGAGE_TEXTS, ENVIRONMENT, EXPANDED_FONT_SIZE, EditorPage, EmbedBase, FONT_SIZE_SELECTORS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GooglePage, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, ImageUploader, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailerUtils, Member, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_TEXT_MODIFIER_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PLURAL, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SELECT_COUNTRY, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SidebarSection, SlackPage, TAB_SELECTORS, TAGS_SELECTORS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THIRD_PARTY_ROUTES, TOASTR_MESSAGES, TagsPage, TeamMembers, ThankYouPage, USER_AGENTS, WEBHOOK_SELECTORS, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_WEB_TEXTS, ZapierPage, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, currencyUtils, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, filterUtils, generateRandomBypassEmail, generateStagingData, getByDataQA, getGlobalUserState, getImagePathAndName, getListCount, headerUtils, hexToRGB, hexToRGBA, hyphenize, i18nFixture, initializeCredentials, initializeTotp, isGithubIssueOpen, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
|
|
158593
158549
|
//# sourceMappingURL=index.js.map
|