@bigbinary/neeto-playwright-commons 1.11.10 → 1.11.12

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 CHANGED
@@ -100,6 +100,7 @@ const ROUTES = {
100
100
  },
101
101
  attachment: `/neeto_editor${BASE_URL}/direct_uploads/attach`,
102
102
  dashboard: "/dashboard",
103
+ neetoThankYou: "/neeto_thank_you_engine",
103
104
  };
104
105
  const API_ROUTES = {
105
106
  teamMembers: {
@@ -12681,6 +12682,173 @@ const i18nFixture = {
12681
12682
  },
12682
12683
  };
12683
12684
 
12685
+ const THANK_YOU_SELECTORS = {
12686
+ settingsLink: "thank-you-settings-link",
12687
+ showSocialShareIconsSwitch: "show-social-share-icons-switch",
12688
+ showLinkToSubmitAnotherResponseSwitch: "show-link-to-submit-another-response-switch",
12689
+ submitAnotherResponseLinkTextInputField: "submit-another-response-link-text-input-field",
12690
+ previewEditorContent: "preview-editor-content",
12691
+ redirectToExternalLinkRadioLabel: () => "neeto-thank-you-configuration-redirect-to-url-label",
12692
+ thankYouConfigurationLabel: (label = "custom-message") => `neeto-thank-you-configuration-${label}-label`,
12693
+ saveChangesButton: "neeto-thank-you-configuration-save-button",
12694
+ cancelButton: "neeto-thank-you-configuration-cancel-button",
12695
+ thankYouPageImage: "thank-you-page-image",
12696
+ thankYouPageMessage: "thank-you-page-message",
12697
+ thankYouPageContent: "thank-you-page-content",
12698
+ thankYouPageResubmitLink: "thank-you-page-resubmit-link",
12699
+ linkInputField: "link-input-field",
12700
+ previewImage: "preview-image",
12701
+ };
12702
+
12703
+ const optionSelector = (option) => `neeto-editor-fixed-menu-${option}-option`;
12704
+ const fixedMenuSelector = (selector) => `neeto-editor-fixed-menu-${selector}`;
12705
+
12706
+ const NEETO_EDITOR_SELECTORS = {
12707
+ fontSize: optionSelector("font-size"),
12708
+ boldOption: optionSelector("bold"),
12709
+ italicOption: optionSelector("italic"),
12710
+ underlineOption: optionSelector("underline"),
12711
+ strikeOption: optionSelector("strike"),
12712
+ codeBlockOption: optionSelector("code"),
12713
+ highlightOption: optionSelector("highlight"),
12714
+ emojiOption: optionSelector("emoji"),
12715
+ emojiDropdownIcon: "emoji-dropdown-icon",
12716
+ linkInput: fixedMenuSelector("link-option-input"),
12717
+ linkSubmitButton: fixedMenuSelector("link-option-link-button"),
12718
+ commandList: (index) => `neeto-editor-command-list-item-${index}`,
12719
+ imageUploadUrlSubmitButton: "neeto-editor-media-upload-url-submit",
12720
+ imageUploadUrlInputTextField: "neeto-editor-media-upload-url-input",
12721
+ uploadInput: "neeto-editor-media-uploader-input",
12722
+ editorMenuBarWrapper: fixedMenuSelector("wrapper"),
12723
+ undoOption: optionSelector("undo"),
12724
+ redoOption: optionSelector("redo"),
12725
+ imageWrapper: "neeto-editor-image-wrapper",
12726
+ contentField: "neeto-editor-content",
12727
+ addLinkButton: optionSelector("link"),
12728
+ addLinkTextField: "neeto-editor-add-link-text-input",
12729
+ addURLTextField: "neeto-editor-add-link-url-input",
12730
+ submitLinkButton: "neeto-editor-add-link",
12731
+ fixedMenuArrow: fixedMenuSelector("arrow"),
12732
+ cannedResponseOption: optionSelector("canned-responses"),
12733
+ cannedResponseSelectContainer: "select-a-canned-response-select-container",
12734
+ fixedMenuWrapper: fixedMenuSelector("wrapper"),
12735
+ linkOption: optionSelector("link"),
12736
+ addLinkUrlInput: "neeto-editor-add-link-url-input",
12737
+ addLinkDoneButton: "neeto-editor-add-link",
12738
+ unlinkButton: "neeto-editor-link-popover-unlink",
12739
+ editorAttachmentsButton: optionSelector("attachments"),
12740
+ attachmentPreviewDeleteButton: "neeto-editor-preview-delete-button",
12741
+ imageUploadOption: optionSelector("image-upload"),
12742
+ imageUploadLinkInput: "neeto-editor-media-upload-url-input",
12743
+ imageUploadButton: "neeto-editor-media-uploader-dnd",
12744
+ imageUploadLinkSubmitButton: "neeto-editor-media-upload-url-submit",
12745
+ applyButton: "apply-button",
12746
+ videoEmbedOption: optionSelector("video-embed"),
12747
+ videoEmbedInput: "neeto-editor-embed-input",
12748
+ videoEmbedSubmit: "neeto-editor-embed-cancel",
12749
+ videoWrapper: "neeto-editor-video-wrapper",
12750
+ paragraphOption: fixedMenuSelector("font-size-option-body2"),
12751
+ attachmentPreview: "ne-attachments-wrapper",
12752
+ imageUploadLinkButton: "neeto-editor-media-uploader-link-tab",
12753
+ errorText: "neeto-editor-error-text",
12754
+ content: "editor-content",
12755
+ imageUploadDeleteButton: "neeto-editor-image-menu-Delete",
12756
+ dynamicVariablesButton: "dynamic-variables-button",
12757
+ emojiContainer: "neeto-editor-emoji-picker",
12758
+ dynamicVariableSelector: (variable) => `dynamic-variables-list-item-${neetoCist.hyphenate(variable)}`,
12759
+ };
12760
+ const NEETO_TEXT_MODIFIER_SELECTORS = {
12761
+ strike: optionSelector("strike"),
12762
+ underline: optionSelector("underline"),
12763
+ highlight: optionSelector("highlight"),
12764
+ };
12765
+ const TEXT_MODIFIER_SELECTORS = {
12766
+ bold: optionSelector("bold"),
12767
+ italic: optionSelector("italic"),
12768
+ code: optionSelector("code"),
12769
+ blockquote: optionSelector("blockquote"),
12770
+ codeBlock: optionSelector("codeBlock"),
12771
+ };
12772
+ const LIST_MODIFIER_SELECTORS = {
12773
+ bulletList: optionSelector("bulletList"),
12774
+ orderedList: optionSelector("orderedList"),
12775
+ };
12776
+ const FONT_SIZE_SELECTORS = {
12777
+ h1: fixedMenuSelector("font-size-option-h1"),
12778
+ h2: fixedMenuSelector("font-size-option-h2"),
12779
+ h3: fixedMenuSelector("font-size-option-h3"),
12780
+ h4: fixedMenuSelector("font-size-option-h4"),
12781
+ h5: fixedMenuSelector("font-size-option-h5"),
12782
+ };
12783
+
12784
+ const TAB_SELECTORS = {
12785
+ configureTab: "configure-tab",
12786
+ buildTab: "build-tab",
12787
+ themeTab: "theme-tab",
12788
+ shareTab: "share-tab",
12789
+ submissionsTab: "submissions-tab",
12790
+ paymentsTab: "payments-tab",
12791
+ };
12792
+
12793
+ class ThankYouPage {
12794
+ constructor(page, neetoPlaywrightUtilities) {
12795
+ this.navigateToThankYouPage = async () => {
12796
+ await this.page.getByTestId(TAB_SELECTORS.configureTab).click();
12797
+ const fetchConfiguration = this.neetoPlaywrightUtilities.interceptMultipleResponses({
12798
+ responseUrl: ROUTES.neetoThankYou,
12799
+ });
12800
+ await this.page.getByTestId(THANK_YOU_SELECTORS.settingsLink).click();
12801
+ await fetchConfiguration;
12802
+ };
12803
+ this.saveChanges = async () => {
12804
+ const saveChangesButton = this.page.getByTestId(THANK_YOU_SELECTORS.saveChangesButton);
12805
+ await saveChangesButton.click();
12806
+ await this.neetoPlaywrightUtilities.verifyToast();
12807
+ await test$1.expect(saveChangesButton).toBeDisabled();
12808
+ };
12809
+ this.verifyThankYouImage = async (imagePath, imageName) => {
12810
+ await test$1.expect(this.page.getByTestId(THANK_YOU_SELECTORS.thankYouConfigurationLabel())).toBeChecked();
12811
+ await this.neetoPlaywrightUtilities.uploadImage(imagePath);
12812
+ await test$1.expect(this.page.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.progressBar)).toBeHidden();
12813
+ await test$1.expect(this.page.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.uploadedImage)).toHaveAttribute("src", RegExp(imageName), { timeout: 15000 });
12814
+ await test$1.expect(this.page.getByTestId(THANK_YOU_SELECTORS.previewImage)).toHaveAttribute("src", RegExp(imageName), { timeout: 15000 });
12815
+ };
12816
+ this.verifyEditorMenu = async () => {
12817
+ await Promise.all([
12818
+ NEETO_EDITOR_SELECTORS.fontSize,
12819
+ NEETO_EDITOR_SELECTORS.boldOption,
12820
+ NEETO_EDITOR_SELECTORS.italicOption,
12821
+ NEETO_EDITOR_SELECTORS.underlineOption,
12822
+ NEETO_EDITOR_SELECTORS.linkOption,
12823
+ NEETO_EDITOR_SELECTORS.strikeOption,
12824
+ LIST_MODIFIER_SELECTORS.bulletList,
12825
+ LIST_MODIFIER_SELECTORS.orderedList,
12826
+ TEXT_MODIFIER_SELECTORS.code,
12827
+ ].map(editorElement => test$1.expect(this.page
12828
+ .getByTestId(NEETO_EDITOR_SELECTORS.fixedMenuWrapper)
12829
+ .getByTestId(editorElement)).toBeVisible()));
12830
+ };
12831
+ this.verifyThankYouMessage = async (thankYouMessage) => {
12832
+ await this.page.getByTestId(NEETO_EDITOR_SELECTORS.contentField).clear();
12833
+ await this.page
12834
+ .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
12835
+ .fill(thankYouMessage);
12836
+ await test$1.expect(this.page.getByTestId(THANK_YOU_SELECTORS.previewEditorContent)).toContainText(thankYouMessage);
12837
+ };
12838
+ this.addRedirectUrl = async (customRedirectUrl) => {
12839
+ await this.page
12840
+ .getByTestId(THANK_YOU_SELECTORS.thankYouConfigurationLabel("redirect-to-url"))
12841
+ .click();
12842
+ await this.page
12843
+ .getByTestId(THANK_YOU_SELECTORS.linkInputField)
12844
+ .fill(customRedirectUrl);
12845
+ };
12846
+ this.page = page;
12847
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
12848
+ this.t = playwrightI18nextFixture.getI18nInstance().t;
12849
+ }
12850
+ }
12851
+
12684
12852
  const EMBED_SELECTORS = {
12685
12853
  iframe: (appName) => `#${appName}-iframe`,
12686
12854
  modal: (appName) => `#${appName}-modal`,
@@ -15265,12 +15433,13 @@ class SlackPage extends IntegrationBase {
15265
15433
  };
15266
15434
  this.connectAndVerifyIntegration = async (redirectUrl, customSteps, channelToConfigure = SLACK_DEFAULT_CHANNEL) => {
15267
15435
  await this.connect();
15268
- await this.page
15269
- .getByRole("button", {
15436
+ const loginButton = this.page.getByRole("button", {
15270
15437
  name: this.t("neetoSlack.slack.connect.loginButton"),
15271
- })
15272
- .click({ delay: 5000 });
15273
- await this.page.waitForURL(RegExp("(.*)slack.com/.*"));
15438
+ });
15439
+ if (await loginButton.isVisible()) {
15440
+ await loginButton.click({ delay: 5000 });
15441
+ await this.page.waitForURL(RegExp("(.*)slack.com/.*"));
15442
+ }
15274
15443
  const allowButton = this.page.getByRole("button", {
15275
15444
  name: SLACK_WEB_TEXTS.allow,
15276
15445
  });
@@ -15759,87 +15928,6 @@ const LIST_MODIFIER_TAGS = {
15759
15928
  orderedList: "ol",
15760
15929
  };
15761
15930
 
15762
- const optionSelector = (option) => `neeto-editor-fixed-menu-${option}-option`;
15763
- const fixedMenuSelector = (selector) => `neeto-editor-fixed-menu-${selector}`;
15764
-
15765
- const NEETO_EDITOR_SELECTORS = {
15766
- fontSize: optionSelector("font-size"),
15767
- boldOption: optionSelector("bold"),
15768
- italicOption: optionSelector("italic"),
15769
- underlineOption: optionSelector("underline"),
15770
- strikeOption: optionSelector("strike"),
15771
- codeBlockOption: optionSelector("code"),
15772
- highlightOption: optionSelector("highlight"),
15773
- emojiOption: optionSelector("emoji"),
15774
- emojiDropdownIcon: "emoji-dropdown-icon",
15775
- linkInput: fixedMenuSelector("link-option-input"),
15776
- linkSubmitButton: fixedMenuSelector("link-option-link-button"),
15777
- commandList: (index) => `neeto-editor-command-list-item-${index}`,
15778
- imageUploadUrlSubmitButton: "neeto-editor-media-upload-url-submit",
15779
- imageUploadUrlInputTextField: "neeto-editor-media-upload-url-input",
15780
- uploadInput: "neeto-editor-media-uploader-input",
15781
- editorMenuBarWrapper: fixedMenuSelector("wrapper"),
15782
- undoOption: optionSelector("undo"),
15783
- redoOption: optionSelector("redo"),
15784
- imageWrapper: "neeto-editor-image-wrapper",
15785
- contentField: "neeto-editor-content",
15786
- addLinkButton: optionSelector("link"),
15787
- addLinkTextField: "neeto-editor-add-link-text-input",
15788
- addURLTextField: "neeto-editor-add-link-url-input",
15789
- submitLinkButton: "neeto-editor-add-link",
15790
- fixedMenuArrow: fixedMenuSelector("arrow"),
15791
- cannedResponseOption: optionSelector("canned-responses"),
15792
- cannedResponseSelectContainer: "select-a-canned-response-select-container",
15793
- fixedMenuWrapper: fixedMenuSelector("wrapper"),
15794
- linkOption: optionSelector("link"),
15795
- addLinkUrlInput: "neeto-editor-add-link-url-input",
15796
- addLinkDoneButton: "neeto-editor-add-link",
15797
- unlinkButton: "neeto-editor-link-popover-unlink",
15798
- editorAttachmentsButton: optionSelector("attachments"),
15799
- attachmentPreviewDeleteButton: "neeto-editor-preview-delete-button",
15800
- imageUploadOption: optionSelector("image-upload"),
15801
- imageUploadLinkInput: "neeto-editor-media-upload-url-input",
15802
- imageUploadButton: "neeto-editor-media-uploader-dnd",
15803
- imageUploadLinkSubmitButton: "neeto-editor-media-upload-url-submit",
15804
- applyButton: "apply-button",
15805
- videoEmbedOption: optionSelector("video-embed"),
15806
- videoEmbedInput: "neeto-editor-embed-input",
15807
- videoEmbedSubmit: "neeto-editor-embed-cancel",
15808
- videoWrapper: "neeto-editor-video-wrapper",
15809
- paragraphOption: fixedMenuSelector("font-size-option-body2"),
15810
- attachmentPreview: "ne-attachments-wrapper",
15811
- imageUploadLinkButton: "neeto-editor-media-uploader-link-tab",
15812
- errorText: "neeto-editor-error-text",
15813
- content: "editor-content",
15814
- imageUploadDeleteButton: "neeto-editor-image-menu-Delete",
15815
- dynamicVariablesButton: "dynamic-variables-button",
15816
- emojiContainer: "neeto-editor-emoji-picker",
15817
- dynamicVariableSelector: (variable) => `dynamic-variables-list-item-${neetoCist.hyphenate(variable)}`,
15818
- };
15819
- const NEETO_TEXT_MODIFIER_SELECTORS = {
15820
- strike: optionSelector("strike"),
15821
- underline: optionSelector("underline"),
15822
- highlight: optionSelector("highlight"),
15823
- };
15824
- const TEXT_MODIFIER_SELECTORS = {
15825
- bold: optionSelector("bold"),
15826
- italic: optionSelector("italic"),
15827
- code: optionSelector("code"),
15828
- blockquote: optionSelector("blockquote"),
15829
- codeBlock: optionSelector("codeBlock"),
15830
- };
15831
- const LIST_MODIFIER_SELECTORS = {
15832
- bulletList: optionSelector("bulletList"),
15833
- orderedList: optionSelector("orderedList"),
15834
- };
15835
- const FONT_SIZE_SELECTORS = {
15836
- h1: fixedMenuSelector("font-size-option-h1"),
15837
- h2: fixedMenuSelector("font-size-option-h2"),
15838
- h3: fixedMenuSelector("font-size-option-h3"),
15839
- h4: fixedMenuSelector("font-size-option-h4"),
15840
- h5: fixedMenuSelector("font-size-option-h5"),
15841
- };
15842
-
15843
15931
  class EditorPage {
15844
15932
  constructor(page, neetoPlaywrightUtilities, editorWrapper) {
15845
15933
  this.linkUrl = faker.faker.internet.url();
@@ -149174,14 +149262,17 @@ exports.SLACK_WEB_TEXTS = SLACK_WEB_TEXTS;
149174
149262
  exports.STORAGE_STATE = STORAGE_STATE;
149175
149263
  exports.SidebarSection = SidebarSection;
149176
149264
  exports.SlackPage = SlackPage;
149265
+ exports.TAB_SELECTORS = TAB_SELECTORS;
149177
149266
  exports.TAGS_SELECTORS = TAGS_SELECTORS;
149178
149267
  exports.TEXT_MODIFIER_ROLES = TEXT_MODIFIER_ROLES;
149179
149268
  exports.TEXT_MODIFIER_SELECTORS = TEXT_MODIFIER_SELECTORS;
149180
149269
  exports.TEXT_MODIFIER_TAGS = TEXT_MODIFIER_TAGS;
149270
+ exports.THANK_YOU_SELECTORS = THANK_YOU_SELECTORS;
149181
149271
  exports.THIRD_PARTY_ROUTES = THIRD_PARTY_ROUTES;
149182
149272
  exports.TOASTR_MESSAGES = TOASTR_MESSAGES;
149183
149273
  exports.TagsPage = TagsPage;
149184
149274
  exports.TeamMembers = TeamMembers;
149275
+ exports.ThankYouPage = ThankYouPage;
149185
149276
  exports.USER_AGENTS = USER_AGENTS;
149186
149277
  exports.WebhooksPage = WebhooksPage;
149187
149278
  exports.ZAPIER_LIMIT_EXHAUSTED_MESSAGE = ZAPIER_LIMIT_EXHAUSTED_MESSAGE;