@bigbinary/neeto-playwright-commons 1.9.1 → 1.9.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.d.ts CHANGED
@@ -42,8 +42,7 @@ interface ApiRequestProps {
42
42
  params?: ParamProps;
43
43
  }
44
44
  interface WaitForPageLoadParams {
45
- visiblityTimeout: number;
46
- retryTimeout: number;
45
+ visibilityTimeout: number;
47
46
  customPageContext: Page | undefined;
48
47
  }
49
48
  type ApiRequest = (props: ApiRequestProps & Record<string, unknown>) => Promise<APIResponse | undefined>;
@@ -57,7 +56,7 @@ interface SelectOptionFromDropdownParams {
57
56
  selectMenu: string;
58
57
  value: string;
59
58
  options?: Partial<{
60
- visiblityTimeout: number;
59
+ visibilityTimeout: number;
61
60
  textAssertionTimeout: number;
62
61
  retryTimeout: number;
63
62
  }>;
@@ -152,9 +151,9 @@ declare class CustomCommands {
152
151
  */
153
152
  reloadAndWait: (requestCount: number, customPageContext?: Page, interceptMultipleResponsesProps?: Partial<Omit<InterceptMultipleResponsesParams, "times">>) => Promise<void>;
154
153
  waitForPageLoad: ({
155
- visiblityTimeout,
154
+ visibilityTimeout,
156
155
  customPageContext
157
- }: WaitForPageLoadParams) => Promise<void>;
156
+ }?: Partial<WaitForPageLoadParams>) => Promise<void>;
158
157
  /**
159
158
  *
160
159
  * Command to send a request.
@@ -223,6 +222,16 @@ declare class CustomCommands {
223
222
  countSelector,
224
223
  countText
225
224
  }: SearchAndVerifyProps) => Promise<void>;
225
+ /**
226
+ *
227
+ * Command to upload an image to image uploader and verify it.
228
+ *
229
+ * @example
230
+ *
231
+ * await neetoPlaywrightUtilities.uploadImage("../assets/image.png");
232
+ * @endexample
233
+ */
234
+ uploadImage: (localImagePath: string) => Promise<void>;
226
235
  }
227
236
  interface EmailContentParams {
228
237
  email: string;
@@ -617,6 +626,214 @@ declare class ZapierPage extends IntegrationBase {
617
626
  }) => Promise<string>;
618
627
  disconnectAndVerify: () => Promise<void>;
619
628
  }
629
+ interface CropImageProps {
630
+ toggleAspectRatioLock: boolean;
631
+ aspectRatioHeight: string;
632
+ aspectRatioWidth: string;
633
+ width: string;
634
+ height: string;
635
+ }
636
+ interface ImageLibraryProps extends Partial<CropImageProps> {
637
+ toggleOrginalImage?: boolean;
638
+ localImagePath: string;
639
+ }
640
+ interface SelectImage extends CropImageProps {
641
+ toggleOrginalImage: boolean;
642
+ searchTerm: string;
643
+ nthImage: number;
644
+ }
645
+ declare class ImageUploader {
646
+ page: Page;
647
+ neetoPlaywrightUtilities: CustomCommands;
648
+ constructor({
649
+ page,
650
+ neetoPlaywrightUtilities
651
+ }: {
652
+ page: Page;
653
+ neetoPlaywrightUtilities: CustomCommands;
654
+ });
655
+ private submitCroppedImage;
656
+ /**
657
+ *
658
+ * Used to remove an image already uploaded from the image uploader amd verify it.
659
+ *
660
+ * @example
661
+ *
662
+ * await imageUploader.removeImage()
663
+ * @endexample
664
+ */
665
+ removeImage: () => Promise<void>;
666
+ /**
667
+ *
668
+ * Used to open the image library modal.
669
+ *
670
+ * @example
671
+ *
672
+ * await imageUploader.openImageLibrary()
673
+ * @endexample
674
+ */
675
+ openImageLibrary: () => Promise<void>;
676
+ /**
677
+ *
678
+ * Used to crop the image. It takes the following parameters:
679
+ *
680
+ * toggleAspectRatioLock (optional): A boolean value to toggle the aspect ratio lock switch which is checked by default. Default is false.
681
+ *
682
+ * aspectRatioHeight (optional): The height of the aspect ratio. Default is 9.
683
+ *
684
+ * aspectRatioWidth (optional): The width of the aspect ratio. Default is 16.
685
+ *
686
+ * width (optional): The width of the cropped image. Default is 100.
687
+ *
688
+ * height (optional): The height of the cropped image. Default is 100.
689
+ *
690
+ * @example
691
+ *
692
+ * await imageUploader.cropImage({
693
+ * toggleAspectRatioLock: false
694
+ * aspectRatioHeight: "9",
695
+ * aspectRatioWidth: "16",
696
+ * width: "100",
697
+ * height: "100",
698
+ * })
699
+ * @endexample
700
+ */
701
+ cropImage: ({
702
+ toggleAspectRatioLock,
703
+ width,
704
+ height,
705
+ aspectRatioHeight,
706
+ aspectRatioWidth
707
+ }?: Partial<CropImageProps>) => Promise<void>;
708
+ /**
709
+ *
710
+ * Used to upload a new image from the library and crop it if required. It takes the following parameters:
711
+ *
712
+ * localImagePath: The path of the image to be uploaded.
713
+ *
714
+ * toggleOrginalImage (optional): A boolean value to toggle the original image switch which is not checked by default. Default is false.
715
+ *
716
+ * toggleAspectRatioLock (optional): A boolean value to toggle the aspect ratio lock switch which is checked by default. Default is false.
717
+ *
718
+ * aspectRatioHeight (optional): The height of the aspect ratio. Default is 9.
719
+ *
720
+ * aspectRatioWidth (optional): The width of the aspect ratio. Default is 16.
721
+ *
722
+ * width (optional): The width of the cropped image. Default is 100.
723
+ *
724
+ * height (optional): The height of the cropped image. Default is 100.
725
+ *
726
+ * @example
727
+ *
728
+ * await imageUploader.uploadNewImageFromLibrary({
729
+ * localImagePath,
730
+ * toggleOrginalImage: false,
731
+ * toggleAspectRatioLock: false,
732
+ * aspectRatioHeight: "9",
733
+ * aspectRatioWidth: "16",
734
+ * width: "100",
735
+ * height: "100",
736
+ * })
737
+ * @endexample
738
+ */
739
+ uploadNewImageFromLibrary: ({
740
+ localImagePath,
741
+ toggleOrginalImage,
742
+ toggleAspectRatioLock,
743
+ aspectRatioHeight,
744
+ aspectRatioWidth,
745
+ width,
746
+ height
747
+ }: ImageLibraryProps) => Promise<void>;
748
+ /**
749
+ *
750
+ * Used to select an image from the unsplash and crop it if required. It takes the following parameters:
751
+ *
752
+ * nthImage (optional): The index of the image to be selected. Default is 0.
753
+ *
754
+ * searchTerm (optional): The input for the search field.
755
+ *
756
+ * toggleOrginalImage (optional): A boolean value to toggle the original image switch which is not checked by default. Default is false.
757
+ *
758
+ * toggleAspectRatioLock (optional): A boolean value to toggle the aspect ratio lock switch which is checked by default. Default is false.
759
+ *
760
+ * aspectRatioHeight (optional): The height of the aspect ratio. Default is 9.
761
+ *
762
+ * aspectRatioWidth (optional): The width of the aspect ratio. Default is 16.
763
+ *
764
+ * width (optional): The width of the cropped image. Default is 100.
765
+ *
766
+ * height (optional): The height of the cropped image. Default is 100.
767
+ *
768
+ * @example
769
+ *
770
+ * await imageUploader.selectImageFromWeb({
771
+ * nthImage: 0,
772
+ * searchTerm: "",
773
+ * toggleOrginalImage: false,
774
+ * toggleAspectRatioLock: false,
775
+ * aspectRatioHeight: "9",
776
+ * aspectRatioWidth: "16",
777
+ * width: "100",
778
+ * height: "100",
779
+ * })
780
+ * @endexample
781
+ */
782
+ selectImageFromWeb: ({
783
+ nthImage,
784
+ searchTerm,
785
+ toggleOrginalImage,
786
+ toggleAspectRatioLock,
787
+ aspectRatioHeight,
788
+ aspectRatioWidth,
789
+ width,
790
+ height
791
+ }?: Partial<SelectImage>) => Promise<void>;
792
+ /**
793
+ *
794
+ * Used to select an image from the library and crop it if required. It takes the following parameters
795
+ *
796
+ * nthImage (optional): The index of the image to be selected. Default is 0.
797
+ *
798
+ * searchTerm (optional): The input for the search field.
799
+ *
800
+ * toggleOrginalImage (optional): A boolean value to toggle the original image switch which is not checked by default. Default is false.
801
+ *
802
+ * toggleAspectRatioLock (optional): A boolean value to toggle the aspect ratio lock switch which is checked by default. Default is false.
803
+ *
804
+ * aspectRatioHeight (optional): The height of the aspect ratio. Default is 9.
805
+ *
806
+ * aspectRatioWidth (optional): The width of the aspect ratio. Default is 16.
807
+ *
808
+ * width (optional): The width of the cropped image. Default is 100.
809
+ *
810
+ * height (optional): The height of the cropped image. Default is 100.
811
+ *
812
+ * @example
813
+ *
814
+ * await imageUploader.selectImageFromLibrary({
815
+ * nthImage: 0,
816
+ * searchTerm: "",
817
+ * toggleOrginalImage: false,
818
+ * toggleAspectRatioLock: false,
819
+ * aspectRatioHeight: "9",
820
+ * aspectRatioWidth: "16",
821
+ * width: "100",
822
+ * height: "100",
823
+ * })
824
+ * @endexample
825
+ */
826
+ selectImageFromLibrary: ({
827
+ nthImage,
828
+ searchTerm,
829
+ toggleOrginalImage,
830
+ toggleAspectRatioLock,
831
+ aspectRatioHeight,
832
+ aspectRatioWidth,
833
+ width,
834
+ height
835
+ }?: Partial<SelectImage>) => Promise<void>;
836
+ }
620
837
  interface BasicUserInfo {
621
838
  firstName: string;
622
839
  lastName: string;
@@ -752,6 +969,7 @@ declare const ROUTES: {
752
969
  subdomainAvailability: string;
753
970
  countries: string;
754
971
  neetoApps: string;
972
+ directUploads: string;
755
973
  teamMembers: {
756
974
  all: string;
757
975
  bulkUpdate: string;
@@ -785,6 +1003,9 @@ declare const THIRD_PARTY_ROUTES: {
785
1003
  zapEditor: (zapId: string) => string;
786
1004
  };
787
1005
  };
1006
+ declare const NEETO_ROUTES: {
1007
+ imageUploader: string;
1008
+ };
788
1009
  declare const networkConditions: Record<"Slow 3G" | "Fast 3G" | "No Throttling", Protocol.Network.emulateNetworkConditionsParameters>;
789
1010
  /**
790
1011
  *
@@ -802,6 +1023,9 @@ declare const networkConditions: Record<"Slow 3G" | "Fast 3G" | "No Throttling",
802
1023
  * @endexample
803
1024
  */
804
1025
  declare const COMMON_SELECTORS: {
1026
+ emailInputError: string;
1027
+ pane: string;
1028
+ sideBar: string;
805
1029
  copyButton: string;
806
1030
  spinner: string;
807
1031
  subheaderText: string;
@@ -1140,6 +1364,33 @@ declare const EMBED_SELECTORS: {
1140
1364
  elementIdInput: string;
1141
1365
  previewElementPopupButton: string;
1142
1366
  };
1367
+ declare const NEETO_IMAGE_UPLOADER_SELECTORS: {
1368
+ imageUploaderWrapper: string;
1369
+ browseText: string;
1370
+ fileInput: string;
1371
+ uploadedImage: string;
1372
+ uploadNewAsset: string;
1373
+ basicImageUploaderRemoveButton: string;
1374
+ removeButton: string;
1375
+ openImageLibraryButton: string;
1376
+ openAssetLibraryButton: string;
1377
+ imageEditorBackButton: string;
1378
+ aspectRatioWidthInput: string;
1379
+ aspectRatioHeightInput: string;
1380
+ cropSubmitButton: string;
1381
+ restrictionMessage: string;
1382
+ progressBar: string;
1383
+ myImagesTab: string;
1384
+ unsplashTab: string;
1385
+ nthLibraryImage: (index: number) => string;
1386
+ nthUnsplashImage: (index: number) => string;
1387
+ unsplashSearchInput: string;
1388
+ imageEditorUploadedImage: string;
1389
+ selectOriginalImageSwitch: string;
1390
+ lockAspectRatioSwitch: string;
1391
+ widthInputField: string;
1392
+ heightInputField: string;
1393
+ };
1143
1394
  declare const CHAT_WIDGET_TEXTS: {
1144
1395
  newConversation: string;
1145
1396
  welcomeChatBubble: string;
@@ -1435,6 +1686,21 @@ declare const hexToRGB: (hex: string) => string;
1435
1686
  declare const filterUtils: {
1436
1687
  openFilterPane: (page: Page) => Promise<void>;
1437
1688
  };
1689
+ /**
1690
+ *
1691
+ * Function to get the image path and name from the image in a given path.
1692
+ *
1693
+ * @example
1694
+ *
1695
+ * import { getImagePathAndName } from "@bigbinary/neeto-playwright-commons";
1696
+ *
1697
+ * const { imagePath, imageName } = getImagePathAndName("../assets/images/image.png");
1698
+ * @endexample
1699
+ */
1700
+ declare const getImagePathAndName: (localImagePath: string) => {
1701
+ imagePath: string;
1702
+ imageName: string;
1703
+ };
1438
1704
  interface CurrentsOverrides {
1439
1705
  projectId: string;
1440
1706
  }
@@ -1463,4 +1729,4 @@ interface Overrides {
1463
1729
  * @endexample
1464
1730
  */
1465
1731
  declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
1466
- export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, EMBED_SELECTORS, ENVIRONMENT, EmbedBase, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SidebarSection, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, TOASTR_MESSAGES, USER_AGENTS, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_WEB_TEXTS, ZapierPage, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, filterUtils, generateRandomBypassEmail, generateStagingData, getByDataQA, getGlobalUserState, headerUtils, hexToRGB, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, _default as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
1732
+ export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, EMBED_SELECTORS, ENVIRONMENT, EmbedBase, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, ImageUploader, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SidebarSection, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, TOASTR_MESSAGES, USER_AGENTS, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_WEB_TEXTS, ZapierPage, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, filterUtils, generateRandomBypassEmail, generateStagingData, getByDataQA, getGlobalUserState, getImagePathAndName, headerUtils, hexToRGB, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, _default as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };