d5-testing-library 1.0.5 → 1.2.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 +578 -231
- package/dist/d5-testing-library.d.ts +140 -33
- package/dist/d5-testing-library.legacy-esm.js +572 -228
- package/dist/d5-testing-library.mjs +572 -228
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as selenium_webdriver from 'selenium-webdriver';
|
|
2
|
-
import { WebDriver, Browser, By, Condition, WebElement
|
|
2
|
+
import { WebDriver, Browser, By, Condition, WebElement } from 'selenium-webdriver';
|
|
3
3
|
|
|
4
4
|
type DriverType = typeof Browser;
|
|
5
5
|
type BrowserList = DriverType[keyof DriverType];
|
|
@@ -16,7 +16,7 @@ type IConfig = {
|
|
|
16
16
|
declare function config(cfg?: IConfig): IConfig;
|
|
17
17
|
|
|
18
18
|
declare abstract class AbstractElement {
|
|
19
|
-
|
|
19
|
+
driver: WebDriver;
|
|
20
20
|
protected constructor(driver?: WebDriver);
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -35,6 +35,7 @@ declare class LoginPage extends AbstractPage {
|
|
|
35
35
|
usernameField: selenium_webdriver.By;
|
|
36
36
|
passwordField: selenium_webdriver.By;
|
|
37
37
|
loginButton: selenium_webdriver.By;
|
|
38
|
+
locate(): Promise<void>;
|
|
38
39
|
get path(): string;
|
|
39
40
|
enterUsername(username: string): Promise<void>;
|
|
40
41
|
enterPassword(password: string): Promise<void>;
|
|
@@ -43,6 +44,7 @@ declare class LoginPage extends AbstractPage {
|
|
|
43
44
|
authorize(): Promise<void>;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
declare const byTestIdCssSelector: (testId: string, element?: string) => string;
|
|
46
48
|
/**
|
|
47
49
|
* Returns a By locator object that can be used to locate an element by its test ID.
|
|
48
50
|
*
|
|
@@ -64,6 +66,41 @@ declare const createDriver: (browser?: BrowserList) => Promise<WebDriver>;
|
|
|
64
66
|
|
|
65
67
|
declare const elementIsNotPresent: (locator: By) => Condition<boolean>;
|
|
66
68
|
|
|
69
|
+
interface WaitElementIsVisibleParams {
|
|
70
|
+
element: WebElement;
|
|
71
|
+
timeout?: number;
|
|
72
|
+
errorMessage?: string;
|
|
73
|
+
driver?: WebDriver;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Waits until a specified web element is visible within a given timeout.
|
|
77
|
+
*
|
|
78
|
+
* @param {WaitElementIsVisibleParams} params - The parameters for the wait function.
|
|
79
|
+
* @param {WebElement} params.element - The web element to wait for visibility.
|
|
80
|
+
* @param {number} [params.timeout] - The maximum time to wait for the element to be visible, in milliseconds. If not provided, the default timeout is used.
|
|
81
|
+
* @param {string} [params.errorMessage] - The error message to display if the wait times out. If not provided, a default error message is used.
|
|
82
|
+
* @param {WebDriver} [params.driver] - The web driver instance to use. If not provided, the default driver from the configuration is used.
|
|
83
|
+
* @returns {Promise<void>} A promise that resolves when the element becomes visible.
|
|
84
|
+
*/
|
|
85
|
+
declare function waitElementIsVisible({ element, timeout, errorMessage, driver }: WaitElementIsVisibleParams): Promise<void>;
|
|
86
|
+
|
|
87
|
+
interface WaiteParams {
|
|
88
|
+
condition: (driver?: WebDriver) => Promise<boolean>;
|
|
89
|
+
timeout?: number;
|
|
90
|
+
errorMessage?: string;
|
|
91
|
+
driver?: WebDriver;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Waits until a specified web element is visible within a given timeout.
|
|
95
|
+
*
|
|
96
|
+
* @param condition
|
|
97
|
+
* @param {number} [timeout] - The maximum time to wait for the element to be visible, in milliseconds. If not provided, the default timeout is used.
|
|
98
|
+
* @param {string} [errorMessage] - The error message to display if the wait times out. If not provided, a default error message is used.
|
|
99
|
+
* @param {WebDriver} [driver] - The web driver instance to use. If not provided, the default driver from the configuration is used.
|
|
100
|
+
* @returns {Promise<void>} A promise that resolves when the element becomes visible.
|
|
101
|
+
*/
|
|
102
|
+
declare function wait(condition: WaiteParams['condition'], driver?: WebDriver, errorMessage?: string, timeout?: number): Promise<void>;
|
|
103
|
+
|
|
67
104
|
declare function signIn(driver?: WebDriver): Promise<WebDriver>;
|
|
68
105
|
|
|
69
106
|
/**
|
|
@@ -76,16 +113,15 @@ declare function signIn(driver?: WebDriver): Promise<WebDriver>;
|
|
|
76
113
|
declare const click: (webElement: WebElement, driver?: WebDriver) => Promise<void>;
|
|
77
114
|
|
|
78
115
|
declare class SubsystemsPanel extends AbstractElement {
|
|
79
|
-
private panelBy;
|
|
80
116
|
private header;
|
|
81
117
|
constructor(driver?: WebDriver);
|
|
82
|
-
private panelElement;
|
|
83
118
|
headerTitle(): Promise<string>;
|
|
84
119
|
}
|
|
85
120
|
|
|
86
121
|
declare abstract class AbstractForm extends AbstractPage {
|
|
122
|
+
protected containerCssSelector: string;
|
|
87
123
|
protected containerBy: By;
|
|
88
|
-
protected
|
|
124
|
+
protected popupContainerCssSelector: string;
|
|
89
125
|
protected constructor(driver?: WebDriver);
|
|
90
126
|
protected isModal(): Promise<boolean>;
|
|
91
127
|
protected getContainerElement: () => selenium_webdriver.WebElementPromise;
|
|
@@ -110,44 +146,55 @@ declare abstract class AbstractForm extends AbstractPage {
|
|
|
110
146
|
}
|
|
111
147
|
|
|
112
148
|
declare abstract class AbstractElementWithParent extends AbstractElement {
|
|
113
|
-
protected
|
|
114
|
-
protected
|
|
115
|
-
constructor(
|
|
149
|
+
protected elementCssSelector: string;
|
|
150
|
+
protected parentCssSelector: string;
|
|
151
|
+
constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
|
|
152
|
+
protected getFullCssSelector(): string;
|
|
116
153
|
getElement(): Promise<WebElement>;
|
|
154
|
+
getAttribute(attr: string): Promise<string>;
|
|
155
|
+
getClasses(): Promise<string>;
|
|
117
156
|
}
|
|
118
157
|
|
|
119
158
|
interface Editor {
|
|
120
159
|
setValue(value: any): Promise<void>;
|
|
121
160
|
getValue(): Promise<any>;
|
|
161
|
+
remove?(itemText: string): Promise<void>;
|
|
162
|
+
clear?(): Promise<void>;
|
|
122
163
|
}
|
|
123
164
|
|
|
124
|
-
|
|
125
|
-
|
|
165
|
+
interface ClearStrategy {
|
|
166
|
+
clear(editor: AbstractDXEditorWithInput): Promise<void>;
|
|
126
167
|
}
|
|
127
168
|
|
|
128
|
-
declare abstract class AbstractDXEditorWithInput extends
|
|
129
|
-
|
|
169
|
+
declare abstract class AbstractDXEditorWithInput extends AbstractElementWithParent implements Editor {
|
|
170
|
+
private clearStrategy;
|
|
171
|
+
protected setClearStrategy(strategy: ClearStrategy): void;
|
|
172
|
+
protected getInputCssSelector(): string;
|
|
173
|
+
getInputElement(): Promise<selenium_webdriver.WebElement>;
|
|
130
174
|
protected getInputValue(): Promise<string>;
|
|
131
175
|
protected setInputValue(value: string): Promise<void>;
|
|
176
|
+
clear(): Promise<void>;
|
|
132
177
|
abstract setValue(value: any): Promise<void>;
|
|
133
178
|
abstract getValue(): Promise<any>;
|
|
134
179
|
}
|
|
135
180
|
|
|
136
181
|
declare class TextEditor extends AbstractDXEditorWithInput {
|
|
182
|
+
constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
|
|
137
183
|
getValue(): Promise<string>;
|
|
138
184
|
setValue(value: string): Promise<void>;
|
|
139
185
|
}
|
|
140
186
|
|
|
141
187
|
declare class NumberEditor extends AbstractDXEditorWithInput {
|
|
188
|
+
constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
|
|
142
189
|
getValue(): Promise<number | null>;
|
|
143
190
|
setValue(value: any): Promise<void>;
|
|
144
191
|
}
|
|
145
192
|
|
|
146
|
-
declare const editorFactory: (
|
|
193
|
+
declare const editorFactory: (parentCssSelector: string, elementCssSelector: string, driver: WebDriver) => Promise<Editor>;
|
|
147
194
|
|
|
148
195
|
declare class FormField extends AbstractElementWithParent implements Editor {
|
|
149
196
|
editor: Editor;
|
|
150
|
-
constructor(
|
|
197
|
+
constructor(parentCssSelector: string, formName: string, name: string, driver?: WebDriver);
|
|
151
198
|
private initEditor;
|
|
152
199
|
/**
|
|
153
200
|
* Возвращает значение в поле
|
|
@@ -163,6 +210,34 @@ declare class FormField extends AbstractElementWithParent implements Editor {
|
|
|
163
210
|
* await formEdit.field('TextFld').setValue('TestValue');
|
|
164
211
|
*/
|
|
165
212
|
setValue(value: any): Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* Очищает значение в поле
|
|
215
|
+
* @example
|
|
216
|
+
* await formEdit.field('NumberFld').clear();
|
|
217
|
+
*/
|
|
218
|
+
clear(): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* Удаляет тег по переданному тексту
|
|
221
|
+
* @example
|
|
222
|
+
* await formEdit.field('TagBox').remove('test');
|
|
223
|
+
*/
|
|
224
|
+
remove(itemText: string): Promise<void>;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
interface Group {
|
|
228
|
+
isDisplayed(): Promise<boolean>;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
declare class FormGroup extends AbstractElementWithParent implements Group {
|
|
232
|
+
editor: Group;
|
|
233
|
+
constructor(parentCssSelector: string, formName: string, name: string, driver?: WebDriver);
|
|
234
|
+
private initEditor;
|
|
235
|
+
/**
|
|
236
|
+
* Возвращает булевое значение доступна ли группа
|
|
237
|
+
* @example
|
|
238
|
+
* expect(await tableList.group('MainSuperPanel').isDisplayed();
|
|
239
|
+
*/
|
|
240
|
+
isDisplayed(): Promise<boolean>;
|
|
166
241
|
}
|
|
167
242
|
|
|
168
243
|
declare abstract class FormEdit extends AbstractForm {
|
|
@@ -176,6 +251,22 @@ declare abstract class FormEdit extends AbstractForm {
|
|
|
176
251
|
* expect(await formEdit.field('Name').getValue()).toBe('test value');
|
|
177
252
|
*/
|
|
178
253
|
field(name: string): FormField;
|
|
254
|
+
/**
|
|
255
|
+
* Проверяет не отключена ли кнопка Сохранить
|
|
256
|
+
* @example
|
|
257
|
+
* const formEdit = new MyForm();
|
|
258
|
+
* //...
|
|
259
|
+
* await formEdit.isSaveButtonDisabled();
|
|
260
|
+
*/
|
|
261
|
+
isSaveButtonDisabled(): Promise<boolean>;
|
|
262
|
+
/**
|
|
263
|
+
* Находит группу формы редактирования по имени
|
|
264
|
+
* @example
|
|
265
|
+
* const formEdit = new MyForm();
|
|
266
|
+
* //...
|
|
267
|
+
* expect(await formEdit.group('Name');
|
|
268
|
+
*/
|
|
269
|
+
group(name: string): FormGroup;
|
|
179
270
|
/**
|
|
180
271
|
* Нажатие на кнопку Сохранить
|
|
181
272
|
* @example
|
|
@@ -187,36 +278,47 @@ declare abstract class FormEdit extends AbstractForm {
|
|
|
187
278
|
}
|
|
188
279
|
|
|
189
280
|
declare class TableToolbarButton extends AbstractElementWithParent {
|
|
190
|
-
|
|
281
|
+
private readonly name;
|
|
282
|
+
constructor(parentCssSelector: string, name: string, driver?: WebDriver);
|
|
191
283
|
click(): Promise<void>;
|
|
192
284
|
isDisabled(): Promise<boolean>;
|
|
193
285
|
}
|
|
194
286
|
|
|
195
287
|
declare class Cell extends AbstractElementWithParent {
|
|
196
|
-
|
|
197
|
-
|
|
288
|
+
private _index;
|
|
289
|
+
private getCellIndex;
|
|
290
|
+
constructor(parentCssSelector: string, getCellIndex: () => Promise<number>, index?: number, driver?: WebDriver);
|
|
291
|
+
private set index(value);
|
|
292
|
+
getElement(): Promise<WebElement>;
|
|
198
293
|
getValue(): Promise<string>;
|
|
199
294
|
getIndex(): number;
|
|
200
295
|
}
|
|
201
296
|
|
|
202
297
|
declare class Column extends AbstractElementWithParent {
|
|
203
|
-
|
|
204
|
-
|
|
298
|
+
private _index;
|
|
299
|
+
private _caption;
|
|
300
|
+
constructor(parentCssSelector: string, caption?: string, index?: number, driver?: WebDriver);
|
|
301
|
+
private set index(value);
|
|
302
|
+
private get index();
|
|
303
|
+
getElement(): Promise<WebElement>;
|
|
304
|
+
private getIndexByCaption;
|
|
205
305
|
caption(): Promise<string>;
|
|
206
|
-
getIndex(): number
|
|
306
|
+
getIndex(): Promise<number>;
|
|
207
307
|
}
|
|
208
308
|
|
|
209
309
|
declare class Row extends AbstractElementWithParent {
|
|
210
310
|
index: number;
|
|
211
|
-
protected getColumnByCaption: (caption: string) =>
|
|
212
|
-
constructor(
|
|
213
|
-
|
|
214
|
-
|
|
311
|
+
protected getColumnByCaption: (caption: string) => Column;
|
|
312
|
+
constructor(parentCssSelector: string, index: number, driver?: WebDriver, getColumnByCaption?: (caption: string) => Column);
|
|
313
|
+
private _getCell;
|
|
314
|
+
getCellByIndex(index: number): Cell;
|
|
315
|
+
getCell(caption: string): Cell;
|
|
215
316
|
select(): Promise<void>;
|
|
216
317
|
isSelected(): Promise<boolean>;
|
|
217
318
|
getIndex(): number;
|
|
218
319
|
getCells(): Promise<Cell[]>;
|
|
219
320
|
private clickInlineButton;
|
|
321
|
+
private checkEditingMode;
|
|
220
322
|
edit(): Promise<void>;
|
|
221
323
|
save(): Promise<void>;
|
|
222
324
|
cancel(): Promise<void>;
|
|
@@ -224,13 +326,10 @@ declare class Row extends AbstractElementWithParent {
|
|
|
224
326
|
|
|
225
327
|
declare class Table extends AbstractElementWithParent {
|
|
226
328
|
protected formName: string;
|
|
227
|
-
constructor(
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
getRowByIndex(index: number): Promise<Row>;
|
|
232
|
-
getColumnByIndex(index: number): Promise<Column>;
|
|
233
|
-
getColumnByCaption(caption: string): Promise<Column>;
|
|
329
|
+
constructor(parentCssSelector: string, formName: string, driver?: WebDriver);
|
|
330
|
+
getRowByIndex(index: number): Row;
|
|
331
|
+
getColumnByIndex(index: number): Column;
|
|
332
|
+
getColumnByCaption: (caption: string) => Column;
|
|
234
333
|
selectRowByIndex(index: number): Promise<void>;
|
|
235
334
|
getRows(): Promise<Row[]>;
|
|
236
335
|
getColumns(): Promise<Column[]>;
|
|
@@ -255,6 +354,14 @@ declare abstract class ListForm extends AbstractForm {
|
|
|
255
354
|
* expect(listForm.table());
|
|
256
355
|
*/
|
|
257
356
|
table(): Table;
|
|
357
|
+
/**
|
|
358
|
+
* Находит группу на лист форме по имени
|
|
359
|
+
* @example
|
|
360
|
+
* const formEdit = new MyForm();
|
|
361
|
+
* //...
|
|
362
|
+
* expect(await formEdit.group('Name');
|
|
363
|
+
*/
|
|
364
|
+
group(name: string): FormGroup;
|
|
258
365
|
/**
|
|
259
366
|
* Находит таблицу
|
|
260
367
|
* @example
|
|
@@ -262,7 +369,7 @@ declare abstract class ListForm extends AbstractForm {
|
|
|
262
369
|
* //...
|
|
263
370
|
* expect(listForm.toolbarButton());
|
|
264
371
|
*/
|
|
265
|
-
toolbarButton(name: string):
|
|
372
|
+
toolbarButton(name: string): TableToolbarButton;
|
|
266
373
|
}
|
|
267
374
|
|
|
268
|
-
export { AbstractPage, Editor, FormEdit, FormField, ListForm, LoginPage, NumberEditor, SubsystemsPanel, TextEditor, byTestId, click, config, createDriver, editorFactory, elementIsNotPresent, signIn };
|
|
375
|
+
export { AbstractPage, Editor, FormEdit, FormField, ListForm, LoginPage, NumberEditor, SubsystemsPanel, TextEditor, byTestId, byTestIdCssSelector, click, config, createDriver, editorFactory, elementIsNotPresent, signIn, wait, waitElementIsVisible };
|