d5-testing-library 1.9.0-alpha.6 → 1.9.0-alpha.8

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.
@@ -0,0 +1,7 @@
1
+ import {
2
+ FormEdit
3
+ } from "./chunk-F2Z574YJ.mjs";
4
+ import "./chunk-7WV6OWRZ.mjs";
5
+ export {
6
+ FormEdit as default
7
+ };
@@ -0,0 +1,7 @@
1
+ import {
2
+ ListForm
3
+ } from "./chunk-ZI4JD3RU.mjs";
4
+ import "./chunk-7WV6OWRZ.mjs";
5
+ export {
6
+ ListForm as default
7
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ TreeView
3
+ } from "./chunk-UFDW7PIX.mjs";
4
+ import "./chunk-ZI4JD3RU.mjs";
5
+ import "./chunk-7WV6OWRZ.mjs";
6
+ export {
7
+ TreeView as default
8
+ };
@@ -980,6 +980,7 @@ var FormField = class extends AbstractEditor {
980
980
  import { By as By15 } from "selenium-webdriver";
981
981
 
982
982
  // src/pageObjects/elements/AbstractButton.ts
983
+ var D5_BUTTON_IS_PRESSED = "d5-is-pressed";
983
984
  var AbstractButton = class extends AbstractElementWithParent {
984
985
  constructor(parentCssSelector, elementCssSelector, driver) {
985
986
  super(parentCssSelector, elementCssSelector, driver);
@@ -1005,6 +1006,15 @@ var AbstractButton = class extends AbstractElementWithParent {
1005
1006
  return false;
1006
1007
  }
1007
1008
  }
1009
+ async isPressed() {
1010
+ try {
1011
+ const button = await this.getElement();
1012
+ const classAttribute = await button.getAttribute("class");
1013
+ return classAttribute.includes(D5_BUTTON_IS_PRESSED);
1014
+ } catch {
1015
+ return false;
1016
+ }
1017
+ }
1008
1018
  };
1009
1019
 
1010
1020
  // src/pageObjects/elements/DXComponents/DXButton.ts
@@ -1276,15 +1286,15 @@ async function classDependencyInjector(formType) {
1276
1286
  let SubFormFactoryClass;
1277
1287
  switch (formType) {
1278
1288
  case "1" /* LIST */:
1279
- SubFormFactoryClass = (await import("./ListForm-HUG5M72M.mjs")).default;
1289
+ SubFormFactoryClass = (await import("./ListForm-M2NWQRYX.mjs")).default;
1280
1290
  break;
1281
1291
  case "3" /* TREE */:
1282
- SubFormFactoryClass = (await import("./TreeView-CGA4HXSC.mjs")).default;
1292
+ SubFormFactoryClass = (await import("./TreeView-SI5MHDCO.mjs")).default;
1283
1293
  break;
1284
1294
  case "2" /* EDIT */:
1285
1295
  case "99" /* FREE_FORM */:
1286
1296
  case "4" /* REPORT */:
1287
- SubFormFactoryClass = (await import("./FormEdit-644JGVDR.mjs")).default;
1297
+ SubFormFactoryClass = (await import("./FormEdit-377LRKDA.mjs")).default;
1288
1298
  break;
1289
1299
  default:
1290
1300
  throw new Error(`Unsupported form type ${formType}`);
@@ -3,7 +3,7 @@ import {
3
3
  FormField,
4
4
  click,
5
5
  safeWait
6
- } from "./chunk-A423WR6K.mjs";
6
+ } from "./chunk-7WV6OWRZ.mjs";
7
7
 
8
8
  // src/pageObjects/elements/Forms/FormEdit.ts
9
9
  import { By } from "selenium-webdriver";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ListForm
3
- } from "./chunk-MDFZWPXC.mjs";
3
+ } from "./chunk-ZI4JD3RU.mjs";
4
4
 
5
5
  // src/pageObjects/elements/Forms/TreeView.ts
6
6
  var TREELIST_HEADER_CSS_SELECTOR = ".dx-treelist-headers .dx-treelist-content .dx-treelist-table.dx-treelist-table-fixed";
@@ -18,13 +18,13 @@ import {
18
18
  staleElementAction,
19
19
  waitElementIsClickable_default,
20
20
  waitElementIsVisible_default
21
- } from "./chunk-A423WR6K.mjs";
21
+ } from "./chunk-7WV6OWRZ.mjs";
22
22
 
23
23
  // src/pageObjects/elements/Table/Table.ts
24
24
  import { By as By6 } from "selenium-webdriver";
25
25
 
26
26
  // src/pageObjects/elements/Table/elements/Row.ts
27
- import { By as By3 } from "selenium-webdriver";
27
+ import { By as By3, Key } from "selenium-webdriver";
28
28
 
29
29
  // src/pageObjects/elements/Table/elements/Cell.ts
30
30
  import { By as By2 } from "selenium-webdriver";
@@ -153,9 +153,18 @@ var Row = class extends AbstractElementWithParent {
153
153
  getCellByTitle(title) {
154
154
  return this._getCell({ title });
155
155
  }
156
- async select() {
156
+ async select(preserve = false) {
157
157
  await staleElementAction(async () => {
158
158
  const rowEl = await this.getElement();
159
+ const isSelected = (await this.getClasses()).includes(DX_SELECTION_CLASS);
160
+ if (isSelected && !preserve) {
161
+ await this.driver.actions({ async: true }).keyUp(Key.CONTROL).perform();
162
+ }
163
+ if (preserve && !isSelected) {
164
+ await this.driver.actions({ async: true }).keyDown(Key.CONTROL).perform();
165
+ await click(rowEl, this.driver);
166
+ return;
167
+ }
159
168
  await click(rowEl, this.driver);
160
169
  });
161
170
  await safeWait(
@@ -467,9 +476,19 @@ var Table = class extends AbstractElementWithParent {
467
476
  /**
468
477
  * Вибрати рядок по індексу.
469
478
  * @param index починається з 0
479
+ * @param preserve boolean який изначає, чи повинні раніше вибрані рядки залишатися вибраними
480
+ */
481
+ selectRowByIndex(index, preserve = false) {
482
+ return this.getRowByIndex(index).select(preserve);
483
+ }
484
+ /**
485
+ * Вибрати масив рядків по індексу.
486
+ * @param indexes починається з 0
470
487
  */
471
- selectRowByIndex(index) {
472
- return this.getRowByIndex(index).select();
488
+ async selectRowsByIndexes(indexes) {
489
+ for (const index of indexes) {
490
+ await this.selectRowByIndex(index, true);
491
+ }
473
492
  }
474
493
  async getRows() {
475
494
  const rowsFullCssSelector = `${this.getFullCssSelector()} ${this.tableContentCssSelector} .dx-row.dx-data-row`;
@@ -776,6 +795,14 @@ var ToolbarItem = class extends AbstractElementWithParent {
776
795
  return false;
777
796
  }
778
797
  }
798
+ async isPressed() {
799
+ try {
800
+ await this.init();
801
+ return this._button.isPressed();
802
+ } catch (error) {
803
+ return false;
804
+ }
805
+ }
779
806
  async getTitle() {
780
807
  await this.init();
781
808
  return await this._button.getTitle();
@@ -1142,13 +1142,14 @@ var init_createDataTestId = __esm({
1142
1142
  });
1143
1143
 
1144
1144
  // src/pageObjects/elements/AbstractButton.ts
1145
- var AbstractButton;
1145
+ var D5_BUTTON_IS_PRESSED, AbstractButton;
1146
1146
  var init_AbstractButton = __esm({
1147
1147
  "src/pageObjects/elements/AbstractButton.ts"() {
1148
1148
  "use strict";
1149
1149
  init_AbstractElementWithParent();
1150
1150
  init_actions();
1151
1151
  init_waitElementIsClickable();
1152
+ D5_BUTTON_IS_PRESSED = "d5-is-pressed";
1152
1153
  AbstractButton = class extends AbstractElementWithParent {
1153
1154
  constructor(parentCssSelector, elementCssSelector, driver) {
1154
1155
  super(parentCssSelector, elementCssSelector, driver);
@@ -1174,6 +1175,15 @@ var init_AbstractButton = __esm({
1174
1175
  return false;
1175
1176
  }
1176
1177
  }
1178
+ async isPressed() {
1179
+ try {
1180
+ const button = await this.getElement();
1181
+ const classAttribute = await button.getAttribute("class");
1182
+ return classAttribute.includes(D5_BUTTON_IS_PRESSED);
1183
+ } catch {
1184
+ return false;
1185
+ }
1186
+ }
1177
1187
  };
1178
1188
  }
1179
1189
  });
@@ -1684,9 +1694,18 @@ var init_Row = __esm({
1684
1694
  getCellByTitle(title) {
1685
1695
  return this._getCell({ title });
1686
1696
  }
1687
- async select() {
1697
+ async select(preserve = false) {
1688
1698
  await staleElementAction(async () => {
1689
1699
  const rowEl = await this.getElement();
1700
+ const isSelected = (await this.getClasses()).includes(DX_SELECTION_CLASS);
1701
+ if (isSelected && !preserve) {
1702
+ await this.driver.actions({ async: true }).keyUp(import_selenium_webdriver22.Key.CONTROL).perform();
1703
+ }
1704
+ if (preserve && !isSelected) {
1705
+ await this.driver.actions({ async: true }).keyDown(import_selenium_webdriver22.Key.CONTROL).perform();
1706
+ await click(rowEl, this.driver);
1707
+ return;
1708
+ }
1690
1709
  await click(rowEl, this.driver);
1691
1710
  });
1692
1711
  await safeWait(
@@ -2215,9 +2234,19 @@ var init_Table = __esm({
2215
2234
  /**
2216
2235
  * Вибрати рядок по індексу.
2217
2236
  * @param index починається з 0
2237
+ * @param preserve boolean який изначає, чи повинні раніше вибрані рядки залишатися вибраними
2238
+ */
2239
+ selectRowByIndex(index, preserve = false) {
2240
+ return this.getRowByIndex(index).select(preserve);
2241
+ }
2242
+ /**
2243
+ * Вибрати масив рядків по індексу.
2244
+ * @param indexes починається з 0
2218
2245
  */
2219
- selectRowByIndex(index) {
2220
- return this.getRowByIndex(index).select();
2246
+ async selectRowsByIndexes(indexes) {
2247
+ for (const index of indexes) {
2248
+ await this.selectRowByIndex(index, true);
2249
+ }
2221
2250
  }
2222
2251
  async getRows() {
2223
2252
  const rowsFullCssSelector = `${this.getFullCssSelector()} ${this.tableContentCssSelector} .dx-row.dx-data-row`;
@@ -2573,6 +2602,14 @@ var init_ToolbarItem = __esm({
2573
2602
  return false;
2574
2603
  }
2575
2604
  }
2605
+ async isPressed() {
2606
+ try {
2607
+ await this.init();
2608
+ return this._button.isPressed();
2609
+ } catch (error) {
2610
+ return false;
2611
+ }
2612
+ }
2576
2613
  async getTitle() {
2577
2614
  await this.init();
2578
2615
  return await this._button.getTitle();
@@ -250,6 +250,7 @@ interface Button {
250
250
  isDisabled(): Promise<boolean>;
251
251
  isDisplayed(): Promise<boolean>;
252
252
  getTitle(): Promise<string>;
253
+ isPressed(): Promise<boolean>;
253
254
  }
254
255
  declare abstract class AbstractButton extends AbstractElementWithParent implements Button {
255
256
  protected constructor(parentCssSelector: string, elementCssSelector: string, driver: WebDriver);
@@ -257,6 +258,7 @@ declare abstract class AbstractButton extends AbstractElementWithParent implemen
257
258
  click(): Promise<void>;
258
259
  isDisabled(): Promise<boolean>;
259
260
  isDisplayed(): Promise<boolean>;
261
+ isPressed(): Promise<boolean>;
260
262
  abstract getTitle(): Promise<string>;
261
263
  }
262
264
 
@@ -517,6 +519,7 @@ declare class ToolbarItem extends AbstractElementWithParent implements Button {
517
519
  click(): Promise<void>;
518
520
  isDisabled(): Promise<boolean>;
519
521
  isDisplayed(): Promise<boolean>;
522
+ isPressed(): Promise<boolean>;
520
523
  getTitle(): Promise<string>;
521
524
  get menu(): ToolbarMenu;
522
525
  }
@@ -581,7 +584,7 @@ declare class Row extends AbstractElementWithParent {
581
584
  getCellByIndex(index: number): Cell;
582
585
  getCell(name: string): Cell;
583
586
  getCellByTitle(title: string): Cell;
584
- select(): Promise<void>;
587
+ select(preserve?: boolean): Promise<void>;
585
588
  isSelected(): Promise<boolean>;
586
589
  getIndex(): number;
587
590
  getCells(): Promise<Cell[]>;
@@ -644,8 +647,14 @@ declare class Table extends AbstractElementWithParent {
644
647
  /**
645
648
  * Вибрати рядок по індексу.
646
649
  * @param index починається з 0
650
+ * @param preserve boolean який изначає, чи повинні раніше вибрані рядки залишатися вибраними
647
651
  */
648
- selectRowByIndex(index: number): Promise<void>;
652
+ selectRowByIndex(index: number, preserve?: boolean): Promise<void>;
653
+ /**
654
+ * Вибрати масив рядків по індексу.
655
+ * @param indexes починається з 0
656
+ */
657
+ selectRowsByIndexes(indexes: number[]): Promise<void>;
649
658
  getRows(): Promise<Row[]>;
650
659
  getColumns(): Promise<Column[]>;
651
660
  element(): Promise<selenium_webdriver.WebElement>;
@@ -250,6 +250,7 @@ interface Button {
250
250
  isDisabled(): Promise<boolean>;
251
251
  isDisplayed(): Promise<boolean>;
252
252
  getTitle(): Promise<string>;
253
+ isPressed(): Promise<boolean>;
253
254
  }
254
255
  declare abstract class AbstractButton extends AbstractElementWithParent implements Button {
255
256
  protected constructor(parentCssSelector: string, elementCssSelector: string, driver: WebDriver);
@@ -257,6 +258,7 @@ declare abstract class AbstractButton extends AbstractElementWithParent implemen
257
258
  click(): Promise<void>;
258
259
  isDisabled(): Promise<boolean>;
259
260
  isDisplayed(): Promise<boolean>;
261
+ isPressed(): Promise<boolean>;
260
262
  abstract getTitle(): Promise<string>;
261
263
  }
262
264
 
@@ -517,6 +519,7 @@ declare class ToolbarItem extends AbstractElementWithParent implements Button {
517
519
  click(): Promise<void>;
518
520
  isDisabled(): Promise<boolean>;
519
521
  isDisplayed(): Promise<boolean>;
522
+ isPressed(): Promise<boolean>;
520
523
  getTitle(): Promise<string>;
521
524
  get menu(): ToolbarMenu;
522
525
  }
@@ -581,7 +584,7 @@ declare class Row extends AbstractElementWithParent {
581
584
  getCellByIndex(index: number): Cell;
582
585
  getCell(name: string): Cell;
583
586
  getCellByTitle(title: string): Cell;
584
- select(): Promise<void>;
587
+ select(preserve?: boolean): Promise<void>;
585
588
  isSelected(): Promise<boolean>;
586
589
  getIndex(): number;
587
590
  getCells(): Promise<Cell[]>;
@@ -644,8 +647,14 @@ declare class Table extends AbstractElementWithParent {
644
647
  /**
645
648
  * Вибрати рядок по індексу.
646
649
  * @param index починається з 0
650
+ * @param preserve boolean який изначає, чи повинні раніше вибрані рядки залишатися вибраними
647
651
  */
648
- selectRowByIndex(index: number): Promise<void>;
652
+ selectRowByIndex(index: number, preserve?: boolean): Promise<void>;
653
+ /**
654
+ * Вибрати масив рядків по індексу.
655
+ * @param indexes починається з 0
656
+ */
657
+ selectRowsByIndexes(indexes: number[]): Promise<void>;
649
658
  getRows(): Promise<Row[]>;
650
659
  getColumns(): Promise<Column[]>;
651
660
  element(): Promise<selenium_webdriver.WebElement>;
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  TreeView
3
- } from "./chunk-IUB5N5UY.mjs";
3
+ } from "./chunk-UFDW7PIX.mjs";
4
4
  import {
5
5
  FilterPanel,
6
6
  FormFilterField,
7
7
  ListForm,
8
8
  PanelFilterField
9
- } from "./chunk-MDFZWPXC.mjs";
9
+ } from "./chunk-ZI4JD3RU.mjs";
10
10
  import {
11
11
  FormEdit
12
- } from "./chunk-BYT5XXKQ.mjs";
12
+ } from "./chunk-F2Z574YJ.mjs";
13
13
  import {
14
14
  AbstractButton,
15
15
  AbstractElement,
@@ -32,7 +32,7 @@ import {
32
32
  safeWait,
33
33
  waitElementIsClickable_default,
34
34
  waitElementIsVisible_default
35
- } from "./chunk-A423WR6K.mjs";
35
+ } from "./chunk-7WV6OWRZ.mjs";
36
36
 
37
37
  // src/pageObjects/pages/LoginPage.ts
38
38
  import { By } from "selenium-webdriver";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  TreeView
3
- } from "./chunk-IUB5N5UY.mjs";
3
+ } from "./chunk-UFDW7PIX.mjs";
4
4
  import {
5
5
  FilterPanel,
6
6
  FormFilterField,
7
7
  ListForm,
8
8
  PanelFilterField
9
- } from "./chunk-MDFZWPXC.mjs";
9
+ } from "./chunk-ZI4JD3RU.mjs";
10
10
  import {
11
11
  FormEdit
12
- } from "./chunk-BYT5XXKQ.mjs";
12
+ } from "./chunk-F2Z574YJ.mjs";
13
13
  import {
14
14
  AbstractButton,
15
15
  AbstractElement,
@@ -32,7 +32,7 @@ import {
32
32
  safeWait,
33
33
  waitElementIsClickable_default,
34
34
  waitElementIsVisible_default
35
- } from "./chunk-A423WR6K.mjs";
35
+ } from "./chunk-7WV6OWRZ.mjs";
36
36
 
37
37
  // src/pageObjects/pages/LoginPage.ts
38
38
  import { By } from "selenium-webdriver";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "d5-testing-library",
3
- "version": "1.9.0-alpha.6",
3
+ "version": "1.9.0-alpha.8",
4
4
  "description": "e2e testing D5 projects",
5
5
  "main": "dist/cjs/d5-testing-library.cjs",
6
6
  "module": "dist/d5-testing-library.legacy-esm.js",
@@ -1,7 +0,0 @@
1
- import {
2
- FormEdit
3
- } from "./chunk-BYT5XXKQ.mjs";
4
- import "./chunk-A423WR6K.mjs";
5
- export {
6
- FormEdit as default
7
- };
@@ -1,7 +0,0 @@
1
- import {
2
- ListForm
3
- } from "./chunk-MDFZWPXC.mjs";
4
- import "./chunk-A423WR6K.mjs";
5
- export {
6
- ListForm as default
7
- };
@@ -1,8 +0,0 @@
1
- import {
2
- TreeView
3
- } from "./chunk-IUB5N5UY.mjs";
4
- import "./chunk-MDFZWPXC.mjs";
5
- import "./chunk-A423WR6K.mjs";
6
- export {
7
- TreeView as default
8
- };