@bigbinary/neeto-playwright-commons 1.8.37 → 1.8.38
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 +20 -2
- package/index.cjs.js.map +1 -1
- package/index.d.ts +10 -2
- package/index.js +20 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -2563,6 +2563,18 @@ class CustomCommands {
|
|
|
2563
2563
|
await pageContext.reload();
|
|
2564
2564
|
await reloadRequests;
|
|
2565
2565
|
};
|
|
2566
|
+
this.waitForPageLoad = async ({ visiblityTimeout = 35000, customPageContext, }) => {
|
|
2567
|
+
const pageContext = customPageContext !== null && customPageContext !== void 0 ? customPageContext : this.page;
|
|
2568
|
+
await pageContext.waitForLoadState("load");
|
|
2569
|
+
await Promise.all([
|
|
2570
|
+
test$1.expect(pageContext.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden({
|
|
2571
|
+
timeout: visiblityTimeout,
|
|
2572
|
+
}),
|
|
2573
|
+
test$1.expect(pageContext.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
|
|
2574
|
+
timeout: visiblityTimeout,
|
|
2575
|
+
}),
|
|
2576
|
+
]);
|
|
2577
|
+
};
|
|
2566
2578
|
this.apiRequest = async ({ url, failOnStatusCode = true, headers: additionalHeaders, body: data, method = "get", params = {}, ...otherOptions }) => {
|
|
2567
2579
|
const csrfToken = await this.page
|
|
2568
2580
|
.locator("[name='csrf-token']")
|
|
@@ -2614,12 +2626,18 @@ class CustomCommands {
|
|
|
2614
2626
|
|
|
2615
2627
|
class MailosaurUtils {
|
|
2616
2628
|
constructor(mailosaur) {
|
|
2629
|
+
this.getEmailContent = ({ email, subjectSubstring = "", timeout = 2 * 60 * 1000, receivedAfter = new Date(), }) => this.mailosaur.messages.get(this.serverId, { sentTo: email, subject: subjectSubstring }, { timeout, receivedAfter });
|
|
2617
2630
|
this.fetchOtpFromEmail = async ({ email, subjectSubstring = OTP_EMAIL_PATTERN, timeout = 2 * 60 * 1000, receivedAfter = new Date(), }) => {
|
|
2618
2631
|
var _a, _b, _c;
|
|
2619
|
-
const receivedEmail = await this.
|
|
2632
|
+
const receivedEmail = await this.getEmailContent({
|
|
2633
|
+
email,
|
|
2634
|
+
subjectSubstring,
|
|
2635
|
+
timeout,
|
|
2636
|
+
receivedAfter,
|
|
2637
|
+
});
|
|
2620
2638
|
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;
|
|
2621
2639
|
if (ramda.isNil(otp)) {
|
|
2622
|
-
throw new Error(`No codes found in the email with subject: ${receivedEmail.subject}. Please re-evaluate the filtering parameters.`);
|
|
2640
|
+
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.`);
|
|
2623
2641
|
}
|
|
2624
2642
|
return otp;
|
|
2625
2643
|
};
|