@dev-blinq/cucumber_client 1.0.1545-dev → 1.0.1547-dev

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.
@@ -160,7 +160,7 @@ ${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.pus
160
160
  `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
161
161
  `,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(s){let i=s.items[s.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let c="end"in i.value?i.value.end:void 0;(Array.isArray(c)?c[c.length-1]:void 0)?.type==="comment"?c?.push(this.sourceToken):s.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)s.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,s.indent)){let c=s.items[s.items.length-2],f=c?.value?.end;if(Array.isArray(f))return Array.prototype.push.apply(f,i.start),f.push(this.sourceToken),void s.items.pop()}i.start.push(this.sourceToken)}return}if(this.indent>=s.indent){let c=!this.onKeyLine&&this.indent===s.indent,f=c&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",d=[];if(f&&i.sep&&!i.value){let g=[];for(let S=0;S<i.sep.length;++S){let k=i.sep[S];switch(k.type){case"newline":g.push(S);break;case"space":break;case"comment":k.indent>s.indent&&(g.length=0);break;default:g.length=0}}g.length>=2&&(d=i.sep.splice(g[1]))}switch(this.type){case"anchor":case"tag":return void(f||i.value?(d.push(this.sourceToken),s.items.push({start:d}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken));case"explicit-key-ind":return i.sep||i.explicitKey?f||i.value?(d.push(this.sourceToken),s.items.push({start:d,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}):(i.start.push(this.sourceToken),i.explicitKey=!0),void(this.onKeyLine=!0);case"map-value-ind":if(i.explicitKey)if(i.sep)if(i.value)s.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ke(i.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:d,key:null,sep:[this.sourceToken]}]});else if(Si(i.key)&&!Ke(i.sep,"newline")){let g=gt(i.start),S=i.key,k=i.sep;k.push(this.sourceToken),delete i.key,delete i.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:g,key:S,sep:k}]})}else d.length>0?i.sep=i.sep.concat(d,this.sourceToken):i.sep.push(this.sourceToken);else if(Ke(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let g=gt(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:g,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||f?s.items.push({start:d,key:null,sep:[this.sourceToken]}):Ke(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return void(this.onKeyLine=!0);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let g=this.flowScalar(this.type);return void(f||i.value?(s.items.push({start:d,key:g,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(g):(Object.assign(i,{key:g,sep:[]}),this.onKeyLine=!0))}default:{let g=this.startBlockValue(s);if(g){if(g.type==="block-seq"){if(!i.explicitKey&&i.sep&&!Ke(i.sep,"newline"))return void(yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source}))}else c&&s.items.push({start:d});return void this.stack.push(g)}}}}yield*this.pop(),yield*this.step()}*blockSequence(s){let i=s.items[s.items.length-1];switch(this.type){case"newline":if(i.value){let c="end"in i.value?i.value.end:void 0;(Array.isArray(c)?c[c.length-1]:void 0)?.type==="comment"?c?.push(this.sourceToken):s.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)s.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,s.indent)){let c=s.items[s.items.length-2],f=c?.value?.end;if(Array.isArray(f))return Array.prototype.push.apply(f,i.start),f.push(this.sourceToken),void s.items.pop()}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=s.indent)break;return void i.start.push(this.sourceToken);case"seq-item-ind":if(this.indent!==s.indent)break;return void(i.value||Ke(i.start,"seq-item-ind")?s.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken))}if(this.indent>s.indent){let c=this.startBlockValue(s);if(c)return void this.stack.push(c)}yield*this.pop(),yield*this.step()}*flowCollection(s){let i=s.items[s.items.length-1];if(this.type==="flow-error-end"){let c;do yield*this.pop(),c=this.peek(1);while(c&&c.type==="flow-collection")}else if(s.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":return void(!i||i.sep?s.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken));case"map-value-ind":return void(!i||i.value?s.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]}));case"space":case"comment":case"newline":case"anchor":case"tag":return void(!i||i.value?s.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken));case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let f=this.flowScalar(this.type);return void(!i||i.value?s.items.push({start:[],key:f,sep:[]}):i.sep?this.stack.push(f):Object.assign(i,{key:f,sep:[]}))}case"flow-map-end":case"flow-seq-end":return void s.end.push(this.sourceToken)}let c=this.startBlockValue(s);c?this.stack.push(c):(yield*this.pop(),yield*this.step())}else{let c=this.peek(2);if(c.type==="block-map"&&(this.type==="map-value-ind"&&c.indent===s.indent||this.type==="newline"&&!c.items[c.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&c.type!=="flow-collection"){let f=gt(On(c));xi(s);let d=s.end.splice(1,s.end.length);d.push(this.sourceToken);let g={type:"block-map",offset:s.offset,indent:s.indent,items:[{start:f,key:s,sep:d}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=g}else yield*this.lineEnd(s)}}flowScalar(s){if(this.onNewLine){let i=this.source.indexOf(`
162
162
  `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
163
- `,i)+1}return{type:s,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(s){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let i=gt(On(s));return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=gt(On(s));return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(s,i){return this.type==="comment"&&!(this.indent<=i)&&s.every(c=>c.type==="newline"||c.type==="space")}*documentEnd(s){this.type!=="doc-mode"&&(s.end?s.end.push(this.sourceToken):s.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(s){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:s.end?s.end.push(this.sourceToken):s.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Ti(a){let s=a.prettyErrors!==!1;return{lineCounter:a.lineCounter||s&&new wi||null,prettyErrors:s}}function ki(a,s={}){let{lineCounter:i,prettyErrors:c}=Ti(s),f=new kr(i?.addNewLine),d=new Er(s),g=null;for(let S of d.compose(f.parse(a),!0,a.length))if(g){if(g.options.logLevel!=="silent"){g.errors.push(new Xe(S.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}}else g=S;return c&&i&&(g.errors.forEach(kn(a,i)),g.warnings.forEach(kn(a,i))),g}return e.Alias=U,e.CST=Ba,e.Composer=Er,e.Document=ft,e.Lexer=vi,e.LineCounter=wi,e.Pair=ve,e.Parser=kr,e.Scalar=G,e.Schema=Tn,e.YAMLError=gr,e.YAMLMap=_e,e.YAMLParseError=Xe,e.YAMLSeq=We,e.YAMLWarning=ii,e.isAlias=p,e.isCollection=A,e.isDocument=b,e.isMap=v,e.isNode=I,e.isPair=m,e.isScalar=y,e.isSeq=w,e.parse=function(a,s,i){let c;typeof s=="function"?c=s:i===void 0&&s&&typeof s=="object"&&(i=s);let f=ki(a,i);if(!f)return null;if(f.warnings.forEach(d=>Rs(f.options.logLevel,d)),f.errors.length>0){if(f.options.logLevel!=="silent")throw f.errors[0];f.errors=[]}return f.toJS(Object.assign({reviver:c},i))},e.parseAllDocuments=function(a,s={}){let{lineCounter:i,prettyErrors:c}=Ti(s),f=new kr(i?.addNewLine),d=new Er(s),g=Array.from(d.compose(f.parse(a)));if(c&&i)for(let S of g)S.errors.forEach(kn(a,i)),S.warnings.forEach(kn(a,i));return g.length>0?g:Object.assign([],{empty:!0},d.streamInfo())},e.parseDocument=ki,e.stringify=function(a,s,i){let c=null;if(typeof s=="function"||Array.isArray(s)?c=s:i===void 0&&s&&(i=s),typeof i=="string"&&(i=i.length),typeof i=="number"){let f=Math.round(i);i=f<1?void 0:f>8?{indent:8}:{indent:f}}if(a===void 0){let{keepUndefined:f}=i??s??{};if(!f)return}return b(a)&&!c?a.toString(i):new ft(a,c,i).toString(i)},e.visit=ee,e.visitAsync=Z,e}({}),As=du;var pu=Me.domUtils.closestCrossShadow,gu=Me.domUtils.isElementVisible,cn=class{deepEventTarget(t){return t.composedPath()[0]}deepActiveElement(t){let n=t.activeElement;for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}modifiersForEvent(t){return(t.altKey?1:0)|(t.ctrlKey?2:0)|(t.metaKey?4:0)|(t.shiftKey?8:0)}buttonForEvent(t){switch(t.which){case 1:return"left";case 2:return"middle";case 3:return"right"}return"left"}positionForEvent(t){if(t.target.nodeName==="CANVAS")return{x:t.offsetX,y:t.offsetY}}consumeEvent(t){t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()}asCheckbox(t){if(!t||t.nodeName!=="INPUT")return null;let n=t;return["checkbox","radio"].includes(n.type)?n:null}isRangeInput(t){return!t||t.nodeName!=="INPUT"?!1:t.type.toLowerCase()==="range"}addEventListener(t,n,r,o){return t.addEventListener(n,r,o),()=>{t.removeEventListener(n,r,o)}}removeEventListeners(t){for(let n of t)n();t.splice(0,t.length)}getNearestInteractiveElement(t,n=window.document){try{if(!t.matches("input,textarea,select")&&!t.isContentEditable){let r=pu(t,"button,select,input,[role=button],[role=checkbox],[role=radio],a,[role=link]",n);if(r&&gu(r))return r}return t}catch(r){return console.error(r),t}}shouldGenerateKeyPressFor(t){if(t.key==="Enter"&&(this.deepEventTarget(t).nodeName==="TEXTAREA"||this.deepEventTarget(t).isContentEditable)||["Backspace","Delete","AltGraph"].includes(t.key)||t.key==="@"&&t.code==="KeyL")return!1;if(navigator.platform.includes("Mac")){if(t.key==="v"&&t.metaKey)return!1}else if(t.key==="v"&&t.ctrlKey||t.key==="Insert"&&t.shiftKey)return!1;if(["Shift","Control","Meta","Alt","Process"].includes(t.key))return!1;let n=t.ctrlKey||t.altKey||t.metaKey;return t.key.length===1&&!n?!!this.asCheckbox(this.deepEventTarget(t)):!0}};var mu=Math.random().toString(36).substring(7),ba=0,Ns=()=>(ba++,`bvt_input_${ba}_${mu}`),yu=e=>{if(e instanceof HTMLInputElement&&(e.type==="button"||e.type==="submit"))return e.value?.length>0;if(e.innerText?.length>0){if(e.childNodes.length===0)return!0;for(let n=0;n<e.childNodes.length;n++){let r=e.childNodes[n];if(r.nodeType===Node.TEXT_NODE&&r.nodeValue.trim().length>0)return!0}}},nt={recordCommand:e=>__bvt_recordCommand(e),setMode:e=>__bvt_setMode(e),revertMode:()=>__bvt_revertMode(),recordPageClose:()=>__bvt_recordPageClose(),getMode:()=>__bvt_getMode(),log:e=>__bvt_log(e),sendObject:e=>__bvt_getObject(e)},va=null,Pe=class{constructor(t,n){this.name=t,this.getAction=n.getAction,this.getInterestedElement=n.getInterestedElement,this.hoverOutlineStyle=n.hoverOutlineStyle,this.start=n.start}},Cs=class{#t=null;#e="noop";contextElement=null;debugListener=!1;debugMouseOut=!1;debugMouseOver=!1;debugFocusOut=!1;debugFocusIn=!1;#n=Symbol("outline");#r=!1;toolbar=null;activeElement=null;cleanup=null;rect=null;offsetX=null;offsetY=null;popupHandlers=[];disableHighlight=!1;improviseLocators=!0;snapshotCapturer=new ma({excludeSelectors:["script","x-bvt-toolbar"]});injectedScript=pa();locatorGenerator=new ga(this.injectedScript);PW=Me;snapshotUtils=new ya;eventUtils=new cn;constructor(t={}){let{disableHighlight:n=!1,improviseLocators:r=!0,popupHandlers:o=[],testAttributes:h=[]}=t;this.disableHighlight=n,this.improviseLocators=r,this.popupHandlers=o,this.locatorGenerator.options.customAttributes=h,this.init()}init({mode:t="noop"}={}){this.addRecorderStates(),this.mode=t,this.addOverrides(),this.addListeners(),this.addHighlightListeners(window),window.addEventListener("DOMContentLoaded",async()=>{this.addToolbar(),this.mode=await nt.getMode()})}collectElementsFromAriaSnapshot(t,n){if(!(t.element&&t.element.tagName==="X-BVT-TOOL")){t.element&&n.add({element:t.element,snapshot:this.injectedScript.ariaSnapshot(t.element)});for(let r of t.children)typeof r!="string"&&this.collectElementsFromAriaSnapshot(r,n)}}addRecorderStates(){let t=new Pe("noop",{getAction:m=>{this.eventUtils.consumeEvent(m)},getInterestedElement:()=>{},hoverOutlineStyle:""}),n=new Pe("idle",{start:()=>(this.toolbar?.hide(),()=>{this.toolbar?.show()}),getAction:()=>null,getInterestedElement:()=>{},hoverOutlineStyle:""}),r=new Pe("running",{start:()=>(this.toolbar?.hide(),()=>{this.toolbar?.show()}),getAction:()=>null,getInterestedElement:()=>{},hoverOutlineStyle:""}),o=new Pe("inspecting",{start:()=>(this.toolbar?.hide(),()=>{this.toolbar?.show(),this.resetHighlight(this.activeElement)}),getInterestedElement:m=>m,hoverOutlineStyle:"2px solid red",getAction(m){if(l.eventUtils.consumeEvent(m),m.type==="pointerdown"){let y=l.eventUtils.deepEventTarget(m);return{details:{name:"click"},element:y}}}}),h=new Pe("multiInspecting",{start:()=>{this.toolbar?.hide();let m=document.getElementsByTagName("body")[0];this.pageSnapshot=this.injectedScript.ariaSnapshot(m),this.lastSnapshot=this.injectedScript._lastAriaSnapshot,this.snapshotElements=new Set,this.interestedElements=new Map,this.collectElementsFromAriaSnapshot(this.lastSnapshot.root,this.snapshotElements),this.elementSet=new Set;for(let{element:y}of this.snapshotElements)this.elementSet.add(y);return()=>{this.toolbar?.show();for(let y of this.interestedElements.keys())y.style.background=y.__originalBackground,delete y.__originalBackground}},getInterestedElement:m=>this.snapshotUtils.isSnapshotAvailable(m,this.elementSet),hoverOutlineStyle:"2px solid red",getAction:m=>{if(this.eventUtils.consumeEvent(m),m.type==="pointerdown"){let y=this.eventUtils.deepEventTarget(m),w=this.injectedScript.ariaSnapshot(y);if(this.snapshotUtils.isSnapshotAvailable(y,this.elementSet)){if(this.interestedElements.has(y)?(this.interestedElements.delete(y),y.style.background=y.__originalBackground,delete y.__originalBackground):(y.__originalBackground=y.style.background,y.style.background="rgba(255, 204, 0, 0.3)",this.interestedElements.set(y,w)),Array.from(this.interestedElements.keys()).length===0)return{details:{name:"click",value:""},element:y};let I=this.injectedScript.utils.parseAriaSnapshot(As,this.pageSnapshot).fragment,B=Array.from(this.interestedElements.values()).map(H=>this.injectedScript.utils.parseAriaSnapshot(As,H).fragment),q=this.snapshotUtils.filterParentToChildren(I,B);return w=this.snapshotUtils.serializeAriaSnapshot(q),{details:{name:"click",value:w},element:y}}}}}),l=this,u=new Pe("recordingText",{start:()=>(this.toolbar?.hide(),()=>{this.toolbar?.show(),this.resetHighlight(this.activeElement)}),getInterestedElement:m=>{if(yu(m))return m},hoverOutlineStyle:"2px solid red",getAction(m){if(l.eventUtils.consumeEvent(m),m.type==="pointerdown"){let y=l.eventUtils.deepEventTarget(m);if(this.getInterestedElement(y))return{details:{name:"click"},element:y}}}}),p=new Pe("recordingHover",{start:()=>(this.toolbar&&(this.toolbar.hoverTool.selected=!0),()=>{this.resetHighlight(this.activeElement),this.toolbar&&(this.toolbar.hoverTool.selected=!1)}),getAction:m=>{if(this.eventUtils.consumeEvent(m),m.type==="click")return{details:{name:"click"},element:this.eventUtils.deepEventTarget(m)}},getInterestedElement:m=>m,hoverOutlineStyle:"2px solid blue"}),b=new Pe("recordingInput",{start:()=>()=>{this.resetHighlight(this.activeElement)},getAction:m=>{switch(m.type){case"pointerdown":{if(m.button===2)return;let y=this.eventUtils.getNearestInteractiveElement(this.eventUtils.deepEventTarget(m)),w=this.eventUtils.asCheckbox(y);return y.nodeName==="INPUT"&&y.type.toLowerCase()==="file"?void 0:w?{details:{name:w.checked?"uncheck":"check"},element:y}:{details:{name:"click",position:this.eventUtils.positionForEvent(m),button:this.eventUtils.buttonForEvent(m),modifiers:this.eventUtils.modifiersForEvent(m),clickCount:m.detail},element:y}}case"input":{let y=this.eventUtils.getNearestInteractiveElement(this.eventUtils.deepEventTarget(m));return y.nodeName==="INPUT"&&y.type.toLowerCase()==="file"?{details:{name:"setInputFiles",files:[...y.files||[]].map(w=>w.name)},element:y}:this.eventUtils.isRangeInput(y)?{details:{name:"fill",text:y.value},element:y}:["INPUT","TEXTAREA"].includes(y.nodeName)||y.isContentEditable?y.nodeName==="INPUT"&&["checkbox","radio"].includes(y.type.toLowerCase())?void 0:{details:{name:"fill",text:y.isContentEditable?y.innerText:y.value},element:y}:y.nodeName==="SELECT"?{details:{name:"select",options:[...y.selectedOptions].map(A=>A.value)},element:y}:void 0}case"keydown":{if(!this.eventUtils.shouldGenerateKeyPressFor(m))return;if(m.key===" "){let y=this.eventUtils.asCheckbox(this.eventUtils.deepEventTarget(m));if(y)return{details:{name:y.checked?"uncheck":"check"},element:y}}return{details:{name:"press",key:m.key,modifiers:this.eventUtils.modifiersForEvent(m)},element:this.eventUtils.deepEventTarget(m)}}}},getInterestedElement:m=>{let y=this.eventUtils.getNearestInteractiveElement(m);return y||m},hoverOutlineStyle:"2px solid red"}),v={noop:t,idle:n,running:r,recordingText:u,recordingContext:u,recordingInput:b,recordingHover:p,inspecting:o,multiInspecting:h};this.RecorderStateMap=v}addOverrides(){let t=window.close.bind(window);window.close=async function(){nt.recordPageClose(),t()};let n=this,r=Element.prototype.attachShadow;Element.prototype.attachShadow=function(o){let h=r.call(this,o);return n.addHighlightListeners(h),h}}set mode(t){let n=this.RecorderStateMap[t];n&&(this.cleanup&&this.cleanup(),this.#t=n,this.#t.start&&(this.cleanup=this.#t.start()),this.#e=t)}get mode(){return this.#e}getFrameDetails(){return{url:window.location.href,title:window.document.title,isTop:window.top===window,viewport:{width:window.innerWidth,height:window.innerHeight}}}setHighlight(t){if(t.closest("x-bvt-toolbar"))return;let n=this.#t.getInterestedElement(t);n&&(this.activeElement=n,n[this.#n]===void 0&&(n[this.#n]=n.style.outline,n.style.outline=this.#t.hoverOutlineStyle,n.styleUpdateFn&&n.styleUpdateFn(n)))}resetHighlight(t){if(!t)return;let n=this.#t.getInterestedElement(t);n&&n[this.#n]!==void 0&&(n.style.outline=n[this.#n],n[this.#n]=void 0,n.styleUpdateFn&&n.styleUpdateFn(n))}addHighlightListeners(t){t.addEventListener("mouseover",n=>{if(this.debugMouseOver)debugger;let r=this.eventUtils.deepEventTarget(n);this.setHighlight(r)}),t.addEventListener("mouseout",n=>{if(this.debugMouseOut)debugger;let r=this.eventUtils.deepEventTarget(n);this.resetHighlight(r)}),t.addEventListener("focusin",n=>{if(this.debugFocusIn)debugger;let r=this.eventUtils.deepEventTarget(n);this.setHighlight(r)}),t.addEventListener("focusout",n=>{if(this.debugFocusOut)debugger;let r=this.eventUtils.deepEventTarget(n);this.resetHighlight(r)})}addToolbar(){if(window.top!==window)return;let t=document.createElement("x-bvt-toolbar");t.id="bvt-toolbar",this.toolbar=t,document.body.appendChild(t)}handleStateTransition(t){if(this.#e==="recordingContext"){this.contextElement=t,nt.revertMode();return}this.#e==="recordingHover"&&nt.revertMode(),this.contextElement=null}getElementProperties(t){if(!t||!(t instanceof HTMLElement||t instanceof SVGElement))throw new Error("Please provide a valid HTML element");let n={properties:{},attributes:{},dataset:{}},r={},o={},h={};for(let u in t)try{let p=t[u];typeof p!="function"&&typeof p!="object"&&p!==null&&p!==void 0&&!u.includes("_")&&(r[u]=p)}catch{r[u]="[Error accessing property]"}if(t.attributes)for(let u of t.attributes)u.name!=="data-input-id"&&u.name!=="data-blinq-id"&&(o[u.name]=u.value);if(t.dataset)for(let[u,p]of Object.entries(t.dataset))u!=="inputId"&&u!=="blinqId"&&(h[u]=p);let l=u=>Object.fromEntries(Object.entries(u).sort(([p],[b])=>p.localeCompare(b)));return n.properties=l(r),n.attributes=l(o),n.dataset=l(h),n}getElementDetails(t,n){(va!==t.dataset.inputId||n!=="input")&&(t.dataset.inputId=Ns(),va=t.dataset.inputId,t.__locators=this.getLocatorsObject(t));let r=this.PW.roleUtils.getAriaRole(t),o=this.PW.roleUtils.getElementAccessibleName(t,!1)||this.PW.roleUtils.getElementAccessibleName(t,!0)||"",h=this.getElementProperties(t);return{role:r,label:o,inputID:t.dataset.inputId,tagName:t.tagName,type:t.type,text:this.PW.selectorUtils.elementText(new Map,t).full.trim(),parent:`tagname: ${t.parentElement?.tagName}
163
+ `,i)+1}return{type:s,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(s){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let i=gt(On(s));return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=gt(On(s));return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(s,i){return this.type==="comment"&&!(this.indent<=i)&&s.every(c=>c.type==="newline"||c.type==="space")}*documentEnd(s){this.type!=="doc-mode"&&(s.end?s.end.push(this.sourceToken):s.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(s){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:s.end?s.end.push(this.sourceToken):s.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Ti(a){let s=a.prettyErrors!==!1;return{lineCounter:a.lineCounter||s&&new wi||null,prettyErrors:s}}function ki(a,s={}){let{lineCounter:i,prettyErrors:c}=Ti(s),f=new kr(i?.addNewLine),d=new Er(s),g=null;for(let S of d.compose(f.parse(a),!0,a.length))if(g){if(g.options.logLevel!=="silent"){g.errors.push(new Xe(S.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}}else g=S;return c&&i&&(g.errors.forEach(kn(a,i)),g.warnings.forEach(kn(a,i))),g}return e.Alias=U,e.CST=Ba,e.Composer=Er,e.Document=ft,e.Lexer=vi,e.LineCounter=wi,e.Pair=ve,e.Parser=kr,e.Scalar=G,e.Schema=Tn,e.YAMLError=gr,e.YAMLMap=_e,e.YAMLParseError=Xe,e.YAMLSeq=We,e.YAMLWarning=ii,e.isAlias=p,e.isCollection=A,e.isDocument=b,e.isMap=v,e.isNode=I,e.isPair=m,e.isScalar=y,e.isSeq=w,e.parse=function(a,s,i){let c;typeof s=="function"?c=s:i===void 0&&s&&typeof s=="object"&&(i=s);let f=ki(a,i);if(!f)return null;if(f.warnings.forEach(d=>Rs(f.options.logLevel,d)),f.errors.length>0){if(f.options.logLevel!=="silent")throw f.errors[0];f.errors=[]}return f.toJS(Object.assign({reviver:c},i))},e.parseAllDocuments=function(a,s={}){let{lineCounter:i,prettyErrors:c}=Ti(s),f=new kr(i?.addNewLine),d=new Er(s),g=Array.from(d.compose(f.parse(a)));if(c&&i)for(let S of g)S.errors.forEach(kn(a,i)),S.warnings.forEach(kn(a,i));return g.length>0?g:Object.assign([],{empty:!0},d.streamInfo())},e.parseDocument=ki,e.stringify=function(a,s,i){let c=null;if(typeof s=="function"||Array.isArray(s)?c=s:i===void 0&&s&&(i=s),typeof i=="string"&&(i=i.length),typeof i=="number"){let f=Math.round(i);i=f<1?void 0:f>8?{indent:8}:{indent:f}}if(a===void 0){let{keepUndefined:f}=i??s??{};if(!f)return}return b(a)&&!c?a.toString(i):new ft(a,c,i).toString(i)},e.visit=ee,e.visitAsync=Z,e}({}),As=du;var pu=Me.domUtils.closestCrossShadow,gu=Me.domUtils.isElementVisible,cn=class{deepEventTarget(t){return t.composedPath()[0]}deepActiveElement(t){let n=t.activeElement;for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}modifiersForEvent(t){return(t.altKey?1:0)|(t.ctrlKey?2:0)|(t.metaKey?4:0)|(t.shiftKey?8:0)}buttonForEvent(t){switch(t.which){case 1:return"left";case 2:return"middle";case 3:return"right"}return"left"}positionForEvent(t){if(t.target.nodeName==="CANVAS")return{x:t.offsetX,y:t.offsetY}}consumeEvent(t){t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()}asCheckbox(t){if(!t||t.nodeName!=="INPUT")return null;let n=t;return["checkbox","radio"].includes(n.type)?n:null}isRangeInput(t){return!t||t.nodeName!=="INPUT"?!1:t.type.toLowerCase()==="range"}addEventListener(t,n,r,o){return t.addEventListener(n,r,o),()=>{t.removeEventListener(n,r,o)}}removeEventListeners(t){for(let n of t)n();t.splice(0,t.length)}getNearestInteractiveElement(t,n=window.document){try{if(!t.matches("input,textarea,select")&&!t.isContentEditable){let r=pu(t,"button,select,input,[role=button],[role=checkbox],[role=radio],a,[role=link]",n);if(r&&gu(r))return r}return t}catch(r){return console.error(r),t}}shouldGenerateKeyPressFor(t){if(t.key==="Enter"&&(this.deepEventTarget(t).nodeName==="TEXTAREA"||this.deepEventTarget(t).isContentEditable)||["Backspace","Delete","AltGraph"].includes(t.key)||t.key==="@"&&t.code==="KeyL")return!1;if(navigator.platform.includes("Mac")){if(t.key==="v"&&t.metaKey)return!1}else if(t.key==="v"&&t.ctrlKey||t.key==="Insert"&&t.shiftKey)return!1;if(["Shift","Control","Meta","Alt","Process"].includes(t.key))return!1;let n=t.ctrlKey||t.altKey||t.metaKey;return t.key.length===1&&!n?!!this.asCheckbox(this.deepEventTarget(t)):!0}};var mu=Math.random().toString(36).substring(7),ba=0,Ns=()=>(ba++,`bvt_input_${ba}_${mu}`),yu=e=>{if(e instanceof HTMLInputElement&&(e.type==="button"||e.type==="submit"))return e.value?.length>0;if(e.innerText?.length>0){if(e.childNodes.length===0)return!0;for(let n=0;n<e.childNodes.length;n++){let r=e.childNodes[n];if(r.nodeType===Node.TEXT_NODE&&r.nodeValue.trim().length>0)return!0}}},nt={recordCommand:e=>__bvt_recordCommand(e),setMode:e=>__bvt_setMode(e),revertMode:()=>__bvt_revertMode(),recordPageClose:()=>__bvt_recordPageClose(),getMode:()=>__bvt_getMode(),log:e=>__bvt_log(e),sendObject:e=>__bvt_getObject(e)},va=null,Pe=class{constructor(t,n){this.name=t,this.getAction=n.getAction,this.getInterestedElement=n.getInterestedElement,this.hoverOutlineStyle=n.hoverOutlineStyle,this.start=n.start}},Cs=class{#t=null;#e="noop";contextElement=null;debugListener=!1;debugMouseOut=!1;debugMouseOver=!1;debugFocusOut=!1;debugFocusIn=!1;#n=Symbol("outline");#r=!1;toolbar=null;activeElement=null;cleanup=null;rect=null;offsetX=null;offsetY=null;popupHandlers=[];disableHighlight=!1;improviseLocators=!0;snapshotCapturer=new ma({excludeSelectors:["script","x-bvt-toolbar"]});injectedScript=pa();locatorGenerator=new ga(this.injectedScript);PW=Me;snapshotUtils=new ya;eventUtils=new cn;constructor(t={}){let{disableHighlight:n=!1,improviseLocators:r=!0,popupHandlers:o=[],testAttributes:h=[]}=t;this.disableHighlight=n,this.improviseLocators=r,this.popupHandlers=o,this.locatorGenerator.options.customAttributes=h,this.init()}init({mode:t="noop"}={}){this.addRecorderStates(),this.mode=t,this.addOverrides(),this.addListeners(),this.addHighlightListeners(window),window.addEventListener("DOMContentLoaded",async()=>{this.addToolbar(),this.mode=await nt.getMode()})}collectElementsFromAriaSnapshot(t,n){if(!(t.element&&t.element.tagName==="X-BVT-TOOL")){t.element&&n.add({element:t.element,snapshot:this.injectedScript.ariaSnapshot(t.element)});for(let r of t.children)typeof r!="string"&&this.collectElementsFromAriaSnapshot(r,n)}}addRecorderStates(){let t=new Pe("noop",{getAction:m=>{this.eventUtils.consumeEvent(m)},getInterestedElement:()=>{},hoverOutlineStyle:""}),n=new Pe("idle",{start:()=>(this.toolbar?.hide(),()=>{this.toolbar?.show()}),getAction:()=>null,getInterestedElement:()=>{},hoverOutlineStyle:""}),r=new Pe("running",{start:()=>(this.toolbar?.hide(),()=>{this.toolbar?.show()}),getAction:()=>null,getInterestedElement:()=>{},hoverOutlineStyle:""}),o=new Pe("inspecting",{start:()=>(this.toolbar?.hide(),()=>{this.toolbar?.show(),this.resetHighlight(this.activeElement)}),getInterestedElement:m=>m,hoverOutlineStyle:"2px solid red",getAction(m){if(l.eventUtils.consumeEvent(m),m.type==="pointerdown"){let y=l.eventUtils.deepEventTarget(m);return{details:{name:"click"},element:y}}}}),h=new Pe("multiInspecting",{start:()=>{this.toolbar?.hide();let m=document.getElementsByTagName("body")[0];this.pageSnapshot=this.injectedScript.ariaSnapshot(m),this.lastSnapshot=this.injectedScript._lastAriaSnapshot,this.snapshotElements=new Set,this.interestedElements=new Map,this.collectElementsFromAriaSnapshot(this.lastSnapshot.root,this.snapshotElements),this.elementSet=new Set;for(let{element:y}of this.snapshotElements)this.elementSet.add(y);return()=>{this.toolbar?.show();for(let y of this.interestedElements.keys())y.style.background=y.__originalBackground,delete y.__originalBackground}},getInterestedElement:m=>this.snapshotUtils.isSnapshotAvailable(m,this.elementSet),hoverOutlineStyle:"2px solid red",getAction:m=>{if(this.eventUtils.consumeEvent(m),m.type==="pointerdown"){let y=this.eventUtils.deepEventTarget(m),w=this.injectedScript.ariaSnapshot(y);if(this.snapshotUtils.isSnapshotAvailable(y,this.elementSet)){if(this.interestedElements.has(y)?(this.interestedElements.delete(y),y.style.background=y.__originalBackground,delete y.__originalBackground):(y.__originalBackground=y.style.background,y.style.background="rgba(255, 204, 0, 0.3)",this.interestedElements.set(y,w)),Array.from(this.interestedElements.keys()).length===0)return{details:{name:"click",value:""},element:y};let I=this.injectedScript.utils.parseAriaSnapshot(As,this.pageSnapshot).fragment,B=Array.from(this.interestedElements.values()).map(H=>this.injectedScript.utils.parseAriaSnapshot(As,H).fragment),q=this.snapshotUtils.filterParentToChildren(I,B);return w=this.snapshotUtils.serializeAriaSnapshot(q),{details:{name:"click",value:w},element:y}}}}}),l=this,u=new Pe("recordingText",{start:()=>(this.toolbar?.hide(),()=>{this.toolbar?.show(),this.resetHighlight(this.activeElement)}),getInterestedElement:m=>{if(yu(m))return m},hoverOutlineStyle:"2px solid red",getAction(m){if(l.eventUtils.consumeEvent(m),m.type==="pointerdown"){let y=l.eventUtils.deepEventTarget(m);if(this.getInterestedElement(y))return{details:{name:"click"},element:y}}}}),p=new Pe("recordingHover",{start:()=>(this.toolbar&&(this.toolbar.hoverTool.selected=!0),()=>{this.resetHighlight(this.activeElement),this.toolbar&&(this.toolbar.hoverTool.selected=!1)}),getAction:m=>{if(this.eventUtils.consumeEvent(m),m.type==="click")return{details:{name:"click"},element:this.eventUtils.deepEventTarget(m)}},getInterestedElement:m=>m,hoverOutlineStyle:"2px solid blue"}),b=new Pe("recordingInput",{start:()=>()=>{this.resetHighlight(this.activeElement)},getAction:m=>{switch(m.type){case"pointerdown":{if(m.button===2)return;let y=this.eventUtils.getNearestInteractiveElement(this.eventUtils.deepEventTarget(m)),w=this.eventUtils.asCheckbox(y);return y.nodeName==="INPUT"&&y.type.toLowerCase()==="file"?void 0:w?{details:{name:w.checked?"uncheck":"check"},element:y}:{details:{name:"click",position:this.eventUtils.positionForEvent(m),button:this.eventUtils.buttonForEvent(m),modifiers:this.eventUtils.modifiersForEvent(m),clickCount:m.detail},element:y}}case"input":{let y=this.eventUtils.getNearestInteractiveElement(this.eventUtils.deepEventTarget(m));return y.nodeName==="INPUT"&&y.type.toLowerCase()==="file"?{details:{name:"setInputFiles",files:[...y.files||[]].map(w=>w.name)},element:y}:this.eventUtils.isRangeInput(y)?{details:{name:"fill",text:y.value},element:y}:["INPUT","TEXTAREA"].includes(y.nodeName)||y.isContentEditable?y.nodeName==="INPUT"&&["checkbox","radio"].includes(y.type.toLowerCase())?void 0:{details:{name:"fill",text:y.isContentEditable?y.innerText:y.value},element:y}:y.nodeName==="SELECT"?{details:{name:"select",options:[...y.selectedOptions].map(A=>A.value)},element:y}:void 0}case"keydown":{if(!this.eventUtils.shouldGenerateKeyPressFor(m))return;if(m.key===" "){let y=this.eventUtils.asCheckbox(this.eventUtils.deepEventTarget(m));if(y)return{details:{name:y.checked?"uncheck":"check"},element:y}}return{details:{name:"press",key:m.key,modifiers:this.eventUtils.modifiersForEvent(m)},element:this.eventUtils.deepEventTarget(m)}}}},getInterestedElement:m=>{let y=this.eventUtils.getNearestInteractiveElement(m);return y||m},hoverOutlineStyle:"2px solid red"}),v={noop:t,idle:n,running:r,recordingText:u,recordingContext:u,recordingInput:b,recordingHover:p,inspecting:o,multiInspecting:h};this.RecorderStateMap=v}addOverrides(){let t=window.close.bind(window);window.close=async function(){nt.recordPageClose(),t()};let n=this,r=Element.prototype.attachShadow;Element.prototype.attachShadow=function(o){let h=r.call(this,o);return n.addHighlightListeners(h),h}}set mode(t){let n=this.RecorderStateMap[t];n&&(this.cleanup&&this.cleanup(),this.#t=n,this.#t.start&&(this.cleanup=this.#t.start()),this.#e=t)}get mode(){return this.#e}getFrameDetails(){return{url:window.location.href,title:window.document.title,isTop:window.top===window,viewport:{width:window.innerWidth,height:window.innerHeight}}}setHighlight(t){if(t.closest("x-bvt-toolbar"))return;let n=this.#t.getInterestedElement(t);n&&(this.activeElement=n,n[this.#n]===void 0&&(n[this.#n]=n.style.outline,n.style.outline=this.#t.hoverOutlineStyle,n.styleUpdateFn&&n.styleUpdateFn(n)))}resetHighlight(t){if(!t)return;let n=this.#t.getInterestedElement(t);n&&n[this.#n]!==void 0&&(n.style.outline=n[this.#n],n[this.#n]=void 0,n.styleUpdateFn&&n.styleUpdateFn(n))}addHighlightListeners(t){t.addEventListener("mouseover",n=>{if(this.debugMouseOver)debugger;let r=this.eventUtils.deepEventTarget(n);this.setHighlight(r)}),t.addEventListener("mouseout",n=>{if(this.debugMouseOut)debugger;let r=this.eventUtils.deepEventTarget(n);this.resetHighlight(r)}),t.addEventListener("focusin",n=>{if(this.debugFocusIn)debugger;let r=this.eventUtils.deepEventTarget(n);this.setHighlight(r)}),t.addEventListener("focusout",n=>{if(this.debugFocusOut)debugger;let r=this.eventUtils.deepEventTarget(n);this.resetHighlight(r)})}addToolbar(){if(window.top!==window)return;let t=document.createElement("x-bvt-toolbar");t.id="bvt-toolbar",this.toolbar=t,document.body.appendChild(t)}handleStateTransition(t){if(this.#e==="recordingContext"){this.contextElement=t,nt.revertMode();return}this.#e==="recordingHover"&&nt.revertMode(),this.contextElement=null}getElementProperties(t){if(!t||!(t instanceof HTMLElement||t instanceof SVGElement))throw new Error("Please provide a valid HTML element");let n={properties:{},attributes:{},dataset:{}},r={},o={},h={};for(let u in t)try{let p=t[u];typeof p!="function"&&typeof p!="object"&&p!==null&&p!==void 0&&!u.includes("_")&&(r[u]=p)}catch{r[u]="[Error accessing property]"}if(t.attributes)for(let u of t.attributes)u.name!=="data-input-id"&&u.name!=="data-blinq-id"&&(o[u.name]=u.value);if(t.dataset)for(let[u,p]of Object.entries(t.dataset))u!=="inputId"&&u!=="blinqId"&&(h[u]=p);let l=u=>Object.fromEntries(Object.entries(u).sort(([p],[b])=>p.localeCompare(b)));return n.properties=l(r),n.attributes=l(o),n.dataset=l(h),n}getElementDetails(t,n){(va!==t.dataset.inputId||n!=="input")&&(t.dataset.inputId=Ns(),va=t.dataset.inputId,t.__locators=this.getLocatorsObject(t));let r=this.PW.roleUtils.getAriaRole(t),o=this.PW.roleUtils.getElementAccessibleName(t,!1)||this.PW.roleUtils.getElementAccessibleName(t,!0)||"",h=this.getElementProperties(t),l=this.PW.selectorUtils.elementText(new Map,t);return{role:r,label:o,inputID:t.dataset.inputId,tagName:t.tagName,type:t.type,text:l.full.trim(),textNormalized:l.normalized.trim(),parent:`tagname: ${t.parentElement?.tagName}
164
164
  innerText: ${t.parentElement?.innerText}`,attrs:{placeholder:t.getAttribute("placeholder"),src:t.getAttribute("src"),href:t.getAttribute("href"),alt:t.getAttribute("alt"),value:t.value,tagName:t.tagName,text:t.textContent,type:t.type,disabled:t.disabled,readOnly:t.readOnly,required:t.required,checked:t.checked,innerText:t.innerText},attributes:h.attributes,properties:h.properties,dataset:h.dataset}}handleEvent(t){if(!this.toolbar)return!0;let n=this.eventUtils.deepEventTarget(t);switch(t.type){case"pointerdown":{let r=n.closest("x-bvt-tool");if(r?.name==="drag")return this.rect=this.toolbar.getBoundingClientRect(),this.offsetX=t.clientX-this.rect.left,this.offsetY=t.clientY-this.rect.top,this.#r=!0,!1;if(r)return!1;break}case"pointerup":{if(this.#r)return this.#r=!1,!1;break}case"mousemove":{if(this.#r){let r=t.clientX-this.offsetX,o=t.clientY-this.offsetY;return r<0||o<0||r+this.rect.width>window.innerWidth||o+this.rect.height>window.innerHeight?void 0:(this.toolbar.style.left=`${r}px`,!1)}break}case"click":{let r=n.closest("x-bvt-tool");if(r?.name==="hover")return r.selected?nt.revertMode():nt.setMode("recordingHover"),!1;break}}return!0}isPopupCloseEvent(t){let n=t.type,r=n==="pointerdown",o=n==="keydown"&&t.key==="Enter";if(!r&&!o)return!1;let h=this.eventUtils.deepEventTarget(t);return this.popupHandlers.some(l=>{let u=l.locator.css,p=l.close_dialog_locator.css,b=document.querySelector(u);if(!b)return!1;let v=window.getComputedStyle(b);return v.display==="none"||v.visibility==="hidden"?!1:h.matches(p)})}getLocatorsObject(t){if(this.contextElement)return this.locatorGenerator.toContextLocators(t,this.contextElement);let n=this.#e==="recordingText";return this.locatorGenerator.getElementLocators(t,{excludeText:n})}addListeners(){["input","keydown","click","pointerdown","pointerup","mousemove"].forEach(n=>{window.addEventListener(n,async r=>{if(this.debugListener)debugger;if(performance.mark("command-received"),!this.handleEvent(r))return;let h=this.#t.getAction(r);if(!h)return;let l=h.element,u=document.querySelector("[data-blinq-id]");u&&u.removeAttribute("data-blinq-id"),l.setAttribute("data-blinq-id",Ns());let p=document.querySelector("[data-blinq-context-id]");p&&p.removeAttribute("data-blinq-context-id"),this.contextElement&&this.contextElement.setAttribute("data-blinq-context-id",Ns()),performance.mark("command-send");let b={mode:this.#e,action:h.details,element:this.getElementDetails(l,n),isPopupCloseClick:this.isPopupCloseEvent(r),...l.__locators??this.getLocatorsObject(l),frame:this.getFrameDetails(),statistics:{time:`${performance.measure("command-received","command-send").duration.toFixed(2)} ms`}},v={id:l.getAttribute("data-blinq-id"),contextId:this.contextElement?.getAttribute("data-blinq-context-id"),doc:this.snapshotCapturer.createSnapshot({excludeSelectors:["x-bvt-toolbar","script","style","link[rel=stylesheet]"]})};b.snapshotDetails=v,await nt.recordCommand(b),this.handleStateTransition(h.element)},{capture:!0})})}setPopupHandlers(t){this.popupHandlers=t}setDisableHighlight(t){this.disableHighlight=t}setImproviseLocators(t){this.improviseLocators=t}deselectAriaElements(){for(let t of this.interestedElements.keys())t.style.background=t.__originalBackground,delete t.__originalBackground;this.interestedElements.clear()}processAriaSnapshot(t){let n=this.snapshotUtils.findMatchingElements(t,this.snapshotElements);for(let r of n.values()){let o=r;o&&(o.__originalOutline=o.style.outline,o.style.outline="2px solid blue",setTimeout(()=>{o.style.outline=o.__originalOutline,delete o.__originalOutline},2e3))}}setTestAttributes(t){this.locatorGenerator.options.customAttributes=t}};window.__bvt_Recorder=new Cs(window.__bvt_Recorder_config);var Is=class extends HTMLElement{#t=!1;tooltipText=null;#e=null;#n=!1;constructor(t,n){super()}connectedCallback(){this.#n||(this.init(),this.addEventListener("mouseenter",this.showTooltip),this.addEventListener("mouseleave",this.hideTooltip),this.#n=!0)}init(){this.setAttribute("role","button"),this.style.cssText=`
165
165
  display: inline-flex;
166
166
  align-items: center;
@@ -144,7 +144,7 @@ class BVTRecorder {
144
144
  getAction: (e) => {
145
145
  this.eventUtils.consumeEvent(e);
146
146
  },
147
- getInterestedElement: () => {},
147
+ getInterestedElement: () => { },
148
148
  hoverOutlineStyle: "",
149
149
  });
150
150
 
@@ -159,7 +159,7 @@ class BVTRecorder {
159
159
  };
160
160
  },
161
161
  getAction: () => null,
162
- getInterestedElement: () => {},
162
+ getInterestedElement: () => { },
163
163
  hoverOutlineStyle: "",
164
164
  });
165
165
 
@@ -174,7 +174,7 @@ class BVTRecorder {
174
174
  };
175
175
  },
176
176
  getAction: () => null,
177
- getInterestedElement: () => {},
177
+ getInterestedElement: () => { },
178
178
  hoverOutlineStyle: "",
179
179
  });
180
180
 
@@ -684,13 +684,15 @@ class BVTRecorder {
684
684
  this.PW.roleUtils.getElementAccessibleName(el, true) ||
685
685
  "";
686
686
  const result = this.getElementProperties(el);
687
+ const elText = this.PW.selectorUtils.elementText(new Map(), el)
687
688
  return {
688
689
  role,
689
690
  label,
690
691
  inputID: el.dataset.inputId,
691
692
  tagName: el.tagName,
692
693
  type: el.type,
693
- text: this.PW.selectorUtils.elementText(new Map(), el).full.trim(),
694
+ text: elText.full.trim(),
695
+ textNormalized: elText.normalized.trim(),
694
696
  parent: `tagname: ${el.parentElement?.tagName}\ninnerText: ${el.parentElement?.innerText}`,
695
697
  attrs: {
696
698
  placeholder: el.getAttribute("placeholder"),
@@ -80,9 +80,9 @@ const timeOutForFunction = async (promise, timeout = 5000) => {
80
80
  }
81
81
  };
82
82
 
83
- async function BVTRecorderInit({ envName, projectDir, roomId, TOKEN }) {
83
+ async function BVTRecorderInit({ envName, projectDir, roomId, TOKEN, socket = null }) {
84
84
  console.log("Connecting to " + WS_URL);
85
- const socket = io(WS_URL);
85
+ socket = socket || io(WS_URL);
86
86
  socketLogger.init(socket, { context: "BVTRecorder", eventName: "BVTRecorder.log" });
87
87
  socket.on("connect", () => {
88
88
  socketLogger.info("Connected to BVTRecorder server");
@@ -337,7 +337,7 @@ const parameterizeLocators = ({ cmd, locs, isValueVariable, isTargetValueVariabl
337
337
  const variable = cmd.value.slice(1, -1);
338
338
  // const val = parametersMap[variable];
339
339
  if (typeof cmd.text === "string") {
340
- const replacementFromValue = cmd.text.trim().replace(/\s+/, " ") ?? ""; // val.trim();
340
+ const replacementFromValue = cmd.text.trim().replace(/\s+/g, " ") ?? ""; // val.trim();
341
341
  if (replacementFromValue.length > 0) {
342
342
  const replacementToValue = `{${variable}}`;
343
343
  locs = _parameterizeLocators(locs, replacementFromValue, replacementToValue);
@@ -348,7 +348,7 @@ const parameterizeLocators = ({ cmd, locs, isValueVariable, isTargetValueVariabl
348
348
  const variable = cmd.targetValue.slice(1, -1);
349
349
  // const val = parametersMap[variable];
350
350
  if (typeof cmd.targetText === "string") {
351
- const replacementFromValue = cmd.targetText.trim().replace(/\s+/, " ") ?? ""; // val.trim();
351
+ const replacementFromValue = cmd.targetText.trim().replace(/\s+/g, " ") ?? ""; // val.trim();
352
352
  if (replacementFromValue.length > 0) {
353
353
  const replacementToValue = `{${variable}}`;
354
354
  locs = _parameterizeLocators(locs, replacementFromValue, replacementToValue);
@@ -0,0 +1,29 @@
1
+ import { io } from "socket.io-client";
2
+ import { BVTRecorderInit } from "./bvt_init";
3
+ const requiredEnvVars = ["PROJECT_ID", "BLINQ_TOKEN", "SESSION_ID", "WORKER_WS_SERVER_URL"];
4
+ function validateEnvVariables() {
5
+ const missingVars = requiredEnvVars.filter((varName) => !process.env[varName]);
6
+ if (missingVars.length > 0) {
7
+ throw new Error(`Missing required environment variables: ${missingVars.join(", ")}`);
8
+ }
9
+ }
10
+ const socket = io(process.env.WORKER_WS_SERVER_URL, {
11
+ path: "/ws",
12
+ transports: ["websocket", "polling"],
13
+ reconnection: true,
14
+ });
15
+ function initWebBVTRecorder(socket) {
16
+ validateEnvVariables();
17
+ const WORKER_WS_SERVER_URL = process.env.WORKER_WS_SERVER_URL;
18
+ const PROJECT_ID = process.env.PROJECT_ID;
19
+ const TOKEN = process.env.BLINQ_TOKEN;
20
+ const ROOM_ID = process.env.SESSION_ID;
21
+ BVTRecorderInit({
22
+ envName: WORKER_WS_SERVER_URL,
23
+ projectDir: PROJECT_ID,
24
+ roomId: ROOM_ID,
25
+ TOKEN: TOKEN,
26
+ socket: socket,
27
+ });
28
+ }
29
+ initWebBVTRecorder(socket);
@@ -0,0 +1,129 @@
1
+ // web-ipcMain.ts
2
+ import { EventEmitter } from "events";
3
+ export class WebIpcMain extends EventEmitter {
4
+ socket;
5
+ handlers = new Map();
6
+ constructor(socket) {
7
+ super();
8
+ this.socket = socket;
9
+ this.setupSocketListeners();
10
+ }
11
+ setupSocketListeners() {
12
+ // Handle invoke calls from renderer (via relay server)
13
+ this.socket.on("invoke", async ({ channel, args, invokeId, clientId }) => {
14
+ const handler = this.handlers.get(channel);
15
+ if (!handler) {
16
+ this.socket.emit("invoke-response", {
17
+ invokeId,
18
+ clientId,
19
+ error: `No handler registered for channel: ${channel}`,
20
+ });
21
+ return;
22
+ }
23
+ try {
24
+ const event = {
25
+ frameId: 0,
26
+ processId: 0,
27
+ sender: {
28
+ send: (replyChannel, ...replyArgs) => {
29
+ this.socket.emit("message", { channel: replyChannel, args: replyArgs, clientId });
30
+ },
31
+ },
32
+ senderFrame: null,
33
+ };
34
+ const result = await Promise.resolve(handler(event, ...args));
35
+ this.socket.emit("invoke-response", { invokeId, clientId, result });
36
+ }
37
+ catch (error) {
38
+ this.socket.emit("invoke-response", {
39
+ invokeId,
40
+ clientId,
41
+ error: error.message || "Handler error",
42
+ });
43
+ }
44
+ });
45
+ // Handle send calls from renderer (fire and forget)
46
+ this.socket.on("send", ({ channel, args, clientId }) => {
47
+ const event = {
48
+ frameId: 0,
49
+ processId: 0,
50
+ sender: {
51
+ send: (replyChannel, ...replyArgs) => {
52
+ this.socket.emit("message", { channel: replyChannel, args: replyArgs, clientId });
53
+ },
54
+ },
55
+ senderFrame: null,
56
+ ports: [],
57
+ reply: (replyChannel, ...replyArgs) => {
58
+ this.socket.emit("message", { channel: replyChannel, args: replyArgs, clientId });
59
+ },
60
+ };
61
+ this.emit(channel, event, ...args);
62
+ });
63
+ // Handle postMessage
64
+ this.socket.on("postMessage", ({ channel, message, clientId }) => {
65
+ const event = {
66
+ frameId: 0,
67
+ processId: 0,
68
+ sender: {
69
+ send: (replyChannel, ...replyArgs) => {
70
+ this.socket.emit("message", { channel: replyChannel, args: replyArgs, clientId });
71
+ },
72
+ },
73
+ senderFrame: null,
74
+ ports: [],
75
+ reply: (replyChannel, ...replyArgs) => {
76
+ this.socket.emit("message", { channel: replyChannel, args: replyArgs, clientId });
77
+ },
78
+ };
79
+ this.emit(channel, event, message);
80
+ });
81
+ // Handle sendToHost
82
+ this.socket.on("sendToHost", ({ channel, args, clientId }) => {
83
+ const event = {
84
+ frameId: 0,
85
+ processId: 0,
86
+ sender: {
87
+ send: (replyChannel, ...replyArgs) => {
88
+ this.socket.emit("message", { channel: replyChannel, args: replyArgs, clientId });
89
+ },
90
+ },
91
+ senderFrame: null,
92
+ ports: [],
93
+ reply: (replyChannel, ...replyArgs) => {
94
+ this.socket.emit("message", { channel: replyChannel, args: replyArgs, clientId });
95
+ },
96
+ };
97
+ this.emit(channel, event, ...args);
98
+ });
99
+ }
100
+ handle(channel, listener) {
101
+ if (this.handlers.has(channel)) {
102
+ throw new Error(`Handler for channel '${channel}' already exists`);
103
+ }
104
+ this.handlers.set(channel, listener);
105
+ }
106
+ handleOnce(channel, listener) {
107
+ const onceWrapper = async (event, ...args) => {
108
+ this.removeHandler(channel);
109
+ return await Promise.resolve(listener(event, ...args));
110
+ };
111
+ this.handle(channel, onceWrapper);
112
+ }
113
+ removeHandler(channel) {
114
+ this.handlers.delete(channel);
115
+ }
116
+ // Send message to all connected clients (via relay server)
117
+ sendToAll(channel, ...args) {
118
+ this.socket.emit("broadcast", { channel, args });
119
+ }
120
+ // Send message to specific client by client ID (via relay server)
121
+ sendToClient(clientId, channel, ...args) {
122
+ this.socket.emit("message", { channel, args, clientId });
123
+ }
124
+ // Cleanup
125
+ destroy() {
126
+ this.handlers.clear();
127
+ this.removeAllListeners();
128
+ }
129
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1545-dev",
3
+ "version": "1.0.1547-dev",
4
4
  "description": " ",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",