@bigbinary/neeto-playwright-commons 1.9.2 → 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
@@ -222,6 +222,16 @@ declare class CustomCommands {
222
222
  countSelector,
223
223
  countText
224
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>;
225
235
  }
226
236
  interface EmailContentParams {
227
237
  email: string;
@@ -616,6 +626,214 @@ declare class ZapierPage extends IntegrationBase {
616
626
  }) => Promise<string>;
617
627
  disconnectAndVerify: () => Promise<void>;
618
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
+ }
619
837
  interface BasicUserInfo {
620
838
  firstName: string;
621
839
  lastName: string;
@@ -751,6 +969,7 @@ declare const ROUTES: {
751
969
  subdomainAvailability: string;
752
970
  countries: string;
753
971
  neetoApps: string;
972
+ directUploads: string;
754
973
  teamMembers: {
755
974
  all: string;
756
975
  bulkUpdate: string;
@@ -784,6 +1003,9 @@ declare const THIRD_PARTY_ROUTES: {
784
1003
  zapEditor: (zapId: string) => string;
785
1004
  };
786
1005
  };
1006
+ declare const NEETO_ROUTES: {
1007
+ imageUploader: string;
1008
+ };
787
1009
  declare const networkConditions: Record<"Slow 3G" | "Fast 3G" | "No Throttling", Protocol.Network.emulateNetworkConditionsParameters>;
788
1010
  /**
789
1011
  *
@@ -1142,6 +1364,33 @@ declare const EMBED_SELECTORS: {
1142
1364
  elementIdInput: string;
1143
1365
  previewElementPopupButton: string;
1144
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
+ };
1145
1394
  declare const CHAT_WIDGET_TEXTS: {
1146
1395
  newConversation: string;
1147
1396
  welcomeChatBubble: string;
@@ -1437,6 +1686,21 @@ declare const hexToRGB: (hex: string) => string;
1437
1686
  declare const filterUtils: {
1438
1687
  openFilterPane: (page: Page) => Promise<void>;
1439
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
+ };
1440
1704
  interface CurrentsOverrides {
1441
1705
  projectId: string;
1442
1706
  }
@@ -1465,4 +1729,4 @@ interface Overrides {
1465
1729
  * @endexample
1466
1730
  */
1467
1731
  declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
1468
- 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 };
package/index.js CHANGED
@@ -4,12 +4,12 @@ import * as fs$d from 'fs';
4
4
  import fs__default, { writeFileSync as writeFileSync$1, unlinkSync, readFileSync } from 'fs';
5
5
  import { curry, not, isEmpty as isEmpty$1, isNil, isNotNil, mergeDeepLeft, mergeAll } from 'ramda';
6
6
  import require$$0$2 from 'util';
7
+ import Path from 'path';
7
8
  import { faker } from '@faker-js/faker';
8
9
  import MailosaurClient from 'mailosaur';
9
10
  import dayjs from 'dayjs';
10
11
  import require$$1$1 from 'tty';
11
12
  import require$$0$3 from 'os';
12
- import Path from 'path';
13
13
  import Stream$4 from 'stream';
14
14
  import require$$0$4 from 'events';
15
15
  import { getI18nInstance, initI18n } from 'playwright-i18next-fixture';
@@ -26,6 +26,58 @@ import require$$1$2 from 'string_decoder';
26
26
  import require$$4$1 from 'timers';
27
27
  import require$$3$2 from 'crypto';
28
28
 
29
+ const BASE_URL = "/api/v1";
30
+ const NEETO_AUTH_BASE_URL = (subdomain = "app") => `https://${subdomain}.neetoauth.net`;
31
+ const ROUTES = {
32
+ neetoAuthSignup: `${NEETO_AUTH_BASE_URL()}/signups/new`,
33
+ neetoAuth: NEETO_AUTH_BASE_URL(),
34
+ loginLink: "/login",
35
+ profile: "/profile",
36
+ admin: "/admin",
37
+ myProfile: "/my/profile",
38
+ authSettings: "/settings",
39
+ webhooks: "/webhooks",
40
+ login: `${BASE_URL}/login`,
41
+ signup: `${BASE_URL}/signups`,
42
+ subdomainAvailability: `${BASE_URL}/subdomain_availability`,
43
+ countries: `${BASE_URL}/countries`,
44
+ neetoApps: `${BASE_URL}/neeto_apps`,
45
+ directUploads: "/direct_uploads",
46
+ teamMembers: {
47
+ all: "/team_members*/**",
48
+ bulkUpdate: "/team_members/teams/bulk_update",
49
+ index: "/team_members/teams",
50
+ show: (id) => `/team_members/teams/${id}`,
51
+ },
52
+ };
53
+ const API_ROUTES = {
54
+ teamMembers: {
55
+ all: "/team_members*/**",
56
+ bulkUpdate: "/team_members/teams/bulk_update",
57
+ index: "/team_members/teams",
58
+ show: (id) => `/team_members/teams/${id}`,
59
+ },
60
+ integrations: {
61
+ zapier: {
62
+ api_keys: "/neeto_integrations/zapier/api_keys",
63
+ },
64
+ },
65
+ };
66
+ const THIRD_PARTY_ROUTES = {
67
+ webhooks: { site: "https://webhook.site/" },
68
+ slack: {
69
+ loginWithPassword: (workspace) => `https://${workspace}.slack.com/sign_in_with_password`,
70
+ },
71
+ zapier: {
72
+ login: "https://zapier.com/app/login",
73
+ logOut: "https://zapier.com/logout",
74
+ zapEditor: (zapId) => `https://zapier.com/editor/${zapId}`,
75
+ },
76
+ };
77
+ const NEETO_ROUTES = {
78
+ imageUploader: "/neeto_image_uploader_engine",
79
+ };
80
+
29
81
  const NEETO_FILTERS_SELECTORS = {
30
82
  emailSelectContainer: "email-select-container-wrapper",
31
83
  filterPaneHeading: "neeto-filters-pane-header",
@@ -45,6 +97,34 @@ const NEETO_FILTERS_SELECTORS = {
45
97
  searchTermBlock: "neeto-filters-search-term-block",
46
98
  };
47
99
 
100
+ const NEETO_IMAGE_UPLOADER_SELECTORS = {
101
+ imageUploaderWrapper: "image-uploader-wrapper",
102
+ browseText: "neeto-image-uploader-browse-text",
103
+ fileInput: "neeto-image-uploader-file-input",
104
+ uploadedImage: "uploaded-image",
105
+ uploadNewAsset: "upload-new-asset",
106
+ basicImageUploaderRemoveButton: "basic-image-uploader-remove-button",
107
+ removeButton: "image-uploader-remove-button",
108
+ openImageLibraryButton: "image-uploader-open-image-library-button",
109
+ openAssetLibraryButton: "open-asset-library-button",
110
+ imageEditorBackButton: "image-editor-back-button",
111
+ aspectRatioWidthInput: "aspect-ratio-width-input",
112
+ aspectRatioHeightInput: "aspect-ratio-height-input",
113
+ cropSubmitButton: "neeto-image-uploader-crop-submit-button",
114
+ restrictionMessage: "neeto-image-uploader-restriction-message",
115
+ progressBar: "neeto-image-uploader-progress-bar",
116
+ myImagesTab: "neeto-image-uploader-my-images-tab",
117
+ unsplashTab: "neeto-image-uploader-unsplash-tab",
118
+ nthLibraryImage: (index) => `niu-library-image-${index}`,
119
+ nthUnsplashImage: (index) => `niu-unsplash-image-${index}`,
120
+ unsplashSearchInput: "niu-unsplash-image-picker-search-input",
121
+ imageEditorUploadedImage: "image-editor-uploaded-image",
122
+ selectOriginalImageSwitch: "select-original-image-switch",
123
+ lockAspectRatioSwitch: "lock-aspect-ratio-switch",
124
+ widthInputField: "width-input-field",
125
+ heightInputField: "height-input-field",
126
+ };
127
+
48
128
  const ENVIRONMENT = {
49
129
  development: "development",
50
130
  staging: "staging",
@@ -2504,6 +2584,12 @@ var lib$7 = {
2504
2584
 
2505
2585
  var qs$1 = /*@__PURE__*/getDefaultExportFromCjs(lib$7);
2506
2586
 
2587
+ const getImagePathAndName = (localImagePath) => {
2588
+ const imagePath = Path.join(__dirname, localImagePath);
2589
+ const imageName = Path.basename(localImagePath, Path.extname(localImagePath));
2590
+ return { imagePath, imageName };
2591
+ };
2592
+
2507
2593
  class CustomCommands {
2508
2594
  constructor(page, request, baseURL = process.env.BASE_URL) {
2509
2595
  this.interceptMultipleResponses = ({ responseUrl = "", responseStatus = 200, times = 1, baseUrl, customPageContext, timeout = 35000, } = {}) => {
@@ -2618,6 +2704,20 @@ class CustomCommands {
2618
2704
  await expect(this.page.getByTestId(countSelector)).toContainText(countText);
2619
2705
  }).toPass({ timeout: 15000 });
2620
2706
  };
2707
+ this.uploadImage = async (localImagePath) => {
2708
+ const { imageName, imagePath } = getImagePathAndName(localImagePath);
2709
+ await this.page
2710
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.browseText)
2711
+ .click();
2712
+ const uploadFile = this.interceptMultipleResponses({
2713
+ responseUrl: ROUTES.directUploads,
2714
+ });
2715
+ await this.page
2716
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.fileInput)
2717
+ .setInputFiles(imagePath);
2718
+ await uploadFile;
2719
+ await expect(this.page.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.uploadedImage)).toHaveAttribute("src", new RegExp(imageName), { timeout: 20000 });
2720
+ };
2621
2721
  this.page = page;
2622
2722
  this.responses = [];
2623
2723
  this.request = request;
@@ -12548,54 +12648,6 @@ class EmbedBase {
12548
12648
  }
12549
12649
  }
12550
12650
 
12551
- const BASE_URL = "/api/v1";
12552
- const NEETO_AUTH_BASE_URL = (subdomain = "app") => `https://${subdomain}.neetoauth.net`;
12553
- const ROUTES = {
12554
- neetoAuthSignup: `${NEETO_AUTH_BASE_URL()}/signups/new`,
12555
- neetoAuth: NEETO_AUTH_BASE_URL(),
12556
- loginLink: "/login",
12557
- profile: "/profile",
12558
- admin: "/admin",
12559
- myProfile: "/my/profile",
12560
- authSettings: "/settings",
12561
- webhooks: "/webhooks",
12562
- login: `${BASE_URL}/login`,
12563
- signup: `${BASE_URL}/signups`,
12564
- subdomainAvailability: `${BASE_URL}/subdomain_availability`,
12565
- countries: `${BASE_URL}/countries`,
12566
- neetoApps: `${BASE_URL}/neeto_apps`,
12567
- teamMembers: {
12568
- all: "/team_members*/**",
12569
- bulkUpdate: "/team_members/teams/bulk_update",
12570
- index: "/team_members/teams",
12571
- show: (id) => `/team_members/teams/${id}`,
12572
- },
12573
- };
12574
- const API_ROUTES = {
12575
- teamMembers: {
12576
- all: "/team_members*/**",
12577
- bulkUpdate: "/team_members/teams/bulk_update",
12578
- index: "/team_members/teams",
12579
- show: (id) => `/team_members/teams/${id}`,
12580
- },
12581
- integrations: {
12582
- zapier: {
12583
- api_keys: "/neeto_integrations/zapier/api_keys",
12584
- },
12585
- },
12586
- };
12587
- const THIRD_PARTY_ROUTES = {
12588
- webhooks: { site: "https://webhook.site/" },
12589
- slack: {
12590
- loginWithPassword: (workspace) => `https://${workspace}.slack.com/sign_in_with_password`,
12591
- },
12592
- zapier: {
12593
- login: "https://zapier.com/app/login",
12594
- logOut: "https://zapier.com/logout",
12595
- zapEditor: (zapId) => `https://zapier.com/editor/${zapId}`,
12596
- },
12597
- };
12598
-
12599
12651
  const CHAT_WIDGET_TEXTS = {
12600
12652
  newConversation: "New Conversation",
12601
12653
  welcomeChatBubble: "Hi! I'm here to assist you with any questions you may have. What can I do for you?",
@@ -13480,6 +13532,147 @@ class ZapierPage extends IntegrationBase {
13480
13532
  }
13481
13533
  }
13482
13534
 
13535
+ class ImageUploader {
13536
+ constructor({ page, neetoPlaywrightUtilities, }) {
13537
+ this.submitCroppedImage = async () => {
13538
+ const cropImage = this.neetoPlaywrightUtilities.interceptMultipleResponses({
13539
+ responseUrl: ROUTES.directUploads,
13540
+ });
13541
+ await this.page
13542
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.cropSubmitButton)
13543
+ .click();
13544
+ await cropImage;
13545
+ };
13546
+ this.removeImage = async () => {
13547
+ await this.page
13548
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.imageUploaderWrapper)
13549
+ .getByTestId(COMMON_SELECTORS.dropdownIcon)
13550
+ .click();
13551
+ await this.page
13552
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.removeButton)
13553
+ .click();
13554
+ await expect(this.page.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.uploadedImage)).toBeHidden();
13555
+ };
13556
+ this.openImageLibrary = async () => {
13557
+ const fetchImages = this.neetoPlaywrightUtilities.interceptMultipleResponses({
13558
+ responseUrl: NEETO_ROUTES.imageUploader,
13559
+ });
13560
+ await this.page
13561
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.openAssetLibraryButton)
13562
+ .click();
13563
+ await fetchImages;
13564
+ };
13565
+ this.cropImage = async ({ toggleAspectRatioLock = false, width = "100", height = "100", aspectRatioHeight = "9", aspectRatioWidth = "16", } = {}) => {
13566
+ toggleAspectRatioLock &&
13567
+ (await this.page
13568
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.lockAspectRatioSwitch)
13569
+ .click());
13570
+ await this.page
13571
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.aspectRatioHeightInput)
13572
+ .fill(aspectRatioHeight);
13573
+ await this.page
13574
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.aspectRatioWidthInput)
13575
+ .fill(aspectRatioWidth);
13576
+ await this.page
13577
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.widthInputField)
13578
+ .fill(width);
13579
+ await this.page
13580
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.heightInputField)
13581
+ .fill(height);
13582
+ };
13583
+ this.uploadNewImageFromLibrary = async ({ localImagePath, toggleOrginalImage = false, toggleAspectRatioLock = false, aspectRatioHeight = "9", aspectRatioWidth = "16", width = "100", height = "100", }) => {
13584
+ await this.openImageLibrary();
13585
+ const fileUploaderPromise = this.page.waitForEvent("filechooser");
13586
+ await this.page
13587
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.uploadNewAsset)
13588
+ .click();
13589
+ const fileUploader = await fileUploaderPromise;
13590
+ const { imagePath, imageName } = getImagePathAndName(localImagePath);
13591
+ await fileUploader.setFiles(imagePath);
13592
+ await expect(this.page.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.imageEditorUploadedImage)).toHaveAttribute("src", new RegExp(imageName), { timeout: 20000 });
13593
+ toggleOrginalImage
13594
+ ? await this.page
13595
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.selectOriginalImageSwitch)
13596
+ .click()
13597
+ : await this.cropImage({
13598
+ toggleAspectRatioLock,
13599
+ aspectRatioHeight,
13600
+ aspectRatioWidth,
13601
+ width,
13602
+ height,
13603
+ });
13604
+ await this.submitCroppedImage();
13605
+ };
13606
+ this.selectImageFromWeb = async ({ nthImage = 0, searchTerm = "", toggleOrginalImage = false, toggleAspectRatioLock = false, aspectRatioHeight = "9", aspectRatioWidth = "16", width = "100", height = "100", } = {}) => {
13607
+ await this.openImageLibrary();
13608
+ const switchImageTab = this.neetoPlaywrightUtilities.interceptMultipleResponses({
13609
+ responseUrl: NEETO_ROUTES.imageUploader,
13610
+ });
13611
+ await this.page
13612
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.unsplashTab)
13613
+ .click();
13614
+ await switchImageTab;
13615
+ if (isNotEmpty(searchTerm)) {
13616
+ await this.page
13617
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.unsplashSearchInput)
13618
+ .fill(searchTerm);
13619
+ await expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
13620
+ timeout: 10000,
13621
+ });
13622
+ }
13623
+ await this.page
13624
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.nthUnsplashImage(nthImage))
13625
+ .click();
13626
+ await expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
13627
+ timeout: 10000,
13628
+ });
13629
+ toggleOrginalImage
13630
+ ? await this.page
13631
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.selectOriginalImageSwitch)
13632
+ .click()
13633
+ : await this.cropImage({
13634
+ toggleAspectRatioLock,
13635
+ aspectRatioHeight,
13636
+ aspectRatioWidth,
13637
+ width,
13638
+ height,
13639
+ });
13640
+ await this.submitCroppedImage();
13641
+ };
13642
+ this.selectImageFromLibrary = async ({ nthImage = 0, searchTerm = "", toggleOrginalImage = false, toggleAspectRatioLock = false, aspectRatioHeight = "9", aspectRatioWidth = "16", width = "100", height = "100", } = {}) => {
13643
+ await this.openImageLibrary();
13644
+ await expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
13645
+ timeout: 10000,
13646
+ });
13647
+ if (isNotEmpty(searchTerm)) {
13648
+ await this.page
13649
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.unsplashSearchInput)
13650
+ .fill(searchTerm);
13651
+ await expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
13652
+ timeout: 10000,
13653
+ });
13654
+ }
13655
+ await this.page
13656
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.nthLibraryImage(nthImage))
13657
+ .click();
13658
+ toggleOrginalImage
13659
+ ? await this.page
13660
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.selectOriginalImageSwitch)
13661
+ .click()
13662
+ : await this.cropImage({
13663
+ toggleAspectRatioLock,
13664
+ aspectRatioHeight,
13665
+ aspectRatioWidth,
13666
+ width,
13667
+ height,
13668
+ });
13669
+ await this.submitCroppedImage();
13670
+ };
13671
+ this.page = page;
13672
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
13673
+ }
13674
+ }
13675
+
13483
13676
  const LOGIN_SELECTORS = {
13484
13677
  appleAuthenticationButton: "apple-authentication-button",
13485
13678
  emailTextField: "login-email-text-field",
@@ -147485,5 +147678,5 @@ const definePlaywrightConfig = (overrides) => {
147485
147678
  });
147486
147679
  };
147487
147680
 
147488
- export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, 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, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
147681
+ export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, 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, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
147489
147682
  //# sourceMappingURL=index.js.map