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
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
// src/config.ts
|
|
2
|
-
import * as process from "node:process";
|
|
3
|
-
var driversMap = /* @__PURE__ */ new Map();
|
|
4
|
-
var createConfigProxy = (config2) => {
|
|
5
|
-
return new Proxy(config2, {
|
|
6
|
-
get(_target, prop) {
|
|
7
|
-
if (prop === "driver") {
|
|
8
|
-
return driversMap.get(process.pid);
|
|
9
|
-
}
|
|
10
|
-
return Reflect.get(...arguments);
|
|
11
|
-
},
|
|
12
|
-
set(_target, prop, value) {
|
|
13
|
-
if (prop === "driver") {
|
|
14
|
-
driversMap.set(process.pid, value);
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
return Reflect.set(...arguments);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
2
|
var Config = class _Config {
|
|
22
3
|
static instance;
|
|
23
4
|
appConfig;
|
|
@@ -28,8 +9,7 @@ var Config = class _Config {
|
|
|
28
9
|
return _Config.instance;
|
|
29
10
|
}
|
|
30
11
|
config = (cfg) => {
|
|
31
|
-
if (!cfg)
|
|
32
|
-
return createConfigProxy(this.appConfig);
|
|
12
|
+
if (!cfg) return this.appConfig;
|
|
33
13
|
this.appConfig = cfg;
|
|
34
14
|
};
|
|
35
15
|
};
|
|
@@ -45,23 +25,38 @@ import { By } from "selenium-webdriver";
|
|
|
45
25
|
function fixElementStaleError(by, driver) {
|
|
46
26
|
const maxCount = 3;
|
|
47
27
|
let err;
|
|
48
|
-
const call = async (times
|
|
49
|
-
if (times > maxCount)
|
|
50
|
-
throw err;
|
|
28
|
+
const call = async (times) => {
|
|
29
|
+
if (times > maxCount) throw err;
|
|
51
30
|
try {
|
|
52
31
|
let el = await driver.findElement(by);
|
|
53
32
|
await el.getAttribute("class");
|
|
54
33
|
return el;
|
|
55
34
|
} catch (e) {
|
|
56
35
|
err = e;
|
|
57
|
-
if (e instanceof Error && e.
|
|
58
|
-
return call(
|
|
36
|
+
if (e instanceof Error && e.message.toLowerCase().includes("stale element")) {
|
|
37
|
+
return call(times + 1);
|
|
59
38
|
}
|
|
60
39
|
}
|
|
61
|
-
if (err)
|
|
62
|
-
throw err;
|
|
40
|
+
if (err) throw err;
|
|
63
41
|
};
|
|
64
|
-
return call();
|
|
42
|
+
return call(0);
|
|
43
|
+
}
|
|
44
|
+
async function staleElementAction(action) {
|
|
45
|
+
const maxCount = 3;
|
|
46
|
+
let err;
|
|
47
|
+
const call = async (times) => {
|
|
48
|
+
if (times > maxCount) throw err;
|
|
49
|
+
try {
|
|
50
|
+
await action();
|
|
51
|
+
} catch (e) {
|
|
52
|
+
err = e;
|
|
53
|
+
if (e instanceof Error && e.message.toLowerCase().includes("stale element")) {
|
|
54
|
+
await call(times + 1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (err) throw err;
|
|
58
|
+
};
|
|
59
|
+
await call(0);
|
|
65
60
|
}
|
|
66
61
|
|
|
67
62
|
// src/pageObjects/AbstractElement.ts
|
|
@@ -69,7 +64,7 @@ var AbstractElement = class {
|
|
|
69
64
|
driver;
|
|
70
65
|
elementCssSelector;
|
|
71
66
|
constructor(driver, elementCssSelector) {
|
|
72
|
-
this.driver = driver
|
|
67
|
+
this.driver = driver;
|
|
73
68
|
this.elementCssSelector = elementCssSelector;
|
|
74
69
|
}
|
|
75
70
|
getFullCssSelector() {
|
|
@@ -124,26 +119,34 @@ var AbstractPage = class extends AbstractElement {
|
|
|
124
119
|
|
|
125
120
|
// src/utils/wait.ts
|
|
126
121
|
async function wait(condition, driver, errorMessage, timeout) {
|
|
127
|
-
driver = driver ?? config().driver;
|
|
128
122
|
await driver.wait(condition, timeout ?? config().timeout, errorMessage);
|
|
129
123
|
}
|
|
124
|
+
function safeWait(condition, driver, errorMessage, timeout) {
|
|
125
|
+
return wait(async () => {
|
|
126
|
+
try {
|
|
127
|
+
return await condition(driver);
|
|
128
|
+
} catch {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}, driver, errorMessage, timeout);
|
|
132
|
+
}
|
|
130
133
|
|
|
131
134
|
// src/utils/waitElementIsVisible.ts
|
|
132
|
-
import { until } from "selenium-webdriver";
|
|
133
135
|
async function waitElementIsVisible({
|
|
134
|
-
element,
|
|
135
136
|
timeout,
|
|
136
137
|
errorMessage,
|
|
137
|
-
driver
|
|
138
|
+
driver,
|
|
139
|
+
...rest
|
|
138
140
|
}) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
await safeWait(async () => {
|
|
142
|
+
const searchedElement = "by" in rest ? await fixElementStaleError(rest.by, driver) : rest.element;
|
|
143
|
+
return await searchedElement.isDisplayed();
|
|
144
|
+
}, driver, errorMessage ?? "Element is not visible", timeout ?? config().timeout);
|
|
142
145
|
}
|
|
146
|
+
var waitElementIsVisible_default = waitElementIsVisible;
|
|
143
147
|
|
|
144
148
|
// src/utils/actions.ts
|
|
145
149
|
var click = async (webElement, driver) => {
|
|
146
|
-
driver = driver ?? config().driver;
|
|
147
150
|
if (!await webElement.isDisplayed()) {
|
|
148
151
|
await driver.executeScript("arguments[0].scrollIntoView(true);", webElement);
|
|
149
152
|
}
|
|
@@ -151,7 +154,6 @@ var click = async (webElement, driver) => {
|
|
|
151
154
|
await actions.move({ origin: webElement }).click().perform();
|
|
152
155
|
};
|
|
153
156
|
var contextMenu = async (webElement, driver) => {
|
|
154
|
-
driver = driver ?? config().driver;
|
|
155
157
|
if (!await webElement.isDisplayed()) {
|
|
156
158
|
await driver.executeScript("arguments[0].scrollIntoView(true);", webElement);
|
|
157
159
|
}
|
|
@@ -176,8 +178,7 @@ async function waitElementIsClickable({
|
|
|
176
178
|
driver,
|
|
177
179
|
...rest
|
|
178
180
|
}) {
|
|
179
|
-
|
|
180
|
-
await wait(async () => {
|
|
181
|
+
await safeWait(async () => {
|
|
181
182
|
const searchedElement = "by" in rest ? await fixElementStaleError(rest.by, driver) : rest.element;
|
|
182
183
|
const isDisabled = await searchedElement.getCssValue("pointer-events") === "none";
|
|
183
184
|
return await searchedElement.isDisplayed() && !isDisabled;
|
|
@@ -302,10 +303,8 @@ var AbstractFormElement = class extends AbstractElementWithParent {
|
|
|
302
303
|
var CheckBox = class extends AbstractElementWithParent {
|
|
303
304
|
async getValue() {
|
|
304
305
|
const result = await this.getAttribute("aria-checked");
|
|
305
|
-
if (result === "true")
|
|
306
|
-
|
|
307
|
-
if (result === "false")
|
|
308
|
-
return 0;
|
|
306
|
+
if (result === "true") return 1;
|
|
307
|
+
if (result === "false") return 0;
|
|
309
308
|
return null;
|
|
310
309
|
}
|
|
311
310
|
async setValue(value) {
|
|
@@ -401,10 +400,8 @@ var SelectBoxEditor = class extends AbstractDXEditorWithInput {
|
|
|
401
400
|
var SwitchEditor = class extends AbstractElementWithParent {
|
|
402
401
|
async getValue() {
|
|
403
402
|
const result = await this.getAttribute("aria-label");
|
|
404
|
-
if (result === "ON")
|
|
405
|
-
|
|
406
|
-
if (result === "OFF")
|
|
407
|
-
return 0;
|
|
403
|
+
if (result === "ON") return 1;
|
|
404
|
+
if (result === "OFF") return 0;
|
|
408
405
|
return null;
|
|
409
406
|
}
|
|
410
407
|
async setValue(value) {
|
|
@@ -417,7 +414,7 @@ var SwitchEditor = class extends AbstractElementWithParent {
|
|
|
417
414
|
return;
|
|
418
415
|
}
|
|
419
416
|
await click(inputEl, this.driver);
|
|
420
|
-
await
|
|
417
|
+
await safeWait(async () => {
|
|
421
418
|
const updatedValue = await this.getValue();
|
|
422
419
|
return updatedValue !== currentValue;
|
|
423
420
|
}, this.driver);
|
|
@@ -447,7 +444,7 @@ var TagBox = class extends AbstractDXEditorWithInput {
|
|
|
447
444
|
}
|
|
448
445
|
async waitOptionSelection() {
|
|
449
446
|
const option = await fixElementStaleError(By6.css(TAG_BOX_LIST_ITEM_SELECTOR), this.driver);
|
|
450
|
-
await
|
|
447
|
+
await safeWait(() => option.isDisplayed(), this.driver);
|
|
451
448
|
}
|
|
452
449
|
async selectOption(inputEl, value, lastElement) {
|
|
453
450
|
try {
|
|
@@ -531,8 +528,7 @@ var ButtonGroup = class extends AbstractElementWithParent {
|
|
|
531
528
|
break;
|
|
532
529
|
}
|
|
533
530
|
}
|
|
534
|
-
if (!buttonEl)
|
|
535
|
-
throw new Error(`Cannot find item in button group with text: ${value}`);
|
|
531
|
+
if (!buttonEl) throw new Error(`Cannot find item in button group with text: ${value}`);
|
|
536
532
|
await click(buttonEl, this.driver);
|
|
537
533
|
}
|
|
538
534
|
};
|
|
@@ -574,11 +570,8 @@ var BaseDateEditor = class extends AbstractDXEditorWithInput {
|
|
|
574
570
|
this.setClearStrategy(new InputClearStrategy());
|
|
575
571
|
}
|
|
576
572
|
async setArrayValue(value) {
|
|
577
|
-
const actions = this.driver.actions({ async: true });
|
|
578
573
|
const dateField = await this.driver.findElement(By8.css(`${this.getFullCssSelector()}`));
|
|
579
|
-
const dateInputEl = await this.getInputElement();
|
|
580
574
|
const dateFieldDataTestID = await this.getDataTestId();
|
|
581
|
-
const formattedDates = value.map(formatDMYDate);
|
|
582
575
|
const button = await dateField.findElement(By8.css(`.${BTN_CALENDAR_POPOVER_OPEN_SELECTOR}`));
|
|
583
576
|
await click(button, this.driver);
|
|
584
577
|
const calendarPopoverElement = await this.driver.findElement(By8.css(byTestIdCssSelector(`${dateFieldDataTestID}-calendar-popover`)));
|
|
@@ -588,29 +581,23 @@ var BaseDateEditor = class extends AbstractDXEditorWithInput {
|
|
|
588
581
|
const dateToInput = await calendarPopoverElement.findElement(
|
|
589
582
|
By8.css(`.${BTN_CALENDAR_POPOVER_DATE_TO_INPUT_SELECTOR} .dx-texteditor-input`)
|
|
590
583
|
);
|
|
591
|
-
await
|
|
592
|
-
await
|
|
593
|
-
await click(dateToInput, this.driver);
|
|
594
|
-
await actions.move({ origin: dateInputEl }).sendKeys(Key3.HOME).perform();
|
|
595
|
-
await dateToInput.sendKeys(formattedDates[1]);
|
|
596
|
-
await actions.move({ origin: dateInputEl }).sendKeys(Key3.ENTER).perform();
|
|
584
|
+
await this.setSingleValue(value[0], dateFromInput);
|
|
585
|
+
await this.setSingleValue(value[1], dateToInput);
|
|
597
586
|
const btnOk = await this.driver.findElement(By8.css(`.${BTN_SAVE_SELECTOR}`));
|
|
598
587
|
await click(btnOk, this.driver);
|
|
599
588
|
}
|
|
600
|
-
async setSingleValue(value) {
|
|
589
|
+
async setSingleValue(value, inputEl) {
|
|
601
590
|
const actions = this.driver.actions({ async: true });
|
|
602
591
|
const formattedDate = formatDMYDate(value);
|
|
603
|
-
|
|
604
|
-
await
|
|
605
|
-
await actions.move({ origin:
|
|
606
|
-
await actions.move({ origin: dateInputEl }).sendKeys(formattedDate, Key3.ENTER).perform();
|
|
592
|
+
await click(inputEl, this.driver);
|
|
593
|
+
await actions.move({ origin: inputEl }).sendKeys(Key3.HOME).perform();
|
|
594
|
+
await actions.move({ origin: inputEl }).sendKeys(formattedDate, Key3.ENTER).perform();
|
|
607
595
|
}
|
|
608
596
|
async setDateValue(value) {
|
|
609
|
-
await this.clear();
|
|
610
597
|
if (Array.isArray(value)) {
|
|
611
598
|
await this.setArrayValue(value);
|
|
612
599
|
} else {
|
|
613
|
-
await this.setSingleValue(value);
|
|
600
|
+
await this.setSingleValue(value, await this.getInputElement());
|
|
614
601
|
}
|
|
615
602
|
}
|
|
616
603
|
};
|
|
@@ -802,16 +789,12 @@ var editorFactory = async (parentCssSelector, elementCssSelector, driver) => {
|
|
|
802
789
|
const classSting = await elementInstance.getClasses();
|
|
803
790
|
if ((classSting.includes("text-control" /* Text */) || classSting.includes("text-area-control" /* TextArea */)) && !classSting.includes("single-date-range-control" /* SingleDateRange */))
|
|
804
791
|
return new TextEditor(parentCssSelector, elementCssSelector, driver);
|
|
805
|
-
if (classSting.includes("number-control" /* Number */))
|
|
806
|
-
|
|
807
|
-
if (classSting.includes("
|
|
808
|
-
return new CheckBox(parentCssSelector, elementCssSelector, driver);
|
|
809
|
-
if (classSting.includes("multi-select-control" /* Multiselect */))
|
|
810
|
-
return new TagBox(parentCssSelector, elementCssSelector, driver);
|
|
792
|
+
if (classSting.includes("number-control" /* Number */)) return new NumberEditor(parentCssSelector, elementCssSelector, driver);
|
|
793
|
+
if (classSting.includes("check-box" /* CheckBox */)) return new CheckBox(parentCssSelector, elementCssSelector, driver);
|
|
794
|
+
if (classSting.includes("multi-select-control" /* Multiselect */)) return new TagBox(parentCssSelector, elementCssSelector, driver);
|
|
811
795
|
if (classSting.includes("select-control" /* Select */))
|
|
812
796
|
return new SelectBoxEditor(parentCssSelector, elementCssSelector, driver);
|
|
813
|
-
if (classSting.includes("switch-control" /* Switch */))
|
|
814
|
-
return new SwitchEditor(parentCssSelector, elementCssSelector, driver);
|
|
797
|
+
if (classSting.includes("switch-control" /* Switch */)) return new SwitchEditor(parentCssSelector, elementCssSelector, driver);
|
|
815
798
|
if (classSting.includes("date-control" /* Date */) || classSting.includes("single-date-range-control" /* SingleDateRange */)) {
|
|
816
799
|
return new DateEditor(parentCssSelector, elementCssSelector, driver);
|
|
817
800
|
}
|
|
@@ -1139,16 +1122,11 @@ var Accordion = class extends AbstractGroup {
|
|
|
1139
1122
|
var groupFactory = async (parentCssSelector, elementCssSelector, driver) => {
|
|
1140
1123
|
const elementInstance = new AbstractFormElement(parentCssSelector, elementCssSelector, driver);
|
|
1141
1124
|
const classSting = await elementInstance.getClasses();
|
|
1142
|
-
if (classSting.includes("tab-panel-group"))
|
|
1143
|
-
|
|
1144
|
-
if (classSting.includes("
|
|
1145
|
-
|
|
1146
|
-
if (classSting.includes("
|
|
1147
|
-
return new Panel(parentCssSelector, elementCssSelector, driver);
|
|
1148
|
-
if (classSting.includes("accordion-group"))
|
|
1149
|
-
return new Accordion(parentCssSelector, elementCssSelector, driver);
|
|
1150
|
-
if (classSting.includes("d5-accordion-item"))
|
|
1151
|
-
return new AccordionItem(parentCssSelector, elementCssSelector, driver);
|
|
1125
|
+
if (classSting.includes("tab-panel-group")) return new TabPanel(parentCssSelector, elementCssSelector, driver);
|
|
1126
|
+
if (classSting.includes("tab-panel-item")) return new TabPanelItem(parentCssSelector, elementCssSelector, driver);
|
|
1127
|
+
if (classSting.includes("panel-group")) return new Panel(parentCssSelector, elementCssSelector, driver);
|
|
1128
|
+
if (classSting.includes("accordion-group")) return new Accordion(parentCssSelector, elementCssSelector, driver);
|
|
1129
|
+
if (classSting.includes("d5-accordion-item")) return new AccordionItem(parentCssSelector, elementCssSelector, driver);
|
|
1152
1130
|
throw new Error("Unknown type of group. Please write ticket to the support");
|
|
1153
1131
|
};
|
|
1154
1132
|
|
|
@@ -1292,15 +1270,15 @@ async function classDependencyInjector(formType) {
|
|
|
1292
1270
|
let SubFormFactoryClass;
|
|
1293
1271
|
switch (formType) {
|
|
1294
1272
|
case "1" /* LIST */:
|
|
1295
|
-
SubFormFactoryClass = (await import("./ListForm-
|
|
1273
|
+
SubFormFactoryClass = (await import("./ListForm-MXGUBMWS.mjs")).default;
|
|
1296
1274
|
break;
|
|
1297
1275
|
case "3" /* TREE */:
|
|
1298
|
-
SubFormFactoryClass = (await import("./TreeView-
|
|
1276
|
+
SubFormFactoryClass = (await import("./TreeView-VZBOZCFW.mjs")).default;
|
|
1299
1277
|
break;
|
|
1300
1278
|
case "2" /* EDIT */:
|
|
1301
1279
|
case "99" /* FREE_FORM */:
|
|
1302
1280
|
case "4" /* REPORT */:
|
|
1303
|
-
SubFormFactoryClass = (await import("./FormEdit-
|
|
1281
|
+
SubFormFactoryClass = (await import("./FormEdit-QNZOB7PA.mjs")).default;
|
|
1304
1282
|
break;
|
|
1305
1283
|
default:
|
|
1306
1284
|
throw new Error(`Unsupported form type ${formType}`);
|
|
@@ -1331,7 +1309,7 @@ var Form = class extends AbstractForm {
|
|
|
1331
1309
|
async getTitleText() {
|
|
1332
1310
|
if (await this.isModal()) {
|
|
1333
1311
|
const titleEl2 = await this.driver.findElement(By15.css(`${this.popupContainerCssSelector} .popup-title`));
|
|
1334
|
-
await
|
|
1312
|
+
await waitElementIsVisible_default({
|
|
1335
1313
|
element: titleEl2,
|
|
1336
1314
|
driver: this.driver,
|
|
1337
1315
|
errorMessage: `Form title element is not visible`
|
|
@@ -1359,7 +1337,7 @@ var Form = class extends AbstractForm {
|
|
|
1359
1337
|
const cssSelector = subformCssSelector(this.containerCssSelector, subFormTestId(name), isDockPanel);
|
|
1360
1338
|
const byCssSelector = By15.css(cssSelector);
|
|
1361
1339
|
const subFormEl = await this.driver.findElement(byCssSelector);
|
|
1362
|
-
await
|
|
1340
|
+
await waitElementIsVisible_default({
|
|
1363
1341
|
element: subFormEl,
|
|
1364
1342
|
driver: this.driver,
|
|
1365
1343
|
errorMessage: `Subform "${name}" is not visible`
|
|
@@ -1383,10 +1361,11 @@ var Form = class extends AbstractForm {
|
|
|
1383
1361
|
export {
|
|
1384
1362
|
config,
|
|
1385
1363
|
fixElementStaleError,
|
|
1364
|
+
staleElementAction,
|
|
1386
1365
|
AbstractElement,
|
|
1387
1366
|
AbstractPage,
|
|
1388
|
-
|
|
1389
|
-
|
|
1367
|
+
safeWait,
|
|
1368
|
+
waitElementIsVisible_default,
|
|
1390
1369
|
click,
|
|
1391
1370
|
contextMenu,
|
|
1392
1371
|
byTestIdCssSelector,
|
|
@@ -14,10 +14,11 @@ import {
|
|
|
14
14
|
createLayoutFilterTestId,
|
|
15
15
|
createTableId,
|
|
16
16
|
fixElementStaleError,
|
|
17
|
-
|
|
17
|
+
safeWait,
|
|
18
|
+
staleElementAction,
|
|
18
19
|
waitElementIsClickable_default,
|
|
19
|
-
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
waitElementIsVisible_default
|
|
21
|
+
} from "./chunk-32KSAOFJ.mjs";
|
|
21
22
|
|
|
22
23
|
// src/pageObjects/elements/Table/Table.ts
|
|
23
24
|
import { By as By6 } from "selenium-webdriver";
|
|
@@ -46,7 +47,7 @@ var transformOutputIndex = (index) => +index - 1;
|
|
|
46
47
|
var Cell = class extends AbstractElementWithParent {
|
|
47
48
|
_index;
|
|
48
49
|
getCellIndex;
|
|
49
|
-
constructor(parentCssSelector, getCellIndex,
|
|
50
|
+
constructor(parentCssSelector, getCellIndex, driver, index) {
|
|
50
51
|
super(parentCssSelector, getCssCellByIndexSelector(index), driver);
|
|
51
52
|
this.getCellIndex = getCellIndex;
|
|
52
53
|
this._index = index;
|
|
@@ -74,8 +75,7 @@ var Cell = class extends AbstractElementWithParent {
|
|
|
74
75
|
}
|
|
75
76
|
async getDateValue(cellEl, cellElClass) {
|
|
76
77
|
const value = (await cellEl.getText()).trim();
|
|
77
|
-
if (value === "")
|
|
78
|
-
return null;
|
|
78
|
+
if (value === "") return null;
|
|
79
79
|
const isWithTime = cellElClass.includes("with-time");
|
|
80
80
|
try {
|
|
81
81
|
if (isWithTime) {
|
|
@@ -101,14 +101,10 @@ var Cell = class extends AbstractElementWithParent {
|
|
|
101
101
|
async getValue() {
|
|
102
102
|
const cellEl = await this.getElement();
|
|
103
103
|
const cellElClass = await cellEl.getAttribute("class");
|
|
104
|
-
if (cellElClass.includes("boolean-column" /* Boolean */))
|
|
105
|
-
|
|
106
|
-
if (cellElClass.includes("
|
|
107
|
-
|
|
108
|
-
if (cellElClass.includes("number-column" /* Number */))
|
|
109
|
-
return this.getNumberValue(cellEl);
|
|
110
|
-
if (cellElClass.includes("date-column" /* Date */))
|
|
111
|
-
return this.getDateValue(cellEl, cellElClass);
|
|
104
|
+
if (cellElClass.includes("boolean-column" /* Boolean */)) return this.getBooleanValue(cellEl);
|
|
105
|
+
if (cellElClass.includes("tags-column" /* Tags */)) return this.getTagsValue(cellEl);
|
|
106
|
+
if (cellElClass.includes("number-column" /* Number */)) return this.getNumberValue(cellEl);
|
|
107
|
+
if (cellElClass.includes("date-column" /* Date */)) return this.getDateValue(cellEl, cellElClass);
|
|
112
108
|
const cellText = await cellEl.getText();
|
|
113
109
|
return cellText == "" ? null : cellText;
|
|
114
110
|
}
|
|
@@ -144,8 +140,8 @@ var Row = class extends AbstractElementWithParent {
|
|
|
144
140
|
() => {
|
|
145
141
|
return this.getColumnBy({ title, name }).getIndex();
|
|
146
142
|
},
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
this.driver,
|
|
144
|
+
index
|
|
149
145
|
);
|
|
150
146
|
}
|
|
151
147
|
getCellByIndex(index) {
|
|
@@ -158,9 +154,11 @@ var Row = class extends AbstractElementWithParent {
|
|
|
158
154
|
return this._getCell({ title });
|
|
159
155
|
}
|
|
160
156
|
async select() {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
157
|
+
await staleElementAction(async () => {
|
|
158
|
+
const rowEl = await this.getElement();
|
|
159
|
+
await click(rowEl, this.driver);
|
|
160
|
+
});
|
|
161
|
+
await safeWait(
|
|
164
162
|
async () => {
|
|
165
163
|
const classes = await this.getClasses();
|
|
166
164
|
return classes.includes(DX_SELECTION_CLASS);
|
|
@@ -189,14 +187,14 @@ var Row = class extends AbstractElementWithParent {
|
|
|
189
187
|
const buttonCssSelector = `.${DX_DATA_ROW_CLASS}[aria-rowindex="${transformInputIndex(
|
|
190
188
|
this.index
|
|
191
189
|
)}"] .${buttonClass}`;
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
this.driver
|
|
195
|
-
|
|
196
|
-
|
|
190
|
+
const by = By3.css(`${this.parentCssSelector} ${this.fixedTableContentCssSelector} ${buttonCssSelector}`);
|
|
191
|
+
await staleElementAction(async () => {
|
|
192
|
+
const button = await fixElementStaleError(by, this.driver);
|
|
193
|
+
await click(button, this.driver);
|
|
194
|
+
});
|
|
197
195
|
}
|
|
198
196
|
async checkEditingMode(isEditing, msg) {
|
|
199
|
-
await
|
|
197
|
+
await safeWait(
|
|
200
198
|
async () => {
|
|
201
199
|
return (await this.getClasses()).includes(DX_ROW_EDIT_CLASS) === isEditing;
|
|
202
200
|
},
|
|
@@ -367,7 +365,7 @@ var DXContextMenuList = class extends AbstractDropDownMenuList {
|
|
|
367
365
|
}
|
|
368
366
|
async isVisible() {
|
|
369
367
|
try {
|
|
370
|
-
await
|
|
368
|
+
await waitElementIsVisible_default({
|
|
371
369
|
element: await this.driver.findElement(By5.css(`.dx-overlay-wrapper .dx-contextmenu`)),
|
|
372
370
|
driver: this.driver,
|
|
373
371
|
errorMessage: "Cannot find dropdown element"
|
|
@@ -754,8 +752,7 @@ var ToolbarItem = class extends AbstractElementWithParent {
|
|
|
754
752
|
this._formName = formName;
|
|
755
753
|
}
|
|
756
754
|
async init() {
|
|
757
|
-
if (this._button)
|
|
758
|
-
return this._button;
|
|
755
|
+
if (this._button) return this._button;
|
|
759
756
|
const classNames = await this.getClasses();
|
|
760
757
|
if (classNames.includes(GROUP_BUTTON_CLASS)) {
|
|
761
758
|
this._button = new ToolbarGroupButton(this.getFullCssSelector(), this._itemName, this.driver);
|
|
@@ -839,7 +836,7 @@ var FilterOperation = class extends AbstractElementWithParent {
|
|
|
839
836
|
await click(clickableElement, this.driver);
|
|
840
837
|
try {
|
|
841
838
|
const widgetPopupEl = await this.driver.findElement(By9.css(`${byTestIdCssSelector(`${OPERATIONS_WIDGET_POPUP}-${this._testId}`)}`));
|
|
842
|
-
await
|
|
839
|
+
await waitElementIsVisible_default({
|
|
843
840
|
element: widgetPopupEl,
|
|
844
841
|
errorMessage: `Operation widget popup is not visible`,
|
|
845
842
|
driver: this.driver
|
|
@@ -855,11 +852,10 @@ var FilterOperation = class extends AbstractElementWithParent {
|
|
|
855
852
|
await this.initOperationWidget();
|
|
856
853
|
const operationEl = await fixElementStaleError(By9.css(`${byTestIdCssSelector(`${OPERATIONS_WIDGET_POPUP}-${this._testId}`)} ${getWidgetInPopupSelector(operationName)}`), this.driver);
|
|
857
854
|
await click(operationEl, this.driver);
|
|
858
|
-
await
|
|
855
|
+
await safeWait(
|
|
859
856
|
async () => {
|
|
860
857
|
const currOperationName = await this.getAttribute("data-operation");
|
|
861
|
-
if (operationName === "isblank")
|
|
862
|
-
return true;
|
|
858
|
+
if (operationName === "isblank") return true;
|
|
863
859
|
return currOperationName === operationName;
|
|
864
860
|
},
|
|
865
861
|
this.driver,
|
|
@@ -868,15 +864,14 @@ var FilterOperation = class extends AbstractElementWithParent {
|
|
|
868
864
|
}
|
|
869
865
|
async getOperation() {
|
|
870
866
|
const result = await this.getAttribute("data-operation");
|
|
871
|
-
if (!result)
|
|
872
|
-
throw new Error("Operation not found");
|
|
867
|
+
if (!result) throw new Error("Operation not found");
|
|
873
868
|
return result;
|
|
874
869
|
}
|
|
875
870
|
async setIsBlank(value) {
|
|
876
871
|
const currValue = await this.getIsBlank();
|
|
877
872
|
if (currValue !== value) {
|
|
878
873
|
await this.setOperation("isblank");
|
|
879
|
-
await
|
|
874
|
+
await safeWait(
|
|
880
875
|
async () => {
|
|
881
876
|
const currIsBlank = await this.getIsBlank();
|
|
882
877
|
return currIsBlank === value;
|
|
@@ -948,7 +943,8 @@ var FormFilterField = class extends AbstractEditor {
|
|
|
948
943
|
async initOperation() {
|
|
949
944
|
return new FilterOperation({
|
|
950
945
|
parentCssSelector: this.parentCssSelector,
|
|
951
|
-
filterTestID: createLayoutFilterTestId(this.formName, this.name)
|
|
946
|
+
filterTestID: createLayoutFilterTestId(this.formName, this.name),
|
|
947
|
+
driver: this.driver
|
|
952
948
|
});
|
|
953
949
|
}
|
|
954
950
|
/**
|
|
@@ -1048,7 +1044,8 @@ var PanelFilterField = class extends AbstractEditor {
|
|
|
1048
1044
|
async initOperation() {
|
|
1049
1045
|
return new FilterOperation({
|
|
1050
1046
|
parentCssSelector: this.parentCssSelector,
|
|
1051
|
-
filterTestID: createDocFilterTestId(this.formName, this.name)
|
|
1047
|
+
filterTestID: createDocFilterTestId(this.formName, this.name),
|
|
1048
|
+
driver: this.driver
|
|
1052
1049
|
});
|
|
1053
1050
|
}
|
|
1054
1051
|
/**
|
|
@@ -1200,7 +1197,7 @@ var ColumnFilter = class extends AbstractElement {
|
|
|
1200
1197
|
await actions.move({ origin: columnEl }).perform();
|
|
1201
1198
|
const elements = await columnEl.findElements(By11.css(HEADER_FILTER_ICON));
|
|
1202
1199
|
let headerFilterIcon = null;
|
|
1203
|
-
await
|
|
1200
|
+
await safeWait(
|
|
1204
1201
|
async () => {
|
|
1205
1202
|
let result = false;
|
|
1206
1203
|
for (let element of elements) {
|
|
@@ -1215,12 +1212,11 @@ var ColumnFilter = class extends AbstractElement {
|
|
|
1215
1212
|
this.driver,
|
|
1216
1213
|
`HeaderFilter "${this._name}" is not visible`
|
|
1217
1214
|
);
|
|
1218
|
-
if (!headerFilterIcon)
|
|
1219
|
-
|
|
1220
|
-
await headerFilterIcon.click();
|
|
1215
|
+
if (!headerFilterIcon) throw new Error(`HeaderFilter "${this._name}" is not visible`);
|
|
1216
|
+
await click(headerFilterIcon, this.driver);
|
|
1221
1217
|
const filter = new HeaderFilterField("", this._formName, this._name, this.driver);
|
|
1222
1218
|
const filterEl = await filter.getElement();
|
|
1223
|
-
await
|
|
1219
|
+
await waitElementIsVisible_default({
|
|
1224
1220
|
element: filterEl,
|
|
1225
1221
|
driver: this.driver,
|
|
1226
1222
|
errorMessage: `Header filter is not visible`
|
|
@@ -1250,7 +1246,8 @@ var ColumnFilter = class extends AbstractElement {
|
|
|
1250
1246
|
const filter = await this.initFilter();
|
|
1251
1247
|
const filterOperation = new FilterOperation({
|
|
1252
1248
|
parentCssSelector: HEADER_FILTER_CONTAINER,
|
|
1253
|
-
filterTestID: createHeaderFilterTestId(this._formName, this._name)
|
|
1249
|
+
filterTestID: createHeaderFilterTestId(this._formName, this._name),
|
|
1250
|
+
driver: this.driver
|
|
1254
1251
|
});
|
|
1255
1252
|
const inputEl = await filter.getElement();
|
|
1256
1253
|
if (typeof operation === "string") {
|
|
@@ -1293,7 +1290,8 @@ var ColumnFilter = class extends AbstractElement {
|
|
|
1293
1290
|
await inputEl.click();
|
|
1294
1291
|
return new FilterOperation({
|
|
1295
1292
|
parentCssSelector: HEADER_FILTER_CONTAINER,
|
|
1296
|
-
filterTestID: createHeaderFilterTestId(this._formName, this._name)
|
|
1293
|
+
filterTestID: createHeaderFilterTestId(this._formName, this._name),
|
|
1294
|
+
driver: this.driver
|
|
1297
1295
|
});
|
|
1298
1296
|
}
|
|
1299
1297
|
/**
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
Form,
|
|
3
3
|
FormField,
|
|
4
4
|
click,
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
safeWait
|
|
6
|
+
} from "./chunk-32KSAOFJ.mjs";
|
|
7
7
|
|
|
8
8
|
// src/pageObjects/elements/Forms/FormEdit.ts
|
|
9
9
|
import { By } from "selenium-webdriver";
|
|
@@ -53,7 +53,7 @@ var FormEdit = class extends Form {
|
|
|
53
53
|
async saveButtonClick() {
|
|
54
54
|
const saveButtonCssSelector = await this.getButtonCssSelector(this.saveButtonId);
|
|
55
55
|
const saveButton = await this.driver.findElement(By.css(saveButtonCssSelector));
|
|
56
|
-
await
|
|
56
|
+
await safeWait(async () => !await this.isSaveButtonDisabled(), this.driver, "Button is disabled");
|
|
57
57
|
await click(saveButton, this.driver);
|
|
58
58
|
}
|
|
59
59
|
/**
|