@bigbinary/neeto-playwright-commons 1.18.4 → 1.19.0

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
@@ -409,6 +409,8 @@ const EMBED_SELECTORS = {
409
409
  showIconCheckbox: "show-icon-checkbox",
410
410
  elementIdInput: "element-id-input-field",
411
411
  previewElementPopupButton: "preview-element-popup-button",
412
+ embedSelector: (embedType) => `[data-testid="embed-selector-card-${hyphenize(embedType)}"]`,
413
+ backToEmbedSelectionButton: "back-to-embed-selection-button",
412
414
  };
413
415
 
414
416
  const NEETO_FILTERS_SELECTORS = {
@@ -57012,6 +57014,9 @@ class ThankYouPage {
57012
57014
 
57013
57015
  class EmbedBase {
57014
57016
  constructor({ context, page, neetoPlaywrightUtilities, appName, }) {
57017
+ /**
57018
+ * @deprecated This method is deprecated. Use initializeEmbedPageV2 instead.
57019
+ */
57015
57020
  this.initializeEmbedPage = async ({ embedType, embedCode, customElementText = "Click here", }) => {
57016
57021
  this.embedTestPage = await this.context.newPage();
57017
57022
  this.embedTestPageType = embedType;
@@ -57029,6 +57034,23 @@ class EmbedBase {
57029
57034
  : EMBED_SELECTORS.iframe(this.appName));
57030
57035
  return this.embedTestPage;
57031
57036
  };
57037
+ this.initializeEmbedPageV2 = async ({ embedType, embedCode, customElementText = "Click here", }) => {
57038
+ this.embedTestPage = await this.context.newPage();
57039
+ this.embedTestPageType = embedType;
57040
+ const fileContent = basicHTMLContent(this.embedTestPageType === "elementPopup"
57041
+ ? `${embedCode}<a href='#' id='open-popup-button'>${customElementText}</a>`
57042
+ : embedCode);
57043
+ this.filePath = `tmp/${faker.faker.word.noun()}.html`;
57044
+ fs$d.writeFileSync(this.filePath, fileContent, "utf8");
57045
+ await this.embedTestPage.goto(`file://${Path.resolve(this.filePath)}`, {
57046
+ timeout: 20000,
57047
+ });
57048
+ await this.embedTestPage.waitForLoadState("load");
57049
+ this.embeddedFrame = this.embedTestPage.frameLocator(this.embedTestPageType === "inline"
57050
+ ? "iframe"
57051
+ : EMBED_SELECTORS.iframe(this.appName));
57052
+ return this.embedTestPage;
57053
+ };
57032
57054
  this.closeEmbedModalAndPage = async () => {
57033
57055
  if (this.embedTestPageType !== "inline") {
57034
57056
  await this.embedTestPage
@@ -57053,6 +57075,9 @@ class EmbedBase {
57053
57075
  });
57054
57076
  }).toPass({ timeout: 2 * 60 * 1000 });
57055
57077
  };
57078
+ /**
57079
+ * @deprecated This method is deprecated. Use copyEmbedScriptV2 instead.
57080
+ */
57056
57081
  this.copyEmbedScript = async ({ embedLabel }) => {
57057
57082
  await this.page
57058
57083
  .getByTestId(COMMON_SELECTORS.radioLabel(embedLabel))
@@ -57060,12 +57085,24 @@ class EmbedBase {
57060
57085
  await this.page.getByTestId(COMMON_SELECTORS.copyButton).click();
57061
57086
  return await this.page.evaluate(() => navigator.clipboard.readText());
57062
57087
  };
57088
+ this.copyEmbedScriptV2 = async (embedType) => {
57089
+ await this.selectEmbedTypeV2(embedType);
57090
+ await this.page.getByTestId(COMMON_SELECTORS.copyButton).click();
57091
+ return await this.page.evaluate(() => navigator.clipboard.readText());
57092
+ };
57093
+ /**
57094
+ * @deprecated This method is deprecated. Use selectEmbedTypeV2 instead.
57095
+ */
57063
57096
  this.selectEmbedType = async (embedLabel) => {
57064
57097
  await this.page.getByTestId(EMBED_SELECTORS.htmlTab).click();
57065
57098
  await this.page
57066
57099
  .getByTestId(COMMON_SELECTORS.radioLabel(embedLabel))
57067
57100
  .check();
57068
57101
  };
57102
+ this.selectEmbedTypeV2 = async (embedType) => {
57103
+ await this.page.locator(EMBED_SELECTORS.embedSelector(embedType)).click();
57104
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
57105
+ };
57069
57106
  this.verifyInlineCustomization = async ({ headingTestId,
57070
57107
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
57071
57108
  inlineEmbedInterceptParams, customizationOptions, }) => {
@@ -57098,7 +57135,9 @@ class EmbedBase {
57098
57135
  test$1.expect(iframeHeight).toStrictEqual(embedHeightPercentage);
57099
57136
  // eslint-disable-next-line playwright/no-standalone-expect
57100
57137
  test$1.expect(iframeWidth).toStrictEqual(embedWidthPercentage);
57138
+ await this.backToEmbedSelection();
57101
57139
  };
57140
+ this.backToEmbedSelection = () => this.page.getByTestId(EMBED_SELECTORS.backToEmbedSelectionButton).click();
57102
57141
  this.verifyFloatingPopupCustomization = async (customizationOptions) => {
57103
57142
  await this.page
57104
57143
  .getByTestId(EMBED_SELECTORS.buttonTextInput)
@@ -57165,6 +57204,7 @@ class EmbedBase {
57165
57204
  else if (customizationOptions.showIcon === false) {
57166
57205
  await test$1.expect(floatingButtonIcon).toBeHidden();
57167
57206
  }
57207
+ await this.backToEmbedSelection();
57168
57208
  };
57169
57209
  this.verifyElementClickCustomization = async (customizationOptions) => {
57170
57210
  await this.page
@@ -57176,6 +57216,7 @@ class EmbedBase {
57176
57216
  test$1.expect(this.page.getByTestId(EMBED_SELECTORS.previewElementPopupButton)).toBeVisible(),
57177
57217
  await test$1.expect(this.page.locator(`#${customizationOptions.customId}`)).toBeVisible(),
57178
57218
  ]);
57219
+ await this.backToEmbedSelection();
57179
57220
  };
57180
57221
  this.expectMultipleTextsInCodeblock = async (containTextOptions) => {
57181
57222
  const codeBlock = this.page.getByTestId(EMBED_SELECTORS.codeBlock);
@@ -194670,6 +194711,9 @@ const definePlaywrightConfig = (overrides) => {
194670
194711
  timezoneId: "Asia/Calcutta",
194671
194712
  geolocation: { latitude: 18.553187, longitude: 73.948313 }, // BB Pune office
194672
194713
  permissions: ["geolocation"],
194714
+ launchOptions: {
194715
+ args: ["--js-flags=--max-old-space-size=4096"],
194716
+ },
194673
194717
  ...useOverrides,
194674
194718
  },
194675
194719
  projects: useCustomProjects
@@ -194682,7 +194726,10 @@ const definePlaywrightConfig = (overrides) => {
194682
194726
  },
194683
194727
  {
194684
194728
  name: "chromium",
194685
- use: { ...test$1.devices["Desktop Chrome"], storageState: STORAGE_STATE },
194729
+ use: {
194730
+ ...test$1.devices["Desktop Chrome"],
194731
+ storageState: STORAGE_STATE,
194732
+ },
194686
194733
  dependencies: ["setup"],
194687
194734
  },
194688
194735
  { name: "cleanup credentials", testMatch: "global.teardown.ts" },