@agnos-ui/page-objects 0.10.0-next.2 → 0.10.0-next.4
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 +15 -0
- package/index.cjs +1 -1
- package/index.js +49 -21
- package/package.json +2 -2
package/drawer.po.d.ts
CHANGED
|
@@ -26,9 +26,24 @@ export declare class DrawerPO extends BasePO {
|
|
|
26
26
|
get locatorContainer(): Locator;
|
|
27
27
|
get locatorSplitter(): Locator;
|
|
28
28
|
get locatorCloseButton(): Locator;
|
|
29
|
+
/**
|
|
30
|
+
* Hovers the mouse over the center of a splitter element.
|
|
31
|
+
*
|
|
32
|
+
* @returns A promise that resolves to an object containing the absolute x and y coordinates
|
|
33
|
+
* of the hover position
|
|
34
|
+
*/
|
|
35
|
+
hoverOnSplitter(): Promise<{
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
}>;
|
|
29
39
|
state(): Promise<{
|
|
30
40
|
rootClasses: string[];
|
|
31
41
|
header: string | undefined;
|
|
32
42
|
body: string | undefined;
|
|
33
43
|
}>;
|
|
44
|
+
statePosition(): Promise<{
|
|
45
|
+
'--bs-drawer-size': string;
|
|
46
|
+
'--bs-drawer-size-min': string;
|
|
47
|
+
'--bs-drawer-size-max': string;
|
|
48
|
+
}>;
|
|
34
49
|
}
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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 w 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(),s=t.querySelector(e.title)?.innerText?.trim(),a=t.querySelector(e.body)?.innerText?.trim(),n=t.querySelector(e.footer)?.innerText?.trim();return{rootClasses:t.className.trim().split(" ").sort(),header:r,title:s,body:a,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 k 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=[],s=[],a={},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&&(a.first=n(d)),u&&(a.previous=n(u)),i&&(a.next=n(i)),h&&(a.last=n(h));for(const g of o)s.push(g.getAttribute("href")||""),r.push((g.textContent||"").trim());const q=[...t.querySelectorAll("a.au-page[aria-disabled]")];return e.pages=r,e.hrefs=s,e.hrefsNavigation=a,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 T 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=[],s=[];for(const a of o)r.push((a.textContent||"").trim()),s.push(a.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:s}},this.selectors)}}const C={rootComponent:".au-select"};class L 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 s=t.querySelector("ul.dropdown-menu"),a=s!=null,n=[],d=[];if(s!=null){const u=s.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:a,list:n,checked:d}})}}const S={rootComponent:".alert",body:".alert-body",closeButton:".btn-close"};class V 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 I 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 s=r.querySelector(".accordion-collapse"),a=r.querySelector(".accordion-button");o.push({classes:r.className.trim().split(" "),id:r.id,isInDOM:s!==null,bodyContainerId:s?.id,buttonId:a?.id,expanded:a?.getAttribute("aria-expanded"),disabled:a?.getAttribute("aria-disabled"),labeledBy:s?.getAttribute("aria-labelledby"),buttonControls:a?.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,s=t.querySelector(e.closeButton)?.getAttribute("aria-label");return{rootClasses:t.className.trim().split(" ").sort(),body:o,header:r,closeButton:s}},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 z 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 D 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(),s=t.getBoundingClientRect();return r.left>=s.left&&r.right<=s.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 hoverOnSplitter(){const t=this.locatorSplitter,e=await t.boundingBox(),o=Math.round(e.width/2),r=Math.round(e.height/2);return await t.hover({position:{x:o,y:r}}),{x:e.x+o,y:e.y+r}}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)}async statePosition(){return this.locatorRoot.evaluate(t=>{const e=t.style;return{"--bs-drawer-size":e.getPropertyValue("--bs-drawer-size"),"--bs-drawer-size-min":e.getPropertyValue("--bs-drawer-size-min"),"--bs-drawer-size-max":e.getPropertyValue("--bs-drawer-size-max")}})}}exports.AccordionPO=I;exports.AlertPO=V;exports.CarouselPO=F;exports.CollapsePO=D;exports.DrawerPO=_;exports.ModalPO=w;exports.PaginationPO=k;exports.ProgressbarPO=H;exports.RatingPO=T;exports.SelectPO=L;exports.SliderPO=M;exports.ToastPO=A;exports.ToasterPO=E;exports.TreePO=z;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.js
CHANGED
|
@@ -9,7 +9,7 @@ const p = {
|
|
|
9
9
|
body: ".modal-body",
|
|
10
10
|
footer: ".modal-footer"
|
|
11
11
|
};
|
|
12
|
-
class
|
|
12
|
+
class L extends l {
|
|
13
13
|
selectors = structuredClone(p);
|
|
14
14
|
getComponentSelector() {
|
|
15
15
|
return this.selectors.rootComponent;
|
|
@@ -56,7 +56,7 @@ const y = {
|
|
|
56
56
|
pages: ".au-page",
|
|
57
57
|
ellipses: ".au-ellipsis"
|
|
58
58
|
};
|
|
59
|
-
class
|
|
59
|
+
class T extends l {
|
|
60
60
|
selectors = structuredClone(y);
|
|
61
61
|
// TODO should we add this in the list of selector ?
|
|
62
62
|
// Depend on the setSelectors usage...
|
|
@@ -131,7 +131,7 @@ const C = {
|
|
|
131
131
|
rootComponent: ".au-rating",
|
|
132
132
|
star: ".au-rating-star"
|
|
133
133
|
};
|
|
134
|
-
class
|
|
134
|
+
class V extends l {
|
|
135
135
|
selectors = structuredClone(C);
|
|
136
136
|
getComponentSelector() {
|
|
137
137
|
return this.selectors.rootComponent;
|
|
@@ -165,7 +165,7 @@ const x = {
|
|
|
165
165
|
rootComponent: ".au-select"
|
|
166
166
|
// TODO add selector list
|
|
167
167
|
};
|
|
168
|
-
class
|
|
168
|
+
class I extends l {
|
|
169
169
|
selectors = structuredClone(x);
|
|
170
170
|
getComponentSelector() {
|
|
171
171
|
return this.selectors.rootComponent;
|
|
@@ -237,7 +237,7 @@ const S = {
|
|
|
237
237
|
body: ".alert-body",
|
|
238
238
|
closeButton: ".btn-close"
|
|
239
239
|
};
|
|
240
|
-
class
|
|
240
|
+
class O extends l {
|
|
241
241
|
selectors = structuredClone(S);
|
|
242
242
|
getComponentSelector() {
|
|
243
243
|
return this.selectors.rootComponent;
|
|
@@ -338,7 +338,7 @@ const A = {
|
|
|
338
338
|
outerBar: ".progress",
|
|
339
339
|
innerBar: ".progress-bar"
|
|
340
340
|
};
|
|
341
|
-
class
|
|
341
|
+
class M extends l {
|
|
342
342
|
selectors = structuredClone(A);
|
|
343
343
|
getComponentSelector() {
|
|
344
344
|
return this.selectors.rootComponent;
|
|
@@ -383,7 +383,7 @@ const R = {
|
|
|
383
383
|
progress: ".au-slider-progress",
|
|
384
384
|
content: ".au-slider-content"
|
|
385
385
|
};
|
|
386
|
-
class
|
|
386
|
+
class E extends l {
|
|
387
387
|
selectors = structuredClone(R);
|
|
388
388
|
getComponentSelector() {
|
|
389
389
|
return this.selectors.rootComponent;
|
|
@@ -488,7 +488,7 @@ const B = {
|
|
|
488
488
|
container: ".au-toaster-container",
|
|
489
489
|
closeButton: ".au-toaster-closeAll"
|
|
490
490
|
};
|
|
491
|
-
class
|
|
491
|
+
class z extends l {
|
|
492
492
|
selectors = structuredClone(B);
|
|
493
493
|
getComponentSelector() {
|
|
494
494
|
return this.selectors.rootComponent;
|
|
@@ -512,7 +512,7 @@ const f = {
|
|
|
512
512
|
itemToggle: ".au-tree-expand-icon",
|
|
513
513
|
itemContents: ".au-tree-item"
|
|
514
514
|
};
|
|
515
|
-
class
|
|
515
|
+
class D extends l {
|
|
516
516
|
selectors = structuredClone(f);
|
|
517
517
|
getComponentSelector() {
|
|
518
518
|
return this.selectors.rootComponent;
|
|
@@ -602,7 +602,7 @@ class _ extends l {
|
|
|
602
602
|
});
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
const
|
|
605
|
+
const w = {
|
|
606
606
|
rootComponent: ".au-drawer",
|
|
607
607
|
backdrop: "xpath=./preceding-sibling::div[contains(@class,'au-drawer-backdrop')]",
|
|
608
608
|
header: ".au-drawer-header",
|
|
@@ -612,7 +612,7 @@ const k = {
|
|
|
612
612
|
closeButton: "Close"
|
|
613
613
|
};
|
|
614
614
|
class W extends l {
|
|
615
|
-
selectors = structuredClone(
|
|
615
|
+
selectors = structuredClone(w);
|
|
616
616
|
getComponentSelector() {
|
|
617
617
|
return this.selectors.rootComponent;
|
|
618
618
|
}
|
|
@@ -634,6 +634,24 @@ class W extends l {
|
|
|
634
634
|
get locatorCloseButton() {
|
|
635
635
|
return this._page.getByRole("button", { name: "Close" });
|
|
636
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* Hovers the mouse over the center of a splitter element.
|
|
639
|
+
*
|
|
640
|
+
* @returns A promise that resolves to an object containing the absolute x and y coordinates
|
|
641
|
+
* of the hover position
|
|
642
|
+
*/
|
|
643
|
+
async hoverOnSplitter() {
|
|
644
|
+
const t = this.locatorSplitter, e = await t.boundingBox(), o = Math.round(e.width / 2), r = Math.round(e.height / 2);
|
|
645
|
+
return await t.hover({
|
|
646
|
+
position: {
|
|
647
|
+
x: o,
|
|
648
|
+
y: r
|
|
649
|
+
}
|
|
650
|
+
}), {
|
|
651
|
+
x: e.x + o,
|
|
652
|
+
y: e.y + r
|
|
653
|
+
};
|
|
654
|
+
}
|
|
637
655
|
async state() {
|
|
638
656
|
return this.locatorRoot.evaluate((t, e) => {
|
|
639
657
|
const o = t.querySelector(e.header)?.innerText?.trim(), r = t.querySelector(e.body)?.innerText?.trim();
|
|
@@ -644,26 +662,36 @@ class W extends l {
|
|
|
644
662
|
};
|
|
645
663
|
}, this.selectors);
|
|
646
664
|
}
|
|
665
|
+
async statePosition() {
|
|
666
|
+
return this.locatorRoot.evaluate((t) => {
|
|
667
|
+
const e = t.style;
|
|
668
|
+
return {
|
|
669
|
+
"--bs-drawer-size": e.getPropertyValue("--bs-drawer-size"),
|
|
670
|
+
"--bs-drawer-size-min": e.getPropertyValue("--bs-drawer-size-min"),
|
|
671
|
+
"--bs-drawer-size-max": e.getPropertyValue("--bs-drawer-size-max")
|
|
672
|
+
};
|
|
673
|
+
});
|
|
674
|
+
}
|
|
647
675
|
}
|
|
648
676
|
export {
|
|
649
677
|
H as AccordionPO,
|
|
650
|
-
|
|
678
|
+
O as AlertPO,
|
|
651
679
|
_ as CarouselPO,
|
|
652
680
|
F as CollapsePO,
|
|
653
681
|
W as DrawerPO,
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
682
|
+
L as ModalPO,
|
|
683
|
+
T as PaginationPO,
|
|
684
|
+
M as ProgressbarPO,
|
|
685
|
+
V as RatingPO,
|
|
686
|
+
I as SelectPO,
|
|
687
|
+
E as SliderPO,
|
|
660
688
|
v as ToastPO,
|
|
661
|
-
|
|
662
|
-
|
|
689
|
+
z as ToasterPO,
|
|
690
|
+
D as TreePO,
|
|
663
691
|
S as alertSelectors,
|
|
664
692
|
q as carouselSelectors,
|
|
665
693
|
P as collapseSelectors,
|
|
666
|
-
|
|
694
|
+
w as drawerSelectors,
|
|
667
695
|
p as modalSelectors,
|
|
668
696
|
y as paginationSelectors,
|
|
669
697
|
A as progressbarSelectors,
|
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.10.0-next.
|
|
4
|
+
"version": "0.10.0-next.4",
|
|
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.10.0-next.
|
|
30
|
+
"@agnos-ui/base-po": "0.10.0-next.4"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@playwright/test": "^1.49.0"
|