d5-testing-library 1.0.2 → 1.0.4
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.
|
@@ -309,8 +309,15 @@ var SelectBoxEditor = class extends AbstractDXEditorWithInput {
|
|
|
309
309
|
await inputEl.click();
|
|
310
310
|
await inputEl.sendKeys(value, import_selenium_webdriver7.Key.ENTER);
|
|
311
311
|
const combinedValueXpath = XPathHelper.getRoleXpath(SELECT_BOX_ELEMENT_ROLE) + XPathHelper.getClassAndValueXpath(SELECT_BOX_OPTION_TEXT_CONTAINER_CLASS, value);
|
|
312
|
-
|
|
313
|
-
|
|
312
|
+
await this.driver.wait(async () => {
|
|
313
|
+
try {
|
|
314
|
+
const optElement = await inputEl.findElement(import_selenium_webdriver7.By.xpath(combinedValueXpath));
|
|
315
|
+
await optElement.click();
|
|
316
|
+
return true;
|
|
317
|
+
} catch (e) {
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
}, 2e3);
|
|
314
321
|
}
|
|
315
322
|
async getValue() {
|
|
316
323
|
const value = await super.getInputValue();
|
|
@@ -321,6 +328,33 @@ var SelectBoxEditor = class extends AbstractDXEditorWithInput {
|
|
|
321
328
|
}
|
|
322
329
|
};
|
|
323
330
|
|
|
331
|
+
// src/pageObjects/elements/Editors/SwitchEditor.ts
|
|
332
|
+
var SwitchEditor = class extends AbstractFormElement {
|
|
333
|
+
async getValue() {
|
|
334
|
+
const inputEl = await this.getElement();
|
|
335
|
+
const result = await inputEl.getAttribute("aria-label");
|
|
336
|
+
if (result === "ON")
|
|
337
|
+
return 1;
|
|
338
|
+
if (result === "OFF")
|
|
339
|
+
return 0;
|
|
340
|
+
return void 0;
|
|
341
|
+
}
|
|
342
|
+
async setValue(value) {
|
|
343
|
+
if (value !== 0 && value !== 1) {
|
|
344
|
+
value = value ? 1 : 0;
|
|
345
|
+
}
|
|
346
|
+
const inputEl = await this.getElement();
|
|
347
|
+
const currentValue = await this.getValue();
|
|
348
|
+
if (currentValue !== value) {
|
|
349
|
+
await inputEl.click();
|
|
350
|
+
await this.driver.wait(async () => {
|
|
351
|
+
const updatedValue = await this.getValue();
|
|
352
|
+
return updatedValue !== currentValue;
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
|
|
324
358
|
// src/pageObjects/elements/Editors/editorFactory.ts
|
|
325
359
|
var editorFactory = async (getParentElement, elementBy, driver) => {
|
|
326
360
|
const elementInstance = new AbstractFormElement(getParentElement, elementBy, driver);
|
|
@@ -334,6 +368,8 @@ var editorFactory = async (getParentElement, elementBy, driver) => {
|
|
|
334
368
|
return new CheckBox(getParentElement, elementBy, driver);
|
|
335
369
|
if (classSting.includes("select-control"))
|
|
336
370
|
return new SelectBoxEditor(getParentElement, elementBy, driver);
|
|
371
|
+
if (classSting.includes("switch-control"))
|
|
372
|
+
return new SwitchEditor(getParentElement, elementBy, driver);
|
|
337
373
|
throw new Error("Unknown type of editor. Please write ticket to the support");
|
|
338
374
|
};
|
|
339
375
|
|
|
@@ -505,6 +541,27 @@ var Row = class extends AbstractElementWithParent {
|
|
|
505
541
|
});
|
|
506
542
|
return result;
|
|
507
543
|
}
|
|
544
|
+
async clickInlineButton(rowClass, buttonClass) {
|
|
545
|
+
const fixedTable = await this.getParentElement().findElement(
|
|
546
|
+
import_selenium_webdriver10.By.css(".dx-fixed-columns .dx-datagrid-content.dx-datagrid-content-fixed")
|
|
547
|
+
);
|
|
548
|
+
const rowEl = await fixedTable.findElement(import_selenium_webdriver10.By.className(rowClass));
|
|
549
|
+
const button = await rowEl.findElement(import_selenium_webdriver10.By.className(buttonClass));
|
|
550
|
+
if (button) {
|
|
551
|
+
return button.click();
|
|
552
|
+
}
|
|
553
|
+
throw new Error(`Cannot find ${buttonClass} button`);
|
|
554
|
+
}
|
|
555
|
+
async edit() {
|
|
556
|
+
await this.select();
|
|
557
|
+
return this.clickInlineButton("dx-selection", "edit");
|
|
558
|
+
}
|
|
559
|
+
async save() {
|
|
560
|
+
return this.clickInlineButton("dx-edit-row", "save");
|
|
561
|
+
}
|
|
562
|
+
async cancel() {
|
|
563
|
+
return this.clickInlineButton("dx-edit-row", "cancel");
|
|
564
|
+
}
|
|
508
565
|
};
|
|
509
566
|
|
|
510
567
|
// src/pageObjects/elements/Table/elements/Column.ts
|
|
@@ -614,6 +671,11 @@ var TableToolbarButton = class extends AbstractElementWithParent {
|
|
|
614
671
|
const button = await this.getElement();
|
|
615
672
|
return button.click();
|
|
616
673
|
}
|
|
674
|
+
async isDisabled() {
|
|
675
|
+
const button = await this.getElement();
|
|
676
|
+
const result = await button.getAttribute("aria-disabled");
|
|
677
|
+
return result === "true";
|
|
678
|
+
}
|
|
617
679
|
};
|
|
618
680
|
|
|
619
681
|
// src/pageObjects/elements/TableToolbar/TableToolbar.ts
|
|
@@ -180,6 +180,7 @@ declare abstract class FormEdit extends AbstractForm {
|
|
|
180
180
|
declare class TableToolbarButton extends AbstractElementWithParent {
|
|
181
181
|
constructor(getParentElement: () => WebElementPromise, name: string, driver?: WebDriver);
|
|
182
182
|
click(): Promise<void>;
|
|
183
|
+
isDisabled(): Promise<boolean>;
|
|
183
184
|
}
|
|
184
185
|
|
|
185
186
|
declare class Cell extends AbstractElementWithParent {
|
|
@@ -207,6 +208,10 @@ declare class Row extends AbstractElementWithParent {
|
|
|
207
208
|
isSelected(): Promise<boolean>;
|
|
208
209
|
getIndex(): number;
|
|
209
210
|
getCells(): Promise<Cell[]>;
|
|
211
|
+
private clickInlineButton;
|
|
212
|
+
edit(): Promise<void>;
|
|
213
|
+
save(): Promise<void>;
|
|
214
|
+
cancel(): Promise<void>;
|
|
210
215
|
}
|
|
211
216
|
|
|
212
217
|
declare class Table extends AbstractElementWithParent {
|
|
@@ -270,8 +270,15 @@ var SelectBoxEditor = class extends AbstractDXEditorWithInput {
|
|
|
270
270
|
await inputEl.click();
|
|
271
271
|
await inputEl.sendKeys(value, Key2.ENTER);
|
|
272
272
|
const combinedValueXpath = XPathHelper.getRoleXpath(SELECT_BOX_ELEMENT_ROLE) + XPathHelper.getClassAndValueXpath(SELECT_BOX_OPTION_TEXT_CONTAINER_CLASS, value);
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
await this.driver.wait(async () => {
|
|
274
|
+
try {
|
|
275
|
+
const optElement = await inputEl.findElement(By6.xpath(combinedValueXpath));
|
|
276
|
+
await optElement.click();
|
|
277
|
+
return true;
|
|
278
|
+
} catch (e) {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
}, 2e3);
|
|
275
282
|
}
|
|
276
283
|
async getValue() {
|
|
277
284
|
const value = await super.getInputValue();
|
|
@@ -282,6 +289,33 @@ var SelectBoxEditor = class extends AbstractDXEditorWithInput {
|
|
|
282
289
|
}
|
|
283
290
|
};
|
|
284
291
|
|
|
292
|
+
// src/pageObjects/elements/Editors/SwitchEditor.ts
|
|
293
|
+
var SwitchEditor = class extends AbstractFormElement {
|
|
294
|
+
async getValue() {
|
|
295
|
+
const inputEl = await this.getElement();
|
|
296
|
+
const result = await inputEl.getAttribute("aria-label");
|
|
297
|
+
if (result === "ON")
|
|
298
|
+
return 1;
|
|
299
|
+
if (result === "OFF")
|
|
300
|
+
return 0;
|
|
301
|
+
return void 0;
|
|
302
|
+
}
|
|
303
|
+
async setValue(value) {
|
|
304
|
+
if (value !== 0 && value !== 1) {
|
|
305
|
+
value = value ? 1 : 0;
|
|
306
|
+
}
|
|
307
|
+
const inputEl = await this.getElement();
|
|
308
|
+
const currentValue = await this.getValue();
|
|
309
|
+
if (currentValue !== value) {
|
|
310
|
+
await inputEl.click();
|
|
311
|
+
await this.driver.wait(async () => {
|
|
312
|
+
const updatedValue = await this.getValue();
|
|
313
|
+
return updatedValue !== currentValue;
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
|
|
285
319
|
// src/pageObjects/elements/Editors/editorFactory.ts
|
|
286
320
|
var editorFactory = async (getParentElement, elementBy, driver) => {
|
|
287
321
|
const elementInstance = new AbstractFormElement(getParentElement, elementBy, driver);
|
|
@@ -295,6 +329,8 @@ var editorFactory = async (getParentElement, elementBy, driver) => {
|
|
|
295
329
|
return new CheckBox(getParentElement, elementBy, driver);
|
|
296
330
|
if (classSting.includes("select-control"))
|
|
297
331
|
return new SelectBoxEditor(getParentElement, elementBy, driver);
|
|
332
|
+
if (classSting.includes("switch-control"))
|
|
333
|
+
return new SwitchEditor(getParentElement, elementBy, driver);
|
|
298
334
|
throw new Error("Unknown type of editor. Please write ticket to the support");
|
|
299
335
|
};
|
|
300
336
|
|
|
@@ -466,6 +502,27 @@ var Row = class extends AbstractElementWithParent {
|
|
|
466
502
|
});
|
|
467
503
|
return result;
|
|
468
504
|
}
|
|
505
|
+
async clickInlineButton(rowClass, buttonClass) {
|
|
506
|
+
const fixedTable = await this.getParentElement().findElement(
|
|
507
|
+
By9.css(".dx-fixed-columns .dx-datagrid-content.dx-datagrid-content-fixed")
|
|
508
|
+
);
|
|
509
|
+
const rowEl = await fixedTable.findElement(By9.className(rowClass));
|
|
510
|
+
const button = await rowEl.findElement(By9.className(buttonClass));
|
|
511
|
+
if (button) {
|
|
512
|
+
return button.click();
|
|
513
|
+
}
|
|
514
|
+
throw new Error(`Cannot find ${buttonClass} button`);
|
|
515
|
+
}
|
|
516
|
+
async edit() {
|
|
517
|
+
await this.select();
|
|
518
|
+
return this.clickInlineButton("dx-selection", "edit");
|
|
519
|
+
}
|
|
520
|
+
async save() {
|
|
521
|
+
return this.clickInlineButton("dx-edit-row", "save");
|
|
522
|
+
}
|
|
523
|
+
async cancel() {
|
|
524
|
+
return this.clickInlineButton("dx-edit-row", "cancel");
|
|
525
|
+
}
|
|
469
526
|
};
|
|
470
527
|
|
|
471
528
|
// src/pageObjects/elements/Table/elements/Column.ts
|
|
@@ -575,6 +632,11 @@ var TableToolbarButton = class extends AbstractElementWithParent {
|
|
|
575
632
|
const button = await this.getElement();
|
|
576
633
|
return button.click();
|
|
577
634
|
}
|
|
635
|
+
async isDisabled() {
|
|
636
|
+
const button = await this.getElement();
|
|
637
|
+
const result = await button.getAttribute("aria-disabled");
|
|
638
|
+
return result === "true";
|
|
639
|
+
}
|
|
578
640
|
};
|
|
579
641
|
|
|
580
642
|
// src/pageObjects/elements/TableToolbar/TableToolbar.ts
|
|
@@ -270,8 +270,15 @@ var SelectBoxEditor = class extends AbstractDXEditorWithInput {
|
|
|
270
270
|
await inputEl.click();
|
|
271
271
|
await inputEl.sendKeys(value, Key2.ENTER);
|
|
272
272
|
const combinedValueXpath = XPathHelper.getRoleXpath(SELECT_BOX_ELEMENT_ROLE) + XPathHelper.getClassAndValueXpath(SELECT_BOX_OPTION_TEXT_CONTAINER_CLASS, value);
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
await this.driver.wait(async () => {
|
|
274
|
+
try {
|
|
275
|
+
const optElement = await inputEl.findElement(By6.xpath(combinedValueXpath));
|
|
276
|
+
await optElement.click();
|
|
277
|
+
return true;
|
|
278
|
+
} catch (e) {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
}, 2e3);
|
|
275
282
|
}
|
|
276
283
|
async getValue() {
|
|
277
284
|
const value = await super.getInputValue();
|
|
@@ -282,6 +289,33 @@ var SelectBoxEditor = class extends AbstractDXEditorWithInput {
|
|
|
282
289
|
}
|
|
283
290
|
};
|
|
284
291
|
|
|
292
|
+
// src/pageObjects/elements/Editors/SwitchEditor.ts
|
|
293
|
+
var SwitchEditor = class extends AbstractFormElement {
|
|
294
|
+
async getValue() {
|
|
295
|
+
const inputEl = await this.getElement();
|
|
296
|
+
const result = await inputEl.getAttribute("aria-label");
|
|
297
|
+
if (result === "ON")
|
|
298
|
+
return 1;
|
|
299
|
+
if (result === "OFF")
|
|
300
|
+
return 0;
|
|
301
|
+
return void 0;
|
|
302
|
+
}
|
|
303
|
+
async setValue(value) {
|
|
304
|
+
if (value !== 0 && value !== 1) {
|
|
305
|
+
value = value ? 1 : 0;
|
|
306
|
+
}
|
|
307
|
+
const inputEl = await this.getElement();
|
|
308
|
+
const currentValue = await this.getValue();
|
|
309
|
+
if (currentValue !== value) {
|
|
310
|
+
await inputEl.click();
|
|
311
|
+
await this.driver.wait(async () => {
|
|
312
|
+
const updatedValue = await this.getValue();
|
|
313
|
+
return updatedValue !== currentValue;
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
|
|
285
319
|
// src/pageObjects/elements/Editors/editorFactory.ts
|
|
286
320
|
var editorFactory = async (getParentElement, elementBy, driver) => {
|
|
287
321
|
const elementInstance = new AbstractFormElement(getParentElement, elementBy, driver);
|
|
@@ -295,6 +329,8 @@ var editorFactory = async (getParentElement, elementBy, driver) => {
|
|
|
295
329
|
return new CheckBox(getParentElement, elementBy, driver);
|
|
296
330
|
if (classSting.includes("select-control"))
|
|
297
331
|
return new SelectBoxEditor(getParentElement, elementBy, driver);
|
|
332
|
+
if (classSting.includes("switch-control"))
|
|
333
|
+
return new SwitchEditor(getParentElement, elementBy, driver);
|
|
298
334
|
throw new Error("Unknown type of editor. Please write ticket to the support");
|
|
299
335
|
};
|
|
300
336
|
|
|
@@ -466,6 +502,27 @@ var Row = class extends AbstractElementWithParent {
|
|
|
466
502
|
});
|
|
467
503
|
return result;
|
|
468
504
|
}
|
|
505
|
+
async clickInlineButton(rowClass, buttonClass) {
|
|
506
|
+
const fixedTable = await this.getParentElement().findElement(
|
|
507
|
+
By9.css(".dx-fixed-columns .dx-datagrid-content.dx-datagrid-content-fixed")
|
|
508
|
+
);
|
|
509
|
+
const rowEl = await fixedTable.findElement(By9.className(rowClass));
|
|
510
|
+
const button = await rowEl.findElement(By9.className(buttonClass));
|
|
511
|
+
if (button) {
|
|
512
|
+
return button.click();
|
|
513
|
+
}
|
|
514
|
+
throw new Error(`Cannot find ${buttonClass} button`);
|
|
515
|
+
}
|
|
516
|
+
async edit() {
|
|
517
|
+
await this.select();
|
|
518
|
+
return this.clickInlineButton("dx-selection", "edit");
|
|
519
|
+
}
|
|
520
|
+
async save() {
|
|
521
|
+
return this.clickInlineButton("dx-edit-row", "save");
|
|
522
|
+
}
|
|
523
|
+
async cancel() {
|
|
524
|
+
return this.clickInlineButton("dx-edit-row", "cancel");
|
|
525
|
+
}
|
|
469
526
|
};
|
|
470
527
|
|
|
471
528
|
// src/pageObjects/elements/Table/elements/Column.ts
|
|
@@ -575,6 +632,11 @@ var TableToolbarButton = class extends AbstractElementWithParent {
|
|
|
575
632
|
const button = await this.getElement();
|
|
576
633
|
return button.click();
|
|
577
634
|
}
|
|
635
|
+
async isDisabled() {
|
|
636
|
+
const button = await this.getElement();
|
|
637
|
+
const result = await button.getAttribute("aria-disabled");
|
|
638
|
+
return result === "true";
|
|
639
|
+
}
|
|
578
640
|
};
|
|
579
641
|
|
|
580
642
|
// src/pageObjects/elements/TableToolbar/TableToolbar.ts
|