@agnos-ui/page-objects 0.8.0-next.1 → 0.8.1
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/carousel.po.d.ts +42 -0
- package/index.cjs +1 -1
- package/index.d.ts +2 -0
- package/index.js +192 -102
- package/package.json +4 -2
- package/slider.po.d.ts +3 -0
- package/toaster.po.d.ts +19 -0
package/carousel.po.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BasePO } from '@agnos-ui/base-po';
|
|
2
|
+
import type { Locator } from '@playwright/test';
|
|
3
|
+
export declare const carouselSelectors: {
|
|
4
|
+
rootComponent: string;
|
|
5
|
+
container: string;
|
|
6
|
+
slide: string;
|
|
7
|
+
nextBtn: string;
|
|
8
|
+
prevBtn: string;
|
|
9
|
+
indicators: string;
|
|
10
|
+
indicatorBtn: string;
|
|
11
|
+
};
|
|
12
|
+
export interface CarouselPOState {
|
|
13
|
+
rootClasses: string[];
|
|
14
|
+
prevBtn: boolean;
|
|
15
|
+
nextBtn: boolean;
|
|
16
|
+
indicators: {
|
|
17
|
+
selected: number;
|
|
18
|
+
count: number;
|
|
19
|
+
};
|
|
20
|
+
slides: {
|
|
21
|
+
visible: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export declare class CarouselPO extends BasePO {
|
|
25
|
+
selectors: {
|
|
26
|
+
rootComponent: string;
|
|
27
|
+
container: string;
|
|
28
|
+
slide: string;
|
|
29
|
+
nextBtn: string;
|
|
30
|
+
prevBtn: string;
|
|
31
|
+
indicators: string;
|
|
32
|
+
indicatorBtn: string;
|
|
33
|
+
};
|
|
34
|
+
getComponentSelector(): string;
|
|
35
|
+
get locatorContainer(): Locator;
|
|
36
|
+
get locatorNextBtn(): Locator;
|
|
37
|
+
get locatorPrevBtn(): Locator;
|
|
38
|
+
get locatorIndicators(): Locator;
|
|
39
|
+
get locatorIndicatorBtn(): Locator;
|
|
40
|
+
get locatorSlide(): Locator;
|
|
41
|
+
state(): Promise<CarouselPOState>;
|
|
42
|
+
}
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var T=Object.defineProperty;var k=(i,l,t)=>l in i?T(i,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[l]=t;var h=(i,l,t)=>k(i,typeof l!="symbol"?l+"":l,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("@agnos-ui/base-po"),x={rootComponent:".modal",closeButton:".btn-close",backdrop:"xpath=./preceding-sibling::div[contains(@class,'modal-backdrop')]",header:".modal-header",title:".modal-title",body:".modal-body",footer:".modal-footer"};class H extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(x))}getComponentSelector(){return this.selectors.rootComponent}get locatorHeader(){return this.locatorRoot.locator(this.selectors.header)}get locatorTitle(){return this.locatorHeader.locator(this.selectors.title)}get locatorBody(){return this.locatorRoot.locator(this.selectors.body)}get locatorFooter(){return this.locatorRoot.locator(this.selectors.footer)}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}get locatorBackdrop(){return this.locatorRoot.locator(this.selectors.backdrop)}async state(){return this.locatorRoot.evaluate((t,e)=>{var n,u,p,m,g,d,y,S,C;const s=(n=t.querySelector(e.closeButton))==null?void 0:n.getAttribute("aria-label"),a=(p=(u=t.querySelector(e.header))==null?void 0:u.innerText)==null?void 0:p.trim(),r=(g=(m=t.querySelector(e.title))==null?void 0:m.innerText)==null?void 0:g.trim(),o=(y=(d=t.querySelector(e.body))==null?void 0:d.innerText)==null?void 0:y.trim(),c=(C=(S=t.querySelector(e.footer))==null?void 0:S.innerText)==null?void 0:C.trim();return{rootClasses:t.className.trim().split(" ").sort(),header:a,title:r,body:o,footer:c,closeButton:s}},this.selectors)}}const A={rootComponent:".au-pagination",activePage:".active",previousPage:".au-previous",nextPage:".au-next",firstPage:".au-first",lastPage:".au-last",pages:".au-page",ellipses:".au-ellipsis"};class I extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(A))}getComponentSelector(){return this.selectors.rootComponent}get locatorActivePage(){return this.locatorRoot.locator(this.selectors.activePage)}get locatorPreviousButton(){return this.locatorRoot.locator(this.selectors.previousPage)}get locatorNextButton(){return this.locatorRoot.locator(this.selectors.nextPage)}get locatorFirstButton(){return this.locatorRoot.locator(this.selectors.firstPage)}get locatorLastButton(){return this.locatorRoot.locator(this.selectors.lastPage)}get locatorPages(){return this.locatorRoot.locator(this.selectors.pages)}locatorNthPage(t){return this.locatorRoot.locator(this.selectors.pages).nth(t-1)}locatorPage(t){return this.locatorRoot.locator(this.selectors.pages,{hasText:t})}get locatorEllipses(){return this.locatorRoot.locator(this.selectors.ellipses)}async state(){return this.locatorRoot.evaluate(t=>{const e={rootClasses:[],disabled:null,pages:[],hrefs:[]},s=[...t.querySelectorAll(".au-page")],a=[],r=[],o={},c=d=>d==null?void 0:d.getAttribute("href"),n=t.querySelector("a.au-first"),u=t.querySelector("a.au-previous"),p=t.querySelector("a.au-next"),m=t.querySelector("a.au-last");n&&(o.first=c(n)),u&&(o.previous=c(u)),p&&(o.next=c(p)),m&&(o.last=c(m));for(const d of s)r.push(d.getAttribute("href")||""),a.push((d.textContent||"").trim());const g=[...t.querySelectorAll("a.au-page[aria-disabled]")];return e.pages=a,e.hrefs=r,e.hrefsNavigation=o,e.rootClasses=t.className.trim().split(" "),e.disabled=g.length===s.length?"true":null,t.querySelector("a.au-previous[aria-disabled]")?e.isPreviousDisabled=!0:u&&(e.isPreviousDisabled=!1),t.querySelector("a.au-next[aria-disabled]")?e.isNextDisabled=!0:p&&(e.isNextDisabled=!1),t.querySelector("a.au-first[aria-disabled]")?e.isFirstDisabled=!0:n&&(e.isFirstDisabled=!1),t.querySelector("a.au-last[aria-disabled]")?e.isLastDisabled=!0:m&&(e.isLastDisabled=!1),e})}}const P={rootComponent:".au-rating",star:".au-rating-star"};class M extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(P))}getComponentSelector(){return this.selectors.rootComponent}locatorStar(t){return this.locatorRoot.locator(this.selectors.star).nth(t)}async state(){return await this.locatorRoot.evaluate((t,e)=>{const s=[...t.querySelectorAll(e.star)],a=[],r=[];for(const o of s)a.push((o.textContent||"").trim()),r.push(o.className.split(" "));return{rootClasses:t.className.trim().split(" ").sort(),value:t.getAttribute("aria-valuenow"),min:t.getAttribute("aria-valuemin"),max:t.getAttribute("aria-valuemax"),text:t.getAttribute("aria-valuetext"),disabled:t.getAttribute("aria-disabled"),readonly:t.getAttribute("aria-readonly"),stars:a,classes:r}},this.selectors)}}const v={rootComponent:".au-select"};class V extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(v))}getComponentSelector(){return this.selectors.rootComponent}get locatorInput(){return this.locatorRoot.locator('input[type="text"]').nth(0)}get locatorMenu(){return this.locatorRoot.locator(".dropdown-menu")}get locatorMenuItems(){return this.locatorMenu.locator(".au-select-item")}locatorMenuItem(t){return this.locatorMenu.getByText(t).nth(0)}get locatorBadges(){return this.locatorRoot.locator("div.au-select-badge")}locatorBadgeItem(t){return this.locatorBadges.filter({hasText:t}).nth(0)}async state(){return await this.locatorRoot.evaluate(t=>{var u,p;const e=t.querySelector('div[role="combobox"]'),s=t.querySelector('input[type="text"]'),a=[];if(e){const m=e.querySelectorAll("div.au-select-badge");for(const g of m)a.push((u=g==null?void 0:g.textContent)==null?void 0:u.trim())}const r=t.querySelector("ul.dropdown-menu"),o=r!=null,c=[],n=[];if(r!=null){const m=r.querySelectorAll("li.dropdown-item");for(const g of m){const d=(p=g.textContent)==null?void 0:p.trim();c.push(d),g.classList.contains("selected")&&n.push(d)}}return{text:s.value,badges:a,isOpen:o,list:c,checked:n}})}}const f={rootComponent:".alert",body:".alert-body",closeButton:".btn-close"};class w extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(f))}getComponentSelector(){return this.selectors.rootComponent}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}async state(){return this.locatorRoot.evaluate((t,e)=>{var r,o,c;const s=(o=(r=t.querySelector(e.body))==null?void 0:r.innerText)==null?void 0:o.replace(/[^\x20-\x7E]/g,""),a=(c=t.querySelector(e.closeButton))==null?void 0:c.getAttribute("aria-label");return{rootClasses:t.className.trim().split(" ").sort(),body:s,closeButton:a}},this.selectors)}}class E extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",{item:".accordion-item",bodyContainer:".accordion-collapse",body:".accordion-body",header:".accordion-header",buttons:".accordion-button"})}getComponentSelector(){return".au-accordion"}get locatorAccordionItems(){return this.locatorRoot.locator(this.selectors.item)}locatorAccordionItem(t){return this.locatorRoot.locator(this.selectors.item).nth(t)}get locatorAccordionCBodyContainers(){return this.locatorAccordionItems.locator(this.selectors.bodyContainer)}locatorAccordionBodyContainer(t){return this.locatorAccordionItem(t).locator(this.selectors.bodyContainer)}get locatorAccordionBodies(){return this.locatorAccordionCBodyContainers.locator(this.selectors.body)}locatorAccordionBody(t){return this.locatorAccordionBodyContainer(t).locator(this.selectors.body)}get locatorAccordionHeaders(){return this.locatorAccordionItems.locator(this.selectors.header)}locatorAccordionHeader(t){return this.locatorAccordionItem(t).locator(this.selectors.header)}get locatorAccordionButtons(){return this.locatorAccordionHeaders.locator(this.selectors.buttons)}locatorAccordionButton(t){return this.locatorAccordionHeader(t).locator(this.selectors.buttons)}async state(){return await this.locatorRoot.evaluate(t=>{const e=[...t.querySelectorAll(".accordion-item")],s=[];for(const a of e){const r=a.querySelector(".accordion-collapse"),o=a.querySelector(".accordion-button");s.push({classes:a.className.trim().split(" "),id:a.id,isInDOM:r!==null,bodyContainerId:r==null?void 0:r.id,buttonId:o==null?void 0:o.id,expanded:o==null?void 0:o.getAttribute("aria-expanded"),disabled:o==null?void 0:o.getAttribute("aria-disabled"),labeledBy:r==null?void 0:r.getAttribute("aria-labelledby"),buttonControls:o==null?void 0:o.getAttribute("aria-controls")})}return{rootClasses:t.className.trim().split(" "),items:s}})}}const R={rootComponent:'[role="progressbar"]',outerBar:".progress",innerBar:".progress-bar"};class D extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(R))}getComponentSelector(){return this.selectors.rootComponent}get locatorOuterBar(){return this.locatorRoot.locator(this.selectors.outerBar)}get locatorInnerBar(){return this.locatorRoot.locator(this.selectors.innerBar)}async state(){return this.locatorRoot.evaluate(t=>{var a,r,o,c,n,u;const e=t.querySelector(".progress-bar"),s=t.querySelector(".progress");return{ariaLabel:t.getAttribute("aria-label"),ariaValueNow:t.getAttribute("aria-valuenow"),ariaValueMin:t.getAttribute("aria-valuemin"),ariaValueMax:t.getAttribute("aria-valuemax"),ariaValueText:t.getAttribute("aria-valuetext"),label:(a=e==null?void 0:e.textContent)==null?void 0:a.trim(),innerClasses:((c=(o=(r=e==null?void 0:e.className)==null?void 0:r.trim())==null?void 0:o.split(" "))==null?void 0:c.sort())??[],outerHeight:(n=s==null?void 0:s.style)==null?void 0:n.height,innerWidth:(u=e==null?void 0:e.style)==null?void 0:u.width}})}}const B={rootComponent:".au-slider",clickableArea:".au-slider-clickable-area",handle:".au-slider-handle",tick:".au-slider-tick",tickLabel:".au-slider-tick-label",tickLabelVertical:".au-slider-tick-label-vertical",minLabelHorizontal:".au-slider-label-min",maxLabelHorizontal:".au-slider-label-max",minLabelVertical:".au-slider-label-vertical-min",maxLabelVertical:".au-slider-label-vertical-max",valueLabel:".au-slider-label-now",progress:".au-slider-progress"};class z extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(B))}getComponentSelector(){return this.selectors.rootComponent}get locatorHandle(){return this.locatorRoot.locator(this.selectors.handle)}get locatorTick(){return this.locatorRoot.locator(this.selectors.tick)}get locatorTickLabel(){return this.locatorRoot.locator(this.selectors.tickLabel)}get locatorTickLabelVertical(){return this.locatorRoot.locator(this.selectors.tickLabelVertical)}get locatorMinLabelHorizontal(){return this.locatorRoot.locator(this.selectors.minLabelHorizontal)}get locatorMaxLabelHorizontal(){return this.locatorRoot.locator(this.selectors.maxLabelHorizontal)}get locatorMinLabelVertical(){return this.locatorRoot.locator(this.selectors.minLabelVertical)}get locatorMaxLabelVertical(){return this.locatorRoot.locator(this.selectors.maxLabelVertical)}get locatorProgress(){return this.locatorRoot.locator(this.selectors.progress)}get locatorValueLabel(){return this.locatorRoot.locator(this.selectors.valueLabel)}async sliderHandleState(){return this.locatorRoot.locator(this.selectors.handle).evaluateAll(t=>t.map(e=>({style:e.getAttribute("style"),value:e.getAttribute("aria-valuenow"),min:e.getAttribute("aria-valuemin"),max:e.getAttribute("aria-valuemax"),disabled:e.getAttribute("aria-disabled"),readonly:e.getAttribute("aria-readonly"),ariaLabel:e.getAttribute("aria-label"),ariaValueText:e.getAttribute("aria-valuetext")})))}async sliderProgressState(){return this.locatorRoot.locator(this.selectors.progress).evaluateAll(t=>t.map(e=>e.getAttribute("style")))}async sliderTickLabelState(t){return t.evaluateAll(e=>e.map(s=>({style:s.getAttribute("style"),innerText:s.innerText})))}}const O={rootComponent:".toast",closeButton:".btn-close",header:".toast-header",body:".toast-body"};class F extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(O))}getComponentSelector(){return this.selectors.rootComponent}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}async state(){return await this.locatorRoot.evaluate((t,e)=>{var o,c,n;const s=(o=t.querySelector(e.body))==null?void 0:o.innerText,a=(c=t.querySelector(e.header))==null?void 0:c.innerText,r=(n=t.querySelector(e.closeButton))==null?void 0:n.getAttribute("aria-label");return{rootClasses:t.className.trim().split(" ").sort(),body:s,header:a,closeButton:r}},this.selectors)}}const q={rootComponent:'[role="tree"]',itemContainer:'[role="treeitem"]',itemToggle:".au-tree-expand-icon",itemContents:".au-tree-item"};class j extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(q))}getComponentSelector(){return this.selectors.rootComponent}get locatorItemToggle(){return this.locatorRoot.locator(this.selectors.itemToggle)}get locatorItemContainer(){return this.locatorRoot.locator(this.selectors.itemContents)}async itemContainerState(){return this.locatorRoot.locator(this.selectors.itemContainer).evaluateAll(t=>t.map(e=>({ariaSelected:e.getAttribute("aria-selected"),ariaExpanded:e.getAttribute("aria-expanded")})))}async itemToggleState(){return this.locatorRoot.locator(this.selectors.itemToggle).evaluateAll(t=>t.map(e=>({ariaLabel:e.getAttribute("aria-label")})))}}const L={rootComponent:".au-collapse"};class W extends b.BasePO{constructor(){super(...arguments);h(this,"selectors",structuredClone(L))}getComponentSelector(){return this.selectors.rootComponent}async state(){return this.locatorRoot.evaluate((t,e)=>({rootClasses:t.className.trim().split(" ").sort()}),this.selectors)}}exports.AccordionPO=E;exports.AlertPO=w;exports.CollapsePO=W;exports.ModalPO=H;exports.PaginationPO=I;exports.ProgressbarPO=D;exports.RatingPO=M;exports.SelectPO=V;exports.SliderPO=z;exports.ToastPO=F;exports.TreePO=j;exports.alertSelectors=f;exports.collapseSelectors=L;exports.modalSelectors=x;exports.paginationSelectors=A;exports.progressbarSelectors=R;exports.ratingSelectors=P;exports.selectSelectors=v;exports.sliderSelectors=B;exports.toastSelectors=O;exports.treeSelectors=q;
|
|
1
|
+
"use strict";var w=Object.defineProperty;var H=(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)=>H(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 M 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,b,m,g,C,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=(m=(b=t.querySelector(e.title))==null?void 0:b.innerText)==null?void 0:m.trim(),o=(C=(g=t.querySelector(e.body))==null?void 0:g.innerText)==null?void 0:C.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 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 V extends d.BasePO{constructor(){super(...arguments);u(this,"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:[]},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"),b=t.querySelector("a.au-last");n&&(o.first=i(n)),h&&(o.previous=i(h)),p&&(o.next=i(p)),b&&(o.last=i(b));for(const g of s)r.push(g.getAttribute("href")||""),a.push((g.textContent||"").trim());const m=[...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=m.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:b&&(e.isLastDisabled=!1),e})}}const B={rootComponent:".au-rating",star:".au-rating-star"};class E extends d.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(B))}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 R={rootComponent:".au-select"};class D extends d.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(R))}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 b=e.querySelectorAll("div.au-select-badge");for(const m of b)a.push((h=m==null?void 0:m.textContent)==null?void 0:h.trim())}const r=t.querySelector("ul.dropdown-menu"),o=r!=null,i=[],n=[];if(r!=null){const b=r.querySelectorAll("li.dropdown-item");for(const m of b){const g=(p=m.textContent)==null?void 0:p.trim();i.push(g),m.classList.contains("selected")&&n.push(g)}}return{text:s.value,badges:a,isOpen:o,list:i,checked:n}})}}const v={rootComponent:".alert",body:".alert-body",closeButton:".btn-close"};class z extends d.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(v))}getComponentSelector(){return this.selectors.rootComponent}get locatorCloseButton(){return this.locatorRoot.locator(this.selectors.closeButton)}async state(){return this.locatorRoot.evaluate((t,e)=>{var r,o,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",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"};class j extends d.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(O))}getComponentSelector(){return this.selectors.rootComponent}get locatorHandle(){return this.locatorRoot.locator(this.selectors.handle)}get locatorTick(){return this.locatorRoot.locator(this.selectors.tick)}get locatorTickLabel(){return this.locatorRoot.locator(this.selectors.tickLabel)}get 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)}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 y={rootComponent:".toast",closeButton:".btn-close",header:".toast-header",body:".toast-body"};class q extends d.BasePO{constructor(){super(...arguments);u(this,"selectors",structuredClone(y))}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(y.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=M;exports.PaginationPO=V;exports.ProgressbarPO=_;exports.RatingPO=E;exports.SelectPO=D;exports.SliderPO=j;exports.ToastPO=q;exports.ToasterPO=W;exports.TreePO=G;exports.alertSelectors=v;exports.carouselSelectors=I;exports.collapseSelectors=k;exports.modalSelectors=A;exports.paginationSelectors=P;exports.progressbarSelectors=f;exports.ratingSelectors=B;exports.selectSelectors=R;exports.sliderSelectors=O;exports.toastSelectors=y;exports.toasterSelectors=L;exports.treeSelectors=T;
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var A = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { BasePO as
|
|
2
|
+
var R = (c, l, t) => l in c ? A(c, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[l] = t;
|
|
3
|
+
var u = (c, l, t) => R(c, typeof l != "symbol" ? l + "" : l, t);
|
|
4
|
+
import { BasePO as d } from "@agnos-ui/base-po";
|
|
5
5
|
const v = {
|
|
6
6
|
// TODO: should we use bootstrap-independent classes starting with au- ?
|
|
7
7
|
rootComponent: ".modal",
|
|
@@ -12,10 +12,10 @@ const v = {
|
|
|
12
12
|
body: ".modal-body",
|
|
13
13
|
footer: ".modal-footer"
|
|
14
14
|
};
|
|
15
|
-
class
|
|
15
|
+
class E extends d {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments);
|
|
18
|
-
|
|
18
|
+
u(this, "selectors", structuredClone(v));
|
|
19
19
|
}
|
|
20
20
|
getComponentSelector() {
|
|
21
21
|
return this.selectors.rootComponent;
|
|
@@ -40,15 +40,15 @@ class V extends m {
|
|
|
40
40
|
}
|
|
41
41
|
async state() {
|
|
42
42
|
return this.locatorRoot.evaluate((t, e) => {
|
|
43
|
-
var n,
|
|
44
|
-
const
|
|
43
|
+
var n, h, p, b, m, g, y, C, x;
|
|
44
|
+
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 = (m = (b = t.querySelector(e.title)) == null ? void 0 : b.innerText) == null ? void 0 : m.trim(), o = (y = (g = t.querySelector(e.body)) == null ? void 0 : g.innerText) == null ? void 0 : y.trim(), i = (x = (C = t.querySelector(e.footer)) == null ? void 0 : C.innerText) == null ? void 0 : x.trim();
|
|
45
45
|
return {
|
|
46
46
|
rootClasses: t.className.trim().split(" ").sort(),
|
|
47
|
-
header:
|
|
47
|
+
header: a,
|
|
48
48
|
title: r,
|
|
49
49
|
body: o,
|
|
50
|
-
footer:
|
|
51
|
-
closeButton:
|
|
50
|
+
footer: i,
|
|
51
|
+
closeButton: s
|
|
52
52
|
};
|
|
53
53
|
}, this.selectors);
|
|
54
54
|
}
|
|
@@ -63,10 +63,10 @@ const f = {
|
|
|
63
63
|
pages: ".au-page",
|
|
64
64
|
ellipses: ".au-ellipsis"
|
|
65
65
|
};
|
|
66
|
-
class
|
|
66
|
+
class D extends d {
|
|
67
67
|
constructor() {
|
|
68
68
|
super(...arguments);
|
|
69
|
-
|
|
69
|
+
u(this, "selectors", structuredClone(f));
|
|
70
70
|
}
|
|
71
71
|
// TODO should we add this in the list of selector ?
|
|
72
72
|
// Depend on the setSelectors usage...
|
|
@@ -128,23 +128,23 @@ class w extends m {
|
|
|
128
128
|
}
|
|
129
129
|
async state() {
|
|
130
130
|
return this.locatorRoot.evaluate((t) => {
|
|
131
|
-
const e = { rootClasses: [], disabled: null, pages: [], hrefs: [] },
|
|
132
|
-
n && (o.first =
|
|
133
|
-
for (const
|
|
134
|
-
r.push(
|
|
135
|
-
const
|
|
136
|
-
return e.pages =
|
|
131
|
+
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"), b = t.querySelector("a.au-last");
|
|
132
|
+
n && (o.first = i(n)), h && (o.previous = i(h)), p && (o.next = i(p)), b && (o.last = i(b));
|
|
133
|
+
for (const g of s)
|
|
134
|
+
r.push(g.getAttribute("href") || ""), a.push((g.textContent || "").trim());
|
|
135
|
+
const m = [...t.querySelectorAll("a.au-page[aria-disabled]")];
|
|
136
|
+
return e.pages = a, e.hrefs = r, e.hrefsNavigation = o, e.rootClasses = t.className.trim().split(" "), e.disabled = m.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 : b && (e.isLastDisabled = !1), e;
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
const
|
|
140
|
+
const B = {
|
|
141
141
|
rootComponent: ".au-rating",
|
|
142
142
|
star: ".au-rating-star"
|
|
143
143
|
};
|
|
144
|
-
class
|
|
144
|
+
class z extends d {
|
|
145
145
|
constructor() {
|
|
146
146
|
super(...arguments);
|
|
147
|
-
|
|
147
|
+
u(this, "selectors", structuredClone(B));
|
|
148
148
|
}
|
|
149
149
|
getComponentSelector() {
|
|
150
150
|
return this.selectors.rootComponent;
|
|
@@ -157,9 +157,9 @@ class M extends m {
|
|
|
157
157
|
}
|
|
158
158
|
async state() {
|
|
159
159
|
return await this.locatorRoot.evaluate((t, e) => {
|
|
160
|
-
const
|
|
161
|
-
for (const o of
|
|
162
|
-
|
|
160
|
+
const s = [...t.querySelectorAll(e.star)], a = [], r = [];
|
|
161
|
+
for (const o of s)
|
|
162
|
+
a.push((o.textContent || "").trim()), r.push(o.className.split(" "));
|
|
163
163
|
return {
|
|
164
164
|
rootClasses: t.className.trim().split(" ").sort(),
|
|
165
165
|
value: t.getAttribute("aria-valuenow"),
|
|
@@ -168,20 +168,20 @@ class M extends m {
|
|
|
168
168
|
text: t.getAttribute("aria-valuetext"),
|
|
169
169
|
disabled: t.getAttribute("aria-disabled"),
|
|
170
170
|
readonly: t.getAttribute("aria-readonly"),
|
|
171
|
-
stars:
|
|
171
|
+
stars: a,
|
|
172
172
|
classes: r
|
|
173
173
|
};
|
|
174
174
|
}, this.selectors);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
const
|
|
177
|
+
const P = {
|
|
178
178
|
rootComponent: ".au-select"
|
|
179
179
|
// TODO add selector list
|
|
180
180
|
};
|
|
181
|
-
class
|
|
181
|
+
class F extends d {
|
|
182
182
|
constructor() {
|
|
183
183
|
super(...arguments);
|
|
184
|
-
|
|
184
|
+
u(this, "selectors", structuredClone(P));
|
|
185
185
|
}
|
|
186
186
|
getComponentSelector() {
|
|
187
187
|
return this.selectors.rootComponent;
|
|
@@ -224,40 +224,40 @@ class E extends m {
|
|
|
224
224
|
}
|
|
225
225
|
async state() {
|
|
226
226
|
return await this.locatorRoot.evaluate((t) => {
|
|
227
|
-
var
|
|
228
|
-
const e = t.querySelector('div[role="combobox"]'),
|
|
227
|
+
var h, p;
|
|
228
|
+
const e = t.querySelector('div[role="combobox"]'), s = t.querySelector('input[type="text"]'), a = [];
|
|
229
229
|
if (e) {
|
|
230
230
|
const b = e.querySelectorAll("div.au-select-badge");
|
|
231
|
-
for (const
|
|
232
|
-
|
|
231
|
+
for (const m of b)
|
|
232
|
+
a.push((h = m == null ? void 0 : m.textContent) == null ? void 0 : h.trim());
|
|
233
233
|
}
|
|
234
|
-
const r = t.querySelector("ul.dropdown-menu"), o = r != null,
|
|
234
|
+
const r = t.querySelector("ul.dropdown-menu"), o = r != null, i = [], n = [];
|
|
235
235
|
if (r != null) {
|
|
236
236
|
const b = r.querySelectorAll("li.dropdown-item");
|
|
237
|
-
for (const
|
|
238
|
-
const
|
|
239
|
-
|
|
237
|
+
for (const m of b) {
|
|
238
|
+
const g = (p = m.textContent) == null ? void 0 : p.trim();
|
|
239
|
+
i.push(g), m.classList.contains("selected") && n.push(g);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
return {
|
|
243
|
-
text:
|
|
244
|
-
badges:
|
|
243
|
+
text: s.value,
|
|
244
|
+
badges: a,
|
|
245
245
|
isOpen: o,
|
|
246
|
-
list:
|
|
246
|
+
list: i,
|
|
247
247
|
checked: n
|
|
248
248
|
};
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
const
|
|
252
|
+
const q = {
|
|
253
253
|
rootComponent: ".alert",
|
|
254
254
|
body: ".alert-body",
|
|
255
255
|
closeButton: ".btn-close"
|
|
256
256
|
};
|
|
257
|
-
class
|
|
257
|
+
class _ extends d {
|
|
258
258
|
constructor() {
|
|
259
259
|
super(...arguments);
|
|
260
|
-
|
|
260
|
+
u(this, "selectors", structuredClone(q));
|
|
261
261
|
}
|
|
262
262
|
getComponentSelector() {
|
|
263
263
|
return this.selectors.rootComponent;
|
|
@@ -267,20 +267,20 @@ class D extends m {
|
|
|
267
267
|
}
|
|
268
268
|
async state() {
|
|
269
269
|
return this.locatorRoot.evaluate((t, e) => {
|
|
270
|
-
var r, o,
|
|
271
|
-
const
|
|
270
|
+
var r, o, i;
|
|
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");
|
|
272
272
|
return {
|
|
273
273
|
rootClasses: t.className.trim().split(" ").sort(),
|
|
274
|
-
body:
|
|
275
|
-
closeButton:
|
|
274
|
+
body: s,
|
|
275
|
+
closeButton: a
|
|
276
276
|
};
|
|
277
277
|
}, this.selectors);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
class
|
|
280
|
+
class W extends d {
|
|
281
281
|
constructor() {
|
|
282
282
|
super(...arguments);
|
|
283
|
-
|
|
283
|
+
u(this, "selectors", {
|
|
284
284
|
item: ".accordion-item",
|
|
285
285
|
bodyContainer: ".accordion-collapse",
|
|
286
286
|
body: ".accordion-body",
|
|
@@ -338,12 +338,12 @@ class z extends m {
|
|
|
338
338
|
}
|
|
339
339
|
async state() {
|
|
340
340
|
return await this.locatorRoot.evaluate((t) => {
|
|
341
|
-
const e = [...t.querySelectorAll(".accordion-item")],
|
|
342
|
-
for (const
|
|
343
|
-
const r =
|
|
344
|
-
|
|
345
|
-
classes:
|
|
346
|
-
id:
|
|
341
|
+
const e = [...t.querySelectorAll(".accordion-item")], s = [];
|
|
342
|
+
for (const a of e) {
|
|
343
|
+
const r = a.querySelector(".accordion-collapse"), o = a.querySelector(".accordion-button");
|
|
344
|
+
s.push({
|
|
345
|
+
classes: a.className.trim().split(" "),
|
|
346
|
+
id: a.id,
|
|
347
347
|
isInDOM: r !== null,
|
|
348
348
|
bodyContainerId: r == null ? void 0 : r.id,
|
|
349
349
|
buttonId: o == null ? void 0 : o.id,
|
|
@@ -353,19 +353,19 @@ class z extends m {
|
|
|
353
353
|
buttonControls: o == null ? void 0 : o.getAttribute("aria-controls")
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
|
-
return { rootClasses: t.className.trim().split(" "), items:
|
|
356
|
+
return { rootClasses: t.className.trim().split(" "), items: s };
|
|
357
357
|
});
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
const
|
|
360
|
+
const L = {
|
|
361
361
|
rootComponent: '[role="progressbar"]',
|
|
362
362
|
outerBar: ".progress",
|
|
363
363
|
innerBar: ".progress-bar"
|
|
364
364
|
};
|
|
365
|
-
class
|
|
365
|
+
class j extends d {
|
|
366
366
|
constructor() {
|
|
367
367
|
super(...arguments);
|
|
368
|
-
|
|
368
|
+
u(this, "selectors", structuredClone(L));
|
|
369
369
|
}
|
|
370
370
|
getComponentSelector() {
|
|
371
371
|
return this.selectors.rootComponent;
|
|
@@ -378,29 +378,30 @@ class F extends m {
|
|
|
378
378
|
}
|
|
379
379
|
async state() {
|
|
380
380
|
return this.locatorRoot.evaluate((t) => {
|
|
381
|
-
var
|
|
382
|
-
const e = t.querySelector(".progress-bar"),
|
|
381
|
+
var a, r, o, i, n, h;
|
|
382
|
+
const e = t.querySelector(".progress-bar"), s = t.querySelector(".progress");
|
|
383
383
|
return {
|
|
384
384
|
ariaLabel: t.getAttribute("aria-label"),
|
|
385
385
|
ariaValueNow: t.getAttribute("aria-valuenow"),
|
|
386
386
|
ariaValueMin: t.getAttribute("aria-valuemin"),
|
|
387
387
|
ariaValueMax: t.getAttribute("aria-valuemax"),
|
|
388
388
|
ariaValueText: t.getAttribute("aria-valuetext"),
|
|
389
|
-
label: (
|
|
390
|
-
innerClasses: ((
|
|
391
|
-
outerHeight: (n =
|
|
392
|
-
innerWidth: (
|
|
389
|
+
label: (a = e == null ? void 0 : e.textContent) == null ? void 0 : a.trim(),
|
|
390
|
+
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()) ?? [],
|
|
391
|
+
outerHeight: (n = s == null ? void 0 : s.style) == null ? void 0 : n.height,
|
|
392
|
+
innerWidth: (h = e == null ? void 0 : e.style) == null ? void 0 : h.width
|
|
393
393
|
};
|
|
394
394
|
});
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
const
|
|
397
|
+
const T = {
|
|
398
398
|
rootComponent: ".au-slider",
|
|
399
399
|
clickableArea: ".au-slider-clickable-area",
|
|
400
400
|
handle: ".au-slider-handle",
|
|
401
401
|
tick: ".au-slider-tick",
|
|
402
402
|
tickLabel: ".au-slider-tick-label",
|
|
403
403
|
tickLabelVertical: ".au-slider-tick-label-vertical",
|
|
404
|
+
tickLabelNow: ".au-slider-tick-label-now",
|
|
404
405
|
minLabelHorizontal: ".au-slider-label-min",
|
|
405
406
|
maxLabelHorizontal: ".au-slider-label-max",
|
|
406
407
|
minLabelVertical: ".au-slider-label-vertical-min",
|
|
@@ -408,10 +409,10 @@ const L = {
|
|
|
408
409
|
valueLabel: ".au-slider-label-now",
|
|
409
410
|
progress: ".au-slider-progress"
|
|
410
411
|
};
|
|
411
|
-
class
|
|
412
|
+
class G extends d {
|
|
412
413
|
constructor() {
|
|
413
414
|
super(...arguments);
|
|
414
|
-
|
|
415
|
+
u(this, "selectors", structuredClone(T));
|
|
415
416
|
}
|
|
416
417
|
getComponentSelector() {
|
|
417
418
|
return this.selectors.rootComponent;
|
|
@@ -425,6 +426,9 @@ class W extends m {
|
|
|
425
426
|
get locatorTickLabel() {
|
|
426
427
|
return this.locatorRoot.locator(this.selectors.tickLabel);
|
|
427
428
|
}
|
|
429
|
+
get locatorTickLabelNow() {
|
|
430
|
+
return this.locatorRoot.locator(this.selectors.tickLabelNow);
|
|
431
|
+
}
|
|
428
432
|
get locatorTickLabelVertical() {
|
|
429
433
|
return this.locatorRoot.locator(this.selectors.tickLabelVertical);
|
|
430
434
|
}
|
|
@@ -467,22 +471,22 @@ class W extends m {
|
|
|
467
471
|
* @returns state of all the ticks
|
|
468
472
|
*/
|
|
469
473
|
async sliderTickLabelState(t) {
|
|
470
|
-
return t.evaluateAll((e) => e.map((
|
|
471
|
-
style:
|
|
472
|
-
innerText:
|
|
474
|
+
return t.evaluateAll((e) => e.map((s) => ({
|
|
475
|
+
style: s.getAttribute("style"),
|
|
476
|
+
innerText: s.innerText
|
|
473
477
|
})));
|
|
474
478
|
}
|
|
475
479
|
}
|
|
476
|
-
const
|
|
480
|
+
const S = {
|
|
477
481
|
rootComponent: ".toast",
|
|
478
482
|
closeButton: ".btn-close",
|
|
479
483
|
header: ".toast-header",
|
|
480
484
|
body: ".toast-body"
|
|
481
485
|
};
|
|
482
|
-
class
|
|
486
|
+
class k extends d {
|
|
483
487
|
constructor() {
|
|
484
488
|
super(...arguments);
|
|
485
|
-
|
|
489
|
+
u(this, "selectors", structuredClone(S));
|
|
486
490
|
}
|
|
487
491
|
getComponentSelector() {
|
|
488
492
|
return this.selectors.rootComponent;
|
|
@@ -492,27 +496,53 @@ class _ extends m {
|
|
|
492
496
|
}
|
|
493
497
|
async state() {
|
|
494
498
|
return await this.locatorRoot.evaluate((t, e) => {
|
|
495
|
-
var o,
|
|
496
|
-
const
|
|
499
|
+
var o, i, n;
|
|
500
|
+
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");
|
|
497
501
|
return {
|
|
498
502
|
rootClasses: t.className.trim().split(" ").sort(),
|
|
499
|
-
body:
|
|
500
|
-
header:
|
|
503
|
+
body: s,
|
|
504
|
+
header: a,
|
|
501
505
|
closeButton: r
|
|
502
506
|
};
|
|
503
507
|
}, this.selectors);
|
|
504
508
|
}
|
|
505
509
|
}
|
|
506
|
-
const
|
|
510
|
+
const I = {
|
|
511
|
+
rootComponent: ".au-toaster",
|
|
512
|
+
container: ".au-toaster-container",
|
|
513
|
+
closeButton: ".au-toaster-closeAll"
|
|
514
|
+
};
|
|
515
|
+
class J extends d {
|
|
516
|
+
constructor() {
|
|
517
|
+
super(...arguments);
|
|
518
|
+
u(this, "selectors", structuredClone(I));
|
|
519
|
+
}
|
|
520
|
+
getComponentSelector() {
|
|
521
|
+
return this.selectors.rootComponent;
|
|
522
|
+
}
|
|
523
|
+
get locatorContainer() {
|
|
524
|
+
return this.locatorRoot.locator(this.selectors.container);
|
|
525
|
+
}
|
|
526
|
+
async toastPOs() {
|
|
527
|
+
return Array.from(
|
|
528
|
+
{ length: await this.locatorContainer.locator(S.rootComponent).count() },
|
|
529
|
+
(t, e) => new k(this.locatorContainer, e)
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
get locatorCloseButton() {
|
|
533
|
+
return this.locatorRoot.locator(this.selectors.closeButton);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
const w = {
|
|
507
537
|
rootComponent: '[role="tree"]',
|
|
508
538
|
itemContainer: '[role="treeitem"]',
|
|
509
539
|
itemToggle: ".au-tree-expand-icon",
|
|
510
540
|
itemContents: ".au-tree-item"
|
|
511
541
|
};
|
|
512
|
-
class
|
|
542
|
+
class K extends d {
|
|
513
543
|
constructor() {
|
|
514
544
|
super(...arguments);
|
|
515
|
-
|
|
545
|
+
u(this, "selectors", structuredClone(w));
|
|
516
546
|
}
|
|
517
547
|
getComponentSelector() {
|
|
518
548
|
return this.selectors.rootComponent;
|
|
@@ -535,13 +565,13 @@ class j extends m {
|
|
|
535
565
|
})));
|
|
536
566
|
}
|
|
537
567
|
}
|
|
538
|
-
const
|
|
568
|
+
const O = {
|
|
539
569
|
rootComponent: ".au-collapse"
|
|
540
570
|
};
|
|
541
|
-
class
|
|
571
|
+
class Q extends d {
|
|
542
572
|
constructor() {
|
|
543
573
|
super(...arguments);
|
|
544
|
-
|
|
574
|
+
u(this, "selectors", structuredClone(O));
|
|
545
575
|
}
|
|
546
576
|
getComponentSelector() {
|
|
547
577
|
return this.selectors.rootComponent;
|
|
@@ -552,26 +582,86 @@ class G extends m {
|
|
|
552
582
|
}), this.selectors);
|
|
553
583
|
}
|
|
554
584
|
}
|
|
585
|
+
const H = {
|
|
586
|
+
rootComponent: ".au-carousel",
|
|
587
|
+
container: ".au-carousel-container",
|
|
588
|
+
slide: ".au-carousel-slide",
|
|
589
|
+
nextBtn: ".carousel-control-next",
|
|
590
|
+
prevBtn: ".carousel-control-prev",
|
|
591
|
+
indicators: ".carousel-indicators",
|
|
592
|
+
indicatorBtn: ".carousel-indicators button"
|
|
593
|
+
};
|
|
594
|
+
class U extends d {
|
|
595
|
+
constructor() {
|
|
596
|
+
super(...arguments);
|
|
597
|
+
u(this, "selectors", structuredClone(H));
|
|
598
|
+
}
|
|
599
|
+
getComponentSelector() {
|
|
600
|
+
return this.selectors.rootComponent;
|
|
601
|
+
}
|
|
602
|
+
get locatorContainer() {
|
|
603
|
+
return this.locatorRoot.locator(this.selectors.container);
|
|
604
|
+
}
|
|
605
|
+
get locatorNextBtn() {
|
|
606
|
+
return this.locatorRoot.locator(this.selectors.nextBtn);
|
|
607
|
+
}
|
|
608
|
+
get locatorPrevBtn() {
|
|
609
|
+
return this.locatorRoot.locator(this.selectors.prevBtn);
|
|
610
|
+
}
|
|
611
|
+
get locatorIndicators() {
|
|
612
|
+
return this.locatorRoot.locator(this.selectors.indicators);
|
|
613
|
+
}
|
|
614
|
+
get locatorIndicatorBtn() {
|
|
615
|
+
return this.locatorRoot.locator(this.selectors.indicatorBtn);
|
|
616
|
+
}
|
|
617
|
+
get locatorSlide() {
|
|
618
|
+
return this.locatorRoot.locator(this.selectors.slide);
|
|
619
|
+
}
|
|
620
|
+
async state() {
|
|
621
|
+
return this.locatorRoot.evaluate((t) => {
|
|
622
|
+
const e = t.querySelectorAll(".carousel-indicators button");
|
|
623
|
+
return {
|
|
624
|
+
rootClasses: t.className.trim().split(" ").sort(),
|
|
625
|
+
prevBtn: t.querySelector(".carousel-control-prev") !== null,
|
|
626
|
+
nextBtn: t.querySelector(".carousel-control-next") !== null,
|
|
627
|
+
indicators: {
|
|
628
|
+
selected: [...e].findIndex((s) => s.classList.contains("active")),
|
|
629
|
+
count: e.length
|
|
630
|
+
},
|
|
631
|
+
slides: {
|
|
632
|
+
visible: [...t.querySelectorAll(".au-carousel-slide")].findIndex((s) => {
|
|
633
|
+
const a = s.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
634
|
+
return a.left >= r.left && a.right <= r.right;
|
|
635
|
+
})
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
}
|
|
555
641
|
export {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
642
|
+
W as AccordionPO,
|
|
643
|
+
_ as AlertPO,
|
|
644
|
+
U as CarouselPO,
|
|
645
|
+
Q as CollapsePO,
|
|
646
|
+
E as ModalPO,
|
|
647
|
+
D as PaginationPO,
|
|
648
|
+
j as ProgressbarPO,
|
|
649
|
+
z as RatingPO,
|
|
650
|
+
F as SelectPO,
|
|
651
|
+
G as SliderPO,
|
|
652
|
+
k as ToastPO,
|
|
653
|
+
J as ToasterPO,
|
|
654
|
+
K as TreePO,
|
|
655
|
+
q as alertSelectors,
|
|
656
|
+
H as carouselSelectors,
|
|
657
|
+
O as collapseSelectors,
|
|
569
658
|
v as modalSelectors,
|
|
570
659
|
f as paginationSelectors,
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
660
|
+
L as progressbarSelectors,
|
|
661
|
+
B as ratingSelectors,
|
|
662
|
+
P as selectSelectors,
|
|
663
|
+
T as sliderSelectors,
|
|
664
|
+
S as toastSelectors,
|
|
665
|
+
I as toasterSelectors,
|
|
666
|
+
w as treeSelectors
|
|
577
667
|
};
|
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.8.
|
|
4
|
+
"version": "0.8.1",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"e2e",
|
|
7
7
|
"page-object",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"accordion",
|
|
11
11
|
"AgnosUI",
|
|
12
12
|
"alert",
|
|
13
|
+
"carousel",
|
|
13
14
|
"collapse",
|
|
14
15
|
"components",
|
|
15
16
|
"modal",
|
|
@@ -18,6 +19,7 @@
|
|
|
18
19
|
"rating",
|
|
19
20
|
"slider",
|
|
20
21
|
"toast",
|
|
22
|
+
"tree",
|
|
21
23
|
"widgets"
|
|
22
24
|
],
|
|
23
25
|
"type": "module",
|
|
@@ -25,7 +27,7 @@
|
|
|
25
27
|
"module": "./index.js",
|
|
26
28
|
"types": "./index.d.ts",
|
|
27
29
|
"dependencies": {
|
|
28
|
-
"@agnos-ui/base-po": "0.8.
|
|
30
|
+
"@agnos-ui/base-po": "0.8.1"
|
|
29
31
|
},
|
|
30
32
|
"peerDependencies": {
|
|
31
33
|
"@playwright/test": "^1.49.0"
|
package/slider.po.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const sliderSelectors: {
|
|
|
7
7
|
tick: string;
|
|
8
8
|
tickLabel: string;
|
|
9
9
|
tickLabelVertical: string;
|
|
10
|
+
tickLabelNow: string;
|
|
10
11
|
minLabelHorizontal: string;
|
|
11
12
|
maxLabelHorizontal: string;
|
|
12
13
|
minLabelVertical: string;
|
|
@@ -22,6 +23,7 @@ export declare class SliderPO extends BasePO {
|
|
|
22
23
|
tick: string;
|
|
23
24
|
tickLabel: string;
|
|
24
25
|
tickLabelVertical: string;
|
|
26
|
+
tickLabelNow: string;
|
|
25
27
|
minLabelHorizontal: string;
|
|
26
28
|
maxLabelHorizontal: string;
|
|
27
29
|
minLabelVertical: string;
|
|
@@ -33,6 +35,7 @@ export declare class SliderPO extends BasePO {
|
|
|
33
35
|
get locatorHandle(): Locator;
|
|
34
36
|
get locatorTick(): Locator;
|
|
35
37
|
get locatorTickLabel(): Locator;
|
|
38
|
+
get locatorTickLabelNow(): Locator;
|
|
36
39
|
get locatorTickLabelVertical(): Locator;
|
|
37
40
|
get locatorMinLabelHorizontal(): Locator;
|
|
38
41
|
get locatorMaxLabelHorizontal(): Locator;
|
package/toaster.po.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Locator } from '@playwright/test';
|
|
2
|
+
import { BasePO } from '@agnos-ui/base-po';
|
|
3
|
+
import { ToastPO } from './toast.po';
|
|
4
|
+
export declare const toasterSelectors: {
|
|
5
|
+
rootComponent: string;
|
|
6
|
+
container: string;
|
|
7
|
+
closeButton: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class ToasterPO extends BasePO {
|
|
10
|
+
selectors: {
|
|
11
|
+
rootComponent: string;
|
|
12
|
+
container: string;
|
|
13
|
+
closeButton: string;
|
|
14
|
+
};
|
|
15
|
+
getComponentSelector(): string;
|
|
16
|
+
get locatorContainer(): Locator;
|
|
17
|
+
toastPOs(): Promise<ToastPO[]>;
|
|
18
|
+
get locatorCloseButton(): Locator;
|
|
19
|
+
}
|