d5-testing-library 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/d5-testing-library.cjs +380 -13
- package/dist/d5-testing-library.d.ts +109 -3
- package/dist/d5-testing-library.legacy-esm.js +379 -12
- package/dist/d5-testing-library.mjs +379 -12
- package/package.json +2 -2
|
@@ -75,10 +75,9 @@ var createDriver = async (browser) => {
|
|
|
75
75
|
// src/utils/elementIsNotPresent.ts
|
|
76
76
|
import { Condition } from "selenium-webdriver";
|
|
77
77
|
var elementIsNotPresent = function elementIsNotPresent2(locator) {
|
|
78
|
-
return new Condition("for no element to be located " + locator, function(driver) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
78
|
+
return new Condition("for no element to be located " + locator, async function(driver) {
|
|
79
|
+
const elements = await driver.findElements(locator);
|
|
80
|
+
return elements.length == 0;
|
|
82
81
|
});
|
|
83
82
|
};
|
|
84
83
|
|
|
@@ -123,18 +122,33 @@ var SubsystemsPanel = class extends AbstractElement {
|
|
|
123
122
|
};
|
|
124
123
|
|
|
125
124
|
// src/pageObjects/elements/Forms/AbstractForm.ts
|
|
125
|
+
import { By as By4 } from "selenium-webdriver";
|
|
126
126
|
var AbstractForm = class extends AbstractPage {
|
|
127
127
|
containerBy;
|
|
128
|
+
popupContainerBy;
|
|
128
129
|
constructor(driver) {
|
|
129
130
|
super(driver);
|
|
130
131
|
this.containerBy = byTestId(`form-content-wrapper-${this.formName}`);
|
|
131
132
|
}
|
|
133
|
+
async isModal() {
|
|
134
|
+
const el = await this.getContainerElement();
|
|
135
|
+
const value = await el.getAttribute("data-ismodal");
|
|
136
|
+
return value === "true";
|
|
137
|
+
}
|
|
132
138
|
getContainerElement = () => {
|
|
133
139
|
return this.driver.findElement(this.containerBy);
|
|
134
140
|
};
|
|
135
141
|
get formName() {
|
|
136
142
|
return "";
|
|
137
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Возвращает true если форма есть в DOM
|
|
146
|
+
* @example
|
|
147
|
+
* class MyForm extends FormEdit {}
|
|
148
|
+
* //...
|
|
149
|
+
* const formEdit = new MyForm();
|
|
150
|
+
* expect(await formEdit.exists()).toBe(true);
|
|
151
|
+
*/
|
|
138
152
|
async exists() {
|
|
139
153
|
try {
|
|
140
154
|
await this.driver.wait(elementIsNotPresent(this.containerBy), 1e3);
|
|
@@ -143,13 +157,30 @@ var AbstractForm = class extends AbstractPage {
|
|
|
143
157
|
return true;
|
|
144
158
|
}
|
|
145
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Получение заголовка на формы
|
|
162
|
+
* @example
|
|
163
|
+
* const listForm = new MyForm();
|
|
164
|
+
* //...
|
|
165
|
+
* expect(await listForm.getTitleText()).toBe('MyFormTitle');
|
|
166
|
+
*/
|
|
167
|
+
async getTitleText() {
|
|
168
|
+
if (await this.isModal()) {
|
|
169
|
+
const popupEl = await this.driver.findElement(this.popupContainerBy);
|
|
170
|
+
const titleEl2 = await popupEl.findElement(By4.className("popup-title"));
|
|
171
|
+
return titleEl2.getText();
|
|
172
|
+
}
|
|
173
|
+
let container = await this.getContainerElement();
|
|
174
|
+
let titleEl = await container.findElement(By4.className("form-toolbar-name-container"));
|
|
175
|
+
return titleEl.getText();
|
|
176
|
+
}
|
|
146
177
|
};
|
|
147
178
|
|
|
148
179
|
// src/pageObjects/elements/Forms/FormEdit.ts
|
|
149
|
-
import { By as
|
|
180
|
+
import { By as By7 } from "selenium-webdriver";
|
|
150
181
|
|
|
151
182
|
// src/pageObjects/elements/Editors/AbstractEditor.ts
|
|
152
|
-
import { By as
|
|
183
|
+
import { By as By5, Key } from "selenium-webdriver";
|
|
153
184
|
|
|
154
185
|
// src/pageObjects/AbstractFormElement.ts
|
|
155
186
|
var AbstractFormElement = class extends AbstractElementWithParent {
|
|
@@ -163,7 +194,7 @@ var AbstractFormElement = class extends AbstractElementWithParent {
|
|
|
163
194
|
var AbstractDXEditorWithInput = class extends AbstractFormElement {
|
|
164
195
|
async getInputElement() {
|
|
165
196
|
const controlEl = await this.getElement();
|
|
166
|
-
return controlEl.findElement(
|
|
197
|
+
return controlEl.findElement(By5.className("dx-texteditor-input"));
|
|
167
198
|
}
|
|
168
199
|
async getInputValue() {
|
|
169
200
|
const inputEl = await this.getInputElement();
|
|
@@ -197,6 +228,60 @@ var NumberEditor = class extends AbstractDXEditorWithInput {
|
|
|
197
228
|
}
|
|
198
229
|
};
|
|
199
230
|
|
|
231
|
+
// src/pageObjects/elements/Editors/CheckBox.ts
|
|
232
|
+
var CheckBox = class extends AbstractFormElement {
|
|
233
|
+
async getValue() {
|
|
234
|
+
const inputEl = await this.getElement();
|
|
235
|
+
const result = await inputEl.getAttribute("aria-checked");
|
|
236
|
+
if (result === "true")
|
|
237
|
+
return true;
|
|
238
|
+
if (result === "false")
|
|
239
|
+
return false;
|
|
240
|
+
return void 0;
|
|
241
|
+
}
|
|
242
|
+
async setValue(value) {
|
|
243
|
+
const inputEl = await this.getElement();
|
|
244
|
+
const currentValue = await this.getValue();
|
|
245
|
+
if (currentValue !== value) {
|
|
246
|
+
await inputEl.click();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
// src/pageObjects/elements/Editors/SelectBoxEditor.ts
|
|
252
|
+
import { By as By6, Key as Key2 } from "selenium-webdriver";
|
|
253
|
+
|
|
254
|
+
// src/utils/xpathHelper.ts
|
|
255
|
+
var XPathHelper = class {
|
|
256
|
+
static getRoleXpath(role) {
|
|
257
|
+
return `//div[@role='${role}']`;
|
|
258
|
+
}
|
|
259
|
+
static getClassAndValueXpath(cssClass, value) {
|
|
260
|
+
return `//div[contains(@class, '${cssClass}') and contains(.,'${value}')]`;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// src/pageObjects/elements/Editors/SelectBoxEditor.ts
|
|
265
|
+
var SELECT_BOX_OPTION_TEXT_CONTAINER_CLASS = "d5-multi-select-item";
|
|
266
|
+
var SELECT_BOX_ELEMENT_ROLE = "option";
|
|
267
|
+
var SelectBoxEditor = class extends AbstractDXEditorWithInput {
|
|
268
|
+
async setSelectInputValue(value) {
|
|
269
|
+
const inputEl = await this.getInputElement();
|
|
270
|
+
await inputEl.click();
|
|
271
|
+
await inputEl.sendKeys(value, Key2.ENTER);
|
|
272
|
+
const combinedValueXpath = XPathHelper.getRoleXpath(SELECT_BOX_ELEMENT_ROLE) + XPathHelper.getClassAndValueXpath(SELECT_BOX_OPTION_TEXT_CONTAINER_CLASS, value);
|
|
273
|
+
const optElement = await inputEl.findElement(By6.xpath(combinedValueXpath));
|
|
274
|
+
await optElement.click();
|
|
275
|
+
}
|
|
276
|
+
async getValue() {
|
|
277
|
+
const value = await super.getInputValue();
|
|
278
|
+
return value == "" ? null : value;
|
|
279
|
+
}
|
|
280
|
+
setValue(value) {
|
|
281
|
+
return this.setSelectInputValue(value);
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
|
|
200
285
|
// src/pageObjects/elements/Editors/editorFactory.ts
|
|
201
286
|
var editorFactory = async (getParentElement, elementBy, driver) => {
|
|
202
287
|
const elementInstance = new AbstractFormElement(getParentElement, elementBy, driver);
|
|
@@ -206,6 +291,10 @@ var editorFactory = async (getParentElement, elementBy, driver) => {
|
|
|
206
291
|
return new TextEditor(getParentElement, elementBy, driver);
|
|
207
292
|
if (classSting.includes("number-control"))
|
|
208
293
|
return new NumberEditor(getParentElement, elementBy, driver);
|
|
294
|
+
if (classSting.includes("check-box"))
|
|
295
|
+
return new CheckBox(getParentElement, elementBy, driver);
|
|
296
|
+
if (classSting.includes("select-control"))
|
|
297
|
+
return new SelectBoxEditor(getParentElement, elementBy, driver);
|
|
209
298
|
throw new Error("Unknown type of editor. Please write ticket to the support");
|
|
210
299
|
};
|
|
211
300
|
|
|
@@ -216,6 +305,9 @@ function createDataTestId(formName, itemType, itemName) {
|
|
|
216
305
|
function createFieldTestId(formName, itemName) {
|
|
217
306
|
return createDataTestId(formName, "form_field" /* FORM_FIELD */, itemName);
|
|
218
307
|
}
|
|
308
|
+
function createTableId(formName) {
|
|
309
|
+
return `${"table" /* TABLE */}-${formName}`;
|
|
310
|
+
}
|
|
219
311
|
|
|
220
312
|
// src/pageObjects/elements/FormField.ts
|
|
221
313
|
var FormField = class extends AbstractElementWithParent {
|
|
@@ -229,10 +321,22 @@ var FormField = class extends AbstractElementWithParent {
|
|
|
229
321
|
this.editor = await editorFactory(this.getParentElement, this.elementBy, this.driver);
|
|
230
322
|
}
|
|
231
323
|
}
|
|
324
|
+
/**
|
|
325
|
+
* Возвращает значение в поле
|
|
326
|
+
* @example
|
|
327
|
+
* expect(await formEdit.field('NumberFld').getValue()).toBe(10);
|
|
328
|
+
* expect(await formEdit.field('TextFld').getValue()).toBe('TestValue');
|
|
329
|
+
*/
|
|
232
330
|
async getValue() {
|
|
233
331
|
await this.initEditor();
|
|
234
332
|
return this.editor.getValue();
|
|
235
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Устанавливает значение в поле
|
|
336
|
+
* @example
|
|
337
|
+
* await formEdit.field('NumberFld').setValue(123);
|
|
338
|
+
* await formEdit.field('TextFld').setValue('TestValue');
|
|
339
|
+
*/
|
|
236
340
|
async setValue(value) {
|
|
237
341
|
await this.initEditor();
|
|
238
342
|
return this.editor.setValue(value);
|
|
@@ -241,21 +345,284 @@ var FormField = class extends AbstractElementWithParent {
|
|
|
241
345
|
|
|
242
346
|
// src/pageObjects/elements/Forms/FormEdit.ts
|
|
243
347
|
var FormEdit = class extends AbstractForm {
|
|
244
|
-
saveButtonBy =
|
|
348
|
+
saveButtonBy = By7.id("button-save");
|
|
349
|
+
constructor(driver) {
|
|
350
|
+
super(driver);
|
|
351
|
+
this.popupContainerBy = By7.className(`popup form-edit-${this.formName}`);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Находит поле формы редактирования по имени
|
|
355
|
+
* @example
|
|
356
|
+
* const formEdit = new MyForm();
|
|
357
|
+
* //...
|
|
358
|
+
* expect(await formEdit.field('Name').getValue()).toBe('test value');
|
|
359
|
+
*/
|
|
245
360
|
field(name) {
|
|
246
361
|
return new FormField(this.getContainerElement, this.formName, name, this.driver);
|
|
247
362
|
}
|
|
363
|
+
/**
|
|
364
|
+
* Нажатие на кнопку Сохранить
|
|
365
|
+
* @example
|
|
366
|
+
* const formEdit = new MyForm();
|
|
367
|
+
* //...
|
|
368
|
+
* await formEdit.saveButtonClick();
|
|
369
|
+
*/
|
|
248
370
|
async saveButtonClick() {
|
|
249
371
|
await this.driver.findElement(this.saveButtonBy).click();
|
|
250
372
|
}
|
|
251
373
|
};
|
|
252
374
|
|
|
253
375
|
// src/pageObjects/elements/Forms/ListForm.ts
|
|
254
|
-
import { By as
|
|
376
|
+
import { By as By13 } from "selenium-webdriver";
|
|
377
|
+
|
|
378
|
+
// src/pageObjects/elements/Table/Table.ts
|
|
379
|
+
import { By as By10 } from "selenium-webdriver";
|
|
380
|
+
|
|
381
|
+
// src/pageObjects/elements/Table/utils.ts
|
|
382
|
+
import { By as By8 } from "selenium-webdriver";
|
|
383
|
+
var getRowPathByIndex = (index) => {
|
|
384
|
+
return By8.xpath(`//tr[@aria-rowindex="${transformInputIndex(index)}"]`);
|
|
385
|
+
};
|
|
386
|
+
var getColumnPathByIndex = (index) => {
|
|
387
|
+
return By8.xpath(`//td[@aria-colindex="${transformInputIndex(index)}"]`);
|
|
388
|
+
};
|
|
389
|
+
var getColumnPathByCaption = (caption) => {
|
|
390
|
+
return By8.xpath(`//td[@role="columnheader"][@aria-label="Column ${caption}"]`);
|
|
391
|
+
};
|
|
392
|
+
var getCellPathByIndex = (index) => {
|
|
393
|
+
return By8.xpath(`//td[@role="gridcell"][@aria-colindex="${transformInputIndex(index)}"]`);
|
|
394
|
+
};
|
|
395
|
+
var transformInputIndex = (index) => index + 1;
|
|
396
|
+
var transformOutputIndex = (index) => +index - 1;
|
|
397
|
+
|
|
398
|
+
// src/pageObjects/elements/Table/elements/Row.ts
|
|
399
|
+
import { By as By9 } from "selenium-webdriver";
|
|
400
|
+
|
|
401
|
+
// src/pageObjects/elements/Table/elements/Cell.ts
|
|
402
|
+
var Cell = class extends AbstractElementWithParent {
|
|
403
|
+
index;
|
|
404
|
+
constructor(getParentElement, index, driver) {
|
|
405
|
+
super(getParentElement, driver);
|
|
406
|
+
this.index = index;
|
|
407
|
+
this.elementBy = getCellPathByIndex(index);
|
|
408
|
+
}
|
|
409
|
+
async getValue() {
|
|
410
|
+
const cellEl = await this.getElement();
|
|
411
|
+
return cellEl.getText();
|
|
412
|
+
}
|
|
413
|
+
getIndex() {
|
|
414
|
+
return this.index;
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
// src/pageObjects/elements/Table/elements/Row.ts
|
|
419
|
+
var Row = class extends AbstractElementWithParent {
|
|
420
|
+
index;
|
|
421
|
+
getColumnByCaption;
|
|
422
|
+
constructor(getParentElement, index, driver, getColumnByCaption) {
|
|
423
|
+
super(getParentElement, driver);
|
|
424
|
+
this.index = index;
|
|
425
|
+
this.elementBy = getRowPathByIndex(index);
|
|
426
|
+
this.getColumnByCaption = getColumnByCaption;
|
|
427
|
+
}
|
|
428
|
+
getRowElement = () => {
|
|
429
|
+
return this.driver.findElement(this.elementBy);
|
|
430
|
+
};
|
|
431
|
+
async getCellByIndex(index) {
|
|
432
|
+
const rowEl = await this.getElement();
|
|
433
|
+
const cell = rowEl.findElement(getCellPathByIndex(index));
|
|
434
|
+
if (cell) {
|
|
435
|
+
return new Cell(this.getRowElement, index, this.driver);
|
|
436
|
+
}
|
|
437
|
+
throw new Error(`Cannot find cell by index: ${index}`);
|
|
438
|
+
}
|
|
439
|
+
async getCell(caption) {
|
|
440
|
+
const column = await this.getColumnByCaption(caption);
|
|
441
|
+
if (column) {
|
|
442
|
+
const index = column.getIndex();
|
|
443
|
+
return this.getCellByIndex(index);
|
|
444
|
+
}
|
|
445
|
+
throw new Error("Unknown caption of cell");
|
|
446
|
+
}
|
|
447
|
+
async select() {
|
|
448
|
+
const rowEl = await this.getElement();
|
|
449
|
+
await rowEl.click();
|
|
450
|
+
}
|
|
451
|
+
async isSelected() {
|
|
452
|
+
const rowEl = await this.getElement();
|
|
453
|
+
const result = await rowEl.getAttribute("aria-selected");
|
|
454
|
+
return result === "true";
|
|
455
|
+
}
|
|
456
|
+
getIndex() {
|
|
457
|
+
return this.index;
|
|
458
|
+
}
|
|
459
|
+
async getCells() {
|
|
460
|
+
const rowEl = await this.getElement();
|
|
461
|
+
const cells = await rowEl.findElements(By9.css(`td[role="gridcell"]`));
|
|
462
|
+
const result = [];
|
|
463
|
+
cells.forEach((_, index) => {
|
|
464
|
+
const newCell = new Cell(this.getRowElement, index, this.driver);
|
|
465
|
+
result.push(newCell);
|
|
466
|
+
});
|
|
467
|
+
return result;
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
// src/pageObjects/elements/Table/elements/Column.ts
|
|
472
|
+
var Column = class extends AbstractElementWithParent {
|
|
473
|
+
index;
|
|
474
|
+
constructor(getParentElement, index, driver) {
|
|
475
|
+
super(getParentElement, driver);
|
|
476
|
+
this.index = index;
|
|
477
|
+
this.elementBy = getColumnPathByIndex(index);
|
|
478
|
+
}
|
|
479
|
+
async caption() {
|
|
480
|
+
const el = await this.getElement();
|
|
481
|
+
return el.getText();
|
|
482
|
+
}
|
|
483
|
+
getIndex() {
|
|
484
|
+
return this.index;
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
// src/pageObjects/elements/Table/Table.ts
|
|
489
|
+
var Table = class extends AbstractElementWithParent {
|
|
490
|
+
constructor(getParentElement, formName, driver) {
|
|
491
|
+
super(getParentElement, driver);
|
|
492
|
+
this.elementBy = By10.id(createTableId(formName));
|
|
493
|
+
}
|
|
494
|
+
async getHeaderElement() {
|
|
495
|
+
const parentEl = await this.getElement();
|
|
496
|
+
return parentEl.findElement(By10.className("dx-header-row"));
|
|
497
|
+
}
|
|
498
|
+
async getDataGrid() {
|
|
499
|
+
const parentEl = await this.getElement();
|
|
500
|
+
return parentEl.findElement(By10.css(`div[role="grid"]`));
|
|
501
|
+
}
|
|
502
|
+
getTableElement = () => {
|
|
503
|
+
return this.driver.findElement(this.elementBy);
|
|
504
|
+
};
|
|
505
|
+
async getRowByIndex(index) {
|
|
506
|
+
const gridContainer = await this.getDataGrid();
|
|
507
|
+
const row = await gridContainer.findElement(getRowPathByIndex(index));
|
|
508
|
+
if (row) {
|
|
509
|
+
return new Row(this.getTableElement, index, this.driver, this.getColumnByCaption.bind(this));
|
|
510
|
+
}
|
|
511
|
+
throw new Error(`Cannot find row by index: ${index}`);
|
|
512
|
+
}
|
|
513
|
+
async getColumnByIndex(index) {
|
|
514
|
+
const headerContainer = await this.getHeaderElement();
|
|
515
|
+
const column = await headerContainer.findElement(getColumnPathByIndex(index));
|
|
516
|
+
if (column) {
|
|
517
|
+
return new Column(this.getTableElement, index, this.driver);
|
|
518
|
+
}
|
|
519
|
+
throw new Error(`Cannot find column by index: ${index}`);
|
|
520
|
+
}
|
|
521
|
+
async getColumnByCaption(caption) {
|
|
522
|
+
const headerContainer = await this.getHeaderElement();
|
|
523
|
+
const column = await headerContainer.findElement(getColumnPathByCaption(caption));
|
|
524
|
+
if (column) {
|
|
525
|
+
const index = await column.getAttribute("aria-colindex");
|
|
526
|
+
return new Column(this.getTableElement, transformOutputIndex(index), this.driver);
|
|
527
|
+
}
|
|
528
|
+
throw new Error(`Cannot find column by caption: ${caption}`);
|
|
529
|
+
}
|
|
530
|
+
async selectRowByIndex(index) {
|
|
531
|
+
const row = await this.getRowByIndex(index);
|
|
532
|
+
if (row) {
|
|
533
|
+
await row.select();
|
|
534
|
+
} else {
|
|
535
|
+
throw new Error(`Cannot find row by index: ${index}`);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
async getRows() {
|
|
539
|
+
const gridContainer = await this.getDataGrid();
|
|
540
|
+
const rows = await gridContainer.findElements(By10.className("dx-row dx-data-row"));
|
|
541
|
+
const result = [];
|
|
542
|
+
rows.forEach((_, index) => {
|
|
543
|
+
const newRow = new Row(this.getTableElement, index, this.driver, this.getColumnByCaption.bind(this));
|
|
544
|
+
result.push(newRow);
|
|
545
|
+
});
|
|
546
|
+
return result;
|
|
547
|
+
}
|
|
548
|
+
async getColumns() {
|
|
549
|
+
const headerContainer = await this.getHeaderElement();
|
|
550
|
+
const columns = await headerContainer.findElements(By10.css(`td[role="columnheader"]`));
|
|
551
|
+
const result = [];
|
|
552
|
+
columns.forEach((_, index) => {
|
|
553
|
+
const newCol = new Column(this.getTableElement, index, this.driver);
|
|
554
|
+
result.push(newCol);
|
|
555
|
+
});
|
|
556
|
+
return result;
|
|
557
|
+
}
|
|
558
|
+
async element() {
|
|
559
|
+
return this.getElement();
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
// src/pageObjects/elements/TableToolbar/TableToolbar.ts
|
|
564
|
+
import { By as By12 } from "selenium-webdriver";
|
|
565
|
+
|
|
566
|
+
// src/pageObjects/elements/TableToolbar/TableToolbarButton.ts
|
|
567
|
+
import { By as By11 } from "selenium-webdriver";
|
|
568
|
+
var TOOLBAR_BUTTON_CLASS = "toolbar-button";
|
|
569
|
+
var TableToolbarButton = class extends AbstractElementWithParent {
|
|
570
|
+
constructor(getParentElement, name, driver) {
|
|
571
|
+
super(getParentElement, driver);
|
|
572
|
+
this.elementBy = By11.id(`${TOOLBAR_BUTTON_CLASS}-${name}`);
|
|
573
|
+
}
|
|
574
|
+
async click() {
|
|
575
|
+
const button = await this.getElement();
|
|
576
|
+
return button.click();
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
// src/pageObjects/elements/TableToolbar/TableToolbar.ts
|
|
581
|
+
var TABLE_TOOLBAR_CLASS = "d5-table-toolbar";
|
|
582
|
+
var TableToolbar = class extends AbstractElementWithParent {
|
|
583
|
+
constructor(getParentElement, formName, driver) {
|
|
584
|
+
super(getParentElement, driver);
|
|
585
|
+
this.elementBy = By12.id(`${TABLE_TOOLBAR_CLASS}-${formName}`);
|
|
586
|
+
}
|
|
587
|
+
getTableToolbarElement = () => {
|
|
588
|
+
return this.driver.findElement(this.elementBy);
|
|
589
|
+
};
|
|
590
|
+
async button(name) {
|
|
591
|
+
const toolbar = await this.getTableToolbarElement();
|
|
592
|
+
const button = await toolbar.findElement(By12.id(`${TOOLBAR_BUTTON_CLASS}-${name}`));
|
|
593
|
+
if (button) {
|
|
594
|
+
return new TableToolbarButton(this.getTableToolbarElement, name, this.driver);
|
|
595
|
+
}
|
|
596
|
+
throw new Error(`Cannot find button by name: ${name}`);
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
// src/pageObjects/elements/Forms/ListForm.ts
|
|
255
601
|
var ListForm = class extends AbstractForm {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
602
|
+
constructor(driver) {
|
|
603
|
+
super(driver);
|
|
604
|
+
this.popupContainerBy = By13.className(`popup form-inline-${this.formName}`);
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Находит таблицу
|
|
608
|
+
* @example
|
|
609
|
+
* const listForm = new MyForm();
|
|
610
|
+
* //...
|
|
611
|
+
* expect(listForm.table());
|
|
612
|
+
*/
|
|
613
|
+
table() {
|
|
614
|
+
return new Table(this.getContainerElement, this.formName, this.driver);
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Находит таблицу
|
|
618
|
+
* @example
|
|
619
|
+
* const listForm = new MyForm();
|
|
620
|
+
* //...
|
|
621
|
+
* expect(listForm.toolbarButton());
|
|
622
|
+
*/
|
|
623
|
+
toolbarButton(name) {
|
|
624
|
+
const toolbar = new TableToolbar(this.getContainerElement, this.formName, this.driver);
|
|
625
|
+
return toolbar.button(name);
|
|
259
626
|
}
|
|
260
627
|
};
|
|
261
628
|
|