@bigbinary/neeto-playwright-commons 1.18.5 → 1.19.1

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
@@ -49,6 +49,36 @@ function _interopNamespaceDefault(e) {
49
49
  var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs$d);
50
50
  var Path__namespace = /*#__PURE__*/_interopNamespaceDefault(Path);
51
51
 
52
+ let MemberApis$1 = class MemberApis {
53
+ constructor(neetoPlaywrightUtilities) {
54
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
55
+ this.create = (body) => this.neetoPlaywrightUtilities.apiRequest({
56
+ method: "post",
57
+ url: this.teamsBaseUrl,
58
+ body: { user: body },
59
+ });
60
+ this.jobStatus = (jobId) => this.neetoPlaywrightUtilities.apiRequest({
61
+ url: `${this.teamsBaseUrl}/creation_status/${jobId}`,
62
+ });
63
+ this.fetch = (params) => this.neetoPlaywrightUtilities.apiRequest({
64
+ method: "get",
65
+ url: this.teamsBaseUrl,
66
+ params,
67
+ });
68
+ this.update = (memberId, body) => this.neetoPlaywrightUtilities.apiRequest({
69
+ method: "put",
70
+ url: `${this.teamsBaseUrl}/${memberId}`,
71
+ body: { team: body },
72
+ });
73
+ this.bulkUpdate = (body) => this.neetoPlaywrightUtilities.apiRequest({
74
+ method: "patch",
75
+ url: `${this.teamsBaseUrl}/bulk_update`,
76
+ body: { users: body },
77
+ });
78
+ this.teamsBaseUrl = "/team_members/teams";
79
+ }
80
+ };
81
+
52
82
  const ENVIRONMENT = {
53
83
  development: "development",
54
84
  staging: "staging",
@@ -409,6 +439,8 @@ const EMBED_SELECTORS = {
409
439
  showIconCheckbox: "show-icon-checkbox",
410
440
  elementIdInput: "element-id-input-field",
411
441
  previewElementPopupButton: "preview-element-popup-button",
442
+ embedSelector: (embedType) => `[data-testid="embed-selector-card-${hyphenize(embedType)}"]`,
443
+ backToEmbedSelectionButton: "back-to-embed-selection-button",
412
444
  };
413
445
 
414
446
  const NEETO_FILTERS_SELECTORS = {
@@ -57012,6 +57044,9 @@ class ThankYouPage {
57012
57044
 
57013
57045
  class EmbedBase {
57014
57046
  constructor({ context, page, neetoPlaywrightUtilities, appName, }) {
57047
+ /**
57048
+ * @deprecated This method is deprecated. Use initializeEmbedPageV2 instead.
57049
+ */
57015
57050
  this.initializeEmbedPage = async ({ embedType, embedCode, customElementText = "Click here", }) => {
57016
57051
  this.embedTestPage = await this.context.newPage();
57017
57052
  this.embedTestPageType = embedType;
@@ -57029,6 +57064,23 @@ class EmbedBase {
57029
57064
  : EMBED_SELECTORS.iframe(this.appName));
57030
57065
  return this.embedTestPage;
57031
57066
  };
57067
+ this.initializeEmbedPageV2 = async ({ embedType, embedCode, customElementText = "Click here", }) => {
57068
+ this.embedTestPage = await this.context.newPage();
57069
+ this.embedTestPageType = embedType;
57070
+ const fileContent = basicHTMLContent(this.embedTestPageType === "elementPopup"
57071
+ ? `${embedCode}<a href='#' id='open-popup-button'>${customElementText}</a>`
57072
+ : embedCode);
57073
+ this.filePath = `tmp/${faker.faker.word.noun()}.html`;
57074
+ fs$d.writeFileSync(this.filePath, fileContent, "utf8");
57075
+ await this.embedTestPage.goto(`file://${Path.resolve(this.filePath)}`, {
57076
+ timeout: 20000,
57077
+ });
57078
+ await this.embedTestPage.waitForLoadState("load");
57079
+ this.embeddedFrame = this.embedTestPage.frameLocator(this.embedTestPageType === "inline"
57080
+ ? "iframe"
57081
+ : EMBED_SELECTORS.iframe(this.appName));
57082
+ return this.embedTestPage;
57083
+ };
57032
57084
  this.closeEmbedModalAndPage = async () => {
57033
57085
  if (this.embedTestPageType !== "inline") {
57034
57086
  await this.embedTestPage
@@ -57053,6 +57105,9 @@ class EmbedBase {
57053
57105
  });
57054
57106
  }).toPass({ timeout: 2 * 60 * 1000 });
57055
57107
  };
57108
+ /**
57109
+ * @deprecated This method is deprecated. Use copyEmbedScriptV2 instead.
57110
+ */
57056
57111
  this.copyEmbedScript = async ({ embedLabel }) => {
57057
57112
  await this.page
57058
57113
  .getByTestId(COMMON_SELECTORS.radioLabel(embedLabel))
@@ -57060,12 +57115,24 @@ class EmbedBase {
57060
57115
  await this.page.getByTestId(COMMON_SELECTORS.copyButton).click();
57061
57116
  return await this.page.evaluate(() => navigator.clipboard.readText());
57062
57117
  };
57118
+ this.copyEmbedScriptV2 = async (embedType) => {
57119
+ await this.selectEmbedTypeV2(embedType);
57120
+ await this.page.getByTestId(COMMON_SELECTORS.copyButton).click();
57121
+ return await this.page.evaluate(() => navigator.clipboard.readText());
57122
+ };
57123
+ /**
57124
+ * @deprecated This method is deprecated. Use selectEmbedTypeV2 instead.
57125
+ */
57063
57126
  this.selectEmbedType = async (embedLabel) => {
57064
57127
  await this.page.getByTestId(EMBED_SELECTORS.htmlTab).click();
57065
57128
  await this.page
57066
57129
  .getByTestId(COMMON_SELECTORS.radioLabel(embedLabel))
57067
57130
  .check();
57068
57131
  };
57132
+ this.selectEmbedTypeV2 = async (embedType) => {
57133
+ await this.page.locator(EMBED_SELECTORS.embedSelector(embedType)).click();
57134
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
57135
+ };
57069
57136
  this.verifyInlineCustomization = async ({ headingTestId,
57070
57137
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
57071
57138
  inlineEmbedInterceptParams, customizationOptions, }) => {
@@ -57098,7 +57165,9 @@ class EmbedBase {
57098
57165
  test$1.expect(iframeHeight).toStrictEqual(embedHeightPercentage);
57099
57166
  // eslint-disable-next-line playwright/no-standalone-expect
57100
57167
  test$1.expect(iframeWidth).toStrictEqual(embedWidthPercentage);
57168
+ await this.backToEmbedSelection();
57101
57169
  };
57170
+ this.backToEmbedSelection = () => this.page.getByTestId(EMBED_SELECTORS.backToEmbedSelectionButton).click();
57102
57171
  this.verifyFloatingPopupCustomization = async (customizationOptions) => {
57103
57172
  await this.page
57104
57173
  .getByTestId(EMBED_SELECTORS.buttonTextInput)
@@ -57165,6 +57234,7 @@ class EmbedBase {
57165
57234
  else if (customizationOptions.showIcon === false) {
57166
57235
  await test$1.expect(floatingButtonIcon).toBeHidden();
57167
57236
  }
57237
+ await this.backToEmbedSelection();
57168
57238
  };
57169
57239
  this.verifyElementClickCustomization = async (customizationOptions) => {
57170
57240
  await this.page
@@ -57176,6 +57246,7 @@ class EmbedBase {
57176
57246
  test$1.expect(this.page.getByTestId(EMBED_SELECTORS.previewElementPopupButton)).toBeVisible(),
57177
57247
  await test$1.expect(this.page.locator(`#${customizationOptions.customId}`)).toBeVisible(),
57178
57248
  ]);
57249
+ await this.backToEmbedSelection();
57179
57250
  };
57180
57251
  this.expectMultipleTextsInCodeblock = async (containTextOptions) => {
57181
57252
  const codeBlock = this.page.getByTestId(EMBED_SELECTORS.codeBlock);
@@ -194748,6 +194819,7 @@ exports.MEMBER_TEXTS = MEMBER_TEXTS;
194748
194819
  exports.MERGE_TAGS_SELECTORS = MERGE_TAGS_SELECTORS;
194749
194820
  exports.MailerUtils = MailerUtils;
194750
194821
  exports.Member = Member;
194822
+ exports.MemberApis = MemberApis$1;
194751
194823
  exports.NEETO_AUTH_BASE_URL = NEETO_AUTH_BASE_URL;
194752
194824
  exports.NEETO_EDITOR_SELECTORS = NEETO_EDITOR_SELECTORS;
194753
194825
  exports.NEETO_FILTERS_SELECTORS = NEETO_FILTERS_SELECTORS;