aria-ease 7.1.0 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +2 -13
  2. package/dist/AccordionComponentStrategy-T5YODP3A.js +1 -0
  3. package/dist/ComboboxComponentStrategy-DHZS4NW6.js +5 -0
  4. package/dist/MenuComponentStrategy-L3QXLC6S.js +5 -0
  5. package/dist/buildContracts-NGEEUCN3.js +13 -0
  6. package/dist/cli.cjs +5 -5
  7. package/dist/cli.js +1 -1
  8. package/dist/{contractTestRunnerPlaywright-44QPA5JG.js → contractTestRunnerPlaywright-IFI5BPGV.js} +3 -3
  9. package/dist/{contractTestRunnerPlaywright-IUUAGMXP.js → contractTestRunnerPlaywright-SJIHHZ3Y.js} +3 -3
  10. package/dist/index.cjs +15 -15
  11. package/dist/index.d.cts +1 -3
  12. package/dist/index.d.ts +1 -3
  13. package/dist/index.js +5 -5
  14. package/dist/src/utils/test/AccordionComponentStrategy-S35ZYITU.js +1 -0
  15. package/dist/src/utils/test/ComboboxComponentStrategy-5AWO63DA.js +5 -0
  16. package/dist/src/utils/test/MenuComponentStrategy-QHVBLUBR.js +5 -0
  17. package/dist/src/utils/test/{contractTestRunnerPlaywright-VALOFEZZ.js → contractTestRunnerPlaywright-Y7N2W6AK.js} +3 -3
  18. package/dist/src/utils/test/dsl/index.cjs +1 -1
  19. package/dist/src/utils/test/dsl/index.d.cts +1 -3
  20. package/dist/src/utils/test/dsl/index.d.ts +1 -3
  21. package/dist/src/utils/test/dsl/index.js +1 -1
  22. package/dist/src/utils/test/index.cjs +5 -5
  23. package/dist/src/utils/test/index.js +1 -1
  24. package/dist/{test-MWX7KH44.js → test-2XAMHIKD.js} +1 -1
  25. package/package.json +1 -1
  26. package/dist/AccordionComponentStrategy-2SWMNUR6.js +0 -1
  27. package/dist/ComboboxComponentStrategy-YSYLR2U5.js +0 -5
  28. package/dist/MenuComponentStrategy-C22BZEBH.js +0 -5
  29. package/dist/buildContracts-T4XQZBDU.js +0 -13
  30. package/dist/src/utils/test/AccordionComponentStrategy-X2GSQ5KT.js +0 -1
  31. package/dist/src/utils/test/ComboboxComponentStrategy-SICWLI27.js +0 -5
  32. package/dist/src/utils/test/MenuComponentStrategy-R4VPAHDE.js +0 -5
@@ -1 +1 @@
1
- var T={"popup.open":{setup:[{when:["keyboard","textInput"],steps:()=>[{type:"keypress",target:"input",key:"ArrowDown"}]},{when:["pointer"],steps:()=>[{type:"click",target:"button"}]}],assertion:S},"popup.closed":{setup:[{when:["keyboard"],steps:()=>[]},{when:["pointer"],steps:()=>[]}],assertion:[...w(),...b()]},"main.focused":{setup:[{when:["keyboard"],steps:()=>[{type:"focus",target:"main"}]}],assertion:_},"main.notFocused":{setup:[{when:["keyboard"],steps:()=>[]}],assertion:D},"input.filled":{setup:[{when:["keyboard","textInput"],steps:()=>[{type:"type",target:"input",value:"test"}]}],assertion:C},"input.notFilled":{setup:[{when:["keyboard","textInput"],steps:()=>[{type:"type",target:"input",value:""}]}],assertion:V},activeOption:{requires:["popup.open"],setup:[{when:["keyboard","pointer"],steps:(e={})=>typeof e.relativeTarget=="number"?Array.from({length:e.relativeTarget},()=>({type:"keypress",target:"input",key:"ArrowDown"})):e.relativeTarget==="first"?[]:e.relativeTarget==="last"?[{type:"keypress",target:"input",key:"ArrowUp"}]:[]}],assertion:(e={})=>M(e.relativeTarget)},"activeDescendant.notEmpty":{requires:[],setup:[{when:["keyboard"],steps:()=>[]}],assertion:E},"activeDescendant.Empty":{requires:[],setup:[{when:["keyboard"],steps:()=>[]}],assertion:b},selectedOption:{requires:["popup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"keypress",target:"relative",key:"Enter",relativeTargeta:e.relativeTarget}]},{when:["pointer"],steps:(e={})=>[{type:"click",target:"relative",relativeTargeta:e.relativeTarget}]}],assertion:(e={})=>q(e.relativeTarget)}};function S(){return [{target:"popup",assertion:"toBeVisible",failureMessage:"Expected popup to be visible"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected combobox main to have aria-expanded='true'."}]}function w(){return [{target:"popup",assertion:"notToBeVisible",failureMessage:"Expected popup to be closed"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected combobox main to have aria-expanded='false'."}]}function M(e){return [{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:{ref:"relative",relativeTarget:e,property:"id"},failureMessage:"Expected aria-activedescendant on main to match the id of the first option."}]}function E(){return [{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"!empty",failureMessage:"Expected aria-activedescendant on main to not be empty."}]}function b(){return [{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"",failureMessage:"Expected aria-activedescendant on main to be empty."}]}function q(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",failureMessage:`Expected ${e} option to have aria-selected='true'.`}]}function _(){return [{target:"main",assertion:"toHaveFocus",failureMessage:"Expected main to be focused."}]}function D(){return [{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected main to not have focused."}]}function C(){return [{target:"input",assertion:"toHaveValue",expectedValue:"test",failureMessage:"Expected input to have the value 'test'."}]}function V(){return [{target:"input",assertion:"toHaveValue",expectedValue:"",failureMessage:"Expected input to have the value ''."}]}var A={"popup.open":{setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"main",key:"Enter"}]},{when:["pointer"],steps:()=>[{type:"click",target:"main"}]}],assertion:H},"popup.closed":{setup:[{when:["keyboard"],steps:()=>[]},{when:["pointer"],steps:()=>[]}],assertion:I},"main.focused":{setup:[{when:["keyboard"],steps:()=>[{type:"focus",target:"main"}]}],assertion:R},"main.notFocused":{setup:[{when:["keyboard"],steps:()=>[]}],assertion:F},activeItem:{requires:["popup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>B(e.relativeTarget)},"submenu.open":{requires:["popup.open"],setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}]},{when:["pointer"],steps:()=>[{type:"click",target:"submenuTrigger"}]}],assertion:P},"submenu.closed":{requires:["submenu.open"],setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"submenuTrigger",key:"ArrowLeft"}]},{when:["pointer"],steps:()=>[{type:"click",target:"submenuTrigger"}]}],assertion:O},"submenuTrigger.focused":{setup:[{when:["keyboard"],steps:()=>[{type:"focus",target:"submenuTrigger"}]}],assertion:z},"submenuTrigger.notFocused":{setup:[{when:["keyboard"],steps:()=>[]}],assertion:$},activeSubmenuItem:{requires:["submenu.open"],setup:[{when:["keyboard"],steps:(e={})=>{let t=[{type:"focus",target:"submenuTrigger"},{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}];return typeof e.relativeTarget=="number"&&(t=t.concat(Array.from({length:e.relativeTarget},()=>({type:"keypress",target:"submenuItems",key:"ArrowDown"})))),t}},{when:["pointer"],steps:(e={})=>[{type:"click",target:"submenuTrigger"},{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>L(e.relativeTarget)}};function H(){return [{target:"popup",assertion:"toBeVisible",failureMessage:"Expected popup to be visible"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected menu main to have aria-expanded='true'."}]}function I(){return [{target:"popup",assertion:"notToBeVisible",failureMessage:"Expected popup to be closed"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected menu main to have aria-expanded='false'."}]}function R(){return [{target:"main",assertion:"toHaveFocus",failureMessage:"Expected menu main to be focused."}]}function F(){return [{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected menu main to not have focused."}]}function B(e){return [{target:"relative",assertion:"toHaveFocus",expectedValue:e,failureMessage:`${e} menu item should have focus.`}]}function P(){return [{target:"submenu",assertion:"toBeVisible",failureMessage:"Expected submenu to be visible"},{target:"submenuTrigger",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected submenu trigger to have aria-expanded='true'."}]}function O(){return [{target:"submenu",assertion:"notToBeVisible",failureMessage:"Expected submenu to be closed"},{target:"submenuTrigger",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected submenu trigger to have aria-expanded='false'."}]}function z(){return [{target:"submenuTrigger",assertion:"toHaveFocus",failureMessage:"Expected submenu trigger to be focused."}]}function $(){return [{target:"submenuTrigger",assertion:"notToHaveFocus",failureMessage:"Expected submenu trigger to not have focused."}]}function L(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveFocus",failureMessage:`Expected submenu item ${e} to have focus.`}]}var k={activeTab:{setup:[{when:["keyboard"],steps:(e={})=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"ArrowLeft"}]},{when:["pointer"],steps:(e={})=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>K(e.relativeTarget)},focusedTab:{setup:[{when:["keyboard"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]},{when:["pointer"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>j(e.relativeTarget)}};function j(e){return [{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:"Expected first tab to have focus."}]}function J(e){return [{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${e} tab to have tabindex='0'.`}]}function K(e){return [{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${e} tab to have aria-selected='true'.`},{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${e} tab to be visible.`},J(e)]}function N(e,t){return t.some(c=>e.capabilities.includes(c))}function y(e,t){Array.isArray(e)&&e.length&&!e[0].when&&(e=[{when:["keyboard"],steps:()=>e}]);for(let c of e)if(N(t,c.when))return c.steps(t);throw new Error(`No setup strategy matches capabilities: ${t.capabilities.join(", ")}`)}var U={combobox:T,menu:A,tabs:k},m=class{constructor(t){this.jsonContract=t;}toJSON(){return this.jsonContract}},f=class{constructor(t){this.componentName=t;this.statePack=U[t]||{};}metaValue={};selectorsValue={};relationshipInvariants=[];staticAssertions=[];dynamicTests=[];statePack;meta(t){return this.metaValue=t,this}selectors(t){return this.selectorsValue=t,this}relationships(t){let c=this.statePack,p={capabilities:["keyboard"]},g=(o,i=new Set)=>{if(i.has(o))return [];i.add(o);let a=c[o];if(!a)return [];let r=[];if(Array.isArray(a.requires))for(let s of a.requires)r=r.concat(g(s,i));return a.setup&&(r=r.concat(y(a.setup,p))),r};return t({ariaReference:(o,i,a)=>({requires:r=>{let s=g(r,new Set);return {required:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:a,level:"required",setup:s}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:a,level:"optional",setup:s}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:a,level:"recommended",setup:s})}},required:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:a,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:a,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:a,level:"recommended"})}),contains:(o,i)=>({requires:a=>{let r=g(a,new Set);return {required:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"required",setup:r}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"optional",setup:r}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"recommended",setup:r})}},required:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"recommended"})})}),this}static(t){return t({target:p=>{let g=i=>{let a=this.statePack,r={capabilities:["keyboard"]},s=(n,u=new Set)=>{if(u.has(n))return [];u.add(n);let d=a[n];if(!d)return [];let v=[];if(Array.isArray(d.requires))for(let x of d.requires)v=v.concat(s(x,u));return d.setup&&(v=v.concat(y(d.setup,r))),v};return s(i,new Set)},l=i=>i==="role"?"toHaveRole":"toHaveAttribute",o=(i,a,r)=>{let s=l(i);return {required:()=>this.staticAssertions.push({target:p,assertion:s,attribute:i,expectedValue:a,failureMessage:"",level:"required",setup:r}),optional:()=>this.staticAssertions.push({target:p,assertion:s,attribute:i,expectedValue:a,failureMessage:"",level:"optional",setup:r}),recommended:()=>this.staticAssertions.push({target:p,assertion:s,attribute:i,expectedValue:a,failureMessage:"",level:"recommended",setup:r})}};return {has:(i,a)=>({...o(i,a),requires:s=>{let n=g(s);return o(i,a,n)}})}}}),this}when(t){return new h(this,this.statePack,t)}addDynamicTest(t){this.dynamicTests.push(t);}build(){return {meta:this.metaValue,selectors:this.selectorsValue,relationships:this.relationshipInvariants.length?this.relationshipInvariants:void 0,static:this.staticAssertions.length?[{assertions:this.staticAssertions}]:[],dynamic:this.dynamicTests}}},h=class{constructor(t,c,p){this.parent=t;this.statePack=c;this.event=p;}_as;_onTarget;_onRelativeTarget;_given=[];_then=[];_desc="";_level="required";_orientation;as(t){return this._as=t,this}on(t,c){return this._onTarget=t,this._onRelativeTarget=c,this}given(t){return this._given=this._normalizeStates(t),this}then(t){return this._then=this._normalizeStates(t),this}orientation(t){return this._orientation=t,this}_normalizeStates(t){return (Array.isArray(t)?t:[t]).flatMap(p=>typeof p=="string"?[p]:typeof p=="object"&&p!==null&&"type"in p&&"ref"in p?this._findStateKeyByTypeAndRef(p.type)?[{type:p.type,ref:p.ref}]:[]:[p])}_findStateKeyByTypeAndRef(t){if(Object.keys(this.statePack).includes(t))return t}describe(t){return this._desc=t,this}required(){return this._level="required",this._finalize(),this.parent}optional(){return this._level="optional",this._finalize(),this.parent}recommended(){return this._level="recommended",this._finalize(),this.parent}_finalize(){let p={capabilities:[{keypress:"keyboard",click:"pointer",type:"textInput",focus:"keyboard",hover:"pointer"}[this._as||"keyboard"]||this._as||"keyboard"]},g=(r,s=new Set)=>{if(s.has(r))return [];s.add(r);let n=this.statePack[r];if(!n)return [];let u=[];if(Array.isArray(n.requires))for(let d of n.requires)u=u.concat(g(d,s));return n.setup&&(u=u.concat(y(n.setup,p))),u},l=[];for(let r of this._given)if(typeof r=="string")l.push(...g(r));else if(typeof r=="object"&&r!==null&&"type"in r&&"ref"in r){let s=this._findStateKeyByTypeAndRef(r.type);if(s){let n=this.statePack[s];if(n&&n.setup)for(let u of n.setup)typeof u.steps=="function"?l.push(...u.steps({relativeTarget:r.ref})):Array.isArray(u.steps)&&l.push(...u.steps);}}let o=new Set;l=l.filter(r=>{let s=JSON.stringify(r);return o.has(s)?false:(o.add(s),true)});let i=[];for(let r of this._then)if(typeof r=="string"){let s=this.statePack[r];if(s&&s.assertion!==void 0){let n=s.assertion;if(typeof n=="function")try{n=n();}catch(u){throw new Error(`Error calling assertion function for state '${r}': ${u.message}`)}Array.isArray(n)?i.push(...n):i.push(n);}}else if(typeof r=="object"&&r!==null&&"type"in r&&"ref"in r){let s=this._findStateKeyByTypeAndRef(r.type);if(s){let n=this.statePack[s];if(n&&n.assertion!==void 0){let u=n.assertion;if(typeof u=="function")try{u=u({relativeTarget:r.ref});}catch(d){throw new Error(`Error calling assertion function for state '${s}': ${d.message}`)}Array.isArray(u)?i.push(...u):i.push(u);}}}let a=[{type:this._as,target:this._onTarget,key:this._as==="keypress"?this.event:void 0,relativeTarget:this._onRelativeTarget}];this.parent.addDynamicTest({description:this._desc||"",level:this._level,orientation:this._orientation||"horizontal",action:a,assertions:i,...l.length?{setup:l}:{}});}};function ie(e,t){let c=new f(e);return t(c),new m(c.build())}export{ie as createContract};
1
+ var A={"comboboxpopup.open":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"keypress",target:"input",key:"ArrowDown"}]},{when:["pointer"],steps:()=>[{type:"click",target:"button"}]}],assertion:S},"comboboxpopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:[...M(),...h()]},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:q},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:C},"input.filled":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:"test"}]}],assertion:V},"input.empty":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:""}]}],assertion:H},"option.active":{requires:["comboboxpopup.open"],setup:[{when:["keyboard","pointer"],steps:(e={})=>typeof e.relativeTarget=="number"?Array.from({length:e.relativeTarget},()=>({type:"keypress",target:"main",key:"ArrowDown"})):e.relativeTarget==="first"?[{type:"keypress",target:"main",key:"ArrowDown"}]:e.relativeTarget==="last"?[{type:"keypress",target:"main",key:"ArrowDown"},{type:"keypress",target:"main",key:"ArrowUp"}]:[]}],assertion:(e={})=>E(e.relativeTarget)},"activedescendant.set":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:_},"activedescendant.unset":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:h},"option.selected":{requires:["comboboxpopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"keypress",target:"relative",key:"Enter",relativeTarget:e.relativeTarget}]},{when:["pointer"],steps:(e={})=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>D(e.relativeTarget)}};function S(){return [{target:"popup",assertion:"toBeVisible",failureMessage:"Expected popup to be visible"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected combobox main to have aria-expanded='true'."}]}function M(){return [{target:"popup",assertion:"notToBeVisible",failureMessage:"Expected popup to be closed"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected combobox main to have aria-expanded='false'."}]}function E(e){return [{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:{ref:"relative",relativeTarget:e,property:"id"},failureMessage:"Expected aria-activedescendant on main to match the id of the first relative item."}]}function _(){return [{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"!empty",failureMessage:"Expected aria-activedescendant on main to not be empty."}]}function h(){return [{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"",failureMessage:"Expected aria-activedescendant on main to be empty."}]}function D(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",failureMessage:`Expected ${e} item to have aria-selected='true'.`}]}function q(){return [{target:"main",assertion:"toHaveFocus",failureMessage:"Expected main to be focused."}]}function C(){return [{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected main to not have focused."}]}function V(){return [{target:"input",assertion:"toHaveValue",expectedValue:"test",failureMessage:"Expected input to have the value 'test'."}]}function H(){return [{target:"input",assertion:"toHaveValue",expectedValue:"",failureMessage:"Expected input to have the value ''."}]}var T={"menupopup.open":{setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"main",key:"Enter"}]},{when:["pointer"],steps:()=>[{type:"click",target:"main"}]}],assertion:I},"menupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:R},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:B},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:P},"menuitem.focused":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>F(e.relativeTarget)},"submenupopup.open":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}]},{when:["pointer"],steps:()=>[{type:"click",target:"submenuTrigger"}]}],assertion:O},"submenupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:$},"submenutrigger.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"submenuTrigger"}]}],assertion:z},"submenutrigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:L},"submenuitem.focused":{requires:["submenupopup.open"],setup:[{when:["keyboard"],steps:(e={})=>{let t=[{type:"focus",target:"submenuTrigger"},{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}];return typeof e.relativeTarget=="number"&&(t=t.concat(Array.from({length:e.relativeTarget},()=>({type:"keypress",target:"submenuItems",key:"ArrowDown"})))),e.relativeTarget==="first"&&(t=t.concat({type:"keypress",target:"submenuItems",key:"ArrowDown"})),e.relativeTarget==="last"&&(t=t.concat({type:"keypress",target:"submenuItems",key:"ArrowUp"})),t}},{when:["pointer"],steps:(e={})=>[{type:"click",target:"submenuTrigger"},{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>j(e.relativeTarget)}};function I(){return [{target:"popup",assertion:"toBeVisible",failureMessage:"Expected popup to be visible"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected menu main to have aria-expanded='true'."}]}function R(){return [{target:"popup",assertion:"notToBeVisible",failureMessage:"Expected popup to be closed"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected menu main to have aria-expanded='false'."}]}function B(){return [{target:"main",assertion:"toHaveFocus",failureMessage:"Expected menu main to be focused."}]}function P(){return [{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected menu main to not have focused."}]}function F(e){return [{target:"relative",assertion:"toHaveFocus",expectedValue:e,failureMessage:`${e} menu item should have focus.`}]}function O(){return [{target:"submenu",assertion:"toBeVisible",failureMessage:"Expected submenu to be visible"},{target:"submenuTrigger",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected submenu trigger to have aria-expanded='true'."}]}function $(){return [{target:"submenu",assertion:"notToBeVisible",failureMessage:"Expected submenu to be closed"},{target:"submenuTrigger",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected submenu trigger to have aria-expanded='false'."}]}function z(){return [{target:"submenuTrigger",assertion:"toHaveFocus",failureMessage:"Expected submenu trigger to be focused."}]}function L(){return [{target:"submenuTrigger",assertion:"notToHaveFocus",failureMessage:"Expected submenu trigger to not have focused."}]}function j(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveFocus",failureMessage:`Expected submenu item ${e} to have focus.`}]}var k={"tab.active":{setup:[{when:["keyboard"],steps:(e={})=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"ArrowLeft"}]},{when:["pointer"],steps:(e={})=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>U(e.relativeTarget)},"tab.focused":{setup:[{when:["keyboard","pointer"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>J(e.relativeTarget)}};function J(e){return [{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:"Expected first tab to have focus."}]}function K(e){return [{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${e} tab to have tabindex='0'.`}]}function U(e){return [{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${e} tab to have aria-selected='true'.`},{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${e} tab to be visible.`},K(e)]}var x={"panel.expanded":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Enter"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>N(e.relativeTarget)},"panel.collapsed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>X(e.relativeTarget)}};function N(e){return [{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${e} trigger to be visible.`},{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected trigger to have aria-expanded='true' when panel expands."}]}function X(e){return [{target:"panel",assertion:"notToBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${e} trigger not to be visible.`},{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected trigger to have aria-expanded='false' when panel collapses."}]}function W(e,t){return t.some(c=>e.capabilities.includes(c))}function y(e,t){Array.isArray(e)&&e.length&&!e[0].when&&(e=[{when:["keyboard"],steps:()=>e}]);for(let c of e)if(W(t,c.when))return c.steps(t);throw new Error(`No setup strategy matches capabilities: ${t.capabilities.join(", ")}`)}var G={combobox:A,menu:T,tabs:k,accordion:x},m=class{constructor(t){this.jsonContract=t;}toJSON(){return this.jsonContract}},b=class{constructor(t){this.componentName=t;this.statePack=G[t]||{};}metaValue={};selectorsValue={};relationshipInvariants=[];staticAssertions=[];dynamicTests=[];statePack;meta(t){return this.metaValue=t,this}selectors(t){return this.selectorsValue=t,this}relationships(t){let c=this.statePack,p={capabilities:["keyboard"]},g=(o,i=new Set)=>{if(i.has(o))return [];i.add(o);let a=c[o];if(!a)return [];let r=[];if(Array.isArray(a.requires))for(let s of a.requires)r=r.concat(g(s,i));return a.setup&&(r=r.concat(y(a.setup,p))),r};return t({ariaReference:(o,i,a)=>({requires:r=>{let s=g(r,new Set);return {required:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:a,level:"required",setup:s}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:a,level:"optional",setup:s}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:a,level:"recommended",setup:s})}},required:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:a,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:a,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:a,level:"recommended"})}),contains:(o,i)=>({requires:a=>{let r=g(a,new Set);return {required:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"required",setup:r}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"optional",setup:r}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"recommended",setup:r})}},required:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"recommended"})})}),this}static(t){return t({target:p=>{let g=i=>{let a=this.statePack,r={capabilities:["keyboard"]},s=(n,u=new Set)=>{if(u.has(n))return [];u.add(n);let d=a[n];if(!d)return [];let v=[];if(Array.isArray(d.requires))for(let w of d.requires)v=v.concat(s(w,u));return d.setup&&(v=v.concat(y(d.setup,r))),v};return s(i,new Set)},l=i=>i==="role"?"toHaveRole":"toHaveAttribute",o=(i,a,r)=>{let s=l(i);return {required:()=>this.staticAssertions.push({target:p,assertion:s,attribute:i,expectedValue:a,failureMessage:"",level:"required",setup:r}),optional:()=>this.staticAssertions.push({target:p,assertion:s,attribute:i,expectedValue:a,failureMessage:"",level:"optional",setup:r}),recommended:()=>this.staticAssertions.push({target:p,assertion:s,attribute:i,expectedValue:a,failureMessage:"",level:"recommended",setup:r})}};return {has:(i,a)=>({...o(i,a),requires:s=>{let n=g(s);return o(i,a,n)}})}}}),this}when(t){return new f(this,this.statePack,t)}addDynamicTest(t){this.dynamicTests.push(t);}build(){return {meta:this.metaValue,selectors:this.selectorsValue,relationships:this.relationshipInvariants.length?this.relationshipInvariants:void 0,static:this.staticAssertions.length?this.staticAssertions:[],dynamic:this.dynamicTests}}},f=class{constructor(t,c,p){this.parent=t;this.statePack=c;this.event=p;}_as;_onTarget;_onRelativeTarget;_given=[];_then=[];_desc="";_level="required";_orientation;as(t){return this._as=t,this}on(t,c){return this._onTarget=t,this._onRelativeTarget=c,this}given(t){return this._given=this._normalizeStates(t),this}then(t){return this._then=this._normalizeStates(t),this}orientation(t){return this._orientation=t,this}_normalizeStates(t){return (Array.isArray(t)?t:[t]).flatMap(p=>typeof p=="string"?[p]:typeof p=="object"&&p!==null&&"type"in p&&"ref"in p?this._findStateKeyByTypeAndRef(p.type)?[{type:p.type,ref:p.ref}]:[]:[p])}_findStateKeyByTypeAndRef(t){if(Object.keys(this.statePack).includes(t))return t}describe(t){return this._desc=t,this}required(){return this._level="required",this._finalize(),this.parent}optional(){return this._level="optional",this._finalize(),this.parent}recommended(){return this._level="recommended",this._finalize(),this.parent}_finalize(){let p={capabilities:[{keypress:"keyboard",click:"pointer",type:"textInput",focus:"keyboard",hover:"pointer"}[this._as||"keyboard"]||this._as||"keyboard"]},g=(r,s=new Set)=>{if(s.has(r))return [];s.add(r);let n=this.statePack[r];if(!n)return [];let u=[];if(Array.isArray(n.requires))for(let d of n.requires)u=u.concat(g(d,s));return n.setup&&(u=u.concat(y(n.setup,p))),u},l=[];for(let r of this._given)if(typeof r=="string")l.push(...g(r));else if(typeof r=="object"&&r!==null&&"type"in r&&"ref"in r){let s=this._findStateKeyByTypeAndRef(r.type);if(s){let n=this.statePack[s];if(n&&n.setup)for(let u of n.setup)typeof u.steps=="function"?l.push(...u.steps({relativeTarget:r.ref})):Array.isArray(u.steps)&&l.push(...u.steps);}}let o=new Set;l=l.filter(r=>{let s=JSON.stringify(r);return o.has(s)?false:(o.add(s),true)});let i=[];for(let r of this._then)if(typeof r=="string"){let s=this.statePack[r];if(s&&s.assertion!==void 0){let n=s.assertion;if(typeof n=="function")try{n=n();}catch(u){throw new Error(`Error calling assertion function for state '${r}': ${u.message}`)}Array.isArray(n)?i.push(...n):i.push(n);}}else if(typeof r=="object"&&r!==null&&"type"in r&&"ref"in r){let s=this._findStateKeyByTypeAndRef(r.type);if(s){let n=this.statePack[s];if(n&&n.assertion!==void 0){let u=n.assertion;if(typeof u=="function")try{u=u({relativeTarget:r.ref});}catch(d){throw new Error(`Error calling assertion function for state '${s}': ${d.message}`)}Array.isArray(u)?i.push(...u):i.push(u);}}}let a=[{type:this._as,target:this._onTarget,key:this._as==="keypress"?this.event:void 0,relativeTarget:this._onRelativeTarget}];this.parent.addDynamicTest({description:this._desc||"",level:this._level,orientation:this._orientation||"horizontal",action:a,assertions:i,...l.length?{setup:l}:{}});}};function ue(e,t){let c=new b(e);return t(c),new m(c.build())}export{ue as createContract};
@@ -1,8 +1,8 @@
1
- 'use strict';var playwright=require('playwright'),Me=require('path'),Be=require('fs-extra'),test=require('@playwright/test'),url=require('url'),fs=require('fs'),I=require('chalk'),xt=require('readline');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Me__default=/*#__PURE__*/_interopDefault(Me);var Be__default=/*#__PURE__*/_interopDefault(Be);var I__default=/*#__PURE__*/_interopDefault(I);var xt__default=/*#__PURE__*/_interopDefault(xt);var wt=Object.defineProperty;var V=(c,e)=>()=>(c&&(e=c(c=0)),e);var Q=(c,e)=>{for(var t in e)wt(c,t,{get:e[t],enumerable:true});};async function bt(){return re||(re=await playwright.chromium.launch({headless:true,args:["--disable-extensions","--disable-blink-features=AutomationControlled"]})),re}async function Tt(){return ie||(ie=await(await bt()).newContext({permissions:[],ignoreHTTPSErrors:true})),ie}async function De(){return await(await Tt()).newPage()}async function We(){ie&&(await ie.close(),ie=null),re&&(await re.close(),re=null);}var re,ie,be=V(()=>{re=null,ie=null;});function Z(c){return c==="required"||c==="recommended"||c==="optional"?c:$t}function ce(c){return c==="minimal"||c==="balanced"||c==="strict"||c==="paranoid"?c:"balanced"}function Oe(c,e){return {minimal:{required:"error",recommended:"ignore",optional:"ignore"},balanced:{required:"error",recommended:"warning",optional:"ignore"},strict:{required:"error",recommended:"error",optional:"warning"},paranoid:{required:"error",recommended:"error",optional:"error"}}[e][c]}var $t,Te=V(()=>{$t="required";});var Je={};Q(Je,{loadConfig:()=>kt});function St(c){let e=[];if(!c||typeof c!="object")return e.push("Config must be an object"),{valid:false,errors:e};let t=c;if(t.audit!==void 0){if(typeof t.audit!="object"||t.audit===null)e.push("audit must be an object");else if(t.audit.urls!==void 0&&(Array.isArray(t.audit.urls)?t.audit.urls.some(r=>typeof r!="string")&&e.push("audit.urls must contain only strings"):e.push("audit.urls must be an array")),t.audit.output!==void 0)if(typeof t.audit.output!="object")e.push("audit.output must be an object");else {let r=t.audit.output;r.format!==void 0&&(["json","csv","html","all"].includes(r.format)||e.push("audit.output.format must be one of: json, csv, html, all")),r.out!==void 0&&typeof r.out!="string"&&e.push("audit.output.out must be a string");}}if(t.test!==void 0)if(typeof t.test!="object"||t.test===null)e.push("test must be an object");else {t.test.disableTimeouts!==void 0&&typeof t.test.disableTimeouts!="boolean"&&e.push("test.disableTimeouts must be a boolean when provided");let r=["actionTimeoutMs","assertionTimeoutMs","navigationTimeoutMs","componentReadyTimeoutMs"];for(let i of r){let n=t.test[i];n!==void 0&&(typeof n!="number"||!Number.isFinite(n)||n<0)&&e.push(`test.${i} must be a non-negative number when provided`);}t.test.components!==void 0&&(Array.isArray(t.test.components)?t.test.components.forEach((i,n)=>{if(typeof i!="object"||i===null)e.push(`test.components[${n}] must be an object`);else {typeof i.name!="string"&&e.push(`test.components[${n}].name must be a string`),i.contractPath!==void 0&&typeof i.contractPath!="string"&&e.push(`test.components[${n}].contractPath must be a string when provided`),i.strategyPath!==void 0&&typeof i.strategyPath!="string"&&e.push(`test.components[${n}].strategyPath must be a string when provided`),i.strictness!==void 0&&!["minimal","balanced","strict","paranoid"].includes(i.strictness)&&e.push(`test.components[${n}].strictness must be one of: minimal, balanced, strict, paranoid`),i.disableTimeouts!==void 0&&typeof i.disableTimeouts!="boolean"&&e.push(`test.components[${n}].disableTimeouts must be a boolean when provided`);let a=["actionTimeoutMs","assertionTimeoutMs","navigationTimeoutMs","componentReadyTimeoutMs"];for(let o of a){let f=i[o];f!==void 0&&(typeof f!="number"||!Number.isFinite(f)||f<0)&&e.push(`test.components[${n}].${o} must be a non-negative number when provided`);}}}):e.push("test.components must be an array")),t.test.strictness!==void 0&&(["minimal","balanced","strict","paranoid"].includes(t.test.strictness)||e.push("test.strictness must be one of: minimal, balanced, strict, paranoid"));}return t.contracts!==void 0&&(Array.isArray(t.contracts)?t.contracts.forEach((r,i)=>{typeof r!="object"||r===null?e.push(`contracts[${i}] must be an object`):(typeof r.src!="string"&&e.push(`contracts[${i}].src is required and must be a string`),r.out!==void 0&&typeof r.out!="string"&&e.push(`contracts[${i}].out must be a string`));}):e.push("contracts must be an array")),{valid:e.length===0,errors:e}}async function Ct(c){try{let e=Me__default.default.extname(c);if(e===".json"){let t=await Be__default.default.readFile(c,"utf-8");return JSON.parse(t)}else if([".js",".mjs",".cjs",".ts"].includes(e)){let t=await import(c);return t.default||t}return null}catch{return null}}async function kt(c=process.cwd()){let e=["ariaease.config.js","ariaease.config.mjs","ariaease.config.cjs","ariaease.config.json","ariaease.config.ts"],t=null,r=null,i=[];for(let n of e){let a=Me__default.default.resolve(c,n);if(await Be__default.default.pathExists(a)){if(r=a,t=await Ct(a),t===null){i.push(`Found config at ${n} but failed to load it. Check for syntax errors.`);continue}let o=St(t);if(!o.valid){i.push(`Config validation failed in ${n}:`),i.push(...o.errors.map(f=>` - ${f}`)),t=null;continue}break}}return {config:t||{},configPath:t?r:null,errors:i}}var Ke=V(()=>{});var ze={};Q(ze,{MenuComponentStrategy:()=>Se});var Se,Ge=V(()=>{Se=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.popup)return;let t=this.selectors.popup,r=e.locator(t).first();if(!await r.isVisible().catch(()=>false))return;let n=false,a=this.selectors.input;if(!a&&this.selectors.focusable?a=this.selectors.focusable:a||(a=this.selectors.main),a&&(await e.locator(a).first().focus(),await e.keyboard.press("Escape"),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n&&this.selectors.main&&(await e.locator(this.selectors.main).first().click({timeout:this.actionTimeoutMs}),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),n||(await e.mouse.click(10,10),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n)throw new Error(`\u274C FATAL: Cannot close menu between tests. Menu remains visible after trying:
1
+ 'use strict';var playwright=require('playwright'),Me=require('path'),Be=require('fs-extra'),test=require('@playwright/test'),url=require('url'),fs=require('fs'),I=require('chalk'),xt=require('readline');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Me__default=/*#__PURE__*/_interopDefault(Me);var Be__default=/*#__PURE__*/_interopDefault(Be);var I__default=/*#__PURE__*/_interopDefault(I);var xt__default=/*#__PURE__*/_interopDefault(xt);var vt=Object.defineProperty;var V=(c,e)=>()=>(c&&(e=c(c=0)),e);var Q=(c,e)=>{for(var t in e)vt(c,t,{get:e[t],enumerable:true});};async function bt(){return re||(re=await playwright.chromium.launch({headless:true,args:["--disable-extensions","--disable-blink-features=AutomationControlled"]})),re}async function Tt(){return ie||(ie=await(await bt()).newContext({permissions:[],ignoreHTTPSErrors:true})),ie}async function De(){return await(await Tt()).newPage()}async function We(){ie&&(await ie.close(),ie=null),re&&(await re.close(),re=null);}var re,ie,be=V(()=>{re=null,ie=null;});function Z(c){return c==="required"||c==="recommended"||c==="optional"?c:$t}function ce(c){return c==="minimal"||c==="balanced"||c==="strict"||c==="paranoid"?c:"balanced"}function Oe(c,e){return {minimal:{required:"error",recommended:"ignore",optional:"ignore"},balanced:{required:"error",recommended:"warning",optional:"ignore"},strict:{required:"error",recommended:"error",optional:"warning"},paranoid:{required:"error",recommended:"error",optional:"error"}}[e][c]}var $t,Te=V(()=>{$t="required";});var Je={};Q(Je,{loadConfig:()=>kt});function St(c){let e=[];if(!c||typeof c!="object")return e.push("Config must be an object"),{valid:false,errors:e};let t=c;if(t.audit!==void 0){if(typeof t.audit!="object"||t.audit===null)e.push("audit must be an object");else if(t.audit.urls!==void 0&&(Array.isArray(t.audit.urls)?t.audit.urls.some(r=>typeof r!="string")&&e.push("audit.urls must contain only strings"):e.push("audit.urls must be an array")),t.audit.output!==void 0)if(typeof t.audit.output!="object")e.push("audit.output must be an object");else {let r=t.audit.output;r.format!==void 0&&(["json","csv","html","all"].includes(r.format)||e.push("audit.output.format must be one of: json, csv, html, all")),r.out!==void 0&&typeof r.out!="string"&&e.push("audit.output.out must be a string");}}if(t.test!==void 0)if(typeof t.test!="object"||t.test===null)e.push("test must be an object");else {t.test.disableTimeouts!==void 0&&typeof t.test.disableTimeouts!="boolean"&&e.push("test.disableTimeouts must be a boolean when provided");let r=["actionTimeoutMs","assertionTimeoutMs","navigationTimeoutMs","componentReadyTimeoutMs"];for(let i of r){let n=t.test[i];n!==void 0&&(typeof n!="number"||!Number.isFinite(n)||n<0)&&e.push(`test.${i} must be a non-negative number when provided`);}t.test.components!==void 0&&(Array.isArray(t.test.components)?t.test.components.forEach((i,n)=>{if(typeof i!="object"||i===null)e.push(`test.components[${n}] must be an object`);else {typeof i.name!="string"&&e.push(`test.components[${n}].name must be a string`),i.contractPath!==void 0&&typeof i.contractPath!="string"&&e.push(`test.components[${n}].contractPath must be a string when provided`),i.strategyPath!==void 0&&typeof i.strategyPath!="string"&&e.push(`test.components[${n}].strategyPath must be a string when provided`),i.strictness!==void 0&&!["minimal","balanced","strict","paranoid"].includes(i.strictness)&&e.push(`test.components[${n}].strictness must be one of: minimal, balanced, strict, paranoid`),i.disableTimeouts!==void 0&&typeof i.disableTimeouts!="boolean"&&e.push(`test.components[${n}].disableTimeouts must be a boolean when provided`);let a=["actionTimeoutMs","assertionTimeoutMs","navigationTimeoutMs","componentReadyTimeoutMs"];for(let o of a){let f=i[o];f!==void 0&&(typeof f!="number"||!Number.isFinite(f)||f<0)&&e.push(`test.components[${n}].${o} must be a non-negative number when provided`);}}}):e.push("test.components must be an array")),t.test.strictness!==void 0&&(["minimal","balanced","strict","paranoid"].includes(t.test.strictness)||e.push("test.strictness must be one of: minimal, balanced, strict, paranoid"));}return t.contracts!==void 0&&(Array.isArray(t.contracts)?t.contracts.forEach((r,i)=>{typeof r!="object"||r===null?e.push(`contracts[${i}] must be an object`):(typeof r.src!="string"&&e.push(`contracts[${i}].src is required and must be a string`),r.out!==void 0&&typeof r.out!="string"&&e.push(`contracts[${i}].out must be a string`));}):e.push("contracts must be an array")),{valid:e.length===0,errors:e}}async function Ct(c){try{let e=Me__default.default.extname(c);if(e===".json"){let t=await Be__default.default.readFile(c,"utf-8");return JSON.parse(t)}else if([".js",".mjs",".cjs",".ts"].includes(e)){let t=await import(c);return t.default||t}return null}catch{return null}}async function kt(c=process.cwd()){let e=["ariaease.config.js","ariaease.config.mjs","ariaease.config.cjs","ariaease.config.json","ariaease.config.ts"],t=null,r=null,i=[];for(let n of e){let a=Me__default.default.resolve(c,n);if(await Be__default.default.pathExists(a)){if(r=a,t=await Ct(a),t===null){i.push(`Found config at ${n} but failed to load it. Check for syntax errors.`);continue}let o=St(t);if(!o.valid){i.push(`Config validation failed in ${n}:`),i.push(...o.errors.map(f=>` - ${f}`)),t=null;continue}break}}return {config:t||{},configPath:t?r:null,errors:i}}var Ke=V(()=>{});var ze={};Q(ze,{MenuComponentStrategy:()=>Se});var Se,Ge=V(()=>{Se=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.popup)return;let t=this.selectors.popup,r=e.locator(t).first();if(!await r.isVisible().catch(()=>false))return;let n=false,a=this.selectors.main;if(a&&(await e.locator(a).first().focus(),await e.keyboard.press("Escape"),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n&&this.selectors.main&&(await e.locator(this.selectors.main).first().click({timeout:this.actionTimeoutMs}),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),n||(await e.mouse.click(10,10),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n)throw new Error(`\u274C FATAL: Cannot close menu between tests. Menu remains visible after trying:
2
2
  1. Escape key
3
3
  2. Clicking trigger
4
4
  3. Clicking outside
5
- This indicates a problem with the menu component's close functionality.`);this.selectors.input&&await e.locator(this.selectors.input).first().clear(),this.selectors.main&&await e.locator(this.selectors.main).first().focus();}async shouldSkipTest(e,t){if(!(e.action.some(a=>a.target==="submenu"||a.target==="submenuTrigger"||a.target==="submenuItems")||e.assertions.some(a=>a.target==="submenu"||a.target==="submenuTrigger"||a.target==="submenuItems")))return false;let i=this.selectors.submenuTrigger;return i?await t.locator(i).count()===0:true}getMainSelector(){return this.mainSelector}};});var Ne={};Q(Ne,{AccordionComponentStrategy:()=>Ce});var Ce,Ye=V(()=>{Ce=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.panel||!this.selectors.trigger||this.selectors.popup)return;let t=this.selectors.trigger,r=this.selectors.panel;if(!t||!r)return;let i=await e.locator(t).all();for(let n of i){let a=await n.getAttribute("aria-expanded")==="true",o=await n.getAttribute("aria-controls");if(a&&o){await n.click({timeout:this.actionTimeoutMs});let f=e.locator(`#${o}`);await test.expect(f).toBeHidden({timeout:this.assertionTimeoutMs}).catch(()=>{});}}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};});var Qe={};Q(Qe,{ComboboxComponentStrategy:()=>Ae});var Ae,Xe=V(()=>{Ae=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.popup)return;let t=this.selectors.popup,r=e.locator(t).first();if(!await r.isVisible().catch(()=>false))return;let n=false,a=this.selectors.input;if(!a&&this.selectors.focusable?a=this.selectors.focusable:a||(a=this.selectors.button),a&&(await e.locator(a).first().focus(),await e.keyboard.press("Escape"),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n&&this.selectors.button&&(await e.locator(this.selectors.button).first().click({timeout:this.actionTimeoutMs}),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),n||(await e.mouse.click(10,10),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n)throw new Error(`\u274C FATAL: Cannot close combobox popup between tests. Popup remains visible after trying:
5
+ This indicates a problem with the menu component's close functionality.`);this.selectors.input&&await e.locator(this.selectors.input).first().clear(),this.selectors.main&&await e.locator(this.selectors.main).first().focus();}async shouldSkipTest(e,t){if(!(e.action.some(a=>a.target==="submenu"||a.target==="submenuTrigger"||a.target==="submenuItems")||e.assertions.some(a=>a.target==="submenu"||a.target==="submenuTrigger"||a.target==="submenuItems")))return false;let i=this.selectors.submenuTrigger;return i?await t.locator(i).count()===0:true}getMainSelector(){return this.mainSelector}};});var Ne={};Q(Ne,{AccordionComponentStrategy:()=>Ce});var Ce,Ye=V(()=>{Ce=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.panel||!this.selectors.trigger)return;let t=this.selectors.trigger,r=this.selectors.panel;if(!t||!r)return;let i=await e.locator(t).all();for(let n of i){let a=await n.getAttribute("aria-expanded")==="true",o=await n.getAttribute("aria-controls");if(a&&o){await n.click({timeout:this.actionTimeoutMs});let f=e.locator(`#${o}`);await test.expect(f).toBeHidden({timeout:this.assertionTimeoutMs}).catch(()=>{});}}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};});var Qe={};Q(Qe,{ComboboxComponentStrategy:()=>Ae});var Ae,Xe=V(()=>{Ae=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.popup)return;let t=this.selectors.popup,r=e.locator(t).first();if(!await r.isVisible().catch(()=>false))return;let n=false,a=this.selectors.main;if(a&&(await e.locator(a).first().focus(),await e.keyboard.press("Escape"),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n&&this.selectors.button&&(await e.locator(this.selectors.button).first().click({timeout:this.actionTimeoutMs}),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),n||(await e.mouse.click(10,10),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n)throw new Error(`\u274C FATAL: Cannot close combobox popup between tests. Popup remains visible after trying:
6
6
  1. Escape key
7
7
  2. Clicking button
8
8
  3. Clicking outside
@@ -27,15 +27,15 @@ ${"\u2550".repeat(60)}`),this.log(`\u{1F4CA} Summary
27
27
  `),o>0?(this.log("\u{1F527} Next Steps:"),this.log(" 1. Review the failures above"),this.log(" 2. Fix ARIA attributes and keyboard handlers"),this.log(` 3. Re-run tests to verify fixes
28
28
  `)):!this.isPlaywright&&this.skipped>0&&this.log(`\u2728 Optional: Run Playwright tests for complete validation
29
29
  `),{passes:a,failures:o,skipped:this.skipped,duration:t}}error(e,t){this.log(`
30
- \u274C Error: ${e}`),t&&this.log(` Context: ${t}`),this.log("");}};});var nt={};Q(nt,{RelativeTargetResolver:()=>O});var O,me=V(()=>{O=class{static async resolve(e,t,r){let i=await e.locator(t).all();if(typeof r=="number")return i[r-1];switch(r){case "first":return i[0];case "second":return i[1];case "last":return i[i.length-1];case "next":{let a=(await e.evaluate(([o])=>Array.from(document.querySelectorAll(o)).indexOf(document.activeElement),[t])+1)%i.length;return i[a]}case "previous":{let a=(await e.evaluate(([o])=>Array.from(document.querySelectorAll(o)).indexOf(document.activeElement),[t])-1+i.length)%i.length;return i[a]}default:return null}}};});var ne,ot=V(()=>{me();ne=class{constructor(e,t,r=400){this.page=e;this.selectors=t;this.timeoutMs=r;}isBrowserClosedError(e){return e instanceof Error&&e.message.includes("Target page, context or browser has been closed")}async focus(e,t,r){try{if(e==="virtual"&&r){let n=this.selectors.main;if(!n)return {success:!1,error:"Main selector not defined for virtual focus."};let a=this.page.locator(n).first();return await a.count()?(await a.evaluate((f,S)=>{f.setAttribute("aria-activedescendant",S);},r),{success:!0}):{success:!1,error:"Main element not found for virtual focus."}}if(e==="relative"&&t){let n=this.selectors.relative;if(!n)return {success:!1,error:"Relative selector not defined for focus action."};let a=await O.resolve(this.page,n,t);return a?(await a.focus({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for focus.`}}let i=this.selectors[e];return i?(await this.page.locator(i).first().focus({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for focus target ${e} not found.`}}catch(i){return this.isBrowserClosedError(i)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to focus ${e}: ${i instanceof Error?i.message:String(i)}`}}}async type(e,t){try{let r=this.selectors[e];return r?(await this.page.locator(r).first().fill(t,{timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for type target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to type into ${e}: ${r instanceof Error?r.message:String(r)}`}}}async click(e,t){try{if(e==="document")return await this.page.mouse.click(10,10),{success:!0};if(e==="relative"&&t){let i=this.selectors.relative;if(!i)return {success:!1,error:"Relative selector not defined for click action."};let n=await O.resolve(this.page,i,t);return n?(await n.click({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for click.`}}let r=this.selectors[e];return r?(await this.page.locator(r).first().click({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for action target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to click ${e}: ${r instanceof Error?r.message:String(r)}`}}}async keypress(e,t,r){try{let n={Space:"Space",Enter:"Enter",Escape:"Escape","Arrow Up":"ArrowUp","Arrow Down":"ArrowDown","Arrow Left":"ArrowLeft","Arrow Right":"ArrowRight",Home:"Home",End:"End",Tab:"Tab"}[t]||t;if(n==="Space"?n=" ":n.includes(" ")&&(n=n.replace(/ /g,"")),e==="focusable"&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Home","End","Tab","Shift+Tab"].includes(n))return await this.page.keyboard.press(n),{success:!0};if(e==="relative"){if(r==null)return {success:!1,error:"relativeTarget must be provided for relative keypress."};let S=this.selectors.relative;if(!S)return {success:!1,error:"Relative selector not defined for keypress action."};let y=await O.resolve(this.page,S,r);return y?(await y.press(n,{timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${r} for keypress.`}}let a=this.selectors[e];if(!a)return {success:!1,error:`Selector for keypress target ${e} not found.`};let o=this.page.locator(a).first();return await o.count()===0?{success:!1,error:`${e} element not found.`,shouldBreak:!0}:(await o.press(n,{timeout:this.timeoutMs}),{success:!0})}catch(i){return this.isBrowserClosedError(i)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to press ${t} on ${e}: ${i instanceof Error?i.message:String(i)}`}}}async hover(e,t){try{if(e==="relative"&&t){let i=this.selectors.relative;if(!i)return {success:!1,error:"Relative selector not defined for hover action."};let n=await O.resolve(this.page,i,t);return n?(await n.hover({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for hover.`}}let r=this.selectors[e];return r?(await this.page.locator(r).first().hover({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for hover target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to hover ${e}: ${r instanceof Error?r.message:String(r)}`}}}};});var le,at=V(()=>{me();le=class{constructor(e,t,r=400){this.page=e;this.selectors=t;this.timeoutMs=r;}async resolveTarget(e,t,r){try{if(e==="relative"){let n=r?this.selectors[r]:this.selectors.relative;if(!n)return {target:null,error:"Relative selector is not defined in the contract."};if(!t)return {target:null,error:"Relative target or expected value is not defined."};let a=await O.resolve(this.page,n,t);return a?{target:a}:{target:null,error:`Target ${e} not found.`}}let i=this.selectors[e];return i?{target:this.page.locator(i).first()}:{target:null,error:`Selector for assertion target ${e} not found.`}}catch(i){return {target:null,error:`Failed to resolve target ${e}: ${i instanceof Error?i.message:String(i)}`}}}async validateVisibility(e,t,r,i,n){try{return r?(await test.expect(e).toBeVisible({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} is visible as expected. Test: "${n}".`}):(await test.expect(e).toBeHidden({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} is not visible as expected. Test: "${n}".`})}catch{let a=this.selectors[t]||"",o=await this.page.evaluate(f=>{let S=f?document.querySelector(f):null;if(!S)return "element not found";let y=window.getComputedStyle(S);return `display:${y.display}, visibility:${y.visibility}, opacity:${y.opacity}`},a);return r?{success:false,failMessage:`${i} (actual: ${o})`}:{success:false,failMessage:`${i} ${t} is still visible (actual: ${o}).`}}}async validateAttribute(e,t,r,i,n,a){if(i==="!empty"){let S=await e.getAttribute(r);return S&&S.trim()!==""?{success:true,passMessage:`${t} has non-empty "${r}". Test: "${a}".`}:{success:false,failMessage:`${n} ${t} "${r}" should not be empty, found "${S}".`}}if(typeof i!="string")throw console.error("[AssertionRunner] expectedValue is not a string:",i),new Error(`AssertionRunner: expectedValue for attribute assertion must be a string, but got: ${JSON.stringify(i)}`);let o=i.split(" | ").map(S=>S.trim()),f=await e.getAttribute(r);return f!==null&&o.includes(f)?{success:true,passMessage:`${t} has expected "${r}". Test: "${a}".`}:{success:false,failMessage:`${n} ${t} "${r}" should be "${i}", found "${f}".`}}async validateValue(e,t,r,i,n){let a=await e.inputValue().catch(()=>"");return r==="!empty"?a&&a.trim()!==""?{success:true,passMessage:`${t} has non-empty value. Test: "${n}".`}:{success:false,failMessage:`${i} ${t} value should not be empty, found "${a}".`}:r===""?a===""?{success:true,passMessage:`${t} has empty value. Test: "${n}".`}:{success:false,failMessage:`${i} ${t} value should be empty, found "${a}".`}:a===r?{success:true,passMessage:`${t} has expected value. Test: "${n}".`}:{success:false,failMessage:`${i} ${t} value should be "${r}", found "${a}".`}}async validateFocus(e,t,r,i,n){try{return r?(await test.expect(e).toBeFocused({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} has focus as expected. Test: "${n}".`}):(await test.expect(e).not.toBeFocused({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} does not have focus as expected. Test: "${n}".`})}catch{let a=await this.page.evaluate(()=>{let o=document.activeElement;return o?`${o.tagName}#${o.id||"no-id"}.${o.className||"no-class"}`:"no element focused"});return {success:false,failMessage:`${i} (actual focus: ${a})`}}}async validateRole(e,t,r,i,n){let a=await e.getAttribute("role");return a===r?{success:true,passMessage:`${t} has role "${r}". Test: "${n}".`}:{success:false,failMessage:`${i} Expected role "${r}", found "${a}".`}}async validate(e,t){if(this.page.isClosed())return {success:false,failMessage:"CRITICAL: Browser/page closed before completing all tests. Increase test timeout or reduce test complexity."};let r=null,i;if(e.controlledBy){let n=e.controlledBy,a=this.selectors[n.target];if(!a)return {success:false,failMessage:`Selector for controlledBy.target '${n.target}' not found.`,target:null};let o=null;if(n.relativeTarget?o=await O.resolve(this.page,a,n.relativeTarget):o=this.page.locator(a).first(),!o)return {success:false,failMessage:"Controlling element for controlledBy not found.",target:null};let f=n.attribute||"aria-controls",S=await o.getAttribute(f);if(!S)return {success:false,failMessage:`Controlling element does not have attribute '${f}'.`,target:null};if(r=this.page.locator(`#${S}`),!r||await r.count()===0)return {success:false,failMessage:`Controlled element with id '${S}' not found.`,target:null}}else {let n=await this.resolveTarget(e.target,e.relativeTarget||e.expectedValue,e.selectorKey);if(r=n.target,i=n.error,i||!r)return {success:false,failMessage:i||`Target ${e.target} not found.`,target:null}}if(e.target==="input"&&e.attribute==="aria-activedescendant"&&e.expectedValue==="!empty"&&e.relativeTarget&&e.selectorKey){let n=await O.resolve(this.page,this.selectors[e.selectorKey],e.relativeTarget),a=n?await n.getAttribute("id"):null,o=await r.getAttribute("aria-activedescendant");return a&&o===a?{success:true,passMessage:`input[aria-activedescendant] matches id of ${e.relativeTarget}(${e.selectorKey}). Test: "${t}".`}:{success:false,failMessage:`input[aria-activedescendant] should match id of ${e.relativeTarget}(${e.selectorKey}), found "${o}".`}}switch(e.assertion){case "toBeVisible":return this.validateVisibility(r,e.target,true,e.failureMessage||"",t);case "notToBeVisible":return this.validateVisibility(r,e.target,false,e.failureMessage||"",t);case "toHaveAttribute":return e.attribute&&e.expectedValue!==void 0?this.validateAttribute(r,e.target,e.attribute,e.expectedValue,e.failureMessage||"",t):{success:false,failMessage:"Missing attribute or expectedValue for toHaveAttribute assertion"};case "toHaveValue":return e.expectedValue!==void 0?this.validateValue(r,e.target,e.expectedValue,e.failureMessage||"",t):{success:false,failMessage:"Missing expectedValue for toHaveValue assertion"};case "toHaveFocus":return this.validateFocus(r,e.target,true,e.failureMessage||"",t);case "notToHaveFocus":return this.validateFocus(r,e.target,false,e.failureMessage||"",t);case "toHaveRole":return e.expectedValue!==void 0?this.validateRole(r,e.target,e.expectedValue,e.failureMessage||"",t):{success:false,failMessage:"Missing expectedValue for toHaveRole assertion"};default:return {success:false,failMessage:`Unknown assertion type: ${e.assertion}`}}}};});var ct={};Q(ct,{runContractTestsPlaywright:()=>Et});async function Et(c,e,t,r,i){let n=r?.test?.components?.find(h=>h.name===c),a=!!n?.contractPath,o=new de(true,a),f={actionTimeoutMs:400,assertionTimeoutMs:400,navigationTimeoutMs:3e4,componentReadyTimeoutMs:5e3},S=r?.test?.disableTimeouts===true,x=n?.disableTimeouts===true||S,P=(h,_,J)=>{if(x)return 0;let D=h??_;return typeof D!="number"||!Number.isFinite(D)||D<0?J:D},z=P(n?.actionTimeoutMs,r?.test?.actionTimeoutMs,f.actionTimeoutMs),ee=P(n?.assertionTimeoutMs,r?.test?.assertionTimeoutMs,f.assertionTimeoutMs),ue=P(n?.navigationTimeoutMs,r?.test?.navigationTimeoutMs,f.navigationTimeoutMs),ye=P(n?.componentReadyTimeoutMs,r?.test?.componentReadyTimeoutMs,f.componentReadyTimeoutMs),Le=ce(t),te=n?.contractPath;if(!te)throw new Error(`Contract path not found for component: ${c}`);let gt=(()=>{if(Me__default.default.isAbsolute(te))return te;if(i){let _=Me__default.default.resolve(i,te);try{return fs.readFileSync(_,"utf-8"),_}catch{}}let h=Me__default.default.resolve(process.cwd(),te);try{return fs.readFileSync(h,"utf-8"),h}catch{return new URL(te,(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).pathname}})(),dt=fs.readFileSync(gt,"utf-8"),C=JSON.parse(dt),mt=(C.relationships?.length||0)+(C.static[0]?.assertions.length||0)+C.dynamic.length,ht=C.meta?.source?.apg,H=[],G=[],N=[],B=[],T=null,M=(h,_)=>{let J=Z(_),D=Oe(J,Le);if(D==="error")return H.push(h),{status:"fail",level:J,detail:h};if(D==="warning")return G.push(h),{status:"warn",level:J,detail:h};let K=`${h} (ignored by strictness=${Le}, level=${J})`;return B.push(K),{status:"skip",level:J,detail:K}};try{if(T=await De(),e){try{await T.goto(e,{waitUntil:"domcontentloaded",timeout:ue});}catch(s){throw new Error(`Failed to navigate to ${e}. Ensure dev server is running and accessible. Original error: ${s instanceof Error?s.message:String(s)}`)}await T.addStyleTag({content:"* { transition: none !important; animation: none !important; }"});}let h=await ge.detect(c,n,z,ee,i);if(!h)throw new Error(`Unsupported component: ${c}`);let _=h.getMainSelector();if(!_)throw new Error(`CRITICAL: No selector found in contract for ${c}`);try{await T.locator(_).first().waitFor({state:"attached",timeout:ye});}catch(s){throw new Error(`
30
+ \u274C Error: ${e}`),t&&this.log(` Context: ${t}`),this.log("");}};});var nt={};Q(nt,{RelativeTargetResolver:()=>O});var O,me=V(()=>{O=class{static async resolve(e,t,r){let i=await e.locator(t).all();if(typeof r=="number")return i[r-1];switch(r){case "first":return i[0];case "second":return i[1];case "last":return i[i.length-1];case "next":{let a=(await e.evaluate(([o])=>Array.from(document.querySelectorAll(o)).indexOf(document.activeElement),[t])+1)%i.length;return i[a]}case "previous":{let a=(await e.evaluate(([o])=>Array.from(document.querySelectorAll(o)).indexOf(document.activeElement),[t])-1+i.length)%i.length;return i[a]}default:return null}}};});var ne,ot=V(()=>{me();ne=class{constructor(e,t,r=400){this.page=e;this.selectors=t;this.timeoutMs=r;}isBrowserClosedError(e){return e instanceof Error&&e.message.includes("Target page, context or browser has been closed")}async focus(e,t,r){try{if(e==="virtual"&&r){let n=this.selectors.main;if(!n)return {success:!1,error:"Main selector not defined for virtual focus."};let a=this.page.locator(n).first();return await a.count()?(await a.evaluate((f,S)=>{f.setAttribute("aria-activedescendant",S);},r),{success:!0}):{success:!1,error:"Main element not found for virtual focus."}}if(e==="relative"&&t){let n=this.selectors.relative;if(!n)return {success:!1,error:"Relative selector not defined for focus action."};let a=await O.resolve(this.page,n,t);return a?(await a.focus({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for focus.`}}let i=this.selectors[e];return i?(await this.page.locator(i).first().focus({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for focus target ${e} not found.`}}catch(i){return this.isBrowserClosedError(i)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to focus ${e}: ${i instanceof Error?i.message:String(i)}`}}}async type(e,t){try{let r=this.selectors[e];return r?(await this.page.locator(r).first().fill(t,{timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for type target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to type into ${e}: ${r instanceof Error?r.message:String(r)}`}}}async click(e,t){try{if(e==="document")return await this.page.mouse.click(10,10),{success:!0};if(e==="relative"&&t){let i=this.selectors.relative;if(!i)return {success:!1,error:"Relative selector not defined for click action."};let n=await O.resolve(this.page,i,t);return n?(await n.click({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for click.`}}let r=this.selectors[e];return r?(await this.page.locator(r).first().click({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for action target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to click ${e}: ${r instanceof Error?r.message:String(r)}`}}}async keypress(e,t,r){try{let n={Space:"Space",Enter:"Enter",Escape:"Escape","Arrow Up":"ArrowUp","Arrow Down":"ArrowDown","Arrow Left":"ArrowLeft","Arrow Right":"ArrowRight",Home:"Home",End:"End",Tab:"Tab"}[t]||t;if(n==="Space"?n=" ":n.includes(" ")&&(n=n.replace(/ /g,"")),e==="relative"){if(r==null)return {success:!1,error:"relativeTarget must be provided for relative keypress."};let S=this.selectors.relative;if(!S)return {success:!1,error:"Relative selector not defined for keypress action."};let y=await O.resolve(this.page,S,r);return y?(await y.press(n,{timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${r} for keypress.`}}let a=this.selectors[e];if(!a)return {success:!1,error:`Selector for keypress target ${e} not found.`};let o=this.page.locator(a).first();return await o.count()===0?{success:!1,error:`${e} element not found.`,shouldBreak:!0}:(await o.press(n,{timeout:this.timeoutMs}),{success:!0})}catch(i){return this.isBrowserClosedError(i)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to press ${t} on ${e}: ${i instanceof Error?i.message:String(i)}`}}}async hover(e,t){try{if(e==="relative"&&t){let i=this.selectors.relative;if(!i)return {success:!1,error:"Relative selector not defined for hover action."};let n=await O.resolve(this.page,i,t);return n?(await n.hover({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for hover.`}}let r=this.selectors[e];return r?(await this.page.locator(r).first().hover({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for hover target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to hover ${e}: ${r instanceof Error?r.message:String(r)}`}}}};});var le,at=V(()=>{me();le=class{constructor(e,t,r=400){this.page=e;this.selectors=t;this.timeoutMs=r;}async resolveTarget(e,t,r){try{if(e==="relative"){let n=r?this.selectors[r]:this.selectors.relative;if(!n)return {target:null,error:"Relative selector is not defined in the contract."};if(!t)return {target:null,error:"Relative target or expected value is not defined."};let a=await O.resolve(this.page,n,t);return a?{target:a}:{target:null,error:`Target ${e} not found.`}}let i=this.selectors[e];return i?{target:this.page.locator(i).first()}:{target:null,error:`Selector for assertion target ${e} not found.`}}catch(i){return {target:null,error:`Failed to resolve target ${e}: ${i instanceof Error?i.message:String(i)}`}}}async validateVisibility(e,t,r,i,n){try{return r?(await test.expect(e).toBeVisible({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} is visible as expected. Test: "${n}".`}):(await test.expect(e).toBeHidden({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} is not visible as expected. Test: "${n}".`})}catch{let a=this.selectors[t]||"",o=await this.page.evaluate(f=>{let S=f?document.querySelector(f):null;if(!S)return "element not found";let y=window.getComputedStyle(S);return `display:${y.display}, visibility:${y.visibility}, opacity:${y.opacity}`},a);return r?{success:false,failMessage:`${i} (actual: ${o})`}:{success:false,failMessage:`${i} ${t} is still visible (actual: ${o}).`}}}async validateAttribute(e,t,r,i,n,a){if(i==="!empty"){let S=await e.getAttribute(r);return S&&S.trim()!==""?{success:true,passMessage:`${t} has non-empty "${r}". Test: "${a}".`}:{success:false,failMessage:`${n} ${t} "${r}" should not be empty, found "${S}".`}}if(typeof i!="string")throw console.error("[AssertionRunner] expectedValue is not a string:",i),new Error(`AssertionRunner: expectedValue for attribute assertion must be a string, but got: ${JSON.stringify(i)}`);let o=i.split(" | ").map(S=>S.trim()),f=await e.getAttribute(r);return f!==null&&o.includes(f)?{success:true,passMessage:`${t} has expected "${r}". Test: "${a}".`}:{success:false,failMessage:`${n} ${t} "${r}" should be "${i}", found "${f}".`}}async validateValue(e,t,r,i,n){let a=await e.inputValue().catch(()=>"");return r==="!empty"?a&&a.trim()!==""?{success:true,passMessage:`${t} has non-empty value. Test: "${n}".`}:{success:false,failMessage:`${i} ${t} value should not be empty, found "${a}".`}:r===""?a===""?{success:true,passMessage:`${t} has empty value. Test: "${n}".`}:{success:false,failMessage:`${i} ${t} value should be empty, found "${a}".`}:a===r?{success:true,passMessage:`${t} has expected value. Test: "${n}".`}:{success:false,failMessage:`${i} ${t} value should be "${r}", found "${a}".`}}async validateFocus(e,t,r,i,n){try{return r?(await test.expect(e).toBeFocused({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} has focus as expected. Test: "${n}".`}):(await test.expect(e).not.toBeFocused({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} does not have focus as expected. Test: "${n}".`})}catch{let a=await this.page.evaluate(()=>{let o=document.activeElement;return o?`${o.tagName}#${o.id||"no-id"}.${o.className||"no-class"}`:"no element focused"});return {success:false,failMessage:`${i} (actual focus: ${a})`}}}async validateRole(e,t,r,i,n){let a=await e.getAttribute("role");return a===r?{success:true,passMessage:`${t} has role "${r}". Test: "${n}".`}:{success:false,failMessage:`${i} Expected role "${r}", found "${a}".`}}async validate(e,t){if(this.page.isClosed())return {success:false,failMessage:"CRITICAL: Browser/page closed before completing all tests. Increase test timeout or reduce test complexity."};let r=null,i;if(e.controlledBy){let n=e.controlledBy,a=this.selectors[n.target];if(!a)return {success:false,failMessage:`Selector for controlledBy.target '${n.target}' not found.`,target:null};let o=null;if(n.relativeTarget?o=await O.resolve(this.page,a,n.relativeTarget):o=this.page.locator(a).first(),!o)return {success:false,failMessage:"Controlling element for controlledBy not found.",target:null};let f=n.attribute||"aria-controls",S=await o.getAttribute(f);if(!S)return {success:false,failMessage:`Controlling element does not have attribute '${f}'.`,target:null};if(r=this.page.locator(`#${S}`),!r||await r.count()===0)return {success:false,failMessage:`Controlled element with id '${S}' not found.`,target:null}}else {let n=await this.resolveTarget(e.target,e.relativeTarget||e.expectedValue,e.selectorKey);if(r=n.target,i=n.error,i||!r)return {success:false,failMessage:i||`Target ${e.target} not found.`,target:null}}if(e.target==="input"&&e.attribute==="aria-activedescendant"&&e.expectedValue==="!empty"&&e.relativeTarget&&e.selectorKey){let n=await O.resolve(this.page,this.selectors[e.selectorKey],e.relativeTarget),a=n?await n.getAttribute("id"):null,o=await r.getAttribute("aria-activedescendant");return a&&o===a?{success:true,passMessage:`input[aria-activedescendant] matches id of ${e.relativeTarget}(${e.selectorKey}). Test: "${t}".`}:{success:false,failMessage:`input[aria-activedescendant] should match id of ${e.relativeTarget}(${e.selectorKey}), found "${o}".`}}switch(e.assertion){case "toBeVisible":return this.validateVisibility(r,e.target,true,e.failureMessage||"",t);case "notToBeVisible":return this.validateVisibility(r,e.target,false,e.failureMessage||"",t);case "toHaveAttribute":return e.attribute&&e.expectedValue!==void 0?this.validateAttribute(r,e.target,e.attribute,e.expectedValue,e.failureMessage||"",t):{success:false,failMessage:"Missing attribute or expectedValue for toHaveAttribute assertion"};case "toHaveValue":return e.expectedValue!==void 0?this.validateValue(r,e.target,e.expectedValue,e.failureMessage||"",t):{success:false,failMessage:"Missing expectedValue for toHaveValue assertion"};case "toHaveFocus":return this.validateFocus(r,e.target,true,e.failureMessage||"",t);case "notToHaveFocus":return this.validateFocus(r,e.target,false,e.failureMessage||"",t);case "toHaveRole":return e.expectedValue!==void 0?this.validateRole(r,e.target,e.expectedValue,e.failureMessage||"",t):{success:false,failMessage:"Missing expectedValue for toHaveRole assertion"};default:return {success:false,failMessage:`Unknown assertion type: ${e.assertion}`}}}};});var ct={};Q(ct,{runContractTestsPlaywright:()=>Et});async function Et(c,e,t,r,i){let n=r?.test?.components?.find(h=>h.name===c),a=!!n?.contractPath,o=new de(true,a),f={actionTimeoutMs:400,assertionTimeoutMs:400,navigationTimeoutMs:3e4,componentReadyTimeoutMs:5e3},S=r?.test?.disableTimeouts===true,x=n?.disableTimeouts===true||S,P=(h,_,J)=>{if(x)return 0;let D=h??_;return typeof D!="number"||!Number.isFinite(D)||D<0?J:D},z=P(n?.actionTimeoutMs,r?.test?.actionTimeoutMs,f.actionTimeoutMs),ee=P(n?.assertionTimeoutMs,r?.test?.assertionTimeoutMs,f.assertionTimeoutMs),ue=P(n?.navigationTimeoutMs,r?.test?.navigationTimeoutMs,f.navigationTimeoutMs),ye=P(n?.componentReadyTimeoutMs,r?.test?.componentReadyTimeoutMs,f.componentReadyTimeoutMs),Le=ce(t),te=n?.contractPath;if(!te)throw new Error(`Contract path not found for component: ${c}`);let gt=(()=>{if(Me__default.default.isAbsolute(te))return te;if(i){let _=Me__default.default.resolve(i,te);try{return fs.readFileSync(_,"utf-8"),_}catch{}}let h=Me__default.default.resolve(process.cwd(),te);try{return fs.readFileSync(h,"utf-8"),h}catch{return new URL(te,(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).pathname}})(),dt=fs.readFileSync(gt,"utf-8"),C=JSON.parse(dt),mt=(C.relationships?.length||0)+(C.static.length||0)+C.dynamic.length,ht=C.meta?.source?.apg,H=[],G=[],N=[],B=[],T=null,M=(h,_)=>{let J=Z(_),D=Oe(J,Le);if(D==="error")return H.push(h),{status:"fail",level:J,detail:h};if(D==="warning")return G.push(h),{status:"warn",level:J,detail:h};let K=`${h} (ignored by strictness=${Le}, level=${J})`;return B.push(K),{status:"skip",level:J,detail:K}};try{if(T=await De(),e){try{await T.goto(e,{waitUntil:"domcontentloaded",timeout:ue});}catch(s){throw new Error(`Failed to navigate to ${e}. Ensure dev server is running and accessible. Original error: ${s instanceof Error?s.message:String(s)}`)}await T.addStyleTag({content:"* { transition: none !important; animation: none !important; }"});}let h=await ge.detect(c,n,z,ee,i);if(!h)throw new Error(`Unsupported component: ${c}`);let _=h.getMainSelector();if(!_)throw new Error(`CRITICAL: No selector found in contract for ${c}`);try{await T.locator(_).first().waitFor({state:"attached",timeout:ye});}catch(s){throw new Error(`
31
31
  \u274C CRITICAL: Component not found on page!
32
32
  This usually means:
33
33
  - The component didn't render
34
34
  - The URL is incorrect
35
35
  - The component selector '${_}' in the contract is wrong
36
- - Original error: ${s}`)}o.start(c,mt,ht),c==="menu"&&C.selectors.main&&await T.locator(C.selectors.main).first().waitFor({state:"visible",timeout:ye}).catch(()=>{});let J=c==="menu"&&C.selectors.submenuTrigger?await T.locator(C.selectors.submenuTrigger).count()>0:!1,D=s=>s.type==="aria-reference"&&[s.from,s.to].some(g=>["submenu","submenuTrigger","submenuItems"].includes(g||""))||s.type==="contains"&&[s.parent,s.child].some(g=>["submenu","submenuTrigger","submenuItems"].includes(g||"")),K=0,L=0,F=0;for(let s of C.relationships||[]){if(h&&typeof h.resetState=="function")try{await h.resetState(T);}catch(m){G.push(`Warning: resetState failed before relationship test: ${m instanceof Error?m.message:String(m)}`);}let g=Z(s.level);if(Array.isArray(s.setup)&&s.setup.length>0){let $=function(p){return w.includes(p)};var Fe=$;let m=new ne(T,C.selectors,z),R=s.type==="aria-reference"?`${s.from}.${s.attribute} references ${s.to}`:`${s.parent} contains ${s.child}`,w=["focus","type","click","keypress","hover"],v=p=>({...p,type:$(p.type)?p.type:"click"}),k=s.setup.map(v),E=await we(k,m,h,T,R,["submenu","submenuTrigger","submenuItems"]);if(E.skip){B.push(E.message||"Setup action skipped"),o.reportStaticTest(R,"skip",E.message,g);continue}if(!E.success){let p=`Relationship setup failed: ${E.error}`,u=M(p,s.level);u.status==="fail"&&(L+=1),u.status==="warn"&&(F+=1),o.reportStaticTest(R,u.status,u.detail,u.level);continue}}if(c==="menu"&&!J&&D(s)){let R=s.type==="aria-reference"?`${s.from}.${s.attribute} references ${s.to}`:`${s.parent} contains ${s.child}`,w="Skipping submenu relationship assertion: no submenu capability detected in rendered component.";B.push(w),o.reportStaticTest(R,"skip",w,g);continue}if(s.type==="aria-reference"){let m=`${s.from}.${s.attribute} references ${s.to}`,R=C.selectors[s.from],w=C.selectors[s.to];if(!R||!w){let d=M(`Relationship selector missing: from="${s.from}" or to="${s.to}" not found in selectors.`,s.level);d.status==="fail"&&(L+=1),d.status==="warn"&&(F+=1),o.reportStaticTest(m,d.status,d.detail,d.level);continue}let $=T.locator(R).first(),v=T.locator(w).first(),k=await $.count()>0,E=await v.count()>0;if(!k||!E){if(c==="menu"&&D(s)){let U="Skipping submenu relationship assertion in static phase: submenu elements are not present until submenu is opened.";B.push(U),o.reportStaticTest(m,"skip",U,g);continue}let d=M(`Relationship target not found: ${k?s.to:s.from}.`,s.level);d.status==="fail"&&(L+=1),d.status==="warn"&&(F+=1),o.reportStaticTest(m,d.status,d.detail,d.level);continue}let p=await $.getAttribute(s.attribute),u=await v.getAttribute("id");if(!u){let d=M(`Relationship target "${s.to}" must have an id for ${s.attribute} validation.`,s.level);d.status==="fail"&&(L+=1),d.status==="warn"&&(F+=1),o.reportStaticTest(m,d.status,d.detail,d.level);continue}if(!(p||"").split(/\s+/).filter(Boolean).includes(u)){let d=M(`Expected ${s.from} ${s.attribute} to reference id "${u}", found "${p||""}".`,s.level);d.status==="fail"&&(L+=1),d.status==="warn"&&(F+=1),o.reportStaticTest(m,d.status,d.detail,d.level);continue}N.push(`Relationship valid: ${s.from}.${s.attribute} -> ${s.to} (id=${u}).`),K+=1,o.reportStaticTest(m,"pass",void 0,g);continue}if(s.type==="contains"){let m=`${s.parent} contains ${s.child}`,R=C.selectors[s.parent],w=C.selectors[s.child];if(!R||!w){let p=M(`Relationship selector missing: parent="${s.parent}" or child="${s.child}" not found in selectors.`,s.level);p.status==="fail"&&(L+=1),p.status==="warn"&&(F+=1),o.reportStaticTest(m,p.status,p.detail,p.level);continue}let $=T.locator(R).first();if(!(await $.count()>0)){if(c==="menu"&&D(s)){let u="Skipping submenu relationship assertion in static phase: submenu container is not present until submenu is opened.";B.push(u),o.reportStaticTest(m,"skip",u,g);continue}let p=M(`Relationship parent target not found: ${s.parent}.`,s.level);p.status==="fail"&&(L+=1),p.status==="warn"&&(F+=1),o.reportStaticTest(m,p.status,p.detail,p.level);continue}if(await $.locator(w).count()<1){if(c==="menu"&&D(s)){let u="Skipping submenu relationship assertion in static phase: submenu descendants are not present until submenu is opened.";B.push(u),o.reportStaticTest(m,"skip",u,g);continue}let p=M(`Expected ${s.parent} to contain descendant matching selector for ${s.child}.`,s.level);p.status==="fail"&&(L+=1),p.status==="warn"&&(F+=1),o.reportStaticTest(m,p.status,p.detail,p.level);continue}N.push(`Relationship valid: ${s.parent} contains ${s.child}.`),K+=1,o.reportStaticTest(m,"pass",void 0,g);}}async function Ve(s,g,m,R={}){if(!s||typeof s!="object"||!("ref"in s))return s;let w;if(s.ref==="relative"){if(!s.relativeTarget||!R.relativeBaseSelector)return;let $=m.locator(R.relativeBaseSelector),v=await $.count(),k=0;if(s.relativeTarget==="first"?k=0:s.relativeTarget==="second"?k=1:s.relativeTarget==="last"?k=v-1:isNaN(Number(s.relativeTarget))?k=0:k=Number(s.relativeTarget),k<0||k>=v)return;let E=$.nth(k);return await Ue(E,s.property||s.attribute)}else {if(w=g[s.ref],!w)throw new Error(`Selector for ref '${s.ref}' not found in contract selectors.`);let $=m.locator(w).first();return await Ue($,s.property||s.attribute)}}async function Ue(s,g){if(s)return !g||g==="id"?await s.getAttribute("id")??void 0:g==="class"?await s.getAttribute("class")??void 0:g==="textContent"?await s.evaluate(m=>m.textContent??void 0):g.startsWith("aria-")?await s.getAttribute(g)??void 0:g.endsWith("*")?await s.evaluate(R=>{let w=[];for(let $ of Array.from(R.attributes))$.name.startsWith("aria-")&&w.push(`${$.name}=${$.value}`);return w.join(";")}):await s.getAttribute(g)??void 0}let yt=new le(T,C.selectors,ee);async function we(s,g,m,R,w,$=[]){if(!Array.isArray(s)||s.length===0)return {success:!0};m&&typeof m.resetState=="function"&&await m.resetState(R);for(let v of s){let k={success:!0};try{if(v.type==="focus")v.target==="relative"&&v.relativeTarget?k=await g.focus("relative",v.relativeTarget):k=await g.focus(v.target);else if(v.type==="type"&&v.value)k=await g.type(v.target,v.value);else if(v.type==="click")k=await g.click(v.target,v.relativeTarget);else if(v.type==="keypress"&&v.key)k=await g.keypress(v.target,v.key,v.relativeTarget);else if(v.type==="hover")k=await g.hover(v.target,v.relativeTarget);else continue}catch(E){k={success:!1,error:E instanceof Error?E.message:String(E)};}if(!k.success){let E=k.error||"Setup action failed";return $.some(u=>w.includes(u)||E.includes(u))?{success:!1,skip:!0,message:`Skipping test - capability not present: ${E}`}:{success:!1,error:E}}}return {success:!0}}for(let s of C.static[0]?.assertions||[]){if(h&&typeof h.resetState=="function")try{await h.resetState(T);}catch(p){G.push(`Warning: resetState failed before static test: ${p instanceof Error?p.message:String(p)}`);}if(s.target==="relative")continue;let g=`${s.target}${s.attribute?` (${s.attribute})`:""}`,m=Z(s.level);if(c==="menu"&&s.target==="submenuTrigger"&&!J){let p=`Skipping submenu static assertion for ${s.target}: no submenu capability detected in rendered component.`;B.push(p),o.reportStaticTest(g,"skip",p,m);continue}let R=[];if(s.target||R.push("target"),s.attribute||R.push("attribute"),typeof s.expectedValue>"u"&&R.push("expectedValue"),R.length>0){let p=`${s.target||""}${s.attribute?` (${s.attribute})`:""}`,u=`Static assertion missing required field(s): ${R.join(", ")}`,b=M(u,s.level);b.status==="fail"&&(L+=1),b.status==="warn"&&(F+=1),o.reportStaticTest(p,b.status,b.detail,b.level);continue}if(Array.isArray(s.setup)&&s.setup.length>0){let b=function(l){return u.includes(l)};var Fe=b;let p=new ne(T,C.selectors,z),u=["focus","type","click","keypress","hover"],W=l=>({...l,type:b(l.type)?l.type:"click"}),d=s.setup.map(W),U=await we(d,p,h,T,g,["submenu","submenuTrigger","submenuItems"]);if(U.skip){B.push(U.message||"Setup action skipped"),o.reportStaticTest(g,"skip",U.message,m);continue}if(!U.success){let l=`Static setup failed: ${U.error}`,A=M(l,s.level);A.status==="fail"&&(L+=1),A.status==="warn"&&(F+=1),o.reportStaticTest(g,A.status,A.detail,A.level);continue}}let w=C.selectors[s.target];if(!w){let p=`Selector for target ${s.target} not found.`,u=M(p,s.level);u.status==="fail"&&(L+=1),u.status==="warn"&&(F+=1),o.reportStaticTest(g,u.status,u.detail,u.level);continue}let $=T.locator(w).first();if(!(await $.count()>0)){let p=`Target ${s.target} not found.`,u=M(p,s.level);u.status==="fail"&&(L+=1),u.status==="warn"&&(F+=1),o.reportStaticTest(g,u.status,u.detail,u.level);continue}let k=(p,u,b)=>{let W=new RegExp(`\\[${u}(?:=["']?([^\\]"']+)["']?)?\\]`),d=p.match(W);if(!d)return !1;if(!b)return !0;let U=d[1];return U?b.split(" | ").includes(U):!1},E=s.expectedValue;if(s.expectedValue&&typeof s.expectedValue=="object"&&"ref"in s.expectedValue){let p={},u=s.relativeTarget;if(s.expectedValue.ref==="relative"&&s.target==="relative"&&u){let b=C.selectors[u];if(!b)throw new Error(`Selector for relativeTarget '${u}' not found in contract selectors.`);p.relativeBaseSelector=b;}else if(s.expectedValue.ref==="relative"&&u){let b=C.selectors[u];if(!b)throw new Error(`Selector for relativeTarget '${u}' not found in contract selectors.`);p.relativeBaseSelector=b;}E=await Ve(s.expectedValue,C.selectors,T,p);}if(s.expectedValue)if(k(w,s.attribute,typeof E=="string"?E:void 0))N.push(`${s.attribute}="${E}" on ${s.target} verified by selector (already present in: ${w}).`),K+=1,o.reportStaticTest(g,"pass",void 0,m);else {let p=E??"",u=await yt.validateAttribute($,s.target,s.attribute,p,s.failureMessage,"Static ARIA Test");if(u.success&&u.passMessage)N.push(u.passMessage),K+=1,o.reportStaticTest(g,"pass",void 0,m);else if(!u.success&&u.failMessage){let b=M(u.failMessage,s.level);b.status==="fail"&&(L+=1),b.status==="warn"&&(F+=1),o.reportStaticTest(g,b.status,b.detail,b.level);}}else {let p=s.attribute.split(" | "),u=!1,b=!0;for(let W of p){let d=W.trim();if(k(w,d)){N.push(`${d} on ${s.target} verified by selector (already present in: ${w}).`),u=!0;continue}if(b=!1,await $.getAttribute(d)!==null){u=!0;break}}if(!u&&!b){let W=s.failureMessage+` None of the attributes "${s.attribute}" are present.`,d=M(W,s.level);d.status==="fail"&&(L+=1),d.status==="warn"&&(F+=1),o.reportStaticTest(g,d.status,d.detail,d.level);}else !b&&u?(N.push(`At least one of the attributes "${s.attribute}" exists on the element.`),K+=1,o.reportStaticTest(g,"pass",void 0,m)):(K+=1,o.reportStaticTest(g,"pass",void 0,m));}}for(let s of C.dynamic||[]){if(!s.assertions||s.assertions.length===0){let l="Skipping test - no assertions found for this dynamic test.";B.push(l),o.reportTest({description:s.description,level:Z(s.level)},"skip",l);continue}if(!T||T.isClosed()){console.warn(`
36
+ - Original error: ${s}`)}o.start(c,mt,ht),c==="menu"&&C.selectors.main&&await T.locator(C.selectors.main).first().waitFor({state:"visible",timeout:ye}).catch(()=>{});let J=c==="menu"&&C.selectors.submenuTrigger?await T.locator(C.selectors.submenuTrigger).count()>0:!1,D=s=>s.type==="aria-reference"&&[s.from,s.to].some(g=>["submenu","submenuTrigger","submenuItems"].includes(g||""))||s.type==="contains"&&[s.parent,s.child].some(g=>["submenu","submenuTrigger","submenuItems"].includes(g||"")),K=0,L=0,F=0;for(let s of C.relationships||[]){if(h&&typeof h.resetState=="function")try{await h.resetState(T);}catch(m){G.push(`Warning: resetState failed before relationship test: ${m instanceof Error?m.message:String(m)}`);}let g=Z(s.level);if(Array.isArray(s.setup)&&s.setup.length>0){let $=function(p){return v.includes(p)};var Fe=$;let m=new ne(T,C.selectors,z),R=s.type==="aria-reference"?`${s.from}.${s.attribute} references ${s.to}`:`${s.parent} contains ${s.child}`,v=["focus","type","click","keypress","hover"],w=p=>({...p,type:$(p.type)?p.type:"click"}),k=s.setup.map(w),E=await ve(k,m,h,T,R,["submenu","submenuTrigger","submenuItems"]);if(E.skip){B.push(E.message||"Setup action skipped"),o.reportStaticTest(R,"skip",E.message,g);continue}if(!E.success){let p=`Relationship setup failed: ${E.error}`,u=M(p,s.level);u.status==="fail"&&(L+=1),u.status==="warn"&&(F+=1),o.reportStaticTest(R,u.status,u.detail,u.level);continue}}if(c==="menu"&&!J&&D(s)){let R=s.type==="aria-reference"?`${s.from}.${s.attribute} references ${s.to}`:`${s.parent} contains ${s.child}`,v="Skipping submenu relationship assertion: no submenu capability detected in rendered component.";B.push(v),o.reportStaticTest(R,"skip",v,g);continue}if(s.type==="aria-reference"){let m=`${s.from}.${s.attribute} references ${s.to}`,R=C.selectors[s.from],v=C.selectors[s.to];if(!R||!v){let d=M(`Relationship selector missing: from="${s.from}" or to="${s.to}" not found in selectors.`,s.level);d.status==="fail"&&(L+=1),d.status==="warn"&&(F+=1),o.reportStaticTest(m,d.status,d.detail,d.level);continue}let $=T.locator(R).first(),w=T.locator(v).first(),k=await $.count()>0,E=await w.count()>0;if(!k||!E){if(c==="menu"&&D(s)){let U="Skipping submenu relationship assertion in static phase: submenu elements are not present until submenu is opened.";B.push(U),o.reportStaticTest(m,"skip",U,g);continue}let d=M(`Relationship target not found: ${k?s.to:s.from}.`,s.level);d.status==="fail"&&(L+=1),d.status==="warn"&&(F+=1),o.reportStaticTest(m,d.status,d.detail,d.level);continue}let p=await $.getAttribute(s.attribute),u=await w.getAttribute("id");if(!u){let d=M(`Relationship target "${s.to}" must have an id for ${s.attribute} validation.`,s.level);d.status==="fail"&&(L+=1),d.status==="warn"&&(F+=1),o.reportStaticTest(m,d.status,d.detail,d.level);continue}if(!(p||"").split(/\s+/).filter(Boolean).includes(u)){let d=M(`Expected ${s.from} ${s.attribute} to reference id "${u}", found "${p||""}".`,s.level);d.status==="fail"&&(L+=1),d.status==="warn"&&(F+=1),o.reportStaticTest(m,d.status,d.detail,d.level);continue}N.push(`Relationship valid: ${s.from}.${s.attribute} -> ${s.to} (id=${u}).`),K+=1,o.reportStaticTest(m,"pass",void 0,g);continue}if(s.type==="contains"){let m=`${s.parent} contains ${s.child}`,R=C.selectors[s.parent],v=C.selectors[s.child];if(!R||!v){let p=M(`Relationship selector missing: parent="${s.parent}" or child="${s.child}" not found in selectors.`,s.level);p.status==="fail"&&(L+=1),p.status==="warn"&&(F+=1),o.reportStaticTest(m,p.status,p.detail,p.level);continue}let $=T.locator(R).first();if(!(await $.count()>0)){if(c==="menu"&&D(s)){let u="Skipping submenu relationship assertion in static phase: submenu container is not present until submenu is opened.";B.push(u),o.reportStaticTest(m,"skip",u,g);continue}let p=M(`Relationship parent target not found: ${s.parent}.`,s.level);p.status==="fail"&&(L+=1),p.status==="warn"&&(F+=1),o.reportStaticTest(m,p.status,p.detail,p.level);continue}if(await $.locator(v).count()<1){if(c==="menu"&&D(s)){let u="Skipping submenu relationship assertion in static phase: submenu descendants are not present until submenu is opened.";B.push(u),o.reportStaticTest(m,"skip",u,g);continue}let p=M(`Expected ${s.parent} to contain descendant matching selector for ${s.child}.`,s.level);p.status==="fail"&&(L+=1),p.status==="warn"&&(F+=1),o.reportStaticTest(m,p.status,p.detail,p.level);continue}N.push(`Relationship valid: ${s.parent} contains ${s.child}.`),K+=1,o.reportStaticTest(m,"pass",void 0,g);}}async function Ve(s,g,m,R={}){if(!s||typeof s!="object"||!("ref"in s))return s;let v;if(s.ref==="relative"){if(!s.relativeTarget||!R.relativeBaseSelector)return;let $=m.locator(R.relativeBaseSelector),w=await $.count(),k=0;if(s.relativeTarget==="first"?k=0:s.relativeTarget==="second"?k=1:s.relativeTarget==="last"?k=w-1:isNaN(Number(s.relativeTarget))?k=0:k=Number(s.relativeTarget),k<0||k>=w)return;let E=$.nth(k);return await Ue(E,s.property||s.attribute)}else {if(v=g[s.ref],!v)throw new Error(`Selector for ref '${s.ref}' not found in contract selectors.`);let $=m.locator(v).first();return await Ue($,s.property||s.attribute)}}async function Ue(s,g){if(s)return !g||g==="id"?await s.getAttribute("id")??void 0:g==="class"?await s.getAttribute("class")??void 0:g==="textContent"?await s.evaluate(m=>m.textContent??void 0):g.startsWith("aria-")?await s.getAttribute(g)??void 0:g.endsWith("*")?await s.evaluate(R=>{let v=[];for(let $ of Array.from(R.attributes))$.name.startsWith("aria-")&&v.push(`${$.name}=${$.value}`);return v.join(";")}):await s.getAttribute(g)??void 0}let yt=new le(T,C.selectors,ee);async function ve(s,g,m,R,v,$=[]){if(!Array.isArray(s)||s.length===0)return {success:!0};m&&typeof m.resetState=="function"&&await m.resetState(R);for(let w of s){let k={success:!0};try{if(w.type==="focus")w.target==="relative"&&w.relativeTarget?k=await g.focus("relative",w.relativeTarget):k=await g.focus(w.target);else if(w.type==="type"&&w.value)k=await g.type(w.target,w.value);else if(w.type==="click")k=await g.click(w.target,w.relativeTarget);else if(w.type==="keypress"&&w.key)k=await g.keypress(w.target,w.key,w.relativeTarget);else if(w.type==="hover")k=await g.hover(w.target,w.relativeTarget);else continue}catch(E){k={success:!1,error:E instanceof Error?E.message:String(E)};}if(!k.success){let E=k.error||"Setup action failed";return $.some(u=>v.includes(u)||E.includes(u))?{success:!1,skip:!0,message:`Skipping test - capability not present: ${E}`}:{success:!1,error:E}}}return {success:!0}}for(let s of C.static||[]){if(h&&typeof h.resetState=="function")try{await h.resetState(T);}catch(p){G.push(`Warning: resetState failed before static test: ${p instanceof Error?p.message:String(p)}`);}if(s.target==="relative")continue;let g=`${s.target}${s.attribute?` (${s.attribute})`:""}`,m=Z(s.level);if(c==="menu"&&s.target==="submenuTrigger"&&!J){let p=`Skipping submenu static assertion for ${s.target}: no submenu capability detected in rendered component.`;B.push(p),o.reportStaticTest(g,"skip",p,m);continue}let R=[];if(s.target||R.push("target"),s.attribute||R.push("attribute"),typeof s.expectedValue>"u"&&R.push("expectedValue"),R.length>0){let p=`${s.target||""}${s.attribute?` (${s.attribute})`:""}`,u=`Static assertion missing required field(s): ${R.join(", ")}`,b=M(u,s.level);b.status==="fail"&&(L+=1),b.status==="warn"&&(F+=1),o.reportStaticTest(p,b.status,b.detail,b.level);continue}if(Array.isArray(s.setup)&&s.setup.length>0){let b=function(l){return u.includes(l)};var Fe=b;let p=new ne(T,C.selectors,z),u=["focus","type","click","keypress","hover"],W=l=>({...l,type:b(l.type)?l.type:"click"}),d=s.setup.map(W),U=await ve(d,p,h,T,g,["submenu","submenuTrigger","submenuItems"]);if(U.skip){B.push(U.message||"Setup action skipped"),o.reportStaticTest(g,"skip",U.message,m);continue}if(!U.success){let l=`Static setup failed: ${U.error}`,A=M(l,s.level);A.status==="fail"&&(L+=1),A.status==="warn"&&(F+=1),o.reportStaticTest(g,A.status,A.detail,A.level);continue}}let v=C.selectors[s.target];if(!v){let p=`Selector for target ${s.target} not found.`,u=M(p,s.level);u.status==="fail"&&(L+=1),u.status==="warn"&&(F+=1),o.reportStaticTest(g,u.status,u.detail,u.level);continue}let $=T.locator(v).first();if(!(await $.count()>0)){let p=`Target ${s.target} not found.`,u=M(p,s.level);u.status==="fail"&&(L+=1),u.status==="warn"&&(F+=1),o.reportStaticTest(g,u.status,u.detail,u.level);continue}let k=(p,u,b)=>{let W=new RegExp(`\\[${u}(?:=["']?([^\\]"']+)["']?)?\\]`),d=p.match(W);if(!d)return !1;if(!b)return !0;let U=d[1];return U?b.split(" | ").includes(U):!1},E=s.expectedValue;if(s.expectedValue&&typeof s.expectedValue=="object"&&"ref"in s.expectedValue){let p={},u=s.relativeTarget;if(s.expectedValue.ref==="relative"&&s.target==="relative"&&u){let b=C.selectors[u];if(!b)throw new Error(`Selector for relativeTarget '${u}' not found in contract selectors.`);p.relativeBaseSelector=b;}else if(s.expectedValue.ref==="relative"&&u){let b=C.selectors[u];if(!b)throw new Error(`Selector for relativeTarget '${u}' not found in contract selectors.`);p.relativeBaseSelector=b;}E=await Ve(s.expectedValue,C.selectors,T,p);}if(s.expectedValue)if(k(v,s.attribute,typeof E=="string"?E:void 0))N.push(`${s.attribute}="${E}" on ${s.target} verified by selector (already present in: ${v}).`),K+=1,o.reportStaticTest(g,"pass",void 0,m);else {let p=E??"",u=await yt.validateAttribute($,s.target,s.attribute,p,s.failureMessage,"Static ARIA Test");if(u.success&&u.passMessage)N.push(u.passMessage),K+=1,o.reportStaticTest(g,"pass",void 0,m);else if(!u.success&&u.failMessage){let b=M(u.failMessage,s.level);b.status==="fail"&&(L+=1),b.status==="warn"&&(F+=1),o.reportStaticTest(g,b.status,b.detail,b.level);}}else {let p=s.attribute.split(" | "),u=!1,b=!0;for(let W of p){let d=W.trim();if(k(v,d)){N.push(`${d} on ${s.target} verified by selector (already present in: ${v}).`),u=!0;continue}if(b=!1,await $.getAttribute(d)!==null){u=!0;break}}if(!u&&!b){let W=s.failureMessage+` None of the attributes "${s.attribute}" are present.`,d=M(W,s.level);d.status==="fail"&&(L+=1),d.status==="warn"&&(F+=1),o.reportStaticTest(g,d.status,d.detail,d.level);}else !b&&u?(N.push(`At least one of the attributes "${s.attribute}" exists on the element.`),K+=1,o.reportStaticTest(g,"pass",void 0,m)):(K+=1,o.reportStaticTest(g,"pass",void 0,m));}}for(let s of C.dynamic||[]){if(!s.assertions||s.assertions.length===0){let l="Skipping test - no assertions found for this dynamic test.";B.push(l),o.reportTest({description:s.description,level:Z(s.level)},"skip",l);continue}if(!T||T.isClosed()){console.warn(`
37
37
  \u26A0\uFE0F Browser closed - skipping remaining ${C.dynamic.length-C.dynamic.indexOf(s)} tests
38
- `),H.push(`CRITICAL: Browser/page closed before completing all tests. ${C.dynamic.length-C.dynamic.indexOf(s)} tests skipped.`);break}try{await h.resetState(T);}catch(l){let A=l instanceof Error?l.message:String(l);throw o.error(A),l}let{setup:g=[],action:m,assertions:R}=s,w=Z(s.level),$=new ne(T,C.selectors,z);if(Array.isArray(g)&&g.length>0){let A=function(j){return l.includes(j)};var Fe=A;let l=["focus","type","click","keypress","hover"],se=j=>({...j,type:A(j.type)?j.type:"click"}),ve=g.map(se),q=await we(ve,$,h,T,s.description,["submenu","submenuTrigger","submenuItems"]);if(q.skip){B.push(q.message||"Setup action skipped"),o.reportTest({description:s.description,level:w},"skip",q.message);continue}if(!q.success){let j=M(`Setup failed: ${q.error}`,s.level);o.reportTest({description:s.description,level:w},j.status,j.detail);continue}}let v=H.length,k=G.length,E=B.length;if(await h.shouldSkipTest(s,T)){let l="Skipping test - component-specific conditions not met";B.push(l),o.reportTest({description:s.description,level:w},"skip",l);continue}let u=new le(T,C.selectors,ee),b=!1,W=null;for(let l of m){if(!T||T.isClosed()){H.push("CRITICAL: Browser/page closed during test execution. Remaining actions skipped."),b=!0;break}let A;if(l.type==="focus")l.target==="relative"&&l.relativeTarget?A=await $.focus("relative",l.relativeTarget):A=await $.focus(l.target);else if(l.type==="type"&&l.value)A=await $.type(l.target,l.value);else if(l.type==="click")A=await $.click(l.target,l.relativeTarget);else if(l.type==="keypress"&&l.key)A=await $.keypress(l.target,l.key,l.relativeTarget);else if(l.type==="hover")A=await $.hover(l.target,l.relativeTarget);else continue;if(!A.success){if(A.error){let se=M(A.error,s.level);W={status:se.status,detail:se.detail};}b=!0;break}}if(b){o.reportTest({description:s.description,level:w},W?.status||"fail",W?.detail||H[H.length-1]);continue}for(let l of R){let A;if(l.expectedValue&&typeof l.expectedValue=="object"&&"ref"in l.expectedValue)if(l.expectedValue.ref==="relative"){let{RelativeTargetResolver:Y}=await Promise.resolve().then(()=>(me(),nt)),j=C.selectors.relative;if(!j)throw new Error("Relative selector not defined in contract selectors.");let ae=l.relativeTarget||"first",X=await Y.resolve(T,j,ae);if(!X)throw new Error(`Could not resolve relative target '${ae}' for expectedValue.`);let He=l.expectedValue.property||l.expectedValue.attribute||"id";if(He==="textContent")A=await X.evaluate(pe=>pe.textContent??void 0);else {let pe=await X.getAttribute(He);A=pe===null?void 0:pe;}}else A=await Ve(l.expectedValue,C.selectors,T,{});else typeof l.expectedValue=="string"||typeof l.expectedValue>"u"?A=l.expectedValue:A="";let se={...l,expectedValue:A},ve=A??"",q=await u.validate({...se,expectedValue:ve},s.description);if(q.success&&q.passMessage)N.push(q.passMessage);else if(!q.success&&q.failMessage){let Y=[];if(l.target||Y.push("target"),l.assertion||Y.push("assertion"),["toHaveAttribute","toHaveValue","toHaveRole"].includes(l.assertion)&&(typeof l.attribute>"u"&&l.assertion==="toHaveAttribute"&&Y.push("attribute"),typeof l.expectedValue>"u"&&Y.push("expectedValue")),Y.length>0){let j=Z(l.level||s.level),ae=`Dynamic assertion missing required field(s): ${Y.join(", ")}`,X=M(ae,j);if(X.status==="skip")continue;H.push(ae),o.reportTest({description:s.description,level:j},X.status,X.detail);continue}}}let d=H.length,U=G.length,je=B.length;d>v?o.reportTest({description:s.description,level:w},"fail",H[H.length-1]):U>k?o.reportTest({description:s.description,level:w},"warn",G[G.length-1]):je>E?o.reportTest({description:s.description,level:w},"skip",B[B.length-1]):o.reportTest({description:s.description,level:w},"pass");}o.reportStatic(K,L,F),o.summary(H);}catch(h){if(h instanceof Error)throw h.message.includes("Executable doesn't exist")||h.message.includes("browserType.launch")?new Error(`
38
+ `),H.push(`CRITICAL: Browser/page closed before completing all tests. ${C.dynamic.length-C.dynamic.indexOf(s)} tests skipped.`);break}try{await h.resetState(T);}catch(l){let A=l instanceof Error?l.message:String(l);throw o.error(A),l}let{setup:g=[],action:m,assertions:R}=s,v=Z(s.level),$=new ne(T,C.selectors,z);if(Array.isArray(g)&&g.length>0){let A=function(j){return l.includes(j)};var Fe=A;let l=["focus","type","click","keypress","hover"],se=j=>({...j,type:A(j.type)?j.type:"click"}),we=g.map(se),q=await ve(we,$,h,T,s.description,["submenu","submenuTrigger","submenuItems"]);if(q.skip){B.push(q.message||"Setup action skipped"),o.reportTest({description:s.description,level:v},"skip",q.message);continue}if(!q.success){let j=M(`Setup failed: ${q.error}`,s.level);o.reportTest({description:s.description,level:v},j.status,j.detail);continue}}let w=H.length,k=G.length,E=B.length;if(await h.shouldSkipTest(s,T)){let l="Skipping test - component-specific conditions not met";B.push(l),o.reportTest({description:s.description,level:v},"skip",l);continue}let u=new le(T,C.selectors,ee),b=!1,W=null;for(let l of m){if(!T||T.isClosed()){H.push("CRITICAL: Browser/page closed during test execution. Remaining actions skipped."),b=!0;break}let A;if(l.type==="focus")l.target==="relative"&&l.relativeTarget?A=await $.focus("relative",l.relativeTarget):A=await $.focus(l.target);else if(l.type==="type"&&l.value)A=await $.type(l.target,l.value);else if(l.type==="click")A=await $.click(l.target,l.relativeTarget);else if(l.type==="keypress"&&l.key)A=await $.keypress(l.target,l.key,l.relativeTarget);else if(l.type==="hover")A=await $.hover(l.target,l.relativeTarget);else continue;if(!A.success){if(A.error){let se=M(A.error,s.level);W={status:se.status,detail:se.detail};}b=!0;break}}if(b){o.reportTest({description:s.description,level:v},W?.status||"fail",W?.detail||H[H.length-1]);continue}for(let l of R){let A;if(l.expectedValue&&typeof l.expectedValue=="object"&&"ref"in l.expectedValue)if(l.expectedValue.ref==="relative"){let{RelativeTargetResolver:Y}=await Promise.resolve().then(()=>(me(),nt)),j=C.selectors.relative;if(!j)throw new Error("Relative selector not defined in contract selectors.");let ae=l.relativeTarget||"first",X=await Y.resolve(T,j,ae);if(!X)throw new Error(`Could not resolve relative target '${ae}' for expectedValue.`);let He=l.expectedValue.property||l.expectedValue.attribute||"id";if(He==="textContent")A=await X.evaluate(pe=>pe.textContent??void 0);else {let pe=await X.getAttribute(He);A=pe===null?void 0:pe;}}else A=await Ve(l.expectedValue,C.selectors,T,{});else typeof l.expectedValue=="string"||typeof l.expectedValue>"u"?A=l.expectedValue:A="";let se={...l,expectedValue:A},we=A??"",q=await u.validate({...se,expectedValue:we},s.description);if(q.success&&q.passMessage)N.push(q.passMessage);else if(!q.success&&q.failMessage){let Y=[];if(l.target||Y.push("target"),l.assertion||Y.push("assertion"),["toHaveAttribute","toHaveValue","toHaveRole"].includes(l.assertion)&&(typeof l.attribute>"u"&&l.assertion==="toHaveAttribute"&&Y.push("attribute"),typeof l.expectedValue>"u"&&Y.push("expectedValue")),Y.length>0){let j=Z(l.level||s.level),ae=`Dynamic assertion missing required field(s): ${Y.join(", ")}`,X=M(ae,j);if(X.status==="skip")continue;H.push(ae),o.reportTest({description:s.description,level:j},X.status,X.detail);continue}}}let d=H.length,U=G.length,je=B.length;d>w?o.reportTest({description:s.description,level:v},"fail",H[H.length-1]):U>k?o.reportTest({description:s.description,level:v},"warn",G[G.length-1]):je>E?o.reportTest({description:s.description,level:v},"skip",B[B.length-1]):o.reportTest({description:s.description,level:v},"pass");}o.reportStatic(K,L,F),o.summary(H);}catch(h){if(h instanceof Error)throw h.message.includes("Executable doesn't exist")||h.message.includes("browserType.launch")?new Error(`
39
39
  \u274C CRITICAL: Playwright browsers not found!
40
40
  \u{1F4E6} Run: npx playwright install chromium`):h.message.includes("net::ERR_CONNECTION_REFUSED")||h.message.includes("NS_ERROR_CONNECTION_REFUSED")?new Error(`
41
41
  \u274C CRITICAL: Cannot connect to dev server!
@@ -1,4 +1,4 @@
1
- import {d,b}from'./chunk-APUMBDOT.js';import m from'path';async function y(a,e,c={}){if(!a||typeof a!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!e)throw new Error("\u274C testUiComponent requires a URL");if(e&&typeof e!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let i={violations:[]};async function l(t){try{let n=await fetch(t,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(n.ok||n.status===304)return t}catch{return null}return null}let p=d(c.strictness),o={},d$1=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:t}=await import('./configLoader-NCYRL2O6.js'),n=await t(process.cwd());if(o=n.config,n.configPath&&(d$1=m.dirname(n.configPath)),c.strictness===void 0){let r=o.test?.components?.find(h=>h?.name===a)?.strictness;p=d(r??o.test?.strictness);}}catch{c.strictness===void 0&&(p="balanced");}let s;try{if(e){let t=await l(e);if(t){console.log(`\u{1F3AD} Running Playwright tests on ${t}`);let{runContractTestsPlaywright:n}=await import('./contractTestRunnerPlaywright-VALOFEZZ.js');s=await n(a,t,p,o,d$1);}else throw new Error(`\u274C Dev server not running at ${e}
1
+ import {d,b}from'./chunk-APUMBDOT.js';import m from'path';async function y(a,e,c={}){if(!a||typeof a!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!e)throw new Error("\u274C testUiComponent requires a URL");if(e&&typeof e!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let i={violations:[]};async function l(t){try{let n=await fetch(t,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(n.ok||n.status===304)return t}catch{return null}return null}let p=d(c.strictness),o={},d$1=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:t}=await import('./configLoader-NCYRL2O6.js'),n=await t(process.cwd());if(o=n.config,n.configPath&&(d$1=m.dirname(n.configPath)),c.strictness===void 0){let r=o.test?.components?.find(h=>h?.name===a)?.strictness;p=d(r??o.test?.strictness);}}catch{c.strictness===void 0&&(p="balanced");}let s;try{if(e){let t=await l(e);if(t){console.log(`\u{1F3AD} Running Playwright tests on ${t}`);let{runContractTestsPlaywright:n}=await import('./contractTestRunnerPlaywright-Y7N2W6AK.js');s=await n(a,t,p,o,d$1);}else throw new Error(`\u274C Dev server not running at ${e}
2
2
  Please start your dev server and try again.`)}else throw new Error("\u274C URL is required for component testing. Please provide a URL to run full accessibility tests with testUiComponent.")}catch(t){throw t instanceof Error?t:new Error(`\u274C Contract test execution failed: ${String(t)}`)}let u={violations:i.violations,raw:i,contract:s};if(s.failures.length>0&&e==="Playwright")throw new Error(`
3
3
  \u274C ${s.failures.length} accessibility contract test${s.failures.length>1?"s":""} failed (Playwright mode)
4
4
  \u2705 ${s.passes.length} test${s.passes.length>1?"s":""} passed
@@ -1,4 +1,4 @@
1
- import{b as g,d as f}from"./chunk-APUMBDOT.js";import"./chunk-CNU4N4AY.js";import m from"path";async function y(a,e,c={}){if(!a||typeof a!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!e)throw new Error("\u274C testUiComponent requires a URL");if(e&&typeof e!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let i={violations:[]};async function l(t){try{let n=await fetch(t,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(n.ok||n.status===304)return t}catch{return null}return null}let p=f(c.strictness),o={},d=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:t}=await import("./configLoader-ZXTSCIP6.js"),n=await t(process.cwd());if(o=n.config,n.configPath&&(d=m.dirname(n.configPath)),c.strictness===void 0){let r=o.test?.components?.find(h=>h?.name===a)?.strictness;p=f(r??o.test?.strictness)}}catch{c.strictness===void 0&&(p="balanced")}let s;try{if(e){let t=await l(e);if(t){console.log(`\u{1F3AD} Running Playwright tests on ${t}`);let{runContractTestsPlaywright:n}=await import("./contractTestRunnerPlaywright-IUUAGMXP.js");s=await n(a,t,p,o,d)}else throw new Error(`\u274C Dev server not running at ${e}
1
+ import{b as g,d as f}from"./chunk-APUMBDOT.js";import"./chunk-CNU4N4AY.js";import m from"path";async function y(a,e,c={}){if(!a||typeof a!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!e)throw new Error("\u274C testUiComponent requires a URL");if(e&&typeof e!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let i={violations:[]};async function l(t){try{let n=await fetch(t,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(n.ok||n.status===304)return t}catch{return null}return null}let p=f(c.strictness),o={},d=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:t}=await import("./configLoader-ZXTSCIP6.js"),n=await t(process.cwd());if(o=n.config,n.configPath&&(d=m.dirname(n.configPath)),c.strictness===void 0){let r=o.test?.components?.find(h=>h?.name===a)?.strictness;p=f(r??o.test?.strictness)}}catch{c.strictness===void 0&&(p="balanced")}let s;try{if(e){let t=await l(e);if(t){console.log(`\u{1F3AD} Running Playwright tests on ${t}`);let{runContractTestsPlaywright:n}=await import("./contractTestRunnerPlaywright-SJIHHZ3Y.js");s=await n(a,t,p,o,d)}else throw new Error(`\u274C Dev server not running at ${e}
2
2
  Please start your dev server and try again.`)}else throw new Error("\u274C URL is required for component testing. Please provide a URL to run full accessibility tests with testUiComponent.")}catch(t){throw t instanceof Error?t:new Error(`\u274C Contract test execution failed: ${String(t)}`)}let u={violations:i.violations,raw:i,contract:s};if(s.failures.length>0&&e==="Playwright")throw new Error(`
3
3
  \u274C ${s.failures.length} accessibility contract test${s.failures.length>1?"s":""} failed (Playwright mode)
4
4
  \u2705 ${s.passes.length} test${s.passes.length>1?"s":""} passed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aria-ease",
3
- "version": "7.1.0",
3
+ "version": "7.3.0",
4
4
  "description": "Accessibility infrastructure for the entire frontend engineering lifecycle. Build accessible patterns, run automated audits, verify component interactions, and gate deployments — all in one system.",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- import{a as o}from"./chunk-SM6ZKEDR.js";import"./chunk-CNU4N4AY.js";var n=class{constructor(t,e,i=400,s=400){this.mainSelector=t;this.selectors=e;this.actionTimeoutMs=i;this.assertionTimeoutMs=s}async resetState(t){if(!this.selectors.panel||!this.selectors.trigger||this.selectors.popup)return;let e=this.selectors.trigger,i=this.selectors.panel;if(!e||!i)return;let s=await t.locator(e).all();for(let r of s){let c=await r.getAttribute("aria-expanded")==="true",a=await r.getAttribute("aria-controls");if(c&&a){await r.click({timeout:this.actionTimeoutMs});let l=t.locator(`#${a}`);await(0,o.expect)(l).toBeHidden({timeout:this.assertionTimeoutMs}).catch(()=>{})}}}async shouldSkipTest(){return!1}getMainSelector(){return this.mainSelector}};export{n as AccordionComponentStrategy};
@@ -1,5 +0,0 @@
1
- import{a as i}from"./chunk-SM6ZKEDR.js";import"./chunk-CNU4N4AY.js";var n=class{constructor(t,r,o=400,c=400){this.mainSelector=t;this.selectors=r;this.actionTimeoutMs=o;this.assertionTimeoutMs=c}async resetState(t){if(!this.selectors.popup)return;let r=this.selectors.popup,o=t.locator(r).first();if(!await o.isVisible().catch(()=>!1))return;let e=!1,s=this.selectors.input;if(!s&&this.selectors.focusable?s=this.selectors.focusable:s||(s=this.selectors.button),s&&(await t.locator(s).first().focus(),await t.keyboard.press("Escape"),e=await(0,i.expect)(o).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!e&&this.selectors.button&&(await t.locator(this.selectors.button).first().click({timeout:this.actionTimeoutMs}),e=await(0,i.expect)(o).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),e||(await t.mouse.click(10,10),e=await(0,i.expect)(o).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!e)throw new Error(`\u274C FATAL: Cannot close combobox popup between tests. Popup remains visible after trying:
2
- 1. Escape key
3
- 2. Clicking button
4
- 3. Clicking outside
5
- This indicates a problem with the combobox component's close functionality.`);this.selectors.input&&await t.locator(this.selectors.input).first().clear()}async shouldSkipTest(){return!1}getMainSelector(){return this.mainSelector}};export{n as ComboboxComponentStrategy};
@@ -1,5 +0,0 @@
1
- import{a as r}from"./chunk-SM6ZKEDR.js";import"./chunk-CNU4N4AY.js";var c=class{constructor(t,o,i=400,n=400){this.mainSelector=t;this.selectors=o;this.actionTimeoutMs=i;this.assertionTimeoutMs=n}async resetState(t){if(!this.selectors.popup)return;let o=this.selectors.popup,i=t.locator(o).first();if(!await i.isVisible().catch(()=>!1))return;let s=!1,e=this.selectors.input;if(!e&&this.selectors.focusable?e=this.selectors.focusable:e||(e=this.selectors.main),e&&(await t.locator(e).first().focus(),await t.keyboard.press("Escape"),s=await(0,r.expect)(i).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!s&&this.selectors.main&&(await t.locator(this.selectors.main).first().click({timeout:this.actionTimeoutMs}),s=await(0,r.expect)(i).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),s||(await t.mouse.click(10,10),s=await(0,r.expect)(i).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!s)throw new Error(`\u274C FATAL: Cannot close menu between tests. Menu remains visible after trying:
2
- 1. Escape key
3
- 2. Clicking trigger
4
- 3. Clicking outside
5
- This indicates a problem with the menu component's close functionality.`);this.selectors.input&&await t.locator(this.selectors.input).first().clear(),this.selectors.main&&await t.locator(this.selectors.main).first().focus()}async shouldSkipTest(t,o){if(!(t.action.some(e=>e.target==="submenu"||e.target==="submenuTrigger"||e.target==="submenuItems")||t.assertions.some(e=>e.target==="submenu"||e.target==="submenuTrigger"||e.target==="submenuItems")))return!1;let n=this.selectors.submenuTrigger;return n?await o.locator(n).count()===0:!0}getMainSelector(){return this.mainSelector}};export{c as MenuComponentStrategy};
@@ -1,13 +0,0 @@
1
- import"./chunk-CNU4N4AY.js";import g from"path";import v from"fs-extra";import{glob as q}from"fs/promises";import l from"chalk";function E(f){let e=[];if(!f||typeof f!="object")return{valid:!1,errors:[{path:"$",message:"Contract must be an object"}]};let r=f;if(!r.selectors)e.push({path:"$.selectors",message:"selectors is required"});else if(typeof r.selectors!="object"||r.selectors===null||Array.isArray(r.selectors))e.push({path:"$.selectors",message:"selectors must be an object"});else{let o=r.selectors;Object.entries(o).forEach(([s,a])=>{typeof a!="string"&&e.push({path:`$.selectors['${s}']`,message:"All selectors must be strings"})})}return Array.isArray(r.static)?r.static.forEach((o,s)=>{if(typeof o!="object"||o===null){e.push({path:`$.static[${s}]`,message:"static item must be an object"});return}let a=o;if(!Array.isArray(a.assertions)){e.push({path:`$.static[${s}].assertions`,message:"assertions must be an array"});return}a.assertions.forEach((n,i)=>{if(typeof n!="object"||n===null){e.push({path:`$.static[${s}].assertions[${i}]`,message:"assertion must be an object"});return}let t=n;typeof t.target!="string"&&e.push({path:`$.static[${s}].assertions[${i}].target`,message:"target is required and must be a string"}),typeof t.attribute!="string"&&e.push({path:`$.static[${s}].assertions[${i}].attribute`,message:"attribute is required and must be a string"}),typeof t.failureMessage!="string"&&e.push({path:`$.static[${s}].assertions[${i}].failureMessage`,message:"failureMessage is required and must be a string"}),t.level!==void 0&&!["required","recommended","optional"].includes(t.level)&&e.push({path:`$.static[${s}].assertions[${i}].level`,message:"level must be one of: required, recommended, optional"})})}):e.push({path:"$.static",message:"static must be an array"}),Array.isArray(r.dynamic)?r.dynamic.forEach((o,s)=>{if(typeof o!="object"||o===null){e.push({path:`$.dynamic[${s}]`,message:"dynamic item must be an object"});return}let a=o;typeof a.description!="string"&&e.push({path:`$.dynamic[${s}].description`,message:"description is required and must be a string"}),Array.isArray(a.action)?a.action.forEach((n,i)=>{if(typeof n!="object"||n===null){e.push({path:`$.dynamic[${s}].action[${i}]`,message:"action item must be an object"});return}let t=n;typeof t.type!="string"&&e.push({path:`$.dynamic[${s}].action[${i}].type`,message:"type is required and must be a string"}),typeof t.target!="string"&&e.push({path:`$.dynamic[${s}].action[${i}].target`,message:"target is required and must be a string"})}):e.push({path:`$.dynamic[${s}].action`,message:"action is required and must be an array"}),Array.isArray(a.assertions)?a.assertions.forEach((n,i)=>{if(typeof n!="object"||n===null){e.push({path:`$.dynamic[${s}].assertions[${i}]`,message:"assertion must be an object"});return}let t=n;typeof t.target!="string"&&e.push({path:`$.dynamic[${s}].assertions[${i}].target`,message:"target is required and must be a string"}),typeof t.assertion!="string"&&e.push({path:`$.dynamic[${s}].assertions[${i}].assertion`,message:"assertion is required and must be a string"}),t.level!==void 0&&!["required","recommended","optional"].includes(t.level)&&e.push({path:`$.dynamic[${s}].assertions[${i}].level`,message:"level must be one of: required, recommended, optional"})}):e.push({path:`$.dynamic[${s}].assertions`,message:"assertions is required and must be an array"})}):e.push({path:"$.dynamic",message:"dynamic must be an array"}),r.relationships!==void 0&&(Array.isArray(r.relationships)?r.relationships.forEach((o,s)=>{if(typeof o!="object"||o===null){e.push({path:`$.relationships[${s}]`,message:"relationship must be an object"});return}let a=o,n=a.type;["aria-reference","contains"].includes(n)||e.push({path:`$.relationships[${s}].type`,message:"type must be one of: aria-reference, contains"}),n==="aria-reference"?(typeof a.from!="string"&&e.push({path:`$.relationships[${s}].from`,message:"from is required for aria-reference and must be a string"}),typeof a.attribute!="string"&&e.push({path:`$.relationships[${s}].attribute`,message:"attribute is required for aria-reference and must be a string"}),typeof a.to!="string"&&e.push({path:`$.relationships[${s}].to`,message:"to is required for aria-reference and must be a string"})):n==="contains"&&(typeof a.parent!="string"&&e.push({path:`$.relationships[${s}].parent`,message:"parent is required for contains and must be a string"}),typeof a.child!="string"&&e.push({path:`$.relationships[${s}].child`,message:"child is required for contains and must be a string"}))}):e.push({path:"$.relationships",message:"relationships must be an array"})),{valid:e.length===0,errors:e}}function R(f,e){let r=[];if(!f||typeof f!="object")return r;let s=f.relationships;return Array.isArray(s)&&s.forEach((a,n)=>{let i=a.type;if(i==="aria-reference"){let t=a.from,c=a.to;t&&!e.has(t)&&r.push({path:`$.relationships[${n}].from`,message:`Selector '${t}' not found in selectors`}),c&&!e.has(c)&&r.push({path:`$.relationships[${n}].to`,message:`Selector '${c}' not found in selectors`})}else if(i==="contains"){let t=a.parent,c=a.child;t&&!e.has(t)&&r.push({path:`$.relationships[${n}].parent`,message:`Selector '${t}' not found in selectors`}),c&&!e.has(c)&&r.push({path:`$.relationships[${n}].child`,message:`Selector '${c}' not found in selectors`})}}),r}function k(f,e){let r=[];if(!f||typeof f!="object")return r;let o=f,s=o.static;Array.isArray(s)&&s.forEach((n,i)=>{let t=n.assertions;Array.isArray(t)&&t.forEach((c,h)=>{let p=c.target;p&&!e.has(p)&&r.push({path:`$.static[${i}].assertions[${h}].target`,message:`Selector '${p}' not found in selectors`})})});let a=o.dynamic;return Array.isArray(a)&&a.forEach((n,i)=>{let t=n.action;Array.isArray(t)&&t.forEach((h,p)=>{let u=h.target;u&&u!=="document"&&!e.has(u)&&r.push({path:`$.dynamic[${i}].action[${p}].target`,message:`Selector '${u}' not found in selectors (or use 'document')`})});let c=n.assertions;Array.isArray(c)&&c.forEach((h,p)=>{let u=h.target;u&&u!=="relative"&&!e.has(u)&&r.push({path:`$.dynamic[${i}].assertions[${p}].target`,message:`Selector '${u}' not found in selectors (or use 'relative')`})})}),r}async function F(f,e){let r=[],o=[];if(!e.contracts||e.contracts.length===0)return console.log(l.yellow('\u2139\uFE0F No contracts configured. Add "contracts" array to ariaease.config.js')),{success:!0,built:o,errors:r};try{console.log(l.cyanBright(`
2
- \u{1F3D7}\uFE0F Building contracts...
3
- `));for(let s of e.contracts){let a=g.resolve(f,s.src),n=s.out?g.resolve(f,s.out):void 0;console.log(l.gray(` Pattern: ${s.src}`)),console.log(n?l.gray(` Output: ${s.out}
4
- `):l.gray(` Output: Same directory as source
5
- `));let i=[];for await(let t of q(a,{cwd:f}))i.push(t);if(i.length===0){console.log(l.yellow(`\u26A0\uFE0F No contract files found matching pattern: ${s.src}`));continue}n&&await v.ensureDir(n);for(let t of i)try{let c=t.startsWith("/")?t:g.resolve(f,t),h=await import(`file://${c}`),p=h.default;if(!p){let d=Object.entries(h).find(([,m])=>m&&typeof m=="object"&&"toJSON"in m);d&&(p=d[1])}if(!p||typeof p.toJSON!="function"){r.push(`${g.basename(t)}: No contract with toJSON() method found`);continue}let u=p.toJSON(),A=E(u);if(!A.valid){let m=`Schema validation failed:
6
- ${A.errors.map($=>` ${l.red("\u2717")} ${$.path}: ${$.message}`).join(`
7
- `)}`;r.push(`${g.basename(t)}: ${m}`),console.log(l.red(`\u274C ${g.basename(t)}`)),console.log(l.red(` ${m}`));continue}let y=new Set;if(u&&typeof u=="object"&&"selectors"in u){let d=u.selectors;Object.keys(d).forEach(m=>y.add(m))}let j=[...R(u,y),...k(u,y)];if(j.length>0){let m=`Reference validation failed:
8
- ${j.map($=>` ${l.red("\u2717")} ${$.path}: ${$.message}`).join(`
9
- `)}`;r.push(`${g.basename(t)}: ${m}`),console.log(l.red(`\u274C ${g.basename(t)}`)),console.log(l.red(` ${m}`));continue}let w=g.basename(t,g.extname(t)),b=n?g.join(n,`${w}.json`):g.join(g.dirname(c),`${w}.json`);await v.writeFile(b,JSON.stringify(u,null,2)+`
10
- `,"utf-8");let S=g.relative(f,b);o.push(S),console.log(l.green(`\u2705 ${g.basename(t)} \u2192 ${g.basename(b)}`))}catch(c){let h=c instanceof Error?c.message:String(c),p=g.basename(t);r.push(`${p}: ${h}`),console.log(l.red(`\u274C ${p}`)),console.log(l.red(` Error: ${h}`))}}return console.log(""),r.length===0?(console.log(l.green(`\u2705 Built ${o.length} contract${o.length!==1?"s":""} successfully
11
- `)),{success:!0,built:o,errors:r}):(console.log(l.yellow(`\u26A0\uFE0F Built ${o.length} contracts with ${r.length} error${r.length!==1?"s":""}
12
- `)),{success:!1,built:o,errors:r})}catch(s){let n=`Failed to build contracts: ${s instanceof Error?s.message:String(s)}`;return r.push(n),console.log(l.red(`\u274C ${n}
13
- `)),{success:!1,built:o,errors:r}}}export{F as buildContracts};
@@ -1 +0,0 @@
1
- import {expect}from'@playwright/test';var a=class{constructor(t,e,o=400,i=400){this.mainSelector=t;this.selectors=e;this.actionTimeoutMs=o;this.assertionTimeoutMs=i;}async resetState(t){if(!this.selectors.panel||!this.selectors.trigger||this.selectors.popup)return;let e=this.selectors.trigger,o=this.selectors.panel;if(!e||!o)return;let i=await t.locator(e).all();for(let r of i){let n=await r.getAttribute("aria-expanded")==="true",s=await r.getAttribute("aria-controls");if(n&&s){await r.click({timeout:this.actionTimeoutMs});let c=t.locator(`#${s}`);await expect(c).toBeHidden({timeout:this.assertionTimeoutMs}).catch(()=>{});}}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};export{a as AccordionComponentStrategy};
@@ -1,5 +0,0 @@
1
- import {expect}from'@playwright/test';var n=class{constructor(t,r,o=400,c=400){this.mainSelector=t;this.selectors=r;this.actionTimeoutMs=o;this.assertionTimeoutMs=c;}async resetState(t){if(!this.selectors.popup)return;let r=this.selectors.popup,o=t.locator(r).first();if(!await o.isVisible().catch(()=>false))return;let e=false,s=this.selectors.input;if(!s&&this.selectors.focusable?s=this.selectors.focusable:s||(s=this.selectors.button),s&&(await t.locator(s).first().focus(),await t.keyboard.press("Escape"),e=await expect(o).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!e&&this.selectors.button&&(await t.locator(this.selectors.button).first().click({timeout:this.actionTimeoutMs}),e=await expect(o).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),e||(await t.mouse.click(10,10),e=await expect(o).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!e)throw new Error(`\u274C FATAL: Cannot close combobox popup between tests. Popup remains visible after trying:
2
- 1. Escape key
3
- 2. Clicking button
4
- 3. Clicking outside
5
- This indicates a problem with the combobox component's close functionality.`);this.selectors.input&&await t.locator(this.selectors.input).first().clear();}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};export{n as ComboboxComponentStrategy};
@@ -1,5 +0,0 @@
1
- import {expect}from'@playwright/test';var c=class{constructor(t,r,i=400,o=400){this.mainSelector=t;this.selectors=r;this.actionTimeoutMs=i;this.assertionTimeoutMs=o;}async resetState(t){if(!this.selectors.popup)return;let r=this.selectors.popup,i=t.locator(r).first();if(!await i.isVisible().catch(()=>false))return;let s=false,e=this.selectors.input;if(!e&&this.selectors.focusable?e=this.selectors.focusable:e||(e=this.selectors.main),e&&(await t.locator(e).first().focus(),await t.keyboard.press("Escape"),s=await expect(i).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!s&&this.selectors.main&&(await t.locator(this.selectors.main).first().click({timeout:this.actionTimeoutMs}),s=await expect(i).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),s||(await t.mouse.click(10,10),s=await expect(i).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!s)throw new Error(`\u274C FATAL: Cannot close menu between tests. Menu remains visible after trying:
2
- 1. Escape key
3
- 2. Clicking trigger
4
- 3. Clicking outside
5
- This indicates a problem with the menu component's close functionality.`);this.selectors.input&&await t.locator(this.selectors.input).first().clear(),this.selectors.main&&await t.locator(this.selectors.main).first().focus();}async shouldSkipTest(t,r){if(!(t.action.some(e=>e.target==="submenu"||e.target==="submenuTrigger"||e.target==="submenuItems")||t.assertions.some(e=>e.target==="submenu"||e.target==="submenuTrigger"||e.target==="submenuItems")))return false;let o=this.selectors.submenuTrigger;return o?await r.locator(o).count()===0:true}getMainSelector(){return this.mainSelector}};export{c as MenuComponentStrategy};