@bigbinary/neeto-playwright-commons 1.21.0 → 1.21.2

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
@@ -82,6 +82,48 @@ let MemberApis$1 = class MemberApis {
82
82
  }
83
83
  };
84
84
 
85
+ let RoleApis$1 = class RoleApis {
86
+ constructor(neetoPlaywrightUtilities) {
87
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
88
+ this.BASE_URL = "/team_members";
89
+ this.ORGANIZATION_ROLES_URL = `${this.BASE_URL}/organization_roles`;
90
+ this.fetch = (endpoint) => this.neetoPlaywrightUtilities.apiRequest({
91
+ url: `${this.BASE_URL}/${endpoint}`,
92
+ });
93
+ this.addRole = (roleName, permissionIds) => this.neetoPlaywrightUtilities.apiRequest({
94
+ url: this.ORGANIZATION_ROLES_URL,
95
+ method: "post",
96
+ data: {
97
+ organization_role: {
98
+ name: roleName,
99
+ permission_ids: permissionIds,
100
+ },
101
+ },
102
+ });
103
+ this.editRole = (roleId, body) => this.neetoPlaywrightUtilities.apiRequest({
104
+ url: `${this.ORGANIZATION_ROLES_URL}/${roleId}`,
105
+ method: "patch",
106
+ body: { organization_role: body },
107
+ });
108
+ this.deleteRole = (roleId, standardRoleId) => this.neetoPlaywrightUtilities.apiRequest({
109
+ url: `${this.ORGANIZATION_ROLES_URL}/${roleId}`,
110
+ method: "delete",
111
+ body: { new_role_id: standardRoleId },
112
+ });
113
+ }
114
+ };
115
+
116
+ let TagsApi$1 = class TagsApi {
117
+ constructor(neetoPlaywrightUtilities) {
118
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
119
+ this.create = ({ body, tagsRequestUrl, }) => this.neetoPlaywrightUtilities.apiRequest({
120
+ url: tagsRequestUrl,
121
+ body,
122
+ method: "post",
123
+ });
124
+ }
125
+ };
126
+
85
127
  const COMMON_SELECTORS = {
86
128
  emailInputError: "email-input-error",
87
129
  pane: "pane-wrapper",
@@ -192,7 +234,7 @@ const COMMON_SELECTORS = {
192
234
  continueButton: "continue-button",
193
235
  clearAllButton: "clear-all-button",
194
236
  requiredSwitch: "required-switch",
195
- customSwitch: (switchLabel) => ` ${neetoCist.hyphenate(switchLabel)}-switch`,
237
+ customSwitch: (switchLabel) => `${neetoCist.hyphenate(switchLabel)}-switch`,
196
238
  customMenuItem: (label) => `${neetoCist.hyphenate(label)}-menu-item`,
197
239
  customInputLabel: (name = "nui") => `${neetoCist.hyphenate(name)}-input-label`,
198
240
  customInputField: (name = "nui") => `${neetoCist.hyphenate(name)}-input-field`,
@@ -188537,7 +188579,11 @@ class ThankYouPage {
188537
188579
  await this.page
188538
188580
  .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
188539
188581
  .fill(thankYouMessage);
188540
- await test$1.expect(this.page.getByTestId(THANK_YOU_SELECTORS.thankYouMessageWrapper).getByTestId(NEETO_EDITOR_SELECTORS.contentField)).toContainText(thankYouMessage);
188582
+ await test$1.expect(this.page
188583
+ .getByTestId(THANK_YOU_SELECTORS.previewEditorContent)
188584
+ .or(this.page
188585
+ .getByTestId(THANK_YOU_SELECTORS.thankYouMessageWrapper)
188586
+ .getByTestId(NEETO_EDITOR_SELECTORS.contentField))).toContainText(thankYouMessage);
188541
188587
  };
188542
188588
  this.addRedirectUrl = async (customRedirectUrl) => {
188543
188589
  await this.page
@@ -192020,32 +192066,27 @@ class EditorPage {
192020
192066
  };
192021
192067
  this.verifyFontSize = async () => {
192022
192068
  const fontsAndTexts = [];
192023
- await this.page
192024
- .getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorFixedMenuFontSize)
192025
- .click();
192026
- const allButtons = await this.page
192069
+ const fontSizeDropdownButton = this.page.getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorFixedMenuFontSize);
192070
+ await fontSizeDropdownButton.click();
192071
+ const headingButtons = await this.page
192027
192072
  .getByTestId(COMMON_SELECTORS.dropdownContainer)
192028
192073
  .getByRole("button")
192029
192074
  .all();
192030
- const headingButtons = (await Promise.all(allButtons.map(async (button) => {
192075
+ const headingLevels = (await Promise.all(headingButtons.map(async (button) => {
192031
192076
  const dataCy = await button.getAttribute("data-cy");
192032
- return /^neeto-editor-fixed-menu-font-size-option-h[1-6]$/.test(dataCy || "")
192033
- ? button
192034
- : null;
192077
+ const headingLevel = dataCy === null || dataCy === void 0 ? void 0 : dataCy.split("-").pop();
192078
+ return /^h[1-5]$/.test(headingLevel || "") ? headingLevel : null;
192035
192079
  }))).filter(Boolean);
192036
- for (const button of headingButtons) {
192037
- const dataCy = await button.getAttribute("data-cy");
192038
- const fontKey = dataCy === null || dataCy === void 0 ? void 0 : dataCy.split("-").pop();
192039
- if (!fontKey)
192040
- continue;
192041
- const headingLevel = Number(fontKey.slice(1));
192080
+ const fontSizeDropdown = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.fontSize);
192081
+ for (const headingLevel of headingLevels) {
192082
+ const fontKey = headingLevel;
192042
192083
  const randomText = await this.fillRandomText();
192043
- await this.page
192044
- .getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorFixedMenuFontSize)
192084
+ await fontSizeDropdown.click();
192085
+ await this.editorWrapper
192086
+ .getByTestId(FONT_SIZE_SELECTORS[fontKey])
192045
192087
  .click();
192046
- await button.click();
192047
192088
  await test$1.expect(this.contentField.getByRole("heading", {
192048
- level: headingLevel,
192089
+ level: Number(headingLevel === null || headingLevel === void 0 ? void 0 : headingLevel.slice(1)),
192049
192090
  name: randomText,
192050
192091
  })).toBeVisible();
192051
192092
  fontsAndTexts.push({
@@ -193253,7 +193294,7 @@ class RolesPage {
193253
193294
  const { permissions } = await this.roleApis
193254
193295
  .fetch("permissions")
193255
193296
  .then(response => response === null || response === void 0 ? void 0 : response.json());
193256
- const permissionObjects = targetPermissions.map(permission => neetoCist.findBy({ category: permission }, permissions));
193297
+ const permissionObjects = targetPermissions.flatMap(permission => permissions.filter((p) => p.category === permission));
193257
193298
  return ramda.pluck("id", permissionObjects);
193258
193299
  };
193259
193300
  this.getRoleIdAndOrganizationId = async (roleName) => {
@@ -195492,6 +195533,7 @@ exports.PROFILE_SECTION_SELECTORS = PROFILE_SECTION_SELECTORS;
195492
195533
  exports.PROJECT_TRANSLATIONS_PATH = PROJECT_TRANSLATIONS_PATH;
195493
195534
  exports.ROLES_SELECTORS = ROLES_SELECTORS;
195494
195535
  exports.ROUTES = ROUTES;
195536
+ exports.RoleApis = RoleApis$1;
195495
195537
  exports.RolesPage = RolesPage;
195496
195538
  exports.SELECT_COUNTRY = SELECT_COUNTRY;
195497
195539
  exports.SIGNUP_SELECTORS = SIGNUP_SELECTORS;
@@ -195514,6 +195556,7 @@ exports.THANK_YOU_SELECTORS = THANK_YOU_SELECTORS;
195514
195556
  exports.THEMES_SELECTORS = THEMES_SELECTORS;
195515
195557
  exports.THIRD_PARTY_ROUTES = THIRD_PARTY_ROUTES;
195516
195558
  exports.TOASTR_MESSAGES = TOASTR_MESSAGES;
195559
+ exports.TagsApi = TagsApi$1;
195517
195560
  exports.TagsPage = TagsPage;
195518
195561
  exports.TeamMembers = TeamMembers;
195519
195562
  exports.ThankYouPage = ThankYouPage;