@bigbinary/neeto-playwright-commons 1.18.2 → 1.18.4

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.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 {
@@ -2603,6 +2670,7 @@ declare class TeamMembers {
2603
2670
  name: string;
2604
2671
  email: string;
2605
2672
  }) => Promise<void>;
2673
+ private applyFilter;
2606
2674
  }
2607
2675
  interface BasicUserInfo {
2608
2676
  firstName: string;
@@ -2618,6 +2686,7 @@ interface CreateOrganizationProps extends BasicUserInfo {
2618
2686
  interface LoginAndOnboardParams extends BasicUserInfo {
2619
2687
  handleOnboarding: () => Promise<void>;
2620
2688
  baseURL?: string;
2689
+ fetchOtpFromEmail?: FetchOtpFromEmail;
2621
2690
  }
2622
2691
  interface Credentials extends BasicUserInfo {
2623
2692
  otp?: number;
@@ -2626,6 +2695,15 @@ interface Credentials extends BasicUserInfo {
2626
2695
  businessName: string;
2627
2696
  subdomainName: string;
2628
2697
  }
2698
+ type FetchOtpFromEmail = (params: {
2699
+ email: string;
2700
+ timeout: number;
2701
+ }) => Promise<string>;
2702
+ interface LoginWithFastmailEmail {
2703
+ email: string;
2704
+ loginTimeout?: number;
2705
+ fetchOtpFromEmail: FetchOtpFromEmail;
2706
+ }
2629
2707
  declare class OrganizationPage {
2630
2708
  page: Page;
2631
2709
  neetoPlaywrightUtilities: CustomCommands;
@@ -2704,6 +2782,7 @@ declare class OrganizationPage {
2704
2782
  * @endexample
2705
2783
  */
2706
2784
  updateSubdomainIfExists: (appName: string) => Promise<void>;
2785
+ fillEmailAndSubmit: (email: string, loginTimeout: number) => Promise<void>;
2707
2786
  /**
2708
2787
  *
2709
2788
  * Used to login via SSO. It takes the following parameters:
@@ -2718,6 +2797,33 @@ declare class OrganizationPage {
2718
2797
  * @endexample
2719
2798
  */
2720
2799
  loginViaSSO: (email?: string, loginTimeout?: number) => Promise<void>;
2800
+ /**
2801
+ *
2802
+ * This method is used to login NeetoAuth using Fastmail email id. It takes the following parameters:
2803
+ *
2804
+ * email: A Fastmail email id. You can generate a Fastmail email id using the method generateRandomEmail in MailerUtils.
2805
+ *
2806
+ * loginTimeout (optional): Specifies the maximum amount of time the method will wait for the login process to complete before timing out. Default is 15s.
2807
+ *
2808
+ * fetchOtpFromEmail: Method to fetch OTP from Fastmail email.
2809
+ *
2810
+ * @example
2811
+ *
2812
+ * await organizationPage.loginWithFastmailEmail({
2813
+ * email,
2814
+ * fetchOtpFromEmail: () =>
2815
+ * mailerUtils.findOtpFromEmail({
2816
+ * ...newHost,
2817
+ * timeout: 5 * 60 * 1000,
2818
+ * }),
2819
+ * })
2820
+ * @endexample
2821
+ */
2822
+ loginWithFastmailEmail: ({
2823
+ email,
2824
+ loginTimeout,
2825
+ fetchOtpFromEmail
2826
+ }: LoginWithFastmailEmail) => Promise<void>;
2721
2827
  /**
2722
2828
  *
2723
2829
  * Used to fill and submit all the profile info. It takes the following parameters:
@@ -2771,7 +2877,8 @@ declare class OrganizationPage {
2771
2877
  lastName,
2772
2878
  country,
2773
2879
  handleOnboarding,
2774
- baseURL
2880
+ baseURL,
2881
+ fetchOtpFromEmail
2775
2882
  }: LoginAndOnboardParams) => Promise<void>;
2776
2883
  /**
2777
2884
  *
@@ -2806,10 +2913,7 @@ declare class OrganizationPage {
2806
2913
  appName
2807
2914
  }: {
2808
2915
  credentials: Credentials;
2809
- fetchOtpFromEmail?: (params: {
2810
- email: string;
2811
- timeout: number;
2812
- }) => Promise<string>;
2916
+ fetchOtpFromEmail?: FetchOtpFromEmail;
2813
2917
  appName: string;
2814
2918
  }) => Promise<{
2815
2919
  STORAGE_STATE: {