d5-testing-library 2.0.0-alpha.6 → 2.0.0-alpha.7

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FormEdit
3
- } from "./chunk-N4PDOG6U.mjs";
3
+ } from "./chunk-WQR3N5X2.mjs";
4
4
  export {
5
5
  FormEdit as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ListForm
3
- } from "./chunk-N4PDOG6U.mjs";
3
+ } from "./chunk-WQR3N5X2.mjs";
4
4
  export {
5
5
  ListForm as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TreeView
3
- } from "./chunk-N4PDOG6U.mjs";
3
+ } from "./chunk-WQR3N5X2.mjs";
4
4
  export {
5
5
  TreeView as default
6
6
  };
@@ -2859,11 +2859,14 @@ var AbstractElement = class {
2859
2859
  joinRelativeCssSelectors(selectors) {
2860
2860
  return selectors.join(" ");
2861
2861
  }
2862
- getLocator() {
2862
+ syncLocator() {
2863
2863
  return this.page.locator(`css=${this.getFullCssSelector()}`);
2864
2864
  }
2865
+ getLocator() {
2866
+ return this.syncLocator();
2867
+ }
2865
2868
  async getAttribute(attr) {
2866
- const locator = this.getLocator();
2869
+ const locator = this.syncLocator();
2867
2870
  if (await locator.isVisible()) {
2868
2871
  return locator.getAttribute(attr);
2869
2872
  }
@@ -3317,15 +3320,15 @@ async function classDependencyInjector(formType) {
3317
3320
  let SubFormFactoryClass;
3318
3321
  switch (formType) {
3319
3322
  case "1" /* LIST */:
3320
- SubFormFactoryClass = (await import("./ListForm-H7E4GQWM.mjs")).default;
3323
+ SubFormFactoryClass = (await import("./ListForm-5PVPUASR.mjs")).default;
3321
3324
  break;
3322
3325
  case "3" /* TREE */:
3323
- SubFormFactoryClass = (await import("./TreeView-Q7YDCHQZ.mjs")).default;
3326
+ SubFormFactoryClass = (await import("./TreeView-Q2LHHV2B.mjs")).default;
3324
3327
  break;
3325
3328
  case "2" /* EDIT */:
3326
3329
  case "99" /* FREE_FORM */:
3327
3330
  case "4" /* REPORT */:
3328
- SubFormFactoryClass = (await import("./FormEdit-KTRSSTSI.mjs")).default;
3331
+ SubFormFactoryClass = (await import("./FormEdit-3SOUFQYD.mjs")).default;
3329
3332
  break;
3330
3333
  default:
3331
3334
  throw new Error(`Unsupported form type ${formType}`);
@@ -3487,14 +3490,14 @@ var Cell = class extends AbstractElementWithParent {
3487
3490
  }
3488
3491
  return getDate(value);
3489
3492
  }
3490
- async element() {
3493
+ async getLocator() {
3491
3494
  if (this._index == null) {
3492
3495
  this.index = await this.getCellIndex();
3493
3496
  }
3494
- return this.getLocator();
3497
+ return this.syncLocator();
3495
3498
  }
3496
3499
  async getValue() {
3497
- const cellEl = await this.element();
3500
+ const cellEl = await this.getLocator();
3498
3501
  const cellElClass = await cellEl.getAttribute("class") ?? "";
3499
3502
  if (cellElClass.includes("boolean-column" /* Boolean */)) return this.getBooleanValue(cellEl);
3500
3503
  if (cellElClass.includes("tags-column" /* Tags */)) return this.getTagsValue(cellEl);
@@ -3652,9 +3655,9 @@ var Column = class extends AbstractElementWithParent {
3652
3655
  get index() {
3653
3656
  return this._index;
3654
3657
  }
3655
- async element() {
3658
+ async getLocator() {
3656
3659
  await this.getIndex();
3657
- return this.getLocator();
3660
+ return this.syncLocator();
3658
3661
  }
3659
3662
  async getColumnHeaderIndexBy(cssSelector) {
3660
3663
  const column = this.page.locator(`${this.parentCssSelector} ${this.headerCssSelector} ${cssSelector}`);
@@ -3667,7 +3670,7 @@ var Column = class extends AbstractElementWithParent {
3667
3670
  return this.getColumnHeaderIndexBy(getColumnByNameCssSelector(this._name));
3668
3671
  }
3669
3672
  async caption() {
3670
- const el = await this.element();
3673
+ const el = await this.getLocator();
3671
3674
  const text = await el.innerText();
3672
3675
  return text?.trim() ?? null;
3673
3676
  }
@@ -5609,7 +5612,7 @@ var Table = class extends AbstractElementWithParent {
5609
5612
  [row] = await this.getSelectedRows();
5610
5613
  }
5611
5614
  if (!row) throw new Error("No row available row for context menu");
5612
- const cellElement = await row.getCell(fieldName).element();
5615
+ const cellElement = await row.getCell(fieldName).getLocator();
5613
5616
  await cellElement.click({ button: "right" });
5614
5617
  });
5615
5618
  }
@@ -6017,7 +6020,7 @@ var ColumnFilter = class {
6017
6020
  await this.getCancelButton().click();
6018
6021
  }
6019
6022
  async initFilter() {
6020
- const columnEl = await this._column.element();
6023
+ const columnEl = await this._column.getLocator();
6021
6024
  await columnEl.hover();
6022
6025
  const headerFilterIcon = columnEl.locator(HEADER_FILTER_ICON);
6023
6026
  await headerFilterIcon.waitFor({ state: "visible" });
@@ -76,11 +76,14 @@ var init_AbstractElement = __esm({
76
76
  joinRelativeCssSelectors(selectors) {
77
77
  return selectors.join(" ");
78
78
  }
79
- getLocator() {
79
+ syncLocator() {
80
80
  return this.page.locator(`css=${this.getFullCssSelector()}`);
81
81
  }
82
+ getLocator() {
83
+ return this.syncLocator();
84
+ }
82
85
  async getAttribute(attr) {
83
- const locator = this.getLocator();
86
+ const locator = this.syncLocator();
84
87
  if (await locator.isVisible()) {
85
88
  return locator.getAttribute(attr);
86
89
  }
@@ -2000,14 +2003,14 @@ var init_Cell = __esm({
2000
2003
  }
2001
2004
  return getDate(value);
2002
2005
  }
2003
- async element() {
2006
+ async getLocator() {
2004
2007
  if (this._index == null) {
2005
2008
  this.index = await this.getCellIndex();
2006
2009
  }
2007
- return this.getLocator();
2010
+ return this.syncLocator();
2008
2011
  }
2009
2012
  async getValue() {
2010
- const cellEl = await this.element();
2013
+ const cellEl = await this.getLocator();
2011
2014
  const cellElClass = await cellEl.getAttribute("class") ?? "";
2012
2015
  if (cellElClass.includes("boolean-column" /* Boolean */)) return this.getBooleanValue(cellEl);
2013
2016
  if (cellElClass.includes("tags-column" /* Tags */)) return this.getTagsValue(cellEl);
@@ -2166,9 +2169,9 @@ var init_Column = __esm({
2166
2169
  get index() {
2167
2170
  return this._index;
2168
2171
  }
2169
- async element() {
2172
+ async getLocator() {
2170
2173
  await this.getIndex();
2171
- return this.getLocator();
2174
+ return this.syncLocator();
2172
2175
  }
2173
2176
  async getColumnHeaderIndexBy(cssSelector) {
2174
2177
  const column = this.page.locator(`${this.parentCssSelector} ${this.headerCssSelector} ${cssSelector}`);
@@ -2181,7 +2184,7 @@ var init_Column = __esm({
2181
2184
  return this.getColumnHeaderIndexBy(getColumnByNameCssSelector(this._name));
2182
2185
  }
2183
2186
  async caption() {
2184
- const el = await this.element();
2187
+ const el = await this.getLocator();
2185
2188
  const text = await el.innerText();
2186
2189
  return text?.trim() ?? null;
2187
2190
  }
@@ -2682,7 +2685,7 @@ var init_Table = __esm({
2682
2685
  [row] = await this.getSelectedRows();
2683
2686
  }
2684
2687
  if (!row) throw new Error("No row available row for context menu");
2685
- const cellElement = await row.getCell(fieldName).element();
2688
+ const cellElement = await row.getCell(fieldName).getLocator();
2686
2689
  await cellElement.click({ button: "right" });
2687
2690
  });
2688
2691
  }
@@ -3561,7 +3564,7 @@ var init_ColumnFilter = __esm({
3561
3564
  await this.getCancelButton().click();
3562
3565
  }
3563
3566
  async initFilter() {
3564
- const columnEl = await this._column.element();
3567
+ const columnEl = await this._column.getLocator();
3565
3568
  await columnEl.hover();
3566
3569
  const headerFilterIcon = columnEl.locator(HEADER_FILTER_ICON);
3567
3570
  await headerFilterIcon.waitFor({ state: "visible" });
@@ -1,4 +1,4 @@
1
- import { Page, Locator } from '@playwright/test';
1
+ import { Locator, Page } from '@playwright/test';
2
2
  import * as playwright_core from 'playwright-core';
3
3
 
4
4
  type IConfig = {
@@ -9,13 +9,14 @@ type IConfig = {
9
9
  };
10
10
  declare function config(cfg?: IConfig): IConfig;
11
11
 
12
- declare abstract class AbstractElement {
12
+ declare abstract class AbstractElement<TLocator extends Locator | Promise<Locator> = Locator> {
13
13
  page: Page;
14
14
  protected elementCssSelector: string;
15
15
  protected constructor(page: Page, elementCssSelector?: string);
16
16
  protected getFullCssSelector(): string;
17
17
  protected joinRelativeCssSelectors(selectors: string[]): string;
18
- getLocator(): Locator;
18
+ protected syncLocator(): Locator;
19
+ getLocator(): TLocator;
19
20
  getAttribute(attr: string): Promise<string>;
20
21
  getClasses(): Promise<string>;
21
22
  getDataTestId(): Promise<string>;
@@ -115,7 +116,7 @@ interface ClearStrategy {
115
116
  clear(editor: Editor): Promise<void>;
116
117
  }
117
118
 
118
- declare abstract class AbstractElementWithParent extends AbstractElement {
119
+ declare abstract class AbstractElementWithParent<TLocator extends Locator | Promise<Locator> = Locator> extends AbstractElement<TLocator> {
119
120
  protected parentCssSelector: string;
120
121
  constructor(parentCssSelector: string, elementCssSelector: string, page: Page);
121
122
  protected getFullCssSelector(): string;
@@ -513,7 +514,7 @@ declare class ToolbarItem extends AbstractElementWithParent implements Button {
513
514
  get menu(): ToolbarMenu;
514
515
  }
515
516
 
516
- declare class Cell extends AbstractElementWithParent {
517
+ declare class Cell extends AbstractElementWithParent<Promise<Locator>> {
517
518
  private _index;
518
519
  private readonly getCellIndex;
519
520
  constructor(parentCssSelector: string, getCellIndex: () => Promise<number>, page: Page, index?: number);
@@ -522,7 +523,7 @@ declare class Cell extends AbstractElementWithParent {
522
523
  private getTagsValue;
523
524
  private getNumberValue;
524
525
  private getDateValue;
525
- element(): Promise<Locator>;
526
+ getLocator(): Promise<Locator>;
526
527
  getValue(): Promise<string | number | 1 | 0 | string[] | Date | Date[] | null>;
527
528
  getIndex(): number;
528
529
  }
@@ -535,7 +536,7 @@ interface ConstructorParams$1 {
535
536
  index?: number;
536
537
  page: Page;
537
538
  }
538
- declare class Column extends AbstractElementWithParent {
539
+ declare class Column extends AbstractElementWithParent<Promise<Locator>> {
539
540
  private _index;
540
541
  private _caption;
541
542
  private _name;
@@ -543,7 +544,7 @@ declare class Column extends AbstractElementWithParent {
543
544
  constructor({ parentCssSelector, headerCssSelector, name, caption, index, page }: ConstructorParams$1);
544
545
  private set index(value);
545
546
  private get index();
546
- element(): Promise<Locator>;
547
+ getLocator(): Promise<Locator>;
547
548
  private getColumnHeaderIndexBy;
548
549
  private getIndexByCaption;
549
550
  private getIndexByName;
@@ -1,4 +1,4 @@
1
- import { Page, Locator } from '@playwright/test';
1
+ import { Locator, Page } from '@playwright/test';
2
2
  import * as playwright_core from 'playwright-core';
3
3
 
4
4
  type IConfig = {
@@ -9,13 +9,14 @@ type IConfig = {
9
9
  };
10
10
  declare function config(cfg?: IConfig): IConfig;
11
11
 
12
- declare abstract class AbstractElement {
12
+ declare abstract class AbstractElement<TLocator extends Locator | Promise<Locator> = Locator> {
13
13
  page: Page;
14
14
  protected elementCssSelector: string;
15
15
  protected constructor(page: Page, elementCssSelector?: string);
16
16
  protected getFullCssSelector(): string;
17
17
  protected joinRelativeCssSelectors(selectors: string[]): string;
18
- getLocator(): Locator;
18
+ protected syncLocator(): Locator;
19
+ getLocator(): TLocator;
19
20
  getAttribute(attr: string): Promise<string>;
20
21
  getClasses(): Promise<string>;
21
22
  getDataTestId(): Promise<string>;
@@ -115,7 +116,7 @@ interface ClearStrategy {
115
116
  clear(editor: Editor): Promise<void>;
116
117
  }
117
118
 
118
- declare abstract class AbstractElementWithParent extends AbstractElement {
119
+ declare abstract class AbstractElementWithParent<TLocator extends Locator | Promise<Locator> = Locator> extends AbstractElement<TLocator> {
119
120
  protected parentCssSelector: string;
120
121
  constructor(parentCssSelector: string, elementCssSelector: string, page: Page);
121
122
  protected getFullCssSelector(): string;
@@ -513,7 +514,7 @@ declare class ToolbarItem extends AbstractElementWithParent implements Button {
513
514
  get menu(): ToolbarMenu;
514
515
  }
515
516
 
516
- declare class Cell extends AbstractElementWithParent {
517
+ declare class Cell extends AbstractElementWithParent<Promise<Locator>> {
517
518
  private _index;
518
519
  private readonly getCellIndex;
519
520
  constructor(parentCssSelector: string, getCellIndex: () => Promise<number>, page: Page, index?: number);
@@ -522,7 +523,7 @@ declare class Cell extends AbstractElementWithParent {
522
523
  private getTagsValue;
523
524
  private getNumberValue;
524
525
  private getDateValue;
525
- element(): Promise<Locator>;
526
+ getLocator(): Promise<Locator>;
526
527
  getValue(): Promise<string | number | 1 | 0 | string[] | Date | Date[] | null>;
527
528
  getIndex(): number;
528
529
  }
@@ -535,7 +536,7 @@ interface ConstructorParams$1 {
535
536
  index?: number;
536
537
  page: Page;
537
538
  }
538
- declare class Column extends AbstractElementWithParent {
539
+ declare class Column extends AbstractElementWithParent<Promise<Locator>> {
539
540
  private _index;
540
541
  private _caption;
541
542
  private _name;
@@ -543,7 +544,7 @@ declare class Column extends AbstractElementWithParent {
543
544
  constructor({ parentCssSelector, headerCssSelector, name, caption, index, page }: ConstructorParams$1);
544
545
  private set index(value);
545
546
  private get index();
546
- element(): Promise<Locator>;
547
+ getLocator(): Promise<Locator>;
547
548
  private getColumnHeaderIndexBy;
548
549
  private getIndexByCaption;
549
550
  private getIndexByName;
@@ -23,7 +23,7 @@ import {
23
23
  readonlyLocator,
24
24
  wait,
25
25
  waitElementIsVisible_default
26
- } from "./chunk-N4PDOG6U.mjs";
26
+ } from "./chunk-WQR3N5X2.mjs";
27
27
  export {
28
28
  AbstractPage,
29
29
  ApiRequest,
@@ -23,7 +23,7 @@ import {
23
23
  readonlyLocator,
24
24
  wait,
25
25
  waitElementIsVisible_default
26
- } from "./chunk-N4PDOG6U.mjs";
26
+ } from "./chunk-WQR3N5X2.mjs";
27
27
  export {
28
28
  AbstractPage,
29
29
  ApiRequest,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "d5-testing-library",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.0-alpha.7",
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",