d5-testing-library 1.3.1 → 1.4.0
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/dist/cjs/d5-testing-library.cjs +404 -143
- package/dist/d5-testing-library.d.ts +55 -22
- package/dist/d5-testing-library.legacy-esm.js +401 -142
- package/dist/d5-testing-library.mjs +401 -142
- package/package.json +1 -1
|
@@ -128,6 +128,9 @@ var AbstractPage = class extends AbstractElement {
|
|
|
128
128
|
// src/utils/actions.ts
|
|
129
129
|
var click = async (webElement, driver) => {
|
|
130
130
|
driver = driver ?? config().driver;
|
|
131
|
+
if (!await webElement.isDisplayed()) {
|
|
132
|
+
await driver.executeScript("arguments[0].scrollIntoView(true);", webElement);
|
|
133
|
+
}
|
|
131
134
|
const actions = driver.actions({ async: true });
|
|
132
135
|
await actions.move({ origin: webElement }).click().perform();
|
|
133
136
|
};
|
|
@@ -253,7 +256,95 @@ var SubsystemsPanel = class extends AbstractElement {
|
|
|
253
256
|
};
|
|
254
257
|
|
|
255
258
|
// src/pageObjects/elements/Forms/AbstractForm.ts
|
|
259
|
+
import { By as By6 } from "selenium-webdriver";
|
|
260
|
+
|
|
261
|
+
// src/utils/createDataTestId.ts
|
|
262
|
+
function createDataTestId(formName, itemType, itemName) {
|
|
263
|
+
return `${formName}-${itemType}-${itemName}`;
|
|
264
|
+
}
|
|
265
|
+
function createFieldTestId(formName, itemName) {
|
|
266
|
+
return createDataTestId(formName, "form_field" /* FORM_FIELD */, itemName);
|
|
267
|
+
}
|
|
268
|
+
function createGroupTestId(formName, itemName) {
|
|
269
|
+
return createDataTestId(formName, "group" /* GROUP */, itemName);
|
|
270
|
+
}
|
|
271
|
+
function createFilterTestId(formName, itemName, layout) {
|
|
272
|
+
return createDataTestId(formName, "filter" /* FILTER */, itemName) + `-${layout}`;
|
|
273
|
+
}
|
|
274
|
+
function createDocFilterTestId(formName, itemName) {
|
|
275
|
+
return createFilterTestId(formName, itemName, "dock-panel-filter" /* DOCK_PANEL */);
|
|
276
|
+
}
|
|
277
|
+
function createLayoutFilterTestId(formName, itemName) {
|
|
278
|
+
return createFilterTestId(formName, itemName, "layout-filter" /* LAYOUT */);
|
|
279
|
+
}
|
|
280
|
+
function createTableId(formName) {
|
|
281
|
+
return `${"table" /* TABLE */}-${formName}`;
|
|
282
|
+
}
|
|
283
|
+
function createFormButtonTestId(formName, itemName) {
|
|
284
|
+
return createDataTestId(formName, "button" /* BUTTON */, itemName);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// src/utils/waitElementIsClickable.ts
|
|
288
|
+
async function waitElementIsClickable({
|
|
289
|
+
element,
|
|
290
|
+
timeout,
|
|
291
|
+
errorMessage,
|
|
292
|
+
driver
|
|
293
|
+
}) {
|
|
294
|
+
driver = driver ?? config().driver;
|
|
295
|
+
await wait(async () => {
|
|
296
|
+
const isDisabled = await element.getCssValue("pointer-events") === "none";
|
|
297
|
+
return await element.isDisplayed() && !isDisabled;
|
|
298
|
+
}, driver, errorMessage, timeout ?? config().timeout);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// src/pageObjects/elements/TableToolbar/AbstractButton.ts
|
|
302
|
+
var AbstractButton = class extends AbstractElementWithParent {
|
|
303
|
+
constructor(parentCssSelector, elementCssSelector, driver) {
|
|
304
|
+
super(parentCssSelector, elementCssSelector, driver);
|
|
305
|
+
}
|
|
306
|
+
async click() {
|
|
307
|
+
const button = await this.getElement();
|
|
308
|
+
await waitElementIsClickable({
|
|
309
|
+
element: button,
|
|
310
|
+
errorMessage: this.buttonNotDisplayedError(),
|
|
311
|
+
driver: this.driver
|
|
312
|
+
});
|
|
313
|
+
await click(button, this.driver);
|
|
314
|
+
}
|
|
315
|
+
async isDisabled() {
|
|
316
|
+
const button = await this.getElement();
|
|
317
|
+
return await button.getCssValue("pointer-events") === "none";
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
// src/pageObjects/elements/DXComponents/DXButton.ts
|
|
256
322
|
import { By as By5 } from "selenium-webdriver";
|
|
323
|
+
var DXButton = class extends AbstractButton {
|
|
324
|
+
async getText() {
|
|
325
|
+
const classes = await this.getClasses();
|
|
326
|
+
if (!classes.includes("dx-button-has-text")) {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
const el = await this.getElement();
|
|
330
|
+
const textEl = el.findElement(By5.className("dx-button-text"));
|
|
331
|
+
return await textEl.getText();
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
// src/pageObjects/elements/FormButton.ts
|
|
336
|
+
var FormButton = class extends DXButton {
|
|
337
|
+
name;
|
|
338
|
+
constructor(parentCssSelector, formName, name, driver) {
|
|
339
|
+
super(parentCssSelector, byTestIdCssSelector(createFormButtonTestId(formName, name)), driver);
|
|
340
|
+
this.name = name;
|
|
341
|
+
}
|
|
342
|
+
buttonNotDisplayedError() {
|
|
343
|
+
return `Form Button ${this.name} cannot be clicked. It is not displayed or it is disabled`;
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
// src/pageObjects/elements/Forms/AbstractForm.ts
|
|
257
348
|
var AbstractForm = class extends AbstractPage {
|
|
258
349
|
containerCssSelector = "";
|
|
259
350
|
containerBy;
|
|
@@ -300,42 +391,22 @@ var AbstractForm = class extends AbstractPage {
|
|
|
300
391
|
*/
|
|
301
392
|
async getTitleText() {
|
|
302
393
|
if (await this.isModal()) {
|
|
303
|
-
const titleEl2 = await this.driver.findElement(
|
|
394
|
+
const titleEl2 = await this.driver.findElement(By6.css(`${this.popupContainerCssSelector} .popup-title`));
|
|
304
395
|
return titleEl2.getText();
|
|
305
396
|
}
|
|
306
|
-
let titleEl = await this.driver.findElement(
|
|
397
|
+
let titleEl = await this.driver.findElement(By6.className("main-toolbar-form-title"));
|
|
307
398
|
return titleEl.getText();
|
|
308
399
|
}
|
|
400
|
+
button(name) {
|
|
401
|
+
return new FormButton(this.containerCssSelector, this.formName, name, this.driver);
|
|
402
|
+
}
|
|
309
403
|
};
|
|
310
404
|
|
|
311
405
|
// src/pageObjects/elements/Forms/FormEdit.ts
|
|
312
|
-
import { By as
|
|
313
|
-
|
|
314
|
-
// src/utils/createDataTestId.ts
|
|
315
|
-
function createDataTestId(formName, itemType, itemName) {
|
|
316
|
-
return `${formName}-${itemType}-${itemName}`;
|
|
317
|
-
}
|
|
318
|
-
function createFieldTestId(formName, itemName) {
|
|
319
|
-
return createDataTestId(formName, "form_field" /* FORM_FIELD */, itemName);
|
|
320
|
-
}
|
|
321
|
-
function createGroupTestId(formName, itemName) {
|
|
322
|
-
return createDataTestId(formName, "group" /* GROUP */, itemName);
|
|
323
|
-
}
|
|
324
|
-
function createFilterTestId(formName, itemName, layout) {
|
|
325
|
-
return createDataTestId(formName, "filter" /* FILTER */, itemName) + `-${layout}`;
|
|
326
|
-
}
|
|
327
|
-
function createDocFilterTestId(formName, itemName) {
|
|
328
|
-
return createFilterTestId(formName, itemName, "dock-panel-filter" /* DOCK_PANEL */);
|
|
329
|
-
}
|
|
330
|
-
function createLayoutFilterTestId(formName, itemName) {
|
|
331
|
-
return createFilterTestId(formName, itemName, "layout-filter" /* LAYOUT */);
|
|
332
|
-
}
|
|
333
|
-
function createTableId(formName) {
|
|
334
|
-
return `${"table" /* TABLE */}-${formName}`;
|
|
335
|
-
}
|
|
406
|
+
import { By as By15 } from "selenium-webdriver";
|
|
336
407
|
|
|
337
408
|
// src/pageObjects/elements/Editors/AbstractEditor.ts
|
|
338
|
-
import { By as
|
|
409
|
+
import { By as By7, Key } from "selenium-webdriver";
|
|
339
410
|
|
|
340
411
|
// src/pageObjects/elements/Editors/ClearStrategy/InputClearStrategy.ts
|
|
341
412
|
var InputClearStrategy = class {
|
|
@@ -355,7 +426,7 @@ var AbstractDXEditorWithInput = class extends AbstractElementWithParent {
|
|
|
355
426
|
return `${this.getFullCssSelector()} .dx-texteditor-input`;
|
|
356
427
|
}
|
|
357
428
|
async getInputElement() {
|
|
358
|
-
return this.driver.findElement(
|
|
429
|
+
return this.driver.findElement(By7.css(this.getInputCssSelector()));
|
|
359
430
|
}
|
|
360
431
|
async getInputValue() {
|
|
361
432
|
const inputEl = await this.getInputElement();
|
|
@@ -400,6 +471,22 @@ var NumberEditor = class extends AbstractDXEditorWithInput {
|
|
|
400
471
|
}
|
|
401
472
|
};
|
|
402
473
|
|
|
474
|
+
// src/pageObjects/elements/Editors/types.ts
|
|
475
|
+
var ControlClass = /* @__PURE__ */ ((ControlClass2) => {
|
|
476
|
+
ControlClass2["Text"] = "text-control";
|
|
477
|
+
ControlClass2["TextArea"] = "text-area-control";
|
|
478
|
+
ControlClass2["Number"] = "number-control";
|
|
479
|
+
ControlClass2["CheckBox"] = "check-box";
|
|
480
|
+
ControlClass2["Multiselect"] = "multi-select-control";
|
|
481
|
+
ControlClass2["Select"] = "select-control";
|
|
482
|
+
ControlClass2["Switch"] = "switch-control";
|
|
483
|
+
ControlClass2["Date"] = "date-control";
|
|
484
|
+
ControlClass2["SingleDateRange"] = "single-date-range-control";
|
|
485
|
+
ControlClass2["BooleanSelector"] = "buttons-group";
|
|
486
|
+
ControlClass2["ButtonGroup"] = "button-group-field";
|
|
487
|
+
return ControlClass2;
|
|
488
|
+
})(ControlClass || {});
|
|
489
|
+
|
|
403
490
|
// src/pageObjects/AbstractFormElement.ts
|
|
404
491
|
var AbstractFormElement = class extends AbstractElementWithParent {
|
|
405
492
|
constructor(parentCssSelector, elementCssSelector, driver) {
|
|
@@ -427,20 +514,17 @@ var CheckBox = class extends AbstractElementWithParent {
|
|
|
427
514
|
};
|
|
428
515
|
|
|
429
516
|
// src/pageObjects/elements/Editors/SelectBoxEditor.ts
|
|
430
|
-
import { By as
|
|
517
|
+
import { By as By9, Key as Key2 } from "selenium-webdriver";
|
|
431
518
|
|
|
432
519
|
// src/utils/xpathHelper.ts
|
|
433
520
|
var XPathHelper = class {
|
|
434
|
-
static getRoleXpath(role) {
|
|
435
|
-
return `//div[@role='${role}']`;
|
|
436
|
-
}
|
|
437
521
|
static getClassAndValueXpath(cssClass, value) {
|
|
438
|
-
return
|
|
522
|
+
return `div[contains(@class, '${cssClass}') and contains(.,'${value}')]`;
|
|
439
523
|
}
|
|
440
524
|
};
|
|
441
525
|
|
|
442
526
|
// src/pageObjects/elements/Editors/ClearStrategy/ClearButtonStrategy.ts
|
|
443
|
-
import { By as
|
|
527
|
+
import { By as By8 } from "selenium-webdriver";
|
|
444
528
|
var DX_TEXTEDITOR_EMPTY = "dx-texteditor-empty";
|
|
445
529
|
var DX_CLEAR_BUTTON_AREA = "dx-clear-button-area";
|
|
446
530
|
var ClearButtonStrategy = class {
|
|
@@ -451,7 +535,7 @@ var ClearButtonStrategy = class {
|
|
|
451
535
|
this._driver = driver;
|
|
452
536
|
}
|
|
453
537
|
async isEmptyEditorField() {
|
|
454
|
-
const editorContainer = await this._driver.findElement(
|
|
538
|
+
const editorContainer = await this._driver.findElement(By8.css(this.editorContainerClass));
|
|
455
539
|
const classAttribute = await editorContainer.getAttribute("class");
|
|
456
540
|
return classAttribute.includes(DX_TEXTEDITOR_EMPTY);
|
|
457
541
|
}
|
|
@@ -460,18 +544,31 @@ var ClearButtonStrategy = class {
|
|
|
460
544
|
throw new Error("This field is already empty");
|
|
461
545
|
}
|
|
462
546
|
const clearBtnSelector = `${this.editorContainerClass} .${DX_CLEAR_BUTTON_AREA}`;
|
|
463
|
-
const clearBtn = await this._driver.findElement(
|
|
547
|
+
const clearBtn = await this._driver.findElement(By8.css(clearBtnSelector));
|
|
464
548
|
await click(clearBtn, this._driver);
|
|
465
549
|
}
|
|
466
550
|
};
|
|
467
551
|
|
|
468
552
|
// src/pageObjects/elements/Editors/SelectBoxEditor.ts
|
|
469
553
|
var SELECT_BOX_OPTION_TEXT_CONTAINER_CLASS = "d5-multi-select-item";
|
|
470
|
-
var
|
|
471
|
-
var
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
554
|
+
var combinedValueXpath = (value) => `//body/div[@id="root"]/div[contains(@class, "dx-overlay-wrapper")]//${XPathHelper.getClassAndValueXpath(SELECT_BOX_OPTION_TEXT_CONTAINER_CLASS, value)}`;
|
|
555
|
+
var dropDownOptionClick = async (optionValue, driver, delay = true) => {
|
|
556
|
+
const { implicit } = await driver.manage().getTimeouts();
|
|
557
|
+
let optElement = null;
|
|
558
|
+
const timeout = delay ? implicit : 200;
|
|
559
|
+
let err = null;
|
|
560
|
+
try {
|
|
561
|
+
await driver.manage().setTimeouts({ implicit: timeout });
|
|
562
|
+
optElement = await driver.findElement(By9.xpath(combinedValueXpath(optionValue)));
|
|
563
|
+
await click(optElement, driver);
|
|
564
|
+
} catch (e) {
|
|
565
|
+
err = new Error(`Item not found: "${optionValue}"`);
|
|
566
|
+
} finally {
|
|
567
|
+
await driver.manage().setTimeouts({ implicit });
|
|
568
|
+
}
|
|
569
|
+
if (err)
|
|
570
|
+
throw err;
|
|
571
|
+
};
|
|
475
572
|
var SelectBoxEditor = class extends AbstractDXEditorWithInput {
|
|
476
573
|
constructor(parentCssSelector, elementCssSelector, driver) {
|
|
477
574
|
super(parentCssSelector, elementCssSelector, driver);
|
|
@@ -480,9 +577,12 @@ var SelectBoxEditor = class extends AbstractDXEditorWithInput {
|
|
|
480
577
|
async setSelectInputValue(value) {
|
|
481
578
|
const inputEl = await this.getInputElement();
|
|
482
579
|
await click(inputEl, this.driver);
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
580
|
+
try {
|
|
581
|
+
await dropDownOptionClick(value, this.driver, false);
|
|
582
|
+
} catch {
|
|
583
|
+
await inputEl.sendKeys(value, Key2.ENTER);
|
|
584
|
+
await dropDownOptionClick(value, this.driver);
|
|
585
|
+
}
|
|
486
586
|
}
|
|
487
587
|
async getValue() {
|
|
488
588
|
const value = await super.getInputValue();
|
|
@@ -521,7 +621,7 @@ var SwitchEditor = class extends AbstractElementWithParent {
|
|
|
521
621
|
};
|
|
522
622
|
|
|
523
623
|
// src/pageObjects/elements/Editors/TagBox.ts
|
|
524
|
-
import { By as
|
|
624
|
+
import { By as By10 } from "selenium-webdriver";
|
|
525
625
|
var TAGS_SELECTOR = ".dx-tag .tag-text";
|
|
526
626
|
var DX_TAG_CONTAINER = "dx-tag-container";
|
|
527
627
|
var DX_TEXTEDITOR_EMPTY2 = "dx-texteditor-empty";
|
|
@@ -542,27 +642,32 @@ var TagBox = class extends AbstractDXEditorWithInput {
|
|
|
542
642
|
await this.confirmSelection();
|
|
543
643
|
}
|
|
544
644
|
async waitOptionSelection() {
|
|
545
|
-
const option = await this.driver.findElement(
|
|
645
|
+
const option = await this.driver.findElement(By10.css(TAG_BOX_LIST_ITEM_SELECTOR));
|
|
546
646
|
await wait(() => option.isDisplayed(), this.driver);
|
|
547
647
|
}
|
|
548
648
|
async selectOption(inputEl, value, lastElement) {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
649
|
+
try {
|
|
650
|
+
await dropDownOptionClick(value, this.driver, false);
|
|
651
|
+
} catch {
|
|
652
|
+
await inputEl.sendKeys(value);
|
|
653
|
+
await dropDownOptionClick(value, this.driver);
|
|
654
|
+
}
|
|
552
655
|
await this.waitOptionSelection();
|
|
553
656
|
if (value !== lastElement) {
|
|
554
657
|
await inputEl.clear();
|
|
555
658
|
}
|
|
556
659
|
}
|
|
557
660
|
async confirmSelection() {
|
|
558
|
-
const btnOk = await this.driver.findElement(
|
|
661
|
+
const btnOk = await this.driver.findElement(By10.css(BTN_OK_SELECTOR));
|
|
559
662
|
await click(btnOk, this.driver);
|
|
560
663
|
}
|
|
561
664
|
async getTagBoxInputValue() {
|
|
562
665
|
if (await this.isTagBoxEmpty()) {
|
|
563
666
|
return [];
|
|
564
667
|
}
|
|
565
|
-
const tags = await this.driver.findElements(
|
|
668
|
+
const tags = await this.driver.findElements(
|
|
669
|
+
By10.css(`${this.getFullCssSelector()} .${DX_TAG_CONTAINER} ${TAGS_SELECTOR}`)
|
|
670
|
+
);
|
|
566
671
|
const values = [];
|
|
567
672
|
for (const tag of tags) {
|
|
568
673
|
values.push(await tag.getAttribute("textContent"));
|
|
@@ -590,24 +695,26 @@ var TagBox = class extends AbstractDXEditorWithInput {
|
|
|
590
695
|
throw new Error(`The tag with the text: ${itemText} was not found`);
|
|
591
696
|
}
|
|
592
697
|
const clearBtnTestId = byTestIdCssSelector(`clear-button-${itemText}`);
|
|
593
|
-
const clearBtn = await this.driver.findElement(
|
|
698
|
+
const clearBtn = await this.driver.findElement(
|
|
699
|
+
By10.css(`${this.getFullCssSelector()} .${DX_TAG_CONTAINER} ${clearBtnTestId}`)
|
|
700
|
+
);
|
|
594
701
|
await click(clearBtn, this.driver);
|
|
595
702
|
}
|
|
596
703
|
};
|
|
597
704
|
|
|
598
705
|
// src/pageObjects/elements/Editors/ButtonGroup.ts
|
|
599
|
-
import { By as
|
|
706
|
+
import { By as By11 } from "selenium-webdriver";
|
|
600
707
|
var ITEM_CLASS = "dx-buttongroup-item";
|
|
601
708
|
var SELECTED_CLASS = "dx-state-selected";
|
|
602
709
|
var ButtonGroup = class extends AbstractElementWithParent {
|
|
603
710
|
getItems() {
|
|
604
|
-
return this.driver.findElements(
|
|
711
|
+
return this.driver.findElements(By11.css(`${this.getFullCssSelector()} .${ITEM_CLASS}`));
|
|
605
712
|
}
|
|
606
713
|
getDataValue(el) {
|
|
607
714
|
return el.getAttribute("data-value");
|
|
608
715
|
}
|
|
609
716
|
async getValue() {
|
|
610
|
-
const selectedEl = await this.driver.findElement(
|
|
717
|
+
const selectedEl = await this.driver.findElement(By11.css(`${this.getFullCssSelector()} .${ITEM_CLASS}.${SELECTED_CLASS}`));
|
|
611
718
|
return this.getDataValue(selectedEl);
|
|
612
719
|
}
|
|
613
720
|
async setValue(value) {
|
|
@@ -640,26 +747,67 @@ var BooleanSelector = class extends ButtonGroup {
|
|
|
640
747
|
}
|
|
641
748
|
};
|
|
642
749
|
|
|
643
|
-
// src/pageObjects/elements/Editors/
|
|
644
|
-
import { By as
|
|
645
|
-
|
|
750
|
+
// src/pageObjects/elements/Editors/Date/SingleDateEditor.ts
|
|
751
|
+
import { By as By13 } from "selenium-webdriver";
|
|
752
|
+
|
|
753
|
+
// src/pageObjects/elements/Editors/Date/BaseDateEditor.ts
|
|
754
|
+
import { By as By12, Key as Key3 } from "selenium-webdriver";
|
|
755
|
+
|
|
756
|
+
// src/pageObjects/elements/Editors/Date/utils.ts
|
|
757
|
+
var formatDMYDate = (date) => {
|
|
758
|
+
const [year, month, day] = date.toJSON().split("T")[0].split("-");
|
|
759
|
+
return `${day}${month}${year}`;
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
// src/pageObjects/elements/Editors/Date/BaseDateEditor.ts
|
|
763
|
+
var BTN_CALENDAR_POPOVER_OPEN_SELECTOR = "calendar-popover-open-button";
|
|
764
|
+
var BTN_CALENDAR_POPOVER_DATE_FROM_INPUT_SELECTOR = "DateRange__inputs-item--dateFrom";
|
|
765
|
+
var BTN_CALENDAR_POPOVER_DATE_TO_INPUT_SELECTOR = "DateRange__inputs-item--dateTo";
|
|
766
|
+
var BTN_SAVE_SELECTOR = "DateRange__button-save";
|
|
767
|
+
var BaseDateEditor = class extends AbstractDXEditorWithInput {
|
|
646
768
|
constructor(parentCssSelector, elementCssSelector, driver) {
|
|
647
769
|
super(parentCssSelector, elementCssSelector, driver);
|
|
648
770
|
this.setClearStrategy(new InputClearStrategy());
|
|
649
771
|
}
|
|
650
|
-
async getDateElement() {
|
|
651
|
-
return this.driver.findElement(By11.css(this.getFullCssSelector() + " .dx-dropdowneditor-input-wrapper input[type=hidden]"));
|
|
652
|
-
}
|
|
653
772
|
async setDateValue(value) {
|
|
654
|
-
const dateEl = await this.getInputElement();
|
|
655
|
-
const stringDate = value.toJSON().split("T")[0];
|
|
656
|
-
const dateArr = stringDate.split("-");
|
|
657
|
-
const [year, month, day] = dateArr;
|
|
658
|
-
const keys = day + month + year;
|
|
659
|
-
await click(dateEl, this.driver);
|
|
660
773
|
const actions = this.driver.actions({ async: true });
|
|
661
|
-
|
|
662
|
-
|
|
774
|
+
const dateField = await this.driver.findElement(By12.css(`${this.getFullCssSelector()}`));
|
|
775
|
+
const dateFieldDataTestID = await this.getDataTestId();
|
|
776
|
+
const calendarPopoverSelector = byTestIdCssSelector(`${dateFieldDataTestID}-calendar-popover`);
|
|
777
|
+
const dateInputEl = await this.getInputElement();
|
|
778
|
+
await dateInputEl.clear();
|
|
779
|
+
if (Array.isArray(value)) {
|
|
780
|
+
const formattedDates = value.map(formatDMYDate);
|
|
781
|
+
const button = await dateField.findElement(By12.css(`.${BTN_CALENDAR_POPOVER_OPEN_SELECTOR}`));
|
|
782
|
+
await button.click();
|
|
783
|
+
const calendarPopoverElement = await this.driver.findElement(By12.css(calendarPopoverSelector));
|
|
784
|
+
const dateFromInput = await calendarPopoverElement.findElement(By12.css(`.${BTN_CALENDAR_POPOVER_DATE_FROM_INPUT_SELECTOR} .dx-texteditor-input`));
|
|
785
|
+
const dateToInput = await calendarPopoverElement.findElement(By12.css(`.${BTN_CALENDAR_POPOVER_DATE_TO_INPUT_SELECTOR} .dx-texteditor-input`));
|
|
786
|
+
await dateFromInput.click();
|
|
787
|
+
await dateFromInput.sendKeys(formattedDates[0]);
|
|
788
|
+
await dateToInput.click();
|
|
789
|
+
await actions.move({ origin: dateInputEl }).sendKeys(Key3.HOME).perform();
|
|
790
|
+
await dateToInput.sendKeys(formattedDates[1]);
|
|
791
|
+
await actions.move({ origin: dateInputEl }).sendKeys(Key3.ENTER).perform();
|
|
792
|
+
const btnOk = await this.driver.findElement(By12.css(`.${BTN_SAVE_SELECTOR}`));
|
|
793
|
+
await btnOk.click();
|
|
794
|
+
} else {
|
|
795
|
+
const formattedDate = formatDMYDate(value);
|
|
796
|
+
await click(dateInputEl, this.driver);
|
|
797
|
+
await actions.move({ origin: dateInputEl }).sendKeys(Key3.HOME).perform();
|
|
798
|
+
await actions.move({ origin: dateInputEl }).sendKeys(formattedDate, Key3.ENTER).perform();
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
// src/pageObjects/elements/Editors/Date/SingleDateEditor.ts
|
|
804
|
+
var SingleDateEditor = class extends BaseDateEditor {
|
|
805
|
+
constructor(parentCssSelector, elementCssSelector, driver) {
|
|
806
|
+
super(parentCssSelector, elementCssSelector, driver);
|
|
807
|
+
this.setClearStrategy(new InputClearStrategy());
|
|
808
|
+
}
|
|
809
|
+
async getDateElement() {
|
|
810
|
+
return this.driver.findElement(By13.css(this.getFullCssSelector() + " .dx-dropdowneditor-input-wrapper input[type=hidden]"));
|
|
663
811
|
}
|
|
664
812
|
async getDateValue() {
|
|
665
813
|
const inputEl = await this.getDateElement();
|
|
@@ -677,27 +825,105 @@ var DateEditor = class extends AbstractDXEditorWithInput {
|
|
|
677
825
|
}
|
|
678
826
|
};
|
|
679
827
|
|
|
828
|
+
// src/pageObjects/elements/Editors/Date/DateRangeEditor.ts
|
|
829
|
+
import { By as By14 } from "selenium-webdriver";
|
|
830
|
+
var DateRangeEditor = class extends BaseDateEditor {
|
|
831
|
+
constructor(parentCssSelector, elementCssSelector, driver) {
|
|
832
|
+
super(parentCssSelector, elementCssSelector, driver);
|
|
833
|
+
this.setClearStrategy(new InputClearStrategy());
|
|
834
|
+
}
|
|
835
|
+
async getDateElement() {
|
|
836
|
+
return this.driver.findElement(By14.css(this.getFullCssSelector() + " .dx-texteditor-input"));
|
|
837
|
+
}
|
|
838
|
+
async getDateValue() {
|
|
839
|
+
const inputEl = await this.getDateElement();
|
|
840
|
+
const dateFromStr = await inputEl.getAttribute("datefrom");
|
|
841
|
+
const dateToStr = await inputEl.getAttribute("dateto");
|
|
842
|
+
const dateFrom = new Date(dateFromStr);
|
|
843
|
+
const dateTo = new Date(dateToStr);
|
|
844
|
+
return [dateFrom, dateTo];
|
|
845
|
+
}
|
|
846
|
+
async getValue() {
|
|
847
|
+
const values = await this.getDateValue();
|
|
848
|
+
return !values.length ? null : values;
|
|
849
|
+
}
|
|
850
|
+
setValue(value) {
|
|
851
|
+
if (typeof value === "object") {
|
|
852
|
+
return this.setDateValue(value);
|
|
853
|
+
}
|
|
854
|
+
throw new Error(`Value is incorrect. It should be Object`);
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
// src/pageObjects/elements/Editors/Date/DateEditor.ts
|
|
859
|
+
var DateEditor = class extends AbstractDXEditorWithInput {
|
|
860
|
+
editorInstance = null;
|
|
861
|
+
initPromise;
|
|
862
|
+
constructor(parentCssSelector, elementCssSelector, driver) {
|
|
863
|
+
super(parentCssSelector, elementCssSelector, driver);
|
|
864
|
+
this.initPromise = this.init(parentCssSelector, elementCssSelector, driver);
|
|
865
|
+
}
|
|
866
|
+
async init(parentCssSelector, elementCssSelector, driver) {
|
|
867
|
+
await this.updateEditorInstance(parentCssSelector, elementCssSelector, driver);
|
|
868
|
+
}
|
|
869
|
+
async updateEditorInstance(parentCssSelector, elementCssSelector, driver) {
|
|
870
|
+
const elementInstance = new AbstractFormElement(parentCssSelector, elementCssSelector, driver);
|
|
871
|
+
const classString = await elementInstance.getClasses();
|
|
872
|
+
switch (true) {
|
|
873
|
+
case classString.includes("date-control" /* Date */):
|
|
874
|
+
this.editorInstance = new SingleDateEditor(parentCssSelector, elementCssSelector, driver);
|
|
875
|
+
break;
|
|
876
|
+
case classString.includes("single-date-range-control" /* SingleDateRange */):
|
|
877
|
+
this.editorInstance = new DateRangeEditor(parentCssSelector, elementCssSelector, driver);
|
|
878
|
+
break;
|
|
879
|
+
default:
|
|
880
|
+
this.editorInstance = new SingleDateEditor(parentCssSelector, elementCssSelector, driver);
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
async ensureInitialized() {
|
|
884
|
+
if (!this.editorInstance) {
|
|
885
|
+
await this.initPromise;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
async setValue(value) {
|
|
889
|
+
await this.ensureInitialized();
|
|
890
|
+
if (this.editorInstance) {
|
|
891
|
+
await this.editorInstance.setValue(value);
|
|
892
|
+
return await this.updateEditorInstance(this.parentCssSelector, this.elementCssSelector, this.driver);
|
|
893
|
+
}
|
|
894
|
+
throw new Error("Editor instance is not initialized.");
|
|
895
|
+
}
|
|
896
|
+
async getValue() {
|
|
897
|
+
await this.ensureInitialized();
|
|
898
|
+
if (this.editorInstance) {
|
|
899
|
+
return this.editorInstance.getValue();
|
|
900
|
+
}
|
|
901
|
+
throw new Error("Editor instance is not initialized.");
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
|
|
680
905
|
// src/pageObjects/elements/Editors/editorFactory.ts
|
|
681
906
|
var editorFactory = async (parentCssSelector, elementCssSelector, driver) => {
|
|
682
907
|
const elementInstance = new AbstractFormElement(parentCssSelector, elementCssSelector, driver);
|
|
683
908
|
const classSting = await elementInstance.getClasses();
|
|
684
|
-
if (classSting.includes("text-control"))
|
|
909
|
+
if ((classSting.includes("text-control" /* Text */) || classSting.includes("text-area-control" /* TextArea */)) && !classSting.includes("single-date-range-control" /* SingleDateRange */))
|
|
685
910
|
return new TextEditor(parentCssSelector, elementCssSelector, driver);
|
|
686
|
-
if (classSting.includes("number-control"))
|
|
911
|
+
if (classSting.includes("number-control" /* Number */))
|
|
687
912
|
return new NumberEditor(parentCssSelector, elementCssSelector, driver);
|
|
688
|
-
if (classSting.includes("check-box"))
|
|
913
|
+
if (classSting.includes("check-box" /* CheckBox */))
|
|
689
914
|
return new CheckBox(parentCssSelector, elementCssSelector, driver);
|
|
690
|
-
if (classSting.includes("multi-select-control"))
|
|
915
|
+
if (classSting.includes("multi-select-control" /* Multiselect */))
|
|
691
916
|
return new TagBox(parentCssSelector, elementCssSelector, driver);
|
|
692
|
-
if (classSting.includes("select-control"))
|
|
917
|
+
if (classSting.includes("select-control" /* Select */))
|
|
693
918
|
return new SelectBoxEditor(parentCssSelector, elementCssSelector, driver);
|
|
694
|
-
if (classSting.includes("switch-control"))
|
|
919
|
+
if (classSting.includes("switch-control" /* Switch */))
|
|
695
920
|
return new SwitchEditor(parentCssSelector, elementCssSelector, driver);
|
|
696
|
-
if (classSting.includes("date-control"))
|
|
921
|
+
if (classSting.includes("date-control" /* Date */) || classSting.includes("single-date-range-control" /* SingleDateRange */)) {
|
|
697
922
|
return new DateEditor(parentCssSelector, elementCssSelector, driver);
|
|
698
|
-
|
|
923
|
+
}
|
|
924
|
+
if (classSting.includes("buttons-group" /* BooleanSelector */))
|
|
699
925
|
return new BooleanSelector(parentCssSelector, elementCssSelector, driver);
|
|
700
|
-
if (classSting.includes("button-group-field"))
|
|
926
|
+
if (classSting.includes("button-group-field" /* ButtonGroup */))
|
|
701
927
|
return new ButtonGroup(parentCssSelector, elementCssSelector, driver);
|
|
702
928
|
throw new Error("Unknown type of editor. Please write ticket to the support");
|
|
703
929
|
};
|
|
@@ -825,8 +1051,8 @@ var FormGroup = class extends AbstractElementWithParent {
|
|
|
825
1051
|
|
|
826
1052
|
// src/pageObjects/elements/Forms/FormEdit.ts
|
|
827
1053
|
var FormEdit = class extends AbstractForm {
|
|
828
|
-
saveButtonBy =
|
|
829
|
-
closeButtonBy =
|
|
1054
|
+
saveButtonBy = By15.id("button-save");
|
|
1055
|
+
closeButtonBy = By15.id("button-cancel");
|
|
830
1056
|
constructor(driver) {
|
|
831
1057
|
super(driver);
|
|
832
1058
|
this.popupContainerCssSelector = `.popup .form-edit-${this.formName}`;
|
|
@@ -889,16 +1115,16 @@ var FormEdit = class extends AbstractForm {
|
|
|
889
1115
|
};
|
|
890
1116
|
|
|
891
1117
|
// src/pageObjects/elements/Table/Table.ts
|
|
892
|
-
import { By as
|
|
1118
|
+
import { By as By20 } from "selenium-webdriver";
|
|
893
1119
|
|
|
894
1120
|
// src/pageObjects/elements/Table/elements/Row.ts
|
|
895
|
-
import { By as
|
|
1121
|
+
import { By as By18 } from "selenium-webdriver";
|
|
896
1122
|
|
|
897
1123
|
// src/pageObjects/elements/Table/elements/Cell.ts
|
|
898
|
-
import { By as
|
|
1124
|
+
import { By as By17 } from "selenium-webdriver";
|
|
899
1125
|
|
|
900
1126
|
// src/pageObjects/elements/Table/utils.ts
|
|
901
|
-
import { By as
|
|
1127
|
+
import { By as By16 } from "selenium-webdriver";
|
|
902
1128
|
function getCssRowByIndexSelector(index) {
|
|
903
1129
|
return `tr[aria-rowindex="${transformInputIndex(index)}"]`;
|
|
904
1130
|
}
|
|
@@ -925,9 +1151,18 @@ var Cell = class extends AbstractElementWithParent {
|
|
|
925
1151
|
this.elementCssSelector = getCssCellByIndexSelector(index);
|
|
926
1152
|
}
|
|
927
1153
|
async getBooleanValue(cellEl) {
|
|
928
|
-
const booleanEl = await cellEl.findElement(
|
|
1154
|
+
const booleanEl = await cellEl.findElement(By17.className("boolean-widget"));
|
|
929
1155
|
return await booleanEl.getAttribute("aria-checked") === "true" ? 1 : 0;
|
|
930
1156
|
}
|
|
1157
|
+
async getTagsValue(cellEl) {
|
|
1158
|
+
const tagsCssSelector = ".multiselect-container .multiselect-cell";
|
|
1159
|
+
const tags = await cellEl.findElements(By17.css(tagsCssSelector));
|
|
1160
|
+
const values = [];
|
|
1161
|
+
for (const tag of tags) {
|
|
1162
|
+
values.push(await tag.getAttribute("textContent"));
|
|
1163
|
+
}
|
|
1164
|
+
return values;
|
|
1165
|
+
}
|
|
931
1166
|
async getElement() {
|
|
932
1167
|
if (this._index == null) {
|
|
933
1168
|
this.index = await this.getCellIndex();
|
|
@@ -937,9 +1172,10 @@ var Cell = class extends AbstractElementWithParent {
|
|
|
937
1172
|
async getValue() {
|
|
938
1173
|
const cellEl = await this.getElement();
|
|
939
1174
|
const cellElClass = await cellEl.getAttribute("class");
|
|
940
|
-
if (cellElClass.includes("boolean-column"))
|
|
1175
|
+
if (cellElClass.includes("boolean-column" /* Boolean */))
|
|
941
1176
|
return this.getBooleanValue(cellEl);
|
|
942
|
-
|
|
1177
|
+
if (cellElClass.includes("tags-column" /* Tags */))
|
|
1178
|
+
return this.getTagsValue(cellEl);
|
|
943
1179
|
return cellEl.getText();
|
|
944
1180
|
}
|
|
945
1181
|
getIndex() {
|
|
@@ -960,9 +1196,14 @@ var Row = class extends AbstractElementWithParent {
|
|
|
960
1196
|
this.getColumnBy = getColumnBy;
|
|
961
1197
|
}
|
|
962
1198
|
_getCell({ index, name, title }) {
|
|
963
|
-
return new Cell(
|
|
964
|
-
|
|
965
|
-
|
|
1199
|
+
return new Cell(
|
|
1200
|
+
this.getFullCssSelector(),
|
|
1201
|
+
() => {
|
|
1202
|
+
return this.getColumnBy({ title, name }).getIndex();
|
|
1203
|
+
},
|
|
1204
|
+
index,
|
|
1205
|
+
this.driver
|
|
1206
|
+
);
|
|
966
1207
|
}
|
|
967
1208
|
getCellByIndex(index) {
|
|
968
1209
|
return this._getCell({ index });
|
|
@@ -976,10 +1217,14 @@ var Row = class extends AbstractElementWithParent {
|
|
|
976
1217
|
async select() {
|
|
977
1218
|
const rowEl = await this.getElement();
|
|
978
1219
|
await click(rowEl, this.driver);
|
|
979
|
-
await wait(
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1220
|
+
await wait(
|
|
1221
|
+
async () => {
|
|
1222
|
+
const classes = await this.getClasses();
|
|
1223
|
+
return classes.includes(DX_SELECTION_CLASS);
|
|
1224
|
+
},
|
|
1225
|
+
this.driver,
|
|
1226
|
+
"Cannot select row"
|
|
1227
|
+
);
|
|
983
1228
|
}
|
|
984
1229
|
async isSelected() {
|
|
985
1230
|
const result = await this.getAttribute("aria-selected");
|
|
@@ -989,7 +1234,7 @@ var Row = class extends AbstractElementWithParent {
|
|
|
989
1234
|
return this.index;
|
|
990
1235
|
}
|
|
991
1236
|
async getCells() {
|
|
992
|
-
const cells = await this.driver.findElements(
|
|
1237
|
+
const cells = await this.driver.findElements(By18.css(`${this.getFullCssSelector()} td[role="gridcell"]`));
|
|
993
1238
|
const result = [];
|
|
994
1239
|
cells.forEach((_, index) => {
|
|
995
1240
|
const newCell = this.getCellByIndex(index);
|
|
@@ -999,14 +1244,22 @@ var Row = class extends AbstractElementWithParent {
|
|
|
999
1244
|
}
|
|
1000
1245
|
async clickInlineButton(buttonClass) {
|
|
1001
1246
|
const FIXED_TABLE_CSS_SELECTOR = ".dx-fixed-columns .dx-datagrid-content.dx-datagrid-content-fixed";
|
|
1002
|
-
const buttonCssSelector = `.${DX_DATA_ROW_CLASS}[aria-rowindex="${transformInputIndex(
|
|
1003
|
-
|
|
1247
|
+
const buttonCssSelector = `.${DX_DATA_ROW_CLASS}[aria-rowindex="${transformInputIndex(
|
|
1248
|
+
this.index
|
|
1249
|
+
)}"] .${buttonClass}`;
|
|
1250
|
+
const button = await this.driver.findElement(
|
|
1251
|
+
By18.css(`${this.parentCssSelector} ${FIXED_TABLE_CSS_SELECTOR} ${buttonCssSelector}`)
|
|
1252
|
+
);
|
|
1004
1253
|
return click(button, this.driver);
|
|
1005
1254
|
}
|
|
1006
1255
|
async checkEditingMode(isEditing, msg) {
|
|
1007
|
-
await wait(
|
|
1008
|
-
|
|
1009
|
-
|
|
1256
|
+
await wait(
|
|
1257
|
+
async () => {
|
|
1258
|
+
return (await this.getClasses()).includes(DX_ROW_EDIT_CLASS) === isEditing;
|
|
1259
|
+
},
|
|
1260
|
+
this.driver,
|
|
1261
|
+
msg
|
|
1262
|
+
);
|
|
1010
1263
|
}
|
|
1011
1264
|
async edit() {
|
|
1012
1265
|
await this.clickInlineButton("edit");
|
|
@@ -1023,19 +1276,18 @@ var Row = class extends AbstractElementWithParent {
|
|
|
1023
1276
|
};
|
|
1024
1277
|
|
|
1025
1278
|
// src/pageObjects/elements/Table/elements/Column.ts
|
|
1026
|
-
import { By as
|
|
1027
|
-
var getHeaderCssSelector = () => {
|
|
1028
|
-
return ".dx-datagrid-headers .dx-datagrid-content:not(.dx-datagrid-content-fixed)";
|
|
1029
|
-
};
|
|
1279
|
+
import { By as By19 } from "selenium-webdriver";
|
|
1030
1280
|
var Column = class extends AbstractElementWithParent {
|
|
1031
1281
|
_index;
|
|
1032
1282
|
_caption;
|
|
1033
1283
|
_name;
|
|
1034
|
-
|
|
1284
|
+
headerCssSelector;
|
|
1285
|
+
constructor({ parentCssSelector, headerCssSelector, name, caption, index, driver }) {
|
|
1035
1286
|
super(parentCssSelector, "", driver);
|
|
1036
1287
|
this._name = name;
|
|
1037
1288
|
this.index = index;
|
|
1038
1289
|
this._caption = caption;
|
|
1290
|
+
this.headerCssSelector = headerCssSelector;
|
|
1039
1291
|
}
|
|
1040
1292
|
set index(index) {
|
|
1041
1293
|
this._index = index;
|
|
@@ -1049,7 +1301,9 @@ var Column = class extends AbstractElementWithParent {
|
|
|
1049
1301
|
return super.getElement();
|
|
1050
1302
|
}
|
|
1051
1303
|
async getColumnHeaderIndexBy(cssSelector) {
|
|
1052
|
-
const column = await this.driver.findElement(
|
|
1304
|
+
const column = await this.driver.findElement(
|
|
1305
|
+
By19.css(`${this.parentCssSelector} ${this.headerCssSelector} ${cssSelector}`)
|
|
1306
|
+
);
|
|
1053
1307
|
return transformOutputIndex(await column.getAttribute("aria-colindex"));
|
|
1054
1308
|
}
|
|
1055
1309
|
async getIndexByCaption() {
|
|
@@ -1081,9 +1335,11 @@ var Column = class extends AbstractElementWithParent {
|
|
|
1081
1335
|
// src/pageObjects/elements/Table/Table.ts
|
|
1082
1336
|
var Table = class extends AbstractElementWithParent {
|
|
1083
1337
|
formName;
|
|
1084
|
-
|
|
1338
|
+
headerCssSelector;
|
|
1339
|
+
constructor(parentCssSelector, headerCssSelector, formName, driver) {
|
|
1085
1340
|
super(parentCssSelector, `#${createTableId(formName)}`, driver);
|
|
1086
1341
|
this.formName = formName;
|
|
1342
|
+
this.headerCssSelector = headerCssSelector;
|
|
1087
1343
|
}
|
|
1088
1344
|
getColumnBy = (args) => {
|
|
1089
1345
|
if (args.title) {
|
|
@@ -1104,6 +1360,7 @@ var Table = class extends AbstractElementWithParent {
|
|
|
1104
1360
|
getColumnByTitle = (title) => {
|
|
1105
1361
|
return new Column({
|
|
1106
1362
|
parentCssSelector: this.getFullCssSelector(),
|
|
1363
|
+
headerCssSelector: this.headerCssSelector,
|
|
1107
1364
|
caption: title,
|
|
1108
1365
|
driver: this.driver
|
|
1109
1366
|
});
|
|
@@ -1111,6 +1368,7 @@ var Table = class extends AbstractElementWithParent {
|
|
|
1111
1368
|
getColumnByName = (name) => {
|
|
1112
1369
|
return new Column({
|
|
1113
1370
|
parentCssSelector: this.getFullCssSelector(),
|
|
1371
|
+
headerCssSelector: this.headerCssSelector,
|
|
1114
1372
|
name,
|
|
1115
1373
|
driver: this.driver
|
|
1116
1374
|
});
|
|
@@ -1119,7 +1377,7 @@ var Table = class extends AbstractElementWithParent {
|
|
|
1119
1377
|
return this.getRowByIndex(index).select();
|
|
1120
1378
|
}
|
|
1121
1379
|
async getRows() {
|
|
1122
|
-
const rows = await this.driver.findElements(
|
|
1380
|
+
const rows = await this.driver.findElements(By20.css(`${this.getFullCssSelector()} .dx-row.dx-data-row`));
|
|
1123
1381
|
const result = [];
|
|
1124
1382
|
rows.forEach((_, index) => {
|
|
1125
1383
|
const newRow = new Row(this.getFullCssSelector(), index, this.driver, this.getColumnBy);
|
|
@@ -1128,7 +1386,9 @@ var Table = class extends AbstractElementWithParent {
|
|
|
1128
1386
|
return result;
|
|
1129
1387
|
}
|
|
1130
1388
|
async getColumns() {
|
|
1131
|
-
const columns = await this.driver.findElements(
|
|
1389
|
+
const columns = await this.driver.findElements(
|
|
1390
|
+
By20.css(`${this.getFullCssSelector()} ${this.headerCssSelector} td[role="columnheader"]`)
|
|
1391
|
+
);
|
|
1132
1392
|
const result = [];
|
|
1133
1393
|
columns.forEach((_, index) => {
|
|
1134
1394
|
const newCol = new Column({
|
|
@@ -1155,24 +1415,6 @@ var Table = class extends AbstractElementWithParent {
|
|
|
1155
1415
|
}
|
|
1156
1416
|
};
|
|
1157
1417
|
|
|
1158
|
-
// src/pageObjects/elements/TableToolbar/AbstractButton.ts
|
|
1159
|
-
var AbstractButton = class extends AbstractElementWithParent {
|
|
1160
|
-
constructor(parentCssSelector, elementCssSelector, driver) {
|
|
1161
|
-
super(parentCssSelector, elementCssSelector, driver);
|
|
1162
|
-
}
|
|
1163
|
-
async click() {
|
|
1164
|
-
const button = await this.getElement();
|
|
1165
|
-
await wait(async () => {
|
|
1166
|
-
return await button.isDisplayed() && !await this.isDisabled();
|
|
1167
|
-
}, this.driver, this.buttonNotDisplayedError());
|
|
1168
|
-
await click(button, this.driver);
|
|
1169
|
-
}
|
|
1170
|
-
async isDisabled() {
|
|
1171
|
-
const button = await this.getElement();
|
|
1172
|
-
return await button.getCssValue("pointer-events") === "none";
|
|
1173
|
-
}
|
|
1174
|
-
};
|
|
1175
|
-
|
|
1176
1418
|
// src/pageObjects/elements/TableToolbar/ToolbarGroupButton.ts
|
|
1177
1419
|
var ToolbarGroupButton = class extends AbstractButton {
|
|
1178
1420
|
name;
|
|
@@ -1199,7 +1441,7 @@ var ToolbarButton = class extends AbstractButton {
|
|
|
1199
1441
|
};
|
|
1200
1442
|
|
|
1201
1443
|
// src/pageObjects/elements/TableToolbar/ToolbarMenu.ts
|
|
1202
|
-
import { By as
|
|
1444
|
+
import { By as By21 } from "selenium-webdriver";
|
|
1203
1445
|
|
|
1204
1446
|
// src/utils/typesUtil.ts
|
|
1205
1447
|
var types = {
|
|
@@ -1233,7 +1475,7 @@ var ToolbarMenu = class extends AbstractElementWithParent {
|
|
|
1233
1475
|
}
|
|
1234
1476
|
async toggle() {
|
|
1235
1477
|
const dropdown = await this.getElement();
|
|
1236
|
-
await dropdown.
|
|
1478
|
+
await click(dropdown, this.driver);
|
|
1237
1479
|
}
|
|
1238
1480
|
getCssSelectorToButton(name) {
|
|
1239
1481
|
return byTestId(`ftb-${this._formName}-${name}`);
|
|
@@ -1243,9 +1485,11 @@ var ToolbarMenu = class extends AbstractElementWithParent {
|
|
|
1243
1485
|
}
|
|
1244
1486
|
async goToButton(name, selector) {
|
|
1245
1487
|
const toolbarMenuItem = this.driver.findElement(selector);
|
|
1246
|
-
await
|
|
1247
|
-
|
|
1248
|
-
|
|
1488
|
+
await waitElementIsClickable({
|
|
1489
|
+
element: toolbarMenuItem,
|
|
1490
|
+
errorMessage: this.buttonNotDisplayedError(name),
|
|
1491
|
+
driver: this.driver
|
|
1492
|
+
});
|
|
1249
1493
|
await click(toolbarMenuItem, this.driver);
|
|
1250
1494
|
}
|
|
1251
1495
|
async clickButton(name) {
|
|
@@ -1264,12 +1508,12 @@ var ToolbarMenu = class extends AbstractElementWithParent {
|
|
|
1264
1508
|
async clickButtonByTitle(title) {
|
|
1265
1509
|
await this.toggle();
|
|
1266
1510
|
if (isString(title)) {
|
|
1267
|
-
const selector =
|
|
1511
|
+
const selector = By21.xpath(buttonByTextXpath(title));
|
|
1268
1512
|
await this.goToButton(title, selector);
|
|
1269
1513
|
}
|
|
1270
1514
|
if (isArray(title)) {
|
|
1271
1515
|
for (let t of title) {
|
|
1272
|
-
const selector =
|
|
1516
|
+
const selector = By21.xpath(buttonByTextXpath(t));
|
|
1273
1517
|
await this.goToButton(t, selector);
|
|
1274
1518
|
}
|
|
1275
1519
|
}
|
|
@@ -1366,7 +1610,7 @@ var FormFilterField = class extends AbstractEditor {
|
|
|
1366
1610
|
};
|
|
1367
1611
|
|
|
1368
1612
|
// src/pageObjects/elements/Filters/FilterPanel.ts
|
|
1369
|
-
import { By as
|
|
1613
|
+
import { By as By22 } from "selenium-webdriver";
|
|
1370
1614
|
|
|
1371
1615
|
// src/pageObjects/elements/Filters/PanelFilterField.ts
|
|
1372
1616
|
var PanelFilterField = class extends AbstractEditor {
|
|
@@ -1421,7 +1665,7 @@ var FilterPanel = class extends AbstractElement {
|
|
|
1421
1665
|
async filterPanelButtons() {
|
|
1422
1666
|
const selector = `${this.elementCssSelector} ${FILTER_PANEL_SELECTOR} .filter-panel__buttons-panel .dx-button-text`;
|
|
1423
1667
|
const el = await this.getElement();
|
|
1424
|
-
return el.findElements(
|
|
1668
|
+
return el.findElements(By22.css(selector));
|
|
1425
1669
|
}
|
|
1426
1670
|
constructor(formName, driver) {
|
|
1427
1671
|
super(driver, drawerSelector(formName));
|
|
@@ -1454,16 +1698,19 @@ var FilterPanel = class extends AbstractElement {
|
|
|
1454
1698
|
await this.driver.sleep(300);
|
|
1455
1699
|
}
|
|
1456
1700
|
async close() {
|
|
1457
|
-
const btn = await this.driver.findElement(
|
|
1701
|
+
const btn = await this.driver.findElement(By22.css(`${this.elementCssSelector} ${CLOSE_SELECTOR}`));
|
|
1458
1702
|
await click(btn, this.driver);
|
|
1459
1703
|
}
|
|
1460
1704
|
};
|
|
1461
1705
|
|
|
1462
1706
|
// src/pageObjects/elements/Forms/ListForm.ts
|
|
1707
|
+
var DATAGRID_HEADER_CSS_SELECTOR = ".dx-datagrid-headers .dx-datagrid-content:not(.dx-datagrid-content-fixed)";
|
|
1463
1708
|
var ListForm = class extends AbstractForm {
|
|
1709
|
+
headerCssSelector;
|
|
1464
1710
|
constructor(driver) {
|
|
1465
1711
|
super(driver);
|
|
1466
1712
|
this.popupContainerCssSelector = `.popup .form-inline-${this.formName}`;
|
|
1713
|
+
this.headerCssSelector = DATAGRID_HEADER_CSS_SELECTOR;
|
|
1467
1714
|
}
|
|
1468
1715
|
/**
|
|
1469
1716
|
* Находит таблицу
|
|
@@ -1473,7 +1720,7 @@ var ListForm = class extends AbstractForm {
|
|
|
1473
1720
|
* expect(listForm.table());
|
|
1474
1721
|
*/
|
|
1475
1722
|
table() {
|
|
1476
|
-
return new Table(this.containerCssSelector, this.formName, this.driver);
|
|
1723
|
+
return new Table(this.containerCssSelector, this.headerCssSelector, this.formName, this.driver);
|
|
1477
1724
|
}
|
|
1478
1725
|
/**
|
|
1479
1726
|
* Находит группу на лист форме по имени
|
|
@@ -1519,8 +1766,18 @@ var ListForm = class extends AbstractForm {
|
|
|
1519
1766
|
}
|
|
1520
1767
|
};
|
|
1521
1768
|
|
|
1769
|
+
// src/pageObjects/elements/Forms/TreeView.ts
|
|
1770
|
+
var TREELIST_HEADER_CSS_SELECTOR = ".dx-treelist-headers .dx-treelist-content:not(.dx-datagrid-content-fixed)";
|
|
1771
|
+
var TreeView = class extends ListForm {
|
|
1772
|
+
constructor(driver) {
|
|
1773
|
+
super(driver);
|
|
1774
|
+
this.popupContainerCssSelector = `.popup .wrapper-tree-view-${this.formName}`;
|
|
1775
|
+
this.headerCssSelector = TREELIST_HEADER_CSS_SELECTOR;
|
|
1776
|
+
}
|
|
1777
|
+
};
|
|
1778
|
+
|
|
1522
1779
|
// src/pageObjects/elements/Dialog.ts
|
|
1523
|
-
import { By as
|
|
1780
|
+
import { By as By23 } from "selenium-webdriver";
|
|
1524
1781
|
var DIALOG_CLASS = ".d5-dialog";
|
|
1525
1782
|
var DIALOG_TITLE_CLASS = ".dialog__title";
|
|
1526
1783
|
var DIALOG_TEXT_CLASS = ".dialog__text";
|
|
@@ -1534,7 +1791,7 @@ var DialogButton = class extends AbstractButton {
|
|
|
1534
1791
|
}
|
|
1535
1792
|
async getElement() {
|
|
1536
1793
|
const panel = await super.getElement();
|
|
1537
|
-
return panel.findElement(
|
|
1794
|
+
return panel.findElement(By23.xpath(buttonByTextXpath2(this.text)));
|
|
1538
1795
|
}
|
|
1539
1796
|
buttonNotDisplayedError() {
|
|
1540
1797
|
return `Dialog button ${this.text} cannot be clicked. It is not displayed or it is disabled`;
|
|
@@ -1554,11 +1811,11 @@ var Dialog = class extends AbstractElement {
|
|
|
1554
1811
|
return this.joinRelativeCssSelectors([DIALOG_CLASS, DIALOG_BUTTONS_PANEL_CLASS]);
|
|
1555
1812
|
}
|
|
1556
1813
|
async title() {
|
|
1557
|
-
const el = await this.driver.findElement(
|
|
1814
|
+
const el = await this.driver.findElement(By23.css(this.titleSelector));
|
|
1558
1815
|
return await el.getText();
|
|
1559
1816
|
}
|
|
1560
1817
|
async text() {
|
|
1561
|
-
const el = await this.driver.findElement(
|
|
1818
|
+
const el = await this.driver.findElement(By23.css(this.textSelector));
|
|
1562
1819
|
return await el.getText();
|
|
1563
1820
|
}
|
|
1564
1821
|
button(text) {
|
|
@@ -1567,6 +1824,7 @@ var Dialog = class extends AbstractElement {
|
|
|
1567
1824
|
};
|
|
1568
1825
|
export {
|
|
1569
1826
|
AbstractPage,
|
|
1827
|
+
ControlClass,
|
|
1570
1828
|
Dialog,
|
|
1571
1829
|
FilterPanel,
|
|
1572
1830
|
FormEdit,
|
|
@@ -1578,6 +1836,7 @@ export {
|
|
|
1578
1836
|
PanelFilterField,
|
|
1579
1837
|
SubsystemsPanel,
|
|
1580
1838
|
TextEditor,
|
|
1839
|
+
TreeView,
|
|
1581
1840
|
byTestId,
|
|
1582
1841
|
byTestIdCssSelector,
|
|
1583
1842
|
click,
|