@bigbinary/neeto-playwright-commons 1.17.4 → 1.17.6

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
@@ -469,6 +469,7 @@ const EMBED_SELECTORS = {
469
469
  buttonTextColorLabel: "button-text-color-label",
470
470
  colorPickerTarget: "color-picker-target",
471
471
  colorpickerEditableInput: "colorpicker-editable-input",
472
+ colorpickerEditableInputTextbox: "colorpicker-editable-input-textbox",
472
473
  showIconCheckbox: "show-icon-checkbox",
473
474
  elementIdInput: "element-id-input-field",
474
475
  previewElementPopupButton: "preview-element-popup-button",
@@ -795,6 +796,11 @@ const TABLE_SELECTORS = {
795
796
  columnMenuButton: "column-menu-button",
796
797
  };
797
798
 
799
+ const THEMES_SELECTORS = {
800
+ colorPickerDropdownContainer: (colorHex) => `${colorHex}-dropdown-container`,
801
+ themeStyle: (styleType) => `theme-style-${neetoCist.hyphenate(styleType)}`,
802
+ };
803
+
798
804
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
799
805
 
800
806
  function getDefaultExportFromCjs (x) {
@@ -3955,7 +3961,10 @@ class CustomCommands {
3955
3961
  ...interceptMultipleResponsesProps,
3956
3962
  });
3957
3963
  await pageContext.reload();
3958
- await Promise.all([this.waitForPageLoad(), reloadRequests]);
3964
+ await Promise.all([
3965
+ this.waitForPageLoad({ customPageContext: pageContext }),
3966
+ reloadRequests,
3967
+ ]);
3959
3968
  };
3960
3969
  this.waitForPageLoad = async ({ visibilityTimeout = 35000, customPageContext, } = {}) => {
3961
3970
  const pageContext = customPageContext !== null && customPageContext !== void 0 ? customPageContext : this.page;
@@ -12253,6 +12262,58 @@ class MailerUtils {
12253
12262
  }
12254
12263
  }
12255
12264
 
12265
+ const hexToRGBA = (hex) => {
12266
+ let r = 0, g = 0, b = 0, a = 1;
12267
+ if (hex.length === 5) {
12268
+ r = parseInt(`${hex[1]}${hex[1]}`, 16);
12269
+ g = parseInt(`${hex[2]}${hex[2]}`, 16);
12270
+ b = parseInt(`${hex[3]}${hex[3]}`, 16);
12271
+ a = parseInt(`${hex[4]}${hex[4]}`, 16) / 255;
12272
+ }
12273
+ else if (hex.length === 9) {
12274
+ r = parseInt(`${hex[1]}${hex[2]}`, 16);
12275
+ g = parseInt(`${hex[3]}${hex[4]}`, 16);
12276
+ b = parseInt(`${hex[5]}${hex[6]}`, 16);
12277
+ a = parseInt(`${hex[7]}${hex[8]}`, 16) / 255;
12278
+ }
12279
+ return `rgba(${r}, ${g}, ${b}, ${a.toFixed(2)})`;
12280
+ };
12281
+ class ColorPickerUtils {
12282
+ constructor(page) {
12283
+ this.page = page;
12284
+ this.pickColor = async (styleType, color) => {
12285
+ const colorPickerInput = this.page
12286
+ .getByTestId(EMBED_SELECTORS.colorpickerEditableInput)
12287
+ .getByTestId(EMBED_SELECTORS.colorpickerEditableInputTextbox);
12288
+ await this.page
12289
+ .getByTestId(THEMES_SELECTORS.themeStyle(styleType))
12290
+ .getByTestId(EMBED_SELECTORS.colorPickerTarget)
12291
+ .click();
12292
+ await test$1.expect(colorPickerInput).toBeVisible();
12293
+ await colorPickerInput.fill(color.replace("#", ""));
12294
+ await test$1.expect(this.page.getByTestId(THEMES_SELECTORS.colorPickerDropdownContainer(color))).toBeVisible();
12295
+ await colorPickerInput.press("Escape");
12296
+ await test$1.expect(colorPickerInput).toBeHidden();
12297
+ };
12298
+ this.hexToRGBA = (hex) => {
12299
+ let r = 0, g = 0, b = 0, a = 1;
12300
+ if (hex.length === 5) {
12301
+ r = parseInt(`${hex[1]}${hex[1]}`, 16);
12302
+ g = parseInt(`${hex[2]}${hex[2]}`, 16);
12303
+ b = parseInt(`${hex[3]}${hex[3]}`, 16);
12304
+ a = parseInt(`${hex[4]}${hex[4]}`, 16) / 255;
12305
+ }
12306
+ else if (hex.length === 9) {
12307
+ r = parseInt(`${hex[1]}${hex[2]}`, 16);
12308
+ g = parseInt(`${hex[3]}${hex[4]}`, 16);
12309
+ b = parseInt(`${hex[5]}${hex[6]}`, 16);
12310
+ a = parseInt(`${hex[7]}${hex[8]}`, 16) / 255;
12311
+ }
12312
+ return `rgba(${r}, ${g}, ${b}, ${a.toFixed(2)})`;
12313
+ };
12314
+ }
12315
+ }
12316
+
12256
12317
  const commands = {
12257
12318
  neetoPlaywrightUtilities: async ({ page, request, baseURL }, use) => {
12258
12319
  const commands = new CustomCommands(page, request, baseURL);
@@ -12268,6 +12329,10 @@ const commands = {
12268
12329
  await mailerUtils.fastmailApi.authorizeAndSetAccountId();
12269
12330
  await use(mailerUtils);
12270
12331
  },
12332
+ colorPicker: async ({ page }, use) => {
12333
+ const colorPicker = new ColorPickerUtils(page);
12334
+ await use(colorPicker);
12335
+ },
12271
12336
  };
12272
12337
 
12273
12338
  const generateStagingData = (product = "invoice") => {
@@ -21391,7 +21456,7 @@ class EmbedBase {
21391
21456
  .click();
21392
21457
  await this.page
21393
21458
  .getByTestId(EMBED_SELECTORS.colorpickerEditableInput)
21394
- .getByRole("textbox")
21459
+ .getByTestId(EMBED_SELECTORS.colorpickerEditableInputTextbox)
21395
21460
  .fill(customizationOptions.buttonColorHex);
21396
21461
  const buttonTextColorLabel = this.page.getByTestId(EMBED_SELECTORS.buttonTextColorLabel);
21397
21462
  // This additional click is to close the previously opened color picker for buttonColor.
@@ -21403,7 +21468,7 @@ class EmbedBase {
21403
21468
  .click();
21404
21469
  await this.page
21405
21470
  .getByTestId(EMBED_SELECTORS.colorpickerEditableInput)
21406
- .getByRole("textbox")
21471
+ .getByTestId(EMBED_SELECTORS.colorpickerEditableInputTextbox)
21407
21472
  .fill(customizationOptions.buttonTextColorHex);
21408
21473
  const showIconCheckbox = this.page.getByTestId(EMBED_SELECTORS.showIconCheckbox);
21409
21474
  if (customizationOptions.showIcon === true) {
@@ -25262,7 +25327,7 @@ class OrganizationPage {
25262
25327
  await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden({ timeout: 15000 });
25263
25328
  };
25264
25329
  this.loginAndOnboard = async ({ email, firstName, lastName, country, handleOnboarding, baseURL = process.env.BASE_URL, }) => {
25265
- await this.page.goto(`${baseURL}/${ROUTES.admin}`, { timeout: 20000 });
25330
+ await this.page.goto(`${baseURL}${ROUTES.admin}`, { timeout: 20000 });
25266
25331
  await this.loginViaSSO(email);
25267
25332
  await this.setupProfile({ firstName, lastName, country });
25268
25333
  await this.page.waitForURL(new RegExp(getGlobalUserState().domain), {
@@ -158275,23 +158340,6 @@ const isGithubIssueOpen = async (issueLinks) => {
158275
158340
  return issueStatuses.some(issueStatus => { var _a; return ((_a = issueStatus === null || issueStatus === void 0 ? void 0 : issueStatus.data) === null || _a === void 0 ? void 0 : _a.state) === "open"; });
158276
158341
  };
158277
158342
 
158278
- const hexToRGBA = (hex) => {
158279
- let r = 0, g = 0, b = 0, a = 1;
158280
- if (hex.length === 5) {
158281
- r = parseInt(`${hex[1]}${hex[1]}`, 16);
158282
- g = parseInt(`${hex[2]}${hex[2]}`, 16);
158283
- b = parseInt(`${hex[3]}${hex[3]}`, 16);
158284
- a = parseInt(`${hex[4]}${hex[4]}`, 16) / 255;
158285
- }
158286
- else if (hex.length === 9) {
158287
- r = parseInt(`${hex[1]}${hex[2]}`, 16);
158288
- g = parseInt(`${hex[3]}${hex[4]}`, 16);
158289
- b = parseInt(`${hex[5]}${hex[6]}`, 16);
158290
- a = parseInt(`${hex[7]}${hex[8]}`, 16) / 255;
158291
- }
158292
- return `rgba(${r}, ${g}, ${b}, ${a.toFixed(2)})`;
158293
- };
158294
-
158295
158343
  var main$2 = {exports: {}};
158296
158344
 
158297
158345
  var name = "dotenv";
@@ -158990,6 +159038,7 @@ exports.TEXT_MODIFIER_ROLES = TEXT_MODIFIER_ROLES;
158990
159038
  exports.TEXT_MODIFIER_SELECTORS = TEXT_MODIFIER_SELECTORS;
158991
159039
  exports.TEXT_MODIFIER_TAGS = TEXT_MODIFIER_TAGS;
158992
159040
  exports.THANK_YOU_SELECTORS = THANK_YOU_SELECTORS;
159041
+ exports.THEMES_SELECTORS = THEMES_SELECTORS;
158993
159042
  exports.THIRD_PARTY_ROUTES = THIRD_PARTY_ROUTES;
158994
159043
  exports.TOASTR_MESSAGES = TOASTR_MESSAGES;
158995
159044
  exports.TagsPage = TagsPage;