@bigbinary/neeto-playwright-commons 1.18.2 → 1.18.3
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 +36755 -1042
- package/index.cjs.js.map +1 -1
- package/index.d.ts +108 -5
- package/index.js +36758 -1045
- package/index.js.map +1 -1
- package/package.json +3 -1
package/index.d.ts
CHANGED
|
@@ -515,6 +515,12 @@ interface MessageInferredData {
|
|
|
515
515
|
codes: string[] | null;
|
|
516
516
|
body: string;
|
|
517
517
|
}
|
|
518
|
+
interface AttachmentDetails {
|
|
519
|
+
filename: string;
|
|
520
|
+
type: string;
|
|
521
|
+
content: Buffer;
|
|
522
|
+
contentType: string;
|
|
523
|
+
}
|
|
518
524
|
interface FormattedList {
|
|
519
525
|
html: MessageInferredData;
|
|
520
526
|
text: MessageInferredData;
|
|
@@ -527,6 +533,7 @@ interface FormattedList {
|
|
|
527
533
|
received: string;
|
|
528
534
|
subject: string;
|
|
529
535
|
attachments: Attachment[];
|
|
536
|
+
blobId: string;
|
|
530
537
|
}
|
|
531
538
|
declare class MailerUtils {
|
|
532
539
|
private neetoPlaywrightUtilities;
|
|
@@ -600,6 +607,11 @@ declare class MailerUtils {
|
|
|
600
607
|
* @endexample
|
|
601
608
|
*/
|
|
602
609
|
listMessages: (messageSearchCriteria?: Partial<MessageSearchCriteria> | undefined, listMessagesFilterCriteria?: Partial<ListMessagesFilterCriteria> | undefined) => Promise<FormattedList[]>;
|
|
610
|
+
getEmailIds: (messageSearchCriteria?: Partial<MessageSearchCriteria>, {
|
|
611
|
+
timeout,
|
|
612
|
+
receivedAfter,
|
|
613
|
+
expectedEmailCount
|
|
614
|
+
}?: Partial<FindMessageFilterOptions> | undefined, shouldThrowErrorOnTimeout?: boolean) => Promise<string[]>;
|
|
603
615
|
/**
|
|
604
616
|
*
|
|
605
617
|
* This method is used to find a first email matching the search criteria. On top of the listMessage method, this method waits until a specific mail is received or the timeout is exceeded. This method is useful for fetching an email once an action is triggered since it waits for the message delivery and can be customized according to delays in email deliveries.
|
|
@@ -696,6 +708,61 @@ declare class MailerUtils {
|
|
|
696
708
|
*
|
|
697
709
|
*/
|
|
698
710
|
generateRandomEmail: () => string;
|
|
711
|
+
/**
|
|
712
|
+
*
|
|
713
|
+
* This method is used to return the attachment based on the attachmentName of first email matching the search criteria. On top of the findMessage method, this method matches the attachment name with the attachments associated to the email. If any attachment matches then it will fetch the attachment details and return. If any attachment file name doesn't contain the substring attachmentName then it will throw an error saying No such attachment exists.
|
|
714
|
+
*
|
|
715
|
+
* attachmentName: A substring matching the attachment file name. It can be both with or without extension.
|
|
716
|
+
*
|
|
717
|
+
* messageSearchCriteria: An object containing the search criteria for matching the messages. The object can contain the keys, from, to, subject and body. All the keys of the object are optional. The values of the object are of string type and are case-insensitive. The following key-value pairs can be used:
|
|
718
|
+
*
|
|
719
|
+
* from: The complete email address from which the email was sent.
|
|
720
|
+
*
|
|
721
|
+
* to: The complete email address to which the email was sent to.
|
|
722
|
+
*
|
|
723
|
+
* subject: A complete string or a substring used to match the subject of the email.
|
|
724
|
+
*
|
|
725
|
+
* body: A complete string or a substring used to match the body of the email.
|
|
726
|
+
*
|
|
727
|
+
* messageFilterCriteria (optional): An object containing the criteria which are used to filter the messages that match the search criteria. The object can contain the keys receivedAfter, page and itemsPerPage. The following key-value pairs can be used:
|
|
728
|
+
*
|
|
729
|
+
* receivedAfter: A JavaScript Date object used to filter the matching messages on the date-time of email delivery. Defaults to one hour before the method call.
|
|
730
|
+
*
|
|
731
|
+
* timeout: A number indicating the number of milliseconds to retry fetching the message before timing out. Defaults to 10 seconds.
|
|
732
|
+
*
|
|
733
|
+
* shouldThrowErrorOnTimeout (optional): A boolean value indicating whether the method show throw an error if a matching message is not found within the timeout time. If set to false, no error is thrown if the timeout is exceeded and just returns an empty object. Defaults to true.
|
|
734
|
+
*
|
|
735
|
+
* Returns a promise object with details of attachment. The object will have the following shape.
|
|
736
|
+
*
|
|
737
|
+
* filename: A string representing the file name of attachment.
|
|
738
|
+
*
|
|
739
|
+
* type: A string representing the type of attachment file.
|
|
740
|
+
*
|
|
741
|
+
* content: A buffer with the content of attachment file.
|
|
742
|
+
*
|
|
743
|
+
* contentType: A string representing the content type of attachment file.
|
|
744
|
+
*
|
|
745
|
+
* @example
|
|
746
|
+
*
|
|
747
|
+
* test("sample test", async ({ mailerUtils }) => {
|
|
748
|
+
* const message = await mailerUtils.getEmailAttachment(
|
|
749
|
+
* "invite",
|
|
750
|
+
* {
|
|
751
|
+
* to: fastmailEmailId,
|
|
752
|
+
* from: senderEmailId,
|
|
753
|
+
* subject: "Event details",
|
|
754
|
+
* }, {
|
|
755
|
+
* receivedAfter: new Date(),
|
|
756
|
+
* timeout: 60 * 1000,
|
|
757
|
+
* }, false);
|
|
758
|
+
* });
|
|
759
|
+
* @endexample
|
|
760
|
+
*/
|
|
761
|
+
getEmailAttachment: (attachmentName: string, messageSearchCriteria?: Partial<MessageSearchCriteria>, {
|
|
762
|
+
timeout,
|
|
763
|
+
receivedAfter,
|
|
764
|
+
expectedEmailCount
|
|
765
|
+
}?: Partial<FindMessageFilterOptions> | undefined, shouldThrowErrorOnTimeout?: boolean) => Promise<AttachmentDetails | undefined>;
|
|
699
766
|
}
|
|
700
767
|
type Hex = Lowercase<`#${string}`>;
|
|
701
768
|
interface BaseThemeStyle {
|
|
@@ -2618,6 +2685,7 @@ interface CreateOrganizationProps extends BasicUserInfo {
|
|
|
2618
2685
|
interface LoginAndOnboardParams extends BasicUserInfo {
|
|
2619
2686
|
handleOnboarding: () => Promise<void>;
|
|
2620
2687
|
baseURL?: string;
|
|
2688
|
+
fetchOtpFromEmail?: FetchOtpFromEmail;
|
|
2621
2689
|
}
|
|
2622
2690
|
interface Credentials extends BasicUserInfo {
|
|
2623
2691
|
otp?: number;
|
|
@@ -2626,6 +2694,15 @@ interface Credentials extends BasicUserInfo {
|
|
|
2626
2694
|
businessName: string;
|
|
2627
2695
|
subdomainName: string;
|
|
2628
2696
|
}
|
|
2697
|
+
type FetchOtpFromEmail = (params: {
|
|
2698
|
+
email: string;
|
|
2699
|
+
timeout: number;
|
|
2700
|
+
}) => Promise<string>;
|
|
2701
|
+
interface LoginWithFastmailEmail {
|
|
2702
|
+
email: string;
|
|
2703
|
+
loginTimeout?: number;
|
|
2704
|
+
fetchOtpFromEmail: FetchOtpFromEmail;
|
|
2705
|
+
}
|
|
2629
2706
|
declare class OrganizationPage {
|
|
2630
2707
|
page: Page;
|
|
2631
2708
|
neetoPlaywrightUtilities: CustomCommands;
|
|
@@ -2704,6 +2781,7 @@ declare class OrganizationPage {
|
|
|
2704
2781
|
* @endexample
|
|
2705
2782
|
*/
|
|
2706
2783
|
updateSubdomainIfExists: (appName: string) => Promise<void>;
|
|
2784
|
+
fillEmailAndSubmit: (email: string, loginTimeout: number) => Promise<void>;
|
|
2707
2785
|
/**
|
|
2708
2786
|
*
|
|
2709
2787
|
* Used to login via SSO. It takes the following parameters:
|
|
@@ -2718,6 +2796,33 @@ declare class OrganizationPage {
|
|
|
2718
2796
|
* @endexample
|
|
2719
2797
|
*/
|
|
2720
2798
|
loginViaSSO: (email?: string, loginTimeout?: number) => Promise<void>;
|
|
2799
|
+
/**
|
|
2800
|
+
*
|
|
2801
|
+
* This method is used to login NeetoAuth using Fastmail email id. It takes the following parameters:
|
|
2802
|
+
*
|
|
2803
|
+
* email: A Fastmail email id. You can generate a Fastmail email id using the method generateRandomEmail in MailerUtils.
|
|
2804
|
+
*
|
|
2805
|
+
* loginTimeout (optional): Specifies the maximum amount of time the method will wait for the login process to complete before timing out. Default is 15s.
|
|
2806
|
+
*
|
|
2807
|
+
* fetchOtpFromEmail: Method to fetch OTP from Fastmail email.
|
|
2808
|
+
*
|
|
2809
|
+
* @example
|
|
2810
|
+
*
|
|
2811
|
+
* await organizationPage.loginWithFastmailEmail({
|
|
2812
|
+
* email,
|
|
2813
|
+
* fetchOtpFromEmail: () =>
|
|
2814
|
+
* mailerUtils.findOtpFromEmail({
|
|
2815
|
+
* ...newHost,
|
|
2816
|
+
* timeout: 5 * 60 * 1000,
|
|
2817
|
+
* }),
|
|
2818
|
+
* })
|
|
2819
|
+
* @endexample
|
|
2820
|
+
*/
|
|
2821
|
+
loginWithFastmailEmail: ({
|
|
2822
|
+
email,
|
|
2823
|
+
loginTimeout,
|
|
2824
|
+
fetchOtpFromEmail
|
|
2825
|
+
}: LoginWithFastmailEmail) => Promise<void>;
|
|
2721
2826
|
/**
|
|
2722
2827
|
*
|
|
2723
2828
|
* Used to fill and submit all the profile info. It takes the following parameters:
|
|
@@ -2771,7 +2876,8 @@ declare class OrganizationPage {
|
|
|
2771
2876
|
lastName,
|
|
2772
2877
|
country,
|
|
2773
2878
|
handleOnboarding,
|
|
2774
|
-
baseURL
|
|
2879
|
+
baseURL,
|
|
2880
|
+
fetchOtpFromEmail
|
|
2775
2881
|
}: LoginAndOnboardParams) => Promise<void>;
|
|
2776
2882
|
/**
|
|
2777
2883
|
*
|
|
@@ -2806,10 +2912,7 @@ declare class OrganizationPage {
|
|
|
2806
2912
|
appName
|
|
2807
2913
|
}: {
|
|
2808
2914
|
credentials: Credentials;
|
|
2809
|
-
fetchOtpFromEmail?:
|
|
2810
|
-
email: string;
|
|
2811
|
-
timeout: number;
|
|
2812
|
-
}) => Promise<string>;
|
|
2915
|
+
fetchOtpFromEmail?: FetchOtpFromEmail;
|
|
2813
2916
|
appName: string;
|
|
2814
2917
|
}) => Promise<{
|
|
2815
2918
|
STORAGE_STATE: {
|