@agnos-ui/page-objects 0.7.0 → 0.8.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/collapse.po.d.ts +13 -0
- package/index.cjs +1 -1
- package/index.d.ts +1 -0
- package/index.js +126 -84
- package/package.json +2 -2
- package/slider.po.d.ts +18 -0
package/collapse.po.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BasePO } from '@agnos-ui/base-po';
|
|
2
|
+
export declare const collapseSelectors: {
|
|
3
|
+
rootComponent: string;
|
|
4
|
+
};
|
|
5
|
+
export declare class CollapsePO extends BasePO {
|
|
6
|
+
selectors: {
|
|
7
|
+
rootComponent: string;
|
|
8
|
+
};
|
|
9
|
+
getComponentSelector(): string;
|
|
10
|
+
state(): Promise<{
|
|
11
|
+
rootClasses: string[];
|
|
12
|
+
}>;
|
|
13
|
+
}
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var T=Object.defineProperty;var L=(i,c,t)=>c in i?T(i,c,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[c]=t;var g=(i,c,t)=>L(i,typeof c!="symbol"?c+"":c,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("@agnos-ui/base-po"),C={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 H extends b.BasePO{constructor(){super(...arguments);g(this,"selectors",structuredClone(C))}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)}async state(){return this.locatorRoot.evaluate((t,e)=>{var n,u,p,m,h,d,y,S,x;const s=(n=t.querySelector(e.closeButton))==null?void 0:n.getAttribute("aria-label"),a=(p=(u=t.querySelector(e.header))==null?void 0:u.innerText)==null?void 0:p.trim(),r=(h=(m=t.querySelector(e.title))==null?void 0:m.innerText)==null?void 0:h.trim(),o=(y=(d=t.querySelector(e.body))==null?void 0:d.innerText)==null?void 0:y.trim(),l=(x=(S=t.querySelector(e.footer))==null?void 0:S.innerText)==null?void 0:x.trim();return{rootClasses:t.className.trim().split(" ").sort(),header:a,title:r,body:o,footer:l,closeButton:s}},this.selectors)}}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 I extends b.BasePO{constructor(){super(...arguments);g(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:[]},s=[...t.querySelectorAll(".au-page")],a=[],r=[],o={},l=d=>d==null?void 0:d.getAttribute("href"),n=t.querySelector("a.au-first"),u=t.querySelector("a.au-previous"),p=t.querySelector("a.au-next"),m=t.querySelector("a.au-last");n&&(o.first=l(n)),u&&(o.previous=l(u)),p&&(o.next=l(p)),m&&(o.last=l(m));for(const d of s)r.push(d.getAttribute("href")||""),a.push((d.textContent||"").trim());const h=[...t.querySelectorAll("a.au-page[aria-disabled]")];return e.pages=a,e.hrefs=r,e.hrefsNavigation=o,e.rootClasses=t.className.trim().split(" "),e.disabled=h.length===s.length?"true":null,t.querySelector("a.au-previous[aria-disabled]")?e.isPreviousDisabled=!0:u&&(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 P={rootComponent:".au-rating",star:".au-rating-star"};class M extends b.BasePO{constructor(){super(...arguments);g(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 s=[...t.querySelectorAll(e.star)],a=[],r=[];for(const o of s)a.push((o.textContent||"").trim()),r.push(o.className.split(" "));return{rootClasses:t.className.trim().split(" ").sort(),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:a,classes:r}},this.selectors)}}const f={rootComponent:".au-select"};class w extends b.BasePO{constructor(){super(...arguments);g(this,"selectors",structuredClone(f))}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 u,p;const e=t.querySelector('div[role="combobox"]'),s=t.querySelector('input[type="text"]'),a=[];if(e){const m=e.querySelectorAll("div.au-select-badge");for(const h of m)a.push((u=h==null?void 0:h.textContent)==null?void 0:u.trim())}const r=t.querySelector("ul.dropdown-menu"),o=r!=null,l=[],n=[];if(r!=null){const m=r.querySelectorAll("li.dropdown-item");for(const h of m){const d=(p=h.textContent)==null?void 0:p.trim();l.push(d),h.classList.contains("selected")&&n.push(d)}}return{text:s.value,badges:a,isOpen:o,list:l,checked:n}})}}const v={rootComponent:".alert",body:".alert-body",closeButton:".btn-close"};class E extends b.BasePO{constructor(){super(...arguments);g(this,"selectors",structuredClone(v))}getComponentSelector(){return this.selectors.rootComponent}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}async state(){return this.locatorRoot.evaluate((t,e)=>{var r,o,l;const s=(o=(r=t.querySelector(e.body))==null?void 0:r.innerText)==null?void 0:o.replace(/[^\x20-\x7E]/g,""),a=(l=t.querySelector(e.closeButton))==null?void 0:l.getAttribute("aria-label");return{rootClasses:t.className.trim().split(" ").sort(),body:s,closeButton:a}},this.selectors)}}class V extends b.BasePO{constructor(){super(...arguments);g(this,"selectors",{item:".accordion-item",bodyContainer:".accordion-collapse",body:".accordion-body",header:".accordion-header",buttons:".accordion-button"})}getComponentSelector(){return".au-accordion"}get locatorAccordionItems(){return this.locatorRoot.locator(this.selectors.item)}locatorAccordionItem(t){return this.locatorRoot.locator(this.selectors.item).nth(t)}get locatorAccordionCBodyContainers(){return this.locatorAccordionItems.locator(this.selectors.bodyContainer)}locatorAccordionBodyContainer(t){return this.locatorAccordionItem(t).locator(this.selectors.bodyContainer)}get locatorAccordionBodies(){return this.locatorAccordionCBodyContainers.locator(this.selectors.body)}locatorAccordionBody(t){return this.locatorAccordionBodyContainer(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")],s=[];for(const a of e){const r=a.querySelector(".accordion-collapse"),o=a.querySelector(".accordion-button");s.push({classes:a.className.trim().split(" "),id:a.id,isInDOM:r!==null,bodyContainerId: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:s}})}}const R={rootComponent:'[role="progressbar"]',outerBar:".progress",innerBar:".progress-bar"};class D extends b.BasePO{constructor(){super(...arguments);g(this,"selectors",structuredClone(R))}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 a,r,o,l,n,u;const e=t.querySelector(".progress-bar"),s=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:(a=e==null?void 0:e.textContent)==null?void 0:a.trim(),innerClasses:((l=(o=(r=e==null?void 0:e.className)==null?void 0:r.trim())==null?void 0:o.split(" "))==null?void 0:l.sort())??[],outerHeight:(n=s==null?void 0:s.style)==null?void 0:n.height,innerWidth:(u=e==null?void 0:e.style)==null?void 0:u.width}})}}const B={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 k extends b.BasePO{constructor(){super(...arguments);g(this,"selectors",structuredClone(B))}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 O={rootComponent:".toast",closeButton:".btn-close",header:".toast-header",body:".toast-body"};class z extends b.BasePO{constructor(){super(...arguments);g(this,"selectors",structuredClone(O))}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,l,n;const s=(o=t.querySelector(e.body))==null?void 0:o.innerText,a=(l=t.querySelector(e.header))==null?void 0:l.innerText,r=(n=t.querySelector(e.closeButton))==null?void 0:n.getAttribute("aria-label");return{rootClasses:t.className.trim().split(" ").sort(),body:s,header:a,closeButton:r}},this.selectors)}}const q={rootComponent:'[role="tree"]',itemContainer:'[role="treeitem"]',itemToggle:".au-tree-expand-icon",itemContents:".au-tree-item"};class F extends b.BasePO{constructor(){super(...arguments);g(this,"selectors",structuredClone(q))}getComponentSelector(){return this.selectors.rootComponent}get locatorItemToggle(){return this.locatorRoot.locator(this.selectors.itemToggle)}get locatorItemContainer(){return this.locatorRoot.locator(this.selectors.itemContents)}async itemContainerState(){return this.locatorRoot.locator(this.selectors.itemContainer).evaluateAll(t=>t.map(e=>({ariaSelected:e.getAttribute("aria-selected"),ariaExpanded:e.getAttribute("aria-expanded")})))}async itemToggleState(){return this.locatorRoot.locator(this.selectors.itemToggle).evaluateAll(t=>t.map(e=>({ariaLabel:e.getAttribute("aria-label")})))}}exports.AccordionPO=V;exports.AlertPO=E;exports.ModalPO=H;exports.PaginationPO=I;exports.ProgressbarPO=D;exports.RatingPO=M;exports.SelectPO=w;exports.SliderPO=k;exports.ToastPO=z;exports.TreePO=F;exports.alertSelectors=v;exports.modalSelectors=C;exports.paginationSelectors=A;exports.progressbarSelectors=R;exports.ratingSelectors=P;exports.selectSelectors=f;exports.sliderSelectors=B;exports.toastSelectors=O;exports.treeSelectors=q;
|
|
1
|
+
"use strict";var T=Object.defineProperty;var k=(i,l,t)=>l in i?T(i,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[l]=t;var h=(i,l,t)=>k(i,typeof l!="symbol"?l+"":l,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("@agnos-ui/base-po"),x={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 H extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(x))}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)}async state(){return this.locatorRoot.evaluate((t,e)=>{var n,u,p,m,g,d,y,S,C;const s=(n=t.querySelector(e.closeButton))==null?void 0:n.getAttribute("aria-label"),a=(p=(u=t.querySelector(e.header))==null?void 0:u.innerText)==null?void 0:p.trim(),r=(g=(m=t.querySelector(e.title))==null?void 0:m.innerText)==null?void 0:g.trim(),o=(y=(d=t.querySelector(e.body))==null?void 0:d.innerText)==null?void 0:y.trim(),c=(C=(S=t.querySelector(e.footer))==null?void 0:S.innerText)==null?void 0:C.trim();return{rootClasses:t.className.trim().split(" ").sort(),header:a,title:r,body:o,footer:c,closeButton:s}},this.selectors)}}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 I extends b.BasePO{constructor(){super(...arguments);h(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:[]},s=[...t.querySelectorAll(".au-page")],a=[],r=[],o={},c=d=>d==null?void 0:d.getAttribute("href"),n=t.querySelector("a.au-first"),u=t.querySelector("a.au-previous"),p=t.querySelector("a.au-next"),m=t.querySelector("a.au-last");n&&(o.first=c(n)),u&&(o.previous=c(u)),p&&(o.next=c(p)),m&&(o.last=c(m));for(const d of s)r.push(d.getAttribute("href")||""),a.push((d.textContent||"").trim());const g=[...t.querySelectorAll("a.au-page[aria-disabled]")];return e.pages=a,e.hrefs=r,e.hrefsNavigation=o,e.rootClasses=t.className.trim().split(" "),e.disabled=g.length===s.length?"true":null,t.querySelector("a.au-previous[aria-disabled]")?e.isPreviousDisabled=!0:u&&(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 P={rootComponent:".au-rating",star:".au-rating-star"};class M extends b.BasePO{constructor(){super(...arguments);h(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 s=[...t.querySelectorAll(e.star)],a=[],r=[];for(const o of s)a.push((o.textContent||"").trim()),r.push(o.className.split(" "));return{rootClasses:t.className.trim().split(" ").sort(),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:a,classes:r}},this.selectors)}}const v={rootComponent:".au-select"};class V extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(v))}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 u,p;const e=t.querySelector('div[role="combobox"]'),s=t.querySelector('input[type="text"]'),a=[];if(e){const m=e.querySelectorAll("div.au-select-badge");for(const g of m)a.push((u=g==null?void 0:g.textContent)==null?void 0:u.trim())}const r=t.querySelector("ul.dropdown-menu"),o=r!=null,c=[],n=[];if(r!=null){const m=r.querySelectorAll("li.dropdown-item");for(const g of m){const d=(p=g.textContent)==null?void 0:p.trim();c.push(d),g.classList.contains("selected")&&n.push(d)}}return{text:s.value,badges:a,isOpen:o,list:c,checked:n}})}}const f={rootComponent:".alert",body:".alert-body",closeButton:".btn-close"};class w extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(f))}getComponentSelector(){return this.selectors.rootComponent}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}async state(){return this.locatorRoot.evaluate((t,e)=>{var r,o,c;const s=(o=(r=t.querySelector(e.body))==null?void 0:r.innerText)==null?void 0:o.replace(/[^\x20-\x7E]/g,""),a=(c=t.querySelector(e.closeButton))==null?void 0:c.getAttribute("aria-label");return{rootClasses:t.className.trim().split(" ").sort(),body:s,closeButton:a}},this.selectors)}}class E extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",{item:".accordion-item",bodyContainer:".accordion-collapse",body:".accordion-body",header:".accordion-header",buttons:".accordion-button"})}getComponentSelector(){return".au-accordion"}get locatorAccordionItems(){return this.locatorRoot.locator(this.selectors.item)}locatorAccordionItem(t){return this.locatorRoot.locator(this.selectors.item).nth(t)}get locatorAccordionCBodyContainers(){return this.locatorAccordionItems.locator(this.selectors.bodyContainer)}locatorAccordionBodyContainer(t){return this.locatorAccordionItem(t).locator(this.selectors.bodyContainer)}get locatorAccordionBodies(){return this.locatorAccordionCBodyContainers.locator(this.selectors.body)}locatorAccordionBody(t){return this.locatorAccordionBodyContainer(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")],s=[];for(const a of e){const r=a.querySelector(".accordion-collapse"),o=a.querySelector(".accordion-button");s.push({classes:a.className.trim().split(" "),id:a.id,isInDOM:r!==null,bodyContainerId: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:s}})}}const R={rootComponent:'[role="progressbar"]',outerBar:".progress",innerBar:".progress-bar"};class D extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(R))}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 a,r,o,c,n,u;const e=t.querySelector(".progress-bar"),s=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:(a=e==null?void 0:e.textContent)==null?void 0:a.trim(),innerClasses:((c=(o=(r=e==null?void 0:e.className)==null?void 0:r.trim())==null?void 0:o.split(" "))==null?void 0:c.sort())??[],outerHeight:(n=s==null?void 0:s.style)==null?void 0:n.height,innerWidth:(u=e==null?void 0:e.style)==null?void 0:u.width}})}}const B={rootComponent:".au-slider",clickableArea:".au-slider-clickable-area",handle:".au-slider-handle",tick:".au-slider-tick",tickLabel:".au-slider-tick-label",tickLabelVertical:".au-slider-tick-label-vertical",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 z extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(B))}getComponentSelector(){return this.selectors.rootComponent}get locatorHandle(){return this.locatorRoot.locator(this.selectors.handle)}get locatorTick(){return this.locatorRoot.locator(this.selectors.tick)}get locatorTickLabel(){return this.locatorRoot.locator(this.selectors.tickLabel)}get locatorTickLabelVertical(){return this.locatorRoot.locator(this.selectors.tickLabelVertical)}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")))}async sliderTickLabelState(t){return t.evaluateAll(e=>e.map(s=>({style:s.getAttribute("style"),innerText:s.innerText})))}}const O={rootComponent:".toast",closeButton:".btn-close",header:".toast-header",body:".toast-body"};class F extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(O))}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,c,n;const s=(o=t.querySelector(e.body))==null?void 0:o.innerText,a=(c=t.querySelector(e.header))==null?void 0:c.innerText,r=(n=t.querySelector(e.closeButton))==null?void 0:n.getAttribute("aria-label");return{rootClasses:t.className.trim().split(" ").sort(),body:s,header:a,closeButton:r}},this.selectors)}}const q={rootComponent:'[role="tree"]',itemContainer:'[role="treeitem"]',itemToggle:".au-tree-expand-icon",itemContents:".au-tree-item"};class j extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(q))}getComponentSelector(){return this.selectors.rootComponent}get locatorItemToggle(){return this.locatorRoot.locator(this.selectors.itemToggle)}get locatorItemContainer(){return this.locatorRoot.locator(this.selectors.itemContents)}async itemContainerState(){return this.locatorRoot.locator(this.selectors.itemContainer).evaluateAll(t=>t.map(e=>({ariaSelected:e.getAttribute("aria-selected"),ariaExpanded:e.getAttribute("aria-expanded")})))}async itemToggleState(){return this.locatorRoot.locator(this.selectors.itemToggle).evaluateAll(t=>t.map(e=>({ariaLabel:e.getAttribute("aria-label")})))}}const L={rootComponent:".au-collapse"};class W extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(L))}getComponentSelector(){return this.selectors.rootComponent}async state(){return this.locatorRoot.evaluate((t,e)=>({rootClasses:t.className.trim().split(" ").sort()}),this.selectors)}}exports.AccordionPO=E;exports.AlertPO=w;exports.CollapsePO=W;exports.ModalPO=H;exports.PaginationPO=I;exports.ProgressbarPO=D;exports.RatingPO=M;exports.SelectPO=V;exports.SliderPO=z;exports.ToastPO=F;exports.TreePO=j;exports.alertSelectors=f;exports.collapseSelectors=L;exports.modalSelectors=x;exports.paginationSelectors=A;exports.progressbarSelectors=R;exports.ratingSelectors=P;exports.selectSelectors=v;exports.sliderSelectors=B;exports.toastSelectors=O;exports.treeSelectors=q;
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var A = Object.defineProperty;
|
|
2
|
-
var S = (i,
|
|
3
|
-
var
|
|
4
|
-
import { BasePO as
|
|
5
|
-
const
|
|
2
|
+
var S = (i, l, t) => l in i ? A(i, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[l] = t;
|
|
3
|
+
var h = (i, l, t) => S(i, typeof l != "symbol" ? l + "" : l, t);
|
|
4
|
+
import { BasePO as m } from "@agnos-ui/base-po";
|
|
5
|
+
const v = {
|
|
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 f = {
|
|
|
12
12
|
body: ".modal-body",
|
|
13
13
|
footer: ".modal-footer"
|
|
14
14
|
};
|
|
15
|
-
class
|
|
15
|
+
class V extends m {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments);
|
|
18
|
-
|
|
18
|
+
h(this, "selectors", structuredClone(v));
|
|
19
19
|
}
|
|
20
20
|
getComponentSelector() {
|
|
21
21
|
return this.selectors.rootComponent;
|
|
@@ -40,20 +40,20 @@ class w extends b {
|
|
|
40
40
|
}
|
|
41
41
|
async state() {
|
|
42
42
|
return this.locatorRoot.evaluate((t, e) => {
|
|
43
|
-
var n, u, p,
|
|
44
|
-
const
|
|
43
|
+
var n, u, p, b, g, d, y, C, x;
|
|
44
|
+
const a = (n = t.querySelector(e.closeButton)) == null ? void 0 : n.getAttribute("aria-label"), s = (p = (u = t.querySelector(e.header)) == null ? void 0 : u.innerText) == null ? void 0 : p.trim(), r = (g = (b = t.querySelector(e.title)) == null ? void 0 : b.innerText) == null ? void 0 : g.trim(), o = (y = (d = t.querySelector(e.body)) == null ? void 0 : d.innerText) == null ? void 0 : y.trim(), c = (x = (C = t.querySelector(e.footer)) == null ? void 0 : C.innerText) == null ? void 0 : x.trim();
|
|
45
45
|
return {
|
|
46
46
|
rootClasses: t.className.trim().split(" ").sort(),
|
|
47
|
-
header:
|
|
47
|
+
header: s,
|
|
48
48
|
title: r,
|
|
49
49
|
body: o,
|
|
50
|
-
footer:
|
|
51
|
-
closeButton:
|
|
50
|
+
footer: c,
|
|
51
|
+
closeButton: a
|
|
52
52
|
};
|
|
53
53
|
}, this.selectors);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
const
|
|
56
|
+
const f = {
|
|
57
57
|
rootComponent: ".au-pagination",
|
|
58
58
|
activePage: ".active",
|
|
59
59
|
previousPage: ".au-previous",
|
|
@@ -63,10 +63,10 @@ const v = {
|
|
|
63
63
|
pages: ".au-page",
|
|
64
64
|
ellipses: ".au-ellipsis"
|
|
65
65
|
};
|
|
66
|
-
class
|
|
66
|
+
class w extends m {
|
|
67
67
|
constructor() {
|
|
68
68
|
super(...arguments);
|
|
69
|
-
|
|
69
|
+
h(this, "selectors", structuredClone(f));
|
|
70
70
|
}
|
|
71
71
|
// TODO should we add this in the list of selector ?
|
|
72
72
|
// Depend on the setSelectors usage...
|
|
@@ -128,12 +128,12 @@ class M extends b {
|
|
|
128
128
|
}
|
|
129
129
|
async state() {
|
|
130
130
|
return this.locatorRoot.evaluate((t) => {
|
|
131
|
-
const e = { rootClasses: [], disabled: null, pages: [], hrefs: [] },
|
|
132
|
-
n && (o.first =
|
|
133
|
-
for (const d of
|
|
134
|
-
r.push(d.getAttribute("href") || ""),
|
|
135
|
-
const
|
|
136
|
-
return e.pages =
|
|
131
|
+
const e = { rootClasses: [], disabled: null, pages: [], hrefs: [] }, a = [...t.querySelectorAll(".au-page")], s = [], r = [], o = {}, c = (d) => d == null ? void 0 : d.getAttribute("href"), n = t.querySelector("a.au-first"), u = t.querySelector("a.au-previous"), p = t.querySelector("a.au-next"), b = t.querySelector("a.au-last");
|
|
132
|
+
n && (o.first = c(n)), u && (o.previous = c(u)), p && (o.next = c(p)), b && (o.last = c(b));
|
|
133
|
+
for (const d of a)
|
|
134
|
+
r.push(d.getAttribute("href") || ""), s.push((d.textContent || "").trim());
|
|
135
|
+
const g = [...t.querySelectorAll("a.au-page[aria-disabled]")];
|
|
136
|
+
return e.pages = s, e.hrefs = r, e.hrefsNavigation = o, e.rootClasses = t.className.trim().split(" "), e.disabled = g.length === a.length ? "true" : null, t.querySelector("a.au-previous[aria-disabled]") ? e.isPreviousDisabled = !0 : u && (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 : b && (e.isLastDisabled = !1), e;
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -141,10 +141,10 @@ const R = {
|
|
|
141
141
|
rootComponent: ".au-rating",
|
|
142
142
|
star: ".au-rating-star"
|
|
143
143
|
};
|
|
144
|
-
class
|
|
144
|
+
class M extends m {
|
|
145
145
|
constructor() {
|
|
146
146
|
super(...arguments);
|
|
147
|
-
|
|
147
|
+
h(this, "selectors", structuredClone(R));
|
|
148
148
|
}
|
|
149
149
|
getComponentSelector() {
|
|
150
150
|
return this.selectors.rootComponent;
|
|
@@ -157,9 +157,9 @@ class E extends b {
|
|
|
157
157
|
}
|
|
158
158
|
async state() {
|
|
159
159
|
return await this.locatorRoot.evaluate((t, e) => {
|
|
160
|
-
const
|
|
161
|
-
for (const o of
|
|
162
|
-
|
|
160
|
+
const a = [...t.querySelectorAll(e.star)], s = [], r = [];
|
|
161
|
+
for (const o of a)
|
|
162
|
+
s.push((o.textContent || "").trim()), r.push(o.className.split(" "));
|
|
163
163
|
return {
|
|
164
164
|
rootClasses: t.className.trim().split(" ").sort(),
|
|
165
165
|
value: t.getAttribute("aria-valuenow"),
|
|
@@ -168,7 +168,7 @@ class E extends b {
|
|
|
168
168
|
text: t.getAttribute("aria-valuetext"),
|
|
169
169
|
disabled: t.getAttribute("aria-disabled"),
|
|
170
170
|
readonly: t.getAttribute("aria-readonly"),
|
|
171
|
-
stars:
|
|
171
|
+
stars: s,
|
|
172
172
|
classes: r
|
|
173
173
|
};
|
|
174
174
|
}, this.selectors);
|
|
@@ -178,10 +178,10 @@ const B = {
|
|
|
178
178
|
rootComponent: ".au-select"
|
|
179
179
|
// TODO add selector list
|
|
180
180
|
};
|
|
181
|
-
class
|
|
181
|
+
class E extends m {
|
|
182
182
|
constructor() {
|
|
183
183
|
super(...arguments);
|
|
184
|
-
|
|
184
|
+
h(this, "selectors", structuredClone(B));
|
|
185
185
|
}
|
|
186
186
|
getComponentSelector() {
|
|
187
187
|
return this.selectors.rootComponent;
|
|
@@ -225,25 +225,25 @@ class V extends b {
|
|
|
225
225
|
async state() {
|
|
226
226
|
return await this.locatorRoot.evaluate((t) => {
|
|
227
227
|
var u, p;
|
|
228
|
-
const e = t.querySelector('div[role="combobox"]'),
|
|
228
|
+
const e = t.querySelector('div[role="combobox"]'), a = t.querySelector('input[type="text"]'), s = [];
|
|
229
229
|
if (e) {
|
|
230
|
-
const
|
|
231
|
-
for (const
|
|
232
|
-
|
|
230
|
+
const b = e.querySelectorAll("div.au-select-badge");
|
|
231
|
+
for (const g of b)
|
|
232
|
+
s.push((u = g == null ? void 0 : g.textContent) == null ? void 0 : u.trim());
|
|
233
233
|
}
|
|
234
|
-
const r = t.querySelector("ul.dropdown-menu"), o = r != null,
|
|
234
|
+
const r = t.querySelector("ul.dropdown-menu"), o = r != null, c = [], n = [];
|
|
235
235
|
if (r != null) {
|
|
236
|
-
const
|
|
237
|
-
for (const
|
|
238
|
-
const d = (p =
|
|
239
|
-
|
|
236
|
+
const b = r.querySelectorAll("li.dropdown-item");
|
|
237
|
+
for (const g of b) {
|
|
238
|
+
const d = (p = g.textContent) == null ? void 0 : p.trim();
|
|
239
|
+
c.push(d), g.classList.contains("selected") && n.push(d);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
return {
|
|
243
|
-
text:
|
|
244
|
-
badges:
|
|
243
|
+
text: a.value,
|
|
244
|
+
badges: s,
|
|
245
245
|
isOpen: o,
|
|
246
|
-
list:
|
|
246
|
+
list: c,
|
|
247
247
|
checked: n
|
|
248
248
|
};
|
|
249
249
|
});
|
|
@@ -254,10 +254,10 @@ const P = {
|
|
|
254
254
|
body: ".alert-body",
|
|
255
255
|
closeButton: ".btn-close"
|
|
256
256
|
};
|
|
257
|
-
class D extends
|
|
257
|
+
class D extends m {
|
|
258
258
|
constructor() {
|
|
259
259
|
super(...arguments);
|
|
260
|
-
|
|
260
|
+
h(this, "selectors", structuredClone(P));
|
|
261
261
|
}
|
|
262
262
|
getComponentSelector() {
|
|
263
263
|
return this.selectors.rootComponent;
|
|
@@ -267,20 +267,20 @@ class D extends b {
|
|
|
267
267
|
}
|
|
268
268
|
async state() {
|
|
269
269
|
return this.locatorRoot.evaluate((t, e) => {
|
|
270
|
-
var r, o,
|
|
271
|
-
const
|
|
270
|
+
var r, o, c;
|
|
271
|
+
const a = (o = (r = t.querySelector(e.body)) == null ? void 0 : r.innerText) == null ? void 0 : o.replace(/[^\x20-\x7E]/g, ""), s = (c = t.querySelector(e.closeButton)) == null ? void 0 : c.getAttribute("aria-label");
|
|
272
272
|
return {
|
|
273
273
|
rootClasses: t.className.trim().split(" ").sort(),
|
|
274
|
-
body:
|
|
275
|
-
closeButton:
|
|
274
|
+
body: a,
|
|
275
|
+
closeButton: s
|
|
276
276
|
};
|
|
277
277
|
}, this.selectors);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
class
|
|
280
|
+
class z extends m {
|
|
281
281
|
constructor() {
|
|
282
282
|
super(...arguments);
|
|
283
|
-
|
|
283
|
+
h(this, "selectors", {
|
|
284
284
|
item: ".accordion-item",
|
|
285
285
|
bodyContainer: ".accordion-collapse",
|
|
286
286
|
body: ".accordion-body",
|
|
@@ -338,12 +338,12 @@ class k extends b {
|
|
|
338
338
|
}
|
|
339
339
|
async state() {
|
|
340
340
|
return await this.locatorRoot.evaluate((t) => {
|
|
341
|
-
const e = [...t.querySelectorAll(".accordion-item")],
|
|
342
|
-
for (const
|
|
343
|
-
const r =
|
|
344
|
-
|
|
345
|
-
classes:
|
|
346
|
-
id:
|
|
341
|
+
const e = [...t.querySelectorAll(".accordion-item")], a = [];
|
|
342
|
+
for (const s of e) {
|
|
343
|
+
const r = s.querySelector(".accordion-collapse"), o = s.querySelector(".accordion-button");
|
|
344
|
+
a.push({
|
|
345
|
+
classes: s.className.trim().split(" "),
|
|
346
|
+
id: s.id,
|
|
347
347
|
isInDOM: r !== null,
|
|
348
348
|
bodyContainerId: r == null ? void 0 : r.id,
|
|
349
349
|
buttonId: o == null ? void 0 : o.id,
|
|
@@ -353,7 +353,7 @@ class k extends b {
|
|
|
353
353
|
buttonControls: o == null ? void 0 : o.getAttribute("aria-controls")
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
|
-
return { rootClasses: t.className.trim().split(" "), items:
|
|
356
|
+
return { rootClasses: t.className.trim().split(" "), items: a };
|
|
357
357
|
});
|
|
358
358
|
}
|
|
359
359
|
}
|
|
@@ -362,10 +362,10 @@ const q = {
|
|
|
362
362
|
outerBar: ".progress",
|
|
363
363
|
innerBar: ".progress-bar"
|
|
364
364
|
};
|
|
365
|
-
class
|
|
365
|
+
class F extends m {
|
|
366
366
|
constructor() {
|
|
367
367
|
super(...arguments);
|
|
368
|
-
|
|
368
|
+
h(this, "selectors", structuredClone(q));
|
|
369
369
|
}
|
|
370
370
|
getComponentSelector() {
|
|
371
371
|
return this.selectors.rootComponent;
|
|
@@ -378,17 +378,17 @@ class z extends b {
|
|
|
378
378
|
}
|
|
379
379
|
async state() {
|
|
380
380
|
return this.locatorRoot.evaluate((t) => {
|
|
381
|
-
var
|
|
382
|
-
const e = t.querySelector(".progress-bar"),
|
|
381
|
+
var s, r, o, c, n, u;
|
|
382
|
+
const e = t.querySelector(".progress-bar"), a = t.querySelector(".progress");
|
|
383
383
|
return {
|
|
384
384
|
ariaLabel: t.getAttribute("aria-label"),
|
|
385
385
|
ariaValueNow: t.getAttribute("aria-valuenow"),
|
|
386
386
|
ariaValueMin: t.getAttribute("aria-valuemin"),
|
|
387
387
|
ariaValueMax: t.getAttribute("aria-valuemax"),
|
|
388
388
|
ariaValueText: t.getAttribute("aria-valuetext"),
|
|
389
|
-
label: (
|
|
390
|
-
innerClasses: ((
|
|
391
|
-
outerHeight: (n =
|
|
389
|
+
label: (s = e == null ? void 0 : e.textContent) == null ? void 0 : s.trim(),
|
|
390
|
+
innerClasses: ((c = (o = (r = e == null ? void 0 : e.className) == null ? void 0 : r.trim()) == null ? void 0 : o.split(" ")) == null ? void 0 : c.sort()) ?? [],
|
|
391
|
+
outerHeight: (n = a == null ? void 0 : a.style) == null ? void 0 : n.height,
|
|
392
392
|
innerWidth: (u = e == null ? void 0 : e.style) == null ? void 0 : u.width
|
|
393
393
|
};
|
|
394
394
|
});
|
|
@@ -398,6 +398,9 @@ const L = {
|
|
|
398
398
|
rootComponent: ".au-slider",
|
|
399
399
|
clickableArea: ".au-slider-clickable-area",
|
|
400
400
|
handle: ".au-slider-handle",
|
|
401
|
+
tick: ".au-slider-tick",
|
|
402
|
+
tickLabel: ".au-slider-tick-label",
|
|
403
|
+
tickLabelVertical: ".au-slider-tick-label-vertical",
|
|
401
404
|
minLabelHorizontal: ".au-slider-label-min",
|
|
402
405
|
maxLabelHorizontal: ".au-slider-label-max",
|
|
403
406
|
minLabelVertical: ".au-slider-label-vertical-min",
|
|
@@ -405,10 +408,10 @@ const L = {
|
|
|
405
408
|
valueLabel: ".au-slider-label-now",
|
|
406
409
|
progress: ".au-slider-progress"
|
|
407
410
|
};
|
|
408
|
-
class
|
|
411
|
+
class W extends m {
|
|
409
412
|
constructor() {
|
|
410
413
|
super(...arguments);
|
|
411
|
-
|
|
414
|
+
h(this, "selectors", structuredClone(L));
|
|
412
415
|
}
|
|
413
416
|
getComponentSelector() {
|
|
414
417
|
return this.selectors.rootComponent;
|
|
@@ -416,6 +419,15 @@ class F extends b {
|
|
|
416
419
|
get locatorHandle() {
|
|
417
420
|
return this.locatorRoot.locator(this.selectors.handle);
|
|
418
421
|
}
|
|
422
|
+
get locatorTick() {
|
|
423
|
+
return this.locatorRoot.locator(this.selectors.tick);
|
|
424
|
+
}
|
|
425
|
+
get locatorTickLabel() {
|
|
426
|
+
return this.locatorRoot.locator(this.selectors.tickLabel);
|
|
427
|
+
}
|
|
428
|
+
get locatorTickLabelVertical() {
|
|
429
|
+
return this.locatorRoot.locator(this.selectors.tickLabelVertical);
|
|
430
|
+
}
|
|
419
431
|
get locatorMinLabelHorizontal() {
|
|
420
432
|
return this.locatorRoot.locator(this.selectors.minLabelHorizontal);
|
|
421
433
|
}
|
|
@@ -449,6 +461,17 @@ class F extends b {
|
|
|
449
461
|
async sliderProgressState() {
|
|
450
462
|
return this.locatorRoot.locator(this.selectors.progress).evaluateAll((t) => t.map((e) => e.getAttribute("style")));
|
|
451
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* Get the state of the tick elements
|
|
466
|
+
* @param locator tick locator (horizontal or vertical)
|
|
467
|
+
* @returns state of all the ticks
|
|
468
|
+
*/
|
|
469
|
+
async sliderTickLabelState(t) {
|
|
470
|
+
return t.evaluateAll((e) => e.map((a) => ({
|
|
471
|
+
style: a.getAttribute("style"),
|
|
472
|
+
innerText: a.innerText
|
|
473
|
+
})));
|
|
474
|
+
}
|
|
452
475
|
}
|
|
453
476
|
const T = {
|
|
454
477
|
rootComponent: ".toast",
|
|
@@ -456,10 +479,10 @@ const T = {
|
|
|
456
479
|
header: ".toast-header",
|
|
457
480
|
body: ".toast-body"
|
|
458
481
|
};
|
|
459
|
-
class
|
|
482
|
+
class _ extends m {
|
|
460
483
|
constructor() {
|
|
461
484
|
super(...arguments);
|
|
462
|
-
|
|
485
|
+
h(this, "selectors", structuredClone(T));
|
|
463
486
|
}
|
|
464
487
|
getComponentSelector() {
|
|
465
488
|
return this.selectors.rootComponent;
|
|
@@ -469,27 +492,27 @@ class W extends b {
|
|
|
469
492
|
}
|
|
470
493
|
async state() {
|
|
471
494
|
return await this.locatorRoot.evaluate((t, e) => {
|
|
472
|
-
var o,
|
|
473
|
-
const
|
|
495
|
+
var o, c, n;
|
|
496
|
+
const a = (o = t.querySelector(e.body)) == null ? void 0 : o.innerText, s = (c = t.querySelector(e.header)) == null ? void 0 : c.innerText, r = (n = t.querySelector(e.closeButton)) == null ? void 0 : n.getAttribute("aria-label");
|
|
474
497
|
return {
|
|
475
498
|
rootClasses: t.className.trim().split(" ").sort(),
|
|
476
|
-
body:
|
|
477
|
-
header:
|
|
499
|
+
body: a,
|
|
500
|
+
header: s,
|
|
478
501
|
closeButton: r
|
|
479
502
|
};
|
|
480
503
|
}, this.selectors);
|
|
481
504
|
}
|
|
482
505
|
}
|
|
483
|
-
const
|
|
506
|
+
const k = {
|
|
484
507
|
rootComponent: '[role="tree"]',
|
|
485
508
|
itemContainer: '[role="treeitem"]',
|
|
486
509
|
itemToggle: ".au-tree-expand-icon",
|
|
487
510
|
itemContents: ".au-tree-item"
|
|
488
511
|
};
|
|
489
|
-
class j extends
|
|
512
|
+
class j extends m {
|
|
490
513
|
constructor() {
|
|
491
514
|
super(...arguments);
|
|
492
|
-
|
|
515
|
+
h(this, "selectors", structuredClone(k));
|
|
493
516
|
}
|
|
494
517
|
getComponentSelector() {
|
|
495
518
|
return this.selectors.rootComponent;
|
|
@@ -512,24 +535,43 @@ class j extends b {
|
|
|
512
535
|
})));
|
|
513
536
|
}
|
|
514
537
|
}
|
|
538
|
+
const H = {
|
|
539
|
+
rootComponent: ".au-collapse"
|
|
540
|
+
};
|
|
541
|
+
class G extends m {
|
|
542
|
+
constructor() {
|
|
543
|
+
super(...arguments);
|
|
544
|
+
h(this, "selectors", structuredClone(H));
|
|
545
|
+
}
|
|
546
|
+
getComponentSelector() {
|
|
547
|
+
return this.selectors.rootComponent;
|
|
548
|
+
}
|
|
549
|
+
async state() {
|
|
550
|
+
return this.locatorRoot.evaluate((t, e) => ({
|
|
551
|
+
rootClasses: t.className.trim().split(" ").sort()
|
|
552
|
+
}), this.selectors);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
515
555
|
export {
|
|
516
|
-
|
|
556
|
+
z as AccordionPO,
|
|
517
557
|
D as AlertPO,
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
W as
|
|
558
|
+
G as CollapsePO,
|
|
559
|
+
V as ModalPO,
|
|
560
|
+
w as PaginationPO,
|
|
561
|
+
F as ProgressbarPO,
|
|
562
|
+
M as RatingPO,
|
|
563
|
+
E as SelectPO,
|
|
564
|
+
W as SliderPO,
|
|
565
|
+
_ as ToastPO,
|
|
525
566
|
j as TreePO,
|
|
526
567
|
P as alertSelectors,
|
|
527
|
-
|
|
528
|
-
v as
|
|
568
|
+
H as collapseSelectors,
|
|
569
|
+
v as modalSelectors,
|
|
570
|
+
f as paginationSelectors,
|
|
529
571
|
q as progressbarSelectors,
|
|
530
572
|
R as ratingSelectors,
|
|
531
573
|
B as selectSelectors,
|
|
532
574
|
L as sliderSelectors,
|
|
533
575
|
T as toastSelectors,
|
|
534
|
-
|
|
576
|
+
k as treeSelectors
|
|
535
577
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agnos-ui/page-objects",
|
|
3
3
|
"description": "Page objects to be used when testing AgnosUI-based applications with Playwright.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0-next.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"e2e",
|
|
7
7
|
"page-object",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"module": "./index.js",
|
|
26
26
|
"types": "./index.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@agnos-ui/base-po": "0.
|
|
28
|
+
"@agnos-ui/base-po": "0.8.0-next.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@playwright/test": "^1.49.0"
|
package/slider.po.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export declare const sliderSelectors: {
|
|
|
4
4
|
rootComponent: string;
|
|
5
5
|
clickableArea: string;
|
|
6
6
|
handle: string;
|
|
7
|
+
tick: string;
|
|
8
|
+
tickLabel: string;
|
|
9
|
+
tickLabelVertical: string;
|
|
7
10
|
minLabelHorizontal: string;
|
|
8
11
|
maxLabelHorizontal: string;
|
|
9
12
|
minLabelVertical: string;
|
|
@@ -16,6 +19,9 @@ export declare class SliderPO extends BasePO {
|
|
|
16
19
|
rootComponent: string;
|
|
17
20
|
clickableArea: string;
|
|
18
21
|
handle: string;
|
|
22
|
+
tick: string;
|
|
23
|
+
tickLabel: string;
|
|
24
|
+
tickLabelVertical: string;
|
|
19
25
|
minLabelHorizontal: string;
|
|
20
26
|
maxLabelHorizontal: string;
|
|
21
27
|
minLabelVertical: string;
|
|
@@ -25,6 +31,9 @@ export declare class SliderPO extends BasePO {
|
|
|
25
31
|
};
|
|
26
32
|
getComponentSelector(): string;
|
|
27
33
|
get locatorHandle(): Locator;
|
|
34
|
+
get locatorTick(): Locator;
|
|
35
|
+
get locatorTickLabel(): Locator;
|
|
36
|
+
get locatorTickLabelVertical(): Locator;
|
|
28
37
|
get locatorMinLabelHorizontal(): Locator;
|
|
29
38
|
get locatorMaxLabelHorizontal(): Locator;
|
|
30
39
|
get locatorMinLabelVertical(): Locator;
|
|
@@ -42,4 +51,13 @@ export declare class SliderPO extends BasePO {
|
|
|
42
51
|
ariaValueText: string | null;
|
|
43
52
|
}[]>;
|
|
44
53
|
sliderProgressState(): Promise<(string | null)[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Get the state of the tick elements
|
|
56
|
+
* @param locator tick locator (horizontal or vertical)
|
|
57
|
+
* @returns state of all the ticks
|
|
58
|
+
*/
|
|
59
|
+
sliderTickLabelState(locator: Locator): Promise<{
|
|
60
|
+
style: string | null;
|
|
61
|
+
innerText: string;
|
|
62
|
+
}[]>;
|
|
45
63
|
}
|