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
|
@@ -31,11 +31,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
AbstractPage: () => AbstractPage,
|
|
34
|
+
Dialog: () => Dialog,
|
|
35
|
+
FilterPanel: () => FilterPanel,
|
|
34
36
|
FormEdit: () => FormEdit,
|
|
35
37
|
FormField: () => FormField,
|
|
38
|
+
FormFilterField: () => FormFilterField,
|
|
36
39
|
ListForm: () => ListForm,
|
|
37
40
|
LoginPage: () => LoginPage,
|
|
38
41
|
NumberEditor: () => NumberEditor,
|
|
42
|
+
PanelFilterField: () => PanelFilterField,
|
|
39
43
|
SubsystemsPanel: () => SubsystemsPanel,
|
|
40
44
|
TextEditor: () => TextEditor,
|
|
41
45
|
byTestId: () => byTestId,
|
|
@@ -45,6 +49,7 @@ __export(src_exports, {
|
|
|
45
49
|
createDriver: () => createDriver,
|
|
46
50
|
editorFactory: () => editorFactory,
|
|
47
51
|
elementIsNotPresent: () => elementIsNotPresent,
|
|
52
|
+
readonlyLocator: () => readonlyLocator,
|
|
48
53
|
signIn: () => signIn,
|
|
49
54
|
wait: () => wait,
|
|
50
55
|
waitElementIsVisible: () => waitElementIsVisible
|
|
@@ -91,11 +96,61 @@ function config(cfg) {
|
|
|
91
96
|
return configInstance.config(cfg);
|
|
92
97
|
}
|
|
93
98
|
|
|
99
|
+
// src/pageObjects/AbstractElement.ts
|
|
100
|
+
var import_selenium_webdriver2 = require("selenium-webdriver");
|
|
101
|
+
|
|
102
|
+
// src/utils/waitElementIsVisible.ts
|
|
103
|
+
var import_selenium_webdriver = require("selenium-webdriver");
|
|
104
|
+
|
|
105
|
+
// src/utils/wait.ts
|
|
106
|
+
async function wait(condition, driver, errorMessage, timeout) {
|
|
107
|
+
driver = driver ?? config().driver;
|
|
108
|
+
await driver.wait(condition, timeout ?? config().timeout, errorMessage);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// src/utils/waitElementIsVisible.ts
|
|
112
|
+
async function waitElementIsVisible({
|
|
113
|
+
element,
|
|
114
|
+
timeout,
|
|
115
|
+
errorMessage,
|
|
116
|
+
driver
|
|
117
|
+
}) {
|
|
118
|
+
driver = driver ?? config().driver;
|
|
119
|
+
const condition = import_selenium_webdriver.until.elementIsVisible(element);
|
|
120
|
+
await wait(condition.fn, driver, errorMessage ?? condition.description(), timeout ?? config().timeout);
|
|
121
|
+
}
|
|
122
|
+
|
|
94
123
|
// src/pageObjects/AbstractElement.ts
|
|
95
124
|
var AbstractElement = class {
|
|
96
125
|
driver;
|
|
97
|
-
|
|
126
|
+
elementCssSelector;
|
|
127
|
+
constructor(driver, elementCssSelector) {
|
|
98
128
|
this.driver = driver || config().driver;
|
|
129
|
+
this.elementCssSelector = elementCssSelector;
|
|
130
|
+
}
|
|
131
|
+
getFullCssSelector() {
|
|
132
|
+
return this.elementCssSelector;
|
|
133
|
+
}
|
|
134
|
+
joinRelativeCssSelectors(selectors) {
|
|
135
|
+
return selectors.join(" ");
|
|
136
|
+
}
|
|
137
|
+
async getElement() {
|
|
138
|
+
return this.driver.findElement(import_selenium_webdriver2.By.css(this.getFullCssSelector()));
|
|
139
|
+
}
|
|
140
|
+
async getAttribute(attr) {
|
|
141
|
+
const element = await this.getElement();
|
|
142
|
+
await waitElementIsVisible({
|
|
143
|
+
element,
|
|
144
|
+
driver: this.driver,
|
|
145
|
+
errorMessage: `Element not found: ${this.getFullCssSelector()}`
|
|
146
|
+
});
|
|
147
|
+
return await element.getAttribute(attr);
|
|
148
|
+
}
|
|
149
|
+
async getClasses() {
|
|
150
|
+
return await this.getAttribute("class");
|
|
151
|
+
}
|
|
152
|
+
async getDataTestId() {
|
|
153
|
+
return await this.getAttribute("data-testid");
|
|
99
154
|
}
|
|
100
155
|
};
|
|
101
156
|
|
|
@@ -128,19 +183,63 @@ var AbstractPage = class extends AbstractElement {
|
|
|
128
183
|
}
|
|
129
184
|
};
|
|
130
185
|
|
|
186
|
+
// src/utils/actions.ts
|
|
187
|
+
var click = async (webElement, driver) => {
|
|
188
|
+
driver = driver ?? config().driver;
|
|
189
|
+
const actions = driver.actions({ async: true });
|
|
190
|
+
await actions.move({ origin: webElement }).click().perform();
|
|
191
|
+
};
|
|
192
|
+
|
|
131
193
|
// src/utils/locators.ts
|
|
132
|
-
var
|
|
194
|
+
var import_selenium_webdriver3 = require("selenium-webdriver");
|
|
133
195
|
var byTestIdCssSelector = (testId, element = "div") => {
|
|
134
196
|
return `${element}[data-testid="${testId}"]`;
|
|
135
197
|
};
|
|
136
198
|
var byTestId = (testId, element = "div") => {
|
|
137
|
-
return
|
|
199
|
+
return import_selenium_webdriver3.By.css(byTestIdCssSelector(testId, element));
|
|
200
|
+
};
|
|
201
|
+
var readonlyLocator = "readonly";
|
|
202
|
+
|
|
203
|
+
// src/pageObjects/pages/LoginPage.ts
|
|
204
|
+
var LOGIN_PATH = "/login";
|
|
205
|
+
var LoginPage = class extends AbstractPage {
|
|
206
|
+
usernameField = byTestId("loginField", "input");
|
|
207
|
+
passwordField = byTestId("passwordField", "input");
|
|
208
|
+
loginButton = byTestId("loginButton");
|
|
209
|
+
async locate() {
|
|
210
|
+
await super.locate();
|
|
211
|
+
const login = await this.driver.findElement(this.usernameField);
|
|
212
|
+
await waitElementIsVisible({
|
|
213
|
+
element: login,
|
|
214
|
+
driver: this.driver
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
get path() {
|
|
218
|
+
return LOGIN_PATH;
|
|
219
|
+
}
|
|
220
|
+
async enterUsername(username) {
|
|
221
|
+
await this.driver.findElement(this.usernameField).sendKeys(username);
|
|
222
|
+
}
|
|
223
|
+
async enterPassword(password) {
|
|
224
|
+
await this.driver.findElement(this.passwordField).sendKeys(password);
|
|
225
|
+
}
|
|
226
|
+
async clickLoginButton() {
|
|
227
|
+
await click(await this.driver.findElement(this.loginButton), this.driver);
|
|
228
|
+
}
|
|
229
|
+
async loginWith(username, password) {
|
|
230
|
+
await this.enterUsername(username);
|
|
231
|
+
await this.enterPassword(password);
|
|
232
|
+
await this.clickLoginButton();
|
|
233
|
+
}
|
|
234
|
+
async authorize() {
|
|
235
|
+
await this.loginWith(config().auth.login, config().auth.password);
|
|
236
|
+
}
|
|
138
237
|
};
|
|
139
238
|
|
|
140
239
|
// src/utils/createDriver.ts
|
|
141
|
-
var
|
|
240
|
+
var import_selenium_webdriver4 = require("selenium-webdriver");
|
|
142
241
|
var createDriver = async (browser) => {
|
|
143
|
-
const driver = await new
|
|
242
|
+
const driver = await new import_selenium_webdriver4.Builder().forBrowser(browser ?? config().browser).build();
|
|
144
243
|
const manage = driver.manage();
|
|
145
244
|
await manage.setTimeouts({ implicit: config().timeout });
|
|
146
245
|
await manage.window().maximize();
|
|
@@ -148,44 +247,30 @@ var createDriver = async (browser) => {
|
|
|
148
247
|
};
|
|
149
248
|
|
|
150
249
|
// src/utils/elementIsNotPresent.ts
|
|
151
|
-
var
|
|
250
|
+
var import_selenium_webdriver5 = require("selenium-webdriver");
|
|
152
251
|
var elementIsNotPresent = function elementIsNotPresent2(locator) {
|
|
153
|
-
return new
|
|
252
|
+
return new import_selenium_webdriver5.Condition("for no element to be located " + locator, async function(driver) {
|
|
154
253
|
const elements = await driver.findElements(locator);
|
|
155
254
|
return elements.length == 0;
|
|
156
255
|
});
|
|
157
256
|
};
|
|
158
257
|
|
|
159
|
-
// src/utils/
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
await
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
// src/utils/waitElementIsVisible.ts
|
|
169
|
-
async function waitElementIsVisible({
|
|
170
|
-
element,
|
|
171
|
-
timeout,
|
|
172
|
-
errorMessage,
|
|
173
|
-
driver
|
|
174
|
-
}) {
|
|
175
|
-
driver = driver ?? config().driver;
|
|
176
|
-
const condition = import_selenium_webdriver4.until.elementIsVisible(element);
|
|
177
|
-
await wait(condition.fn, driver, errorMessage ?? condition.description(), timeout ?? config().timeout);
|
|
258
|
+
// src/utils/signIn.ts
|
|
259
|
+
async function signIn(driver) {
|
|
260
|
+
const webDriver = driver ?? await createDriver();
|
|
261
|
+
config().driver = webDriver;
|
|
262
|
+
const loginPage = new LoginPage(webDriver);
|
|
263
|
+
await loginPage.locate();
|
|
264
|
+
await loginPage.authorize();
|
|
265
|
+
return webDriver;
|
|
178
266
|
}
|
|
179
267
|
|
|
180
268
|
// src/pageObjects/AbstractElementWithParent.ts
|
|
181
|
-
var import_selenium_webdriver5 = require("selenium-webdriver");
|
|
182
269
|
var AbstractElementWithParent = class extends AbstractElement {
|
|
183
|
-
elementCssSelector;
|
|
184
270
|
parentCssSelector;
|
|
185
271
|
constructor(parentCssSelector, elementCssSelector, driver) {
|
|
186
|
-
super(driver);
|
|
272
|
+
super(driver, elementCssSelector);
|
|
187
273
|
this.parentCssSelector = parentCssSelector;
|
|
188
|
-
this.elementCssSelector = elementCssSelector;
|
|
189
274
|
}
|
|
190
275
|
getFullCssSelector() {
|
|
191
276
|
if (!this.elementCssSelector) {
|
|
@@ -196,20 +281,10 @@ var AbstractElementWithParent = class extends AbstractElement {
|
|
|
196
281
|
}
|
|
197
282
|
return `${this.parentCssSelector} ${this.elementCssSelector}`;
|
|
198
283
|
}
|
|
199
|
-
async
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const element = await this.getElement();
|
|
204
|
-
await waitElementIsVisible({
|
|
205
|
-
element,
|
|
206
|
-
driver: this.driver,
|
|
207
|
-
errorMessage: `Element not found: ${this.getFullCssSelector()}`
|
|
208
|
-
});
|
|
209
|
-
return await element.getAttribute(attr);
|
|
210
|
-
}
|
|
211
|
-
async getClasses() {
|
|
212
|
-
return await this.getAttribute("class");
|
|
284
|
+
async isReadonly() {
|
|
285
|
+
const fieldEl = await this.getElement();
|
|
286
|
+
const classSting = await fieldEl.getAttribute("class");
|
|
287
|
+
return classSting.includes(readonlyLocator);
|
|
213
288
|
}
|
|
214
289
|
};
|
|
215
290
|
|
|
@@ -228,8 +303,10 @@ var SubsystemsPanel = class extends AbstractElement {
|
|
|
228
303
|
super(driver);
|
|
229
304
|
this.header = new SubsystemsPanelHeader("#aside", byTestIdCssSelector("subsystems-panel-title", "span"), this.driver);
|
|
230
305
|
}
|
|
231
|
-
headerTitle() {
|
|
232
|
-
|
|
306
|
+
async headerTitle() {
|
|
307
|
+
const title = await this.header.title();
|
|
308
|
+
await wait(async () => await title.getText() != "", this.driver);
|
|
309
|
+
return title.getText();
|
|
233
310
|
}
|
|
234
311
|
};
|
|
235
312
|
|
|
@@ -266,10 +343,10 @@ var AbstractForm = class extends AbstractPage {
|
|
|
266
343
|
*/
|
|
267
344
|
async exists() {
|
|
268
345
|
try {
|
|
269
|
-
await
|
|
346
|
+
let elements = await this.driver.findElements(this.containerBy);
|
|
347
|
+
return elements.length > 0;
|
|
348
|
+
} catch (error) {
|
|
270
349
|
return false;
|
|
271
|
-
} catch {
|
|
272
|
-
return true;
|
|
273
350
|
}
|
|
274
351
|
}
|
|
275
352
|
/**
|
|
@@ -284,7 +361,7 @@ var AbstractForm = class extends AbstractPage {
|
|
|
284
361
|
const titleEl2 = await this.driver.findElement(import_selenium_webdriver7.By.css(`${this.popupContainerCssSelector} .popup-title`));
|
|
285
362
|
return titleEl2.getText();
|
|
286
363
|
}
|
|
287
|
-
let titleEl = await this.driver.findElement(import_selenium_webdriver7.By.
|
|
364
|
+
let titleEl = await this.driver.findElement(import_selenium_webdriver7.By.className("main-toolbar-form-title"));
|
|
288
365
|
return titleEl.getText();
|
|
289
366
|
}
|
|
290
367
|
};
|
|
@@ -292,6 +369,29 @@ var AbstractForm = class extends AbstractPage {
|
|
|
292
369
|
// src/pageObjects/elements/Forms/FormEdit.ts
|
|
293
370
|
var import_selenium_webdriver14 = require("selenium-webdriver");
|
|
294
371
|
|
|
372
|
+
// src/utils/createDataTestId.ts
|
|
373
|
+
function createDataTestId(formName, itemType, itemName) {
|
|
374
|
+
return `${formName}-${itemType}-${itemName}`;
|
|
375
|
+
}
|
|
376
|
+
function createFieldTestId(formName, itemName) {
|
|
377
|
+
return createDataTestId(formName, "form_field" /* FORM_FIELD */, itemName);
|
|
378
|
+
}
|
|
379
|
+
function createGroupTestId(formName, itemName) {
|
|
380
|
+
return createDataTestId(formName, "group" /* GROUP */, itemName);
|
|
381
|
+
}
|
|
382
|
+
function createFilterTestId(formName, itemName, layout) {
|
|
383
|
+
return createDataTestId(formName, "filter" /* FILTER */, itemName) + `-${layout}`;
|
|
384
|
+
}
|
|
385
|
+
function createDocFilterTestId(formName, itemName) {
|
|
386
|
+
return createFilterTestId(formName, itemName, "dock-panel-filter" /* DOCK_PANEL */);
|
|
387
|
+
}
|
|
388
|
+
function createLayoutFilterTestId(formName, itemName) {
|
|
389
|
+
return createFilterTestId(formName, itemName, "layout-filter" /* LAYOUT */);
|
|
390
|
+
}
|
|
391
|
+
function createTableId(formName) {
|
|
392
|
+
return `${"table" /* TABLE */}-${formName}`;
|
|
393
|
+
}
|
|
394
|
+
|
|
295
395
|
// src/pageObjects/elements/Editors/AbstractEditor.ts
|
|
296
396
|
var import_selenium_webdriver8 = require("selenium-webdriver");
|
|
297
397
|
|
|
@@ -484,6 +584,7 @@ var TAGS_SELECTOR = ".dx-tag .tag-text";
|
|
|
484
584
|
var DX_TAG_CONTAINER = "dx-tag-container";
|
|
485
585
|
var DX_TEXTEDITOR_EMPTY2 = "dx-texteditor-empty";
|
|
486
586
|
var BTN_OK_SELECTOR = ".dx-tagbox-popup-wrapper .dx-popup-bottom .dx-button.dx-popup-done";
|
|
587
|
+
var TAG_BOX_LIST_ITEM_SELECTOR = '.dx-tagbox-popup-wrapper .dx-list-item[aria-selected="true"]';
|
|
487
588
|
var TagBox = class extends AbstractDXEditorWithInput {
|
|
488
589
|
constructor(parentCssSelector, elementCssSelector, driver) {
|
|
489
590
|
super(parentCssSelector, elementCssSelector, driver);
|
|
@@ -498,21 +599,21 @@ var TagBox = class extends AbstractDXEditorWithInput {
|
|
|
498
599
|
}
|
|
499
600
|
await this.confirmSelection();
|
|
500
601
|
}
|
|
602
|
+
async waitOptionSelection() {
|
|
603
|
+
const option = await this.driver.findElement(import_selenium_webdriver11.By.css(TAG_BOX_LIST_ITEM_SELECTOR));
|
|
604
|
+
await wait(() => option.isDisplayed(), this.driver);
|
|
605
|
+
}
|
|
501
606
|
async selectOption(inputEl, value, lastElement) {
|
|
502
607
|
await inputEl.sendKeys(value);
|
|
503
608
|
const optElement = await inputEl.findElement(import_selenium_webdriver11.By.xpath(combinedValueXpath(value)));
|
|
504
609
|
await click(optElement, this.driver);
|
|
610
|
+
await this.waitOptionSelection();
|
|
505
611
|
if (value !== lastElement) {
|
|
506
612
|
await inputEl.clear();
|
|
507
613
|
}
|
|
508
614
|
}
|
|
509
615
|
async confirmSelection() {
|
|
510
|
-
const inputEl = await this.getInputElement();
|
|
511
|
-
const option = await inputEl.findElement(import_selenium_webdriver11.By.xpath(XPathHelper.getRoleXpath(SELECT_BOX_ELEMENT_ROLE)));
|
|
512
616
|
const btnOk = await this.driver.findElement(import_selenium_webdriver11.By.css(BTN_OK_SELECTOR));
|
|
513
|
-
await wait(async () => {
|
|
514
|
-
return await option.getAttribute("aria-selected") === "true";
|
|
515
|
-
}, this.driver);
|
|
516
617
|
await click(btnOk, this.driver);
|
|
517
618
|
}
|
|
518
619
|
async getTagBoxInputValue() {
|
|
@@ -522,8 +623,7 @@ var TagBox = class extends AbstractDXEditorWithInput {
|
|
|
522
623
|
const tags = await this.driver.findElements(import_selenium_webdriver11.By.css(`${this.getFullCssSelector()} .${DX_TAG_CONTAINER} ${TAGS_SELECTOR}`));
|
|
523
624
|
const values = [];
|
|
524
625
|
for (const tag of tags) {
|
|
525
|
-
|
|
526
|
-
values.push(text);
|
|
626
|
+
values.push(await tag.getAttribute("textContent"));
|
|
527
627
|
}
|
|
528
628
|
return values;
|
|
529
629
|
}
|
|
@@ -660,25 +760,11 @@ var editorFactory = async (parentCssSelector, elementCssSelector, driver) => {
|
|
|
660
760
|
throw new Error("Unknown type of editor. Please write ticket to the support");
|
|
661
761
|
};
|
|
662
762
|
|
|
663
|
-
// src/
|
|
664
|
-
|
|
665
|
-
return `${formName}-${itemType}-${itemName}`;
|
|
666
|
-
}
|
|
667
|
-
function createFieldTestId(formName, itemName) {
|
|
668
|
-
return createDataTestId(formName, "form_field" /* FORM_FIELD */, itemName);
|
|
669
|
-
}
|
|
670
|
-
function createGroupTestId(formName, itemName) {
|
|
671
|
-
return createDataTestId(formName, "group" /* GROUP */, itemName);
|
|
672
|
-
}
|
|
673
|
-
function createTableId(formName) {
|
|
674
|
-
return `${"table" /* TABLE */}-${formName}`;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
// src/pageObjects/elements/FormField.ts
|
|
678
|
-
var FormField = class extends AbstractElementWithParent {
|
|
763
|
+
// src/pageObjects/elements/AbstractEditor.ts
|
|
764
|
+
var AbstractEditor = class extends AbstractElementWithParent {
|
|
679
765
|
editor;
|
|
680
|
-
constructor(parentCssSelector,
|
|
681
|
-
super(parentCssSelector,
|
|
766
|
+
constructor(parentCssSelector, elementCssSelector, driver) {
|
|
767
|
+
super(parentCssSelector, elementCssSelector, driver);
|
|
682
768
|
}
|
|
683
769
|
async initEditor() {
|
|
684
770
|
if (!this.editor) {
|
|
@@ -729,6 +815,23 @@ var FormField = class extends AbstractElementWithParent {
|
|
|
729
815
|
}
|
|
730
816
|
return this.editor.remove(itemText);
|
|
731
817
|
}
|
|
818
|
+
/**
|
|
819
|
+
* Возвращает значение true|false в зависимости readOnly поле или нет
|
|
820
|
+
* @example
|
|
821
|
+
* expect(await formEdit.field('NumberFld').isReadonly()).toBe(true);
|
|
822
|
+
* expect(await formEdit.field('TextFld').isReadonly()).toBe(false);
|
|
823
|
+
*/
|
|
824
|
+
async isReadonly() {
|
|
825
|
+
await this.initEditor();
|
|
826
|
+
return this.editor.isReadonly();
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
|
|
830
|
+
// src/pageObjects/elements/FormField.ts
|
|
831
|
+
var FormField = class extends AbstractEditor {
|
|
832
|
+
constructor(parentCssSelector, formName, name, driver) {
|
|
833
|
+
super(parentCssSelector, byTestIdCssSelector(createFieldTestId(formName, name)), driver);
|
|
834
|
+
}
|
|
732
835
|
};
|
|
733
836
|
|
|
734
837
|
// src/pageObjects/elements/Groups/AbstractGroup.ts
|
|
@@ -781,6 +884,7 @@ var FormGroup = class extends AbstractElementWithParent {
|
|
|
781
884
|
// src/pageObjects/elements/Forms/FormEdit.ts
|
|
782
885
|
var FormEdit = class extends AbstractForm {
|
|
783
886
|
saveButtonBy = import_selenium_webdriver14.By.id("button-save");
|
|
887
|
+
closeButtonBy = import_selenium_webdriver14.By.id("button-cancel");
|
|
784
888
|
constructor(driver) {
|
|
785
889
|
super(driver);
|
|
786
890
|
this.popupContainerCssSelector = `.popup .form-edit-${this.formName}`;
|
|
@@ -829,12 +933,26 @@ var FormEdit = class extends AbstractForm {
|
|
|
829
933
|
await wait(async () => !await this.isSaveButtonDisabled(), this.driver, "Button is disabled");
|
|
830
934
|
await click(saveButton, this.driver);
|
|
831
935
|
}
|
|
936
|
+
/**
|
|
937
|
+
* Нажатие на кнопку Закрить
|
|
938
|
+
* @example
|
|
939
|
+
* const formEdit = new MyForm();
|
|
940
|
+
* //...
|
|
941
|
+
* await formEdit.closeButtonClick();
|
|
942
|
+
*/
|
|
943
|
+
async closeButtonClick() {
|
|
944
|
+
const closeButton = await this.driver.findElement(this.closeButtonBy);
|
|
945
|
+
await click(closeButton, this.driver);
|
|
946
|
+
}
|
|
832
947
|
};
|
|
833
948
|
|
|
834
949
|
// src/pageObjects/elements/Table/Table.ts
|
|
835
|
-
var
|
|
950
|
+
var import_selenium_webdriver19 = require("selenium-webdriver");
|
|
836
951
|
|
|
837
952
|
// src/pageObjects/elements/Table/elements/Row.ts
|
|
953
|
+
var import_selenium_webdriver17 = require("selenium-webdriver");
|
|
954
|
+
|
|
955
|
+
// src/pageObjects/elements/Table/elements/Cell.ts
|
|
838
956
|
var import_selenium_webdriver16 = require("selenium-webdriver");
|
|
839
957
|
|
|
840
958
|
// src/pageObjects/elements/Table/utils.ts
|
|
@@ -844,6 +962,7 @@ function getCssRowByIndexSelector(index) {
|
|
|
844
962
|
}
|
|
845
963
|
var getColumnByIndexCssSelector = (columnIndex) => `td[aria-colindex="${transformInputIndex(columnIndex)}"]`;
|
|
846
964
|
var getColumnByCaptionCssSelector = (caption) => `td[role="columnheader"][aria-label="Column ${caption}"]`;
|
|
965
|
+
var getColumnByNameCssSelector = (name) => `td[role="columnheader"][data-fieldname="${name}"]`;
|
|
847
966
|
function getCssCellByIndexSelector(index) {
|
|
848
967
|
return `td[role="gridcell"][aria-colindex="${transformInputIndex(index)}"]`;
|
|
849
968
|
}
|
|
@@ -863,6 +982,10 @@ var Cell = class extends AbstractElementWithParent {
|
|
|
863
982
|
this._index = index;
|
|
864
983
|
this.elementCssSelector = getCssCellByIndexSelector(index);
|
|
865
984
|
}
|
|
985
|
+
async getBooleanValue(cellEl) {
|
|
986
|
+
const booleanEl = await cellEl.findElement(import_selenium_webdriver16.By.className("boolean-widget"));
|
|
987
|
+
return await booleanEl.getAttribute("aria-checked") === "true" ? 1 : 0;
|
|
988
|
+
}
|
|
866
989
|
async getElement() {
|
|
867
990
|
if (this._index == null) {
|
|
868
991
|
this.index = await this.getCellIndex();
|
|
@@ -871,6 +994,10 @@ var Cell = class extends AbstractElementWithParent {
|
|
|
871
994
|
}
|
|
872
995
|
async getValue() {
|
|
873
996
|
const cellEl = await this.getElement();
|
|
997
|
+
const cellElClass = await cellEl.getAttribute("class");
|
|
998
|
+
if (cellElClass.includes("boolean-column")) {
|
|
999
|
+
return this.getBooleanValue(cellEl);
|
|
1000
|
+
}
|
|
874
1001
|
return cellEl.getText();
|
|
875
1002
|
}
|
|
876
1003
|
getIndex() {
|
|
@@ -884,22 +1011,25 @@ var DX_ROW_EDIT_CLASS = "dx-edit-row";
|
|
|
884
1011
|
var DX_DATA_ROW_CLASS = "dx-data-row";
|
|
885
1012
|
var Row = class extends AbstractElementWithParent {
|
|
886
1013
|
index;
|
|
887
|
-
|
|
888
|
-
constructor(parentCssSelector, index, driver,
|
|
1014
|
+
getColumnBy;
|
|
1015
|
+
constructor(parentCssSelector, index, driver, getColumnBy) {
|
|
889
1016
|
super(parentCssSelector, getCssRowByIndexSelector(index), driver);
|
|
890
1017
|
this.index = index;
|
|
891
|
-
this.
|
|
1018
|
+
this.getColumnBy = getColumnBy;
|
|
892
1019
|
}
|
|
893
|
-
_getCell(index,
|
|
1020
|
+
_getCell({ index, name, title }) {
|
|
894
1021
|
return new Cell(this.getFullCssSelector(), () => {
|
|
895
|
-
return this.
|
|
1022
|
+
return this.getColumnBy({ title, name }).getIndex();
|
|
896
1023
|
}, index, this.driver);
|
|
897
1024
|
}
|
|
898
1025
|
getCellByIndex(index) {
|
|
899
|
-
return this._getCell(index);
|
|
1026
|
+
return this._getCell({ index });
|
|
1027
|
+
}
|
|
1028
|
+
getCell(name) {
|
|
1029
|
+
return this._getCell({ name });
|
|
900
1030
|
}
|
|
901
|
-
|
|
902
|
-
return this._getCell(
|
|
1031
|
+
getCellByTitle(title) {
|
|
1032
|
+
return this._getCell({ title });
|
|
903
1033
|
}
|
|
904
1034
|
async select() {
|
|
905
1035
|
const rowEl = await this.getElement();
|
|
@@ -917,7 +1047,7 @@ var Row = class extends AbstractElementWithParent {
|
|
|
917
1047
|
return this.index;
|
|
918
1048
|
}
|
|
919
1049
|
async getCells() {
|
|
920
|
-
const cells = await this.driver.findElements(
|
|
1050
|
+
const cells = await this.driver.findElements(import_selenium_webdriver17.By.css(`${this.getFullCssSelector()} td[role="gridcell"]`));
|
|
921
1051
|
const result = [];
|
|
922
1052
|
cells.forEach((_, index) => {
|
|
923
1053
|
const newCell = this.getCellByIndex(index);
|
|
@@ -928,7 +1058,7 @@ var Row = class extends AbstractElementWithParent {
|
|
|
928
1058
|
async clickInlineButton(buttonClass) {
|
|
929
1059
|
const FIXED_TABLE_CSS_SELECTOR = ".dx-fixed-columns .dx-datagrid-content.dx-datagrid-content-fixed";
|
|
930
1060
|
const buttonCssSelector = `.${DX_DATA_ROW_CLASS}[aria-rowindex="${transformInputIndex(this.index)}"] .${buttonClass}`;
|
|
931
|
-
const button = await this.driver.findElement(
|
|
1061
|
+
const button = await this.driver.findElement(import_selenium_webdriver17.By.css(`${this.parentCssSelector} ${FIXED_TABLE_CSS_SELECTOR} ${buttonCssSelector}`));
|
|
932
1062
|
return click(button, this.driver);
|
|
933
1063
|
}
|
|
934
1064
|
async checkEditingMode(isEditing, msg) {
|
|
@@ -951,15 +1081,17 @@ var Row = class extends AbstractElementWithParent {
|
|
|
951
1081
|
};
|
|
952
1082
|
|
|
953
1083
|
// src/pageObjects/elements/Table/elements/Column.ts
|
|
954
|
-
var
|
|
1084
|
+
var import_selenium_webdriver18 = require("selenium-webdriver");
|
|
955
1085
|
var getHeaderCssSelector = () => {
|
|
956
1086
|
return ".dx-datagrid-headers .dx-datagrid-content:not(.dx-datagrid-content-fixed)";
|
|
957
1087
|
};
|
|
958
1088
|
var Column = class extends AbstractElementWithParent {
|
|
959
1089
|
_index;
|
|
960
1090
|
_caption;
|
|
961
|
-
|
|
1091
|
+
_name;
|
|
1092
|
+
constructor({ parentCssSelector, name, caption, index, driver }) {
|
|
962
1093
|
super(parentCssSelector, "", driver);
|
|
1094
|
+
this._name = name;
|
|
963
1095
|
this.index = index;
|
|
964
1096
|
this._caption = caption;
|
|
965
1097
|
}
|
|
@@ -974,19 +1106,33 @@ var Column = class extends AbstractElementWithParent {
|
|
|
974
1106
|
await this.getIndex();
|
|
975
1107
|
return super.getElement();
|
|
976
1108
|
}
|
|
977
|
-
async
|
|
978
|
-
const column = await this.driver.findElement(
|
|
1109
|
+
async getColumnHeaderIndexBy(cssSelector) {
|
|
1110
|
+
const column = await this.driver.findElement(import_selenium_webdriver18.By.css(`${this.parentCssSelector} ${getHeaderCssSelector()} ${cssSelector}`));
|
|
979
1111
|
return transformOutputIndex(await column.getAttribute("aria-colindex"));
|
|
980
1112
|
}
|
|
1113
|
+
async getIndexByCaption() {
|
|
1114
|
+
return this.getColumnHeaderIndexBy(getColumnByCaptionCssSelector(this._caption));
|
|
1115
|
+
}
|
|
1116
|
+
async getIndexByName() {
|
|
1117
|
+
return this.getColumnHeaderIndexBy(getColumnByNameCssSelector(this._name));
|
|
1118
|
+
}
|
|
981
1119
|
async caption() {
|
|
982
1120
|
const el = await this.getElement();
|
|
983
1121
|
return el.getText();
|
|
984
1122
|
}
|
|
985
1123
|
async getIndex() {
|
|
986
|
-
if (this.index
|
|
1124
|
+
if (this.index != null) {
|
|
1125
|
+
return this.index;
|
|
1126
|
+
}
|
|
1127
|
+
if (this._caption != null) {
|
|
987
1128
|
this.index = await this.getIndexByCaption();
|
|
1129
|
+
return this.index;
|
|
988
1130
|
}
|
|
989
|
-
|
|
1131
|
+
if (this._name != null) {
|
|
1132
|
+
this.index = await this.getIndexByName();
|
|
1133
|
+
return this.index;
|
|
1134
|
+
}
|
|
1135
|
+
throw new Error("Cant get the index in the column");
|
|
990
1136
|
}
|
|
991
1137
|
};
|
|
992
1138
|
|
|
@@ -997,32 +1143,57 @@ var Table = class extends AbstractElementWithParent {
|
|
|
997
1143
|
super(parentCssSelector, `#${createTableId(formName)}`, driver);
|
|
998
1144
|
this.formName = formName;
|
|
999
1145
|
}
|
|
1146
|
+
getColumnBy = (args) => {
|
|
1147
|
+
if (args.title) {
|
|
1148
|
+
return this.getColumnByTitle(args.title);
|
|
1149
|
+
}
|
|
1150
|
+
return this.getColumnByName(args.name);
|
|
1151
|
+
};
|
|
1000
1152
|
getRowByIndex(index) {
|
|
1001
|
-
return new Row(this.getFullCssSelector(), index, this.driver, this.
|
|
1153
|
+
return new Row(this.getFullCssSelector(), index, this.driver, this.getColumnBy);
|
|
1002
1154
|
}
|
|
1003
1155
|
getColumnByIndex(index) {
|
|
1004
|
-
return new Column(
|
|
1156
|
+
return new Column({
|
|
1157
|
+
parentCssSelector: this.getFullCssSelector(),
|
|
1158
|
+
driver: this.driver,
|
|
1159
|
+
index
|
|
1160
|
+
});
|
|
1005
1161
|
}
|
|
1006
|
-
|
|
1007
|
-
return new Column(
|
|
1162
|
+
getColumnByTitle = (title) => {
|
|
1163
|
+
return new Column({
|
|
1164
|
+
parentCssSelector: this.getFullCssSelector(),
|
|
1165
|
+
caption: title,
|
|
1166
|
+
driver: this.driver
|
|
1167
|
+
});
|
|
1168
|
+
};
|
|
1169
|
+
getColumnByName = (name) => {
|
|
1170
|
+
return new Column({
|
|
1171
|
+
parentCssSelector: this.getFullCssSelector(),
|
|
1172
|
+
name,
|
|
1173
|
+
driver: this.driver
|
|
1174
|
+
});
|
|
1008
1175
|
};
|
|
1009
1176
|
selectRowByIndex(index) {
|
|
1010
1177
|
return this.getRowByIndex(index).select();
|
|
1011
1178
|
}
|
|
1012
1179
|
async getRows() {
|
|
1013
|
-
const rows = await this.driver.findElements(
|
|
1180
|
+
const rows = await this.driver.findElements(import_selenium_webdriver19.By.css(`${this.getFullCssSelector()} .dx-row.dx-data-row`));
|
|
1014
1181
|
const result = [];
|
|
1015
1182
|
rows.forEach((_, index) => {
|
|
1016
|
-
const newRow = new Row(this.getFullCssSelector(), index, this.driver, this.
|
|
1183
|
+
const newRow = new Row(this.getFullCssSelector(), index, this.driver, this.getColumnBy);
|
|
1017
1184
|
result.push(newRow);
|
|
1018
1185
|
});
|
|
1019
1186
|
return result;
|
|
1020
1187
|
}
|
|
1021
1188
|
async getColumns() {
|
|
1022
|
-
const columns = await this.driver.findElements(
|
|
1189
|
+
const columns = await this.driver.findElements(import_selenium_webdriver19.By.css(`${this.getFullCssSelector()} ${getHeaderCssSelector()} td[role="columnheader"]`));
|
|
1023
1190
|
const result = [];
|
|
1024
1191
|
columns.forEach((_, index) => {
|
|
1025
|
-
const newCol = new Column(
|
|
1192
|
+
const newCol = new Column({
|
|
1193
|
+
parentCssSelector: this.getFullCssSelector(),
|
|
1194
|
+
index,
|
|
1195
|
+
driver: this.driver
|
|
1196
|
+
});
|
|
1026
1197
|
result.push(newCol);
|
|
1027
1198
|
});
|
|
1028
1199
|
return result;
|
|
@@ -1042,19 +1213,16 @@ var Table = class extends AbstractElementWithParent {
|
|
|
1042
1213
|
}
|
|
1043
1214
|
};
|
|
1044
1215
|
|
|
1045
|
-
// src/pageObjects/elements/TableToolbar/
|
|
1046
|
-
var
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
constructor(parentCssSelector, name, driver) {
|
|
1050
|
-
super(parentCssSelector, `#${TOOLBAR_BUTTON_CLASS}-${name}`, driver);
|
|
1051
|
-
this.name = name;
|
|
1216
|
+
// src/pageObjects/elements/TableToolbar/AbstractButton.ts
|
|
1217
|
+
var AbstractButton = class extends AbstractElementWithParent {
|
|
1218
|
+
constructor(parentCssSelector, elementCssSelector, driver) {
|
|
1219
|
+
super(parentCssSelector, elementCssSelector, driver);
|
|
1052
1220
|
}
|
|
1053
1221
|
async click() {
|
|
1054
1222
|
const button = await this.getElement();
|
|
1055
1223
|
await wait(async () => {
|
|
1056
1224
|
return await button.isDisplayed() && !await this.isDisabled();
|
|
1057
|
-
}, this.driver,
|
|
1225
|
+
}, this.driver, this.buttonNotDisplayedError());
|
|
1058
1226
|
await click(button, this.driver);
|
|
1059
1227
|
}
|
|
1060
1228
|
async isDisabled() {
|
|
@@ -1063,14 +1231,289 @@ var TableToolbarButton = class extends AbstractElementWithParent {
|
|
|
1063
1231
|
}
|
|
1064
1232
|
};
|
|
1065
1233
|
|
|
1066
|
-
// src/pageObjects/elements/TableToolbar/
|
|
1234
|
+
// src/pageObjects/elements/TableToolbar/ToolbarGroupButton.ts
|
|
1235
|
+
var ToolbarGroupButton = class extends AbstractButton {
|
|
1236
|
+
name;
|
|
1237
|
+
constructor(parentCssSelector, name, driver) {
|
|
1238
|
+
super(parentCssSelector, ``, driver);
|
|
1239
|
+
this.name = name;
|
|
1240
|
+
}
|
|
1241
|
+
buttonNotDisplayedError() {
|
|
1242
|
+
return `Button ${this.name} cannot be clicked. It is not displayed or it is disabled`;
|
|
1243
|
+
}
|
|
1244
|
+
};
|
|
1245
|
+
|
|
1246
|
+
// src/pageObjects/elements/TableToolbar/ToolbarButton.ts
|
|
1247
|
+
var TOOLBAR_BUTTON_CLASS = "toolbar-button";
|
|
1248
|
+
var ToolbarButton = class extends AbstractButton {
|
|
1249
|
+
name;
|
|
1250
|
+
constructor(parentCssSelector, name, driver) {
|
|
1251
|
+
super(parentCssSelector, `#${TOOLBAR_BUTTON_CLASS}-${name}`, driver);
|
|
1252
|
+
this.name = name;
|
|
1253
|
+
}
|
|
1254
|
+
buttonNotDisplayedError() {
|
|
1255
|
+
return `Button ${this.name} cannot be clicked. It is not displayed or it is disabled`;
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
|
|
1259
|
+
// src/pageObjects/elements/TableToolbar/ToolbarMenu.ts
|
|
1260
|
+
var import_selenium_webdriver20 = require("selenium-webdriver");
|
|
1261
|
+
|
|
1262
|
+
// src/utils/typesUtil.ts
|
|
1263
|
+
var types = {
|
|
1264
|
+
"[object Array]": "array",
|
|
1265
|
+
"[object Date]": "date",
|
|
1266
|
+
"[object Object]": "object",
|
|
1267
|
+
"[object String]": "string",
|
|
1268
|
+
"[object Null]": "null"
|
|
1269
|
+
};
|
|
1270
|
+
var type = function(object) {
|
|
1271
|
+
const typeOfObject = Object.prototype.toString.call(object);
|
|
1272
|
+
return typeof object === "object" ? types[typeOfObject] || "object" : typeof object;
|
|
1273
|
+
};
|
|
1274
|
+
var isArray = function(value) {
|
|
1275
|
+
return type(value) === "array";
|
|
1276
|
+
};
|
|
1277
|
+
var isString = function(object) {
|
|
1278
|
+
return typeof object === "string";
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
// src/pageObjects/elements/TableToolbar/ToolbarMenu.ts
|
|
1282
|
+
var SPINDOWN_CLASS = ".dx-icon-spindown";
|
|
1283
|
+
var buttonGroupItemSelector = (formName, name) => byTestIdCssSelector(`ftb-${formName}-${name}`);
|
|
1284
|
+
var getFullCssSelector = (formName, name) => `${buttonGroupItemSelector(formName, name)} ${SPINDOWN_CLASS}`;
|
|
1285
|
+
var buttonByTextXpath = (text) => `.//span[contains(@class, "dx-menu-item-text") and contains(text(), "${text}")]`;
|
|
1286
|
+
var ToolbarMenu = class extends AbstractElementWithParent {
|
|
1287
|
+
_formName;
|
|
1288
|
+
constructor(parentCssSelector, formName, name, driver) {
|
|
1289
|
+
super(parentCssSelector, getFullCssSelector(formName, name), driver);
|
|
1290
|
+
this._formName = formName;
|
|
1291
|
+
}
|
|
1292
|
+
async toggle() {
|
|
1293
|
+
const dropdown = await this.getElement();
|
|
1294
|
+
await dropdown.click();
|
|
1295
|
+
}
|
|
1296
|
+
getCssSelectorToButton(name) {
|
|
1297
|
+
return byTestId(`ftb-${this._formName}-${name}`);
|
|
1298
|
+
}
|
|
1299
|
+
buttonNotDisplayedError(name) {
|
|
1300
|
+
return `Toolbar menu button ${name} cannot be clicked. It is not displayed or it is disabled`;
|
|
1301
|
+
}
|
|
1302
|
+
async goToButton(name, selector) {
|
|
1303
|
+
const toolbarMenuItem = this.driver.findElement(selector);
|
|
1304
|
+
await wait(async () => {
|
|
1305
|
+
return await toolbarMenuItem.isDisplayed();
|
|
1306
|
+
}, this.driver, this.buttonNotDisplayedError(name));
|
|
1307
|
+
await click(toolbarMenuItem, this.driver);
|
|
1308
|
+
}
|
|
1309
|
+
async clickButton(name) {
|
|
1310
|
+
await this.toggle();
|
|
1311
|
+
if (isString(name)) {
|
|
1312
|
+
const selector = this.getCssSelectorToButton(name);
|
|
1313
|
+
await this.goToButton(name, selector);
|
|
1314
|
+
}
|
|
1315
|
+
if (isArray(name)) {
|
|
1316
|
+
for (let n of name) {
|
|
1317
|
+
const selector = this.getCssSelectorToButton(n);
|
|
1318
|
+
await this.goToButton(n, selector);
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
async clickButtonByTitle(title) {
|
|
1323
|
+
await this.toggle();
|
|
1324
|
+
if (isString(title)) {
|
|
1325
|
+
const selector = import_selenium_webdriver20.By.xpath(buttonByTextXpath(title));
|
|
1326
|
+
await this.goToButton(title, selector);
|
|
1327
|
+
}
|
|
1328
|
+
if (isArray(title)) {
|
|
1329
|
+
for (let t of title) {
|
|
1330
|
+
const selector = import_selenium_webdriver20.By.xpath(buttonByTextXpath(t));
|
|
1331
|
+
await this.goToButton(t, selector);
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1337
|
+
// src/pageObjects/elements/TableToolbar/ToolbarItem.ts
|
|
1338
|
+
var GROUP_BUTTON_CLASS = "toolbar-group-button";
|
|
1339
|
+
var toolbarItemSelector = (form, name) => byTestIdCssSelector(`ftb-${form}-${name}`);
|
|
1340
|
+
var ToolbarItem = class extends AbstractElementWithParent {
|
|
1341
|
+
_button;
|
|
1342
|
+
_formName;
|
|
1343
|
+
_itemName;
|
|
1344
|
+
constructor(parentCssSelector, formName, itemName, driver) {
|
|
1345
|
+
super(parentCssSelector, toolbarItemSelector(formName, itemName), driver);
|
|
1346
|
+
this._itemName = itemName;
|
|
1347
|
+
this._formName = formName;
|
|
1348
|
+
}
|
|
1349
|
+
async init() {
|
|
1350
|
+
if (this._button)
|
|
1351
|
+
return this._button;
|
|
1352
|
+
const classNames = await this.getClasses();
|
|
1353
|
+
if (classNames.includes(GROUP_BUTTON_CLASS)) {
|
|
1354
|
+
this._button = new ToolbarGroupButton(this.getFullCssSelector(), this._itemName, this.driver);
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
this._button = new ToolbarButton(this.parentCssSelector, this._itemName, this.driver);
|
|
1358
|
+
}
|
|
1359
|
+
async click() {
|
|
1360
|
+
await this.init();
|
|
1361
|
+
await this._button.click();
|
|
1362
|
+
}
|
|
1363
|
+
async isDisabled() {
|
|
1364
|
+
await this.init();
|
|
1365
|
+
return await this._button.isDisabled();
|
|
1366
|
+
}
|
|
1367
|
+
get menu() {
|
|
1368
|
+
return new ToolbarMenu(this.parentCssSelector, this._formName, this._itemName, this.driver);
|
|
1369
|
+
}
|
|
1370
|
+
};
|
|
1371
|
+
|
|
1372
|
+
// src/pageObjects/elements/TableToolbar/FormToolbar.ts
|
|
1067
1373
|
var TABLE_TOOLBAR_CLASS = "d5-table-toolbar";
|
|
1068
|
-
var
|
|
1374
|
+
var FormToolbar = class extends AbstractElementWithParent {
|
|
1375
|
+
formName;
|
|
1069
1376
|
constructor(parentCssSelector, formName, driver) {
|
|
1070
1377
|
super(parentCssSelector, `#${TABLE_TOOLBAR_CLASS}-${formName}`, driver);
|
|
1378
|
+
this.formName = formName;
|
|
1071
1379
|
}
|
|
1072
1380
|
button(name) {
|
|
1073
|
-
return new
|
|
1381
|
+
return new ToolbarItem(this.getFullCssSelector(), this.formName, name, this.driver);
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
|
|
1385
|
+
// src/pageObjects/elements/Filters/FormFilterField.ts
|
|
1386
|
+
var FormFilterField = class extends AbstractEditor {
|
|
1387
|
+
constructor(parentCssSelector, formName, name, driver) {
|
|
1388
|
+
super(parentCssSelector, byTestIdCssSelector(createLayoutFilterTestId(formName, name)), driver);
|
|
1389
|
+
}
|
|
1390
|
+
/**
|
|
1391
|
+
* Возвращает значение в поле
|
|
1392
|
+
* @example
|
|
1393
|
+
* expect(await form.formFilter('NumberFld').getValue()).toBe(10);
|
|
1394
|
+
* expect(await form.formFilter('TextFld').getValue()).toBe('TestValue');
|
|
1395
|
+
*/
|
|
1396
|
+
async getValue() {
|
|
1397
|
+
return super.getValue();
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* Устанавливает значение в поле
|
|
1401
|
+
* @example
|
|
1402
|
+
* await form.formFilter('NumberFld').setValue(123);
|
|
1403
|
+
* await form.formFilter('TextFld').setValue('TestValue');
|
|
1404
|
+
*/
|
|
1405
|
+
async setValue(value) {
|
|
1406
|
+
return super.setValue(value);
|
|
1407
|
+
}
|
|
1408
|
+
/**
|
|
1409
|
+
* Очищает значение в поле
|
|
1410
|
+
* @example
|
|
1411
|
+
* await form.formFilter('NumberFld').clear();
|
|
1412
|
+
*/
|
|
1413
|
+
async clear() {
|
|
1414
|
+
return super.clear();
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* Удаляет тег по переданному тексту
|
|
1418
|
+
* @example
|
|
1419
|
+
* await form.formFilter('TagBox').remove('test');
|
|
1420
|
+
*/
|
|
1421
|
+
async remove(itemText) {
|
|
1422
|
+
return super.remove(itemText);
|
|
1423
|
+
}
|
|
1424
|
+
};
|
|
1425
|
+
|
|
1426
|
+
// src/pageObjects/elements/Filters/FilterPanel.ts
|
|
1427
|
+
var import_selenium_webdriver21 = require("selenium-webdriver");
|
|
1428
|
+
|
|
1429
|
+
// src/pageObjects/elements/Filters/PanelFilterField.ts
|
|
1430
|
+
var PanelFilterField = class extends AbstractEditor {
|
|
1431
|
+
constructor(parentCssSelector, formName, name, driver) {
|
|
1432
|
+
super(parentCssSelector, byTestIdCssSelector(createDocFilterTestId(formName, name)), driver);
|
|
1433
|
+
}
|
|
1434
|
+
/**
|
|
1435
|
+
* Возвращает значение в поле
|
|
1436
|
+
* @example
|
|
1437
|
+
* expect(await form.filterPanel.filterField('NumberFld').getValue()).toBe(10);
|
|
1438
|
+
* expect(await form.filterPanel.filterField('TextFld').getValue()).toBe('TestValue');
|
|
1439
|
+
*/
|
|
1440
|
+
async getValue() {
|
|
1441
|
+
return super.getValue();
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Устанавливает значение в поле
|
|
1445
|
+
* @example
|
|
1446
|
+
* await form.filterPanel.filterField('NumberFld').setValue(123);
|
|
1447
|
+
* await form.filterPanel.filterField('TextFld').setValue('TestValue');
|
|
1448
|
+
*/
|
|
1449
|
+
async setValue(value) {
|
|
1450
|
+
return super.setValue(value);
|
|
1451
|
+
}
|
|
1452
|
+
/**
|
|
1453
|
+
* Очищает значение в поле
|
|
1454
|
+
* @example
|
|
1455
|
+
* await form.filterPanel.filterField('NumberFld').clear();
|
|
1456
|
+
*/
|
|
1457
|
+
async clear() {
|
|
1458
|
+
return super.clear();
|
|
1459
|
+
}
|
|
1460
|
+
/**
|
|
1461
|
+
* Удаляет тег по переданному тексту
|
|
1462
|
+
* @example
|
|
1463
|
+
* await form.filterPanel.filterField('TagBox').remove('test');
|
|
1464
|
+
*/
|
|
1465
|
+
async remove(itemText) {
|
|
1466
|
+
return super.remove(itemText);
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
|
|
1470
|
+
// src/pageObjects/elements/Filters/FilterPanel.ts
|
|
1471
|
+
var drawerSelector = (formName) => `.secondary-drawer-side-panel.form-${formName}`;
|
|
1472
|
+
var FILTER_PANEL_SELECTOR = ".filter-panel";
|
|
1473
|
+
var CLOSE_SELECTOR = ".button-close";
|
|
1474
|
+
var FilterPanel = class extends AbstractElement {
|
|
1475
|
+
_formName;
|
|
1476
|
+
get filterPanelSelector() {
|
|
1477
|
+
return `${this.elementCssSelector} ${FILTER_PANEL_SELECTOR}`;
|
|
1478
|
+
}
|
|
1479
|
+
async filterPanelButtons() {
|
|
1480
|
+
const selector = `${this.elementCssSelector} ${FILTER_PANEL_SELECTOR} .filter-panel__buttons-panel .dx-button-text`;
|
|
1481
|
+
const el = await this.getElement();
|
|
1482
|
+
return el.findElements(import_selenium_webdriver21.By.css(selector));
|
|
1483
|
+
}
|
|
1484
|
+
constructor(formName, driver) {
|
|
1485
|
+
super(driver, drawerSelector(formName));
|
|
1486
|
+
this._formName = formName;
|
|
1487
|
+
}
|
|
1488
|
+
/**
|
|
1489
|
+
* Возвращает фильтр на панели фильтрации
|
|
1490
|
+
* @returns {PanelFilterField}
|
|
1491
|
+
* @example
|
|
1492
|
+
* await form.filterPanel.filterField('NumberFld');
|
|
1493
|
+
*/
|
|
1494
|
+
filterField(name) {
|
|
1495
|
+
return new PanelFilterField(this.filterPanelSelector, this._formName, name, this.driver);
|
|
1496
|
+
}
|
|
1497
|
+
async apply() {
|
|
1498
|
+
const btn = await this.findButtonByTitle("\u0417\u0430\u0441\u0442\u043E\u0441\u0443\u0432\u0430\u0442\u0438");
|
|
1499
|
+
await click(btn, this.driver);
|
|
1500
|
+
}
|
|
1501
|
+
async findButtonByTitle(title) {
|
|
1502
|
+
const buttons = await this.filterPanelButtons();
|
|
1503
|
+
for (const btn of buttons) {
|
|
1504
|
+
if (await btn.getText() === title) {
|
|
1505
|
+
return btn;
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
async clearAll() {
|
|
1510
|
+
const btn = await this.findButtonByTitle("\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u0438");
|
|
1511
|
+
await click(btn, this.driver);
|
|
1512
|
+
await this.driver.sleep(300);
|
|
1513
|
+
}
|
|
1514
|
+
async close() {
|
|
1515
|
+
const btn = await this.driver.findElement(import_selenium_webdriver21.By.css(`${this.elementCssSelector} ${CLOSE_SELECTOR}`));
|
|
1516
|
+
await click(btn, this.driver);
|
|
1074
1517
|
}
|
|
1075
1518
|
};
|
|
1076
1519
|
|
|
@@ -1108,71 +1551,90 @@ var ListForm = class extends AbstractForm {
|
|
|
1108
1551
|
* expect(listForm.toolbarButton());
|
|
1109
1552
|
*/
|
|
1110
1553
|
toolbarButton(name) {
|
|
1111
|
-
const toolbar = new
|
|
1554
|
+
const toolbar = new FormToolbar(this.containerCssSelector, this.formName, this.driver);
|
|
1112
1555
|
return toolbar.button(name);
|
|
1113
1556
|
}
|
|
1557
|
+
/**
|
|
1558
|
+
* Фильтр который расположен на форме
|
|
1559
|
+
* @example
|
|
1560
|
+
* const listForm = new MyForm();
|
|
1561
|
+
* //...
|
|
1562
|
+
* expect(listForm.formFilter());
|
|
1563
|
+
*/
|
|
1564
|
+
formFilter(name) {
|
|
1565
|
+
return new FormFilterField(this.containerCssSelector, this.formName, name, this.driver);
|
|
1566
|
+
}
|
|
1567
|
+
/**
|
|
1568
|
+
* Модель панели фильтрации
|
|
1569
|
+
* @returns {FilterPanel}
|
|
1570
|
+
* @example
|
|
1571
|
+
* const listForm = new MyForm();
|
|
1572
|
+
* //...
|
|
1573
|
+
* expect(listForm.filterPanel());
|
|
1574
|
+
*/
|
|
1575
|
+
get filterPanel() {
|
|
1576
|
+
return new FilterPanel(this.formName, this.driver);
|
|
1577
|
+
}
|
|
1114
1578
|
};
|
|
1115
1579
|
|
|
1116
|
-
// src/
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1580
|
+
// src/pageObjects/elements/Dialog.ts
|
|
1581
|
+
var import_selenium_webdriver22 = require("selenium-webdriver");
|
|
1582
|
+
var DIALOG_CLASS = ".d5-dialog";
|
|
1583
|
+
var DIALOG_TITLE_CLASS = ".dialog__title";
|
|
1584
|
+
var DIALOG_TEXT_CLASS = ".dialog__text";
|
|
1585
|
+
var DIALOG_BUTTONS_PANEL_CLASS = ".dialog__buttons-panel";
|
|
1586
|
+
var buttonByTextXpath2 = (text) => `.//span[contains(@class, "dx-button-text") and contains(text(), "${text}")]`;
|
|
1587
|
+
var DialogButton = class extends AbstractButton {
|
|
1588
|
+
text;
|
|
1589
|
+
constructor(parentCssSelector, text, driver) {
|
|
1590
|
+
super(parentCssSelector, "", driver);
|
|
1591
|
+
this.text = text;
|
|
1592
|
+
}
|
|
1593
|
+
async getElement() {
|
|
1594
|
+
const panel = await super.getElement();
|
|
1595
|
+
return panel.findElement(import_selenium_webdriver22.By.xpath(buttonByTextXpath2(this.text)));
|
|
1596
|
+
}
|
|
1597
|
+
buttonNotDisplayedError() {
|
|
1598
|
+
return `Dialog button ${this.text} cannot be clicked. It is not displayed or it is disabled`;
|
|
1599
|
+
}
|
|
1131
1600
|
};
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
var LoginPage = class extends AbstractPage {
|
|
1136
|
-
usernameField = byTestId("loginField", "input");
|
|
1137
|
-
passwordField = byTestId("passwordField", "input");
|
|
1138
|
-
loginButton = byTestId("loginButton");
|
|
1139
|
-
async locate() {
|
|
1140
|
-
await super.locate();
|
|
1141
|
-
const login = await this.driver.findElement(this.usernameField);
|
|
1142
|
-
await waitElementIsVisible({
|
|
1143
|
-
element: login,
|
|
1144
|
-
driver: this.driver
|
|
1145
|
-
});
|
|
1601
|
+
var Dialog = class extends AbstractElement {
|
|
1602
|
+
constructor(driver) {
|
|
1603
|
+
super(driver, DIALOG_CLASS);
|
|
1146
1604
|
}
|
|
1147
|
-
get
|
|
1148
|
-
return
|
|
1605
|
+
get titleSelector() {
|
|
1606
|
+
return this.joinRelativeCssSelectors([DIALOG_CLASS, DIALOG_TITLE_CLASS]);
|
|
1149
1607
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1608
|
+
get textSelector() {
|
|
1609
|
+
return this.joinRelativeCssSelectors([DIALOG_CLASS, DIALOG_TEXT_CLASS]);
|
|
1152
1610
|
}
|
|
1153
|
-
|
|
1154
|
-
|
|
1611
|
+
get buttonsSelector() {
|
|
1612
|
+
return this.joinRelativeCssSelectors([DIALOG_CLASS, DIALOG_BUTTONS_PANEL_CLASS]);
|
|
1155
1613
|
}
|
|
1156
|
-
async
|
|
1157
|
-
|
|
1614
|
+
async title() {
|
|
1615
|
+
const el = await this.driver.findElement(import_selenium_webdriver22.By.css(this.titleSelector));
|
|
1616
|
+
return await el.getText();
|
|
1158
1617
|
}
|
|
1159
|
-
async
|
|
1160
|
-
await this.
|
|
1161
|
-
await
|
|
1162
|
-
await this.clickLoginButton();
|
|
1618
|
+
async text() {
|
|
1619
|
+
const el = await this.driver.findElement(import_selenium_webdriver22.By.css(this.textSelector));
|
|
1620
|
+
return await el.getText();
|
|
1163
1621
|
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1622
|
+
button(text) {
|
|
1623
|
+
return new DialogButton(this.buttonsSelector, text, this.driver);
|
|
1166
1624
|
}
|
|
1167
1625
|
};
|
|
1168
1626
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1169
1627
|
0 && (module.exports = {
|
|
1170
1628
|
AbstractPage,
|
|
1629
|
+
Dialog,
|
|
1630
|
+
FilterPanel,
|
|
1171
1631
|
FormEdit,
|
|
1172
1632
|
FormField,
|
|
1633
|
+
FormFilterField,
|
|
1173
1634
|
ListForm,
|
|
1174
1635
|
LoginPage,
|
|
1175
1636
|
NumberEditor,
|
|
1637
|
+
PanelFilterField,
|
|
1176
1638
|
SubsystemsPanel,
|
|
1177
1639
|
TextEditor,
|
|
1178
1640
|
byTestId,
|
|
@@ -1182,6 +1644,7 @@ var LoginPage = class extends AbstractPage {
|
|
|
1182
1644
|
createDriver,
|
|
1183
1645
|
editorFactory,
|
|
1184
1646
|
elementIsNotPresent,
|
|
1647
|
+
readonlyLocator,
|
|
1185
1648
|
signIn,
|
|
1186
1649
|
wait,
|
|
1187
1650
|
waitElementIsVisible
|