d5-testing-library 1.0.5 → 1.1.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 +446 -66
- package/dist/d5-testing-library.d.ts +97 -11
- package/dist/d5-testing-library.legacy-esm.js +443 -64
- package/dist/d5-testing-library.mjs +443 -64
- package/package.json +1 -1
|
@@ -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>;
|
|
@@ -64,6 +65,24 @@ declare const createDriver: (browser?: BrowserList) => Promise<WebDriver>;
|
|
|
64
65
|
|
|
65
66
|
declare const elementIsNotPresent: (locator: By) => Condition<boolean>;
|
|
66
67
|
|
|
68
|
+
interface WaitElementIsVisibleParams {
|
|
69
|
+
element: WebElement;
|
|
70
|
+
timeout?: number;
|
|
71
|
+
errorMessage?: string;
|
|
72
|
+
driver?: WebDriver;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Waits until a specified web element is visible within a given timeout.
|
|
76
|
+
*
|
|
77
|
+
* @param {WaitElementIsVisibleParams} params - The parameters for the wait function.
|
|
78
|
+
* @param {WebElement} params.element - The web element to wait for visibility.
|
|
79
|
+
* @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.
|
|
80
|
+
* @param {string} [params.errorMessage] - The error message to display if the wait times out. If not provided, a default error message is used.
|
|
81
|
+
* @param {WebDriver} [params.driver] - The web driver instance to use. If not provided, the default driver from the configuration is used.
|
|
82
|
+
* @returns {Promise<void>} A promise that resolves when the element becomes visible.
|
|
83
|
+
*/
|
|
84
|
+
declare function waitElementIsVisible({ element, timeout, errorMessage, driver }: WaitElementIsVisibleParams): Promise<void>;
|
|
85
|
+
|
|
67
86
|
declare function signIn(driver?: WebDriver): Promise<WebDriver>;
|
|
68
87
|
|
|
69
88
|
/**
|
|
@@ -110,35 +129,48 @@ declare abstract class AbstractForm extends AbstractPage {
|
|
|
110
129
|
}
|
|
111
130
|
|
|
112
131
|
declare abstract class AbstractElementWithParent extends AbstractElement {
|
|
113
|
-
|
|
132
|
+
getParentElement: () => Promise<WebElement>;
|
|
114
133
|
protected elementBy: By;
|
|
115
134
|
constructor(getParentElement: () => Promise<WebElement>, driver?: WebDriver);
|
|
116
135
|
getElement(): Promise<WebElement>;
|
|
136
|
+
getAttribute(attr: string): Promise<string>;
|
|
137
|
+
getClasses(): Promise<string>;
|
|
117
138
|
}
|
|
118
139
|
|
|
119
140
|
interface Editor {
|
|
120
141
|
setValue(value: any): Promise<void>;
|
|
121
142
|
getValue(): Promise<any>;
|
|
143
|
+
remove?(itemText: string): Promise<void>;
|
|
144
|
+
clear?(): Promise<void>;
|
|
122
145
|
}
|
|
123
146
|
|
|
124
147
|
declare class AbstractFormElement extends AbstractElementWithParent {
|
|
125
148
|
constructor(getParentElement: () => Promise<WebElement>, elementBy: By, driver?: WebDriver);
|
|
126
149
|
}
|
|
127
150
|
|
|
151
|
+
interface ClearStrategy {
|
|
152
|
+
clear(editor: AbstractDXEditorWithInput): Promise<void>;
|
|
153
|
+
}
|
|
154
|
+
|
|
128
155
|
declare abstract class AbstractDXEditorWithInput extends AbstractFormElement implements Editor {
|
|
129
|
-
|
|
156
|
+
private clearStrategy;
|
|
157
|
+
protected setClearStrategy(strategy: ClearStrategy): void;
|
|
158
|
+
getInputElement(): Promise<selenium_webdriver.WebElement>;
|
|
130
159
|
protected getInputValue(): Promise<string>;
|
|
131
160
|
protected setInputValue(value: string): Promise<void>;
|
|
161
|
+
clear(): Promise<void>;
|
|
132
162
|
abstract setValue(value: any): Promise<void>;
|
|
133
163
|
abstract getValue(): Promise<any>;
|
|
134
164
|
}
|
|
135
165
|
|
|
136
166
|
declare class TextEditor extends AbstractDXEditorWithInput {
|
|
167
|
+
constructor(getParentElement: () => Promise<WebElement>, elementBy: By, driver: WebDriver);
|
|
137
168
|
getValue(): Promise<string>;
|
|
138
169
|
setValue(value: string): Promise<void>;
|
|
139
170
|
}
|
|
140
171
|
|
|
141
172
|
declare class NumberEditor extends AbstractDXEditorWithInput {
|
|
173
|
+
constructor(getParentElement: () => Promise<WebElement>, elementBy: By, driver: WebDriver);
|
|
142
174
|
getValue(): Promise<number | null>;
|
|
143
175
|
setValue(value: any): Promise<void>;
|
|
144
176
|
}
|
|
@@ -163,6 +195,34 @@ declare class FormField extends AbstractElementWithParent implements Editor {
|
|
|
163
195
|
* await formEdit.field('TextFld').setValue('TestValue');
|
|
164
196
|
*/
|
|
165
197
|
setValue(value: any): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Очищает значение в поле
|
|
200
|
+
* @example
|
|
201
|
+
* await formEdit.field('NumberFld').clear();
|
|
202
|
+
*/
|
|
203
|
+
clear(): Promise<void>;
|
|
204
|
+
/**
|
|
205
|
+
* Удаляет тег по переданному тексту
|
|
206
|
+
* @example
|
|
207
|
+
* await formEdit.field('TagBox').remove('test');
|
|
208
|
+
*/
|
|
209
|
+
remove(itemText: string): Promise<void>;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
interface Group {
|
|
213
|
+
isDisplayed(): Promise<boolean>;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
declare class FormGroup extends AbstractElementWithParent implements Group {
|
|
217
|
+
editor: Group;
|
|
218
|
+
constructor(getParentElement: () => Promise<WebElement>, formName: string, name: string, driver?: WebDriver);
|
|
219
|
+
private initEditor;
|
|
220
|
+
/**
|
|
221
|
+
* Возвращает булевое значение доступна ли группа
|
|
222
|
+
* @example
|
|
223
|
+
* expect(await tableList.group('MainSuperPanel').isDisplayed();
|
|
224
|
+
*/
|
|
225
|
+
isDisplayed(): Promise<boolean>;
|
|
166
226
|
}
|
|
167
227
|
|
|
168
228
|
declare abstract class FormEdit extends AbstractForm {
|
|
@@ -176,6 +236,22 @@ declare abstract class FormEdit extends AbstractForm {
|
|
|
176
236
|
* expect(await formEdit.field('Name').getValue()).toBe('test value');
|
|
177
237
|
*/
|
|
178
238
|
field(name: string): FormField;
|
|
239
|
+
/**
|
|
240
|
+
* Проверяет не отключена ли кнопка Сохранить
|
|
241
|
+
* @example
|
|
242
|
+
* const formEdit = new MyForm();
|
|
243
|
+
* //...
|
|
244
|
+
* await formEdit.isSaveButtonDisabled();
|
|
245
|
+
*/
|
|
246
|
+
isSaveButtonDisabled(): Promise<boolean>;
|
|
247
|
+
/**
|
|
248
|
+
* Находит группу формы редактирования по имени
|
|
249
|
+
* @example
|
|
250
|
+
* const formEdit = new MyForm();
|
|
251
|
+
* //...
|
|
252
|
+
* expect(await formEdit.group('Name');
|
|
253
|
+
*/
|
|
254
|
+
group(name: string): FormGroup;
|
|
179
255
|
/**
|
|
180
256
|
* Нажатие на кнопку Сохранить
|
|
181
257
|
* @example
|
|
@@ -187,6 +263,7 @@ declare abstract class FormEdit extends AbstractForm {
|
|
|
187
263
|
}
|
|
188
264
|
|
|
189
265
|
declare class TableToolbarButton extends AbstractElementWithParent {
|
|
266
|
+
private readonly name;
|
|
190
267
|
constructor(getParentElement: () => WebElementPromise, name: string, driver?: WebDriver);
|
|
191
268
|
click(): Promise<void>;
|
|
192
269
|
isDisabled(): Promise<boolean>;
|
|
@@ -201,7 +278,7 @@ declare class Cell extends AbstractElementWithParent {
|
|
|
201
278
|
|
|
202
279
|
declare class Column extends AbstractElementWithParent {
|
|
203
280
|
index: number;
|
|
204
|
-
constructor(getParentElement: () =>
|
|
281
|
+
constructor(getParentElement: () => Promise<WebElement>, index: number, driver?: WebDriver);
|
|
205
282
|
caption(): Promise<string>;
|
|
206
283
|
getIndex(): number;
|
|
207
284
|
}
|
|
@@ -209,7 +286,7 @@ declare class Column extends AbstractElementWithParent {
|
|
|
209
286
|
declare class Row extends AbstractElementWithParent {
|
|
210
287
|
index: number;
|
|
211
288
|
protected getColumnByCaption: (caption: string) => Promise<Column>;
|
|
212
|
-
constructor(getParentElement: () =>
|
|
289
|
+
constructor(getParentElement: () => Promise<WebElement>, index: number, driver?: WebDriver, getColumnByCaption?: (caption: string) => Promise<Column>);
|
|
213
290
|
getCellByIndex(index: number): Promise<Cell>;
|
|
214
291
|
getCell(caption: string): Promise<Cell>;
|
|
215
292
|
select(): Promise<void>;
|
|
@@ -217,6 +294,7 @@ declare class Row extends AbstractElementWithParent {
|
|
|
217
294
|
getIndex(): number;
|
|
218
295
|
getCells(): Promise<Cell[]>;
|
|
219
296
|
private clickInlineButton;
|
|
297
|
+
private checkEditingMode;
|
|
220
298
|
edit(): Promise<void>;
|
|
221
299
|
save(): Promise<void>;
|
|
222
300
|
cancel(): Promise<void>;
|
|
@@ -224,17 +302,17 @@ declare class Row extends AbstractElementWithParent {
|
|
|
224
302
|
|
|
225
303
|
declare class Table extends AbstractElementWithParent {
|
|
226
304
|
protected formName: string;
|
|
227
|
-
constructor(getParentElement: () =>
|
|
228
|
-
|
|
229
|
-
protected getDataGrid(): Promise<
|
|
230
|
-
protected getTableElement: () =>
|
|
305
|
+
constructor(getParentElement: () => Promise<WebElement>, formName: string, driver?: WebDriver);
|
|
306
|
+
private getHeaderCssSelector;
|
|
307
|
+
protected getDataGrid(): Promise<WebElement>;
|
|
308
|
+
protected getTableElement: () => Promise<WebElement>;
|
|
231
309
|
getRowByIndex(index: number): Promise<Row>;
|
|
232
310
|
getColumnByIndex(index: number): Promise<Column>;
|
|
233
311
|
getColumnByCaption(caption: string): Promise<Column>;
|
|
234
312
|
selectRowByIndex(index: number): Promise<void>;
|
|
235
313
|
getRows(): Promise<Row[]>;
|
|
236
314
|
getColumns(): Promise<Column[]>;
|
|
237
|
-
element(): Promise<
|
|
315
|
+
element(): Promise<WebElement>;
|
|
238
316
|
/**
|
|
239
317
|
* Находит поле когда форма находится в состоянии редактирования
|
|
240
318
|
* @example
|
|
@@ -255,6 +333,14 @@ declare abstract class ListForm extends AbstractForm {
|
|
|
255
333
|
* expect(listForm.table());
|
|
256
334
|
*/
|
|
257
335
|
table(): Table;
|
|
336
|
+
/**
|
|
337
|
+
* Находит группу на лист форме по имени
|
|
338
|
+
* @example
|
|
339
|
+
* const formEdit = new MyForm();
|
|
340
|
+
* //...
|
|
341
|
+
* expect(await formEdit.group('Name');
|
|
342
|
+
*/
|
|
343
|
+
group(name: string): FormGroup;
|
|
258
344
|
/**
|
|
259
345
|
* Находит таблицу
|
|
260
346
|
* @example
|
|
@@ -265,4 +351,4 @@ declare abstract class ListForm extends AbstractForm {
|
|
|
265
351
|
toolbarButton(name: string): Promise<TableToolbarButton>;
|
|
266
352
|
}
|
|
267
353
|
|
|
268
|
-
export { AbstractPage, Editor, FormEdit, FormField, ListForm, LoginPage, NumberEditor, SubsystemsPanel, TextEditor, byTestId, click, config, createDriver, editorFactory, elementIsNotPresent, signIn };
|
|
354
|
+
export { AbstractPage, Editor, FormEdit, FormField, ListForm, LoginPage, NumberEditor, SubsystemsPanel, TextEditor, byTestId, click, config, createDriver, editorFactory, elementIsNotPresent, signIn, waitElementIsVisible };
|