@bigbinary/neeto-playwright-commons 6.1.3 → 6.1.5

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.
Files changed (3) hide show
  1. package/index.d.ts +12 -0
  2. package/index.js +19 -12
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -100,6 +100,7 @@ interface FieldValue {
100
100
  type VerifyFieldValue = (values: FieldValue | FieldValue[]) => Promise<void> | Promise<void[]>;
101
101
  interface SelectOptionFromDropdownParams {
102
102
  label?: string;
103
+ dataTestId?: string;
103
104
  value: string;
104
105
  page?: Page;
105
106
  options?: Partial<{
@@ -287,6 +288,8 @@ declare class CustomCommands {
287
288
  *
288
289
  * label (optional): is the label for the menu and the select input container. Default is nui.
289
290
  *
291
+ * dataTestId (optional): is the fixed test ID prefix of the select (for example preferred-time-format). When given, it is used instead of the hyphenated label, so the selector doesn't depend on translated copy.
292
+ *
290
293
  * value: is the value to be selected.
291
294
  *
292
295
  * page (optional): is the custom page context. Default is POM's page.
@@ -309,6 +312,12 @@ declare class CustomCommands {
309
312
  * // or
310
313
  *
311
314
  * await neetoPlaywrightUtilities.selectOptionFromDropdown({
315
+ * dataTestId: "preferred-time-format",
316
+ * value,
317
+ * });
318
+ * // or
319
+ *
320
+ * await neetoPlaywrightUtilities.selectOptionFromDropdown({
312
321
  * label,
313
322
  * value,
314
323
  * options:{
@@ -321,6 +330,7 @@ declare class CustomCommands {
321
330
  */
322
331
  selectOptionFromDropdown: ({
323
332
  label,
333
+ dataTestId,
324
334
  value,
325
335
  page,
326
336
  options: {
@@ -5540,6 +5550,7 @@ declare const DESCRIPTION_EDITOR_TEXTS: {
5540
5550
  linkTag: string;
5541
5551
  link: string;
5542
5552
  cannedResponseHeader: string;
5553
+ seededCannedResponseName: string;
5543
5554
  paragraphOption: string;
5544
5555
  search: string;
5545
5556
  emoji: string;
@@ -5649,6 +5660,7 @@ declare const IP_RESTRICTIONS_SELECTORS: {
5649
5660
  ipEndInpError: string;
5650
5661
  typeSelectError: string;
5651
5662
  addressTypeSelect: string;
5663
+ addressTypeSelectContainer: string;
5652
5664
  resetButton: string;
5653
5665
  };
5654
5666
  declare const AUDIT_LOGS_SELECTORS: {
package/index.js CHANGED
@@ -639,8 +639,9 @@ const IP_RESTRICTIONS_SELECTORS = {
639
639
  ipRangeDeleteBtn: "allowed-ip-range-delete-button",
640
640
  ipStartInpError: "ip-start-input-error",
641
641
  ipEndInpError: "ip-end-input-error",
642
- typeSelectError: "type-select-error",
643
- addressTypeSelect: "address-type-select-field",
642
+ typeSelectError: "address-type-select-error",
643
+ addressTypeSelect: "address-type-select-input",
644
+ addressTypeSelectContainer: "address-type-select-container",
644
645
  resetButton: "ip-restriction-reset-btn",
645
646
  };
646
647
  const AUDIT_LOGS_SELECTORS = {
@@ -998,7 +999,7 @@ const EMBED_SELECTORS = {
998
999
  colorPickerTarget: "color-picker-target",
999
1000
  colorpickerEditableInput: "colorpicker-editable-input",
1000
1001
  colorpickerEditableInputTextbox: "colorpicker-editable-input-textbox",
1001
- showIconCheckbox: "show-icon-checkbox",
1002
+ showIconCheckbox: "show-icon-checkbox-input",
1002
1003
  elementIdInput: "element-id-input-field",
1003
1004
  previewElementPopupButton: "preview-element-popup-button",
1004
1005
  embedSelector: (type) => `embed-selector-card-${hyphenate(type)}`,
@@ -2353,10 +2354,14 @@ class CustomCommands {
2353
2354
  })}`;
2354
2355
  return await this.request[method](formattedUrl, requestOptions);
2355
2356
  };
2356
- selectOptionFromDropdown = async ({ label = "nui", value, page = this.page, options: { visibilityTimeout = 5_000, textAssertionTimeout = 5_000, retryTimeout = 60_000, } = {}, }) => {
2357
- const menu = page.getByTestId(COMMON_SELECTORS.customDropDownMenu(label));
2357
+ selectOptionFromDropdown = async ({ label = "nui", dataTestId, value, page = this.page, options: { visibilityTimeout = 5_000, textAssertionTimeout = 5_000, retryTimeout = 60_000, } = {}, }) => {
2358
+ const menu = page.getByTestId(dataTestId
2359
+ ? `${dataTestId}-select-menu`
2360
+ : COMMON_SELECTORS.customDropDownMenu(label));
2358
2361
  const optionByName = menu.getByRole("option", { name: value, exact: true });
2359
- const container = page.getByTestId(COMMON_SELECTORS.customSelectContainer(label));
2362
+ const container = page.getByTestId(dataTestId
2363
+ ? `${dataTestId}-select-container`
2364
+ : COMMON_SELECTORS.customSelectContainer(label));
2360
2365
  await expect(async () => {
2361
2366
  await container.click();
2362
2367
  await expect(menu).toBeVisible({ timeout: visibilityTimeout });
@@ -4718,16 +4723,16 @@ class HelpAndProfilePage {
4718
4723
  // The country list comes from NeetoAuth, which runs only on staging
4719
4724
  IS_STAGING_ENV &&
4720
4725
  (await this.neetoPlaywrightUtilities.selectOptionFromDropdown({
4721
- label: this.t("neetoTeamMembers.profile.inputs.label.country"),
4726
+ dataTestId: "country",
4722
4727
  value: country,
4723
4728
  }));
4724
4729
  await this.neetoPlaywrightUtilities.selectOptionFromDropdown({
4725
4730
  value: timeFormat,
4726
- label: this.t("neetoTeamMembers.profile.inputs.label.preferredTimeFormat"),
4731
+ dataTestId: "preferred-time-format",
4727
4732
  });
4728
4733
  await this.neetoPlaywrightUtilities.selectOptionFromDropdown({
4729
4734
  value: dateFormat,
4730
- label: this.t("neetoTeamMembers.profile.inputs.label.preferredDateFormat"),
4735
+ dataTestId: "preferred-date-format",
4731
4736
  });
4732
4737
  };
4733
4738
  uploadImage = async (imageName) => {
@@ -5507,6 +5512,8 @@ const DESCRIPTION_EDITOR_TEXTS = {
5507
5512
  linkTag: "a",
5508
5513
  link: "Link",
5509
5514
  cannedResponseHeader: "Canned responses",
5515
+ // Seeded record name (desk, chat), not UI copy, so it doesn't follow the locale.
5516
+ seededCannedResponseName: "Feedback",
5510
5517
  paragraphOption: "paragraph",
5511
5518
  search: "Search",
5512
5519
  emoji: "Emoji",
@@ -6044,9 +6051,9 @@ class EditorPage {
6044
6051
  await expect(this.page.getByTestId(COMMON_SELECTORS.paneHeader)).toContainText(DESCRIPTION_EDITOR_TEXTS.cannedResponseHeader);
6045
6052
  await this.page
6046
6053
  .getByTestId(NEETO_EDITOR_SELECTORS.cannedResponseSelectContainer)
6047
- .fill(this.t("neetoRules.labels.feedback"));
6054
+ .fill(DESCRIPTION_EDITOR_TEXTS.seededCannedResponseName);
6048
6055
  await this.page
6049
- .getByTestId(COMMON_SELECTORS.selectOption(this.t("neetoRules.labels.feedback")))
6056
+ .getByTestId(COMMON_SELECTORS.selectOption(DESCRIPTION_EDITOR_TEXTS.seededCannedResponseName))
6050
6057
  .click();
6051
6058
  await this.page.getByTestId(NEETO_EDITOR_SELECTORS.applyButton).click();
6052
6059
  await this.neetoPlaywrightUtilities.verifyToast({
@@ -6893,7 +6900,7 @@ class IPRestrictionsPage {
6893
6900
  .fill(type);
6894
6901
  await this.page.keyboard.press("Enter");
6895
6902
  await expect(this.page
6896
- .getByTestId(COMMON_SELECTORS.customSelectValueContainer("type"))
6903
+ .getByTestId(IP_RESTRICTIONS_SELECTORS.addressTypeSelectContainer)
6897
6904
  // eslint-disable-next-line playwright/no-nth-methods
6898
6905
  .nth(index)).toContainText(type);
6899
6906
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-playwright-commons",
3
- "version": "6.1.3",
3
+ "version": "6.1.5",
4
4
  "description": "A package encapsulating common playwright code across neeto projects.",
5
5
  "repository": "git@github.com:bigbinary/neeto-playwright-commons.git",
6
6
  "license": "apache-2.0",