@agnos-ui/page-objects 0.1.1 → 0.2.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/dist/lib/index.d.ts +47 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.mjs +110 -68
- package/package.json +2 -2
package/dist/lib/index.d.ts
CHANGED
|
@@ -60,6 +60,14 @@ export declare const alertSelectors: {
|
|
|
60
60
|
closeButton: string;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
+
/** Pagination navigation buttons hrefs */
|
|
64
|
+
export declare interface HrefsNavigation {
|
|
65
|
+
first?: string;
|
|
66
|
+
previous?: string;
|
|
67
|
+
next?: string;
|
|
68
|
+
last?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
63
71
|
export declare class ModalPO extends BasePO {
|
|
64
72
|
selectors: {
|
|
65
73
|
rootComponent: string;
|
|
@@ -136,6 +144,20 @@ export declare class PaginationPO extends BasePO {
|
|
|
136
144
|
*/
|
|
137
145
|
locatorPage(pageString: string): Locator;
|
|
138
146
|
get locatorEllipses(): Locator;
|
|
147
|
+
state(): Promise<PaginationPOState>;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Pagination page object */
|
|
151
|
+
export declare interface PaginationPOState {
|
|
152
|
+
rootClasses: string[];
|
|
153
|
+
disabled: string | null;
|
|
154
|
+
pages: string[];
|
|
155
|
+
hrefs: string[];
|
|
156
|
+
hrefsNavigation?: HrefsNavigation;
|
|
157
|
+
isFirstDisabled?: boolean;
|
|
158
|
+
isPreviousDisabled?: boolean;
|
|
159
|
+
isNextDisabled?: boolean;
|
|
160
|
+
isLastDisabled?: boolean;
|
|
139
161
|
}
|
|
140
162
|
|
|
141
163
|
export declare const paginationSelectors: {
|
|
@@ -262,10 +284,10 @@ export declare class SliderPO extends BasePO {
|
|
|
262
284
|
value: string | null;
|
|
263
285
|
min: string | null;
|
|
264
286
|
max: string | null;
|
|
265
|
-
text: string | null;
|
|
266
287
|
disabled: string | null;
|
|
267
288
|
readonly: string | null;
|
|
268
289
|
ariaLabel: string | null;
|
|
290
|
+
ariaValueText: string | null;
|
|
269
291
|
}[]>;
|
|
270
292
|
sliderProgressState(): Promise<(string | null)[]>;
|
|
271
293
|
}
|
|
@@ -294,4 +316,28 @@ export declare interface State {
|
|
|
294
316
|
innerWidth: string | undefined;
|
|
295
317
|
}
|
|
296
318
|
|
|
319
|
+
export declare class ToastPO extends BasePO {
|
|
320
|
+
selectors: {
|
|
321
|
+
rootComponent: string;
|
|
322
|
+
closeButton: string;
|
|
323
|
+
header: string;
|
|
324
|
+
body: string;
|
|
325
|
+
};
|
|
326
|
+
getComponentSelector(): string;
|
|
327
|
+
get locatorCloseButton(): Locator;
|
|
328
|
+
state(): Promise<{
|
|
329
|
+
rootClasses: string[];
|
|
330
|
+
body: string | undefined;
|
|
331
|
+
header: string | undefined;
|
|
332
|
+
closeButton: string | null | undefined;
|
|
333
|
+
}>;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export declare const toastSelectors: {
|
|
337
|
+
rootComponent: string;
|
|
338
|
+
closeButton: string;
|
|
339
|
+
header: string;
|
|
340
|
+
body: string;
|
|
341
|
+
};
|
|
342
|
+
|
|
297
343
|
export { }
|
package/dist/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var R=Object.defineProperty;var B=(s,a,t)=>a in s?R(s,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[a]=t;var i=(s,a,t)=>(B(s,typeof a!="symbol"?a+"":a,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@agnos-ui/base-po"),A={rootComponent:".modal",closeButton:".btn-close",backdrop:"xpath=./preceding-sibling::div[contains(@class,'modal-backdrop')]",header:".modal-header",title:".modal-title",body:".modal-body",footer:".modal-footer"};class O extends n.BasePO{constructor(){super(...arguments);i(this,"selectors",structuredClone(A))}getComponentSelector(){return this.selectors.rootComponent}get locatorHeader(){return this.locatorRoot.locator(this.selectors.header)}get locatorTitle(){return this.locatorHeader.locator(this.selectors.title)}get locatorBody(){return this.locatorRoot.locator(this.selectors.body)}get locatorFooter(){return this.locatorRoot.locator(this.selectors.footer)}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}get locatorBackdrop(){return this.locatorRoot.locator(this.selectors.backdrop)}}const x={rootComponent:".au-pagination",activePage:".active",previousPage:".au-previous",nextPage:".au-next",firstPage:".au-first",lastPage:".au-last",pages:".au-page",ellipses:".au-ellipsis"};class f extends n.BasePO{constructor(){super(...arguments);i(this,"selectors",structuredClone(x))}getComponentSelector(){return this.selectors.rootComponent}get locatorActivePage(){return this.locatorRoot.locator(this.selectors.activePage)}get locatorPreviousButton(){return this.locatorRoot.locator(this.selectors.previousPage)}get locatorNextButton(){return this.locatorRoot.locator(this.selectors.nextPage)}get locatorFirstButton(){return this.locatorRoot.locator(this.selectors.firstPage)}get locatorLastButton(){return this.locatorRoot.locator(this.selectors.lastPage)}get locatorPages(){return this.locatorRoot.locator(this.selectors.pages)}locatorNthPage(t){return this.locatorRoot.locator(this.selectors.pages).nth(t-1)}locatorPage(t){return this.locatorRoot.locator(this.selectors.pages,{hasText:t})}get locatorEllipses(){return this.locatorRoot.locator(this.selectors.ellipses)}}const P={rootComponent:".au-rating",star:".au-rating-star"};class L extends n.BasePO{constructor(){super(...arguments);i(this,"selectors",structuredClone(P))}getComponentSelector(){return this.selectors.rootComponent}locatorStar(t){return this.locatorRoot.locator(this.selectors.star).nth(t)}async state(){return await this.locatorRoot.evaluate((t,e)=>{const c=[...t.querySelectorAll(e.star)],l=[],r=[];for(const o of c)l.push((o.textContent||"").trim()),r.push(o.className.split(" "));return{rootClasses:t.className.trim().split(" "),value:t.getAttribute("aria-valuenow"),min:t.getAttribute("aria-valuemin"),max:t.getAttribute("aria-valuemax"),text:t.getAttribute("aria-valuetext"),disabled:t.getAttribute("aria-disabled"),readonly:t.getAttribute("aria-readonly"),stars:l,classes:r}},this.selectors)}}const C={rootComponent:".au-select"};class H extends n.BasePO{constructor(){super(...arguments);i(this,"selectors",structuredClone(C))}getComponentSelector(){return this.selectors.rootComponent}get locatorInput(){return this.locatorRoot.locator('input[type="text"]').nth(0)}get locatorMenu(){return this.locatorRoot.locator(".dropdown-menu")}get locatorMenuItems(){return this.locatorMenu.locator(".au-select-item")}locatorMenuItem(t){return this.locatorMenu.getByText(t).nth(0)}get locatorBadges(){return this.locatorRoot.locator("div.au-select-badge")}locatorBadgeItem(t){return this.locatorBadges.filter({hasText:t}).nth(0)}async state(){return await this.locatorRoot.evaluate(t=>{var g,b;const e=t.querySelector('div[role="combobox"]'),c=t.querySelector('input[type="text"]'),l=[];if(e){const m=e.querySelectorAll("div.au-select-badge");for(const u of m)l.push((g=u==null?void 0:u.textContent)==null?void 0:g.trim())}const r=t.querySelector("ul.dropdown-menu"),o=r!=null,d=[],h=[];if(r!=null){const m=r.querySelectorAll("li.dropdown-item");for(const u of m){const p=(b=u.textContent)==null?void 0:b.trim();d.push(p),u.classList.contains("selected")&&h.push(p)}}return{text:c.value,badges:l,isOpen:o,list:d,checked:h}})}}const y={rootComponent:".alert",closeButton:".btn-close"};class M extends n.BasePO{constructor(){super(...arguments);i(this,"selectors",structuredClone(y))}getComponentSelector(){return this.selectors.rootComponent}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}}class I extends n.BasePO{constructor(){super(...arguments);i(this,"selectors",{item:".accordion-item",collapse:".accordion-collapse",body:".accordion-body",header:".accordion-header",buttons:".accordion-button"})}getComponentSelector(){return".accordion"}get locatorAccordionItems(){return this.locatorRoot.locator(this.selectors.item)}locatorAccordionItem(t){return this.locatorRoot.locator(this.selectors.item).nth(t)}get locatorAccordionCollapses(){return this.locatorAccordionItems.locator(this.selectors.collapse)}locatorAccordionCollapse(t){return this.locatorAccordionItem(t).locator(this.selectors.collapse)}get locatorAccordionBodies(){return this.locatorAccordionCollapses.locator(this.selectors.body)}locatorAccordionBody(t){return this.locatorAccordionCollapse(t).locator(this.selectors.body)}get locatorAccordionHeaders(){return this.locatorAccordionItems.locator(this.selectors.header)}locatorAccordionHeader(t){return this.locatorAccordionItem(t).locator(this.selectors.header)}get locatorAccordionButtons(){return this.locatorAccordionHeaders.locator(this.selectors.buttons)}locatorAccordionButton(t){return this.locatorAccordionHeader(t).locator(this.selectors.buttons)}async state(){return await this.locatorRoot.evaluate(t=>{const e=[...t.querySelectorAll(".accordion-item")],c=[];for(const l of e){const r=l.querySelector(".accordion-collapse"),o=l.querySelector(".accordion-button");c.push({classes:l.className.trim().split(" "),id:l.id,isInDOM:r!==null,collapseId:r==null?void 0:r.id,buttonId:o==null?void 0:o.id,expanded:o==null?void 0:o.getAttribute("aria-expanded"),disabled:o==null?void 0:o.getAttribute("aria-disabled"),labeledBy:r==null?void 0:r.getAttribute("aria-labelledby"),buttonControls:o==null?void 0:o.getAttribute("aria-controls")})}return{rootClasses:t.className.trim().split(" "),items:c}})}}const S={rootComponent:'[role="progressbar"]',outerBar:".progress",innerBar:".progress-bar"};class q extends n.BasePO{constructor(){super(...arguments);i(this,"selectors",structuredClone(S))}getComponentSelector(){return this.selectors.rootComponent}get locatorOuterBar(){return this.locatorRoot.locator(this.selectors.outerBar)}get locatorInnerBar(){return this.locatorRoot.locator(this.selectors.innerBar)}async state(){return this.locatorRoot.evaluate(t=>{var l,r,o,d,h,g;const e=t.querySelector(".progress-bar"),c=t.querySelector(".progress");return{ariaLabel:t.getAttribute("aria-label"),ariaValueNow:t.getAttribute("aria-valuenow"),ariaValueMin:t.getAttribute("aria-valuemin"),ariaValueMax:t.getAttribute("aria-valuemax"),ariaValueText:t.getAttribute("aria-valuetext"),label:(l=e==null?void 0:e.textContent)==null?void 0:l.trim(),innerClasses:((d=(o=(r=e==null?void 0:e.className)==null?void 0:r.trim())==null?void 0:o.split(" "))==null?void 0:d.sort())??[],outerHeight:(h=c==null?void 0:c.style)==null?void 0:h.height,innerWidth:(g=e==null?void 0:e.style)==null?void 0:g.width}})}}const v={rootComponent:".au-slider",clickableArea:".au-slider-clickable-area",handle:".au-slider-handle",minLabelHorizontal:".au-slider-label-min",maxLabelHorizontal:".au-slider-label-max",minLabelVertical:".au-slider-label-vertical-min",maxLabelVertical:".au-slider-label-vertical-max",valueLabel:".au-slider-label-now",progress:".au-slider-progress"};class w extends n.BasePO{constructor(){super(...arguments);i(this,"selectors",structuredClone(v))}getComponentSelector(){return this.selectors.rootComponent}get locatorHandle(){return this.locatorRoot.locator(this.selectors.handle)}get locatorMinLabelHorizontal(){return this.locatorRoot.locator(this.selectors.minLabelHorizontal)}get locatorMaxLabelHorizontal(){return this.locatorRoot.locator(this.selectors.maxLabelHorizontal)}get locatorMinLabelVertical(){return this.locatorRoot.locator(this.selectors.minLabelVertical)}get locatorMaxLabelVertical(){return this.locatorRoot.locator(this.selectors.maxLabelVertical)}get locatorProgress(){return this.locatorRoot.locator(this.selectors.progress)}get locatorValueLabel(){return this.locatorRoot.locator(this.selectors.valueLabel)}async sliderHandleState(){return this.locatorRoot.locator(this.selectors.handle).evaluateAll(t=>t.map(e=>({style:e.getAttribute("style"),value:e.getAttribute("aria-valuenow"),min:e.getAttribute("aria-valuemin"),max:e.getAttribute("aria-valuemax"),text:e.getAttribute("aria-valuetext"),disabled:e.getAttribute("aria-disabled"),readonly:e.getAttribute("aria-readonly"),ariaLabel:e.getAttribute("aria-label")})))}async sliderProgressState(){return this.locatorRoot.locator(this.selectors.progress).evaluateAll(t=>t.map(e=>e.getAttribute("style")))}}exports.AccordionPO=I;exports.AlertPO=M;exports.ModalPO=O;exports.PaginationPO=f;exports.ProgressbarPO=q;exports.RatingPO=L;exports.SelectPO=H;exports.SliderPO=w;exports.alertSelectors=y;exports.modalSelectors=A;exports.paginationSelectors=x;exports.progressbarSelectors=S;exports.ratingSelectors=P;exports.selectSelectors=C;exports.sliderSelectors=v;
|
|
1
|
+
"use strict";var R=Object.defineProperty;var B=(c,a,t)=>a in c?R(c,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[a]=t;var u=(c,a,t)=>(B(c,typeof a!="symbol"?a+"":a,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@agnos-ui/base-po"),y={rootComponent:".modal",closeButton:".btn-close",backdrop:"xpath=./preceding-sibling::div[contains(@class,'modal-backdrop')]",header:".modal-header",title:".modal-title",body:".modal-body",footer:".modal-footer"};class O extends g.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(y))}getComponentSelector(){return this.selectors.rootComponent}get locatorHeader(){return this.locatorRoot.locator(this.selectors.header)}get locatorTitle(){return this.locatorHeader.locator(this.selectors.title)}get locatorBody(){return this.locatorRoot.locator(this.selectors.body)}get locatorFooter(){return this.locatorRoot.locator(this.selectors.footer)}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}get locatorBackdrop(){return this.locatorRoot.locator(this.selectors.backdrop)}}const A={rootComponent:".au-pagination",activePage:".active",previousPage:".au-previous",nextPage:".au-next",firstPage:".au-first",lastPage:".au-last",pages:".au-page",ellipses:".au-ellipsis"};class q extends g.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(A))}getComponentSelector(){return this.selectors.rootComponent}get locatorActivePage(){return this.locatorRoot.locator(this.selectors.activePage)}get locatorPreviousButton(){return this.locatorRoot.locator(this.selectors.previousPage)}get locatorNextButton(){return this.locatorRoot.locator(this.selectors.nextPage)}get locatorFirstButton(){return this.locatorRoot.locator(this.selectors.firstPage)}get locatorLastButton(){return this.locatorRoot.locator(this.selectors.lastPage)}get locatorPages(){return this.locatorRoot.locator(this.selectors.pages)}locatorNthPage(t){return this.locatorRoot.locator(this.selectors.pages).nth(t-1)}locatorPage(t){return this.locatorRoot.locator(this.selectors.pages,{hasText:t})}get locatorEllipses(){return this.locatorRoot.locator(this.selectors.ellipses)}async state(){return this.locatorRoot.evaluate(t=>{const e={rootClasses:[],disabled:null,pages:[],hrefs:[]},l=[...t.querySelectorAll(".au-page")],s=[],r=[],o={},i=h=>h==null?void 0:h.getAttribute("href"),n=t.querySelector("a.au-first"),d=t.querySelector("a.au-previous"),p=t.querySelector("a.au-next"),m=t.querySelector("a.au-last");n&&(o.first=i(n)),d&&(o.previous=i(d)),p&&(o.next=i(p)),m&&(o.last=i(m));for(const h of l)r.push(h.getAttribute("href")||""),s.push((h.textContent||"").trim());const b=[...t.querySelectorAll("a.au-page[aria-disabled]")];return e.pages=s,e.hrefs=r,e.hrefsNavigation=o,e.rootClasses=t.className.trim().split(" "),e.disabled=b.length===l.length?"true":null,t.querySelector("a.au-previous[aria-disabled]")?e.isPreviousDisabled=!0:d&&(e.isPreviousDisabled=!1),t.querySelector("a.au-next[aria-disabled]")?e.isNextDisabled=!0:p&&(e.isNextDisabled=!1),t.querySelector("a.au-first[aria-disabled]")?e.isFirstDisabled=!0:n&&(e.isFirstDisabled=!1),t.querySelector("a.au-last[aria-disabled]")?e.isLastDisabled=!0:m&&(e.isLastDisabled=!1),e})}}const S={rootComponent:".au-rating",star:".au-rating-star"};class L extends g.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(S))}getComponentSelector(){return this.selectors.rootComponent}locatorStar(t){return this.locatorRoot.locator(this.selectors.star).nth(t)}async state(){return await this.locatorRoot.evaluate((t,e)=>{const l=[...t.querySelectorAll(e.star)],s=[],r=[];for(const o of l)s.push((o.textContent||"").trim()),r.push(o.className.split(" "));return{rootClasses:t.className.trim().split(" "),value:t.getAttribute("aria-valuenow"),min:t.getAttribute("aria-valuemin"),max:t.getAttribute("aria-valuemax"),text:t.getAttribute("aria-valuetext"),disabled:t.getAttribute("aria-disabled"),readonly:t.getAttribute("aria-readonly"),stars:s,classes:r}},this.selectors)}}const x={rootComponent:".au-select"};class H extends g.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(x))}getComponentSelector(){return this.selectors.rootComponent}get locatorInput(){return this.locatorRoot.locator('input[type="text"]').nth(0)}get locatorMenu(){return this.locatorRoot.locator(".dropdown-menu")}get locatorMenuItems(){return this.locatorMenu.locator(".au-select-item")}locatorMenuItem(t){return this.locatorMenu.getByText(t).nth(0)}get locatorBadges(){return this.locatorRoot.locator("div.au-select-badge")}locatorBadgeItem(t){return this.locatorBadges.filter({hasText:t}).nth(0)}async state(){return await this.locatorRoot.evaluate(t=>{var d,p;const e=t.querySelector('div[role="combobox"]'),l=t.querySelector('input[type="text"]'),s=[];if(e){const m=e.querySelectorAll("div.au-select-badge");for(const b of m)s.push((d=b==null?void 0:b.textContent)==null?void 0:d.trim())}const r=t.querySelector("ul.dropdown-menu"),o=r!=null,i=[],n=[];if(r!=null){const m=r.querySelectorAll("li.dropdown-item");for(const b of m){const h=(p=b.textContent)==null?void 0:p.trim();i.push(h),b.classList.contains("selected")&&n.push(h)}}return{text:l.value,badges:s,isOpen:o,list:i,checked:n}})}}const C={rootComponent:".alert",closeButton:".btn-close"};class M extends g.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(C))}getComponentSelector(){return this.selectors.rootComponent}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}}class I extends g.BasePO{constructor(){super(...arguments);u(this,"selectors",{item:".accordion-item",collapse:".accordion-collapse",body:".accordion-body",header:".accordion-header",buttons:".accordion-button"})}getComponentSelector(){return".accordion"}get locatorAccordionItems(){return this.locatorRoot.locator(this.selectors.item)}locatorAccordionItem(t){return this.locatorRoot.locator(this.selectors.item).nth(t)}get locatorAccordionCollapses(){return this.locatorAccordionItems.locator(this.selectors.collapse)}locatorAccordionCollapse(t){return this.locatorAccordionItem(t).locator(this.selectors.collapse)}get locatorAccordionBodies(){return this.locatorAccordionCollapses.locator(this.selectors.body)}locatorAccordionBody(t){return this.locatorAccordionCollapse(t).locator(this.selectors.body)}get locatorAccordionHeaders(){return this.locatorAccordionItems.locator(this.selectors.header)}locatorAccordionHeader(t){return this.locatorAccordionItem(t).locator(this.selectors.header)}get locatorAccordionButtons(){return this.locatorAccordionHeaders.locator(this.selectors.buttons)}locatorAccordionButton(t){return this.locatorAccordionHeader(t).locator(this.selectors.buttons)}async state(){return await this.locatorRoot.evaluate(t=>{const e=[...t.querySelectorAll(".accordion-item")],l=[];for(const s of e){const r=s.querySelector(".accordion-collapse"),o=s.querySelector(".accordion-button");l.push({classes:s.className.trim().split(" "),id:s.id,isInDOM:r!==null,collapseId:r==null?void 0:r.id,buttonId:o==null?void 0:o.id,expanded:o==null?void 0:o.getAttribute("aria-expanded"),disabled:o==null?void 0:o.getAttribute("aria-disabled"),labeledBy:r==null?void 0:r.getAttribute("aria-labelledby"),buttonControls:o==null?void 0:o.getAttribute("aria-controls")})}return{rootClasses:t.className.trim().split(" "),items:l}})}}const P={rootComponent:'[role="progressbar"]',outerBar:".progress",innerBar:".progress-bar"};class w extends g.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(P))}getComponentSelector(){return this.selectors.rootComponent}get locatorOuterBar(){return this.locatorRoot.locator(this.selectors.outerBar)}get locatorInnerBar(){return this.locatorRoot.locator(this.selectors.innerBar)}async state(){return this.locatorRoot.evaluate(t=>{var s,r,o,i,n,d;const e=t.querySelector(".progress-bar"),l=t.querySelector(".progress");return{ariaLabel:t.getAttribute("aria-label"),ariaValueNow:t.getAttribute("aria-valuenow"),ariaValueMin:t.getAttribute("aria-valuemin"),ariaValueMax:t.getAttribute("aria-valuemax"),ariaValueText:t.getAttribute("aria-valuetext"),label:(s=e==null?void 0:e.textContent)==null?void 0:s.trim(),innerClasses:((i=(o=(r=e==null?void 0:e.className)==null?void 0:r.trim())==null?void 0:o.split(" "))==null?void 0:i.sort())??[],outerHeight:(n=l==null?void 0:l.style)==null?void 0:n.height,innerWidth:(d=e==null?void 0:e.style)==null?void 0:d.width}})}}const v={rootComponent:".au-slider",clickableArea:".au-slider-clickable-area",handle:".au-slider-handle",minLabelHorizontal:".au-slider-label-min",maxLabelHorizontal:".au-slider-label-max",minLabelVertical:".au-slider-label-vertical-min",maxLabelVertical:".au-slider-label-vertical-max",valueLabel:".au-slider-label-now",progress:".au-slider-progress"};class V extends g.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(v))}getComponentSelector(){return this.selectors.rootComponent}get locatorHandle(){return this.locatorRoot.locator(this.selectors.handle)}get locatorMinLabelHorizontal(){return this.locatorRoot.locator(this.selectors.minLabelHorizontal)}get locatorMaxLabelHorizontal(){return this.locatorRoot.locator(this.selectors.maxLabelHorizontal)}get locatorMinLabelVertical(){return this.locatorRoot.locator(this.selectors.minLabelVertical)}get locatorMaxLabelVertical(){return this.locatorRoot.locator(this.selectors.maxLabelVertical)}get locatorProgress(){return this.locatorRoot.locator(this.selectors.progress)}get locatorValueLabel(){return this.locatorRoot.locator(this.selectors.valueLabel)}async sliderHandleState(){return this.locatorRoot.locator(this.selectors.handle).evaluateAll(t=>t.map(e=>({style:e.getAttribute("style"),value:e.getAttribute("aria-valuenow"),min:e.getAttribute("aria-valuemin"),max:e.getAttribute("aria-valuemax"),disabled:e.getAttribute("aria-disabled"),readonly:e.getAttribute("aria-readonly"),ariaLabel:e.getAttribute("aria-label"),ariaValueText:e.getAttribute("aria-valuetext")})))}async sliderProgressState(){return this.locatorRoot.locator(this.selectors.progress).evaluateAll(t=>t.map(e=>e.getAttribute("style")))}}const f={rootComponent:".toast",closeButton:".btn-close",header:".toast-header",body:".toast-body"};class T extends g.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(f))}getComponentSelector(){return this.selectors.rootComponent}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}async state(){return await this.locatorRoot.evaluate((t,e)=>{var o,i,n;const l=(o=t.querySelector(e.body))==null?void 0:o.innerText,s=(i=t.querySelector(e.header))==null?void 0:i.innerText,r=(n=t.querySelector(e.closeButton))==null?void 0:n.getAttribute("aria-label");return{rootClasses:t.className.trim().split(" ").sort(),body:l,header:s,closeButton:r}},this.selectors)}}exports.AccordionPO=I;exports.AlertPO=M;exports.ModalPO=O;exports.PaginationPO=q;exports.ProgressbarPO=w;exports.RatingPO=L;exports.SelectPO=H;exports.SliderPO=V;exports.ToastPO=T;exports.alertSelectors=C;exports.modalSelectors=y;exports.paginationSelectors=A;exports.progressbarSelectors=P;exports.ratingSelectors=S;exports.selectSelectors=x;exports.sliderSelectors=v;exports.toastSelectors=f;
|
package/dist/lib/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var x = (
|
|
3
|
-
var
|
|
4
|
-
import { BasePO as
|
|
5
|
-
const
|
|
1
|
+
var y = Object.defineProperty;
|
|
2
|
+
var x = (c, a, t) => a in c ? y(c, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[a] = t;
|
|
3
|
+
var u = (c, a, t) => (x(c, typeof a != "symbol" ? a + "" : a, t), t);
|
|
4
|
+
import { BasePO as g } from "@agnos-ui/base-po";
|
|
5
|
+
const A = {
|
|
6
6
|
// TODO: should we use bootstrap-independent classes starting with au- ?
|
|
7
7
|
rootComponent: ".modal",
|
|
8
8
|
closeButton: ".btn-close",
|
|
@@ -12,10 +12,10 @@ const C = {
|
|
|
12
12
|
body: ".modal-body",
|
|
13
13
|
footer: ".modal-footer"
|
|
14
14
|
};
|
|
15
|
-
class H extends
|
|
15
|
+
class H extends g {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments);
|
|
18
|
-
|
|
18
|
+
u(this, "selectors", structuredClone(A));
|
|
19
19
|
}
|
|
20
20
|
getComponentSelector() {
|
|
21
21
|
return this.selectors.rootComponent;
|
|
@@ -39,7 +39,7 @@ class H extends n {
|
|
|
39
39
|
return this.locatorRoot.locator(this.selectors.backdrop);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
const
|
|
42
|
+
const C = {
|
|
43
43
|
rootComponent: ".au-pagination",
|
|
44
44
|
activePage: ".active",
|
|
45
45
|
previousPage: ".au-previous",
|
|
@@ -49,10 +49,10 @@ const y = {
|
|
|
49
49
|
pages: ".au-page",
|
|
50
50
|
ellipses: ".au-ellipsis"
|
|
51
51
|
};
|
|
52
|
-
class I extends
|
|
52
|
+
class I extends g {
|
|
53
53
|
constructor() {
|
|
54
54
|
super(...arguments);
|
|
55
|
-
|
|
55
|
+
u(this, "selectors", structuredClone(C));
|
|
56
56
|
}
|
|
57
57
|
// TODO should we add this in the list of selector ?
|
|
58
58
|
// Depend on the setSelectors usage...
|
|
@@ -112,15 +112,25 @@ class I extends n {
|
|
|
112
112
|
get locatorEllipses() {
|
|
113
113
|
return this.locatorRoot.locator(this.selectors.ellipses);
|
|
114
114
|
}
|
|
115
|
+
async state() {
|
|
116
|
+
return this.locatorRoot.evaluate((t) => {
|
|
117
|
+
const e = { rootClasses: [], disabled: null, pages: [], hrefs: [] }, l = [...t.querySelectorAll(".au-page")], s = [], r = [], o = {}, i = (h) => h == null ? void 0 : h.getAttribute("href"), n = t.querySelector("a.au-first"), d = t.querySelector("a.au-previous"), p = t.querySelector("a.au-next"), m = t.querySelector("a.au-last");
|
|
118
|
+
n && (o.first = i(n)), d && (o.previous = i(d)), p && (o.next = i(p)), m && (o.last = i(m));
|
|
119
|
+
for (const h of l)
|
|
120
|
+
r.push(h.getAttribute("href") || ""), s.push((h.textContent || "").trim());
|
|
121
|
+
const b = [...t.querySelectorAll("a.au-page[aria-disabled]")];
|
|
122
|
+
return e.pages = s, e.hrefs = r, e.hrefsNavigation = o, e.rootClasses = t.className.trim().split(" "), e.disabled = b.length === l.length ? "true" : null, t.querySelector("a.au-previous[aria-disabled]") ? e.isPreviousDisabled = !0 : d && (e.isPreviousDisabled = !1), t.querySelector("a.au-next[aria-disabled]") ? e.isNextDisabled = !0 : p && (e.isNextDisabled = !1), t.querySelector("a.au-first[aria-disabled]") ? e.isFirstDisabled = !0 : n && (e.isFirstDisabled = !1), t.querySelector("a.au-last[aria-disabled]") ? e.isLastDisabled = !0 : m && (e.isLastDisabled = !1), e;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
115
125
|
}
|
|
116
126
|
const v = {
|
|
117
127
|
rootComponent: ".au-rating",
|
|
118
128
|
star: ".au-rating-star"
|
|
119
129
|
};
|
|
120
|
-
class
|
|
130
|
+
class w extends g {
|
|
121
131
|
constructor() {
|
|
122
132
|
super(...arguments);
|
|
123
|
-
|
|
133
|
+
u(this, "selectors", structuredClone(v));
|
|
124
134
|
}
|
|
125
135
|
getComponentSelector() {
|
|
126
136
|
return this.selectors.rootComponent;
|
|
@@ -135,9 +145,9 @@ class M extends n {
|
|
|
135
145
|
// We already discuss with Guillaume Saas not to put this in the basic PO which should only return locator basically
|
|
136
146
|
async state() {
|
|
137
147
|
return await this.locatorRoot.evaluate((t, e) => {
|
|
138
|
-
const
|
|
139
|
-
for (const o of
|
|
140
|
-
|
|
148
|
+
const l = [...t.querySelectorAll(e.star)], s = [], r = [];
|
|
149
|
+
for (const o of l)
|
|
150
|
+
s.push((o.textContent || "").trim()), r.push(o.className.split(" "));
|
|
141
151
|
return {
|
|
142
152
|
rootClasses: t.className.trim().split(" "),
|
|
143
153
|
value: t.getAttribute("aria-valuenow"),
|
|
@@ -146,20 +156,20 @@ class M extends n {
|
|
|
146
156
|
text: t.getAttribute("aria-valuetext"),
|
|
147
157
|
disabled: t.getAttribute("aria-disabled"),
|
|
148
158
|
readonly: t.getAttribute("aria-readonly"),
|
|
149
|
-
stars:
|
|
159
|
+
stars: s,
|
|
150
160
|
classes: r
|
|
151
161
|
};
|
|
152
162
|
}, this.selectors);
|
|
153
163
|
}
|
|
154
164
|
}
|
|
155
|
-
const
|
|
165
|
+
const S = {
|
|
156
166
|
rootComponent: ".au-select"
|
|
157
167
|
// TODO add selector list
|
|
158
168
|
};
|
|
159
|
-
class
|
|
169
|
+
class M extends g {
|
|
160
170
|
constructor() {
|
|
161
171
|
super(...arguments);
|
|
162
|
-
|
|
172
|
+
u(this, "selectors", structuredClone(S));
|
|
163
173
|
}
|
|
164
174
|
getComponentSelector() {
|
|
165
175
|
return this.selectors.rootComponent;
|
|
@@ -202,39 +212,39 @@ class w extends n {
|
|
|
202
212
|
}
|
|
203
213
|
async state() {
|
|
204
214
|
return await this.locatorRoot.evaluate((t) => {
|
|
205
|
-
var
|
|
206
|
-
const e = t.querySelector('div[role="combobox"]'),
|
|
215
|
+
var d, p;
|
|
216
|
+
const e = t.querySelector('div[role="combobox"]'), l = t.querySelector('input[type="text"]'), s = [];
|
|
207
217
|
if (e) {
|
|
208
218
|
const m = e.querySelectorAll("div.au-select-badge");
|
|
209
|
-
for (const
|
|
210
|
-
|
|
219
|
+
for (const b of m)
|
|
220
|
+
s.push((d = b == null ? void 0 : b.textContent) == null ? void 0 : d.trim());
|
|
211
221
|
}
|
|
212
|
-
const r = t.querySelector("ul.dropdown-menu"), o = r != null,
|
|
222
|
+
const r = t.querySelector("ul.dropdown-menu"), o = r != null, i = [], n = [];
|
|
213
223
|
if (r != null) {
|
|
214
224
|
const m = r.querySelectorAll("li.dropdown-item");
|
|
215
|
-
for (const
|
|
216
|
-
const
|
|
217
|
-
|
|
225
|
+
for (const b of m) {
|
|
226
|
+
const h = (p = b.textContent) == null ? void 0 : p.trim();
|
|
227
|
+
i.push(h), b.classList.contains("selected") && n.push(h);
|
|
218
228
|
}
|
|
219
229
|
}
|
|
220
230
|
return {
|
|
221
|
-
text:
|
|
222
|
-
badges:
|
|
231
|
+
text: l.value,
|
|
232
|
+
badges: s,
|
|
223
233
|
isOpen: o,
|
|
224
|
-
list:
|
|
225
|
-
checked:
|
|
234
|
+
list: i,
|
|
235
|
+
checked: n
|
|
226
236
|
};
|
|
227
237
|
});
|
|
228
238
|
}
|
|
229
239
|
}
|
|
230
|
-
const
|
|
240
|
+
const f = {
|
|
231
241
|
rootComponent: ".alert",
|
|
232
242
|
closeButton: ".btn-close"
|
|
233
243
|
};
|
|
234
|
-
class O extends
|
|
244
|
+
class O extends g {
|
|
235
245
|
constructor() {
|
|
236
246
|
super(...arguments);
|
|
237
|
-
|
|
247
|
+
u(this, "selectors", structuredClone(f));
|
|
238
248
|
}
|
|
239
249
|
getComponentSelector() {
|
|
240
250
|
return this.selectors.rootComponent;
|
|
@@ -243,10 +253,10 @@ class O extends n {
|
|
|
243
253
|
return this.locatorRoot.locator(this.selectors.closeButton);
|
|
244
254
|
}
|
|
245
255
|
}
|
|
246
|
-
class
|
|
256
|
+
class V extends g {
|
|
247
257
|
constructor() {
|
|
248
258
|
super(...arguments);
|
|
249
|
-
|
|
259
|
+
u(this, "selectors", {
|
|
250
260
|
item: ".accordion-item",
|
|
251
261
|
collapse: ".accordion-collapse",
|
|
252
262
|
body: ".accordion-body",
|
|
@@ -304,12 +314,12 @@ class q extends n {
|
|
|
304
314
|
}
|
|
305
315
|
async state() {
|
|
306
316
|
return await this.locatorRoot.evaluate((t) => {
|
|
307
|
-
const e = [...t.querySelectorAll(".accordion-item")],
|
|
308
|
-
for (const
|
|
309
|
-
const r =
|
|
310
|
-
|
|
311
|
-
classes:
|
|
312
|
-
id:
|
|
317
|
+
const e = [...t.querySelectorAll(".accordion-item")], l = [];
|
|
318
|
+
for (const s of e) {
|
|
319
|
+
const r = s.querySelector(".accordion-collapse"), o = s.querySelector(".accordion-button");
|
|
320
|
+
l.push({
|
|
321
|
+
classes: s.className.trim().split(" "),
|
|
322
|
+
id: s.id,
|
|
313
323
|
isInDOM: r !== null,
|
|
314
324
|
collapseId: r == null ? void 0 : r.id,
|
|
315
325
|
buttonId: o == null ? void 0 : o.id,
|
|
@@ -319,19 +329,19 @@ class q extends n {
|
|
|
319
329
|
buttonControls: o == null ? void 0 : o.getAttribute("aria-controls")
|
|
320
330
|
});
|
|
321
331
|
}
|
|
322
|
-
return { rootClasses: t.className.trim().split(" "), items:
|
|
332
|
+
return { rootClasses: t.className.trim().split(" "), items: l };
|
|
323
333
|
});
|
|
324
334
|
}
|
|
325
335
|
}
|
|
326
|
-
const
|
|
336
|
+
const R = {
|
|
327
337
|
rootComponent: '[role="progressbar"]',
|
|
328
338
|
outerBar: ".progress",
|
|
329
339
|
innerBar: ".progress-bar"
|
|
330
340
|
};
|
|
331
|
-
class
|
|
341
|
+
class D extends g {
|
|
332
342
|
constructor() {
|
|
333
343
|
super(...arguments);
|
|
334
|
-
|
|
344
|
+
u(this, "selectors", structuredClone(R));
|
|
335
345
|
}
|
|
336
346
|
getComponentSelector() {
|
|
337
347
|
return this.selectors.rootComponent;
|
|
@@ -344,23 +354,23 @@ class V extends n {
|
|
|
344
354
|
}
|
|
345
355
|
async state() {
|
|
346
356
|
return this.locatorRoot.evaluate((t) => {
|
|
347
|
-
var
|
|
348
|
-
const e = t.querySelector(".progress-bar"),
|
|
357
|
+
var s, r, o, i, n, d;
|
|
358
|
+
const e = t.querySelector(".progress-bar"), l = t.querySelector(".progress");
|
|
349
359
|
return {
|
|
350
360
|
ariaLabel: t.getAttribute("aria-label"),
|
|
351
361
|
ariaValueNow: t.getAttribute("aria-valuenow"),
|
|
352
362
|
ariaValueMin: t.getAttribute("aria-valuemin"),
|
|
353
363
|
ariaValueMax: t.getAttribute("aria-valuemax"),
|
|
354
364
|
ariaValueText: t.getAttribute("aria-valuetext"),
|
|
355
|
-
label: (
|
|
356
|
-
innerClasses: ((
|
|
357
|
-
outerHeight: (
|
|
358
|
-
innerWidth: (
|
|
365
|
+
label: (s = e == null ? void 0 : e.textContent) == null ? void 0 : s.trim(),
|
|
366
|
+
innerClasses: ((i = (o = (r = e == null ? void 0 : e.className) == null ? void 0 : r.trim()) == null ? void 0 : o.split(" ")) == null ? void 0 : i.sort()) ?? [],
|
|
367
|
+
outerHeight: (n = l == null ? void 0 : l.style) == null ? void 0 : n.height,
|
|
368
|
+
innerWidth: (d = e == null ? void 0 : e.style) == null ? void 0 : d.width
|
|
359
369
|
};
|
|
360
370
|
});
|
|
361
371
|
}
|
|
362
372
|
}
|
|
363
|
-
const
|
|
373
|
+
const P = {
|
|
364
374
|
rootComponent: ".au-slider",
|
|
365
375
|
clickableArea: ".au-slider-clickable-area",
|
|
366
376
|
handle: ".au-slider-handle",
|
|
@@ -371,10 +381,10 @@ const B = {
|
|
|
371
381
|
valueLabel: ".au-slider-label-now",
|
|
372
382
|
progress: ".au-slider-progress"
|
|
373
383
|
};
|
|
374
|
-
class
|
|
384
|
+
class E extends g {
|
|
375
385
|
constructor() {
|
|
376
386
|
super(...arguments);
|
|
377
|
-
|
|
387
|
+
u(this, "selectors", structuredClone(P));
|
|
378
388
|
}
|
|
379
389
|
getComponentSelector() {
|
|
380
390
|
return this.selectors.rootComponent;
|
|
@@ -406,30 +416,62 @@ class k extends n {
|
|
|
406
416
|
value: e.getAttribute("aria-valuenow"),
|
|
407
417
|
min: e.getAttribute("aria-valuemin"),
|
|
408
418
|
max: e.getAttribute("aria-valuemax"),
|
|
409
|
-
text: e.getAttribute("aria-valuetext"),
|
|
410
419
|
disabled: e.getAttribute("aria-disabled"),
|
|
411
420
|
readonly: e.getAttribute("aria-readonly"),
|
|
412
|
-
ariaLabel: e.getAttribute("aria-label")
|
|
421
|
+
ariaLabel: e.getAttribute("aria-label"),
|
|
422
|
+
ariaValueText: e.getAttribute("aria-valuetext")
|
|
413
423
|
})));
|
|
414
424
|
}
|
|
415
425
|
async sliderProgressState() {
|
|
416
426
|
return this.locatorRoot.locator(this.selectors.progress).evaluateAll((t) => t.map((e) => e.getAttribute("style")));
|
|
417
427
|
}
|
|
418
428
|
}
|
|
429
|
+
const B = {
|
|
430
|
+
rootComponent: ".toast",
|
|
431
|
+
closeButton: ".btn-close",
|
|
432
|
+
header: ".toast-header",
|
|
433
|
+
body: ".toast-body"
|
|
434
|
+
};
|
|
435
|
+
class T extends g {
|
|
436
|
+
constructor() {
|
|
437
|
+
super(...arguments);
|
|
438
|
+
u(this, "selectors", structuredClone(B));
|
|
439
|
+
}
|
|
440
|
+
getComponentSelector() {
|
|
441
|
+
return this.selectors.rootComponent;
|
|
442
|
+
}
|
|
443
|
+
get locatorCloseButton() {
|
|
444
|
+
return this.locatorRoot.locator(this.selectors.closeButton);
|
|
445
|
+
}
|
|
446
|
+
async state() {
|
|
447
|
+
return await this.locatorRoot.evaluate((t, e) => {
|
|
448
|
+
var o, i, n;
|
|
449
|
+
const l = (o = t.querySelector(e.body)) == null ? void 0 : o.innerText, s = (i = t.querySelector(e.header)) == null ? void 0 : i.innerText, r = (n = t.querySelector(e.closeButton)) == null ? void 0 : n.getAttribute("aria-label");
|
|
450
|
+
return {
|
|
451
|
+
rootClasses: t.className.trim().split(" ").sort(),
|
|
452
|
+
body: l,
|
|
453
|
+
header: s,
|
|
454
|
+
closeButton: r
|
|
455
|
+
};
|
|
456
|
+
}, this.selectors);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
419
459
|
export {
|
|
420
|
-
|
|
460
|
+
V as AccordionPO,
|
|
421
461
|
O as AlertPO,
|
|
422
462
|
H as ModalPO,
|
|
423
463
|
I as PaginationPO,
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
464
|
+
D as ProgressbarPO,
|
|
465
|
+
w as RatingPO,
|
|
466
|
+
M as SelectPO,
|
|
467
|
+
E as SliderPO,
|
|
468
|
+
T as ToastPO,
|
|
469
|
+
f as alertSelectors,
|
|
470
|
+
A as modalSelectors,
|
|
471
|
+
C as paginationSelectors,
|
|
472
|
+
R as progressbarSelectors,
|
|
432
473
|
v as ratingSelectors,
|
|
433
|
-
|
|
434
|
-
|
|
474
|
+
S as selectSelectors,
|
|
475
|
+
P as sliderSelectors,
|
|
476
|
+
B as toastSelectors
|
|
435
477
|
};
|
package/package.json
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@agnos-ui/base-po": "0.
|
|
66
|
+
"@agnos-ui/base-po": "0.2.0"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"@playwright/test": "*"
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"url": "https://github.com/AmadeusITGroup/AgnosUI.git",
|
|
79
79
|
"directory": "page-objects"
|
|
80
80
|
},
|
|
81
|
-
"version": "0.
|
|
81
|
+
"version": "0.2.0"
|
|
82
82
|
}
|