d5-testing-library 1.1.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 +669 -402
- package/dist/d5-testing-library.d.ts +197 -48
- package/dist/d5-testing-library.legacy-esm.js +656 -394
- package/dist/d5-testing-library.mjs +656 -394
- 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 {
|
|
@@ -44,6 +50,7 @@ declare class LoginPage extends AbstractPage {
|
|
|
44
50
|
authorize(): Promise<void>;
|
|
45
51
|
}
|
|
46
52
|
|
|
53
|
+
declare const byTestIdCssSelector: (testId: string, element?: string) => string;
|
|
47
54
|
/**
|
|
48
55
|
* Returns a By locator object that can be used to locate an element by its test ID.
|
|
49
56
|
*
|
|
@@ -83,6 +90,23 @@ interface WaitElementIsVisibleParams {
|
|
|
83
90
|
*/
|
|
84
91
|
declare function waitElementIsVisible({ element, timeout, errorMessage, driver }: WaitElementIsVisibleParams): Promise<void>;
|
|
85
92
|
|
|
93
|
+
interface WaiteParams {
|
|
94
|
+
condition: (driver?: WebDriver) => Promise<boolean>;
|
|
95
|
+
timeout?: number;
|
|
96
|
+
errorMessage?: string;
|
|
97
|
+
driver?: WebDriver;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Waits until a specified web element is visible within a given timeout.
|
|
101
|
+
*
|
|
102
|
+
* @param condition
|
|
103
|
+
* @param {number} [timeout] - The maximum time to wait for the element to be visible, in milliseconds. If not provided, the default timeout is used.
|
|
104
|
+
* @param {string} [errorMessage] - The error message to display if the wait times out. If not provided, a default error message is used.
|
|
105
|
+
* @param {WebDriver} [driver] - The web driver instance to use. If not provided, the default driver from the configuration is used.
|
|
106
|
+
* @returns {Promise<void>} A promise that resolves when the element becomes visible.
|
|
107
|
+
*/
|
|
108
|
+
declare function wait(condition: WaiteParams['condition'], driver?: WebDriver, errorMessage?: string, timeout?: number): Promise<void>;
|
|
109
|
+
|
|
86
110
|
declare function signIn(driver?: WebDriver): Promise<WebDriver>;
|
|
87
111
|
|
|
88
112
|
/**
|
|
@@ -95,16 +119,15 @@ declare function signIn(driver?: WebDriver): Promise<WebDriver>;
|
|
|
95
119
|
declare const click: (webElement: WebElement, driver?: WebDriver) => Promise<void>;
|
|
96
120
|
|
|
97
121
|
declare class SubsystemsPanel extends AbstractElement {
|
|
98
|
-
private panelBy;
|
|
99
122
|
private header;
|
|
100
123
|
constructor(driver?: WebDriver);
|
|
101
|
-
private panelElement;
|
|
102
124
|
headerTitle(): Promise<string>;
|
|
103
125
|
}
|
|
104
126
|
|
|
105
127
|
declare abstract class AbstractForm extends AbstractPage {
|
|
128
|
+
protected containerCssSelector: string;
|
|
106
129
|
protected containerBy: By;
|
|
107
|
-
protected
|
|
130
|
+
protected popupContainerCssSelector: string;
|
|
108
131
|
protected constructor(driver?: WebDriver);
|
|
109
132
|
protected isModal(): Promise<boolean>;
|
|
110
133
|
protected getContainerElement: () => selenium_webdriver.WebElementPromise;
|
|
@@ -129,12 +152,9 @@ declare abstract class AbstractForm extends AbstractPage {
|
|
|
129
152
|
}
|
|
130
153
|
|
|
131
154
|
declare abstract class AbstractElementWithParent extends AbstractElement {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
getElement(): Promise<WebElement>;
|
|
136
|
-
getAttribute(attr: string): Promise<string>;
|
|
137
|
-
getClasses(): Promise<string>;
|
|
155
|
+
protected parentCssSelector: string;
|
|
156
|
+
constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
|
|
157
|
+
protected getFullCssSelector(): string;
|
|
138
158
|
}
|
|
139
159
|
|
|
140
160
|
interface Editor {
|
|
@@ -144,17 +164,14 @@ interface Editor {
|
|
|
144
164
|
clear?(): Promise<void>;
|
|
145
165
|
}
|
|
146
166
|
|
|
147
|
-
declare class AbstractFormElement extends AbstractElementWithParent {
|
|
148
|
-
constructor(getParentElement: () => Promise<WebElement>, elementBy: By, driver?: WebDriver);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
167
|
interface ClearStrategy {
|
|
152
|
-
clear(editor:
|
|
168
|
+
clear(editor: Editor): Promise<void>;
|
|
153
169
|
}
|
|
154
170
|
|
|
155
|
-
declare abstract class AbstractDXEditorWithInput extends
|
|
171
|
+
declare abstract class AbstractDXEditorWithInput extends AbstractElementWithParent implements Editor {
|
|
156
172
|
private clearStrategy;
|
|
157
173
|
protected setClearStrategy(strategy: ClearStrategy): void;
|
|
174
|
+
protected getInputCssSelector(): string;
|
|
158
175
|
getInputElement(): Promise<selenium_webdriver.WebElement>;
|
|
159
176
|
protected getInputValue(): Promise<string>;
|
|
160
177
|
protected setInputValue(value: string): Promise<void>;
|
|
@@ -164,23 +181,23 @@ declare abstract class AbstractDXEditorWithInput extends AbstractFormElement imp
|
|
|
164
181
|
}
|
|
165
182
|
|
|
166
183
|
declare class TextEditor extends AbstractDXEditorWithInput {
|
|
167
|
-
constructor(
|
|
184
|
+
constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
|
|
168
185
|
getValue(): Promise<string>;
|
|
169
186
|
setValue(value: string): Promise<void>;
|
|
170
187
|
}
|
|
171
188
|
|
|
172
189
|
declare class NumberEditor extends AbstractDXEditorWithInput {
|
|
173
|
-
constructor(
|
|
190
|
+
constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
|
|
174
191
|
getValue(): Promise<number | null>;
|
|
175
192
|
setValue(value: any): Promise<void>;
|
|
176
193
|
}
|
|
177
194
|
|
|
178
|
-
declare const editorFactory: (
|
|
195
|
+
declare const editorFactory: (parentCssSelector: string, elementCssSelector: string, driver: WebDriver) => Promise<Editor>;
|
|
179
196
|
|
|
180
|
-
declare class
|
|
181
|
-
editor: Editor;
|
|
182
|
-
constructor(
|
|
183
|
-
|
|
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>;
|
|
184
201
|
/**
|
|
185
202
|
* Возвращает значение в поле
|
|
186
203
|
* @example
|
|
@@ -209,13 +226,17 @@ declare class FormField extends AbstractElementWithParent implements Editor {
|
|
|
209
226
|
remove(itemText: string): Promise<void>;
|
|
210
227
|
}
|
|
211
228
|
|
|
229
|
+
declare class FormField extends AbstractEditor {
|
|
230
|
+
constructor(parentCssSelector: string, formName: string, name: string, driver?: WebDriver);
|
|
231
|
+
}
|
|
232
|
+
|
|
212
233
|
interface Group {
|
|
213
234
|
isDisplayed(): Promise<boolean>;
|
|
214
235
|
}
|
|
215
236
|
|
|
216
237
|
declare class FormGroup extends AbstractElementWithParent implements Group {
|
|
217
238
|
editor: Group;
|
|
218
|
-
constructor(
|
|
239
|
+
constructor(parentCssSelector: string, formName: string, name: string, driver?: WebDriver);
|
|
219
240
|
private initEditor;
|
|
220
241
|
/**
|
|
221
242
|
* Возвращает булевое значение доступна ли группа
|
|
@@ -262,33 +283,67 @@ declare abstract class FormEdit extends AbstractForm {
|
|
|
262
283
|
saveButtonClick(): Promise<void>;
|
|
263
284
|
}
|
|
264
285
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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;
|
|
268
296
|
click(): Promise<void>;
|
|
269
297
|
isDisabled(): Promise<boolean>;
|
|
270
298
|
}
|
|
271
299
|
|
|
272
300
|
declare class Cell extends AbstractElementWithParent {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
301
|
+
private _index;
|
|
302
|
+
private getCellIndex;
|
|
303
|
+
constructor(parentCssSelector: string, getCellIndex: () => Promise<number>, index?: number, driver?: WebDriver);
|
|
304
|
+
private set index(value);
|
|
305
|
+
private getBooleanValue;
|
|
306
|
+
getElement(): Promise<WebElement>;
|
|
307
|
+
getValue(): Promise<string | 1 | 0>;
|
|
276
308
|
getIndex(): number;
|
|
277
309
|
}
|
|
278
310
|
|
|
311
|
+
interface ConstructorParams {
|
|
312
|
+
parentCssSelector: string;
|
|
313
|
+
name?: string;
|
|
314
|
+
caption?: string;
|
|
315
|
+
index?: number;
|
|
316
|
+
driver?: WebDriver;
|
|
317
|
+
}
|
|
279
318
|
declare class Column extends AbstractElementWithParent {
|
|
280
|
-
|
|
281
|
-
|
|
319
|
+
private _index;
|
|
320
|
+
private _caption;
|
|
321
|
+
private _name;
|
|
322
|
+
constructor({ parentCssSelector, name, caption, index, driver }: ConstructorParams);
|
|
323
|
+
private set index(value);
|
|
324
|
+
private get index();
|
|
325
|
+
getElement(): Promise<WebElement>;
|
|
326
|
+
private getColumnHeaderIndexBy;
|
|
327
|
+
private getIndexByCaption;
|
|
328
|
+
private getIndexByName;
|
|
282
329
|
caption(): Promise<string>;
|
|
283
|
-
getIndex(): number
|
|
330
|
+
getIndex(): Promise<number>;
|
|
284
331
|
}
|
|
285
332
|
|
|
286
333
|
declare class Row extends AbstractElementWithParent {
|
|
287
334
|
index: number;
|
|
288
|
-
protected
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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);
|
|
343
|
+
private _getCell;
|
|
344
|
+
getCellByIndex(index: number): Cell;
|
|
345
|
+
getCell(name: string): Cell;
|
|
346
|
+
getCellByTitle(title: string): Cell;
|
|
292
347
|
select(): Promise<void>;
|
|
293
348
|
isSelected(): Promise<boolean>;
|
|
294
349
|
getIndex(): number;
|
|
@@ -302,17 +357,16 @@ declare class Row extends AbstractElementWithParent {
|
|
|
302
357
|
|
|
303
358
|
declare class Table extends AbstractElementWithParent {
|
|
304
359
|
protected formName: string;
|
|
305
|
-
constructor(
|
|
306
|
-
private
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
getColumnByCaption(caption: string): Promise<Column>;
|
|
360
|
+
constructor(parentCssSelector: string, formName: string, driver?: WebDriver);
|
|
361
|
+
private getColumnBy;
|
|
362
|
+
getRowByIndex(index: number): Row;
|
|
363
|
+
getColumnByIndex(index: number): Column;
|
|
364
|
+
getColumnByTitle: (title: string) => Column;
|
|
365
|
+
getColumnByName: (name: string) => Column;
|
|
312
366
|
selectRowByIndex(index: number): Promise<void>;
|
|
313
367
|
getRows(): Promise<Row[]>;
|
|
314
368
|
getColumns(): Promise<Column[]>;
|
|
315
|
-
element(): Promise<WebElement>;
|
|
369
|
+
element(): Promise<selenium_webdriver.WebElement>;
|
|
316
370
|
/**
|
|
317
371
|
* Находит поле когда форма находится в состоянии редактирования
|
|
318
372
|
* @example
|
|
@@ -323,6 +377,84 @@ declare class Table extends AbstractElementWithParent {
|
|
|
323
377
|
field(name: string): FormField;
|
|
324
378
|
}
|
|
325
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
|
+
|
|
326
458
|
declare abstract class ListForm extends AbstractForm {
|
|
327
459
|
protected constructor(driver?: WebDriver);
|
|
328
460
|
/**
|
|
@@ -348,7 +480,24 @@ declare abstract class ListForm extends AbstractForm {
|
|
|
348
480
|
* //...
|
|
349
481
|
* expect(listForm.toolbarButton());
|
|
350
482
|
*/
|
|
351
|
-
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;
|
|
352
501
|
}
|
|
353
502
|
|
|
354
|
-
export { AbstractPage, Editor, FormEdit, FormField, ListForm, LoginPage, NumberEditor, SubsystemsPanel, TextEditor, byTestId, click, config, createDriver, editorFactory, elementIsNotPresent, signIn, 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 };
|