d5-testing-library 1.2.0 → 1.3.1
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 +618 -155
- package/dist/d5-testing-library.d.ts +205 -22
- package/dist/d5-testing-library.legacy-esm.js +609 -151
- package/dist/d5-testing-library.mjs +609 -151
- 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,14 @@ 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
|
+
protected joinRelativeCssSelectors(selectors: string[]): string;
|
|
24
|
+
getElement(): Promise<WebElement>;
|
|
25
|
+
getAttribute(attr: string): Promise<string>;
|
|
26
|
+
getClasses(): Promise<string>;
|
|
27
|
+
getDataTestId(): Promise<string>;
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
declare abstract class AbstractPage extends AbstractElement {
|
|
@@ -53,6 +60,7 @@ declare const byTestIdCssSelector: (testId: string, element?: string) => string;
|
|
|
53
60
|
* @returns {By} - The By locator object.
|
|
54
61
|
*/
|
|
55
62
|
declare const byTestId: (testId: string, element?: string) => By;
|
|
63
|
+
declare const readonlyLocator = "readonly";
|
|
56
64
|
|
|
57
65
|
/**
|
|
58
66
|
* Creates a WebDriver instance for the specified browser.
|
|
@@ -146,13 +154,10 @@ declare abstract class AbstractForm extends AbstractPage {
|
|
|
146
154
|
}
|
|
147
155
|
|
|
148
156
|
declare abstract class AbstractElementWithParent extends AbstractElement {
|
|
149
|
-
protected elementCssSelector: string;
|
|
150
157
|
protected parentCssSelector: string;
|
|
151
158
|
constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
|
|
152
159
|
protected getFullCssSelector(): string;
|
|
153
|
-
|
|
154
|
-
getAttribute(attr: string): Promise<string>;
|
|
155
|
-
getClasses(): Promise<string>;
|
|
160
|
+
isReadonly(): Promise<boolean>;
|
|
156
161
|
}
|
|
157
162
|
|
|
158
163
|
interface Editor {
|
|
@@ -160,10 +165,11 @@ interface Editor {
|
|
|
160
165
|
getValue(): Promise<any>;
|
|
161
166
|
remove?(itemText: string): Promise<void>;
|
|
162
167
|
clear?(): Promise<void>;
|
|
168
|
+
isReadonly?(): Promise<boolean>;
|
|
163
169
|
}
|
|
164
170
|
|
|
165
171
|
interface ClearStrategy {
|
|
166
|
-
clear(editor:
|
|
172
|
+
clear(editor: Editor): Promise<void>;
|
|
167
173
|
}
|
|
168
174
|
|
|
169
175
|
declare abstract class AbstractDXEditorWithInput extends AbstractElementWithParent implements Editor {
|
|
@@ -192,10 +198,10 @@ declare class NumberEditor extends AbstractDXEditorWithInput {
|
|
|
192
198
|
|
|
193
199
|
declare const editorFactory: (parentCssSelector: string, elementCssSelector: string, driver: WebDriver) => Promise<Editor>;
|
|
194
200
|
|
|
195
|
-
declare class
|
|
196
|
-
editor: Editor;
|
|
197
|
-
constructor(parentCssSelector: string,
|
|
198
|
-
|
|
201
|
+
declare class AbstractEditor extends AbstractElementWithParent implements Editor {
|
|
202
|
+
protected editor: Editor;
|
|
203
|
+
constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
|
|
204
|
+
protected initEditor(): Promise<void>;
|
|
199
205
|
/**
|
|
200
206
|
* Возвращает значение в поле
|
|
201
207
|
* @example
|
|
@@ -222,6 +228,17 @@ declare class FormField extends AbstractElementWithParent implements Editor {
|
|
|
222
228
|
* await formEdit.field('TagBox').remove('test');
|
|
223
229
|
*/
|
|
224
230
|
remove(itemText: string): Promise<void>;
|
|
231
|
+
/**
|
|
232
|
+
* Возвращает значение true|false в зависимости readOnly поле или нет
|
|
233
|
+
* @example
|
|
234
|
+
* expect(await formEdit.field('NumberFld').isReadonly()).toBe(true);
|
|
235
|
+
* expect(await formEdit.field('TextFld').isReadonly()).toBe(false);
|
|
236
|
+
*/
|
|
237
|
+
isReadonly(): Promise<boolean>;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
declare class FormField extends AbstractEditor {
|
|
241
|
+
constructor(parentCssSelector: string, formName: string, name: string, driver?: WebDriver);
|
|
225
242
|
}
|
|
226
243
|
|
|
227
244
|
interface Group {
|
|
@@ -242,6 +259,7 @@ declare class FormGroup extends AbstractElementWithParent implements Group {
|
|
|
242
259
|
|
|
243
260
|
declare abstract class FormEdit extends AbstractForm {
|
|
244
261
|
saveButtonBy: By;
|
|
262
|
+
closeButtonBy: By;
|
|
245
263
|
protected constructor(driver?: WebDriver);
|
|
246
264
|
/**
|
|
247
265
|
* Находит поле формы редактирования по имени
|
|
@@ -275,13 +293,47 @@ declare abstract class FormEdit extends AbstractForm {
|
|
|
275
293
|
* await formEdit.saveButtonClick();
|
|
276
294
|
*/
|
|
277
295
|
saveButtonClick(): Promise<void>;
|
|
296
|
+
/**
|
|
297
|
+
* Нажатие на кнопку Закрить
|
|
298
|
+
* @example
|
|
299
|
+
* const formEdit = new MyForm();
|
|
300
|
+
* //...
|
|
301
|
+
* await formEdit.closeButtonClick();
|
|
302
|
+
*/
|
|
303
|
+
closeButtonClick(): Promise<void>;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
interface Button {
|
|
307
|
+
click(): Promise<void>;
|
|
308
|
+
isDisabled(): Promise<boolean>;
|
|
309
|
+
}
|
|
310
|
+
declare abstract class AbstractButton extends AbstractElementWithParent implements Button {
|
|
311
|
+
protected constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
|
|
312
|
+
protected abstract buttonNotDisplayedError(): string;
|
|
313
|
+
click(): Promise<void>;
|
|
314
|
+
isDisabled(): Promise<boolean>;
|
|
278
315
|
}
|
|
279
316
|
|
|
280
|
-
declare class
|
|
281
|
-
private readonly
|
|
282
|
-
constructor(parentCssSelector: string, name: string, driver?: WebDriver);
|
|
317
|
+
declare class ToolbarMenu extends AbstractElementWithParent {
|
|
318
|
+
private readonly _formName;
|
|
319
|
+
constructor(parentCssSelector: string, formName: string, name: string, driver?: WebDriver);
|
|
320
|
+
protected toggle(): Promise<void>;
|
|
321
|
+
protected getCssSelectorToButton(name: string): By;
|
|
322
|
+
protected buttonNotDisplayedError(name: string): string;
|
|
323
|
+
protected goToButton(name: string, selector: By): Promise<void>;
|
|
324
|
+
clickButton(name: string | string[]): Promise<void>;
|
|
325
|
+
clickButtonByTitle(title: string | string[]): Promise<void>;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
declare class ToolbarItem extends AbstractElementWithParent implements Button {
|
|
329
|
+
private _button;
|
|
330
|
+
private readonly _formName;
|
|
331
|
+
private readonly _itemName;
|
|
332
|
+
constructor(parentCssSelector: string, formName: string, itemName: string, driver?: WebDriver);
|
|
333
|
+
private init;
|
|
283
334
|
click(): Promise<void>;
|
|
284
335
|
isDisabled(): Promise<boolean>;
|
|
336
|
+
get menu(): ToolbarMenu;
|
|
285
337
|
}
|
|
286
338
|
|
|
287
339
|
declare class Cell extends AbstractElementWithParent {
|
|
@@ -289,30 +341,48 @@ declare class Cell extends AbstractElementWithParent {
|
|
|
289
341
|
private getCellIndex;
|
|
290
342
|
constructor(parentCssSelector: string, getCellIndex: () => Promise<number>, index?: number, driver?: WebDriver);
|
|
291
343
|
private set index(value);
|
|
344
|
+
private getBooleanValue;
|
|
292
345
|
getElement(): Promise<WebElement>;
|
|
293
|
-
getValue(): Promise<string>;
|
|
346
|
+
getValue(): Promise<string | 1 | 0>;
|
|
294
347
|
getIndex(): number;
|
|
295
348
|
}
|
|
296
349
|
|
|
350
|
+
interface ConstructorParams {
|
|
351
|
+
parentCssSelector: string;
|
|
352
|
+
name?: string;
|
|
353
|
+
caption?: string;
|
|
354
|
+
index?: number;
|
|
355
|
+
driver?: WebDriver;
|
|
356
|
+
}
|
|
297
357
|
declare class Column extends AbstractElementWithParent {
|
|
298
358
|
private _index;
|
|
299
359
|
private _caption;
|
|
300
|
-
|
|
360
|
+
private _name;
|
|
361
|
+
constructor({ parentCssSelector, name, caption, index, driver }: ConstructorParams);
|
|
301
362
|
private set index(value);
|
|
302
363
|
private get index();
|
|
303
364
|
getElement(): Promise<WebElement>;
|
|
365
|
+
private getColumnHeaderIndexBy;
|
|
304
366
|
private getIndexByCaption;
|
|
367
|
+
private getIndexByName;
|
|
305
368
|
caption(): Promise<string>;
|
|
306
369
|
getIndex(): Promise<number>;
|
|
307
370
|
}
|
|
308
371
|
|
|
309
372
|
declare class Row extends AbstractElementWithParent {
|
|
310
373
|
index: number;
|
|
311
|
-
protected
|
|
312
|
-
|
|
374
|
+
protected getColumnBy: (_: {
|
|
375
|
+
title?: string;
|
|
376
|
+
name?: string;
|
|
377
|
+
}) => Column;
|
|
378
|
+
constructor(parentCssSelector: string, index: number, driver?: WebDriver, getColumnBy?: (_: {
|
|
379
|
+
title?: string;
|
|
380
|
+
name?: string;
|
|
381
|
+
}) => Column);
|
|
313
382
|
private _getCell;
|
|
314
383
|
getCellByIndex(index: number): Cell;
|
|
315
|
-
getCell(
|
|
384
|
+
getCell(name: string): Cell;
|
|
385
|
+
getCellByTitle(title: string): Cell;
|
|
316
386
|
select(): Promise<void>;
|
|
317
387
|
isSelected(): Promise<boolean>;
|
|
318
388
|
getIndex(): number;
|
|
@@ -327,9 +397,11 @@ declare class Row extends AbstractElementWithParent {
|
|
|
327
397
|
declare class Table extends AbstractElementWithParent {
|
|
328
398
|
protected formName: string;
|
|
329
399
|
constructor(parentCssSelector: string, formName: string, driver?: WebDriver);
|
|
400
|
+
private getColumnBy;
|
|
330
401
|
getRowByIndex(index: number): Row;
|
|
331
402
|
getColumnByIndex(index: number): Column;
|
|
332
|
-
|
|
403
|
+
getColumnByTitle: (title: string) => Column;
|
|
404
|
+
getColumnByName: (name: string) => Column;
|
|
333
405
|
selectRowByIndex(index: number): Promise<void>;
|
|
334
406
|
getRows(): Promise<Row[]>;
|
|
335
407
|
getColumns(): Promise<Column[]>;
|
|
@@ -344,6 +416,84 @@ declare class Table extends AbstractElementWithParent {
|
|
|
344
416
|
field(name: string): FormField;
|
|
345
417
|
}
|
|
346
418
|
|
|
419
|
+
declare class FormFilterField extends AbstractEditor {
|
|
420
|
+
constructor(parentCssSelector: string, formName: string, name: string, driver?: WebDriver);
|
|
421
|
+
/**
|
|
422
|
+
* Возвращает значение в поле
|
|
423
|
+
* @example
|
|
424
|
+
* expect(await form.formFilter('NumberFld').getValue()).toBe(10);
|
|
425
|
+
* expect(await form.formFilter('TextFld').getValue()).toBe('TestValue');
|
|
426
|
+
*/
|
|
427
|
+
getValue(): Promise<any>;
|
|
428
|
+
/**
|
|
429
|
+
* Устанавливает значение в поле
|
|
430
|
+
* @example
|
|
431
|
+
* await form.formFilter('NumberFld').setValue(123);
|
|
432
|
+
* await form.formFilter('TextFld').setValue('TestValue');
|
|
433
|
+
*/
|
|
434
|
+
setValue(value: any): Promise<void>;
|
|
435
|
+
/**
|
|
436
|
+
* Очищает значение в поле
|
|
437
|
+
* @example
|
|
438
|
+
* await form.formFilter('NumberFld').clear();
|
|
439
|
+
*/
|
|
440
|
+
clear(): Promise<void>;
|
|
441
|
+
/**
|
|
442
|
+
* Удаляет тег по переданному тексту
|
|
443
|
+
* @example
|
|
444
|
+
* await form.formFilter('TagBox').remove('test');
|
|
445
|
+
*/
|
|
446
|
+
remove(itemText: string): Promise<void>;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
declare class PanelFilterField extends AbstractEditor {
|
|
450
|
+
constructor(parentCssSelector: string, formName: string, name: string, driver?: WebDriver);
|
|
451
|
+
/**
|
|
452
|
+
* Возвращает значение в поле
|
|
453
|
+
* @example
|
|
454
|
+
* expect(await form.filterPanel.filterField('NumberFld').getValue()).toBe(10);
|
|
455
|
+
* expect(await form.filterPanel.filterField('TextFld').getValue()).toBe('TestValue');
|
|
456
|
+
*/
|
|
457
|
+
getValue(): Promise<any>;
|
|
458
|
+
/**
|
|
459
|
+
* Устанавливает значение в поле
|
|
460
|
+
* @example
|
|
461
|
+
* await form.filterPanel.filterField('NumberFld').setValue(123);
|
|
462
|
+
* await form.filterPanel.filterField('TextFld').setValue('TestValue');
|
|
463
|
+
*/
|
|
464
|
+
setValue(value: any): Promise<void>;
|
|
465
|
+
/**
|
|
466
|
+
* Очищает значение в поле
|
|
467
|
+
* @example
|
|
468
|
+
* await form.filterPanel.filterField('NumberFld').clear();
|
|
469
|
+
*/
|
|
470
|
+
clear(): Promise<void>;
|
|
471
|
+
/**
|
|
472
|
+
* Удаляет тег по переданному тексту
|
|
473
|
+
* @example
|
|
474
|
+
* await form.filterPanel.filterField('TagBox').remove('test');
|
|
475
|
+
*/
|
|
476
|
+
remove(itemText: string): Promise<void>;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
declare class FilterPanel extends AbstractElement {
|
|
480
|
+
private _formName;
|
|
481
|
+
private get filterPanelSelector();
|
|
482
|
+
private filterPanelButtons;
|
|
483
|
+
constructor(formName: string, driver?: WebDriver);
|
|
484
|
+
/**
|
|
485
|
+
* Возвращает фильтр на панели фильтрации
|
|
486
|
+
* @returns {PanelFilterField}
|
|
487
|
+
* @example
|
|
488
|
+
* await form.filterPanel.filterField('NumberFld');
|
|
489
|
+
*/
|
|
490
|
+
filterField(name: string): PanelFilterField;
|
|
491
|
+
apply(): Promise<void>;
|
|
492
|
+
private findButtonByTitle;
|
|
493
|
+
clearAll(): Promise<void>;
|
|
494
|
+
close(): Promise<void>;
|
|
495
|
+
}
|
|
496
|
+
|
|
347
497
|
declare abstract class ListForm extends AbstractForm {
|
|
348
498
|
protected constructor(driver?: WebDriver);
|
|
349
499
|
/**
|
|
@@ -369,7 +519,40 @@ declare abstract class ListForm extends AbstractForm {
|
|
|
369
519
|
* //...
|
|
370
520
|
* expect(listForm.toolbarButton());
|
|
371
521
|
*/
|
|
372
|
-
toolbarButton(name: string):
|
|
522
|
+
toolbarButton(name: string): ToolbarItem;
|
|
523
|
+
/**
|
|
524
|
+
* Фильтр который расположен на форме
|
|
525
|
+
* @example
|
|
526
|
+
* const listForm = new MyForm();
|
|
527
|
+
* //...
|
|
528
|
+
* expect(listForm.formFilter());
|
|
529
|
+
*/
|
|
530
|
+
formFilter(name: string): FormFilterField;
|
|
531
|
+
/**
|
|
532
|
+
* Модель панели фильтрации
|
|
533
|
+
* @returns {FilterPanel}
|
|
534
|
+
* @example
|
|
535
|
+
* const listForm = new MyForm();
|
|
536
|
+
* //...
|
|
537
|
+
* expect(listForm.filterPanel());
|
|
538
|
+
*/
|
|
539
|
+
get filterPanel(): FilterPanel;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
declare class DialogButton extends AbstractButton implements Button {
|
|
543
|
+
private readonly text;
|
|
544
|
+
constructor(parentCssSelector: string, text: string, driver?: WebDriver);
|
|
545
|
+
getElement(): Promise<WebElement>;
|
|
546
|
+
protected buttonNotDisplayedError(): string;
|
|
547
|
+
}
|
|
548
|
+
declare class Dialog extends AbstractElement {
|
|
549
|
+
constructor(driver?: WebDriver);
|
|
550
|
+
private get titleSelector();
|
|
551
|
+
private get textSelector();
|
|
552
|
+
private get buttonsSelector();
|
|
553
|
+
title(): Promise<string>;
|
|
554
|
+
text(): Promise<string>;
|
|
555
|
+
button(text: string): DialogButton;
|
|
373
556
|
}
|
|
374
557
|
|
|
375
|
-
export { AbstractPage, Editor, FormEdit, FormField, ListForm, LoginPage, NumberEditor, SubsystemsPanel, TextEditor, byTestId, byTestIdCssSelector, click, config, createDriver, editorFactory, elementIsNotPresent, signIn, wait, waitElementIsVisible };
|
|
558
|
+
export { AbstractPage, Dialog, Editor, FilterPanel, FormEdit, FormField, FormFilterField, ListForm, LoginPage, NumberEditor, PanelFilterField, SubsystemsPanel, TextEditor, byTestId, byTestIdCssSelector, click, config, createDriver, editorFactory, elementIsNotPresent, readonlyLocator, signIn, wait, waitElementIsVisible };
|