@bigbinary/neeto-playwright-commons 1.8.37 → 1.8.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +21 -2
- package/index.cjs.js.map +1 -1
- package/index.d.ts +11 -2
- package/index.js +21 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _playwright_test from '@playwright/test';
|
|
2
2
|
import { Page, APIRequestContext, Response, APIResponse, Fixtures, PlaywrightWorkerArgs, PlaywrightWorkerOptions, PlaywrightTestArgs, PlaywrightTestOptions, Browser, BrowserContext, FrameLocator, Locator, CDPSession } from '@playwright/test';
|
|
3
|
+
import * as mailosaur_lib_models from 'mailosaur/lib/models';
|
|
3
4
|
import MailosaurClient from 'mailosaur';
|
|
4
5
|
import { I18nPlaywrightFixture } from 'playwright-i18next-fixture';
|
|
5
6
|
import { TFunction } from 'i18next';
|
|
@@ -40,6 +41,11 @@ interface ApiRequestProps {
|
|
|
40
41
|
method?: HttpMethods;
|
|
41
42
|
params?: ParamProps;
|
|
42
43
|
}
|
|
44
|
+
interface WaitForPageLoadParams {
|
|
45
|
+
visiblityTimeout: number;
|
|
46
|
+
retryTimeout: number;
|
|
47
|
+
customPageContext: Page | undefined;
|
|
48
|
+
}
|
|
43
49
|
type ApiRequest = (props: ApiRequestProps & Record<string, unknown>) => Promise<APIResponse | undefined>;
|
|
44
50
|
interface FieldValue {
|
|
45
51
|
field: string;
|
|
@@ -67,22 +73,24 @@ declare class CustomCommands {
|
|
|
67
73
|
executeRecursively: ExecuteRecursively;
|
|
68
74
|
verifySuccessToast: ({ message, closeAfterVerification, }?: Partial<VerifySuccessToastParams>) => Promise<void>;
|
|
69
75
|
reloadAndWait: (requestCount: number, customPageContext?: Page, interceptMultipleResponsesProps?: Partial<Omit<InterceptMultipleResponsesParams, "times">>) => Promise<void>;
|
|
76
|
+
waitForPageLoad: ({ visiblityTimeout, customPageContext, }: WaitForPageLoadParams) => Promise<void>;
|
|
70
77
|
apiRequest: ApiRequest;
|
|
71
78
|
selectOptionFromDropdown: ({ selectValueContainer, selectMenu, value, options, }: SelectOptionFromDropdownParams) => Promise<void>;
|
|
72
79
|
verifyFieldValue: VerifyFieldValue;
|
|
73
80
|
}
|
|
74
81
|
|
|
75
|
-
interface
|
|
82
|
+
interface EmailContentParams {
|
|
76
83
|
email: string;
|
|
77
84
|
subjectSubstring?: string;
|
|
78
85
|
timeout?: number;
|
|
79
86
|
receivedAfter?: Date;
|
|
80
87
|
}
|
|
81
|
-
type FetchOtpFromEmail = (props:
|
|
88
|
+
type FetchOtpFromEmail = (props: EmailContentParams) => Promise<string | undefined>;
|
|
82
89
|
declare class MailosaurUtils {
|
|
83
90
|
mailosaur: MailosaurClient;
|
|
84
91
|
serverId: string;
|
|
85
92
|
constructor(mailosaur: MailosaurClient);
|
|
93
|
+
getEmailContent: ({ email, subjectSubstring, timeout, receivedAfter, }: EmailContentParams) => Promise<mailosaur_lib_models.Message>;
|
|
86
94
|
fetchOtpFromEmail: FetchOtpFromEmail;
|
|
87
95
|
generateRandomMailosaurEmail: () => string;
|
|
88
96
|
}
|
|
@@ -454,6 +462,7 @@ declare const COMMON_SELECTORS: {
|
|
|
454
462
|
columnsDropdownContainer: string;
|
|
455
463
|
columnsDropdownButton: string;
|
|
456
464
|
breadcrumbHeader: string;
|
|
465
|
+
header: string;
|
|
457
466
|
};
|
|
458
467
|
|
|
459
468
|
declare const NEETO_EDITOR_SELECTORS: {
|
package/index.js
CHANGED
|
@@ -190,6 +190,7 @@ const COMMON_SELECTORS = {
|
|
|
190
190
|
columnsDropdownContainer: "show/hide-columns-dropdown-container",
|
|
191
191
|
columnsDropdownButton: "columns-dropdown-button",
|
|
192
192
|
breadcrumbHeader: "header-breadcrumb",
|
|
193
|
+
header: "neeto-molecules-header",
|
|
193
194
|
};
|
|
194
195
|
|
|
195
196
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -2517,6 +2518,18 @@ class CustomCommands {
|
|
|
2517
2518
|
await pageContext.reload();
|
|
2518
2519
|
await reloadRequests;
|
|
2519
2520
|
};
|
|
2521
|
+
this.waitForPageLoad = async ({ visiblityTimeout = 35000, customPageContext, }) => {
|
|
2522
|
+
const pageContext = customPageContext !== null && customPageContext !== void 0 ? customPageContext : this.page;
|
|
2523
|
+
await pageContext.waitForLoadState("load");
|
|
2524
|
+
await Promise.all([
|
|
2525
|
+
expect(pageContext.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden({
|
|
2526
|
+
timeout: visiblityTimeout,
|
|
2527
|
+
}),
|
|
2528
|
+
expect(pageContext.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
|
|
2529
|
+
timeout: visiblityTimeout,
|
|
2530
|
+
}),
|
|
2531
|
+
]);
|
|
2532
|
+
};
|
|
2520
2533
|
this.apiRequest = async ({ url, failOnStatusCode = true, headers: additionalHeaders, body: data, method = "get", params = {}, ...otherOptions }) => {
|
|
2521
2534
|
const csrfToken = await this.page
|
|
2522
2535
|
.locator("[name='csrf-token']")
|
|
@@ -2568,12 +2581,18 @@ class CustomCommands {
|
|
|
2568
2581
|
|
|
2569
2582
|
class MailosaurUtils {
|
|
2570
2583
|
constructor(mailosaur) {
|
|
2584
|
+
this.getEmailContent = ({ email, subjectSubstring = "", timeout = 2 * 60 * 1000, receivedAfter = new Date(), }) => this.mailosaur.messages.get(this.serverId, { sentTo: email, subject: subjectSubstring }, { timeout, receivedAfter });
|
|
2571
2585
|
this.fetchOtpFromEmail = async ({ email, subjectSubstring = OTP_EMAIL_PATTERN, timeout = 2 * 60 * 1000, receivedAfter = new Date(), }) => {
|
|
2572
2586
|
var _a, _b, _c;
|
|
2573
|
-
const receivedEmail = await this.
|
|
2587
|
+
const receivedEmail = await this.getEmailContent({
|
|
2588
|
+
email,
|
|
2589
|
+
subjectSubstring,
|
|
2590
|
+
timeout,
|
|
2591
|
+
receivedAfter,
|
|
2592
|
+
});
|
|
2574
2593
|
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;
|
|
2575
2594
|
if (isNil(otp)) {
|
|
2576
|
-
throw new Error(`No codes found in the email with subject: ${receivedEmail.subject}. Please re-evaluate the filtering parameters.`);
|
|
2595
|
+
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.`);
|
|
2577
2596
|
}
|
|
2578
2597
|
return otp;
|
|
2579
2598
|
};
|