@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.
- package/index.cjs +1 -1
- package/index.js +20 -29
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
|
|
2
|
-
|
|
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
|
-
|
|
12
|
-
|
|
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
|
-
|
|
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 =
|
|
38
|
+
let t = this.#e;
|
|
47
39
|
if (!t) {
|
|
48
40
|
const e = this.getComponentSelector();
|
|
49
|
-
let
|
|
41
|
+
let o = this.#t;
|
|
50
42
|
if (e) {
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
43
|
+
o = o.locator(e);
|
|
44
|
+
const a = this.#o;
|
|
45
|
+
a !== null && (o = o.nth(a));
|
|
54
46
|
}
|
|
55
|
-
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
|
-
|
|
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
|
-
|
|
78
|
+
c as BasePO
|
|
88
79
|
};
|