d5-testing-library 1.8.0-alpha.11 → 1.8.0-alpha.13

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-E3O6YV4X.mjs";
4
+ import "./chunk-D7226XWY.mjs";
5
+ export {
6
+ FormEdit as default
7
+ };
@@ -0,0 +1,7 @@
1
+ import {
2
+ ListForm
3
+ } from "./chunk-YSGDK2Y2.mjs";
4
+ import "./chunk-D7226XWY.mjs";
5
+ export {
6
+ ListForm as default
7
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ TreeView
3
+ } from "./chunk-7IHH2VP3.mjs";
4
+ import "./chunk-YSGDK2Y2.mjs";
5
+ import "./chunk-D7226XWY.mjs";
6
+ export {
7
+ TreeView as default
8
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ListForm
3
- } from "./chunk-LJ7UTZYH.mjs";
3
+ } from "./chunk-YSGDK2Y2.mjs";
4
4
 
5
5
  // src/pageObjects/elements/Forms/TreeView.ts
6
6
  var TREELIST_HEADER_CSS_SELECTOR = ".dx-treelist-headers .dx-treelist-content:not(.dx-datagrid-content-fixed)";
@@ -226,8 +226,9 @@ var TextEditor = class extends AbstractDXEditorWithInput {
226
226
  super(parentCssSelector, elementCssSelector, driver);
227
227
  this.setClearStrategy(new InputClearStrategy());
228
228
  }
229
- getValue() {
230
- return this.getInputValue();
229
+ async getValue() {
230
+ const value = await super.getInputValue();
231
+ return value == "" ? null : value;
231
232
  }
232
233
  setValue(value) {
233
234
  return this.setInputValue(value);
@@ -559,8 +560,12 @@ var BaseDateEditor = class extends AbstractDXEditorWithInput {
559
560
  const button = await dateField.findElement(By8.css(`.${BTN_CALENDAR_POPOVER_OPEN_SELECTOR}`));
560
561
  await button.click();
561
562
  const calendarPopoverElement = await this.driver.findElement(By8.css(calendarPopoverSelector));
562
- const dateFromInput = await calendarPopoverElement.findElement(By8.css(`.${BTN_CALENDAR_POPOVER_DATE_FROM_INPUT_SELECTOR} .dx-texteditor-input`));
563
- const dateToInput = await calendarPopoverElement.findElement(By8.css(`.${BTN_CALENDAR_POPOVER_DATE_TO_INPUT_SELECTOR} .dx-texteditor-input`));
563
+ const dateFromInput = await calendarPopoverElement.findElement(
564
+ By8.css(`.${BTN_CALENDAR_POPOVER_DATE_FROM_INPUT_SELECTOR} .dx-texteditor-input`)
565
+ );
566
+ const dateToInput = await calendarPopoverElement.findElement(
567
+ By8.css(`.${BTN_CALENDAR_POPOVER_DATE_TO_INPUT_SELECTOR} .dx-texteditor-input`)
568
+ );
564
569
  await dateFromInput.click();
565
570
  await dateFromInput.sendKeys(formattedDates[0]);
566
571
  await dateToInput.click();
@@ -1254,15 +1259,15 @@ async function classDependencyInjector(formType) {
1254
1259
  let SubFormFactoryClass;
1255
1260
  switch (formType) {
1256
1261
  case "1" /* LIST */:
1257
- SubFormFactoryClass = (await import("./ListForm-Z63MCMIH.mjs")).default;
1262
+ SubFormFactoryClass = (await import("./ListForm-P36U2E2W.mjs")).default;
1258
1263
  break;
1259
1264
  case "3" /* TREE */:
1260
- SubFormFactoryClass = (await import("./TreeView-LMBX3YNB.mjs")).default;
1265
+ SubFormFactoryClass = (await import("./TreeView-NY7F4AKZ.mjs")).default;
1261
1266
  break;
1262
1267
  case "2" /* EDIT */:
1263
1268
  case "99" /* FREE_FORM */:
1264
1269
  case "4" /* REPORT */:
1265
- SubFormFactoryClass = (await import("./FormEdit-NPGDM3FJ.mjs")).default;
1270
+ SubFormFactoryClass = (await import("./FormEdit-NZEL6BMH.mjs")).default;
1266
1271
  break;
1267
1272
  default:
1268
1273
  throw new Error(`Unsupported form type ${formType}`);
@@ -3,7 +3,7 @@ import {
3
3
  FormField,
4
4
  click,
5
5
  wait
6
- } from "./chunk-45B4TCE4.mjs";
6
+ } from "./chunk-D7226XWY.mjs";
7
7
 
8
8
  // src/pageObjects/elements/Forms/FormEdit.ts
9
9
  import { By } from "selenium-webdriver";
@@ -16,7 +16,7 @@ import {
16
16
  wait,
17
17
  waitElementIsClickable,
18
18
  waitElementIsVisible
19
- } from "./chunk-45B4TCE4.mjs";
19
+ } from "./chunk-D7226XWY.mjs";
20
20
 
21
21
  // src/pageObjects/elements/Table/Table.ts
22
22
  import { By as By5 } from "selenium-webdriver";
@@ -65,7 +65,31 @@ var Cell = class extends AbstractElementWithParent {
65
65
  for (const tag of tags) {
66
66
  values.push(await tag.getAttribute("textContent"));
67
67
  }
68
- return values;
68
+ return values.length ? values : null;
69
+ }
70
+ async getNumberValue(cellEl) {
71
+ const value = (await cellEl.getText()).trim();
72
+ return value == "" ? null : Number.parseFloat(value);
73
+ }
74
+ async getDateValue(cellEl, cellElClass) {
75
+ const value = (await cellEl.getText()).trim();
76
+ if (value === "")
77
+ return null;
78
+ const isWithTime = cellElClass.includes("with-time");
79
+ try {
80
+ if (isWithTime) {
81
+ const [datePart, timePart] = value.split(", ");
82
+ const [day, month, year] = datePart.split(".").map(Number);
83
+ const [hours, minutes] = timePart.split(":").map(Number);
84
+ return new Date(Date.UTC(year, month - 1, day, hours, minutes));
85
+ } else {
86
+ const [day, month, year] = value.split(".").map(Number);
87
+ return new Date(Date.UTC(year, month - 1, day));
88
+ }
89
+ } catch (error) {
90
+ console.error(`Error parsing date value "${value}":`, error);
91
+ return null;
92
+ }
69
93
  }
70
94
  async getElement() {
71
95
  if (this._index == null) {
@@ -80,7 +104,12 @@ var Cell = class extends AbstractElementWithParent {
80
104
  return this.getBooleanValue(cellEl);
81
105
  if (cellElClass.includes("tags-column" /* Tags */))
82
106
  return this.getTagsValue(cellEl);
83
- return cellEl.getText();
107
+ if (cellElClass.includes("number-column" /* Number */))
108
+ return this.getNumberValue(cellEl);
109
+ if (cellElClass.includes("date-column" /* Date */))
110
+ return this.getDateValue(cellEl, cellElClass);
111
+ const cellText = await cellEl.getText();
112
+ return cellText == "" ? null : cellText;
84
113
  }
85
114
  getIndex() {
86
115
  return this._index;
@@ -390,8 +419,20 @@ var ToolbarMenu = class extends AbstractElementWithParent {
390
419
  this._formName = formName;
391
420
  }
392
421
  async openDropdownMenu() {
393
- const dropdown = await this.getElement();
394
- await click(dropdown, this.driver);
422
+ await wait(
423
+ async () => {
424
+ const dropdown = await this.getElement();
425
+ await click(dropdown, this.driver);
426
+ try {
427
+ const contextMenu = this.driver.findElement(By6.css(`.dx-overlay-wrapper .${CONTEXT_MENU_CLASS}`));
428
+ return await contextMenu.isDisplayed() && await contextMenu.isEnabled();
429
+ } catch (_) {
430
+ return false;
431
+ }
432
+ },
433
+ this.driver,
434
+ `Cannot find dropdown element`
435
+ );
395
436
  }
396
437
  getCssSelectorToButton(name) {
397
438
  return byTestId(`ftb-${this._formName}-${name}`);
@@ -337,8 +337,9 @@ var init_TextEditor = __esm({
337
337
  super(parentCssSelector, elementCssSelector, driver);
338
338
  this.setClearStrategy(new InputClearStrategy());
339
339
  }
340
- getValue() {
341
- return this.getInputValue();
340
+ async getValue() {
341
+ const value = await super.getInputValue();
342
+ return value == "" ? null : value;
342
343
  }
343
344
  setValue(value) {
344
345
  return this.setInputValue(value);
@@ -768,8 +769,12 @@ var init_BaseDateEditor = __esm({
768
769
  const button = await dateField.findElement(import_selenium_webdriver12.By.css(`.${BTN_CALENDAR_POPOVER_OPEN_SELECTOR}`));
769
770
  await button.click();
770
771
  const calendarPopoverElement = await this.driver.findElement(import_selenium_webdriver12.By.css(calendarPopoverSelector));
771
- const dateFromInput = await calendarPopoverElement.findElement(import_selenium_webdriver12.By.css(`.${BTN_CALENDAR_POPOVER_DATE_FROM_INPUT_SELECTOR} .dx-texteditor-input`));
772
- const dateToInput = await calendarPopoverElement.findElement(import_selenium_webdriver12.By.css(`.${BTN_CALENDAR_POPOVER_DATE_TO_INPUT_SELECTOR} .dx-texteditor-input`));
772
+ const dateFromInput = await calendarPopoverElement.findElement(
773
+ import_selenium_webdriver12.By.css(`.${BTN_CALENDAR_POPOVER_DATE_FROM_INPUT_SELECTOR} .dx-texteditor-input`)
774
+ );
775
+ const dateToInput = await calendarPopoverElement.findElement(
776
+ import_selenium_webdriver12.By.css(`.${BTN_CALENDAR_POPOVER_DATE_TO_INPUT_SELECTOR} .dx-texteditor-input`)
777
+ );
773
778
  await dateFromInput.click();
774
779
  await dateFromInput.sendKeys(formattedDates[0]);
775
780
  await dateToInput.click();
@@ -1581,7 +1586,31 @@ var init_Cell = __esm({
1581
1586
  for (const tag of tags) {
1582
1587
  values.push(await tag.getAttribute("textContent"));
1583
1588
  }
1584
- return values;
1589
+ return values.length ? values : null;
1590
+ }
1591
+ async getNumberValue(cellEl) {
1592
+ const value = (await cellEl.getText()).trim();
1593
+ return value == "" ? null : Number.parseFloat(value);
1594
+ }
1595
+ async getDateValue(cellEl, cellElClass) {
1596
+ const value = (await cellEl.getText()).trim();
1597
+ if (value === "")
1598
+ return null;
1599
+ const isWithTime = cellElClass.includes("with-time");
1600
+ try {
1601
+ if (isWithTime) {
1602
+ const [datePart, timePart] = value.split(", ");
1603
+ const [day, month, year] = datePart.split(".").map(Number);
1604
+ const [hours, minutes] = timePart.split(":").map(Number);
1605
+ return new Date(Date.UTC(year, month - 1, day, hours, minutes));
1606
+ } else {
1607
+ const [day, month, year] = value.split(".").map(Number);
1608
+ return new Date(Date.UTC(year, month - 1, day));
1609
+ }
1610
+ } catch (error) {
1611
+ console.error(`Error parsing date value "${value}":`, error);
1612
+ return null;
1613
+ }
1585
1614
  }
1586
1615
  async getElement() {
1587
1616
  if (this._index == null) {
@@ -1596,7 +1625,12 @@ var init_Cell = __esm({
1596
1625
  return this.getBooleanValue(cellEl);
1597
1626
  if (cellElClass.includes("tags-column" /* Tags */))
1598
1627
  return this.getTagsValue(cellEl);
1599
- return cellEl.getText();
1628
+ if (cellElClass.includes("number-column" /* Number */))
1629
+ return this.getNumberValue(cellEl);
1630
+ if (cellElClass.includes("date-column" /* Date */))
1631
+ return this.getDateValue(cellEl, cellElClass);
1632
+ const cellText = await cellEl.getText();
1633
+ return cellText == "" ? null : cellText;
1600
1634
  }
1601
1635
  getIndex() {
1602
1636
  return this._index;
@@ -2100,6 +2134,7 @@ var init_ToolbarMenu = __esm({
2100
2134
  init_actions();
2101
2135
  init_waitElementIsClickable();
2102
2136
  init_fixElementStaleError();
2137
+ init_wait();
2103
2138
  SPINDOWN_CLASS = ".dx-icon-spindown";
2104
2139
  CONTEXT_MENU_CLASS = "dx-context-menu";
2105
2140
  buttonGroupItemSelector = (formName, name) => byTestIdCssSelector(`ftb-${formName}-${name}`);
@@ -2112,8 +2147,20 @@ var init_ToolbarMenu = __esm({
2112
2147
  this._formName = formName;
2113
2148
  }
2114
2149
  async openDropdownMenu() {
2115
- const dropdown = await this.getElement();
2116
- await click(dropdown, this.driver);
2150
+ await wait(
2151
+ async () => {
2152
+ const dropdown = await this.getElement();
2153
+ await click(dropdown, this.driver);
2154
+ try {
2155
+ const contextMenu = this.driver.findElement(import_selenium_webdriver25.By.css(`.dx-overlay-wrapper .${CONTEXT_MENU_CLASS}`));
2156
+ return await contextMenu.isDisplayed() && await contextMenu.isEnabled();
2157
+ } catch (_) {
2158
+ return false;
2159
+ }
2160
+ },
2161
+ this.driver,
2162
+ `Cannot find dropdown element`
2163
+ );
2117
2164
  }
2118
2165
  getCssSelectorToButton(name) {
2119
2166
  return byTestId(`ftb-${this._formName}-${name}`);
@@ -3258,6 +3305,7 @@ init_Editors();
3258
3305
  // src/pageObjects/elements/SubsystemsPanel/SubsystemItem.ts
3259
3306
  init_actions();
3260
3307
  init_fixElementStaleError();
3308
+ init_waitElementIsVisible();
3261
3309
  var SubsystemItem = class {
3262
3310
  bySelector;
3263
3311
  driver;
@@ -3270,10 +3318,22 @@ var SubsystemItem = class {
3270
3318
  }
3271
3319
  async getTitle() {
3272
3320
  const el = await this.getElement();
3321
+ await waitElementIsVisible(
3322
+ {
3323
+ element: el,
3324
+ driver: this.driver
3325
+ }
3326
+ );
3273
3327
  return await el.getAttribute("data-title");
3274
3328
  }
3275
3329
  async click() {
3276
3330
  const el = await this.getElement();
3331
+ await waitElementIsVisible(
3332
+ {
3333
+ element: el,
3334
+ driver: this.driver
3335
+ }
3336
+ );
3277
3337
  await click(el, this.driver);
3278
3338
  }
3279
3339
  };
@@ -167,7 +167,7 @@ declare abstract class AbstractDXEditorWithInput extends AbstractElementWithPare
167
167
 
168
168
  declare class TextEditor extends AbstractDXEditorWithInput {
169
169
  constructor(parentCssSelector: string, elementCssSelector: string, driver?: WebDriver);
170
- getValue(): Promise<string>;
170
+ getValue(): Promise<string | null>;
171
171
  setValue(value: string): Promise<void>;
172
172
  }
173
173
 
@@ -481,8 +481,10 @@ declare class Cell extends AbstractElementWithParent {
481
481
  private set index(value);
482
482
  private getBooleanValue;
483
483
  private getTagsValue;
484
+ private getNumberValue;
485
+ private getDateValue;
484
486
  getElement(): Promise<WebElement>;
485
- getValue(): Promise<string | 1 | 0 | string[]>;
487
+ getValue(): Promise<string | number | 1 | 0 | string[] | Date>;
486
488
  getIndex(): number;
487
489
  }
488
490
 
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  TreeView
3
- } from "./chunk-745NW6FN.mjs";
3
+ } from "./chunk-7IHH2VP3.mjs";
4
4
  import {
5
5
  FilterPanel,
6
6
  FormFilterField,
7
7
  ListForm,
8
8
  PanelFilterField
9
- } from "./chunk-LJ7UTZYH.mjs";
9
+ } from "./chunk-YSGDK2Y2.mjs";
10
10
  import {
11
11
  FormEdit
12
- } from "./chunk-K4ELCNMK.mjs";
12
+ } from "./chunk-E3O6YV4X.mjs";
13
13
  import {
14
14
  AbstractButton,
15
15
  AbstractElement,
@@ -30,7 +30,7 @@ import {
30
30
  readonlyLocator,
31
31
  wait,
32
32
  waitElementIsVisible
33
- } from "./chunk-45B4TCE4.mjs";
33
+ } from "./chunk-D7226XWY.mjs";
34
34
 
35
35
  // src/pageObjects/pages/LoginPage.ts
36
36
  var LOGIN_PATH = "/login";
@@ -121,10 +121,22 @@ var SubsystemItem = class {
121
121
  }
122
122
  async getTitle() {
123
123
  const el = await this.getElement();
124
+ await waitElementIsVisible(
125
+ {
126
+ element: el,
127
+ driver: this.driver
128
+ }
129
+ );
124
130
  return await el.getAttribute("data-title");
125
131
  }
126
132
  async click() {
127
133
  const el = await this.getElement();
134
+ await waitElementIsVisible(
135
+ {
136
+ element: el,
137
+ driver: this.driver
138
+ }
139
+ );
128
140
  await click(el, this.driver);
129
141
  }
130
142
  };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  TreeView
3
- } from "./chunk-745NW6FN.mjs";
3
+ } from "./chunk-7IHH2VP3.mjs";
4
4
  import {
5
5
  FilterPanel,
6
6
  FormFilterField,
7
7
  ListForm,
8
8
  PanelFilterField
9
- } from "./chunk-LJ7UTZYH.mjs";
9
+ } from "./chunk-YSGDK2Y2.mjs";
10
10
  import {
11
11
  FormEdit
12
- } from "./chunk-K4ELCNMK.mjs";
12
+ } from "./chunk-E3O6YV4X.mjs";
13
13
  import {
14
14
  AbstractButton,
15
15
  AbstractElement,
@@ -30,7 +30,7 @@ import {
30
30
  readonlyLocator,
31
31
  wait,
32
32
  waitElementIsVisible
33
- } from "./chunk-45B4TCE4.mjs";
33
+ } from "./chunk-D7226XWY.mjs";
34
34
 
35
35
  // src/pageObjects/pages/LoginPage.ts
36
36
  var LOGIN_PATH = "/login";
@@ -121,10 +121,22 @@ var SubsystemItem = class {
121
121
  }
122
122
  async getTitle() {
123
123
  const el = await this.getElement();
124
+ await waitElementIsVisible(
125
+ {
126
+ element: el,
127
+ driver: this.driver
128
+ }
129
+ );
124
130
  return await el.getAttribute("data-title");
125
131
  }
126
132
  async click() {
127
133
  const el = await this.getElement();
134
+ await waitElementIsVisible(
135
+ {
136
+ element: el,
137
+ driver: this.driver
138
+ }
139
+ );
128
140
  await click(el, this.driver);
129
141
  }
130
142
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "d5-testing-library",
3
- "version": "1.8.0-alpha.11",
3
+ "version": "1.8.0-alpha.13",
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-K4ELCNMK.mjs";
4
- import "./chunk-45B4TCE4.mjs";
5
- export {
6
- FormEdit as default
7
- };
@@ -1,7 +0,0 @@
1
- import {
2
- ListForm
3
- } from "./chunk-LJ7UTZYH.mjs";
4
- import "./chunk-45B4TCE4.mjs";
5
- export {
6
- ListForm as default
7
- };
@@ -1,8 +0,0 @@
1
- import {
2
- TreeView
3
- } from "./chunk-745NW6FN.mjs";
4
- import "./chunk-LJ7UTZYH.mjs";
5
- import "./chunk-45B4TCE4.mjs";
6
- export {
7
- TreeView as default
8
- };