d5-testing-library 1.8.0-alpha.23 → 1.8.0-alpha.24
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/FormEdit-QNZOB7PA.mjs +7 -0
- package/dist/ListForm-MXGUBMWS.mjs +7 -0
- package/dist/TreeView-VZBOZCFW.mjs +8 -0
- package/dist/{chunk-VJLNAL57.mjs → chunk-32KSAOFJ.mjs} +66 -78
- package/dist/{chunk-MDGM7U6W.mjs → chunk-75FRHQCI.mjs} +1 -1
- package/dist/{chunk-SYZ2HQR7.mjs → chunk-S62QEWWA.mjs} +42 -44
- package/dist/{chunk-NXRKCIYK.mjs → chunk-XGIXXZD6.mjs} +3 -3
- package/dist/cjs/d5-testing-library.cjs +157 -140
- package/dist/{d5-testing-library.d.ts → d5-testing-library.d.mts} +54 -65
- package/dist/d5-testing-library.legacy-esm.js +68 -33
- package/dist/d5-testing-library.mjs +68 -33
- package/package.json +10 -10
- package/dist/FormEdit-ZDBS5OJX.mjs +0 -7
- package/dist/ListForm-6PRF2IKJ.mjs +0 -7
- package/dist/TreeView-YHZLUCNA.mjs +0 -8
|
@@ -34,29 +34,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
34
34
|
function config(cfg) {
|
|
35
35
|
return configInstance.config(cfg);
|
|
36
36
|
}
|
|
37
|
-
var
|
|
37
|
+
var Config, configInstance;
|
|
38
38
|
var init_config = __esm({
|
|
39
39
|
"src/config.ts"() {
|
|
40
40
|
"use strict";
|
|
41
|
-
process = __toESM(require("process"));
|
|
42
|
-
driversMap = /* @__PURE__ */ new Map();
|
|
43
|
-
createConfigProxy = (config2) => {
|
|
44
|
-
return new Proxy(config2, {
|
|
45
|
-
get(_target, prop) {
|
|
46
|
-
if (prop === "driver") {
|
|
47
|
-
return driversMap.get(process.pid);
|
|
48
|
-
}
|
|
49
|
-
return Reflect.get(...arguments);
|
|
50
|
-
},
|
|
51
|
-
set(_target, prop, value) {
|
|
52
|
-
if (prop === "driver") {
|
|
53
|
-
driversMap.set(process.pid, value);
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
return Reflect.set(...arguments);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
41
|
Config = class _Config {
|
|
61
42
|
static instance;
|
|
62
43
|
appConfig;
|
|
@@ -67,8 +48,7 @@ var init_config = __esm({
|
|
|
67
48
|
return _Config.instance;
|
|
68
49
|
}
|
|
69
50
|
config = (cfg) => {
|
|
70
|
-
if (!cfg)
|
|
71
|
-
return createConfigProxy(this.appConfig);
|
|
51
|
+
if (!cfg) return this.appConfig;
|
|
72
52
|
this.appConfig = cfg;
|
|
73
53
|
};
|
|
74
54
|
};
|
|
@@ -80,23 +60,38 @@ var init_config = __esm({
|
|
|
80
60
|
function fixElementStaleError(by, driver) {
|
|
81
61
|
const maxCount = 3;
|
|
82
62
|
let err;
|
|
83
|
-
const call = async (times
|
|
84
|
-
if (times > maxCount)
|
|
85
|
-
throw err;
|
|
63
|
+
const call = async (times) => {
|
|
64
|
+
if (times > maxCount) throw err;
|
|
86
65
|
try {
|
|
87
66
|
let el = await driver.findElement(by);
|
|
88
67
|
await el.getAttribute("class");
|
|
89
68
|
return el;
|
|
90
69
|
} catch (e) {
|
|
91
70
|
err = e;
|
|
92
|
-
if (e instanceof Error && e.
|
|
93
|
-
return call(
|
|
71
|
+
if (e instanceof Error && e.message.toLowerCase().includes("stale element")) {
|
|
72
|
+
return call(times + 1);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (err) throw err;
|
|
76
|
+
};
|
|
77
|
+
return call(0);
|
|
78
|
+
}
|
|
79
|
+
async function staleElementAction(action) {
|
|
80
|
+
const maxCount = 3;
|
|
81
|
+
let err;
|
|
82
|
+
const call = async (times) => {
|
|
83
|
+
if (times > maxCount) throw err;
|
|
84
|
+
try {
|
|
85
|
+
await action();
|
|
86
|
+
} catch (e) {
|
|
87
|
+
err = e;
|
|
88
|
+
if (e instanceof Error && e.message.toLowerCase().includes("stale element")) {
|
|
89
|
+
await call(times + 1);
|
|
94
90
|
}
|
|
95
91
|
}
|
|
96
|
-
if (err)
|
|
97
|
-
throw err;
|
|
92
|
+
if (err) throw err;
|
|
98
93
|
};
|
|
99
|
-
|
|
94
|
+
await call(0);
|
|
100
95
|
}
|
|
101
96
|
var init_fixElementStaleError = __esm({
|
|
102
97
|
"src/utils/fixElementStaleError.ts"() {
|
|
@@ -110,13 +105,12 @@ var init_AbstractElement = __esm({
|
|
|
110
105
|
"src/pageObjects/AbstractElement.ts"() {
|
|
111
106
|
"use strict";
|
|
112
107
|
import_selenium_webdriver = require("selenium-webdriver");
|
|
113
|
-
init_config();
|
|
114
108
|
init_fixElementStaleError();
|
|
115
109
|
AbstractElement = class {
|
|
116
110
|
driver;
|
|
117
111
|
elementCssSelector;
|
|
118
112
|
constructor(driver, elementCssSelector) {
|
|
119
|
-
this.driver = driver
|
|
113
|
+
this.driver = driver;
|
|
120
114
|
this.elementCssSelector = elementCssSelector;
|
|
121
115
|
}
|
|
122
116
|
getFullCssSelector() {
|
|
@@ -181,9 +175,17 @@ var init_AbstractPage = __esm({
|
|
|
181
175
|
|
|
182
176
|
// src/utils/wait.ts
|
|
183
177
|
async function wait(condition, driver, errorMessage, timeout) {
|
|
184
|
-
driver = driver ?? config().driver;
|
|
185
178
|
await driver.wait(condition, timeout ?? config().timeout, errorMessage);
|
|
186
179
|
}
|
|
180
|
+
function safeWait(condition, driver, errorMessage, timeout) {
|
|
181
|
+
return wait(async () => {
|
|
182
|
+
try {
|
|
183
|
+
return await condition(driver);
|
|
184
|
+
} catch {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
}, driver, errorMessage, timeout);
|
|
188
|
+
}
|
|
187
189
|
var init_wait = __esm({
|
|
188
190
|
"src/utils/wait.ts"() {
|
|
189
191
|
"use strict";
|
|
@@ -193,22 +195,24 @@ var init_wait = __esm({
|
|
|
193
195
|
|
|
194
196
|
// src/utils/waitElementIsVisible.ts
|
|
195
197
|
async function waitElementIsVisible({
|
|
196
|
-
element,
|
|
197
198
|
timeout,
|
|
198
199
|
errorMessage,
|
|
199
|
-
driver
|
|
200
|
+
driver,
|
|
201
|
+
...rest
|
|
200
202
|
}) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
await safeWait(async () => {
|
|
204
|
+
const searchedElement = "by" in rest ? await fixElementStaleError(rest.by, driver) : rest.element;
|
|
205
|
+
return await searchedElement.isDisplayed();
|
|
206
|
+
}, driver, errorMessage ?? "Element is not visible", timeout ?? config().timeout);
|
|
204
207
|
}
|
|
205
|
-
var
|
|
208
|
+
var waitElementIsVisible_default;
|
|
206
209
|
var init_waitElementIsVisible = __esm({
|
|
207
210
|
"src/utils/waitElementIsVisible.ts"() {
|
|
208
211
|
"use strict";
|
|
209
|
-
import_selenium_webdriver2 = require("selenium-webdriver");
|
|
210
212
|
init_config();
|
|
211
213
|
init_wait();
|
|
214
|
+
init_fixElementStaleError();
|
|
215
|
+
waitElementIsVisible_default = waitElementIsVisible;
|
|
212
216
|
}
|
|
213
217
|
});
|
|
214
218
|
|
|
@@ -217,9 +221,7 @@ var click, contextMenu;
|
|
|
217
221
|
var init_actions = __esm({
|
|
218
222
|
"src/utils/actions.ts"() {
|
|
219
223
|
"use strict";
|
|
220
|
-
init_config();
|
|
221
224
|
click = async (webElement, driver) => {
|
|
222
|
-
driver = driver ?? config().driver;
|
|
223
225
|
if (!await webElement.isDisplayed()) {
|
|
224
226
|
await driver.executeScript("arguments[0].scrollIntoView(true);", webElement);
|
|
225
227
|
}
|
|
@@ -227,7 +229,6 @@ var init_actions = __esm({
|
|
|
227
229
|
await actions.move({ origin: webElement }).click().perform();
|
|
228
230
|
};
|
|
229
231
|
contextMenu = async (webElement, driver) => {
|
|
230
|
-
driver = driver ?? config().driver;
|
|
231
232
|
if (!await webElement.isDisplayed()) {
|
|
232
233
|
await driver.executeScript("arguments[0].scrollIntoView(true);", webElement);
|
|
233
234
|
}
|
|
@@ -238,16 +239,16 @@ var init_actions = __esm({
|
|
|
238
239
|
});
|
|
239
240
|
|
|
240
241
|
// src/utils/locators.ts
|
|
241
|
-
var
|
|
242
|
+
var import_selenium_webdriver2, byTestIdCssSelector, byTestId, readonlyLocator;
|
|
242
243
|
var init_locators = __esm({
|
|
243
244
|
"src/utils/locators.ts"() {
|
|
244
245
|
"use strict";
|
|
245
|
-
|
|
246
|
+
import_selenium_webdriver2 = require("selenium-webdriver");
|
|
246
247
|
byTestIdCssSelector = (testId, element = "div") => {
|
|
247
248
|
return `${element}[data-testid="${testId}"]`;
|
|
248
249
|
};
|
|
249
250
|
byTestId = (testId, element = "div") => {
|
|
250
|
-
return
|
|
251
|
+
return import_selenium_webdriver2.By.css(byTestIdCssSelector(testId, element));
|
|
251
252
|
};
|
|
252
253
|
readonlyLocator = "readonly";
|
|
253
254
|
}
|
|
@@ -260,8 +261,7 @@ async function waitElementIsClickable({
|
|
|
260
261
|
driver,
|
|
261
262
|
...rest
|
|
262
263
|
}) {
|
|
263
|
-
|
|
264
|
-
await wait(async () => {
|
|
264
|
+
await safeWait(async () => {
|
|
265
265
|
const searchedElement = "by" in rest ? await fixElementStaleError(rest.by, driver) : rest.element;
|
|
266
266
|
const isDisabled = await searchedElement.getCssValue("pointer-events") === "none";
|
|
267
267
|
return await searchedElement.isDisplayed() && !isDisabled;
|
|
@@ -451,10 +451,8 @@ var init_CheckBox = __esm({
|
|
|
451
451
|
CheckBox = class extends AbstractElementWithParent {
|
|
452
452
|
async getValue() {
|
|
453
453
|
const result = await this.getAttribute("aria-checked");
|
|
454
|
-
if (result === "true")
|
|
455
|
-
|
|
456
|
-
if (result === "false")
|
|
457
|
-
return 0;
|
|
454
|
+
if (result === "true") return 1;
|
|
455
|
+
if (result === "false") return 0;
|
|
458
456
|
return null;
|
|
459
457
|
}
|
|
460
458
|
async setValue(value) {
|
|
@@ -580,10 +578,8 @@ var init_SwitchEditor = __esm({
|
|
|
580
578
|
SwitchEditor = class extends AbstractElementWithParent {
|
|
581
579
|
async getValue() {
|
|
582
580
|
const result = await this.getAttribute("aria-label");
|
|
583
|
-
if (result === "ON")
|
|
584
|
-
|
|
585
|
-
if (result === "OFF")
|
|
586
|
-
return 0;
|
|
581
|
+
if (result === "ON") return 1;
|
|
582
|
+
if (result === "OFF") return 0;
|
|
587
583
|
return null;
|
|
588
584
|
}
|
|
589
585
|
async setValue(value) {
|
|
@@ -596,7 +592,7 @@ var init_SwitchEditor = __esm({
|
|
|
596
592
|
return;
|
|
597
593
|
}
|
|
598
594
|
await click(inputEl, this.driver);
|
|
599
|
-
await
|
|
595
|
+
await safeWait(async () => {
|
|
600
596
|
const updatedValue = await this.getValue();
|
|
601
597
|
return updatedValue !== currentValue;
|
|
602
598
|
}, this.driver);
|
|
@@ -639,7 +635,7 @@ var init_TagBox = __esm({
|
|
|
639
635
|
}
|
|
640
636
|
async waitOptionSelection() {
|
|
641
637
|
const option = await fixElementStaleError(import_selenium_webdriver10.By.css(TAG_BOX_LIST_ITEM_SELECTOR), this.driver);
|
|
642
|
-
await
|
|
638
|
+
await safeWait(() => option.isDisplayed(), this.driver);
|
|
643
639
|
}
|
|
644
640
|
async selectOption(inputEl, value, lastElement) {
|
|
645
641
|
try {
|
|
@@ -731,8 +727,7 @@ var init_ButtonGroup = __esm({
|
|
|
731
727
|
break;
|
|
732
728
|
}
|
|
733
729
|
}
|
|
734
|
-
if (!buttonEl)
|
|
735
|
-
throw new Error(`Cannot find item in button group with text: ${value}`);
|
|
730
|
+
if (!buttonEl) throw new Error(`Cannot find item in button group with text: ${value}`);
|
|
736
731
|
await click(buttonEl, this.driver);
|
|
737
732
|
}
|
|
738
733
|
};
|
|
@@ -1069,16 +1064,12 @@ var init_editorFactory = __esm({
|
|
|
1069
1064
|
const classSting = await elementInstance.getClasses();
|
|
1070
1065
|
if ((classSting.includes("text-control" /* Text */) || classSting.includes("text-area-control" /* TextArea */)) && !classSting.includes("single-date-range-control" /* SingleDateRange */))
|
|
1071
1066
|
return new TextEditor(parentCssSelector, elementCssSelector, driver);
|
|
1072
|
-
if (classSting.includes("number-control" /* Number */))
|
|
1073
|
-
|
|
1074
|
-
if (classSting.includes("
|
|
1075
|
-
return new CheckBox(parentCssSelector, elementCssSelector, driver);
|
|
1076
|
-
if (classSting.includes("multi-select-control" /* Multiselect */))
|
|
1077
|
-
return new TagBox(parentCssSelector, elementCssSelector, driver);
|
|
1067
|
+
if (classSting.includes("number-control" /* Number */)) return new NumberEditor(parentCssSelector, elementCssSelector, driver);
|
|
1068
|
+
if (classSting.includes("check-box" /* CheckBox */)) return new CheckBox(parentCssSelector, elementCssSelector, driver);
|
|
1069
|
+
if (classSting.includes("multi-select-control" /* Multiselect */)) return new TagBox(parentCssSelector, elementCssSelector, driver);
|
|
1078
1070
|
if (classSting.includes("select-control" /* Select */))
|
|
1079
1071
|
return new SelectBoxEditor(parentCssSelector, elementCssSelector, driver);
|
|
1080
|
-
if (classSting.includes("switch-control" /* Switch */))
|
|
1081
|
-
return new SwitchEditor(parentCssSelector, elementCssSelector, driver);
|
|
1072
|
+
if (classSting.includes("switch-control" /* Switch */)) return new SwitchEditor(parentCssSelector, elementCssSelector, driver);
|
|
1082
1073
|
if (classSting.includes("date-control" /* Date */) || classSting.includes("single-date-range-control" /* SingleDateRange */)) {
|
|
1083
1074
|
return new DateEditor(parentCssSelector, elementCssSelector, driver);
|
|
1084
1075
|
}
|
|
@@ -1365,16 +1356,11 @@ var init_groupFactory = __esm({
|
|
|
1365
1356
|
groupFactory = async (parentCssSelector, elementCssSelector, driver) => {
|
|
1366
1357
|
const elementInstance = new AbstractFormElement(parentCssSelector, elementCssSelector, driver);
|
|
1367
1358
|
const classSting = await elementInstance.getClasses();
|
|
1368
|
-
if (classSting.includes("tab-panel-group"))
|
|
1369
|
-
|
|
1370
|
-
if (classSting.includes("
|
|
1371
|
-
|
|
1372
|
-
if (classSting.includes("
|
|
1373
|
-
return new Panel(parentCssSelector, elementCssSelector, driver);
|
|
1374
|
-
if (classSting.includes("accordion-group"))
|
|
1375
|
-
return new Accordion(parentCssSelector, elementCssSelector, driver);
|
|
1376
|
-
if (classSting.includes("d5-accordion-item"))
|
|
1377
|
-
return new AccordionItem(parentCssSelector, elementCssSelector, driver);
|
|
1359
|
+
if (classSting.includes("tab-panel-group")) return new TabPanel(parentCssSelector, elementCssSelector, driver);
|
|
1360
|
+
if (classSting.includes("tab-panel-item")) return new TabPanelItem(parentCssSelector, elementCssSelector, driver);
|
|
1361
|
+
if (classSting.includes("panel-group")) return new Panel(parentCssSelector, elementCssSelector, driver);
|
|
1362
|
+
if (classSting.includes("accordion-group")) return new Accordion(parentCssSelector, elementCssSelector, driver);
|
|
1363
|
+
if (classSting.includes("d5-accordion-item")) return new AccordionItem(parentCssSelector, elementCssSelector, driver);
|
|
1378
1364
|
throw new Error("Unknown type of group. Please write ticket to the support");
|
|
1379
1365
|
};
|
|
1380
1366
|
}
|
|
@@ -1573,7 +1559,7 @@ var init_Cell = __esm({
|
|
|
1573
1559
|
Cell = class extends AbstractElementWithParent {
|
|
1574
1560
|
_index;
|
|
1575
1561
|
getCellIndex;
|
|
1576
|
-
constructor(parentCssSelector, getCellIndex,
|
|
1562
|
+
constructor(parentCssSelector, getCellIndex, driver, index) {
|
|
1577
1563
|
super(parentCssSelector, getCssCellByIndexSelector(index), driver);
|
|
1578
1564
|
this.getCellIndex = getCellIndex;
|
|
1579
1565
|
this._index = index;
|
|
@@ -1601,8 +1587,7 @@ var init_Cell = __esm({
|
|
|
1601
1587
|
}
|
|
1602
1588
|
async getDateValue(cellEl, cellElClass) {
|
|
1603
1589
|
const value = (await cellEl.getText()).trim();
|
|
1604
|
-
if (value === "")
|
|
1605
|
-
return null;
|
|
1590
|
+
if (value === "") return null;
|
|
1606
1591
|
const isWithTime = cellElClass.includes("with-time");
|
|
1607
1592
|
try {
|
|
1608
1593
|
if (isWithTime) {
|
|
@@ -1628,14 +1613,10 @@ var init_Cell = __esm({
|
|
|
1628
1613
|
async getValue() {
|
|
1629
1614
|
const cellEl = await this.getElement();
|
|
1630
1615
|
const cellElClass = await cellEl.getAttribute("class");
|
|
1631
|
-
if (cellElClass.includes("boolean-column" /* Boolean */))
|
|
1632
|
-
|
|
1633
|
-
if (cellElClass.includes("
|
|
1634
|
-
|
|
1635
|
-
if (cellElClass.includes("number-column" /* Number */))
|
|
1636
|
-
return this.getNumberValue(cellEl);
|
|
1637
|
-
if (cellElClass.includes("date-column" /* Date */))
|
|
1638
|
-
return this.getDateValue(cellEl, cellElClass);
|
|
1616
|
+
if (cellElClass.includes("boolean-column" /* Boolean */)) return this.getBooleanValue(cellEl);
|
|
1617
|
+
if (cellElClass.includes("tags-column" /* Tags */)) return this.getTagsValue(cellEl);
|
|
1618
|
+
if (cellElClass.includes("number-column" /* Number */)) return this.getNumberValue(cellEl);
|
|
1619
|
+
if (cellElClass.includes("date-column" /* Date */)) return this.getDateValue(cellEl, cellElClass);
|
|
1639
1620
|
const cellText = await cellEl.getText();
|
|
1640
1621
|
return cellText == "" ? null : cellText;
|
|
1641
1622
|
}
|
|
@@ -1684,8 +1665,8 @@ var init_Row = __esm({
|
|
|
1684
1665
|
() => {
|
|
1685
1666
|
return this.getColumnBy({ title, name }).getIndex();
|
|
1686
1667
|
},
|
|
1687
|
-
|
|
1688
|
-
|
|
1668
|
+
this.driver,
|
|
1669
|
+
index
|
|
1689
1670
|
);
|
|
1690
1671
|
}
|
|
1691
1672
|
getCellByIndex(index) {
|
|
@@ -1698,9 +1679,11 @@ var init_Row = __esm({
|
|
|
1698
1679
|
return this._getCell({ title });
|
|
1699
1680
|
}
|
|
1700
1681
|
async select() {
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1682
|
+
await staleElementAction(async () => {
|
|
1683
|
+
const rowEl = await this.getElement();
|
|
1684
|
+
await click(rowEl, this.driver);
|
|
1685
|
+
});
|
|
1686
|
+
await safeWait(
|
|
1704
1687
|
async () => {
|
|
1705
1688
|
const classes = await this.getClasses();
|
|
1706
1689
|
return classes.includes(DX_SELECTION_CLASS);
|
|
@@ -1729,14 +1712,14 @@ var init_Row = __esm({
|
|
|
1729
1712
|
const buttonCssSelector = `.${DX_DATA_ROW_CLASS}[aria-rowindex="${transformInputIndex(
|
|
1730
1713
|
this.index
|
|
1731
1714
|
)}"] .${buttonClass}`;
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1734
|
-
this.driver
|
|
1735
|
-
|
|
1736
|
-
|
|
1715
|
+
const by = import_selenium_webdriver22.By.css(`${this.parentCssSelector} ${this.fixedTableContentCssSelector} ${buttonCssSelector}`);
|
|
1716
|
+
await staleElementAction(async () => {
|
|
1717
|
+
const button = await fixElementStaleError(by, this.driver);
|
|
1718
|
+
await click(button, this.driver);
|
|
1719
|
+
});
|
|
1737
1720
|
}
|
|
1738
1721
|
async checkEditingMode(isEditing, msg) {
|
|
1739
|
-
await
|
|
1722
|
+
await safeWait(
|
|
1740
1723
|
async () => {
|
|
1741
1724
|
return (await this.getClasses()).includes(DX_ROW_EDIT_CLASS) === isEditing;
|
|
1742
1725
|
},
|
|
@@ -2102,7 +2085,7 @@ var init_DXContextMenuList = __esm({
|
|
|
2102
2085
|
}
|
|
2103
2086
|
async isVisible() {
|
|
2104
2087
|
try {
|
|
2105
|
-
await
|
|
2088
|
+
await waitElementIsVisible_default({
|
|
2106
2089
|
element: await this.driver.findElement(import_selenium_webdriver24.By.css(`.dx-overlay-wrapper .dx-contextmenu`)),
|
|
2107
2090
|
driver: this.driver,
|
|
2108
2091
|
errorMessage: "Cannot find dropdown element"
|
|
@@ -2560,8 +2543,7 @@ var init_ToolbarItem = __esm({
|
|
|
2560
2543
|
this._formName = formName;
|
|
2561
2544
|
}
|
|
2562
2545
|
async init() {
|
|
2563
|
-
if (this._button)
|
|
2564
|
-
return this._button;
|
|
2546
|
+
if (this._button) return this._button;
|
|
2565
2547
|
const classNames = await this.getClasses();
|
|
2566
2548
|
if (classNames.includes(GROUP_BUTTON_CLASS)) {
|
|
2567
2549
|
this._button = new ToolbarGroupButton(this.getFullCssSelector(), this._itemName, this.driver);
|
|
@@ -2666,7 +2648,7 @@ var init_FilterOperation = __esm({
|
|
|
2666
2648
|
await click(clickableElement, this.driver);
|
|
2667
2649
|
try {
|
|
2668
2650
|
const widgetPopupEl = await this.driver.findElement(import_selenium_webdriver28.By.css(`${byTestIdCssSelector(`${OPERATIONS_WIDGET_POPUP}-${this._testId}`)}`));
|
|
2669
|
-
await
|
|
2651
|
+
await waitElementIsVisible_default({
|
|
2670
2652
|
element: widgetPopupEl,
|
|
2671
2653
|
errorMessage: `Operation widget popup is not visible`,
|
|
2672
2654
|
driver: this.driver
|
|
@@ -2682,11 +2664,10 @@ var init_FilterOperation = __esm({
|
|
|
2682
2664
|
await this.initOperationWidget();
|
|
2683
2665
|
const operationEl = await fixElementStaleError(import_selenium_webdriver28.By.css(`${byTestIdCssSelector(`${OPERATIONS_WIDGET_POPUP}-${this._testId}`)} ${getWidgetInPopupSelector(operationName)}`), this.driver);
|
|
2684
2666
|
await click(operationEl, this.driver);
|
|
2685
|
-
await
|
|
2667
|
+
await safeWait(
|
|
2686
2668
|
async () => {
|
|
2687
2669
|
const currOperationName = await this.getAttribute("data-operation");
|
|
2688
|
-
if (operationName === "isblank")
|
|
2689
|
-
return true;
|
|
2670
|
+
if (operationName === "isblank") return true;
|
|
2690
2671
|
return currOperationName === operationName;
|
|
2691
2672
|
},
|
|
2692
2673
|
this.driver,
|
|
@@ -2695,15 +2676,14 @@ var init_FilterOperation = __esm({
|
|
|
2695
2676
|
}
|
|
2696
2677
|
async getOperation() {
|
|
2697
2678
|
const result = await this.getAttribute("data-operation");
|
|
2698
|
-
if (!result)
|
|
2699
|
-
throw new Error("Operation not found");
|
|
2679
|
+
if (!result) throw new Error("Operation not found");
|
|
2700
2680
|
return result;
|
|
2701
2681
|
}
|
|
2702
2682
|
async setIsBlank(value) {
|
|
2703
2683
|
const currValue = await this.getIsBlank();
|
|
2704
2684
|
if (currValue !== value) {
|
|
2705
2685
|
await this.setOperation("isblank");
|
|
2706
|
-
await
|
|
2686
|
+
await safeWait(
|
|
2707
2687
|
async () => {
|
|
2708
2688
|
const currIsBlank = await this.getIsBlank();
|
|
2709
2689
|
return currIsBlank === value;
|
|
@@ -2785,7 +2765,8 @@ var init_FormFilterField = __esm({
|
|
|
2785
2765
|
async initOperation() {
|
|
2786
2766
|
return new FilterOperation({
|
|
2787
2767
|
parentCssSelector: this.parentCssSelector,
|
|
2788
|
-
filterTestID: createLayoutFilterTestId(this.formName, this.name)
|
|
2768
|
+
filterTestID: createLayoutFilterTestId(this.formName, this.name),
|
|
2769
|
+
driver: this.driver
|
|
2789
2770
|
});
|
|
2790
2771
|
}
|
|
2791
2772
|
/**
|
|
@@ -2892,7 +2873,8 @@ var init_PanelFilterField = __esm({
|
|
|
2892
2873
|
async initOperation() {
|
|
2893
2874
|
return new FilterOperation({
|
|
2894
2875
|
parentCssSelector: this.parentCssSelector,
|
|
2895
|
-
filterTestID: createDocFilterTestId(this.formName, this.name)
|
|
2876
|
+
filterTestID: createDocFilterTestId(this.formName, this.name),
|
|
2877
|
+
driver: this.driver
|
|
2896
2878
|
});
|
|
2897
2879
|
}
|
|
2898
2880
|
/**
|
|
@@ -3074,7 +3056,7 @@ var init_ColumnFilter = __esm({
|
|
|
3074
3056
|
await actions.move({ origin: columnEl }).perform();
|
|
3075
3057
|
const elements = await columnEl.findElements(import_selenium_webdriver30.By.css(HEADER_FILTER_ICON));
|
|
3076
3058
|
let headerFilterIcon = null;
|
|
3077
|
-
await
|
|
3059
|
+
await safeWait(
|
|
3078
3060
|
async () => {
|
|
3079
3061
|
let result = false;
|
|
3080
3062
|
for (let element of elements) {
|
|
@@ -3089,12 +3071,11 @@ var init_ColumnFilter = __esm({
|
|
|
3089
3071
|
this.driver,
|
|
3090
3072
|
`HeaderFilter "${this._name}" is not visible`
|
|
3091
3073
|
);
|
|
3092
|
-
if (!headerFilterIcon)
|
|
3093
|
-
|
|
3094
|
-
await headerFilterIcon.click();
|
|
3074
|
+
if (!headerFilterIcon) throw new Error(`HeaderFilter "${this._name}" is not visible`);
|
|
3075
|
+
await click(headerFilterIcon, this.driver);
|
|
3095
3076
|
const filter = new HeaderFilterField("", this._formName, this._name, this.driver);
|
|
3096
3077
|
const filterEl = await filter.getElement();
|
|
3097
|
-
await
|
|
3078
|
+
await waitElementIsVisible_default({
|
|
3098
3079
|
element: filterEl,
|
|
3099
3080
|
driver: this.driver,
|
|
3100
3081
|
errorMessage: `Header filter is not visible`
|
|
@@ -3124,7 +3105,8 @@ var init_ColumnFilter = __esm({
|
|
|
3124
3105
|
const filter = await this.initFilter();
|
|
3125
3106
|
const filterOperation = new FilterOperation({
|
|
3126
3107
|
parentCssSelector: HEADER_FILTER_CONTAINER,
|
|
3127
|
-
filterTestID: createHeaderFilterTestId(this._formName, this._name)
|
|
3108
|
+
filterTestID: createHeaderFilterTestId(this._formName, this._name),
|
|
3109
|
+
driver: this.driver
|
|
3128
3110
|
});
|
|
3129
3111
|
const inputEl = await filter.getElement();
|
|
3130
3112
|
if (typeof operation === "string") {
|
|
@@ -3167,7 +3149,8 @@ var init_ColumnFilter = __esm({
|
|
|
3167
3149
|
await inputEl.click();
|
|
3168
3150
|
return new FilterOperation({
|
|
3169
3151
|
parentCssSelector: HEADER_FILTER_CONTAINER,
|
|
3170
|
-
filterTestID: createHeaderFilterTestId(this._formName, this._name)
|
|
3152
|
+
filterTestID: createHeaderFilterTestId(this._formName, this._name),
|
|
3153
|
+
driver: this.driver
|
|
3171
3154
|
});
|
|
3172
3155
|
}
|
|
3173
3156
|
/**
|
|
@@ -3400,7 +3383,7 @@ var init_Form = __esm({
|
|
|
3400
3383
|
async getTitleText() {
|
|
3401
3384
|
if (await this.isModal()) {
|
|
3402
3385
|
const titleEl2 = await this.driver.findElement(import_selenium_webdriver31.By.css(`${this.popupContainerCssSelector} .popup-title`));
|
|
3403
|
-
await
|
|
3386
|
+
await waitElementIsVisible_default({
|
|
3404
3387
|
element: titleEl2,
|
|
3405
3388
|
driver: this.driver,
|
|
3406
3389
|
errorMessage: `Form title element is not visible`
|
|
@@ -3428,7 +3411,7 @@ var init_Form = __esm({
|
|
|
3428
3411
|
const cssSelector = subformCssSelector(this.containerCssSelector, subFormTestId(name), isDockPanel);
|
|
3429
3412
|
const byCssSelector = import_selenium_webdriver31.By.css(cssSelector);
|
|
3430
3413
|
const subFormEl = await this.driver.findElement(byCssSelector);
|
|
3431
|
-
await
|
|
3414
|
+
await waitElementIsVisible_default({
|
|
3432
3415
|
element: subFormEl,
|
|
3433
3416
|
driver: this.driver,
|
|
3434
3417
|
errorMessage: `Subform "${name}" is not visible`
|
|
@@ -3511,7 +3494,7 @@ var init_FormEdit = __esm({
|
|
|
3511
3494
|
async saveButtonClick() {
|
|
3512
3495
|
const saveButtonCssSelector = await this.getButtonCssSelector(this.saveButtonId);
|
|
3513
3496
|
const saveButton = await this.driver.findElement(import_selenium_webdriver32.By.css(saveButtonCssSelector));
|
|
3514
|
-
await
|
|
3497
|
+
await safeWait(async () => !await this.isSaveButtonDisabled(), this.driver, "Button is disabled");
|
|
3515
3498
|
await click(saveButton, this.driver);
|
|
3516
3499
|
}
|
|
3517
3500
|
/**
|
|
@@ -3558,9 +3541,9 @@ __export(src_exports, {
|
|
|
3558
3541
|
elementIsNotPresent: () => elementIsNotPresent,
|
|
3559
3542
|
readonlyLocator: () => readonlyLocator,
|
|
3560
3543
|
signIn: () => signIn,
|
|
3561
|
-
wait: () =>
|
|
3544
|
+
wait: () => safeWait,
|
|
3562
3545
|
waitElementIsClickable: () => waitElementIsClickable_default,
|
|
3563
|
-
waitElementIsVisible: () =>
|
|
3546
|
+
waitElementIsVisible: () => waitElementIsVisible_default
|
|
3564
3547
|
});
|
|
3565
3548
|
module.exports = __toCommonJS(src_exports);
|
|
3566
3549
|
init_config();
|
|
@@ -3571,6 +3554,7 @@ init_config();
|
|
|
3571
3554
|
init_waitElementIsVisible();
|
|
3572
3555
|
init_actions();
|
|
3573
3556
|
init_locators();
|
|
3557
|
+
var import_selenium_webdriver3 = require("selenium-webdriver");
|
|
3574
3558
|
var LOGIN_PATH = "/login";
|
|
3575
3559
|
var LoginPage = class extends AbstractPage {
|
|
3576
3560
|
usernameField = byTestId("loginField", "input");
|
|
@@ -3579,7 +3563,7 @@ var LoginPage = class extends AbstractPage {
|
|
|
3579
3563
|
async locate() {
|
|
3580
3564
|
await super.locate();
|
|
3581
3565
|
const login = await this.driver.findElement(this.usernameField);
|
|
3582
|
-
await
|
|
3566
|
+
await waitElementIsVisible_default({
|
|
3583
3567
|
element: login,
|
|
3584
3568
|
driver: this.driver
|
|
3585
3569
|
});
|
|
@@ -3595,6 +3579,11 @@ var LoginPage = class extends AbstractPage {
|
|
|
3595
3579
|
}
|
|
3596
3580
|
async clickLoginButton() {
|
|
3597
3581
|
await click(await this.driver.findElement(this.loginButton), this.driver);
|
|
3582
|
+
await waitElementIsVisible_default({
|
|
3583
|
+
driver: this.driver,
|
|
3584
|
+
by: import_selenium_webdriver3.By.id("section"),
|
|
3585
|
+
errorMessage: "Sing in not successful"
|
|
3586
|
+
});
|
|
3598
3587
|
}
|
|
3599
3588
|
async loginWith(username, password) {
|
|
3600
3589
|
await this.enterUsername(username);
|
|
@@ -3612,8 +3601,38 @@ init_locators();
|
|
|
3612
3601
|
// src/utils/createDriver.ts
|
|
3613
3602
|
var import_selenium_webdriver4 = require("selenium-webdriver");
|
|
3614
3603
|
init_config();
|
|
3604
|
+
var import_chrome = __toESM(require("selenium-webdriver/chrome"));
|
|
3605
|
+
var import_firefox = __toESM(require("selenium-webdriver/firefox"));
|
|
3606
|
+
function chromeOptions(builder, options) {
|
|
3607
|
+
const ChromeOptions = new import_chrome.default.Options();
|
|
3608
|
+
if (options.headless) {
|
|
3609
|
+
ChromeOptions.addArguments(`--headless=new`);
|
|
3610
|
+
}
|
|
3611
|
+
return builder.setChromeOptions(ChromeOptions);
|
|
3612
|
+
}
|
|
3613
|
+
function firefoxOptions(builder, options) {
|
|
3614
|
+
const FirefoxOptions = new import_firefox.default.Options();
|
|
3615
|
+
if (options.headless) {
|
|
3616
|
+
FirefoxOptions.addArguments(`--headless`);
|
|
3617
|
+
}
|
|
3618
|
+
return builder.setFirefoxOptions(FirefoxOptions);
|
|
3619
|
+
}
|
|
3620
|
+
function setOptions(builder, browser, options) {
|
|
3621
|
+
switch (browser) {
|
|
3622
|
+
case "chrome":
|
|
3623
|
+
return chromeOptions(builder, options);
|
|
3624
|
+
case "firefox":
|
|
3625
|
+
return firefoxOptions(builder, options);
|
|
3626
|
+
default:
|
|
3627
|
+
return builder;
|
|
3628
|
+
}
|
|
3629
|
+
}
|
|
3615
3630
|
var createDriver = async (browser) => {
|
|
3616
|
-
const
|
|
3631
|
+
const _browser = browser ?? config().browser;
|
|
3632
|
+
const headless = config().headless === "true";
|
|
3633
|
+
let builder = new import_selenium_webdriver4.Builder().forBrowser(_browser);
|
|
3634
|
+
builder = setOptions(builder, _browser, { headless });
|
|
3635
|
+
const driver = await builder.build();
|
|
3617
3636
|
const manage = driver.manage();
|
|
3618
3637
|
await manage.setTimeouts({ implicit: config().timeout });
|
|
3619
3638
|
await manage.window().maximize();
|
|
@@ -3635,10 +3654,8 @@ init_waitElementIsClickable();
|
|
|
3635
3654
|
init_wait();
|
|
3636
3655
|
|
|
3637
3656
|
// src/utils/signIn.ts
|
|
3638
|
-
init_config();
|
|
3639
3657
|
async function signIn(driver) {
|
|
3640
3658
|
const webDriver = driver ?? await createDriver();
|
|
3641
|
-
config().driver = webDriver;
|
|
3642
3659
|
const loginPage = new LoginPage(webDriver);
|
|
3643
3660
|
await loginPage.locate();
|
|
3644
3661
|
await loginPage.authorize();
|
|
@@ -3683,23 +3700,23 @@ var SubsystemItem = class {
|
|
|
3683
3700
|
return fixElementStaleError(this.bySelector, this.driver);
|
|
3684
3701
|
}
|
|
3685
3702
|
async getTitle() {
|
|
3686
|
-
|
|
3687
|
-
await waitElementIsVisible(
|
|
3703
|
+
await waitElementIsVisible_default(
|
|
3688
3704
|
{
|
|
3689
|
-
|
|
3705
|
+
by: this.bySelector,
|
|
3690
3706
|
driver: this.driver
|
|
3691
3707
|
}
|
|
3692
3708
|
);
|
|
3709
|
+
const el = await this.getElement();
|
|
3693
3710
|
return await el.getAttribute("data-title");
|
|
3694
3711
|
}
|
|
3695
3712
|
async click() {
|
|
3696
|
-
const el = await this.getElement();
|
|
3697
3713
|
await waitElementIsClickable_default(
|
|
3698
3714
|
{
|
|
3699
|
-
|
|
3715
|
+
by: this.bySelector,
|
|
3700
3716
|
driver: this.driver
|
|
3701
3717
|
}
|
|
3702
3718
|
);
|
|
3719
|
+
const el = await this.getElement();
|
|
3703
3720
|
await click(el, this.driver);
|
|
3704
3721
|
}
|
|
3705
3722
|
};
|
|
@@ -3724,11 +3741,11 @@ var SubsystemsPanel = class extends AbstractElement {
|
|
|
3724
3741
|
}
|
|
3725
3742
|
async headerTitle() {
|
|
3726
3743
|
const title = await this.header.title();
|
|
3727
|
-
await
|
|
3744
|
+
await safeWait(async () => await title.getText() != "", this.driver);
|
|
3728
3745
|
return title.getText();
|
|
3729
3746
|
}
|
|
3730
3747
|
getSearchComponent() {
|
|
3731
|
-
return new TextEditor("#aside", byTestIdCssSelector(SEARCH_INPUT_SELECTOR));
|
|
3748
|
+
return new TextEditor("#aside", byTestIdCssSelector(SEARCH_INPUT_SELECTOR), this.driver);
|
|
3732
3749
|
}
|
|
3733
3750
|
/**
|
|
3734
3751
|
* Находит сабсистему по заголовку
|
|
@@ -3741,7 +3758,7 @@ var SubsystemsPanel = class extends AbstractElement {
|
|
|
3741
3758
|
const searchComponent = this.getSearchComponent();
|
|
3742
3759
|
await this.searchClear();
|
|
3743
3760
|
await searchComponent.setValue(title);
|
|
3744
|
-
await
|
|
3761
|
+
await safeWait(
|
|
3745
3762
|
async () => {
|
|
3746
3763
|
const findElement = await this.itemByTitle(title).getElement();
|
|
3747
3764
|
const classes = await findElement.getAttribute("class");
|
|
@@ -3794,14 +3811,14 @@ var SubsystemsPanel = class extends AbstractElement {
|
|
|
3794
3811
|
* wait subsystemsPanel.back();
|
|
3795
3812
|
*/
|
|
3796
3813
|
async back() {
|
|
3797
|
-
const
|
|
3798
|
-
await
|
|
3814
|
+
const by = import_selenium_webdriver16.By.css(`#aside .${BACK_BUTTON_SELECTOR}`);
|
|
3815
|
+
await waitElementIsVisible_default(
|
|
3799
3816
|
{
|
|
3800
|
-
|
|
3817
|
+
by,
|
|
3801
3818
|
driver: this.driver
|
|
3802
3819
|
}
|
|
3803
3820
|
);
|
|
3804
|
-
await click(
|
|
3821
|
+
await click(await fixElementStaleError(by, this.driver), this.driver);
|
|
3805
3822
|
}
|
|
3806
3823
|
};
|
|
3807
3824
|
|