d5-testing-library 1.1.0 → 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 +271 -304
- package/dist/d5-testing-library.d.ts +58 -37
- package/dist/d5-testing-library.legacy-esm.js +265 -300
- package/dist/d5-testing-library.mjs +265 -300
- 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];
|
|
@@ -44,6 +44,7 @@ declare class LoginPage extends AbstractPage {
|
|
|
44
44
|
authorize(): Promise<void>;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
declare const byTestIdCssSelector: (testId: string, element?: string) => string;
|
|
47
48
|
/**
|
|
48
49
|
* Returns a By locator object that can be used to locate an element by its test ID.
|
|
49
50
|
*
|
|
@@ -83,6 +84,23 @@ interface WaitElementIsVisibleParams {
|
|
|
83
84
|
*/
|
|
84
85
|
declare function waitElementIsVisible({ element, timeout, errorMessage, driver }: WaitElementIsVisibleParams): Promise<void>;
|
|
85
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
|
+
|
|
86
104
|
declare function signIn(driver?: WebDriver): Promise<WebDriver>;
|
|
87
105
|
|
|
88
106
|
/**
|
|
@@ -95,16 +113,15 @@ declare function signIn(driver?: WebDriver): Promise<WebDriver>;
|
|
|
95
113
|
declare const click: (webElement: WebElement, driver?: WebDriver) => Promise<void>;
|
|
96
114
|
|
|
97
115
|
declare class SubsystemsPanel extends AbstractElement {
|
|
98
|
-
private panelBy;
|
|
99
116
|
private header;
|
|
100
117
|
constructor(driver?: WebDriver);
|
|
101
|
-
private panelElement;
|
|
102
118
|
headerTitle(): Promise<string>;
|
|
103
119
|
}
|
|
104
120
|
|
|
105
121
|
declare abstract class AbstractForm extends AbstractPage {
|
|
122
|
+
protected containerCssSelector: string;
|
|
106
123
|
protected containerBy: By;
|
|
107
|
-
protected
|
|
124
|
+
protected popupContainerCssSelector: string;
|
|
108
125
|
protected constructor(driver?: WebDriver);
|
|
109
126
|
protected isModal(): Promise<boolean>;
|
|
110
127
|
protected getContainerElement: () => selenium_webdriver.WebElementPromise;
|
|
@@ -129,9 +146,10 @@ declare abstract class AbstractForm extends AbstractPage {
|
|
|
129
146
|
}
|
|
130
147
|
|
|
131
148
|
declare abstract class AbstractElementWithParent extends AbstractElement {
|
|
132
|
-
|
|
133
|
-
protected
|
|
134
|
-
constructor(
|
|
149
|
+
protected elementCssSelector: string;
|
|
150
|
+
protected parentCssSelector: string;
|
|
151
|
+
constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
|
|
152
|
+
protected getFullCssSelector(): string;
|
|
135
153
|
getElement(): Promise<WebElement>;
|
|
136
154
|
getAttribute(attr: string): Promise<string>;
|
|
137
155
|
getClasses(): Promise<string>;
|
|
@@ -144,17 +162,14 @@ interface Editor {
|
|
|
144
162
|
clear?(): Promise<void>;
|
|
145
163
|
}
|
|
146
164
|
|
|
147
|
-
declare class AbstractFormElement extends AbstractElementWithParent {
|
|
148
|
-
constructor(getParentElement: () => Promise<WebElement>, elementBy: By, driver?: WebDriver);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
165
|
interface ClearStrategy {
|
|
152
166
|
clear(editor: AbstractDXEditorWithInput): Promise<void>;
|
|
153
167
|
}
|
|
154
168
|
|
|
155
|
-
declare abstract class AbstractDXEditorWithInput extends
|
|
169
|
+
declare abstract class AbstractDXEditorWithInput extends AbstractElementWithParent implements Editor {
|
|
156
170
|
private clearStrategy;
|
|
157
171
|
protected setClearStrategy(strategy: ClearStrategy): void;
|
|
172
|
+
protected getInputCssSelector(): string;
|
|
158
173
|
getInputElement(): Promise<selenium_webdriver.WebElement>;
|
|
159
174
|
protected getInputValue(): Promise<string>;
|
|
160
175
|
protected setInputValue(value: string): Promise<void>;
|
|
@@ -164,22 +179,22 @@ declare abstract class AbstractDXEditorWithInput extends AbstractFormElement imp
|
|
|
164
179
|
}
|
|
165
180
|
|
|
166
181
|
declare class TextEditor extends AbstractDXEditorWithInput {
|
|
167
|
-
constructor(
|
|
182
|
+
constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
|
|
168
183
|
getValue(): Promise<string>;
|
|
169
184
|
setValue(value: string): Promise<void>;
|
|
170
185
|
}
|
|
171
186
|
|
|
172
187
|
declare class NumberEditor extends AbstractDXEditorWithInput {
|
|
173
|
-
constructor(
|
|
188
|
+
constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
|
|
174
189
|
getValue(): Promise<number | null>;
|
|
175
190
|
setValue(value: any): Promise<void>;
|
|
176
191
|
}
|
|
177
192
|
|
|
178
|
-
declare const editorFactory: (
|
|
193
|
+
declare const editorFactory: (parentCssSelector: string, elementCssSelector: string, driver: WebDriver) => Promise<Editor>;
|
|
179
194
|
|
|
180
195
|
declare class FormField extends AbstractElementWithParent implements Editor {
|
|
181
196
|
editor: Editor;
|
|
182
|
-
constructor(
|
|
197
|
+
constructor(parentCssSelector: string, formName: string, name: string, driver?: WebDriver);
|
|
183
198
|
private initEditor;
|
|
184
199
|
/**
|
|
185
200
|
* Возвращает значение в поле
|
|
@@ -215,7 +230,7 @@ interface Group {
|
|
|
215
230
|
|
|
216
231
|
declare class FormGroup extends AbstractElementWithParent implements Group {
|
|
217
232
|
editor: Group;
|
|
218
|
-
constructor(
|
|
233
|
+
constructor(parentCssSelector: string, formName: string, name: string, driver?: WebDriver);
|
|
219
234
|
private initEditor;
|
|
220
235
|
/**
|
|
221
236
|
* Возвращает булевое значение доступна ли группа
|
|
@@ -264,31 +279,40 @@ declare abstract class FormEdit extends AbstractForm {
|
|
|
264
279
|
|
|
265
280
|
declare class TableToolbarButton extends AbstractElementWithParent {
|
|
266
281
|
private readonly name;
|
|
267
|
-
constructor(
|
|
282
|
+
constructor(parentCssSelector: string, name: string, driver?: WebDriver);
|
|
268
283
|
click(): Promise<void>;
|
|
269
284
|
isDisabled(): Promise<boolean>;
|
|
270
285
|
}
|
|
271
286
|
|
|
272
287
|
declare class Cell extends AbstractElementWithParent {
|
|
273
|
-
|
|
274
|
-
|
|
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>;
|
|
275
293
|
getValue(): Promise<string>;
|
|
276
294
|
getIndex(): number;
|
|
277
295
|
}
|
|
278
296
|
|
|
279
297
|
declare class Column extends AbstractElementWithParent {
|
|
280
|
-
|
|
281
|
-
|
|
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;
|
|
282
305
|
caption(): Promise<string>;
|
|
283
|
-
getIndex(): number
|
|
306
|
+
getIndex(): Promise<number>;
|
|
284
307
|
}
|
|
285
308
|
|
|
286
309
|
declare class Row extends AbstractElementWithParent {
|
|
287
310
|
index: number;
|
|
288
|
-
protected getColumnByCaption: (caption: string) =>
|
|
289
|
-
constructor(
|
|
290
|
-
|
|
291
|
-
|
|
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;
|
|
292
316
|
select(): Promise<void>;
|
|
293
317
|
isSelected(): Promise<boolean>;
|
|
294
318
|
getIndex(): number;
|
|
@@ -302,17 +326,14 @@ declare class Row extends AbstractElementWithParent {
|
|
|
302
326
|
|
|
303
327
|
declare class Table extends AbstractElementWithParent {
|
|
304
328
|
protected formName: string;
|
|
305
|
-
constructor(
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
getRowByIndex(index: number): Promise<Row>;
|
|
310
|
-
getColumnByIndex(index: number): Promise<Column>;
|
|
311
|
-
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;
|
|
312
333
|
selectRowByIndex(index: number): Promise<void>;
|
|
313
334
|
getRows(): Promise<Row[]>;
|
|
314
335
|
getColumns(): Promise<Column[]>;
|
|
315
|
-
element(): Promise<WebElement>;
|
|
336
|
+
element(): Promise<selenium_webdriver.WebElement>;
|
|
316
337
|
/**
|
|
317
338
|
* Находит поле когда форма находится в состоянии редактирования
|
|
318
339
|
* @example
|
|
@@ -348,7 +369,7 @@ declare abstract class ListForm extends AbstractForm {
|
|
|
348
369
|
* //...
|
|
349
370
|
* expect(listForm.toolbarButton());
|
|
350
371
|
*/
|
|
351
|
-
toolbarButton(name: string):
|
|
372
|
+
toolbarButton(name: string): TableToolbarButton;
|
|
352
373
|
}
|
|
353
374
|
|
|
354
|
-
export { AbstractPage, Editor, FormEdit, FormField, ListForm, LoginPage, NumberEditor, SubsystemsPanel, TextEditor, byTestId, click, config, createDriver, editorFactory, elementIsNotPresent, signIn, waitElementIsVisible };
|
|
375
|
+
export { AbstractPage, Editor, FormEdit, FormField, ListForm, LoginPage, NumberEditor, SubsystemsPanel, TextEditor, byTestId, byTestIdCssSelector, click, config, createDriver, editorFactory, elementIsNotPresent, signIn, wait, waitElementIsVisible };
|