@agnos-ui/page-objects 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/drawer.po.d.ts +34 -0
- package/index.cjs +1 -1
- package/index.d.ts +1 -0
- package/index.js +182 -184
- package/package.json +2 -2
- package/select.po.d.ts +1 -1
package/drawer.po.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BasePO } from '@agnos-ui/base-po';
|
|
2
|
+
import type { Locator } from '@playwright/test';
|
|
3
|
+
export declare const drawerSelectors: {
|
|
4
|
+
rootComponent: string;
|
|
5
|
+
backdrop: string;
|
|
6
|
+
header: string;
|
|
7
|
+
body: string;
|
|
8
|
+
container: string;
|
|
9
|
+
splitter: string;
|
|
10
|
+
closeButton: string;
|
|
11
|
+
};
|
|
12
|
+
export declare class DrawerPO extends BasePO {
|
|
13
|
+
readonly selectors: {
|
|
14
|
+
rootComponent: string;
|
|
15
|
+
backdrop: string;
|
|
16
|
+
header: string;
|
|
17
|
+
body: string;
|
|
18
|
+
container: string;
|
|
19
|
+
splitter: string;
|
|
20
|
+
closeButton: string;
|
|
21
|
+
};
|
|
22
|
+
getComponentSelector(): string;
|
|
23
|
+
get locatorHeader(): Locator;
|
|
24
|
+
get locatorBody(): Locator;
|
|
25
|
+
get locatorBackdrop(): Locator;
|
|
26
|
+
get locatorContainer(): Locator;
|
|
27
|
+
get locatorSplitter(): Locator;
|
|
28
|
+
get locatorCloseButton(): Locator;
|
|
29
|
+
state(): Promise<{
|
|
30
|
+
rootClasses: string[];
|
|
31
|
+
header: string | undefined;
|
|
32
|
+
body: string | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var w=Object.defineProperty;var V=(c,l,t)=>l in c?w(c,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[l]=t;var u=(c,l,t)=>V(c,typeof l!="symbol"?l+"":l,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=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 H extends d.BasePO{constructor(){super(...arguments);u(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)}async state(){return this.locatorRoot.evaluate((t,e)=>{var n,h,p,m,b,g,y,S,x;const s=(n=t.querySelector(e.closeButton))==null?void 0:n.getAttribute("aria-label"),a=(p=(h=t.querySelector(e.header))==null?void 0:h.innerText)==null?void 0:p.trim(),r=(b=(m=t.querySelector(e.title))==null?void 0:m.innerText)==null?void 0:b.trim(),o=(y=(g=t.querySelector(e.body))==null?void 0:g.innerText)==null?void 0:y.trim(),i=(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:i,closeButton:s}},this.selectors)}}const R={rootComponent:".au-pagination",activePage:".active",previousPage:".au-previous",nextPage:".au-next",firstPage:".au-first",lastPage:".au-last",pages:".au-page",ellipses:".au-ellipsis"};class M extends d.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(R))}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={},i=g=>g==null?void 0:g.getAttribute("href"),n=t.querySelector("a.au-first"),h=t.querySelector("a.au-previous"),p=t.querySelector("a.au-next"),m=t.querySelector("a.au-last");n&&(o.first=i(n)),h&&(o.previous=i(h)),p&&(o.next=i(p)),m&&(o.last=i(m));for(const g of s)r.push(g.getAttribute("href")||""),a.push((g.textContent||"").trim());const b=[...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=b.length===s.length?"true":null,t.querySelector("a.au-previous[aria-disabled]")?e.isPreviousDisabled=!0:h&&(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 E extends d.BasePO{constructor(){super(...arguments);u(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 D extends d.BasePO{constructor(){super(...arguments);u(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 h,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 b of m)a.push((h=b==null?void 0:b.textContent)==null?void 0:h.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 g=(p=b.textContent)==null?void 0:p.trim();i.push(g),b.classList.contains("selected")&&n.push(g)}}return{text:s.value,badges:a,isOpen:o,list:i,checked:n}})}}const B={rootComponent:".alert",body:".alert-body",closeButton:".btn-close"};class z extends d.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(B))}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,i;const s=(o=(r=t.querySelector(e.body))==null?void 0:r.innerText)==null?void 0:o.replace(/[^\x20-\x7E]/g,""),a=(i=t.querySelector(e.closeButton))==null?void 0:i.getAttribute("aria-label");return{rootClasses:t.className.trim().split(" ").sort(),body:s,closeButton:a}},this.selectors)}}class F extends d.BasePO{constructor(){super(...arguments);u(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 f={rootComponent:'[role="progressbar"]',outerBar:".progress",innerBar:".progress-bar"};class _ extends d.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(f))}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,i,n,h;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:((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=s==null?void 0:s.style)==null?void 0:n.height,innerWidth:(h=e==null?void 0:e.style)==null?void 0:h.width}})}}const O={rootComponent:".au-slider",clickableArea:".au-slider-clickable-area",clickableAreaVertical:".au-slider-clickable-area-vertical",handle:".au-slider-handle",tick:".au-slider-tick",tickLabel:".au-slider-tick-label",tickLabelVertical:".au-slider-tick-label-vertical",tickLabelNow:".au-slider-tick-label-now",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",content:".au-slider-content"};class j extends d.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(O))}getComponentSelector(){return this.selectors.rootComponent}get clickableArea(){return this.locatorRoot.locator(this.selectors.clickableArea)}get clickableAreaVertical(){return this.locatorRoot.locator(this.selectors.clickableAreaVertical)}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 locatorTickLabelNow(){return this.locatorRoot.locator(this.selectors.tickLabelNow)}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)}get locatorContent(){return this.locatorRoot.locator(this.selectors.content)}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 C={rootComponent:".toast",closeButton:".btn-close",header:".toast-header",body:".toast-body"};class q extends d.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(C))}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 s=(o=t.querySelector(e.body))==null?void 0:o.innerText,a=(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:s,header:a,closeButton:r}},this.selectors)}}const L={rootComponent:".au-toaster",container:".au-toaster-container",closeButton:".au-toaster-closeAll"};class W extends d.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(L))}getComponentSelector(){return this.selectors.rootComponent}get locatorContainer(){return this.locatorRoot.locator(this.selectors.container)}async toastPOs(){return Array.from({length:await this.locatorContainer.locator(C.rootComponent).count()},(t,e)=>new q(this.locatorContainer,e))}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}}const T={rootComponent:'[role="tree"]',itemContainer:'[role="treeitem"]',itemToggle:".au-tree-expand-icon",itemContents:".au-tree-item"};class G extends d.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(T))}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 k={rootComponent:".au-collapse"};class J extends d.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(k))}getComponentSelector(){return this.selectors.rootComponent}async state(){return this.locatorRoot.evaluate((t,e)=>({rootClasses:t.className.trim().split(" ").sort()}),this.selectors)}}const I={rootComponent:".au-carousel",container:".au-carousel-container",slide:".au-carousel-slide",nextBtn:".carousel-control-next",prevBtn:".carousel-control-prev",indicators:".carousel-indicators",indicatorBtn:".carousel-indicators button"};class K extends d.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(I))}getComponentSelector(){return this.selectors.rootComponent}get locatorContainer(){return this.locatorRoot.locator(this.selectors.container)}get locatorNextBtn(){return this.locatorRoot.locator(this.selectors.nextBtn)}get locatorPrevBtn(){return this.locatorRoot.locator(this.selectors.prevBtn)}get locatorIndicators(){return this.locatorRoot.locator(this.selectors.indicators)}get locatorIndicatorBtn(){return this.locatorRoot.locator(this.selectors.indicatorBtn)}get locatorSlide(){return this.locatorRoot.locator(this.selectors.slide)}async state(){return this.locatorRoot.evaluate(t=>{const e=t.querySelectorAll(".carousel-indicators button");return{rootClasses:t.className.trim().split(" ").sort(),prevBtn:t.querySelector(".carousel-control-prev")!==null,nextBtn:t.querySelector(".carousel-control-next")!==null,indicators:{selected:[...e].findIndex(s=>s.classList.contains("active")),count:e.length},slides:{visible:[...t.querySelectorAll(".au-carousel-slide")].findIndex(s=>{const a=s.getBoundingClientRect(),r=t.getBoundingClientRect();return a.left>=r.left&&a.right<=r.right})}}})}}exports.AccordionPO=F;exports.AlertPO=z;exports.CarouselPO=K;exports.CollapsePO=J;exports.ModalPO=H;exports.PaginationPO=M;exports.ProgressbarPO=_;exports.RatingPO=E;exports.SelectPO=D;exports.SliderPO=j;exports.ToastPO=q;exports.ToasterPO=W;exports.TreePO=G;exports.alertSelectors=B;exports.carouselSelectors=I;exports.collapseSelectors=k;exports.modalSelectors=A;exports.paginationSelectors=R;exports.progressbarSelectors=f;exports.ratingSelectors=P;exports.selectSelectors=v;exports.sliderSelectors=O;exports.toastSelectors=C;exports.toasterSelectors=L;exports.treeSelectors=T;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@agnos-ui/base-po"),m={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 k extends l.BasePO{selectors=structuredClone(m);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)=>{const o=t.querySelector(e.closeButton)?.getAttribute("aria-label"),r=t.querySelector(e.header)?.innerText?.trim(),a=t.querySelector(e.title)?.innerText?.trim(),s=t.querySelector(e.body)?.innerText?.trim(),n=t.querySelector(e.footer)?.innerText?.trim();return{rootClasses:t.className.trim().split(" ").sort(),header:r,title:a,body:s,footer:n,closeButton:o}},this.selectors)}}const p={rootComponent:".au-pagination",activePage:".active",previousPage:".au-previous",nextPage:".au-next",firstPage:".au-first",lastPage:".au-last",pages:".au-page",ellipses:".au-ellipsis"};class T extends l.BasePO{selectors=structuredClone(p);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:[]},o=[...t.querySelectorAll(".au-page")],r=[],a=[],s={},n=g=>g?.getAttribute("href"),d=t.querySelector("a.au-first"),u=t.querySelector("a.au-previous"),i=t.querySelector("a.au-next"),h=t.querySelector("a.au-last");d&&(s.first=n(d)),u&&(s.previous=n(u)),i&&(s.next=n(i)),h&&(s.last=n(h));for(const g of o)a.push(g.getAttribute("href")||""),r.push((g.textContent||"").trim());const q=[...t.querySelectorAll("a.au-page[aria-disabled]")];return e.pages=r,e.hrefs=a,e.hrefsNavigation=s,e.rootClasses=t.className.trim().split(" "),e.disabled=q.length===o.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:i&&(e.isNextDisabled=!1),t.querySelector("a.au-first[aria-disabled]")?e.isFirstDisabled=!0:d&&(e.isFirstDisabled=!1),t.querySelector("a.au-last[aria-disabled]")?e.isLastDisabled=!0:h&&(e.isLastDisabled=!1),e})}}const y={rootComponent:".au-rating",star:".au-rating-star"};class L extends l.BasePO{selectors=structuredClone(y);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 o=[...t.querySelectorAll(e.star)],r=[],a=[];for(const s of o)r.push((s.textContent||"").trim()),a.push(s.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:r,classes:a}},this.selectors)}}const C={rootComponent:".au-select"};class w extends l.BasePO{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=>{const e=t.querySelector('div[role="combobox"]'),o=t.querySelector('input[type="text"]'),r=[];if(e){const u=e.querySelectorAll("div.au-select-badge");for(const i of u)r.push(i?.textContent?.trim())}const a=t.querySelector("ul.dropdown-menu"),s=a!=null,n=[],d=[];if(a!=null){const u=a.querySelectorAll("li.dropdown-item");for(const i of u){const h=i.textContent?.trim();n.push(h),i.classList.contains("selected")&&d.push(h)}}return{text:o.value,badges:r,isOpen:s,list:n,checked:d}})}}const S={rootComponent:".alert",body:".alert-body",closeButton:".btn-close"};class I extends l.BasePO{selectors=structuredClone(S);getComponentSelector(){return this.selectors.rootComponent}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}async state(){return this.locatorRoot.evaluate((t,e)=>{const o=t.querySelector(e.body)?.innerText?.replace(/[^\x20-\x7E]/g,""),r=t.querySelector(e.closeButton)?.getAttribute("aria-label");return{rootClasses:t.className.trim().split(" ").sort(),body:o,closeButton:r}},this.selectors)}}class V extends l.BasePO{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")],o=[];for(const r of e){const a=r.querySelector(".accordion-collapse"),s=r.querySelector(".accordion-button");o.push({classes:r.className.trim().split(" "),id:r.id,isInDOM:a!==null,bodyContainerId:a?.id,buttonId:s?.id,expanded:s?.getAttribute("aria-expanded"),disabled:s?.getAttribute("aria-disabled"),labeledBy:a?.getAttribute("aria-labelledby"),buttonControls:s?.getAttribute("aria-controls")})}return{rootClasses:t.className.trim().split(" "),items:o}})}}const x={rootComponent:'[role="progressbar"]',outerBar:".progress",innerBar:".progress-bar"};class H extends l.BasePO{selectors=structuredClone(x);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=>{const e=t.querySelector(".progress-bar"),o=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:e?.textContent?.trim(),innerClasses:e?.className?.trim()?.split(" ")?.sort()??[],outerHeight:o?.style?.height,innerWidth:e?.style?.width}})}}const B={rootComponent:".au-slider",clickableArea:".au-slider-clickable-area",clickableAreaVertical:".au-slider-clickable-area-vertical",handle:".au-slider-handle",tick:".au-slider-tick",tickLabel:".au-slider-tick-label",tickLabelVertical:".au-slider-tick-label-vertical",tickLabelNow:".au-slider-tick-label-now",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",content:".au-slider-content"};class M extends l.BasePO{selectors=structuredClone(B);getComponentSelector(){return this.selectors.rootComponent}get clickableArea(){return this.locatorRoot.locator(this.selectors.clickableArea)}get clickableAreaVertical(){return this.locatorRoot.locator(this.selectors.clickableAreaVertical)}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 locatorTickLabelNow(){return this.locatorRoot.locator(this.selectors.tickLabelNow)}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)}get locatorContent(){return this.locatorRoot.locator(this.selectors.content)}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(o=>({style:o.getAttribute("style"),innerText:o.innerText})))}}const b={rootComponent:".toast",closeButton:".btn-close",header:".toast-header",body:".toast-body"};class A extends l.BasePO{selectors=structuredClone(b);getComponentSelector(){return this.selectors.rootComponent}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}async state(){return await this.locatorRoot.evaluate((t,e)=>{const o=t.querySelector(e.body)?.innerText,r=t.querySelector(e.header)?.innerText,a=t.querySelector(e.closeButton)?.getAttribute("aria-label");return{rootClasses:t.className.trim().split(" ").sort(),body:o,header:r,closeButton:a}},this.selectors)}}const R={rootComponent:".au-toaster",container:".au-toaster-container",closeButton:".au-toaster-closeAll"};class E extends l.BasePO{selectors=structuredClone(R);getComponentSelector(){return this.selectors.rootComponent}get locatorContainer(){return this.locatorRoot.locator(this.selectors.container)}async toastPOs(){return Array.from({length:await this.locatorContainer.locator(b.rootComponent).count()},(t,e)=>new A(this.locatorContainer,e))}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}}const P={rootComponent:'[role="tree"]',itemContainer:'[role="treeitem"]',itemToggle:".au-tree-expand-icon",itemContents:".au-tree-item"};class D extends l.BasePO{selectors=structuredClone(P);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 v={rootComponent:".au-collapse"};class z extends l.BasePO{selectors=structuredClone(v);getComponentSelector(){return this.selectors.rootComponent}async state(){return this.locatorRoot.evaluate((t,e)=>({rootClasses:t.className.trim().split(" ").sort()}),this.selectors)}}const f={rootComponent:".au-carousel",container:".au-carousel-container",slide:".au-carousel-slide",nextBtn:".carousel-control-next",prevBtn:".carousel-control-prev",indicators:".carousel-indicators",indicatorBtn:".carousel-indicators button"};class F extends l.BasePO{selectors=structuredClone(f);getComponentSelector(){return this.selectors.rootComponent}get locatorContainer(){return this.locatorRoot.locator(this.selectors.container)}get locatorNextBtn(){return this.locatorRoot.locator(this.selectors.nextBtn)}get locatorPrevBtn(){return this.locatorRoot.locator(this.selectors.prevBtn)}get locatorIndicators(){return this.locatorRoot.locator(this.selectors.indicators)}get locatorIndicatorBtn(){return this.locatorRoot.locator(this.selectors.indicatorBtn)}get locatorSlide(){return this.locatorRoot.locator(this.selectors.slide)}async state(){return this.locatorRoot.evaluate(t=>{const e=t.querySelectorAll(".carousel-indicators button");return{rootClasses:t.className.trim().split(" ").sort(),prevBtn:t.querySelector(".carousel-control-prev")!==null,nextBtn:t.querySelector(".carousel-control-next")!==null,indicators:{selected:[...e].findIndex(o=>o.classList.contains("active")),count:e.length},slides:{visible:[...t.querySelectorAll(".au-carousel-slide")].findIndex(o=>{const r=o.getBoundingClientRect(),a=t.getBoundingClientRect();return r.left>=a.left&&r.right<=a.right})}}})}}const O={rootComponent:".au-drawer",backdrop:"xpath=./preceding-sibling::div[contains(@class,'au-drawer-backdrop')]",header:".au-drawer-header",body:".au-drawer-body",container:".au-drawer-container",splitter:".au-splitter",closeButton:"Close"};class _ extends l.BasePO{selectors=structuredClone(O);getComponentSelector(){return this.selectors.rootComponent}get locatorHeader(){return this.locatorRoot.locator(this.selectors.header)}get locatorBody(){return this.locatorRoot.locator(this.selectors.body)}get locatorBackdrop(){return this.locatorRoot.locator(this.selectors.backdrop)}get locatorContainer(){return this.locatorRoot.locator(this.selectors.container)}get locatorSplitter(){return this.locatorRoot.locator(this.selectors.splitter)}get locatorCloseButton(){return this._page.getByRole("button",{name:"Close"})}async state(){return this.locatorRoot.evaluate((t,e)=>{const o=t.querySelector(e.header)?.innerText?.trim(),r=t.querySelector(e.body)?.innerText?.trim();return{rootClasses:t.className.trim().split(" ").sort(),header:o,body:r}},this.selectors)}}exports.AccordionPO=V;exports.AlertPO=I;exports.CarouselPO=F;exports.CollapsePO=z;exports.DrawerPO=_;exports.ModalPO=k;exports.PaginationPO=T;exports.ProgressbarPO=H;exports.RatingPO=L;exports.SelectPO=w;exports.SliderPO=M;exports.ToastPO=A;exports.ToasterPO=E;exports.TreePO=D;exports.alertSelectors=S;exports.carouselSelectors=f;exports.collapseSelectors=v;exports.drawerSelectors=O;exports.modalSelectors=m;exports.paginationSelectors=p;exports.progressbarSelectors=x;exports.ratingSelectors=y;exports.selectSelectors=C;exports.sliderSelectors=B;exports.toastSelectors=b;exports.toasterSelectors=R;exports.treeSelectors=P;
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var u = (c, l, t) => R(c, typeof l != "symbol" ? l + "" : l, t);
|
|
4
|
-
import { BasePO as h } from "@agnos-ui/base-po";
|
|
5
|
-
const v = {
|
|
1
|
+
import { BasePO as l } from "@agnos-ui/base-po";
|
|
2
|
+
const p = {
|
|
6
3
|
// TODO: should we use bootstrap-independent classes starting with au- ?
|
|
7
4
|
rootComponent: ".modal",
|
|
8
5
|
closeButton: ".btn-close",
|
|
@@ -12,11 +9,8 @@ const v = {
|
|
|
12
9
|
body: ".modal-body",
|
|
13
10
|
footer: ".modal-footer"
|
|
14
11
|
};
|
|
15
|
-
class
|
|
16
|
-
|
|
17
|
-
super(...arguments);
|
|
18
|
-
u(this, "selectors", structuredClone(v));
|
|
19
|
-
}
|
|
12
|
+
class T extends l {
|
|
13
|
+
selectors = structuredClone(p);
|
|
20
14
|
getComponentSelector() {
|
|
21
15
|
return this.selectors.rootComponent;
|
|
22
16
|
}
|
|
@@ -40,20 +34,19 @@ class E extends h {
|
|
|
40
34
|
}
|
|
41
35
|
async state() {
|
|
42
36
|
return this.locatorRoot.evaluate((t, e) => {
|
|
43
|
-
|
|
44
|
-
const s = (n = t.querySelector(e.closeButton)) == null ? void 0 : n.getAttribute("aria-label"), a = (p = (d = t.querySelector(e.header)) == null ? void 0 : d.innerText) == null ? void 0 : p.trim(), r = (b = (m = t.querySelector(e.title)) == null ? void 0 : m.innerText) == null ? void 0 : b.trim(), o = (C = (g = t.querySelector(e.body)) == null ? void 0 : g.innerText) == null ? void 0 : C.trim(), i = (x = (y = t.querySelector(e.footer)) == null ? void 0 : y.innerText) == null ? void 0 : x.trim();
|
|
37
|
+
const o = t.querySelector(e.closeButton)?.getAttribute("aria-label"), r = t.querySelector(e.header)?.innerText?.trim(), a = t.querySelector(e.title)?.innerText?.trim(), s = t.querySelector(e.body)?.innerText?.trim(), n = t.querySelector(e.footer)?.innerText?.trim();
|
|
45
38
|
return {
|
|
46
39
|
rootClasses: t.className.trim().split(" ").sort(),
|
|
47
|
-
header:
|
|
48
|
-
title:
|
|
49
|
-
body:
|
|
50
|
-
footer:
|
|
51
|
-
closeButton:
|
|
40
|
+
header: r,
|
|
41
|
+
title: a,
|
|
42
|
+
body: s,
|
|
43
|
+
footer: n,
|
|
44
|
+
closeButton: o
|
|
52
45
|
};
|
|
53
46
|
}, this.selectors);
|
|
54
47
|
}
|
|
55
48
|
}
|
|
56
|
-
const
|
|
49
|
+
const y = {
|
|
57
50
|
rootComponent: ".au-pagination",
|
|
58
51
|
activePage: ".active",
|
|
59
52
|
previousPage: ".au-previous",
|
|
@@ -63,11 +56,8 @@ const f = {
|
|
|
63
56
|
pages: ".au-page",
|
|
64
57
|
ellipses: ".au-ellipsis"
|
|
65
58
|
};
|
|
66
|
-
class
|
|
67
|
-
|
|
68
|
-
super(...arguments);
|
|
69
|
-
u(this, "selectors", structuredClone(f));
|
|
70
|
-
}
|
|
59
|
+
class w extends l {
|
|
60
|
+
selectors = structuredClone(y);
|
|
71
61
|
// TODO should we add this in the list of selector ?
|
|
72
62
|
// Depend on the setSelectors usage...
|
|
73
63
|
getComponentSelector() {
|
|
@@ -128,24 +118,21 @@ class D extends h {
|
|
|
128
118
|
}
|
|
129
119
|
async state() {
|
|
130
120
|
return this.locatorRoot.evaluate((t) => {
|
|
131
|
-
const e = { rootClasses: [], disabled: null, pages: [], hrefs: [] },
|
|
132
|
-
|
|
133
|
-
for (const g of
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
return e.pages =
|
|
121
|
+
const e = { rootClasses: [], disabled: null, pages: [], hrefs: [] }, o = [...t.querySelectorAll(".au-page")], r = [], a = [], s = {}, n = (g) => g?.getAttribute("href"), d = t.querySelector("a.au-first"), u = t.querySelector("a.au-previous"), i = t.querySelector("a.au-next"), h = t.querySelector("a.au-last");
|
|
122
|
+
d && (s.first = n(d)), u && (s.previous = n(u)), i && (s.next = n(i)), h && (s.last = n(h));
|
|
123
|
+
for (const g of o)
|
|
124
|
+
a.push(g.getAttribute("href") || ""), r.push((g.textContent || "").trim());
|
|
125
|
+
const m = [...t.querySelectorAll("a.au-page[aria-disabled]")];
|
|
126
|
+
return e.pages = r, e.hrefs = a, e.hrefsNavigation = s, e.rootClasses = t.className.trim().split(" "), e.disabled = m.length === o.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 : i && (e.isNextDisabled = !1), t.querySelector("a.au-first[aria-disabled]") ? e.isFirstDisabled = !0 : d && (e.isFirstDisabled = !1), t.querySelector("a.au-last[aria-disabled]") ? e.isLastDisabled = !0 : h && (e.isLastDisabled = !1), e;
|
|
137
127
|
});
|
|
138
128
|
}
|
|
139
129
|
}
|
|
140
|
-
const
|
|
130
|
+
const C = {
|
|
141
131
|
rootComponent: ".au-rating",
|
|
142
132
|
star: ".au-rating-star"
|
|
143
133
|
};
|
|
144
|
-
class
|
|
145
|
-
|
|
146
|
-
super(...arguments);
|
|
147
|
-
u(this, "selectors", structuredClone(B));
|
|
148
|
-
}
|
|
134
|
+
class I extends l {
|
|
135
|
+
selectors = structuredClone(C);
|
|
149
136
|
getComponentSelector() {
|
|
150
137
|
return this.selectors.rootComponent;
|
|
151
138
|
}
|
|
@@ -157,9 +144,9 @@ class z extends h {
|
|
|
157
144
|
}
|
|
158
145
|
async state() {
|
|
159
146
|
return await this.locatorRoot.evaluate((t, e) => {
|
|
160
|
-
const
|
|
161
|
-
for (const
|
|
162
|
-
|
|
147
|
+
const o = [...t.querySelectorAll(e.star)], r = [], a = [];
|
|
148
|
+
for (const s of o)
|
|
149
|
+
r.push((s.textContent || "").trim()), a.push(s.className.split(" "));
|
|
163
150
|
return {
|
|
164
151
|
rootClasses: t.className.trim().split(" ").sort(),
|
|
165
152
|
value: t.getAttribute("aria-valuenow"),
|
|
@@ -168,21 +155,18 @@ class z extends h {
|
|
|
168
155
|
text: t.getAttribute("aria-valuetext"),
|
|
169
156
|
disabled: t.getAttribute("aria-disabled"),
|
|
170
157
|
readonly: t.getAttribute("aria-readonly"),
|
|
171
|
-
stars:
|
|
172
|
-
classes:
|
|
158
|
+
stars: r,
|
|
159
|
+
classes: a
|
|
173
160
|
};
|
|
174
161
|
}, this.selectors);
|
|
175
162
|
}
|
|
176
163
|
}
|
|
177
|
-
const
|
|
164
|
+
const x = {
|
|
178
165
|
rootComponent: ".au-select"
|
|
179
166
|
// TODO add selector list
|
|
180
167
|
};
|
|
181
|
-
class
|
|
182
|
-
|
|
183
|
-
super(...arguments);
|
|
184
|
-
u(this, "selectors", structuredClone(P));
|
|
185
|
-
}
|
|
168
|
+
class O extends l {
|
|
169
|
+
selectors = structuredClone(x);
|
|
186
170
|
getComponentSelector() {
|
|
187
171
|
return this.selectors.rootComponent;
|
|
188
172
|
}
|
|
@@ -224,41 +208,37 @@ class F extends h {
|
|
|
224
208
|
}
|
|
225
209
|
async state() {
|
|
226
210
|
return await this.locatorRoot.evaluate((t) => {
|
|
227
|
-
|
|
228
|
-
const e = t.querySelector('div[role="combobox"]'), s = t.querySelector('input[type="text"]'), a = [];
|
|
211
|
+
const e = t.querySelector('div[role="combobox"]'), o = t.querySelector('input[type="text"]'), r = [];
|
|
229
212
|
if (e) {
|
|
230
|
-
const
|
|
231
|
-
for (const
|
|
232
|
-
|
|
213
|
+
const u = e.querySelectorAll("div.au-select-badge");
|
|
214
|
+
for (const i of u)
|
|
215
|
+
r.push(i?.textContent?.trim());
|
|
233
216
|
}
|
|
234
|
-
const
|
|
235
|
-
if (
|
|
236
|
-
const
|
|
237
|
-
for (const
|
|
238
|
-
const
|
|
239
|
-
|
|
217
|
+
const a = t.querySelector("ul.dropdown-menu"), s = a != null, n = [], d = [];
|
|
218
|
+
if (a != null) {
|
|
219
|
+
const u = a.querySelectorAll("li.dropdown-item");
|
|
220
|
+
for (const i of u) {
|
|
221
|
+
const h = i.textContent?.trim();
|
|
222
|
+
n.push(h), i.classList.contains("selected") && d.push(h);
|
|
240
223
|
}
|
|
241
224
|
}
|
|
242
225
|
return {
|
|
243
|
-
text:
|
|
244
|
-
badges:
|
|
245
|
-
isOpen:
|
|
246
|
-
list:
|
|
247
|
-
checked:
|
|
226
|
+
text: o.value,
|
|
227
|
+
badges: r,
|
|
228
|
+
isOpen: s,
|
|
229
|
+
list: n,
|
|
230
|
+
checked: d
|
|
248
231
|
};
|
|
249
232
|
});
|
|
250
233
|
}
|
|
251
234
|
}
|
|
252
|
-
const
|
|
235
|
+
const S = {
|
|
253
236
|
rootComponent: ".alert",
|
|
254
237
|
body: ".alert-body",
|
|
255
238
|
closeButton: ".btn-close"
|
|
256
239
|
};
|
|
257
|
-
class
|
|
258
|
-
|
|
259
|
-
super(...arguments);
|
|
260
|
-
u(this, "selectors", structuredClone(q));
|
|
261
|
-
}
|
|
240
|
+
class V extends l {
|
|
241
|
+
selectors = structuredClone(S);
|
|
262
242
|
getComponentSelector() {
|
|
263
243
|
return this.selectors.rootComponent;
|
|
264
244
|
}
|
|
@@ -267,27 +247,23 @@ class _ extends h {
|
|
|
267
247
|
}
|
|
268
248
|
async state() {
|
|
269
249
|
return this.locatorRoot.evaluate((t, e) => {
|
|
270
|
-
|
|
271
|
-
const s = (o = (r = t.querySelector(e.body)) == null ? void 0 : r.innerText) == null ? void 0 : o.replace(/[^\x20-\x7E]/g, ""), a = (i = t.querySelector(e.closeButton)) == null ? void 0 : i.getAttribute("aria-label");
|
|
250
|
+
const o = t.querySelector(e.body)?.innerText?.replace(/[^\x20-\x7E]/g, ""), r = t.querySelector(e.closeButton)?.getAttribute("aria-label");
|
|
272
251
|
return {
|
|
273
252
|
rootClasses: t.className.trim().split(" ").sort(),
|
|
274
|
-
body:
|
|
275
|
-
closeButton:
|
|
253
|
+
body: o,
|
|
254
|
+
closeButton: r
|
|
276
255
|
};
|
|
277
256
|
}, this.selectors);
|
|
278
257
|
}
|
|
279
258
|
}
|
|
280
|
-
class
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
buttons: ".accordion-button"
|
|
289
|
-
});
|
|
290
|
-
}
|
|
259
|
+
class H extends l {
|
|
260
|
+
selectors = {
|
|
261
|
+
item: ".accordion-item",
|
|
262
|
+
bodyContainer: ".accordion-collapse",
|
|
263
|
+
body: ".accordion-body",
|
|
264
|
+
header: ".accordion-header",
|
|
265
|
+
buttons: ".accordion-button"
|
|
266
|
+
};
|
|
291
267
|
getComponentSelector() {
|
|
292
268
|
return ".au-accordion";
|
|
293
269
|
}
|
|
@@ -338,35 +314,32 @@ class W extends h {
|
|
|
338
314
|
}
|
|
339
315
|
async state() {
|
|
340
316
|
return await this.locatorRoot.evaluate((t) => {
|
|
341
|
-
const e = [...t.querySelectorAll(".accordion-item")],
|
|
342
|
-
for (const
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
classes:
|
|
346
|
-
id:
|
|
347
|
-
isInDOM:
|
|
348
|
-
bodyContainerId:
|
|
349
|
-
buttonId:
|
|
350
|
-
expanded:
|
|
351
|
-
disabled:
|
|
352
|
-
labeledBy:
|
|
353
|
-
buttonControls:
|
|
317
|
+
const e = [...t.querySelectorAll(".accordion-item")], o = [];
|
|
318
|
+
for (const r of e) {
|
|
319
|
+
const a = r.querySelector(".accordion-collapse"), s = r.querySelector(".accordion-button");
|
|
320
|
+
o.push({
|
|
321
|
+
classes: r.className.trim().split(" "),
|
|
322
|
+
id: r.id,
|
|
323
|
+
isInDOM: a !== null,
|
|
324
|
+
bodyContainerId: a?.id,
|
|
325
|
+
buttonId: s?.id,
|
|
326
|
+
expanded: s?.getAttribute("aria-expanded"),
|
|
327
|
+
disabled: s?.getAttribute("aria-disabled"),
|
|
328
|
+
labeledBy: a?.getAttribute("aria-labelledby"),
|
|
329
|
+
buttonControls: s?.getAttribute("aria-controls")
|
|
354
330
|
});
|
|
355
331
|
}
|
|
356
|
-
return { rootClasses: t.className.trim().split(" "), items:
|
|
332
|
+
return { rootClasses: t.className.trim().split(" "), items: o };
|
|
357
333
|
});
|
|
358
334
|
}
|
|
359
335
|
}
|
|
360
|
-
const
|
|
336
|
+
const A = {
|
|
361
337
|
rootComponent: '[role="progressbar"]',
|
|
362
338
|
outerBar: ".progress",
|
|
363
339
|
innerBar: ".progress-bar"
|
|
364
340
|
};
|
|
365
|
-
class
|
|
366
|
-
|
|
367
|
-
super(...arguments);
|
|
368
|
-
u(this, "selectors", structuredClone(L));
|
|
369
|
-
}
|
|
341
|
+
class E extends l {
|
|
342
|
+
selectors = structuredClone(A);
|
|
370
343
|
getComponentSelector() {
|
|
371
344
|
return this.selectors.rootComponent;
|
|
372
345
|
}
|
|
@@ -378,23 +351,22 @@ class j extends h {
|
|
|
378
351
|
}
|
|
379
352
|
async state() {
|
|
380
353
|
return this.locatorRoot.evaluate((t) => {
|
|
381
|
-
|
|
382
|
-
const e = t.querySelector(".progress-bar"), s = t.querySelector(".progress");
|
|
354
|
+
const e = t.querySelector(".progress-bar"), o = t.querySelector(".progress");
|
|
383
355
|
return {
|
|
384
356
|
ariaLabel: t.getAttribute("aria-label"),
|
|
385
357
|
ariaValueNow: t.getAttribute("aria-valuenow"),
|
|
386
358
|
ariaValueMin: t.getAttribute("aria-valuemin"),
|
|
387
359
|
ariaValueMax: t.getAttribute("aria-valuemax"),
|
|
388
360
|
ariaValueText: t.getAttribute("aria-valuetext"),
|
|
389
|
-
label:
|
|
390
|
-
innerClasses:
|
|
391
|
-
outerHeight:
|
|
392
|
-
innerWidth:
|
|
361
|
+
label: e?.textContent?.trim(),
|
|
362
|
+
innerClasses: e?.className?.trim()?.split(" ")?.sort() ?? [],
|
|
363
|
+
outerHeight: o?.style?.height,
|
|
364
|
+
innerWidth: e?.style?.width
|
|
393
365
|
};
|
|
394
366
|
});
|
|
395
367
|
}
|
|
396
368
|
}
|
|
397
|
-
const
|
|
369
|
+
const R = {
|
|
398
370
|
rootComponent: ".au-slider",
|
|
399
371
|
clickableArea: ".au-slider-clickable-area",
|
|
400
372
|
clickableAreaVertical: ".au-slider-clickable-area-vertical",
|
|
@@ -411,11 +383,8 @@ const k = {
|
|
|
411
383
|
progress: ".au-slider-progress",
|
|
412
384
|
content: ".au-slider-content"
|
|
413
385
|
};
|
|
414
|
-
class
|
|
415
|
-
|
|
416
|
-
super(...arguments);
|
|
417
|
-
u(this, "selectors", structuredClone(k));
|
|
418
|
-
}
|
|
386
|
+
class M extends l {
|
|
387
|
+
selectors = structuredClone(R);
|
|
419
388
|
getComponentSelector() {
|
|
420
389
|
return this.selectors.rootComponent;
|
|
421
390
|
}
|
|
@@ -482,23 +451,20 @@ class G extends h {
|
|
|
482
451
|
* @returns state of all the ticks
|
|
483
452
|
*/
|
|
484
453
|
async sliderTickLabelState(t) {
|
|
485
|
-
return t.evaluateAll((e) => e.map((
|
|
486
|
-
style:
|
|
487
|
-
innerText:
|
|
454
|
+
return t.evaluateAll((e) => e.map((o) => ({
|
|
455
|
+
style: o.getAttribute("style"),
|
|
456
|
+
innerText: o.innerText
|
|
488
457
|
})));
|
|
489
458
|
}
|
|
490
459
|
}
|
|
491
|
-
const
|
|
460
|
+
const b = {
|
|
492
461
|
rootComponent: ".toast",
|
|
493
462
|
closeButton: ".btn-close",
|
|
494
463
|
header: ".toast-header",
|
|
495
464
|
body: ".toast-body"
|
|
496
465
|
};
|
|
497
|
-
class
|
|
498
|
-
|
|
499
|
-
super(...arguments);
|
|
500
|
-
u(this, "selectors", structuredClone(A));
|
|
501
|
-
}
|
|
466
|
+
class v extends l {
|
|
467
|
+
selectors = structuredClone(b);
|
|
502
468
|
getComponentSelector() {
|
|
503
469
|
return this.selectors.rootComponent;
|
|
504
470
|
}
|
|
@@ -507,27 +473,23 @@ class T extends h {
|
|
|
507
473
|
}
|
|
508
474
|
async state() {
|
|
509
475
|
return await this.locatorRoot.evaluate((t, e) => {
|
|
510
|
-
|
|
511
|
-
const s = (o = t.querySelector(e.body)) == null ? void 0 : o.innerText, a = (i = t.querySelector(e.header)) == null ? void 0 : i.innerText, r = (n = t.querySelector(e.closeButton)) == null ? void 0 : n.getAttribute("aria-label");
|
|
476
|
+
const o = t.querySelector(e.body)?.innerText, r = t.querySelector(e.header)?.innerText, a = t.querySelector(e.closeButton)?.getAttribute("aria-label");
|
|
512
477
|
return {
|
|
513
478
|
rootClasses: t.className.trim().split(" ").sort(),
|
|
514
|
-
body:
|
|
515
|
-
header:
|
|
516
|
-
closeButton:
|
|
479
|
+
body: o,
|
|
480
|
+
header: r,
|
|
481
|
+
closeButton: a
|
|
517
482
|
};
|
|
518
483
|
}, this.selectors);
|
|
519
484
|
}
|
|
520
485
|
}
|
|
521
|
-
const
|
|
486
|
+
const B = {
|
|
522
487
|
rootComponent: ".au-toaster",
|
|
523
488
|
container: ".au-toaster-container",
|
|
524
489
|
closeButton: ".au-toaster-closeAll"
|
|
525
490
|
};
|
|
526
|
-
class
|
|
527
|
-
|
|
528
|
-
super(...arguments);
|
|
529
|
-
u(this, "selectors", structuredClone(I));
|
|
530
|
-
}
|
|
491
|
+
class D extends l {
|
|
492
|
+
selectors = structuredClone(B);
|
|
531
493
|
getComponentSelector() {
|
|
532
494
|
return this.selectors.rootComponent;
|
|
533
495
|
}
|
|
@@ -536,25 +498,22 @@ class J extends h {
|
|
|
536
498
|
}
|
|
537
499
|
async toastPOs() {
|
|
538
500
|
return Array.from(
|
|
539
|
-
{ length: await this.locatorContainer.locator(
|
|
540
|
-
(t, e) => new
|
|
501
|
+
{ length: await this.locatorContainer.locator(b.rootComponent).count() },
|
|
502
|
+
(t, e) => new v(this.locatorContainer, e)
|
|
541
503
|
);
|
|
542
504
|
}
|
|
543
505
|
get locatorCloseButton() {
|
|
544
506
|
return this.locatorRoot.locator(this.selectors.closeButton);
|
|
545
507
|
}
|
|
546
508
|
}
|
|
547
|
-
const
|
|
509
|
+
const f = {
|
|
548
510
|
rootComponent: '[role="tree"]',
|
|
549
511
|
itemContainer: '[role="treeitem"]',
|
|
550
512
|
itemToggle: ".au-tree-expand-icon",
|
|
551
513
|
itemContents: ".au-tree-item"
|
|
552
514
|
};
|
|
553
|
-
class
|
|
554
|
-
|
|
555
|
-
super(...arguments);
|
|
556
|
-
u(this, "selectors", structuredClone(w));
|
|
557
|
-
}
|
|
515
|
+
class z extends l {
|
|
516
|
+
selectors = structuredClone(f);
|
|
558
517
|
getComponentSelector() {
|
|
559
518
|
return this.selectors.rootComponent;
|
|
560
519
|
}
|
|
@@ -576,14 +535,11 @@ class K extends h {
|
|
|
576
535
|
})));
|
|
577
536
|
}
|
|
578
537
|
}
|
|
579
|
-
const
|
|
538
|
+
const P = {
|
|
580
539
|
rootComponent: ".au-collapse"
|
|
581
540
|
};
|
|
582
|
-
class
|
|
583
|
-
|
|
584
|
-
super(...arguments);
|
|
585
|
-
u(this, "selectors", structuredClone(O));
|
|
586
|
-
}
|
|
541
|
+
class F extends l {
|
|
542
|
+
selectors = structuredClone(P);
|
|
587
543
|
getComponentSelector() {
|
|
588
544
|
return this.selectors.rootComponent;
|
|
589
545
|
}
|
|
@@ -593,7 +549,7 @@ class Q extends h {
|
|
|
593
549
|
}), this.selectors);
|
|
594
550
|
}
|
|
595
551
|
}
|
|
596
|
-
const
|
|
552
|
+
const q = {
|
|
597
553
|
rootComponent: ".au-carousel",
|
|
598
554
|
container: ".au-carousel-container",
|
|
599
555
|
slide: ".au-carousel-slide",
|
|
@@ -602,11 +558,8 @@ const V = {
|
|
|
602
558
|
indicators: ".carousel-indicators",
|
|
603
559
|
indicatorBtn: ".carousel-indicators button"
|
|
604
560
|
};
|
|
605
|
-
class
|
|
606
|
-
|
|
607
|
-
super(...arguments);
|
|
608
|
-
u(this, "selectors", structuredClone(V));
|
|
609
|
-
}
|
|
561
|
+
class _ extends l {
|
|
562
|
+
selectors = structuredClone(q);
|
|
610
563
|
getComponentSelector() {
|
|
611
564
|
return this.selectors.rootComponent;
|
|
612
565
|
}
|
|
@@ -636,43 +589,88 @@ class U extends h {
|
|
|
636
589
|
prevBtn: t.querySelector(".carousel-control-prev") !== null,
|
|
637
590
|
nextBtn: t.querySelector(".carousel-control-next") !== null,
|
|
638
591
|
indicators: {
|
|
639
|
-
selected: [...e].findIndex((
|
|
592
|
+
selected: [...e].findIndex((o) => o.classList.contains("active")),
|
|
640
593
|
count: e.length
|
|
641
594
|
},
|
|
642
595
|
slides: {
|
|
643
|
-
visible: [...t.querySelectorAll(".au-carousel-slide")].findIndex((
|
|
644
|
-
const
|
|
645
|
-
return
|
|
596
|
+
visible: [...t.querySelectorAll(".au-carousel-slide")].findIndex((o) => {
|
|
597
|
+
const r = o.getBoundingClientRect(), a = t.getBoundingClientRect();
|
|
598
|
+
return r.left >= a.left && r.right <= a.right;
|
|
646
599
|
})
|
|
647
600
|
}
|
|
648
601
|
};
|
|
649
602
|
});
|
|
650
603
|
}
|
|
651
604
|
}
|
|
605
|
+
const k = {
|
|
606
|
+
rootComponent: ".au-drawer",
|
|
607
|
+
backdrop: "xpath=./preceding-sibling::div[contains(@class,'au-drawer-backdrop')]",
|
|
608
|
+
header: ".au-drawer-header",
|
|
609
|
+
body: ".au-drawer-body",
|
|
610
|
+
container: ".au-drawer-container",
|
|
611
|
+
splitter: ".au-splitter",
|
|
612
|
+
closeButton: "Close"
|
|
613
|
+
};
|
|
614
|
+
class W extends l {
|
|
615
|
+
selectors = structuredClone(k);
|
|
616
|
+
getComponentSelector() {
|
|
617
|
+
return this.selectors.rootComponent;
|
|
618
|
+
}
|
|
619
|
+
get locatorHeader() {
|
|
620
|
+
return this.locatorRoot.locator(this.selectors.header);
|
|
621
|
+
}
|
|
622
|
+
get locatorBody() {
|
|
623
|
+
return this.locatorRoot.locator(this.selectors.body);
|
|
624
|
+
}
|
|
625
|
+
get locatorBackdrop() {
|
|
626
|
+
return this.locatorRoot.locator(this.selectors.backdrop);
|
|
627
|
+
}
|
|
628
|
+
get locatorContainer() {
|
|
629
|
+
return this.locatorRoot.locator(this.selectors.container);
|
|
630
|
+
}
|
|
631
|
+
get locatorSplitter() {
|
|
632
|
+
return this.locatorRoot.locator(this.selectors.splitter);
|
|
633
|
+
}
|
|
634
|
+
get locatorCloseButton() {
|
|
635
|
+
return this._page.getByRole("button", { name: "Close" });
|
|
636
|
+
}
|
|
637
|
+
async state() {
|
|
638
|
+
return this.locatorRoot.evaluate((t, e) => {
|
|
639
|
+
const o = t.querySelector(e.header)?.innerText?.trim(), r = t.querySelector(e.body)?.innerText?.trim();
|
|
640
|
+
return {
|
|
641
|
+
rootClasses: t.className.trim().split(" ").sort(),
|
|
642
|
+
header: o,
|
|
643
|
+
body: r
|
|
644
|
+
};
|
|
645
|
+
}, this.selectors);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
652
648
|
export {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
649
|
+
H as AccordionPO,
|
|
650
|
+
V as AlertPO,
|
|
651
|
+
_ as CarouselPO,
|
|
652
|
+
F as CollapsePO,
|
|
653
|
+
W as DrawerPO,
|
|
654
|
+
T as ModalPO,
|
|
655
|
+
w as PaginationPO,
|
|
656
|
+
E as ProgressbarPO,
|
|
657
|
+
I as RatingPO,
|
|
658
|
+
O as SelectPO,
|
|
659
|
+
M as SliderPO,
|
|
660
|
+
v as ToastPO,
|
|
661
|
+
D as ToasterPO,
|
|
662
|
+
z as TreePO,
|
|
663
|
+
S as alertSelectors,
|
|
664
|
+
q as carouselSelectors,
|
|
665
|
+
P as collapseSelectors,
|
|
666
|
+
k as drawerSelectors,
|
|
667
|
+
p as modalSelectors,
|
|
668
|
+
y as paginationSelectors,
|
|
669
|
+
A as progressbarSelectors,
|
|
670
|
+
C as ratingSelectors,
|
|
671
|
+
x as selectSelectors,
|
|
672
|
+
R as sliderSelectors,
|
|
673
|
+
b as toastSelectors,
|
|
674
|
+
B as toasterSelectors,
|
|
675
|
+
f as treeSelectors
|
|
678
676
|
};
|
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.10.0-next.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"e2e",
|
|
7
7
|
"page-object",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"module": "./index.js",
|
|
28
28
|
"types": "./index.d.ts",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@agnos-ui/base-po": "0.
|
|
30
|
+
"@agnos-ui/base-po": "0.10.0-next.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@playwright/test": "^1.49.0"
|
package/select.po.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare class SelectPO extends BasePO {
|
|
|
33
33
|
locatorBadgeItem(text: string): import("playwright-core").Locator;
|
|
34
34
|
state(): Promise<{
|
|
35
35
|
text: string;
|
|
36
|
-
badges:
|
|
36
|
+
badges: string[];
|
|
37
37
|
isOpen: boolean;
|
|
38
38
|
list: (string | undefined)[];
|
|
39
39
|
checked: (string | undefined)[];
|