@agnos-ui/base-po 0.9.3 → 0.10.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.cjs +1 -1
  2. package/index.js +20 -29
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty;var g=o=>{throw TypeError(o)};var m=(o,t,e)=>t in o?f(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var p=(o,t,e)=>m(o,typeof t!="symbol"?t+"":t,e),d=(o,t,e)=>t.has(o)||g("Cannot "+e);var s=(o,t,e)=>(d(o,t,"read from private field"),e?e.call(o):t.get(o)),c=(o,t,e)=>t.has(o)?g("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e),n=(o,t,e,i)=>(d(o,t,"write to private field"),i?i.call(o,e):t.set(o,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function h(o){return"waitFor"in o}var r,a,l;class R{constructor(t,e=null){c(this,r);c(this,a);c(this,l);p(this,"_page");n(this,r,t),n(this,a,e),this._page=h(t)?t.page():t}get locatorRoot(){let t=s(this,l);if(!t){const e=this.getComponentSelector();let i=s(this,r);if(e){i=i.locator(e);const u=s(this,a);u!==null&&(i=i.nth(u))}t=h(i)?i:i.locator("html"),n(this,l,t)}return t}getComponentSelector(){return""}async waitLoaded(){h(this.locatorRoot)&&await this.locatorRoot.waitFor()}}r=new WeakMap,a=new WeakMap,l=new WeakMap;exports.BasePO=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(r){return"waitFor"in r}class l{#t;#o;#e;_page;constructor(t,e=null){this.#t=t,this.#o=e,this._page=i(t)?t.page():t}get locatorRoot(){let t=this.#e;if(!t){const e=this.getComponentSelector();let o=this.#t;if(e){o=o.locator(e);const a=this.#o;a!==null&&(o=o.nth(a))}t=i(o)?o:o.locator("html"),this.#e=t}return t}getComponentSelector(){return""}async waitLoaded(){i(this.locatorRoot)&&await this.locatorRoot.waitFor()}}exports.BasePO=l;
package/index.js CHANGED
@@ -1,30 +1,22 @@
1
- var f = Object.defineProperty;
2
- var u = (o) => {
3
- throw TypeError(o);
4
- };
5
- var m = (o, t, e) => t in o ? f(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
6
- var g = (o, t, e) => m(o, typeof t != "symbol" ? t + "" : t, e), R = (o, t, e) => t.has(o) || u("Cannot " + e);
7
- var l = (o, t, e) => (R(o, t, "read from private field"), e ? e.call(o) : t.get(o)), s = (o, t, e) => t.has(o) ? u("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, e), n = (o, t, e, i) => (R(o, t, "write to private field"), i ? i.call(o, e) : t.set(o, e), e);
8
- function h(o) {
9
- return "waitFor" in o;
1
+ function i(r) {
2
+ return "waitFor" in r;
10
3
  }
11
- var r, a, c;
12
- class w {
4
+ class c {
5
+ #t;
6
+ #o;
7
+ #e;
8
+ /**
9
+ * Playwright page object from which the page object has been created.
10
+ * It can be convenient for situation where you can't work (internally) with the locatorRoot
11
+ */
12
+ _page;
13
13
  /**
14
14
  *
15
15
  * @param container - Container locator (page if there is no container) where the component is located
16
16
  * @param index - If you have multiple components **inside the container**, you must provide the index to select the component to work with. You can omit this parameter if you have a single component.
17
17
  */
18
18
  constructor(t, e = null) {
19
- s(this, r);
20
- s(this, a);
21
- s(this, c);
22
- /**
23
- * Playwright page object from which the page object has been created.
24
- * It can be convenient for situation where you can't work (internally) with the locatorRoot
25
- */
26
- g(this, "_page");
27
- n(this, r, t), n(this, a, e), this._page = h(t) ? t.page() : t;
19
+ this.#t = t, this.#o = e, this._page = i(t) ? t.page() : t;
28
20
  }
29
21
  /**
30
22
  * The root locator of your page object.
@@ -43,16 +35,16 @@ class w {
43
35
  * ```
44
36
  */
45
37
  get locatorRoot() {
46
- let t = l(this, c);
38
+ let t = this.#e;
47
39
  if (!t) {
48
40
  const e = this.getComponentSelector();
49
- let i = l(this, r);
41
+ let o = this.#t;
50
42
  if (e) {
51
- i = i.locator(e);
52
- const p = l(this, a);
53
- p !== null && (i = i.nth(p));
43
+ o = o.locator(e);
44
+ const a = this.#o;
45
+ a !== null && (o = o.nth(a));
54
46
  }
55
- t = h(i) ? i : i.locator("html"), n(this, c, t);
47
+ t = i(o) ? o : o.locator("html"), this.#e = t;
56
48
  }
57
49
  return t;
58
50
  }
@@ -79,10 +71,9 @@ class w {
79
71
  * Wait for the locatorRoot to be displayed in the page
80
72
  */
81
73
  async waitLoaded() {
82
- h(this.locatorRoot) && await this.locatorRoot.waitFor();
74
+ i(this.locatorRoot) && await this.locatorRoot.waitFor();
83
75
  }
84
76
  }
85
- r = new WeakMap(), a = new WeakMap(), c = new WeakMap();
86
77
  export {
87
- w as BasePO
78
+ c as BasePO
88
79
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agnos-ui/base-po",
3
3
  "description": "Base class to build page objects for end-to-end tests with Playwright.",
4
- "version": "0.9.3",
4
+ "version": "0.10.0-next.0",
5
5
  "keywords": [
6
6
  "e2e",
7
7
  "page-object",