@dev-blinq/cucumber_client 1.0.1558-dev → 1.0.1559-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.
|
@@ -161,7 +161,7 @@ ${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.pus
|
|
|
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
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=y,e.isScalar=m,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:u=[]}=t;this.disableHighlight=n,this.improviseLocators=r,this.popupHandlers=o,this.locatorGenerator.options.customAttributes=u,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:y=>{this.eventUtils.consumeEvent(y)},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:y=>y,hoverOutlineStyle:"2px solid red",getAction(y){if(l.eventUtils.consumeEvent(y),y.type==="pointerdown"){let m=l.eventUtils.deepEventTarget(y);return{details:{name:"click"},element:m}}}}),u=new Pe("multiInspecting",{start:()=>{this.toolbar?.hide();let y=document.getElementsByTagName("body")[0];this.pageSnapshot=this.injectedScript.ariaSnapshot(y),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:m}of this.snapshotElements)this.elementSet.add(m);return()=>{this.toolbar?.show();for(let m of this.interestedElements.keys())m.style.background=m.__originalBackground,delete m.__originalBackground}},getInterestedElement:y=>this.snapshotUtils.isSnapshotAvailable(y,this.elementSet),hoverOutlineStyle:"2px solid red",getAction:y=>{if(this.eventUtils.consumeEvent(y),y.type==="pointerdown"){let m=this.eventUtils.deepEventTarget(y),w=this.injectedScript.ariaSnapshot(m);if(this.snapshotUtils.isSnapshotAvailable(m,this.elementSet)){if(this.interestedElements.has(m)?(this.interestedElements.delete(m),m.style.background=m.__originalBackground,delete m.__originalBackground):(m.__originalBackground=m.style.background,m.style.background="rgba(255, 204, 0, 0.3)",this.interestedElements.set(m,w)),Array.from(this.interestedElements.keys()).length===0)return{details:{name:"click",value:""},element:m};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:m}}}}}),l=this,h=new Pe("recordingText",{start:()=>(this.toolbar?.hide(),()=>{this.toolbar?.show(),this.resetHighlight(this.activeElement)}),getInterestedElement:y=>{if(yu(y))return y},hoverOutlineStyle:"2px solid red",getAction(y){if(l.eventUtils.consumeEvent(y),y.type==="pointerdown"){let m=l.eventUtils.deepEventTarget(y);if(this.getInterestedElement(m))return{details:{name:"click"},element:m}}}}),p=new Pe("recordingHover",{start:()=>(this.toolbar&&(this.toolbar.hoverTool.selected=!0),()=>{this.resetHighlight(this.activeElement),this.toolbar&&(this.toolbar.hoverTool.selected=!1)}),getAction:y=>{if(this.eventUtils.consumeEvent(y),y.type==="click")return{details:{name:"click"},element:this.eventUtils.deepEventTarget(y)}},getInterestedElement:y=>y,hoverOutlineStyle:"2px solid blue"}),b=new Pe("recordingInput",{start:()=>()=>{this.resetHighlight(this.activeElement)},getAction:y=>{switch(y.type){case"pointerdown":{if(y.button===2)return;let m=this.eventUtils.getNearestInteractiveElement(this.eventUtils.deepEventTarget(y)),w=this.eventUtils.asCheckbox(m);return m.nodeName==="INPUT"&&m.type.toLowerCase()==="file"?void 0:w?{details:{name:w.checked?"uncheck":"check"},element:m}:{details:{name:"click",position:this.eventUtils.positionForEvent(y),button:this.eventUtils.buttonForEvent(y),modifiers:this.eventUtils.modifiersForEvent(y),clickCount:y.detail},element:m}}case"input":{let m=this.eventUtils.getNearestInteractiveElement(this.eventUtils.deepEventTarget(y));return m.nodeName==="INPUT"&&m.type.toLowerCase()==="file"?{details:{name:"setInputFiles",files:[...m.files||[]].map(w=>w.name)},element:m}:this.eventUtils.isRangeInput(m)?{details:{name:"fill",text:m.value},element:m}:["INPUT","TEXTAREA"].includes(m.nodeName)||m.isContentEditable?m.nodeName==="INPUT"&&["checkbox","radio"].includes(m.type.toLowerCase())?void 0:{details:{name:"fill",text:m.isContentEditable?m.innerText:m.value},element:m}:m.nodeName==="SELECT"?{details:{name:"select",options:[...m.selectedOptions].map(A=>A.value)},element:m}:void 0}case"keydown":{if(!this.eventUtils.shouldGenerateKeyPressFor(y))return;if(y.key===" "){let m=this.eventUtils.asCheckbox(this.eventUtils.deepEventTarget(y));if(m)return{details:{name:m.checked?"uncheck":"check"},element:m}}return{details:{name:"press",key:y.key,modifiers:this.eventUtils.modifiersForEvent(y)},element:this.eventUtils.deepEventTarget(y)}}}},getInterestedElement:y=>{let m=this.eventUtils.getNearestInteractiveElement(y);return m||y},hoverOutlineStyle:"2px solid red"}),v={noop:t,idle:n,running:r,recordingText:h,recordingContext:h,recordingInput:b,recordingHover:p,inspecting:o,multiInspecting:u};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 u=r.call(this,o);return n.addHighlightListeners(u),u}}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={},u={};for(let h in t)try{let p=t[h];typeof p!="function"&&typeof p!="object"&&p!==null&&p!==void 0&&!h.includes("_")&&(r[h]=p)}catch{r[h]="[Error accessing property]"}if(t.attributes)for(let h of t.attributes)h.name!=="data-input-id"&&h.name!=="data-blinq-id"&&(o[h.name]=h.value);if(t.dataset)for(let[h,p]of Object.entries(t.dataset))h!=="inputId"&&h!=="blinqId"&&(u[h]=p);let l=h=>Object.fromEntries(Object.entries(h).sort(([p],[b])=>p.localeCompare(b)));return n.properties=l(r),n.attributes=l(o),n.dataset=l(u),n}getElementDetails(t,n){(va!==t.dataset.inputId||n!=="input")&&(t.dataset.inputId=Ns(),va=t.dataset.inputId);let r=this.PW.roleUtils.getAriaRole(t),o=this.PW.roleUtils.getElementAccessibleName(t,!1)||this.PW.roleUtils.getElementAccessibleName(t,!0)||"",u=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
|
-
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:u.attributes,properties:u.properties,dataset:u.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 u=this.eventUtils.deepEventTarget(t);return this.popupHandlers.some(l=>{let h=l.locator.css,p=l.close_dialog_locator.css,b=document.querySelector(h);if(!b)return!1;let v=window.getComputedStyle(b);return v.display==="none"||v.visibility==="hidden"?!1:u.matches(p)})}getLocatorsObject(t,n={}){if(this.contextElement)return this.locatorGenerator.toContextLocators(t,this.contextElement,n);let r=this.#e==="recordingText";return this.locatorGenerator.getElementLocators(t,{excludeText:r,...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 u=this.#t.getAction(r);if(!u)return;let l=u.element,h=document.querySelector("[data-blinq-id]");h&&h.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:u.details,element:this.getElementDetails(l,n),isPopupCloseClick:this.isPopupCloseEvent(r),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,
|
|
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:u.attributes,properties:u.properties,dataset:u.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 u=this.eventUtils.deepEventTarget(t);return this.popupHandlers.some(l=>{let h=l.locator.css,p=l.close_dialog_locator.css,b=document.querySelector(h);if(!b)return!1;let v=window.getComputedStyle(b);return v.display==="none"||v.visibility==="hidden"?!1:u.matches(p)})}getLocatorsObject(t,n={}){if(this.contextElement)return this.locatorGenerator.toContextLocators(t,this.contextElement,n);let r=this.#e==="recordingText";return this.locatorGenerator.getElementLocators(t,{excludeText:r,...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 u=this.#t.getAction(r);if(!u)return;let l=u.element,h=document.querySelector("[data-blinq-id]");h&&h.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:u.details,element:this.getElementDetails(l,n),isPopupCloseClick:this.isPopupCloseEvent(r),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,nt.recordCommand(b),this.handleStateTransition(u.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;
|
|
167
167
|
justify-content: center;
|
|
@@ -858,7 +858,7 @@ class BVTRecorder {
|
|
|
858
858
|
// await bvtRecorderBindings.validateLocators(snapshotDetails);
|
|
859
859
|
// });
|
|
860
860
|
// console.log(cmd);
|
|
861
|
-
|
|
861
|
+
bvtRecorderBindings.recordCommand(cmd);
|
|
862
862
|
this.handleStateTransition(action.element);
|
|
863
863
|
},
|
|
864
864
|
{ capture: true }
|