d5-testing-library 1.2.0 → 1.3.0
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 +462 -162
- package/dist/d5-testing-library.d.ts +150 -22
- package/dist/d5-testing-library.legacy-esm.js +455 -158
- package/dist/d5-testing-library.mjs +455 -158
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as selenium_webdriver from 'selenium-webdriver';
|
|
2
|
-
import { WebDriver, Browser, By, Condition
|
|
2
|
+
import { WebDriver, Browser, WebElement, By, Condition } from 'selenium-webdriver';
|
|
3
3
|
|
|
4
4
|
type DriverType = typeof Browser;
|
|
5
5
|
type BrowserList = DriverType[keyof DriverType];
|
|
@@ -17,7 +17,13 @@ declare function config(cfg?: IConfig): IConfig;
|
|
|
17
17
|
|
|
18
18
|
declare abstract class AbstractElement {
|
|
19
19
|
driver: WebDriver;
|
|
20
|
-
protected
|
|
20
|
+
protected elementCssSelector: string;
|
|
21
|
+
protected constructor(driver?: WebDriver, elementCssSelector?: string);
|
|
22
|
+
protected getFullCssSelector(): string;
|
|
23
|
+
getElement(): Promise<WebElement>;
|
|
24
|
+
getAttribute(attr: string): Promise<string>;
|
|
25
|
+
getClasses(): Promise<string>;
|
|
26
|
+
getDataTestId(): Promise<string>;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
declare abstract class AbstractPage extends AbstractElement {
|
|
@@ -146,13 +152,9 @@ declare abstract class AbstractForm extends AbstractPage {
|
|
|
146
152
|
}
|
|
147
153
|
|
|
148
154
|
declare abstract class AbstractElementWithParent extends AbstractElement {
|
|
149
|
-
protected elementCssSelector: string;
|
|
150
155
|
protected parentCssSelector: string;
|
|
151
156
|
constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
|
|
152
157
|
protected getFullCssSelector(): string;
|
|
153
|
-
getElement(): Promise<WebElement>;
|
|
154
|
-
getAttribute(attr: string): Promise<string>;
|
|
155
|
-
getClasses(): Promise<string>;
|
|
156
158
|
}
|
|
157
159
|
|
|
158
160
|
interface Editor {
|
|
@@ -163,7 +165,7 @@ interface Editor {
|
|
|
163
165
|
}
|
|
164
166
|
|
|
165
167
|
interface ClearStrategy {
|
|
166
|
-
clear(editor:
|
|
168
|
+
clear(editor: Editor): Promise<void>;
|
|
167
169
|
}
|
|
168
170
|
|
|
169
171
|
declare abstract class AbstractDXEditorWithInput extends AbstractElementWithParent implements Editor {
|
|
@@ -192,10 +194,10 @@ declare class NumberEditor extends AbstractDXEditorWithInput {
|
|
|
192
194
|
|
|
193
195
|
declare const editorFactory: (parentCssSelector: string, elementCssSelector: string, driver: WebDriver) => Promise<Editor>;
|
|
194
196
|
|
|
195
|
-
declare class
|
|
196
|
-
editor: Editor;
|
|
197
|
-
constructor(parentCssSelector: string,
|
|
198
|
-
|
|
197
|
+
declare class AbstractEditor extends AbstractElementWithParent implements Editor {
|
|
198
|
+
protected editor: Editor;
|
|
199
|
+
constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
|
|
200
|
+
protected initEditor(): Promise<void>;
|
|
199
201
|
/**
|
|
200
202
|
* Возвращает значение в поле
|
|
201
203
|
* @example
|
|
@@ -224,6 +226,10 @@ declare class FormField extends AbstractElementWithParent implements Editor {
|
|
|
224
226
|
remove(itemText: string): Promise<void>;
|
|
225
227
|
}
|
|
226
228
|
|
|
229
|
+
declare class FormField extends AbstractEditor {
|
|
230
|
+
constructor(parentCssSelector: string, formName: string, name: string, driver?: WebDriver);
|
|
231
|
+
}
|
|
232
|
+
|
|
227
233
|
interface Group {
|
|
228
234
|
isDisplayed(): Promise<boolean>;
|
|
229
235
|
}
|
|
@@ -277,9 +283,16 @@ declare abstract class FormEdit extends AbstractForm {
|
|
|
277
283
|
saveButtonClick(): Promise<void>;
|
|
278
284
|
}
|
|
279
285
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
286
|
+
interface Button {
|
|
287
|
+
click(): Promise<void>;
|
|
288
|
+
isDisabled(): Promise<boolean>;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
declare class ToolbarItem extends AbstractElementWithParent implements Button {
|
|
292
|
+
private _button;
|
|
293
|
+
private _itemName;
|
|
294
|
+
constructor(parentCssSelector: string, formName: string, itemName: string, driver?: WebDriver);
|
|
295
|
+
private init;
|
|
283
296
|
click(): Promise<void>;
|
|
284
297
|
isDisabled(): Promise<boolean>;
|
|
285
298
|
}
|
|
@@ -289,30 +302,48 @@ declare class Cell extends AbstractElementWithParent {
|
|
|
289
302
|
private getCellIndex;
|
|
290
303
|
constructor(parentCssSelector: string, getCellIndex: () => Promise<number>, index?: number, driver?: WebDriver);
|
|
291
304
|
private set index(value);
|
|
305
|
+
private getBooleanValue;
|
|
292
306
|
getElement(): Promise<WebElement>;
|
|
293
|
-
getValue(): Promise<string>;
|
|
307
|
+
getValue(): Promise<string | 1 | 0>;
|
|
294
308
|
getIndex(): number;
|
|
295
309
|
}
|
|
296
310
|
|
|
311
|
+
interface ConstructorParams {
|
|
312
|
+
parentCssSelector: string;
|
|
313
|
+
name?: string;
|
|
314
|
+
caption?: string;
|
|
315
|
+
index?: number;
|
|
316
|
+
driver?: WebDriver;
|
|
317
|
+
}
|
|
297
318
|
declare class Column extends AbstractElementWithParent {
|
|
298
319
|
private _index;
|
|
299
320
|
private _caption;
|
|
300
|
-
|
|
321
|
+
private _name;
|
|
322
|
+
constructor({ parentCssSelector, name, caption, index, driver }: ConstructorParams);
|
|
301
323
|
private set index(value);
|
|
302
324
|
private get index();
|
|
303
325
|
getElement(): Promise<WebElement>;
|
|
326
|
+
private getColumnHeaderIndexBy;
|
|
304
327
|
private getIndexByCaption;
|
|
328
|
+
private getIndexByName;
|
|
305
329
|
caption(): Promise<string>;
|
|
306
330
|
getIndex(): Promise<number>;
|
|
307
331
|
}
|
|
308
332
|
|
|
309
333
|
declare class Row extends AbstractElementWithParent {
|
|
310
334
|
index: number;
|
|
311
|
-
protected
|
|
312
|
-
|
|
335
|
+
protected getColumnBy: (_: {
|
|
336
|
+
title?: string;
|
|
337
|
+
name?: string;
|
|
338
|
+
}) => Column;
|
|
339
|
+
constructor(parentCssSelector: string, index: number, driver?: WebDriver, getColumnBy?: (_: {
|
|
340
|
+
title?: string;
|
|
341
|
+
name?: string;
|
|
342
|
+
}) => Column);
|
|
313
343
|
private _getCell;
|
|
314
344
|
getCellByIndex(index: number): Cell;
|
|
315
|
-
getCell(
|
|
345
|
+
getCell(name: string): Cell;
|
|
346
|
+
getCellByTitle(title: string): Cell;
|
|
316
347
|
select(): Promise<void>;
|
|
317
348
|
isSelected(): Promise<boolean>;
|
|
318
349
|
getIndex(): number;
|
|
@@ -327,9 +358,11 @@ declare class Row extends AbstractElementWithParent {
|
|
|
327
358
|
declare class Table extends AbstractElementWithParent {
|
|
328
359
|
protected formName: string;
|
|
329
360
|
constructor(parentCssSelector: string, formName: string, driver?: WebDriver);
|
|
361
|
+
private getColumnBy;
|
|
330
362
|
getRowByIndex(index: number): Row;
|
|
331
363
|
getColumnByIndex(index: number): Column;
|
|
332
|
-
|
|
364
|
+
getColumnByTitle: (title: string) => Column;
|
|
365
|
+
getColumnByName: (name: string) => Column;
|
|
333
366
|
selectRowByIndex(index: number): Promise<void>;
|
|
334
367
|
getRows(): Promise<Row[]>;
|
|
335
368
|
getColumns(): Promise<Column[]>;
|
|
@@ -344,6 +377,84 @@ declare class Table extends AbstractElementWithParent {
|
|
|
344
377
|
field(name: string): FormField;
|
|
345
378
|
}
|
|
346
379
|
|
|
380
|
+
declare class FormFilterField extends AbstractEditor {
|
|
381
|
+
constructor(parentCssSelector: string, formName: string, name: string, driver?: WebDriver);
|
|
382
|
+
/**
|
|
383
|
+
* Возвращает значение в поле
|
|
384
|
+
* @example
|
|
385
|
+
* expect(await form.formFilter('NumberFld').getValue()).toBe(10);
|
|
386
|
+
* expect(await form.formFilter('TextFld').getValue()).toBe('TestValue');
|
|
387
|
+
*/
|
|
388
|
+
getValue(): Promise<any>;
|
|
389
|
+
/**
|
|
390
|
+
* Устанавливает значение в поле
|
|
391
|
+
* @example
|
|
392
|
+
* await form.formFilter('NumberFld').setValue(123);
|
|
393
|
+
* await form.formFilter('TextFld').setValue('TestValue');
|
|
394
|
+
*/
|
|
395
|
+
setValue(value: any): Promise<void>;
|
|
396
|
+
/**
|
|
397
|
+
* Очищает значение в поле
|
|
398
|
+
* @example
|
|
399
|
+
* await form.formFilter('NumberFld').clear();
|
|
400
|
+
*/
|
|
401
|
+
clear(): Promise<void>;
|
|
402
|
+
/**
|
|
403
|
+
* Удаляет тег по переданному тексту
|
|
404
|
+
* @example
|
|
405
|
+
* await form.formFilter('TagBox').remove('test');
|
|
406
|
+
*/
|
|
407
|
+
remove(itemText: string): Promise<void>;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
declare class PanelFilterField extends AbstractEditor {
|
|
411
|
+
constructor(parentCssSelector: string, formName: string, name: string, driver?: WebDriver);
|
|
412
|
+
/**
|
|
413
|
+
* Возвращает значение в поле
|
|
414
|
+
* @example
|
|
415
|
+
* expect(await form.filterPanel.filterField('NumberFld').getValue()).toBe(10);
|
|
416
|
+
* expect(await form.filterPanel.filterField('TextFld').getValue()).toBe('TestValue');
|
|
417
|
+
*/
|
|
418
|
+
getValue(): Promise<any>;
|
|
419
|
+
/**
|
|
420
|
+
* Устанавливает значение в поле
|
|
421
|
+
* @example
|
|
422
|
+
* await form.filterPanel.filterField('NumberFld').setValue(123);
|
|
423
|
+
* await form.filterPanel.filterField('TextFld').setValue('TestValue');
|
|
424
|
+
*/
|
|
425
|
+
setValue(value: any): Promise<void>;
|
|
426
|
+
/**
|
|
427
|
+
* Очищает значение в поле
|
|
428
|
+
* @example
|
|
429
|
+
* await form.filterPanel.filterField('NumberFld').clear();
|
|
430
|
+
*/
|
|
431
|
+
clear(): Promise<void>;
|
|
432
|
+
/**
|
|
433
|
+
* Удаляет тег по переданному тексту
|
|
434
|
+
* @example
|
|
435
|
+
* await form.filterPanel.filterField('TagBox').remove('test');
|
|
436
|
+
*/
|
|
437
|
+
remove(itemText: string): Promise<void>;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
declare class FilterPanel extends AbstractElement {
|
|
441
|
+
private _formName;
|
|
442
|
+
private get filterPanelSelector();
|
|
443
|
+
private filterPanelButtons;
|
|
444
|
+
constructor(formName: string, driver?: WebDriver);
|
|
445
|
+
/**
|
|
446
|
+
* Возвращает фильтр на панели фильтрации
|
|
447
|
+
* @returns {PanelFilterField}
|
|
448
|
+
* @example
|
|
449
|
+
* await form.filterPanel.filterField('NumberFld');
|
|
450
|
+
*/
|
|
451
|
+
filterField(name: string): PanelFilterField;
|
|
452
|
+
apply(): Promise<void>;
|
|
453
|
+
private findButtonByTitle;
|
|
454
|
+
clearAll(): Promise<void>;
|
|
455
|
+
close(): Promise<void>;
|
|
456
|
+
}
|
|
457
|
+
|
|
347
458
|
declare abstract class ListForm extends AbstractForm {
|
|
348
459
|
protected constructor(driver?: WebDriver);
|
|
349
460
|
/**
|
|
@@ -369,7 +480,24 @@ declare abstract class ListForm extends AbstractForm {
|
|
|
369
480
|
* //...
|
|
370
481
|
* expect(listForm.toolbarButton());
|
|
371
482
|
*/
|
|
372
|
-
toolbarButton(name: string):
|
|
483
|
+
toolbarButton(name: string): ToolbarItem;
|
|
484
|
+
/**
|
|
485
|
+
* Фильтр который расположен на форме
|
|
486
|
+
* @example
|
|
487
|
+
* const listForm = new MyForm();
|
|
488
|
+
* //...
|
|
489
|
+
* expect(listForm.formFilter());
|
|
490
|
+
*/
|
|
491
|
+
formFilter(name: string): FormFilterField;
|
|
492
|
+
/**
|
|
493
|
+
* Модель панели фильтрации
|
|
494
|
+
* @returns {FilterPanel}
|
|
495
|
+
* @example
|
|
496
|
+
* const listForm = new MyForm();
|
|
497
|
+
* //...
|
|
498
|
+
* expect(listForm.filterPanel());
|
|
499
|
+
*/
|
|
500
|
+
get filterPanel(): FilterPanel;
|
|
373
501
|
}
|
|
374
502
|
|
|
375
|
-
export { AbstractPage, Editor, FormEdit, FormField, ListForm, LoginPage, NumberEditor, SubsystemsPanel, TextEditor, byTestId, byTestIdCssSelector, click, config, createDriver, editorFactory, elementIsNotPresent, signIn, wait, waitElementIsVisible };
|
|
503
|
+
export { AbstractPage, Editor, FilterPanel, FormEdit, FormField, FormFilterField, ListForm, LoginPage, NumberEditor, PanelFilterField, SubsystemsPanel, TextEditor, byTestId, byTestIdCssSelector, click, config, createDriver, editorFactory, elementIsNotPresent, signIn, wait, waitElementIsVisible };
|