d5-testing-library 2.0.0-alpha.12 → 2.0.0-alpha.14

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FormEdit
3
- } from "./chunk-IU2SMSJW.mjs";
3
+ } from "./chunk-ZBAIOZXV.mjs";
4
4
  export {
5
5
  FormEdit as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ListForm
3
- } from "./chunk-IU2SMSJW.mjs";
3
+ } from "./chunk-ZBAIOZXV.mjs";
4
4
  export {
5
5
  ListForm as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TreeView
3
- } from "./chunk-IU2SMSJW.mjs";
3
+ } from "./chunk-ZBAIOZXV.mjs";
4
4
  export {
5
5
  TreeView as default
6
6
  };
@@ -3320,15 +3320,15 @@ async function classDependencyInjector(formType) {
3320
3320
  let SubFormFactoryClass;
3321
3321
  switch (formType) {
3322
3322
  case "1" /* LIST */:
3323
- SubFormFactoryClass = (await import("./ListForm-PJOXJ3TD.mjs")).default;
3323
+ SubFormFactoryClass = (await import("./ListForm-QQZ3HKUX.mjs")).default;
3324
3324
  break;
3325
3325
  case "3" /* TREE */:
3326
- SubFormFactoryClass = (await import("./TreeView-GXCLUOMI.mjs")).default;
3326
+ SubFormFactoryClass = (await import("./TreeView-JTV7B5N6.mjs")).default;
3327
3327
  break;
3328
3328
  case "2" /* EDIT */:
3329
3329
  case "99" /* FREE_FORM */:
3330
3330
  case "4" /* REPORT */:
3331
- SubFormFactoryClass = (await import("./FormEdit-AHCGTBML.mjs")).default;
3331
+ SubFormFactoryClass = (await import("./FormEdit-NBNO3NFM.mjs")).default;
3332
3332
  break;
3333
3333
  default:
3334
3334
  throw new Error(`Unsupported form type ${formType}`);
@@ -3412,6 +3412,12 @@ var Form = class extends AbstractForm {
3412
3412
  };
3413
3413
  return new SubForm(this.page);
3414
3414
  }
3415
+ async getButtonCssSelector(buttonId) {
3416
+ if (await this.isModal()) {
3417
+ return `${this.popupContainerCssSelector} ${buttonId}`;
3418
+ }
3419
+ return buttonId;
3420
+ }
3415
3421
  getContainerElement() {
3416
3422
  return this.page.locator(this.containerCssSelector);
3417
3423
  }
@@ -3773,6 +3779,119 @@ var NumberEditor = class extends AbstractDXEditorWithInput {
3773
3779
  }
3774
3780
  };
3775
3781
 
3782
+ // src/pageObjects/elements/Editors/ListItem.ts
3783
+ var DropDownListItem = class {
3784
+ page;
3785
+ itemSelector;
3786
+ textSelector;
3787
+ index;
3788
+ exactText;
3789
+ constructor(options) {
3790
+ this.page = options.page;
3791
+ this.itemSelector = options.itemSelector;
3792
+ this.textSelector = options.textSelector;
3793
+ this.index = options.index;
3794
+ this.exactText = options.exactText;
3795
+ }
3796
+ getExactTextRegExp(value) {
3797
+ const escapedText = value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3798
+ return new RegExp(`^\\s*${escapedText}\\s*$`);
3799
+ }
3800
+ getLocatorInternal() {
3801
+ const items = this.page.locator(this.itemSelector);
3802
+ if (this.index != null) {
3803
+ return items.nth(this.index);
3804
+ }
3805
+ if (this.exactText != null) {
3806
+ return items.filter({ has: this.page.locator(this.textSelector), hasText: this.getExactTextRegExp(this.exactText) }).first();
3807
+ }
3808
+ return items.first();
3809
+ }
3810
+ async text() {
3811
+ const value = await this.getLocatorInternal().locator(this.textSelector).first().innerText();
3812
+ return value.trim();
3813
+ }
3814
+ getLocator() {
3815
+ return this.getLocatorInternal();
3816
+ }
3817
+ };
3818
+
3819
+ // src/pageObjects/elements/Editors/DropDownList.ts
3820
+ var OVERLAY_SELECTOR = ".dx-overlay-wrapper";
3821
+ var DROPDOWN_BUTTON_SELECTOR = ".dx-icon.dx-dropdowneditor-icon";
3822
+ var DROPDOWN_LIST_ITEM_SELECTOR = ".dx-item.dx-list-item";
3823
+ var LIST_ITEM_TEXT_SELECTOR = ".d5-multi-select-item__text";
3824
+ var DROPDOWN_LIST_SELECTOR = ".dx-list-items";
3825
+ var LIST_ITEMS_WAIT_TIMEOUT = 1e3;
3826
+ var DropDownList = class {
3827
+ page;
3828
+ parentCssSelector;
3829
+ constructor(options) {
3830
+ this.page = options.page;
3831
+ this.parentCssSelector = options.parentCssSelector;
3832
+ }
3833
+ getDropDownButtonLocator() {
3834
+ return this.page.locator(`${this.parentCssSelector} ${DROPDOWN_BUTTON_SELECTOR}`).first();
3835
+ }
3836
+ getDropDownListItemLocator() {
3837
+ return this.page.locator(`${OVERLAY_SELECTOR} ${DROPDOWN_LIST_ITEM_SELECTOR}`);
3838
+ }
3839
+ async isDropDownListVisible() {
3840
+ try {
3841
+ return await this.page.locator(`${OVERLAY_SELECTOR} ${DROPDOWN_LIST_SELECTOR}`).isVisible();
3842
+ } catch (_) {
3843
+ return false;
3844
+ }
3845
+ }
3846
+ async open() {
3847
+ if (await this.isDropDownListVisible()) return;
3848
+ await this.getDropDownButtonLocator().click();
3849
+ await this.waitForListItems("visible");
3850
+ }
3851
+ async close() {
3852
+ if (!await this.isDropDownListVisible()) return;
3853
+ await this.getDropDownButtonLocator().click();
3854
+ await this.waitForListItems("hidden");
3855
+ }
3856
+ async waitForListItems(state) {
3857
+ try {
3858
+ await this.getDropDownListItemLocator().first().waitFor({
3859
+ state,
3860
+ timeout: LIST_ITEMS_WAIT_TIMEOUT
3861
+ });
3862
+ return true;
3863
+ } catch {
3864
+ return false;
3865
+ }
3866
+ }
3867
+ async list() {
3868
+ if (!await this.waitForListItems("visible")) {
3869
+ return [];
3870
+ }
3871
+ const count = await this.getDropDownListItemLocator().count();
3872
+ const result = [];
3873
+ for (let i = 0; i < count; i++) {
3874
+ result.push(
3875
+ new DropDownListItem({
3876
+ page: this.page,
3877
+ itemSelector: DROPDOWN_LIST_ITEM_SELECTOR,
3878
+ textSelector: LIST_ITEM_TEXT_SELECTOR,
3879
+ index: i
3880
+ })
3881
+ );
3882
+ }
3883
+ return result;
3884
+ }
3885
+ listItem(text) {
3886
+ return new DropDownListItem({
3887
+ page: this.page,
3888
+ itemSelector: `${OVERLAY_SELECTOR} ${DROPDOWN_LIST_ITEM_SELECTOR}`,
3889
+ textSelector: LIST_ITEM_TEXT_SELECTOR,
3890
+ exactText: text.trim()
3891
+ });
3892
+ }
3893
+ };
3894
+
3776
3895
  // src/pageObjects/elements/Editors/types.ts
3777
3896
  var ControlClass = /* @__PURE__ */ ((ControlClass2) => {
3778
3897
  ControlClass2["Text"] = "text-control";
@@ -3989,12 +4108,6 @@ var FormEdit = class extends Form {
3989
4108
  super(page);
3990
4109
  this.popupContainerCssSelector = `.popup.form-edit-${this.formName}`;
3991
4110
  }
3992
- async getButtonCssSelector(buttonId) {
3993
- if (await this.isModal()) {
3994
- return `${this.popupContainerCssSelector} ${buttonId}`;
3995
- }
3996
- return buttonId;
3997
- }
3998
4111
  /**
3999
4112
  * Находит поле формы редактирования по имени
4000
4113
  * @example
@@ -4563,13 +4676,30 @@ var dropDownOptionClick = async (optionValue, page, delay = true) => {
4563
4676
  await locator.click();
4564
4677
  };
4565
4678
  var SelectBoxEditor = class extends AbstractDXEditorWithInput {
4679
+ dropdownList;
4566
4680
  constructor(parentCssSelector, elementCssSelector, page) {
4567
4681
  super(parentCssSelector, elementCssSelector, page);
4568
4682
  this.setClearStrategy(new ClearButtonStrategy(this.getFullCssSelector(), page));
4683
+ this.dropdownList = new DropDownList({
4684
+ page,
4685
+ parentCssSelector: this.getFullCssSelector()
4686
+ });
4569
4687
  }
4570
4688
  getInputLocator() {
4571
4689
  return this.page.locator(`${this.getFullCssSelector()} .dx-texteditor-input`);
4572
4690
  }
4691
+ async dropDownOpen() {
4692
+ await this.dropdownList.open();
4693
+ }
4694
+ async dropDownClose() {
4695
+ await this.dropdownList.close();
4696
+ }
4697
+ async dropDownList() {
4698
+ return this.dropdownList.list();
4699
+ }
4700
+ dropDownListItem(text) {
4701
+ return this.dropdownList.listItem(text);
4702
+ }
4573
4703
  async setSelectInputValue(value) {
4574
4704
  const inputEl = this.getInputLocator();
4575
4705
  await inputEl.click();
@@ -4634,13 +4764,30 @@ var DX_TAG_CONTAINER = "dx-tag-container";
4634
4764
  var DX_TEXTEDITOR_EMPTY2 = "dx-texteditor-empty";
4635
4765
  var BTN_OK_SELECTOR = ".dx-tagbox-popup-wrapper .dx-popup-bottom .dx-button.dx-popup-done";
4636
4766
  var TagBox = class extends AbstractDXEditorWithInput {
4767
+ dropdownList;
4637
4768
  constructor(parentCssSelector, elementCssSelector, page) {
4638
4769
  super(parentCssSelector, elementCssSelector, page);
4639
4770
  this.setClearStrategy(new ClearButtonStrategy(this.getFullCssSelector(), page));
4771
+ this.dropdownList = new DropDownList({
4772
+ page,
4773
+ parentCssSelector: this.getFullCssSelector()
4774
+ });
4640
4775
  }
4641
4776
  getInputLocator() {
4642
4777
  return this.page.locator(`${this.getFullCssSelector()} .dx-texteditor-input`);
4643
4778
  }
4779
+ async dropDownOpen() {
4780
+ await this.dropdownList.open();
4781
+ }
4782
+ async dropDownClose() {
4783
+ await this.dropdownList.close();
4784
+ }
4785
+ async dropDownList() {
4786
+ return this.dropdownList.list();
4787
+ }
4788
+ dropDownListItem(text) {
4789
+ return this.dropdownList.listItem(text);
4790
+ }
4644
4791
  async setTagBoxInputValue(values) {
4645
4792
  const lastElement = values[values.length - 1];
4646
4793
  const input = this.getInputLocator();
@@ -5487,6 +5634,32 @@ var AbstractEditor = class extends AbstractElementWithParent {
5487
5634
  }
5488
5635
  return this.editor.download();
5489
5636
  }
5637
+ async dropDownOpen() {
5638
+ await this.initEditor();
5639
+ if (!this.editor.dropDownOpen) {
5640
+ throw new Error("The dropDownOpen method is not available for this field type.");
5641
+ }
5642
+ return this.editor.dropDownOpen();
5643
+ }
5644
+ async dropDownClose() {
5645
+ await this.initEditor();
5646
+ if (!this.editor.dropDownClose) {
5647
+ throw new Error("The dropDownClose method is not available for this field type.");
5648
+ }
5649
+ return this.editor.dropDownClose();
5650
+ }
5651
+ async dropDownList() {
5652
+ return new DropDownList({
5653
+ page: this.page,
5654
+ parentCssSelector: this.getFullCssSelector()
5655
+ }).list();
5656
+ }
5657
+ dropDownListItem(text) {
5658
+ return new DropDownList({
5659
+ page: this.page,
5660
+ parentCssSelector: this.getFullCssSelector()
5661
+ }).listItem(text);
5662
+ }
5490
5663
  };
5491
5664
 
5492
5665
  // src/pageObjects/elements/FormField.ts
@@ -6294,6 +6467,8 @@ var DATAGRID_CONTENT_CSS_SELECTOR = ".dx-datagrid-content .dx-datagrid-table.dx-
6294
6467
  var FIXED_DATAGRID_CONTENT_CSS_SELECTOR = ".dx-datagrid-sticky-columns .dx-datagrid-content .dx-datagrid-table.dx-datagrid-table-fixed";
6295
6468
  var CONTEXT_MENU_CSS_SELECTOR = ".dx-datagrid";
6296
6469
  var ListForm = class extends Form {
6470
+ closeButtonId = "#cancel";
6471
+ selectButtonId = "#select";
6297
6472
  headerCssSelector;
6298
6473
  fixedTableContentCssSelector;
6299
6474
  tableContentCssSelector;
@@ -6360,6 +6535,14 @@ var ListForm = class extends Form {
6360
6535
  get filterPanel() {
6361
6536
  return new FilterPanel(this.formName, this.page);
6362
6537
  }
6538
+ async closeButtonClick() {
6539
+ const css = await this.getButtonCssSelector(this.closeButtonId);
6540
+ await this.page.locator(css).click();
6541
+ }
6542
+ async selectButtonClick() {
6543
+ const css = await this.getButtonCssSelector(this.selectButtonId);
6544
+ await this.page.locator(css).click();
6545
+ }
6363
6546
  };
6364
6547
 
6365
6548
  export {
@@ -6374,6 +6557,8 @@ export {
6374
6557
  wait,
6375
6558
  TextEditor,
6376
6559
  NumberEditor,
6560
+ DropDownListItem,
6561
+ DropDownList,
6377
6562
  ControlClass,
6378
6563
  editorFactory,
6379
6564
  SubsystemsPanel,
@@ -388,6 +388,132 @@ var init_NumberEditor = __esm({
388
388
  }
389
389
  });
390
390
 
391
+ // src/pageObjects/elements/Editors/ListItem.ts
392
+ var DropDownListItem;
393
+ var init_ListItem = __esm({
394
+ "src/pageObjects/elements/Editors/ListItem.ts"() {
395
+ "use strict";
396
+ DropDownListItem = class {
397
+ page;
398
+ itemSelector;
399
+ textSelector;
400
+ index;
401
+ exactText;
402
+ constructor(options) {
403
+ this.page = options.page;
404
+ this.itemSelector = options.itemSelector;
405
+ this.textSelector = options.textSelector;
406
+ this.index = options.index;
407
+ this.exactText = options.exactText;
408
+ }
409
+ getExactTextRegExp(value) {
410
+ const escapedText = value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
411
+ return new RegExp(`^\\s*${escapedText}\\s*$`);
412
+ }
413
+ getLocatorInternal() {
414
+ const items = this.page.locator(this.itemSelector);
415
+ if (this.index != null) {
416
+ return items.nth(this.index);
417
+ }
418
+ if (this.exactText != null) {
419
+ return items.filter({ has: this.page.locator(this.textSelector), hasText: this.getExactTextRegExp(this.exactText) }).first();
420
+ }
421
+ return items.first();
422
+ }
423
+ async text() {
424
+ const value = await this.getLocatorInternal().locator(this.textSelector).first().innerText();
425
+ return value.trim();
426
+ }
427
+ getLocator() {
428
+ return this.getLocatorInternal();
429
+ }
430
+ };
431
+ }
432
+ });
433
+
434
+ // src/pageObjects/elements/Editors/DropDownList.ts
435
+ var OVERLAY_SELECTOR, DROPDOWN_BUTTON_SELECTOR, DROPDOWN_LIST_ITEM_SELECTOR, LIST_ITEM_TEXT_SELECTOR, DROPDOWN_LIST_SELECTOR, LIST_ITEMS_WAIT_TIMEOUT, DropDownList;
436
+ var init_DropDownList = __esm({
437
+ "src/pageObjects/elements/Editors/DropDownList.ts"() {
438
+ "use strict";
439
+ init_ListItem();
440
+ OVERLAY_SELECTOR = ".dx-overlay-wrapper";
441
+ DROPDOWN_BUTTON_SELECTOR = ".dx-icon.dx-dropdowneditor-icon";
442
+ DROPDOWN_LIST_ITEM_SELECTOR = ".dx-item.dx-list-item";
443
+ LIST_ITEM_TEXT_SELECTOR = ".d5-multi-select-item__text";
444
+ DROPDOWN_LIST_SELECTOR = ".dx-list-items";
445
+ LIST_ITEMS_WAIT_TIMEOUT = 1e3;
446
+ DropDownList = class {
447
+ page;
448
+ parentCssSelector;
449
+ constructor(options) {
450
+ this.page = options.page;
451
+ this.parentCssSelector = options.parentCssSelector;
452
+ }
453
+ getDropDownButtonLocator() {
454
+ return this.page.locator(`${this.parentCssSelector} ${DROPDOWN_BUTTON_SELECTOR}`).first();
455
+ }
456
+ getDropDownListItemLocator() {
457
+ return this.page.locator(`${OVERLAY_SELECTOR} ${DROPDOWN_LIST_ITEM_SELECTOR}`);
458
+ }
459
+ async isDropDownListVisible() {
460
+ try {
461
+ return await this.page.locator(`${OVERLAY_SELECTOR} ${DROPDOWN_LIST_SELECTOR}`).isVisible();
462
+ } catch (_) {
463
+ return false;
464
+ }
465
+ }
466
+ async open() {
467
+ if (await this.isDropDownListVisible()) return;
468
+ await this.getDropDownButtonLocator().click();
469
+ await this.waitForListItems("visible");
470
+ }
471
+ async close() {
472
+ if (!await this.isDropDownListVisible()) return;
473
+ await this.getDropDownButtonLocator().click();
474
+ await this.waitForListItems("hidden");
475
+ }
476
+ async waitForListItems(state) {
477
+ try {
478
+ await this.getDropDownListItemLocator().first().waitFor({
479
+ state,
480
+ timeout: LIST_ITEMS_WAIT_TIMEOUT
481
+ });
482
+ return true;
483
+ } catch {
484
+ return false;
485
+ }
486
+ }
487
+ async list() {
488
+ if (!await this.waitForListItems("visible")) {
489
+ return [];
490
+ }
491
+ const count = await this.getDropDownListItemLocator().count();
492
+ const result = [];
493
+ for (let i = 0; i < count; i++) {
494
+ result.push(
495
+ new DropDownListItem({
496
+ page: this.page,
497
+ itemSelector: DROPDOWN_LIST_ITEM_SELECTOR,
498
+ textSelector: LIST_ITEM_TEXT_SELECTOR,
499
+ index: i
500
+ })
501
+ );
502
+ }
503
+ return result;
504
+ }
505
+ listItem(text) {
506
+ return new DropDownListItem({
507
+ page: this.page,
508
+ itemSelector: `${OVERLAY_SELECTOR} ${DROPDOWN_LIST_ITEM_SELECTOR}`,
509
+ textSelector: LIST_ITEM_TEXT_SELECTOR,
510
+ exactText: text.trim()
511
+ });
512
+ }
513
+ };
514
+ }
515
+ });
516
+
391
517
  // src/pageObjects/elements/Editors/types.ts
392
518
  var ControlClass;
393
519
  var init_types = __esm({
@@ -530,6 +656,7 @@ var init_SelectBoxEditor = __esm({
530
656
  init_xpathHelper();
531
657
  init_src();
532
658
  init_typesUtil();
659
+ init_DropDownList();
533
660
  SELECT_BOX_OPTION_TEXT_CONTAINER_CLASS = "d5-multi-select-item";
534
661
  combinedValueXpath = (value) => `//body/div[@id="root"]/div[contains(@class, "dx-overlay-wrapper")]//${XPathHelper.getClassAndValueXpath(SELECT_BOX_OPTION_TEXT_CONTAINER_CLASS, value)}`;
535
662
  dropDownOptionClick = async (optionValue, page, delay = true) => {
@@ -548,13 +675,30 @@ var init_SelectBoxEditor = __esm({
548
675
  await locator.click();
549
676
  };
550
677
  SelectBoxEditor = class extends AbstractDXEditorWithInput {
678
+ dropdownList;
551
679
  constructor(parentCssSelector, elementCssSelector, page) {
552
680
  super(parentCssSelector, elementCssSelector, page);
553
681
  this.setClearStrategy(new ClearButtonStrategy(this.getFullCssSelector(), page));
682
+ this.dropdownList = new DropDownList({
683
+ page,
684
+ parentCssSelector: this.getFullCssSelector()
685
+ });
554
686
  }
555
687
  getInputLocator() {
556
688
  return this.page.locator(`${this.getFullCssSelector()} .dx-texteditor-input`);
557
689
  }
690
+ async dropDownOpen() {
691
+ await this.dropdownList.open();
692
+ }
693
+ async dropDownClose() {
694
+ await this.dropdownList.close();
695
+ }
696
+ async dropDownList() {
697
+ return this.dropdownList.list();
698
+ }
699
+ dropDownListItem(text) {
700
+ return this.dropdownList.listItem(text);
701
+ }
558
702
  async setSelectInputValue(value) {
559
703
  const inputEl = this.getInputLocator();
560
704
  await inputEl.click();
@@ -633,18 +777,36 @@ var init_TagBox = __esm({
633
777
  init_locators();
634
778
  init_SelectBoxEditor();
635
779
  init_wait();
780
+ init_DropDownList();
636
781
  TAGS_SELECTOR = ".dx-tag .tag-text";
637
782
  DX_TAG_CONTAINER = "dx-tag-container";
638
783
  DX_TEXTEDITOR_EMPTY2 = "dx-texteditor-empty";
639
784
  BTN_OK_SELECTOR = ".dx-tagbox-popup-wrapper .dx-popup-bottom .dx-button.dx-popup-done";
640
785
  TagBox = class extends AbstractDXEditorWithInput {
786
+ dropdownList;
641
787
  constructor(parentCssSelector, elementCssSelector, page) {
642
788
  super(parentCssSelector, elementCssSelector, page);
643
789
  this.setClearStrategy(new ClearButtonStrategy(this.getFullCssSelector(), page));
790
+ this.dropdownList = new DropDownList({
791
+ page,
792
+ parentCssSelector: this.getFullCssSelector()
793
+ });
644
794
  }
645
795
  getInputLocator() {
646
796
  return this.page.locator(`${this.getFullCssSelector()} .dx-texteditor-input`);
647
797
  }
798
+ async dropDownOpen() {
799
+ await this.dropdownList.open();
800
+ }
801
+ async dropDownClose() {
802
+ await this.dropdownList.close();
803
+ }
804
+ async dropDownList() {
805
+ return this.dropdownList.list();
806
+ }
807
+ dropDownListItem(text) {
808
+ return this.dropdownList.listItem(text);
809
+ }
648
810
  async setTagBoxInputValue(values) {
649
811
  const lastElement = values[values.length - 1];
650
812
  const input = this.getInputLocator();
@@ -1446,6 +1608,8 @@ var init_Editors = __esm({
1446
1608
  "use strict";
1447
1609
  init_TextEditor();
1448
1610
  init_NumberEditor();
1611
+ init_ListItem();
1612
+ init_DropDownList();
1449
1613
  init_editorFactory();
1450
1614
  init_types();
1451
1615
  }
@@ -2523,6 +2687,32 @@ var init_AbstractEditor2 = __esm({
2523
2687
  }
2524
2688
  return this.editor.download();
2525
2689
  }
2690
+ async dropDownOpen() {
2691
+ await this.initEditor();
2692
+ if (!this.editor.dropDownOpen) {
2693
+ throw new Error("The dropDownOpen method is not available for this field type.");
2694
+ }
2695
+ return this.editor.dropDownOpen();
2696
+ }
2697
+ async dropDownClose() {
2698
+ await this.initEditor();
2699
+ if (!this.editor.dropDownClose) {
2700
+ throw new Error("The dropDownClose method is not available for this field type.");
2701
+ }
2702
+ return this.editor.dropDownClose();
2703
+ }
2704
+ async dropDownList() {
2705
+ return new DropDownList({
2706
+ page: this.page,
2707
+ parentCssSelector: this.getFullCssSelector()
2708
+ }).list();
2709
+ }
2710
+ dropDownListItem(text) {
2711
+ return new DropDownList({
2712
+ page: this.page,
2713
+ parentCssSelector: this.getFullCssSelector()
2714
+ }).listItem(text);
2715
+ }
2526
2716
  };
2527
2717
  }
2528
2718
  });
@@ -3863,6 +4053,8 @@ var init_ListForm = __esm({
3863
4053
  FIXED_DATAGRID_CONTENT_CSS_SELECTOR = ".dx-datagrid-sticky-columns .dx-datagrid-content .dx-datagrid-table.dx-datagrid-table-fixed";
3864
4054
  CONTEXT_MENU_CSS_SELECTOR = ".dx-datagrid";
3865
4055
  ListForm = class extends Form {
4056
+ closeButtonId = "#cancel";
4057
+ selectButtonId = "#select";
3866
4058
  headerCssSelector;
3867
4059
  fixedTableContentCssSelector;
3868
4060
  tableContentCssSelector;
@@ -3929,6 +4121,14 @@ var init_ListForm = __esm({
3929
4121
  get filterPanel() {
3930
4122
  return new FilterPanel(this.formName, this.page);
3931
4123
  }
4124
+ async closeButtonClick() {
4125
+ const css = await this.getButtonCssSelector(this.closeButtonId);
4126
+ await this.page.locator(css).click();
4127
+ }
4128
+ async selectButtonClick() {
4129
+ const css = await this.getButtonCssSelector(this.selectButtonId);
4130
+ await this.page.locator(css).click();
4131
+ }
3932
4132
  };
3933
4133
  }
3934
4134
  });
@@ -4081,6 +4281,12 @@ var init_Form = __esm({
4081
4281
  };
4082
4282
  return new SubForm(this.page);
4083
4283
  }
4284
+ async getButtonCssSelector(buttonId) {
4285
+ if (await this.isModal()) {
4286
+ return `${this.popupContainerCssSelector} ${buttonId}`;
4287
+ }
4288
+ return buttonId;
4289
+ }
4084
4290
  getContainerElement() {
4085
4291
  return this.page.locator(this.containerCssSelector);
4086
4292
  }
@@ -4107,12 +4313,6 @@ var init_FormEdit = __esm({
4107
4313
  super(page);
4108
4314
  this.popupContainerCssSelector = `.popup.form-edit-${this.formName}`;
4109
4315
  }
4110
- async getButtonCssSelector(buttonId) {
4111
- if (await this.isModal()) {
4112
- return `${this.popupContainerCssSelector} ${buttonId}`;
4113
- }
4114
- return buttonId;
4115
- }
4116
4316
  /**
4117
4317
  * Находит поле формы редактирования по имени
4118
4318
  * @example
@@ -7080,6 +7280,8 @@ __export(src_exports, {
7080
7280
  ApiRequest: () => ApiRequest,
7081
7281
  ControlClass: () => ControlClass,
7082
7282
  Dialog: () => Dialog,
7283
+ DropDownList: () => DropDownList,
7284
+ DropDownListItem: () => DropDownListItem,
7083
7285
  FilterPanel: () => FilterPanel,
7084
7286
  FormEdit: () => FormEdit,
7085
7287
  FormField: () => FormField,
@@ -7132,6 +7334,8 @@ init_src();
7132
7334
  ApiRequest,
7133
7335
  ControlClass,
7134
7336
  Dialog,
7337
+ DropDownList,
7338
+ DropDownListItem,
7135
7339
  FilterPanel,
7136
7340
  FormEdit,
7137
7341
  FormField,
@@ -89,11 +89,19 @@ interface PlaywrightWaitParams {
89
89
  */
90
90
  declare function wait(condition: PlaywrightWaitParams['condition'], page: Page, errorMessage?: string, timeout?: number): Promise<void>;
91
91
 
92
+ interface ListItem {
93
+ text(): Promise<string>;
94
+ getLocator(): Locator;
95
+ }
92
96
  interface Editor {
93
97
  setValue(value: any): Promise<void>;
94
98
  getValue(): Promise<any>;
95
99
  remove?(itemText: string): Promise<void>;
96
100
  clear?(): Promise<void>;
101
+ dropDownOpen?(): Promise<void>;
102
+ dropDownClose?(): Promise<void>;
103
+ dropDownList?(): Promise<ListItem[]>;
104
+ dropDownListItem?(text: string): ListItem;
97
105
  isReadonly?(): Promise<boolean>;
98
106
  isDisabled?(): Promise<boolean>;
99
107
  download?(): Promise<string>;
@@ -150,6 +158,44 @@ declare class NumberEditor extends AbstractDXEditorWithInput {
150
158
  setValue(value: any): Promise<void>;
151
159
  }
152
160
 
161
+ interface DropDownListItemOptions {
162
+ page: Page;
163
+ itemSelector: string;
164
+ textSelector: string;
165
+ index?: number;
166
+ exactText?: string;
167
+ }
168
+ declare class DropDownListItem implements ListItem {
169
+ private readonly page;
170
+ private readonly itemSelector;
171
+ private readonly textSelector;
172
+ private readonly index?;
173
+ private readonly exactText?;
174
+ constructor(options: DropDownListItemOptions);
175
+ private getExactTextRegExp;
176
+ private getLocatorInternal;
177
+ text(): Promise<string>;
178
+ getLocator(): Locator;
179
+ }
180
+
181
+ interface DropDownListOptions {
182
+ page: Page;
183
+ parentCssSelector: string;
184
+ }
185
+ declare class DropDownList {
186
+ private readonly page;
187
+ private readonly parentCssSelector;
188
+ constructor(options: DropDownListOptions);
189
+ private getDropDownButtonLocator;
190
+ private getDropDownListItemLocator;
191
+ private isDropDownListVisible;
192
+ open(): Promise<void>;
193
+ close(): Promise<void>;
194
+ private waitForListItems;
195
+ list(): Promise<ListItem[]>;
196
+ listItem(text: string): ListItem;
197
+ }
198
+
153
199
  declare const editorFactory: (parentCssSelector: string, elementCssSelector: string, page: Page) => Promise<Editor>;
154
200
 
155
201
  interface ISubsystemItem {
@@ -337,6 +383,7 @@ declare abstract class Form extends AbstractForm {
337
383
  * expect(await form.subForm(name));
338
384
  */
339
385
  subForm(name: string, options?: SubFormOptions): Promise<unknown>;
386
+ protected getButtonCssSelector(buttonId: string): Promise<string>;
340
387
  protected getContainerElement(): Locator;
341
388
  }
342
389
 
@@ -427,6 +474,10 @@ declare class AbstractEditor extends AbstractElementWithParent implements Editor
427
474
  * expect(filename()).toBe('file.pdf');
428
475
  */
429
476
  download(): Promise<string>;
477
+ dropDownOpen(): Promise<void>;
478
+ dropDownClose(): Promise<void>;
479
+ dropDownList(): Promise<ListItem[]>;
480
+ dropDownListItem(text: string): ListItem;
430
481
  }
431
482
 
432
483
  declare class FormField extends AbstractEditor {
@@ -437,7 +488,6 @@ declare class FormEdit extends Form {
437
488
  saveButtonId: string;
438
489
  closeButtonId: string;
439
490
  constructor(page: Page);
440
- private getButtonCssSelector;
441
491
  /**
442
492
  * Находит поле формы редактирования по имени
443
493
  * @example
@@ -979,6 +1029,8 @@ declare class ColumnFilter {
979
1029
  }
980
1030
 
981
1031
  declare class ListForm extends Form {
1032
+ closeButtonId: string;
1033
+ selectButtonId: string;
982
1034
  protected headerCssSelector: string;
983
1035
  protected fixedTableContentCssSelector: string;
984
1036
  protected tableContentCssSelector: string;
@@ -1018,6 +1070,8 @@ declare class ListForm extends Form {
1018
1070
  * expect(listForm.filterPanel());
1019
1071
  */
1020
1072
  get filterPanel(): FilterPanel;
1073
+ closeButtonClick(): Promise<void>;
1074
+ selectButtonClick(): Promise<void>;
1021
1075
  }
1022
1076
 
1023
1077
  declare class TreeView extends ListForm {
@@ -1055,4 +1109,4 @@ declare class Dialog extends AbstractElement {
1055
1109
 
1056
1110
  declare function ApiRequest(objectName: string, operation: string): any;
1057
1111
 
1058
- export { AbstractPage, ApiRequest, ControlClass, Dialog, type Editor, FilterPanel, FormEdit, FormField, FormFilterField, ListForm, LoginPage, NumberEditor, PanelFilterField, ReportForm, SubsystemsPanel, TextEditor, TreeView, byTestId, byTestIdCssSelector, config, disabledLocator, editorFactory, readonlyLocator, wait, waitElementIsVisible };
1112
+ export { AbstractPage, ApiRequest, ControlClass, Dialog, DropDownList, DropDownListItem, type Editor, FilterPanel, FormEdit, FormField, FormFilterField, ListForm, type ListItem, LoginPage, NumberEditor, PanelFilterField, ReportForm, SubsystemsPanel, TextEditor, TreeView, byTestId, byTestIdCssSelector, config, disabledLocator, editorFactory, readonlyLocator, wait, waitElementIsVisible };
@@ -89,11 +89,19 @@ interface PlaywrightWaitParams {
89
89
  */
90
90
  declare function wait(condition: PlaywrightWaitParams['condition'], page: Page, errorMessage?: string, timeout?: number): Promise<void>;
91
91
 
92
+ interface ListItem {
93
+ text(): Promise<string>;
94
+ getLocator(): Locator;
95
+ }
92
96
  interface Editor {
93
97
  setValue(value: any): Promise<void>;
94
98
  getValue(): Promise<any>;
95
99
  remove?(itemText: string): Promise<void>;
96
100
  clear?(): Promise<void>;
101
+ dropDownOpen?(): Promise<void>;
102
+ dropDownClose?(): Promise<void>;
103
+ dropDownList?(): Promise<ListItem[]>;
104
+ dropDownListItem?(text: string): ListItem;
97
105
  isReadonly?(): Promise<boolean>;
98
106
  isDisabled?(): Promise<boolean>;
99
107
  download?(): Promise<string>;
@@ -150,6 +158,44 @@ declare class NumberEditor extends AbstractDXEditorWithInput {
150
158
  setValue(value: any): Promise<void>;
151
159
  }
152
160
 
161
+ interface DropDownListItemOptions {
162
+ page: Page;
163
+ itemSelector: string;
164
+ textSelector: string;
165
+ index?: number;
166
+ exactText?: string;
167
+ }
168
+ declare class DropDownListItem implements ListItem {
169
+ private readonly page;
170
+ private readonly itemSelector;
171
+ private readonly textSelector;
172
+ private readonly index?;
173
+ private readonly exactText?;
174
+ constructor(options: DropDownListItemOptions);
175
+ private getExactTextRegExp;
176
+ private getLocatorInternal;
177
+ text(): Promise<string>;
178
+ getLocator(): Locator;
179
+ }
180
+
181
+ interface DropDownListOptions {
182
+ page: Page;
183
+ parentCssSelector: string;
184
+ }
185
+ declare class DropDownList {
186
+ private readonly page;
187
+ private readonly parentCssSelector;
188
+ constructor(options: DropDownListOptions);
189
+ private getDropDownButtonLocator;
190
+ private getDropDownListItemLocator;
191
+ private isDropDownListVisible;
192
+ open(): Promise<void>;
193
+ close(): Promise<void>;
194
+ private waitForListItems;
195
+ list(): Promise<ListItem[]>;
196
+ listItem(text: string): ListItem;
197
+ }
198
+
153
199
  declare const editorFactory: (parentCssSelector: string, elementCssSelector: string, page: Page) => Promise<Editor>;
154
200
 
155
201
  interface ISubsystemItem {
@@ -337,6 +383,7 @@ declare abstract class Form extends AbstractForm {
337
383
  * expect(await form.subForm(name));
338
384
  */
339
385
  subForm(name: string, options?: SubFormOptions): Promise<unknown>;
386
+ protected getButtonCssSelector(buttonId: string): Promise<string>;
340
387
  protected getContainerElement(): Locator;
341
388
  }
342
389
 
@@ -427,6 +474,10 @@ declare class AbstractEditor extends AbstractElementWithParent implements Editor
427
474
  * expect(filename()).toBe('file.pdf');
428
475
  */
429
476
  download(): Promise<string>;
477
+ dropDownOpen(): Promise<void>;
478
+ dropDownClose(): Promise<void>;
479
+ dropDownList(): Promise<ListItem[]>;
480
+ dropDownListItem(text: string): ListItem;
430
481
  }
431
482
 
432
483
  declare class FormField extends AbstractEditor {
@@ -437,7 +488,6 @@ declare class FormEdit extends Form {
437
488
  saveButtonId: string;
438
489
  closeButtonId: string;
439
490
  constructor(page: Page);
440
- private getButtonCssSelector;
441
491
  /**
442
492
  * Находит поле формы редактирования по имени
443
493
  * @example
@@ -979,6 +1029,8 @@ declare class ColumnFilter {
979
1029
  }
980
1030
 
981
1031
  declare class ListForm extends Form {
1032
+ closeButtonId: string;
1033
+ selectButtonId: string;
982
1034
  protected headerCssSelector: string;
983
1035
  protected fixedTableContentCssSelector: string;
984
1036
  protected tableContentCssSelector: string;
@@ -1018,6 +1070,8 @@ declare class ListForm extends Form {
1018
1070
  * expect(listForm.filterPanel());
1019
1071
  */
1020
1072
  get filterPanel(): FilterPanel;
1073
+ closeButtonClick(): Promise<void>;
1074
+ selectButtonClick(): Promise<void>;
1021
1075
  }
1022
1076
 
1023
1077
  declare class TreeView extends ListForm {
@@ -1055,4 +1109,4 @@ declare class Dialog extends AbstractElement {
1055
1109
 
1056
1110
  declare function ApiRequest(objectName: string, operation: string): any;
1057
1111
 
1058
- export { AbstractPage, ApiRequest, ControlClass, Dialog, type Editor, FilterPanel, FormEdit, FormField, FormFilterField, ListForm, LoginPage, NumberEditor, PanelFilterField, ReportForm, SubsystemsPanel, TextEditor, TreeView, byTestId, byTestIdCssSelector, config, disabledLocator, editorFactory, readonlyLocator, wait, waitElementIsVisible };
1112
+ export { AbstractPage, ApiRequest, ControlClass, Dialog, DropDownList, DropDownListItem, type Editor, FilterPanel, FormEdit, FormField, FormFilterField, ListForm, type ListItem, LoginPage, NumberEditor, PanelFilterField, ReportForm, SubsystemsPanel, TextEditor, TreeView, byTestId, byTestIdCssSelector, config, disabledLocator, editorFactory, readonlyLocator, wait, waitElementIsVisible };
@@ -3,6 +3,8 @@ import {
3
3
  ApiRequest,
4
4
  ControlClass,
5
5
  Dialog,
6
+ DropDownList,
7
+ DropDownListItem,
6
8
  FilterPanel,
7
9
  FormEdit,
8
10
  FormField,
@@ -23,12 +25,14 @@ import {
23
25
  readonlyLocator,
24
26
  wait,
25
27
  waitElementIsVisible_default
26
- } from "./chunk-IU2SMSJW.mjs";
28
+ } from "./chunk-ZBAIOZXV.mjs";
27
29
  export {
28
30
  AbstractPage,
29
31
  ApiRequest,
30
32
  ControlClass,
31
33
  Dialog,
34
+ DropDownList,
35
+ DropDownListItem,
32
36
  FilterPanel,
33
37
  FormEdit,
34
38
  FormField,
@@ -3,6 +3,8 @@ import {
3
3
  ApiRequest,
4
4
  ControlClass,
5
5
  Dialog,
6
+ DropDownList,
7
+ DropDownListItem,
6
8
  FilterPanel,
7
9
  FormEdit,
8
10
  FormField,
@@ -23,12 +25,14 @@ import {
23
25
  readonlyLocator,
24
26
  wait,
25
27
  waitElementIsVisible_default
26
- } from "./chunk-IU2SMSJW.mjs";
28
+ } from "./chunk-ZBAIOZXV.mjs";
27
29
  export {
28
30
  AbstractPage,
29
31
  ApiRequest,
30
32
  ControlClass,
31
33
  Dialog,
34
+ DropDownList,
35
+ DropDownListItem,
32
36
  FilterPanel,
33
37
  FormEdit,
34
38
  FormField,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "d5-testing-library",
3
- "version": "2.0.0-alpha.12",
3
+ "version": "2.0.0-alpha.14",
4
4
  "description": "e2e testing D5 projects",
5
5
  "main": "dist/cjs/d5-testing-library.cjs",
6
6
  "module": "dist/d5-testing-library.legacy-esm.js",