d5-testing-library 1.8.0-alpha.22 → 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-BSYJBQIG.mjs → chunk-32KSAOFJ.mjs} +73 -94
- package/dist/{chunk-Q4YMEUH5.mjs → chunk-75FRHQCI.mjs} +1 -1
- package/dist/{chunk-QP2EDHX5.mjs → chunk-S62QEWWA.mjs} +42 -44
- package/dist/{chunk-55ABPMZ7.mjs → chunk-XGIXXZD6.mjs} +3 -3
- package/dist/cjs/d5-testing-library.cjs +164 -156
- 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-TKPY2EAW.mjs +0 -7
- package/dist/ListForm-FJXCM77F.mjs +0 -7
- package/dist/TreeView-KNNQVSJU.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
|
};
|
|
@@ -793,11 +788,8 @@ var init_BaseDateEditor = __esm({
|
|
|
793
788
|
this.setClearStrategy(new InputClearStrategy());
|
|
794
789
|
}
|
|
795
790
|
async setArrayValue(value) {
|
|
796
|
-
const actions = this.driver.actions({ async: true });
|
|
797
791
|
const dateField = await this.driver.findElement(import_selenium_webdriver12.By.css(`${this.getFullCssSelector()}`));
|
|
798
|
-
const dateInputEl = await this.getInputElement();
|
|
799
792
|
const dateFieldDataTestID = await this.getDataTestId();
|
|
800
|
-
const formattedDates = value.map(formatDMYDate);
|
|
801
793
|
const button = await dateField.findElement(import_selenium_webdriver12.By.css(`.${BTN_CALENDAR_POPOVER_OPEN_SELECTOR}`));
|
|
802
794
|
await click(button, this.driver);
|
|
803
795
|
const calendarPopoverElement = await this.driver.findElement(import_selenium_webdriver12.By.css(byTestIdCssSelector(`${dateFieldDataTestID}-calendar-popover`)));
|
|
@@ -807,29 +799,23 @@ var init_BaseDateEditor = __esm({
|
|
|
807
799
|
const dateToInput = await calendarPopoverElement.findElement(
|
|
808
800
|
import_selenium_webdriver12.By.css(`.${BTN_CALENDAR_POPOVER_DATE_TO_INPUT_SELECTOR} .dx-texteditor-input`)
|
|
809
801
|
);
|
|
810
|
-
await
|
|
811
|
-
await
|
|
812
|
-
await click(dateToInput, this.driver);
|
|
813
|
-
await actions.move({ origin: dateInputEl }).sendKeys(import_selenium_webdriver12.Key.HOME).perform();
|
|
814
|
-
await dateToInput.sendKeys(formattedDates[1]);
|
|
815
|
-
await actions.move({ origin: dateInputEl }).sendKeys(import_selenium_webdriver12.Key.ENTER).perform();
|
|
802
|
+
await this.setSingleValue(value[0], dateFromInput);
|
|
803
|
+
await this.setSingleValue(value[1], dateToInput);
|
|
816
804
|
const btnOk = await this.driver.findElement(import_selenium_webdriver12.By.css(`.${BTN_SAVE_SELECTOR}`));
|
|
817
805
|
await click(btnOk, this.driver);
|
|
818
806
|
}
|
|
819
|
-
async setSingleValue(value) {
|
|
807
|
+
async setSingleValue(value, inputEl) {
|
|
820
808
|
const actions = this.driver.actions({ async: true });
|
|
821
809
|
const formattedDate = formatDMYDate(value);
|
|
822
|
-
|
|
823
|
-
await
|
|
824
|
-
await actions.move({ origin:
|
|
825
|
-
await actions.move({ origin: dateInputEl }).sendKeys(formattedDate, import_selenium_webdriver12.Key.ENTER).perform();
|
|
810
|
+
await click(inputEl, this.driver);
|
|
811
|
+
await actions.move({ origin: inputEl }).sendKeys(import_selenium_webdriver12.Key.HOME).perform();
|
|
812
|
+
await actions.move({ origin: inputEl }).sendKeys(formattedDate, import_selenium_webdriver12.Key.ENTER).perform();
|
|
826
813
|
}
|
|
827
814
|
async setDateValue(value) {
|
|
828
|
-
await this.clear();
|
|
829
815
|
if (Array.isArray(value)) {
|
|
830
816
|
await this.setArrayValue(value);
|
|
831
817
|
} else {
|
|
832
|
-
await this.setSingleValue(value);
|
|
818
|
+
await this.setSingleValue(value, await this.getInputElement());
|
|
833
819
|
}
|
|
834
820
|
}
|
|
835
821
|
};
|
|
@@ -1078,16 +1064,12 @@ var init_editorFactory = __esm({
|
|
|
1078
1064
|
const classSting = await elementInstance.getClasses();
|
|
1079
1065
|
if ((classSting.includes("text-control" /* Text */) || classSting.includes("text-area-control" /* TextArea */)) && !classSting.includes("single-date-range-control" /* SingleDateRange */))
|
|
1080
1066
|
return new TextEditor(parentCssSelector, elementCssSelector, driver);
|
|
1081
|
-
if (classSting.includes("number-control" /* Number */))
|
|
1082
|
-
|
|
1083
|
-
if (classSting.includes("
|
|
1084
|
-
return new CheckBox(parentCssSelector, elementCssSelector, driver);
|
|
1085
|
-
if (classSting.includes("multi-select-control" /* Multiselect */))
|
|
1086
|
-
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);
|
|
1087
1070
|
if (classSting.includes("select-control" /* Select */))
|
|
1088
1071
|
return new SelectBoxEditor(parentCssSelector, elementCssSelector, driver);
|
|
1089
|
-
if (classSting.includes("switch-control" /* Switch */))
|
|
1090
|
-
return new SwitchEditor(parentCssSelector, elementCssSelector, driver);
|
|
1072
|
+
if (classSting.includes("switch-control" /* Switch */)) return new SwitchEditor(parentCssSelector, elementCssSelector, driver);
|
|
1091
1073
|
if (classSting.includes("date-control" /* Date */) || classSting.includes("single-date-range-control" /* SingleDateRange */)) {
|
|
1092
1074
|
return new DateEditor(parentCssSelector, elementCssSelector, driver);
|
|
1093
1075
|
}
|
|
@@ -1374,16 +1356,11 @@ var init_groupFactory = __esm({
|
|
|
1374
1356
|
groupFactory = async (parentCssSelector, elementCssSelector, driver) => {
|
|
1375
1357
|
const elementInstance = new AbstractFormElement(parentCssSelector, elementCssSelector, driver);
|
|
1376
1358
|
const classSting = await elementInstance.getClasses();
|
|
1377
|
-
if (classSting.includes("tab-panel-group"))
|
|
1378
|
-
|
|
1379
|
-
if (classSting.includes("
|
|
1380
|
-
|
|
1381
|
-
if (classSting.includes("
|
|
1382
|
-
return new Panel(parentCssSelector, elementCssSelector, driver);
|
|
1383
|
-
if (classSting.includes("accordion-group"))
|
|
1384
|
-
return new Accordion(parentCssSelector, elementCssSelector, driver);
|
|
1385
|
-
if (classSting.includes("d5-accordion-item"))
|
|
1386
|
-
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);
|
|
1387
1364
|
throw new Error("Unknown type of group. Please write ticket to the support");
|
|
1388
1365
|
};
|
|
1389
1366
|
}
|
|
@@ -1582,7 +1559,7 @@ var init_Cell = __esm({
|
|
|
1582
1559
|
Cell = class extends AbstractElementWithParent {
|
|
1583
1560
|
_index;
|
|
1584
1561
|
getCellIndex;
|
|
1585
|
-
constructor(parentCssSelector, getCellIndex,
|
|
1562
|
+
constructor(parentCssSelector, getCellIndex, driver, index) {
|
|
1586
1563
|
super(parentCssSelector, getCssCellByIndexSelector(index), driver);
|
|
1587
1564
|
this.getCellIndex = getCellIndex;
|
|
1588
1565
|
this._index = index;
|
|
@@ -1610,8 +1587,7 @@ var init_Cell = __esm({
|
|
|
1610
1587
|
}
|
|
1611
1588
|
async getDateValue(cellEl, cellElClass) {
|
|
1612
1589
|
const value = (await cellEl.getText()).trim();
|
|
1613
|
-
if (value === "")
|
|
1614
|
-
return null;
|
|
1590
|
+
if (value === "") return null;
|
|
1615
1591
|
const isWithTime = cellElClass.includes("with-time");
|
|
1616
1592
|
try {
|
|
1617
1593
|
if (isWithTime) {
|
|
@@ -1637,14 +1613,10 @@ var init_Cell = __esm({
|
|
|
1637
1613
|
async getValue() {
|
|
1638
1614
|
const cellEl = await this.getElement();
|
|
1639
1615
|
const cellElClass = await cellEl.getAttribute("class");
|
|
1640
|
-
if (cellElClass.includes("boolean-column" /* Boolean */))
|
|
1641
|
-
|
|
1642
|
-
if (cellElClass.includes("
|
|
1643
|
-
|
|
1644
|
-
if (cellElClass.includes("number-column" /* Number */))
|
|
1645
|
-
return this.getNumberValue(cellEl);
|
|
1646
|
-
if (cellElClass.includes("date-column" /* Date */))
|
|
1647
|
-
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);
|
|
1648
1620
|
const cellText = await cellEl.getText();
|
|
1649
1621
|
return cellText == "" ? null : cellText;
|
|
1650
1622
|
}
|
|
@@ -1693,8 +1665,8 @@ var init_Row = __esm({
|
|
|
1693
1665
|
() => {
|
|
1694
1666
|
return this.getColumnBy({ title, name }).getIndex();
|
|
1695
1667
|
},
|
|
1696
|
-
|
|
1697
|
-
|
|
1668
|
+
this.driver,
|
|
1669
|
+
index
|
|
1698
1670
|
);
|
|
1699
1671
|
}
|
|
1700
1672
|
getCellByIndex(index) {
|
|
@@ -1707,9 +1679,11 @@ var init_Row = __esm({
|
|
|
1707
1679
|
return this._getCell({ title });
|
|
1708
1680
|
}
|
|
1709
1681
|
async select() {
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1682
|
+
await staleElementAction(async () => {
|
|
1683
|
+
const rowEl = await this.getElement();
|
|
1684
|
+
await click(rowEl, this.driver);
|
|
1685
|
+
});
|
|
1686
|
+
await safeWait(
|
|
1713
1687
|
async () => {
|
|
1714
1688
|
const classes = await this.getClasses();
|
|
1715
1689
|
return classes.includes(DX_SELECTION_CLASS);
|
|
@@ -1738,14 +1712,14 @@ var init_Row = __esm({
|
|
|
1738
1712
|
const buttonCssSelector = `.${DX_DATA_ROW_CLASS}[aria-rowindex="${transformInputIndex(
|
|
1739
1713
|
this.index
|
|
1740
1714
|
)}"] .${buttonClass}`;
|
|
1741
|
-
const
|
|
1742
|
-
|
|
1743
|
-
this.driver
|
|
1744
|
-
|
|
1745
|
-
|
|
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
|
+
});
|
|
1746
1720
|
}
|
|
1747
1721
|
async checkEditingMode(isEditing, msg) {
|
|
1748
|
-
await
|
|
1722
|
+
await safeWait(
|
|
1749
1723
|
async () => {
|
|
1750
1724
|
return (await this.getClasses()).includes(DX_ROW_EDIT_CLASS) === isEditing;
|
|
1751
1725
|
},
|
|
@@ -2111,7 +2085,7 @@ var init_DXContextMenuList = __esm({
|
|
|
2111
2085
|
}
|
|
2112
2086
|
async isVisible() {
|
|
2113
2087
|
try {
|
|
2114
|
-
await
|
|
2088
|
+
await waitElementIsVisible_default({
|
|
2115
2089
|
element: await this.driver.findElement(import_selenium_webdriver24.By.css(`.dx-overlay-wrapper .dx-contextmenu`)),
|
|
2116
2090
|
driver: this.driver,
|
|
2117
2091
|
errorMessage: "Cannot find dropdown element"
|
|
@@ -2569,8 +2543,7 @@ var init_ToolbarItem = __esm({
|
|
|
2569
2543
|
this._formName = formName;
|
|
2570
2544
|
}
|
|
2571
2545
|
async init() {
|
|
2572
|
-
if (this._button)
|
|
2573
|
-
return this._button;
|
|
2546
|
+
if (this._button) return this._button;
|
|
2574
2547
|
const classNames = await this.getClasses();
|
|
2575
2548
|
if (classNames.includes(GROUP_BUTTON_CLASS)) {
|
|
2576
2549
|
this._button = new ToolbarGroupButton(this.getFullCssSelector(), this._itemName, this.driver);
|
|
@@ -2675,7 +2648,7 @@ var init_FilterOperation = __esm({
|
|
|
2675
2648
|
await click(clickableElement, this.driver);
|
|
2676
2649
|
try {
|
|
2677
2650
|
const widgetPopupEl = await this.driver.findElement(import_selenium_webdriver28.By.css(`${byTestIdCssSelector(`${OPERATIONS_WIDGET_POPUP}-${this._testId}`)}`));
|
|
2678
|
-
await
|
|
2651
|
+
await waitElementIsVisible_default({
|
|
2679
2652
|
element: widgetPopupEl,
|
|
2680
2653
|
errorMessage: `Operation widget popup is not visible`,
|
|
2681
2654
|
driver: this.driver
|
|
@@ -2691,11 +2664,10 @@ var init_FilterOperation = __esm({
|
|
|
2691
2664
|
await this.initOperationWidget();
|
|
2692
2665
|
const operationEl = await fixElementStaleError(import_selenium_webdriver28.By.css(`${byTestIdCssSelector(`${OPERATIONS_WIDGET_POPUP}-${this._testId}`)} ${getWidgetInPopupSelector(operationName)}`), this.driver);
|
|
2693
2666
|
await click(operationEl, this.driver);
|
|
2694
|
-
await
|
|
2667
|
+
await safeWait(
|
|
2695
2668
|
async () => {
|
|
2696
2669
|
const currOperationName = await this.getAttribute("data-operation");
|
|
2697
|
-
if (operationName === "isblank")
|
|
2698
|
-
return true;
|
|
2670
|
+
if (operationName === "isblank") return true;
|
|
2699
2671
|
return currOperationName === operationName;
|
|
2700
2672
|
},
|
|
2701
2673
|
this.driver,
|
|
@@ -2704,15 +2676,14 @@ var init_FilterOperation = __esm({
|
|
|
2704
2676
|
}
|
|
2705
2677
|
async getOperation() {
|
|
2706
2678
|
const result = await this.getAttribute("data-operation");
|
|
2707
|
-
if (!result)
|
|
2708
|
-
throw new Error("Operation not found");
|
|
2679
|
+
if (!result) throw new Error("Operation not found");
|
|
2709
2680
|
return result;
|
|
2710
2681
|
}
|
|
2711
2682
|
async setIsBlank(value) {
|
|
2712
2683
|
const currValue = await this.getIsBlank();
|
|
2713
2684
|
if (currValue !== value) {
|
|
2714
2685
|
await this.setOperation("isblank");
|
|
2715
|
-
await
|
|
2686
|
+
await safeWait(
|
|
2716
2687
|
async () => {
|
|
2717
2688
|
const currIsBlank = await this.getIsBlank();
|
|
2718
2689
|
return currIsBlank === value;
|
|
@@ -2794,7 +2765,8 @@ var init_FormFilterField = __esm({
|
|
|
2794
2765
|
async initOperation() {
|
|
2795
2766
|
return new FilterOperation({
|
|
2796
2767
|
parentCssSelector: this.parentCssSelector,
|
|
2797
|
-
filterTestID: createLayoutFilterTestId(this.formName, this.name)
|
|
2768
|
+
filterTestID: createLayoutFilterTestId(this.formName, this.name),
|
|
2769
|
+
driver: this.driver
|
|
2798
2770
|
});
|
|
2799
2771
|
}
|
|
2800
2772
|
/**
|
|
@@ -2901,7 +2873,8 @@ var init_PanelFilterField = __esm({
|
|
|
2901
2873
|
async initOperation() {
|
|
2902
2874
|
return new FilterOperation({
|
|
2903
2875
|
parentCssSelector: this.parentCssSelector,
|
|
2904
|
-
filterTestID: createDocFilterTestId(this.formName, this.name)
|
|
2876
|
+
filterTestID: createDocFilterTestId(this.formName, this.name),
|
|
2877
|
+
driver: this.driver
|
|
2905
2878
|
});
|
|
2906
2879
|
}
|
|
2907
2880
|
/**
|
|
@@ -3083,7 +3056,7 @@ var init_ColumnFilter = __esm({
|
|
|
3083
3056
|
await actions.move({ origin: columnEl }).perform();
|
|
3084
3057
|
const elements = await columnEl.findElements(import_selenium_webdriver30.By.css(HEADER_FILTER_ICON));
|
|
3085
3058
|
let headerFilterIcon = null;
|
|
3086
|
-
await
|
|
3059
|
+
await safeWait(
|
|
3087
3060
|
async () => {
|
|
3088
3061
|
let result = false;
|
|
3089
3062
|
for (let element of elements) {
|
|
@@ -3098,12 +3071,11 @@ var init_ColumnFilter = __esm({
|
|
|
3098
3071
|
this.driver,
|
|
3099
3072
|
`HeaderFilter "${this._name}" is not visible`
|
|
3100
3073
|
);
|
|
3101
|
-
if (!headerFilterIcon)
|
|
3102
|
-
|
|
3103
|
-
await headerFilterIcon.click();
|
|
3074
|
+
if (!headerFilterIcon) throw new Error(`HeaderFilter "${this._name}" is not visible`);
|
|
3075
|
+
await click(headerFilterIcon, this.driver);
|
|
3104
3076
|
const filter = new HeaderFilterField("", this._formName, this._name, this.driver);
|
|
3105
3077
|
const filterEl = await filter.getElement();
|
|
3106
|
-
await
|
|
3078
|
+
await waitElementIsVisible_default({
|
|
3107
3079
|
element: filterEl,
|
|
3108
3080
|
driver: this.driver,
|
|
3109
3081
|
errorMessage: `Header filter is not visible`
|
|
@@ -3133,7 +3105,8 @@ var init_ColumnFilter = __esm({
|
|
|
3133
3105
|
const filter = await this.initFilter();
|
|
3134
3106
|
const filterOperation = new FilterOperation({
|
|
3135
3107
|
parentCssSelector: HEADER_FILTER_CONTAINER,
|
|
3136
|
-
filterTestID: createHeaderFilterTestId(this._formName, this._name)
|
|
3108
|
+
filterTestID: createHeaderFilterTestId(this._formName, this._name),
|
|
3109
|
+
driver: this.driver
|
|
3137
3110
|
});
|
|
3138
3111
|
const inputEl = await filter.getElement();
|
|
3139
3112
|
if (typeof operation === "string") {
|
|
@@ -3176,7 +3149,8 @@ var init_ColumnFilter = __esm({
|
|
|
3176
3149
|
await inputEl.click();
|
|
3177
3150
|
return new FilterOperation({
|
|
3178
3151
|
parentCssSelector: HEADER_FILTER_CONTAINER,
|
|
3179
|
-
filterTestID: createHeaderFilterTestId(this._formName, this._name)
|
|
3152
|
+
filterTestID: createHeaderFilterTestId(this._formName, this._name),
|
|
3153
|
+
driver: this.driver
|
|
3180
3154
|
});
|
|
3181
3155
|
}
|
|
3182
3156
|
/**
|
|
@@ -3409,7 +3383,7 @@ var init_Form = __esm({
|
|
|
3409
3383
|
async getTitleText() {
|
|
3410
3384
|
if (await this.isModal()) {
|
|
3411
3385
|
const titleEl2 = await this.driver.findElement(import_selenium_webdriver31.By.css(`${this.popupContainerCssSelector} .popup-title`));
|
|
3412
|
-
await
|
|
3386
|
+
await waitElementIsVisible_default({
|
|
3413
3387
|
element: titleEl2,
|
|
3414
3388
|
driver: this.driver,
|
|
3415
3389
|
errorMessage: `Form title element is not visible`
|
|
@@ -3437,7 +3411,7 @@ var init_Form = __esm({
|
|
|
3437
3411
|
const cssSelector = subformCssSelector(this.containerCssSelector, subFormTestId(name), isDockPanel);
|
|
3438
3412
|
const byCssSelector = import_selenium_webdriver31.By.css(cssSelector);
|
|
3439
3413
|
const subFormEl = await this.driver.findElement(byCssSelector);
|
|
3440
|
-
await
|
|
3414
|
+
await waitElementIsVisible_default({
|
|
3441
3415
|
element: subFormEl,
|
|
3442
3416
|
driver: this.driver,
|
|
3443
3417
|
errorMessage: `Subform "${name}" is not visible`
|
|
@@ -3520,7 +3494,7 @@ var init_FormEdit = __esm({
|
|
|
3520
3494
|
async saveButtonClick() {
|
|
3521
3495
|
const saveButtonCssSelector = await this.getButtonCssSelector(this.saveButtonId);
|
|
3522
3496
|
const saveButton = await this.driver.findElement(import_selenium_webdriver32.By.css(saveButtonCssSelector));
|
|
3523
|
-
await
|
|
3497
|
+
await safeWait(async () => !await this.isSaveButtonDisabled(), this.driver, "Button is disabled");
|
|
3524
3498
|
await click(saveButton, this.driver);
|
|
3525
3499
|
}
|
|
3526
3500
|
/**
|
|
@@ -3567,9 +3541,9 @@ __export(src_exports, {
|
|
|
3567
3541
|
elementIsNotPresent: () => elementIsNotPresent,
|
|
3568
3542
|
readonlyLocator: () => readonlyLocator,
|
|
3569
3543
|
signIn: () => signIn,
|
|
3570
|
-
wait: () =>
|
|
3544
|
+
wait: () => safeWait,
|
|
3571
3545
|
waitElementIsClickable: () => waitElementIsClickable_default,
|
|
3572
|
-
waitElementIsVisible: () =>
|
|
3546
|
+
waitElementIsVisible: () => waitElementIsVisible_default
|
|
3573
3547
|
});
|
|
3574
3548
|
module.exports = __toCommonJS(src_exports);
|
|
3575
3549
|
init_config();
|
|
@@ -3580,6 +3554,7 @@ init_config();
|
|
|
3580
3554
|
init_waitElementIsVisible();
|
|
3581
3555
|
init_actions();
|
|
3582
3556
|
init_locators();
|
|
3557
|
+
var import_selenium_webdriver3 = require("selenium-webdriver");
|
|
3583
3558
|
var LOGIN_PATH = "/login";
|
|
3584
3559
|
var LoginPage = class extends AbstractPage {
|
|
3585
3560
|
usernameField = byTestId("loginField", "input");
|
|
@@ -3588,7 +3563,7 @@ var LoginPage = class extends AbstractPage {
|
|
|
3588
3563
|
async locate() {
|
|
3589
3564
|
await super.locate();
|
|
3590
3565
|
const login = await this.driver.findElement(this.usernameField);
|
|
3591
|
-
await
|
|
3566
|
+
await waitElementIsVisible_default({
|
|
3592
3567
|
element: login,
|
|
3593
3568
|
driver: this.driver
|
|
3594
3569
|
});
|
|
@@ -3604,6 +3579,11 @@ var LoginPage = class extends AbstractPage {
|
|
|
3604
3579
|
}
|
|
3605
3580
|
async clickLoginButton() {
|
|
3606
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
|
+
});
|
|
3607
3587
|
}
|
|
3608
3588
|
async loginWith(username, password) {
|
|
3609
3589
|
await this.enterUsername(username);
|
|
@@ -3621,8 +3601,38 @@ init_locators();
|
|
|
3621
3601
|
// src/utils/createDriver.ts
|
|
3622
3602
|
var import_selenium_webdriver4 = require("selenium-webdriver");
|
|
3623
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
|
+
}
|
|
3624
3630
|
var createDriver = async (browser) => {
|
|
3625
|
-
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();
|
|
3626
3636
|
const manage = driver.manage();
|
|
3627
3637
|
await manage.setTimeouts({ implicit: config().timeout });
|
|
3628
3638
|
await manage.window().maximize();
|
|
@@ -3644,10 +3654,8 @@ init_waitElementIsClickable();
|
|
|
3644
3654
|
init_wait();
|
|
3645
3655
|
|
|
3646
3656
|
// src/utils/signIn.ts
|
|
3647
|
-
init_config();
|
|
3648
3657
|
async function signIn(driver) {
|
|
3649
3658
|
const webDriver = driver ?? await createDriver();
|
|
3650
|
-
config().driver = webDriver;
|
|
3651
3659
|
const loginPage = new LoginPage(webDriver);
|
|
3652
3660
|
await loginPage.locate();
|
|
3653
3661
|
await loginPage.authorize();
|
|
@@ -3692,23 +3700,23 @@ var SubsystemItem = class {
|
|
|
3692
3700
|
return fixElementStaleError(this.bySelector, this.driver);
|
|
3693
3701
|
}
|
|
3694
3702
|
async getTitle() {
|
|
3695
|
-
|
|
3696
|
-
await waitElementIsVisible(
|
|
3703
|
+
await waitElementIsVisible_default(
|
|
3697
3704
|
{
|
|
3698
|
-
|
|
3705
|
+
by: this.bySelector,
|
|
3699
3706
|
driver: this.driver
|
|
3700
3707
|
}
|
|
3701
3708
|
);
|
|
3709
|
+
const el = await this.getElement();
|
|
3702
3710
|
return await el.getAttribute("data-title");
|
|
3703
3711
|
}
|
|
3704
3712
|
async click() {
|
|
3705
|
-
const el = await this.getElement();
|
|
3706
3713
|
await waitElementIsClickable_default(
|
|
3707
3714
|
{
|
|
3708
|
-
|
|
3715
|
+
by: this.bySelector,
|
|
3709
3716
|
driver: this.driver
|
|
3710
3717
|
}
|
|
3711
3718
|
);
|
|
3719
|
+
const el = await this.getElement();
|
|
3712
3720
|
await click(el, this.driver);
|
|
3713
3721
|
}
|
|
3714
3722
|
};
|
|
@@ -3733,11 +3741,11 @@ var SubsystemsPanel = class extends AbstractElement {
|
|
|
3733
3741
|
}
|
|
3734
3742
|
async headerTitle() {
|
|
3735
3743
|
const title = await this.header.title();
|
|
3736
|
-
await
|
|
3744
|
+
await safeWait(async () => await title.getText() != "", this.driver);
|
|
3737
3745
|
return title.getText();
|
|
3738
3746
|
}
|
|
3739
3747
|
getSearchComponent() {
|
|
3740
|
-
return new TextEditor("#aside", byTestIdCssSelector(SEARCH_INPUT_SELECTOR));
|
|
3748
|
+
return new TextEditor("#aside", byTestIdCssSelector(SEARCH_INPUT_SELECTOR), this.driver);
|
|
3741
3749
|
}
|
|
3742
3750
|
/**
|
|
3743
3751
|
* Находит сабсистему по заголовку
|
|
@@ -3750,7 +3758,7 @@ var SubsystemsPanel = class extends AbstractElement {
|
|
|
3750
3758
|
const searchComponent = this.getSearchComponent();
|
|
3751
3759
|
await this.searchClear();
|
|
3752
3760
|
await searchComponent.setValue(title);
|
|
3753
|
-
await
|
|
3761
|
+
await safeWait(
|
|
3754
3762
|
async () => {
|
|
3755
3763
|
const findElement = await this.itemByTitle(title).getElement();
|
|
3756
3764
|
const classes = await findElement.getAttribute("class");
|
|
@@ -3803,14 +3811,14 @@ var SubsystemsPanel = class extends AbstractElement {
|
|
|
3803
3811
|
* wait subsystemsPanel.back();
|
|
3804
3812
|
*/
|
|
3805
3813
|
async back() {
|
|
3806
|
-
const
|
|
3807
|
-
await
|
|
3814
|
+
const by = import_selenium_webdriver16.By.css(`#aside .${BACK_BUTTON_SELECTOR}`);
|
|
3815
|
+
await waitElementIsVisible_default(
|
|
3808
3816
|
{
|
|
3809
|
-
|
|
3817
|
+
by,
|
|
3810
3818
|
driver: this.driver
|
|
3811
3819
|
}
|
|
3812
3820
|
);
|
|
3813
|
-
await click(
|
|
3821
|
+
await click(await fixElementStaleError(by, this.driver), this.driver);
|
|
3814
3822
|
}
|
|
3815
3823
|
};
|
|
3816
3824
|
|