d5-testing-library 1.8.0-alpha.13 → 1.8.0-alpha.16

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.
@@ -0,0 +1,7 @@
1
+ import {
2
+ FormEdit
3
+ } from "./chunk-VRVCU4YK.mjs";
4
+ import "./chunk-27K3WKCG.mjs";
5
+ export {
6
+ FormEdit as default
7
+ };
@@ -0,0 +1,7 @@
1
+ import {
2
+ ListForm
3
+ } from "./chunk-GUBPWJAU.mjs";
4
+ import "./chunk-27K3WKCG.mjs";
5
+ export {
6
+ ListForm as default
7
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ TreeView
3
+ } from "./chunk-K4GCHGTD.mjs";
4
+ import "./chunk-GUBPWJAU.mjs";
5
+ import "./chunk-27K3WKCG.mjs";
6
+ export {
7
+ TreeView as default
8
+ };
@@ -150,6 +150,14 @@ var click = async (webElement, driver) => {
150
150
  const actions = driver.actions({ async: true });
151
151
  await actions.move({ origin: webElement }).click().perform();
152
152
  };
153
+ var contextMenu = async (webElement, driver) => {
154
+ driver = driver ?? config().driver;
155
+ if (!await webElement.isDisplayed()) {
156
+ await driver.executeScript("arguments[0].scrollIntoView(true);", webElement);
157
+ }
158
+ const actions = driver.actions({ async: true });
159
+ await actions.move({ origin: webElement }).contextClick().perform();
160
+ };
153
161
 
154
162
  // src/utils/locators.ts
155
163
  import { By as By2 } from "selenium-webdriver";
@@ -548,37 +556,44 @@ var BaseDateEditor = class extends AbstractDXEditorWithInput {
548
556
  super(parentCssSelector, elementCssSelector, driver);
549
557
  this.setClearStrategy(new InputClearStrategy());
550
558
  }
551
- async setDateValue(value) {
559
+ async setArrayValue(value) {
552
560
  const actions = this.driver.actions({ async: true });
553
561
  const dateField = await this.driver.findElement(By8.css(`${this.getFullCssSelector()}`));
562
+ const dateInputEl = await this.getInputElement();
554
563
  const dateFieldDataTestID = await this.getDataTestId();
555
- const calendarPopoverSelector = byTestIdCssSelector(`${dateFieldDataTestID}-calendar-popover`);
564
+ const formattedDates = value.map(formatDMYDate);
565
+ const button = await dateField.findElement(By8.css(`.${BTN_CALENDAR_POPOVER_OPEN_SELECTOR}`));
566
+ await click(button, this.driver);
567
+ const calendarPopoverElement = await this.driver.findElement(By8.css(byTestIdCssSelector(`${dateFieldDataTestID}-calendar-popover`)));
568
+ const dateFromInput = await calendarPopoverElement.findElement(
569
+ By8.css(`.${BTN_CALENDAR_POPOVER_DATE_FROM_INPUT_SELECTOR} .dx-texteditor-input`)
570
+ );
571
+ const dateToInput = await calendarPopoverElement.findElement(
572
+ By8.css(`.${BTN_CALENDAR_POPOVER_DATE_TO_INPUT_SELECTOR} .dx-texteditor-input`)
573
+ );
574
+ await click(dateFromInput, this.driver);
575
+ await dateFromInput.sendKeys(formattedDates[0]);
576
+ await click(dateToInput, this.driver);
577
+ await actions.move({ origin: dateInputEl }).sendKeys(Key3.HOME).perform();
578
+ await dateToInput.sendKeys(formattedDates[1]);
579
+ await actions.move({ origin: dateInputEl }).sendKeys(Key3.ENTER).perform();
580
+ const btnOk = await this.driver.findElement(By8.css(`.${BTN_SAVE_SELECTOR}`));
581
+ await click(btnOk, this.driver);
582
+ }
583
+ async setSingleValue(value) {
584
+ const actions = this.driver.actions({ async: true });
585
+ const formattedDate = formatDMYDate(value);
556
586
  const dateInputEl = await this.getInputElement();
557
- await dateInputEl.clear();
587
+ await click(dateInputEl, this.driver);
588
+ await actions.move({ origin: dateInputEl }).sendKeys(Key3.HOME).perform();
589
+ await actions.move({ origin: dateInputEl }).sendKeys(formattedDate, Key3.ENTER).perform();
590
+ }
591
+ async setDateValue(value) {
592
+ await this.clear();
558
593
  if (Array.isArray(value)) {
559
- const formattedDates = value.map(formatDMYDate);
560
- const button = await dateField.findElement(By8.css(`.${BTN_CALENDAR_POPOVER_OPEN_SELECTOR}`));
561
- await button.click();
562
- const calendarPopoverElement = await this.driver.findElement(By8.css(calendarPopoverSelector));
563
- const dateFromInput = await calendarPopoverElement.findElement(
564
- By8.css(`.${BTN_CALENDAR_POPOVER_DATE_FROM_INPUT_SELECTOR} .dx-texteditor-input`)
565
- );
566
- const dateToInput = await calendarPopoverElement.findElement(
567
- By8.css(`.${BTN_CALENDAR_POPOVER_DATE_TO_INPUT_SELECTOR} .dx-texteditor-input`)
568
- );
569
- await dateFromInput.click();
570
- await dateFromInput.sendKeys(formattedDates[0]);
571
- await dateToInput.click();
572
- await actions.move({ origin: dateInputEl }).sendKeys(Key3.HOME).perform();
573
- await dateToInput.sendKeys(formattedDates[1]);
574
- await actions.move({ origin: dateInputEl }).sendKeys(Key3.ENTER).perform();
575
- const btnOk = await this.driver.findElement(By8.css(`.${BTN_SAVE_SELECTOR}`));
576
- await btnOk.click();
594
+ await this.setArrayValue(value);
577
595
  } else {
578
- const formattedDate = formatDMYDate(value);
579
- await click(dateInputEl, this.driver);
580
- await actions.move({ origin: dateInputEl }).sendKeys(Key3.HOME).perform();
581
- await actions.move({ origin: dateInputEl }).sendKeys(formattedDate, Key3.ENTER).perform();
596
+ await this.setSingleValue(value);
582
597
  }
583
598
  }
584
599
  };
@@ -641,15 +656,14 @@ var DateRangeEditor = class extends BaseDateEditor {
641
656
  // src/pageObjects/elements/Editors/Date/DateEditor.ts
642
657
  var DateEditor = class extends AbstractDXEditorWithInput {
643
658
  editorInstance = null;
644
- initPromise;
645
- constructor(parentCssSelector, elementCssSelector, driver) {
646
- super(parentCssSelector, elementCssSelector, driver);
647
- this.initPromise = this.init(parentCssSelector, elementCssSelector, driver);
648
- }
649
- async init(parentCssSelector, elementCssSelector, driver) {
650
- await this.updateEditorInstance(parentCssSelector, elementCssSelector, driver);
659
+ async init() {
660
+ if (this.editorInstance) {
661
+ return this.editorInstance;
662
+ }
663
+ await this.setEditorInstance();
651
664
  }
652
- async updateEditorInstance(parentCssSelector, elementCssSelector, driver) {
665
+ async setEditorInstance() {
666
+ const { parentCssSelector, elementCssSelector, driver } = this;
653
667
  const elementInstance = new AbstractFormElement(parentCssSelector, elementCssSelector, driver);
654
668
  const classString = await elementInstance.getClasses();
655
669
  switch (true) {
@@ -663,25 +677,14 @@ var DateEditor = class extends AbstractDXEditorWithInput {
663
677
  this.editorInstance = new SingleDateEditor(parentCssSelector, elementCssSelector, driver);
664
678
  }
665
679
  }
666
- async ensureInitialized() {
667
- if (!this.editorInstance) {
668
- await this.initPromise;
669
- }
670
- }
671
680
  async setValue(value) {
672
- await this.ensureInitialized();
673
- if (this.editorInstance) {
674
- await this.editorInstance.setValue(value);
675
- return await this.updateEditorInstance(this.parentCssSelector, this.elementCssSelector, this.driver);
676
- }
677
- throw new Error("Editor instance is not initialized.");
681
+ await this.init();
682
+ await this.editorInstance.setValue(value);
683
+ await this.setEditorInstance();
678
684
  }
679
685
  async getValue() {
680
- await this.ensureInitialized();
681
- if (this.editorInstance) {
682
- return this.editorInstance.getValue();
683
- }
684
- throw new Error("Editor instance is not initialized.");
686
+ await this.init();
687
+ return this.editorInstance.getValue();
685
688
  }
686
689
  };
687
690
 
@@ -841,17 +844,19 @@ function createEditorButtonTestId(itemName) {
841
844
 
842
845
  // src/utils/waitElementIsClickable.ts
843
846
  async function waitElementIsClickable({
844
- element,
845
847
  timeout,
846
848
  errorMessage,
847
- driver
849
+ driver,
850
+ ...rest
848
851
  }) {
849
852
  driver = driver ?? config().driver;
850
853
  await wait(async () => {
851
- const isDisabled = await element.getCssValue("pointer-events") === "none";
852
- return await element.isDisplayed() && !isDisabled;
854
+ const searchedElement = "by" in rest ? await fixElementStaleError(rest.by, driver) : rest.element;
855
+ const isDisabled = await searchedElement.getCssValue("pointer-events") === "none";
856
+ return await searchedElement.isDisplayed() && !isDisabled;
853
857
  }, driver, errorMessage, timeout ?? config().timeout);
854
858
  }
859
+ var waitElementIsClickable_default = waitElementIsClickable;
855
860
 
856
861
  // src/pageObjects/elements/EditorButton.ts
857
862
  var EditorButton = class extends AbstractElementWithParent {
@@ -865,7 +870,7 @@ var EditorButton = class extends AbstractElementWithParent {
865
870
  }
866
871
  async click() {
867
872
  const button = await this.getElement();
868
- await waitElementIsClickable({
873
+ await waitElementIsClickable_default({
869
874
  element: button,
870
875
  errorMessage: this.buttonNotDisplayedError(),
871
876
  driver: this.driver
@@ -969,14 +974,14 @@ var FormField = class extends AbstractEditor {
969
974
  // src/pageObjects/elements/Forms/Form.ts
970
975
  import { By as By15 } from "selenium-webdriver";
971
976
 
972
- // src/pageObjects/elements/TableToolbar/AbstractButton.ts
977
+ // src/pageObjects/elements/AbstractButton.ts
973
978
  var AbstractButton = class extends AbstractElementWithParent {
974
979
  constructor(parentCssSelector, elementCssSelector, driver) {
975
980
  super(parentCssSelector, elementCssSelector, driver);
976
981
  }
977
982
  async click() {
978
983
  const button = await this.getElement();
979
- await waitElementIsClickable({
984
+ await waitElementIsClickable_default({
980
985
  element: button,
981
986
  errorMessage: this.buttonNotDisplayedError(),
982
987
  driver: this.driver
@@ -1259,15 +1264,15 @@ async function classDependencyInjector(formType) {
1259
1264
  let SubFormFactoryClass;
1260
1265
  switch (formType) {
1261
1266
  case "1" /* LIST */:
1262
- SubFormFactoryClass = (await import("./ListForm-P36U2E2W.mjs")).default;
1267
+ SubFormFactoryClass = (await import("./ListForm-RET63S2L.mjs")).default;
1263
1268
  break;
1264
1269
  case "3" /* TREE */:
1265
- SubFormFactoryClass = (await import("./TreeView-NY7F4AKZ.mjs")).default;
1270
+ SubFormFactoryClass = (await import("./TreeView-U2ORN3JF.mjs")).default;
1266
1271
  break;
1267
1272
  case "2" /* EDIT */:
1268
1273
  case "99" /* FREE_FORM */:
1269
1274
  case "4" /* REPORT */:
1270
- SubFormFactoryClass = (await import("./FormEdit-NZEL6BMH.mjs")).default;
1275
+ SubFormFactoryClass = (await import("./FormEdit-IQ3YM6IH.mjs")).default;
1271
1276
  break;
1272
1277
  default:
1273
1278
  throw new Error(`Unsupported form type ${formType}`);
@@ -1298,6 +1303,11 @@ var Form = class extends AbstractForm {
1298
1303
  async getTitleText() {
1299
1304
  if (await this.isModal()) {
1300
1305
  const titleEl2 = await this.driver.findElement(By15.css(`${this.popupContainerCssSelector} .popup-title`));
1306
+ await waitElementIsVisible({
1307
+ element: titleEl2,
1308
+ driver: this.driver,
1309
+ errorMessage: `Form title element is not visible`
1310
+ });
1301
1311
  return titleEl2.getText();
1302
1312
  }
1303
1313
  let titleEl = await this.driver.findElement(By15.className("main-toolbar-form-title"));
@@ -1349,6 +1359,7 @@ export {
1349
1359
  wait,
1350
1360
  waitElementIsVisible,
1351
1361
  click,
1362
+ contextMenu,
1352
1363
  byTestIdCssSelector,
1353
1364
  byTestId,
1354
1365
  readonlyLocator,
@@ -1363,7 +1374,7 @@ export {
1363
1374
  createLayoutFilterTestId,
1364
1375
  createTableId,
1365
1376
  createSubSystemTestId,
1366
- waitElementIsClickable,
1377
+ waitElementIsClickable_default,
1367
1378
  AbstractButton,
1368
1379
  AbstractEditor,
1369
1380
  FormField,