@flowriki/agent 0.1.0-beta.31 → 0.1.0-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accname.global.js +1 -1
- package/dist/{chunk-XSH3IU5Y.js → chunk-3UUCI66O.js} +82 -28
- package/dist/cli.js +80 -8
- package/dist/engine.js +1 -1
- package/package.json +1 -1
package/dist/accname.global.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{function U(e,t,i){function u(n){let o=e.__flAccName;if(o){let l=o(n);return l||t(n.placeholder)||t(n.title)||""}return g(n)}function g(n){let o=n.getAttribute&&n.getAttribute("aria-labelledby");if(o){let b=o.split(/\s+/).map(y=>document.getElementById(y)).filter(Boolean).map(y=>t(y.textContent)).filter(Boolean).join(" ");if(b)return b}let l=t(n.getAttribute&&n.getAttribute("aria-label"));if(l)return l;if(n.id){let b=document.querySelector('label[for="'+CSS.escape(n.id)+'"]');if(b&&t(b.textContent))return t(b.textContent)}let a=n.closest&&n.closest("label");if(a&&t(a.textContent))return t(a.textContent);let s=n.tagName.toLowerCase(),m=(n.type||"").toLowerCase();return(["button","a","summary"].includes(s)||n.getAttribute&&n.getAttribute("role")==="button")&&t(n.textContent)?t(n.textContent):s==="input"&&["submit","button","reset"].includes(m)&&n.value?t(n.value):t(n.placeholder)||t(n.title)||""}let T="input,select,textarea,button,meter,output,progress,[contenteditable]";function h(n){let o=n.parentElement;if(!o||!n.matches?.(T))return"";for(let l of Array.from(o.querySelectorAll("label"))){let a=l.getAttribute("for");if(a&&document.getElementById(a))continue;let s=t(l.textContent);if(s)return s}return""}let L=new WeakMap,H=crypto.randomUUID(),D=0;function R(n){let o=n.getRootNode(),l=E=>o.querySelectorAll(E).length===1,a=[],s=n.getAttribute?.("data-testid");s&&l(`[data-testid=${JSON.stringify(s)}]`)&&a.push({strategy:"testId",value:s});let m=t(n.placeholder);m&&l(`[placeholder=${JSON.stringify(n.placeholder)}]`)&&a.push({strategy:"placeholder",value:m});let b=t(n.getAttribute?.("alt"));b&&l(`[alt=${JSON.stringify(n.getAttribute("alt"))}]`)&&a.push({strategy:"altText",value:b});let y=n.getAttribute?.("title");return y&&l(`[title=${JSON.stringify(y)}]`)&&a.push({strategy:"title",value:t(y)}),n.id&&!/:r|[a-f0-9]{12}|\d{6}/i.test(n.id)&&l(`#${CSS.escape(n.id)}`)&&a.push({strategy:"css",value:`#${CSS.escape(n.id)}`}),a.slice(0,4)}function O(n){let o=L.get(n);o||(o=`${H}:${++D}`,L.set(n,o));let l=R(n),a={__targetId:o,...l.length?{candidates:l}:{}},s=n.getRootNode(),m=u(n);if(m)return{...a,name:m};let b=h(n);if(b)return{...a,name:b,nameFrom:"adjacent-label"};let y=t(Array.from(n.childNodes||[]).filter(I=>I.nodeType===3).map(I=>I.textContent).join(" "));if(y&&y.length<=80)return{...a,name:y,nameFrom:"text"};let E=l[0];return E?{...a,name:"",locator:E.strategy==="placeholder"||E.strategy==="altText"?{strategy:"css",value:`[${E.strategy==="altText"?"alt":"placeholder"}=${JSON.stringify(E.value)}]`}:E}:{...a,name:""}}function $(n){let o=n.getAttribute&&n.getAttribute("role");if(o)return o;let l=n.tagName.toLowerCase(),a=(n.type||"").toLowerCase();return l==="button"?"button":l==="a"&&n.href?"link":l==="select"?n.multiple||n.size>1?"listbox":"combobox":l==="textarea"?"textbox":l==="input"?["submit","button","reset","file"].includes(a)?"button":a==="checkbox"||a==="radio"?a:a==="number"?"spinbutton":a==="search"?"searchbox":a==="range"?"slider":"textbox":n.isContentEditable?"textbox":V[l]??""}let V={li:"listitem",ul:"list",ol:"list",tr:"row",td:"cell",th:"columnheader",table:"table",nav:"navigation",main:"main",header:"banner",footer:"contentinfo",aside:"complementary",form:"form",dialog:"dialog",details:"group",fieldset:"group",img:"img",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading"};function M(n){let o=n,l=null;for(let a=0;o&&a<6&&!(o===document.body||o===document.documentElement);a++){let s="";try{s=getComputedStyle(o).cursor}catch{break}if(s==="pointer")l=o;else if(l)break;o=o.parentElement}return l}let C="tr, [role=row], li, [role=listitem], [role=article], [role=gridcell]";function B(n){try{let o=n.cloneNode(!0);for(let l of Array.from(o.querySelectorAll(i+", input, select, textarea")))l.remove();for(let l of Array.from(o.querySelectorAll("td, th, li, p, div, span, tr")))l.append(" ");return t(o.textContent).slice(0,120)}catch{return""}}function q(n,o,l){if(!l)return!1;let a;try{a=Array.from(document.querySelectorAll(i+", input, select, textarea"))}catch{return!1}if(a.length>400)return!0;let s=0;for(let m of a)if(m!==n&&$(m)===o&&O(m).name===l&&++s>0)return!0;return!1}function N(n,o,l){if(!q(n,o,l))return null;let a=n.closest&&n.closest(C);if(!a)return null;let s=B(a);if(!s)return null;let m=a.getAttribute&&a.getAttribute("role"),b=a.tagName.toLowerCase();return{scope:s,scopeRole:m||(b==="tr"?"row":b==="li"?"listitem":b)}}function r(n){if(!n.closest)return null;let o=n.closest("nav, main, aside, header, footer, [role=navigation], [role=main], [role=complementary], [role=banner], [role=contentinfo], [role=search]");if(!o)return null;let l=o.getAttribute&&o.getAttribute("role");if(l)return{scope:u(o),scopeRole:l};let a=o.tagName.toLowerCase();return a==="nav"?{scope:u(o),scopeRole:"navigation"}:a==="main"?{scope:u(o),scopeRole:"main"}:a==="aside"?{scope:u(o),scopeRole:"complementary"}:o.closest("article, aside, main, nav, section")!==o&&o.closest("article, aside, main, nav, section")!==null?null:a==="header"?{scope:u(o),scopeRole:"banner"}:a==="footer"?{scope:u(o),scopeRole:"contentinfo"}:null}let c=new WeakMap;function f(n,o){n&&o&&Object.keys(o).length&&c.set(n,o)}function w(n,o,l){let a=c.get(n);if(a&&(a.scopeRole||a.nth!==void 0||a.warning))return{scope:a.scope??"",...a.scopeRole?{scopeRole:a.scopeRole}:{},...a.nth===void 0?{}:{nth:a.nth},...a.warning?{warning:a.warning}:{}};let s=N(n,o,l);return s||{scope:S(n)}}function S(n){let o=n.closest&&n.closest("form, fieldset, section, [role=group], [role=region], [role=dialog], [role=alertdialog], dialog");return o?u(o):""}function A(n){if(n.id)return"#"+CSS.escape(n.id);let o=[],l=n;for(;l&&l.nodeType===1&&l!==document.body;){let a=Array.from(l.parentNode?l.parentNode.children:[]).filter(s=>s.tagName===l.tagName);o.unshift(a.length>1?`${l.tagName.toLowerCase()}:nth-of-type(${a.indexOf(l)+1})`:l.tagName.toLowerCase()),l=l.parentElement}return"body > "+o.join(" > ")}return{accName:u,identify:O,roleOf:$,pointerTarget:M,scoping:w,cssPath:A,isAmbiguous:q,landmarkScope:r,remember:f}}var ge=Object.prototype.toString;function Q(e){return typeof e=="function"||ge.call(e)==="[object Function]"}function ye(e){var t=Number(e);return isNaN(t)?0:t===0||!isFinite(t)?t:(t>0?1:-1)*Math.floor(Math.abs(t))}var he=Math.pow(2,53)-1;function ve(e){var t=ye(e);return Math.min(Math.max(t,0),he)}function v(e,t){var i=Array,u=Object(e);if(e==null)throw new TypeError("Array.from requires an array-like object - not null or undefined");if(typeof t<"u"&&!Q(t))throw new TypeError("Array.from: when provided, the second argument must be a function");for(var g=ve(u.length),T=Q(i)?Object(new i(g)):new Array(g),h=0,L;h<g;)L=u[h],t?T[h]=t(L,h):T[h]=L,h+=1;return T.length=g,T}function P(e){"@babel/helpers - typeof";return P=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},P(e)}function we(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function X(e,t){for(var i=0;i<t.length;i++){var u=t[i];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,Y(u.key),u)}}function Se(e,t,i){return t&&X(e.prototype,t),i&&X(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ee(e,t,i){return t=Y(t),t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Y(e){var t=xe(e,"string");return P(t)=="symbol"?t:t+""}function xe(e,t){if(P(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var u=i.call(e,t||"default");if(P(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ae=(function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];we(this,e),Ee(this,"items",void 0),this.items=t}return Se(e,[{key:"add",value:function(i){return this.has(i)===!1&&this.items.push(i),this}},{key:"clear",value:function(){this.items=[]}},{key:"delete",value:function(i){var u=this.items.length;return this.items=this.items.filter(function(g){return g!==i}),u!==this.items.length}},{key:"forEach",value:function(i){var u=this;this.items.forEach(function(g){i(g,g,u)})}},{key:"has",value:function(i){return this.items.indexOf(i)!==-1}},{key:"size",get:function(){return this.items.length}}])})(),Z=typeof Set>"u"?Set:Ae;function p(e){var t;return(t=e.localName)!==null&&t!==void 0?t:e.tagName.toLowerCase()}var Te={article:"article",aside:"complementary",button:"button",datalist:"listbox",dd:"definition",details:"group",dialog:"dialog",dt:"term",fieldset:"group",figure:"figure",form:"form",footer:"contentinfo",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",header:"banner",hr:"separator",html:"document",legend:"legend",li:"listitem",math:"math",main:"main",menu:"list",nav:"navigation",ol:"list",optgroup:"group",option:"option",output:"status",progress:"progressbar",section:"region",summary:"button",table:"table",tbody:"rowgroup",textarea:"textbox",tfoot:"rowgroup",td:"cell",th:"columnheader",thead:"rowgroup",tr:"row",ul:"list"},Le={caption:new Set(["aria-label","aria-labelledby"]),code:new Set(["aria-label","aria-labelledby"]),deletion:new Set(["aria-label","aria-labelledby"]),emphasis:new Set(["aria-label","aria-labelledby"]),generic:new Set(["aria-label","aria-labelledby","aria-roledescription"]),insertion:new Set(["aria-label","aria-labelledby"]),none:new Set(["aria-label","aria-labelledby"]),paragraph:new Set(["aria-label","aria-labelledby"]),presentation:new Set(["aria-label","aria-labelledby"]),strong:new Set(["aria-label","aria-labelledby"]),subscript:new Set(["aria-label","aria-labelledby"]),superscript:new Set(["aria-label","aria-labelledby"])};function Ne(e,t){return["aria-atomic","aria-busy","aria-controls","aria-current","aria-description","aria-describedby","aria-details","aria-dropeffect","aria-flowto","aria-grabbed","aria-hidden","aria-keyshortcuts","aria-label","aria-labelledby","aria-live","aria-owns","aria-relevant","aria-roledescription"].some(function(i){var u;return e.hasAttribute(i)&&!((u=Le[t])!==null&&u!==void 0&&u.has(i))})}function ee(e,t){return Ne(e,t)}function G(e){var t=Re(e);if(t===null||_.indexOf(t)!==-1){var i=Ce(e);if(_.indexOf(t||"")===-1||ee(e,i||""))return i}return t}function Ce(e){var t=Te[p(e)];if(t!==void 0)return t;switch(p(e)){case"a":case"area":case"link":if(e.hasAttribute("href"))return"link";break;case"img":return e.getAttribute("alt")===""&&!ee(e,"img")?"presentation":"img";case"input":{var i=e,u=i.type;switch(u){case"button":case"image":case"reset":case"submit":return"button";case"checkbox":case"radio":return u;case"range":return"slider";case"email":case"tel":case"text":case"url":return e.hasAttribute("list")?"combobox":"textbox";case"search":return e.hasAttribute("list")?"combobox":"searchbox";case"number":return"spinbutton";default:return null}}case"select":return e.hasAttribute("multiple")||e.size>1?"listbox":"combobox"}return null}function Re(e){var t=e.getAttribute("role");if(t!==null){var i=t.trim().split(" ")[0];if(i.length>0)return i}return null}var _=["presentation","none"];function d(e){return e!==null&&e.nodeType===e.ELEMENT_NODE}function W(e){return d(e)&&p(e)==="caption"}function j(e){return d(e)&&p(e)==="input"}function te(e){return d(e)&&p(e)==="optgroup"}function re(e){return d(e)&&p(e)==="select"}function ne(e){return d(e)&&p(e)==="table"}function ie(e){return d(e)&&p(e)==="textarea"}function ae(e){var t=e.ownerDocument===null?e:e.ownerDocument,i=t.defaultView;if(i===null)throw new TypeError("no window available");return i}function oe(e){return d(e)&&p(e)==="fieldset"}function le(e){return d(e)&&p(e)==="legend"}function ue(e){return d(e)&&p(e)==="slot"}function Ie(e){return d(e)&&e.ownerSVGElement!==void 0}function se(e){return d(e)&&p(e)==="svg"}function ce(e){return Ie(e)&&p(e)==="title"}function k(e,t){if(d(e)&&e.hasAttribute(t)){var i=e.getAttribute(t).split(" "),u=e.getRootNode?e.getRootNode():e.ownerDocument;return i.map(function(g){return u.getElementById(g)}).filter(function(g){return g!==null})}return[]}function x(e,t){return d(e)?t.indexOf(G(e))!==-1:!1}function Oe(e){return e.trim().replace(/\s\s+/g," ")}function Me(e,t){if(!d(e))return!1;if(e.hasAttribute("hidden")||e.getAttribute("aria-hidden")==="true")return!0;var i=t(e);return i.getPropertyValue("display")==="none"||i.getPropertyValue("visibility")==="hidden"}function Pe(e){return x(e,["button","combobox","listbox","textbox"])||pe(e,"range")}function pe(e,t){if(!d(e))return!1;if(t==="range")return x(e,["meter","progressbar","scrollbar","slider","spinbutton"]);throw new TypeError("No knowledge about abstract role '".concat(t,"'. This is likely a bug :("))}function fe(e,t){var i=v(e.querySelectorAll(t));return k(e,"aria-owns").forEach(function(u){i.push.apply(i,v(u.querySelectorAll(t)))}),i}function _e(e){return re(e)?e.selectedOptions||fe(e,"[selected]"):fe(e,'[aria-selected="true"]')}function je(e){return x(e,_)}function ke(e){return W(e)}function He(e){return x(e,["button","cell","checkbox","columnheader","gridcell","heading","label","legend","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","row","rowheader","switch","tab","tooltip","treeitem"])}function De(e){return!1}function $e(e){return j(e)||ie(e)?e.value:e.textContent||""}function de(e){var t=e.getPropertyValue("content");return/^["'].*["']$/.test(t)?t.slice(1,-1):""}function me(e){var t=p(e);return t==="button"||t==="input"&&e.getAttribute("type")!=="hidden"||t==="meter"||t==="output"||t==="progress"||t==="select"||t==="textarea"}function be(e){if(me(e))return e;var t=null;return e.childNodes.forEach(function(i){if(t===null&&d(i)){var u=be(i);u!==null&&(t=u)}}),t}function Ve(e){if(e.control!==void 0)return e.control;var t=e.getAttribute("for");return t!==null?e.ownerDocument.getElementById(t):be(e)}function qe(e){var t=e.labels;if(t===null)return t;if(t!==void 0)return v(t);if(!me(e))return null;var i=e.ownerDocument;return v(i.querySelectorAll("label")).filter(function(u){return Ve(u)===e})}function Ge(e){var t=e.assignedNodes();return t.length===0?v(e.childNodes):t}function z(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=new Z,u=typeof Map>"u"?void 0:new Map,g=ae(e),T=t.compute,h=T===void 0?"name":T,L=t.computedStyleSupportsPseudoElements,H=L===void 0?t.getComputedStyle!==void 0:L,D=t.getComputedStyle,R=D===void 0?g.getComputedStyle.bind(g):D,O=t.hidden,$=O===void 0?!1:O,V=function(c,f){if(f!==void 0)throw new Error("use uncachedGetComputedStyle directly for pseudo elements");if(u===void 0)return R(c);var w=u.get(c);if(w)return w;var S=R(c,f);return u.set(c,S),S};function M(r,c){var f="";if(d(r)&&H){var w=R(r,"::before"),S=de(w);f="".concat(S," ").concat(f)}var A=ue(r)?Ge(r):v(r.childNodes).concat(k(r,"aria-owns"));if(A.forEach(function(l){var a=N(l,{isEmbeddedInLabel:c.isEmbeddedInLabel,isReferenced:!1,recursion:!0}),s=d(l)?V(l).getPropertyValue("display"):"inline",m=s!=="inline"?" ":"";f+="".concat(m).concat(a).concat(m)}),d(r)&&H){var n=R(r,"::after"),o=de(n);f="".concat(f," ").concat(o)}return f.trim()}function C(r,c){var f=r.getAttributeNode(c);return f!==null&&!i.has(f)&&f.value.trim()!==""?(i.add(f),f.value):null}function B(r){return d(r)?C(r,"title"):null}function q(r){if(!d(r))return null;if(oe(r)){i.add(r);for(var c=v(r.childNodes),f=0;f<c.length;f+=1){var w=c[f];if(le(w))return N(w,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(ne(r)){i.add(r);for(var S=v(r.childNodes),A=0;A<S.length;A+=1){var n=S[A];if(W(n))return N(n,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(se(r)){i.add(r);for(var o=v(r.childNodes),l=0;l<o.length;l+=1){var a=o[l];if(ce(a))return a.textContent}return null}else if(p(r)==="img"||p(r)==="area"){var s=C(r,"alt");if(s!==null)return s}else if(te(r)){var m=C(r,"label");if(m!==null)return m}if(j(r)&&(r.type==="button"||r.type==="submit"||r.type==="reset")){var b=C(r,"value");if(b!==null)return b;if(r.type==="submit")return"Submit";if(r.type==="reset")return"Reset"}var y=qe(r);if(y!==null&&y.length!==0)return i.add(r),v(y).map(function(J){return N(J,{isEmbeddedInLabel:!0,isReferenced:!1,recursion:!0})}).filter(function(J){return J.length>0}).join(" ");if(j(r)&&r.type==="image"){var E=C(r,"alt");if(E!==null)return E;var I=C(r,"title");return I!==null?I:"Submit Query"}if(x(r,["button"])){var K=M(r,{isEmbeddedInLabel:!1,isReferenced:!1});if(K!=="")return K}return null}function N(r,c){if(i.has(r))return"";if(!$&&Me(r,V)&&!c.isReferenced)return i.add(r),"";var f=d(r)?r.getAttributeNode("aria-labelledby"):null,w=f!==null&&!i.has(f)?k(r,"aria-labelledby"):[];if(h==="name"&&!c.isReferenced&&w.length>0)return i.add(f),w.map(function(s){return N(s,{isEmbeddedInLabel:c.isEmbeddedInLabel,isReferenced:!0,recursion:!1})}).join(" ");var S=c.recursion&&Pe(r)&&h==="name";if(!S){var A=(d(r)&&r.getAttribute("aria-label")||"").trim();if(A!==""&&h==="name")return i.add(r),A;if(!je(r)){var n=q(r);if(n!==null)return i.add(r),n}}if(x(r,["menu"]))return i.add(r),"";if(S||c.isEmbeddedInLabel||c.isReferenced){if(x(r,["combobox","listbox"])){i.add(r);var o=_e(r);return o.length===0?j(r)?r.value:"":v(o).map(function(s){return N(s,{isEmbeddedInLabel:c.isEmbeddedInLabel,isReferenced:!1,recursion:!0})}).join(" ")}if(pe(r,"range"))return i.add(r),r.hasAttribute("aria-valuetext")?r.getAttribute("aria-valuetext"):r.hasAttribute("aria-valuenow")?r.getAttribute("aria-valuenow"):r.getAttribute("value")||"";if(x(r,["textbox"]))return i.add(r),$e(r)}if(He(r)||d(r)&&c.isReferenced||ke(r)||De(r)){var l=M(r,{isEmbeddedInLabel:c.isEmbeddedInLabel,isReferenced:!1});if(l!=="")return i.add(r),l}if(r.nodeType===r.TEXT_NODE)return i.add(r),r.textContent||"";if(c.recursion)return i.add(r),M(r,{isEmbeddedInLabel:c.isEmbeddedInLabel,isReferenced:!1});var a=B(r);return a!==null?(i.add(r),a):(i.add(r),"")}return Oe(N(e,{isEmbeddedInLabel:!1,isReferenced:h==="description",recursion:!1}))}function Be(e){return x(e,["caption","code","deletion","emphasis","generic","insertion","none","paragraph","presentation","strong","subscript","superscript"])}function F(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Be(e)?"":z(e,t)}window.__flAccName=e=>{try{return F(e).replace(/\s+/g," ").trim()}catch{return""}};window.__flCreateTargetIdentity=U;})();
|
|
1
|
+
"use strict";(()=>{function U(e,t,i){function u(r){let a=e.__flAccName;if(a){let l=a(r);return l||t(r.placeholder)||t(r.title)||""}return b(r)}function b(r){let a=r.getAttribute&&r.getAttribute("aria-labelledby");if(a){let p=a.split(/\s+/).map(y=>document.getElementById(y)).filter(Boolean).map(y=>t(y.textContent)).filter(Boolean).join(" ");if(p)return p}let l=t(r.getAttribute&&r.getAttribute("aria-label"));if(l)return l;if(r.id){let p=document.querySelector('label[for="'+CSS.escape(r.id)+'"]');if(p&&t(p.textContent))return t(p.textContent)}let o=r.closest&&r.closest("label");if(o&&t(o.textContent))return t(o.textContent);let s=r.tagName.toLowerCase(),g=(r.type||"").toLowerCase();return(["button","a","summary"].includes(s)||r.getAttribute&&r.getAttribute("role")==="button")&&t(r.textContent)?t(r.textContent):s==="input"&&["submit","button","reset"].includes(g)&&r.value?t(r.value):t(r.placeholder)||t(r.title)||""}let L="input,select,textarea,button,meter,output,progress,[contenteditable]";function h(r){let a=r.parentElement;if(!a||!r.matches?.(L))return"";for(let l of Array.from(a.querySelectorAll("label"))){let o=l.getAttribute("for");if(o&&document.getElementById(o))continue;let s=t(l.textContent).replace(/\s*\*+$/,"");if(s)return s}return""}function C(r,a){return r.getAttribute?.("aria-label")||r.getAttribute?.("aria-labelledby")||r.labels?.length||a!==t(r.placeholder)&&a!==t(r.title)?!1:(r.parentElement?.querySelectorAll("input:not([type=hidden]),select,textarea,[contenteditable]")??[]).length===1}let M=new WeakMap,D=crypto.randomUUID(),I=0;function V(r){let a=r.getRootNode(),l=E=>a.querySelectorAll(E).length===1,o=[],s=r.getAttribute?.("data-testid");s&&l(`[data-testid=${JSON.stringify(s)}]`)&&o.push({strategy:"testId",value:s});let g=t(r.placeholder);g&&l(`[placeholder=${JSON.stringify(r.placeholder)}]`)&&o.push({strategy:"placeholder",value:g});let p=t(r.getAttribute?.("alt"));p&&l(`[alt=${JSON.stringify(r.getAttribute("alt"))}]`)&&o.push({strategy:"altText",value:p});let y=r.getAttribute?.("title");return y&&l(`[title=${JSON.stringify(y)}]`)&&o.push({strategy:"title",value:t(y)}),r.id&&!/:r|[a-f0-9]{12}|\d{6}/i.test(r.id)&&l(`#${CSS.escape(r.id)}`)&&o.push({strategy:"css",value:`#${CSS.escape(r.id)}`}),o.slice(0,4)}function q(r){let a=M.get(r);a||(a=`${D}:${++I}`,M.set(r,a));let l=V(r),o={__targetId:a,...l.length?{candidates:l}:{}},s=r.getRootNode(),g=u(r),p=h(r);if(g&&!(p&&C(r,g)))return{...o,name:g};if(p)return{...o,name:p,nameFrom:"adjacent-label"};let y=t(Array.from(r.childNodes||[]).filter(O=>O.nodeType===3).map(O=>O.textContent).join(" "));if(y&&y.length<=80)return{...o,name:y,nameFrom:"text"};let E=l[0];return E?{...o,name:"",locator:E.strategy==="placeholder"||E.strategy==="altText"?{strategy:"css",value:`[${E.strategy==="altText"?"alt":"placeholder"}=${JSON.stringify(E.value)}]`}:E}:{...o,name:""}}function P(r){let a=r.getAttribute&&r.getAttribute("role");if(a)return a;let l=r.tagName.toLowerCase(),o=(r.type||"").toLowerCase();return l==="button"?"button":l==="a"&&r.href?"link":l==="select"?r.multiple||r.size>1?"listbox":"combobox":l==="textarea"?"textbox":l==="input"?["submit","button","reset","file"].includes(o)?"button":o==="checkbox"||o==="radio"?o:o==="number"?"spinbutton":o==="search"?"searchbox":o==="range"?"slider":"textbox":r.isContentEditable?"textbox":_[l]??""}let _={li:"listitem",ul:"list",ol:"list",tr:"row",td:"cell",th:"columnheader",table:"table",nav:"navigation",main:"main",header:"banner",footer:"contentinfo",aside:"complementary",form:"form",dialog:"dialog",details:"group",fieldset:"group",img:"img",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading"};function R(r){let a=r,l=null;for(let o=0;a&&o<6&&!(a===document.body||a===document.documentElement);o++){let s="";try{s=getComputedStyle(a).cursor}catch{break}if(s==="pointer")l=a;else if(l)break;a=a.parentElement}return l}let B="tr, [role=row], li, [role=listitem], [role=article], [role=gridcell]";function J(r){try{let a=r.cloneNode(!0);for(let l of Array.from(a.querySelectorAll(i+", input, select, textarea")))l.remove();for(let l of Array.from(a.querySelectorAll("td, th, li, p, div, span, tr")))l.append(" ");return t(a.textContent).slice(0,120)}catch{return""}}function A(r,a,l){if(!l)return!1;let o;try{o=Array.from(document.querySelectorAll(i+", input, select, textarea"))}catch{return!1}if(o.length>400)return!0;let s=0;for(let g of o)if(g!==r&&P(g)===a&&q(g).name===l&&++s>0)return!0;return!1}function n(r,a,l){if(!A(r,a,l))return null;let o=r.closest&&r.closest(B);if(!o)return null;let s=J(o);if(!s)return null;let g=o.getAttribute&&o.getAttribute("role"),p=o.tagName.toLowerCase();return{scope:s,scopeRole:g||(p==="tr"?"row":p==="li"?"listitem":p)}}function f(r){if(!r.closest)return null;let a=r.closest("nav, main, aside, header, footer, [role=navigation], [role=main], [role=complementary], [role=banner], [role=contentinfo], [role=search]");if(!a)return null;let l=a.getAttribute&&a.getAttribute("role");if(l)return{scope:u(a),scopeRole:l};let o=a.tagName.toLowerCase();return o==="nav"?{scope:u(a),scopeRole:"navigation"}:o==="main"?{scope:u(a),scopeRole:"main"}:o==="aside"?{scope:u(a),scopeRole:"complementary"}:a.closest("article, aside, main, nav, section")!==a&&a.closest("article, aside, main, nav, section")!==null?null:o==="header"?{scope:u(a),scopeRole:"banner"}:o==="footer"?{scope:u(a),scopeRole:"contentinfo"}:null}let c=new WeakMap;function w(r,a){r&&a&&Object.keys(a).length&&c.set(r,a)}function S(r,a,l){let o=c.get(r);if(o&&(o.scopeRole||o.nth!==void 0||o.warning))return{scope:o.scope??"",...o.scopeRole?{scopeRole:o.scopeRole}:{},...o.nth===void 0?{}:{nth:o.nth},...o.warning?{warning:o.warning}:{}};let s=n(r,a,l);return s||{scope:T(r)}}function T(r){let a=r.closest&&r.closest("form, fieldset, section, [role=group], [role=region], [role=dialog], [role=alertdialog], dialog");return a?u(a):""}function N(r){if(r.id)return"#"+CSS.escape(r.id);let a=[],l=r;for(;l&&l.nodeType===1&&l!==document.body;){let o=Array.from(l.parentNode?l.parentNode.children:[]).filter(s=>s.tagName===l.tagName);a.unshift(o.length>1?`${l.tagName.toLowerCase()}:nth-of-type(${o.indexOf(l)+1})`:l.tagName.toLowerCase()),l=l.parentElement}return"body > "+a.join(" > ")}return{accName:u,identify:q,roleOf:P,pointerTarget:R,scoping:S,cssPath:N,isAmbiguous:A,landmarkScope:f,remember:w}}var ge=Object.prototype.toString;function Q(e){return typeof e=="function"||ge.call(e)==="[object Function]"}function ye(e){var t=Number(e);return isNaN(t)?0:t===0||!isFinite(t)?t:(t>0?1:-1)*Math.floor(Math.abs(t))}var he=Math.pow(2,53)-1;function ve(e){var t=ye(e);return Math.min(Math.max(t,0),he)}function v(e,t){var i=Array,u=Object(e);if(e==null)throw new TypeError("Array.from requires an array-like object - not null or undefined");if(typeof t<"u"&&!Q(t))throw new TypeError("Array.from: when provided, the second argument must be a function");for(var b=ve(u.length),L=Q(i)?Object(new i(b)):new Array(b),h=0,C;h<b;)C=u[h],t?L[h]=t(C,h):L[h]=C,h+=1;return L.length=b,L}function j(e){"@babel/helpers - typeof";return j=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(e)}function we(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function X(e,t){for(var i=0;i<t.length;i++){var u=t[i];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,Y(u.key),u)}}function Se(e,t,i){return t&&X(e.prototype,t),i&&X(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ee(e,t,i){return t=Y(t),t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Y(e){var t=xe(e,"string");return j(t)=="symbol"?t:t+""}function xe(e,t){if(j(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var u=i.call(e,t||"default");if(j(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ae=(function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];we(this,e),Ee(this,"items",void 0),this.items=t}return Se(e,[{key:"add",value:function(i){return this.has(i)===!1&&this.items.push(i),this}},{key:"clear",value:function(){this.items=[]}},{key:"delete",value:function(i){var u=this.items.length;return this.items=this.items.filter(function(b){return b!==i}),u!==this.items.length}},{key:"forEach",value:function(i){var u=this;this.items.forEach(function(b){i(b,b,u)})}},{key:"has",value:function(i){return this.items.indexOf(i)!==-1}},{key:"size",get:function(){return this.items.length}}])})(),Z=typeof Set>"u"?Set:Ae;function m(e){var t;return(t=e.localName)!==null&&t!==void 0?t:e.tagName.toLowerCase()}var Te={article:"article",aside:"complementary",button:"button",datalist:"listbox",dd:"definition",details:"group",dialog:"dialog",dt:"term",fieldset:"group",figure:"figure",form:"form",footer:"contentinfo",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",header:"banner",hr:"separator",html:"document",legend:"legend",li:"listitem",math:"math",main:"main",menu:"list",nav:"navigation",ol:"list",optgroup:"group",option:"option",output:"status",progress:"progressbar",section:"region",summary:"button",table:"table",tbody:"rowgroup",textarea:"textbox",tfoot:"rowgroup",td:"cell",th:"columnheader",thead:"rowgroup",tr:"row",ul:"list"},Le={caption:new Set(["aria-label","aria-labelledby"]),code:new Set(["aria-label","aria-labelledby"]),deletion:new Set(["aria-label","aria-labelledby"]),emphasis:new Set(["aria-label","aria-labelledby"]),generic:new Set(["aria-label","aria-labelledby","aria-roledescription"]),insertion:new Set(["aria-label","aria-labelledby"]),none:new Set(["aria-label","aria-labelledby"]),paragraph:new Set(["aria-label","aria-labelledby"]),presentation:new Set(["aria-label","aria-labelledby"]),strong:new Set(["aria-label","aria-labelledby"]),subscript:new Set(["aria-label","aria-labelledby"]),superscript:new Set(["aria-label","aria-labelledby"])};function Ne(e,t){return["aria-atomic","aria-busy","aria-controls","aria-current","aria-description","aria-describedby","aria-details","aria-dropeffect","aria-flowto","aria-grabbed","aria-hidden","aria-keyshortcuts","aria-label","aria-labelledby","aria-live","aria-owns","aria-relevant","aria-roledescription"].some(function(i){var u;return e.hasAttribute(i)&&!((u=Le[t])!==null&&u!==void 0&&u.has(i))})}function ee(e,t){return Ne(e,t)}function G(e){var t=Re(e);if(t===null||k.indexOf(t)!==-1){var i=Ce(e);if(k.indexOf(t||"")===-1||ee(e,i||""))return i}return t}function Ce(e){var t=Te[m(e)];if(t!==void 0)return t;switch(m(e)){case"a":case"area":case"link":if(e.hasAttribute("href"))return"link";break;case"img":return e.getAttribute("alt")===""&&!ee(e,"img")?"presentation":"img";case"input":{var i=e,u=i.type;switch(u){case"button":case"image":case"reset":case"submit":return"button";case"checkbox":case"radio":return u;case"range":return"slider";case"email":case"tel":case"text":case"url":return e.hasAttribute("list")?"combobox":"textbox";case"search":return e.hasAttribute("list")?"combobox":"searchbox";case"number":return"spinbutton";default:return null}}case"select":return e.hasAttribute("multiple")||e.size>1?"listbox":"combobox"}return null}function Re(e){var t=e.getAttribute("role");if(t!==null){var i=t.trim().split(" ")[0];if(i.length>0)return i}return null}var k=["presentation","none"];function d(e){return e!==null&&e.nodeType===e.ELEMENT_NODE}function z(e){return d(e)&&m(e)==="caption"}function H(e){return d(e)&&m(e)==="input"}function te(e){return d(e)&&m(e)==="optgroup"}function re(e){return d(e)&&m(e)==="select"}function ne(e){return d(e)&&m(e)==="table"}function ie(e){return d(e)&&m(e)==="textarea"}function ae(e){var t=e.ownerDocument===null?e:e.ownerDocument,i=t.defaultView;if(i===null)throw new TypeError("no window available");return i}function oe(e){return d(e)&&m(e)==="fieldset"}function le(e){return d(e)&&m(e)==="legend"}function ue(e){return d(e)&&m(e)==="slot"}function Ie(e){return d(e)&&e.ownerSVGElement!==void 0}function se(e){return d(e)&&m(e)==="svg"}function ce(e){return Ie(e)&&m(e)==="title"}function $(e,t){if(d(e)&&e.hasAttribute(t)){var i=e.getAttribute(t).split(" "),u=e.getRootNode?e.getRootNode():e.ownerDocument;return i.map(function(b){return u.getElementById(b)}).filter(function(b){return b!==null})}return[]}function x(e,t){return d(e)?t.indexOf(G(e))!==-1:!1}function Oe(e){return e.trim().replace(/\s\s+/g," ")}function Me(e,t){if(!d(e))return!1;if(e.hasAttribute("hidden")||e.getAttribute("aria-hidden")==="true")return!0;var i=t(e);return i.getPropertyValue("display")==="none"||i.getPropertyValue("visibility")==="hidden"}function Pe(e){return x(e,["button","combobox","listbox","textbox"])||pe(e,"range")}function pe(e,t){if(!d(e))return!1;if(t==="range")return x(e,["meter","progressbar","scrollbar","slider","spinbutton"]);throw new TypeError("No knowledge about abstract role '".concat(t,"'. This is likely a bug :("))}function fe(e,t){var i=v(e.querySelectorAll(t));return $(e,"aria-owns").forEach(function(u){i.push.apply(i,v(u.querySelectorAll(t)))}),i}function _e(e){return re(e)?e.selectedOptions||fe(e,"[selected]"):fe(e,'[aria-selected="true"]')}function je(e){return x(e,k)}function ke(e){return z(e)}function He(e){return x(e,["button","cell","checkbox","columnheader","gridcell","heading","label","legend","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","row","rowheader","switch","tab","tooltip","treeitem"])}function $e(e){return!1}function De(e){return H(e)||ie(e)?e.value:e.textContent||""}function de(e){var t=e.getPropertyValue("content");return/^["'].*["']$/.test(t)?t.slice(1,-1):""}function me(e){var t=m(e);return t==="button"||t==="input"&&e.getAttribute("type")!=="hidden"||t==="meter"||t==="output"||t==="progress"||t==="select"||t==="textarea"}function be(e){if(me(e))return e;var t=null;return e.childNodes.forEach(function(i){if(t===null&&d(i)){var u=be(i);u!==null&&(t=u)}}),t}function Ve(e){if(e.control!==void 0)return e.control;var t=e.getAttribute("for");return t!==null?e.ownerDocument.getElementById(t):be(e)}function qe(e){var t=e.labels;if(t===null)return t;if(t!==void 0)return v(t);if(!me(e))return null;var i=e.ownerDocument;return v(i.querySelectorAll("label")).filter(function(u){return Ve(u)===e})}function Ge(e){var t=e.assignedNodes();return t.length===0?v(e.childNodes):t}function F(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=new Z,u=typeof Map>"u"?void 0:new Map,b=ae(e),L=t.compute,h=L===void 0?"name":L,C=t.computedStyleSupportsPseudoElements,M=C===void 0?t.getComputedStyle!==void 0:C,D=t.getComputedStyle,I=D===void 0?b.getComputedStyle.bind(b):D,V=t.hidden,q=V===void 0?!1:V,P=function(f,c){if(c!==void 0)throw new Error("use uncachedGetComputedStyle directly for pseudo elements");if(u===void 0)return I(f);var w=u.get(f);if(w)return w;var S=I(f,c);return u.set(f,S),S};function _(n,f){var c="";if(d(n)&&M){var w=I(n,"::before"),S=de(w);c="".concat(S," ").concat(c)}var T=ue(n)?Ge(n):v(n.childNodes).concat($(n,"aria-owns"));if(T.forEach(function(a){var l=A(a,{isEmbeddedInLabel:f.isEmbeddedInLabel,isReferenced:!1,recursion:!0}),o=d(a)?P(a).getPropertyValue("display"):"inline",s=o!=="inline"?" ":"";c+="".concat(s).concat(l).concat(s)}),d(n)&&M){var N=I(n,"::after"),r=de(N);c="".concat(c," ").concat(r)}return c.trim()}function R(n,f){var c=n.getAttributeNode(f);return c!==null&&!i.has(c)&&c.value.trim()!==""?(i.add(c),c.value):null}function B(n){return d(n)?R(n,"title"):null}function J(n){if(!d(n))return null;if(oe(n)){i.add(n);for(var f=v(n.childNodes),c=0;c<f.length;c+=1){var w=f[c];if(le(w))return A(w,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(ne(n)){i.add(n);for(var S=v(n.childNodes),T=0;T<S.length;T+=1){var N=S[T];if(z(N))return A(N,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(se(n)){i.add(n);for(var r=v(n.childNodes),a=0;a<r.length;a+=1){var l=r[a];if(ce(l))return l.textContent}return null}else if(m(n)==="img"||m(n)==="area"){var o=R(n,"alt");if(o!==null)return o}else if(te(n)){var s=R(n,"label");if(s!==null)return s}if(H(n)&&(n.type==="button"||n.type==="submit"||n.type==="reset")){var g=R(n,"value");if(g!==null)return g;if(n.type==="submit")return"Submit";if(n.type==="reset")return"Reset"}var p=qe(n);if(p!==null&&p.length!==0)return i.add(n),v(p).map(function(W){return A(W,{isEmbeddedInLabel:!0,isReferenced:!1,recursion:!0})}).filter(function(W){return W.length>0}).join(" ");if(H(n)&&n.type==="image"){var y=R(n,"alt");if(y!==null)return y;var E=R(n,"title");return E!==null?E:"Submit Query"}if(x(n,["button"])){var O=_(n,{isEmbeddedInLabel:!1,isReferenced:!1});if(O!=="")return O}return null}function A(n,f){if(i.has(n))return"";if(!q&&Me(n,P)&&!f.isReferenced)return i.add(n),"";var c=d(n)?n.getAttributeNode("aria-labelledby"):null,w=c!==null&&!i.has(c)?$(n,"aria-labelledby"):[];if(h==="name"&&!f.isReferenced&&w.length>0)return i.add(c),w.map(function(o){return A(o,{isEmbeddedInLabel:f.isEmbeddedInLabel,isReferenced:!0,recursion:!1})}).join(" ");var S=f.recursion&&Pe(n)&&h==="name";if(!S){var T=(d(n)&&n.getAttribute("aria-label")||"").trim();if(T!==""&&h==="name")return i.add(n),T;if(!je(n)){var N=J(n);if(N!==null)return i.add(n),N}}if(x(n,["menu"]))return i.add(n),"";if(S||f.isEmbeddedInLabel||f.isReferenced){if(x(n,["combobox","listbox"])){i.add(n);var r=_e(n);return r.length===0?H(n)?n.value:"":v(r).map(function(o){return A(o,{isEmbeddedInLabel:f.isEmbeddedInLabel,isReferenced:!1,recursion:!0})}).join(" ")}if(pe(n,"range"))return i.add(n),n.hasAttribute("aria-valuetext")?n.getAttribute("aria-valuetext"):n.hasAttribute("aria-valuenow")?n.getAttribute("aria-valuenow"):n.getAttribute("value")||"";if(x(n,["textbox"]))return i.add(n),De(n)}if(He(n)||d(n)&&f.isReferenced||ke(n)||$e(n)){var a=_(n,{isEmbeddedInLabel:f.isEmbeddedInLabel,isReferenced:!1});if(a!=="")return i.add(n),a}if(n.nodeType===n.TEXT_NODE)return i.add(n),n.textContent||"";if(f.recursion)return i.add(n),_(n,{isEmbeddedInLabel:f.isEmbeddedInLabel,isReferenced:!1});var l=B(n);return l!==null?(i.add(n),l):(i.add(n),"")}return Oe(A(e,{isEmbeddedInLabel:!1,isReferenced:h==="description",recursion:!1}))}function Be(e){return x(e,["caption","code","deletion","emphasis","generic","insertion","none","paragraph","presentation","strong","subscript","superscript"])}function K(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Be(e)?"":F(e,t)}window.__flAccName=e=>{try{return K(e).replace(/\s+/g," ").trim()}catch{return""}};window.__flCreateTargetIdentity=U;})();
|
|
@@ -6,7 +6,7 @@ import os from "os";
|
|
|
6
6
|
import path from "path";
|
|
7
7
|
import { createRequire } from "module";
|
|
8
8
|
import { spawnSync } from "child_process";
|
|
9
|
-
var AGENT_VERSION = "0.1.0-beta.
|
|
9
|
+
var AGENT_VERSION = "0.1.0-beta.33";
|
|
10
10
|
async function prepareBrowsers() {
|
|
11
11
|
if (browsersReady()) {
|
|
12
12
|
return { ok: true, already: true, message: "chromium is already installed" };
|
|
@@ -465,7 +465,7 @@ import path7 from "path";
|
|
|
465
465
|
import { randomBytes } from "crypto";
|
|
466
466
|
import path3 from "path";
|
|
467
467
|
|
|
468
|
-
// ../test-model/dist/chunk-
|
|
468
|
+
// ../test-model/dist/chunk-OL5BRAEM.js
|
|
469
469
|
import { z as z3 } from "zod";
|
|
470
470
|
var LocatorOverrideSchema = z3.object({
|
|
471
471
|
strategy: z3.enum(["css", "xpath", "id", "testId", "text", "label", "placeholder", "altText", "title"]),
|
|
@@ -941,6 +941,7 @@ function parseFlowDocument(input) {
|
|
|
941
941
|
raw.schemaVersion = version;
|
|
942
942
|
}
|
|
943
943
|
liftSignInFirst(raw);
|
|
944
|
+
if (Array.isArray(raw.steps)) raw.steps = mirrorCheckTargets(raw.steps);
|
|
944
945
|
return FlowDocumentSchema.parse(raw);
|
|
945
946
|
}
|
|
946
947
|
var SIGN_IN_FIRST_STEP_ID = "sign-in-first";
|
|
@@ -953,6 +954,36 @@ function liftSignInFirst(raw) {
|
|
|
953
954
|
raw["signIn"] = auth;
|
|
954
955
|
raw.steps = raw.steps.slice(1);
|
|
955
956
|
}
|
|
957
|
+
var CHECK_TARGET_FIELDS = [
|
|
958
|
+
"role",
|
|
959
|
+
"name",
|
|
960
|
+
"scope",
|
|
961
|
+
"scopeRole",
|
|
962
|
+
"frame",
|
|
963
|
+
"pageId",
|
|
964
|
+
"nameFrom",
|
|
965
|
+
"locator",
|
|
966
|
+
"candidates",
|
|
967
|
+
"nth"
|
|
968
|
+
];
|
|
969
|
+
var unset = (value) => value === void 0 || value === null || value === "" || Array.isArray(value) && value.length === 0;
|
|
970
|
+
function mirrorCheckTargets(steps) {
|
|
971
|
+
return steps.map((step) => {
|
|
972
|
+
const held = step;
|
|
973
|
+
if (held["type"] !== "assert") return step;
|
|
974
|
+
const proposals = held["proposals"];
|
|
975
|
+
if (!Array.isArray(proposals)) return step;
|
|
976
|
+
const first = proposals[0];
|
|
977
|
+
const target = first?.["target"];
|
|
978
|
+
if (!target) return step;
|
|
979
|
+
const fill2 = {};
|
|
980
|
+
for (const field of CHECK_TARGET_FIELDS) {
|
|
981
|
+
if (!unset(held[field]) || unset(target[field])) continue;
|
|
982
|
+
fill2[field] = target[field];
|
|
983
|
+
}
|
|
984
|
+
return Object.keys(fill2).length === 0 ? step : { ...held, ...fill2 };
|
|
985
|
+
});
|
|
986
|
+
}
|
|
956
987
|
|
|
957
988
|
// ../test-model/dist/index.js
|
|
958
989
|
import { z as z4 } from "zod";
|
|
@@ -1141,6 +1172,13 @@ var TestCaseSchema = z22.object({
|
|
|
1141
1172
|
});
|
|
1142
1173
|
});
|
|
1143
1174
|
}).transform((testCase) => {
|
|
1175
|
+
const occurrences = testCase.occurrences.map((occurrence) => {
|
|
1176
|
+
const steps = mirrorCheckTargets(occurrence.steps);
|
|
1177
|
+
return steps.some((step, at) => step !== occurrence.steps[at]) ? { ...occurrence, steps } : occurrence;
|
|
1178
|
+
});
|
|
1179
|
+
if (occurrences.some((occurrence, at) => occurrence !== testCase.occurrences[at])) {
|
|
1180
|
+
testCase = { ...testCase, occurrences };
|
|
1181
|
+
}
|
|
1144
1182
|
if (!testCase.defaultActorId || testCase.defaultActorId === "default") return testCase;
|
|
1145
1183
|
if (testCase.actors?.some((actor) => actor.id === testCase.defaultActorId)) return testCase;
|
|
1146
1184
|
const { defaultActorId: _gone, ...rest } = testCase;
|
|
@@ -1884,13 +1922,17 @@ function describePlan(step, p) {
|
|
|
1884
1922
|
let root = "page";
|
|
1885
1923
|
for (const frame of step.frame ?? []) root += `.frameLocator(${quote(frameSelector(frame))})`;
|
|
1886
1924
|
if (!p.overridden && (step.scope || step.scopeRole)) root = scopeExpression(root, step.scope ?? "", step.scopeRole);
|
|
1887
|
-
let base = p.viaAdjacentLabel ? `${root}.getByText(${
|
|
1925
|
+
let base = p.viaAdjacentLabel ? `${root}.getByText(${adjacentLabelPattern(p.arg)}).locator('xpath=..').getByRole(${quote(step.role || "textbox")})` : p.method === "getByRole" ? `${root}.getByRole(${quote(p.arg)}, { name: ${quote(p.name ?? "")}, exact: true })` : `${root}.${p.method}(${quote(p.arg)}${p.exact !== void 0 ? `, { exact: ${p.exact} }` : ""})`;
|
|
1888
1926
|
if (p.inputRole) base = `${root}.getByRole(${quote(p.inputRole)}, { name: ${quote(p.arg)}, exact: true }).or(${base}.and(${root}.locator(${quote(inputSelector(p.inputRole))})))`;
|
|
1889
1927
|
if (p.visible) base += ".filter({ visible: true })";
|
|
1890
1928
|
if (step.nth !== void 0) base += `.nth(${step.nth})`;
|
|
1891
1929
|
if (step.pageId && step.pageId !== "main") base += ` // page ${quote(step.pageId)}`;
|
|
1892
1930
|
return base;
|
|
1893
1931
|
}
|
|
1932
|
+
function adjacentLabelPattern(name) {
|
|
1933
|
+
const bare = name.trim().replace(/\s*\*+$/, "");
|
|
1934
|
+
return new RegExp(`^${bare.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&")}(\\s*\\*)?$`);
|
|
1935
|
+
}
|
|
1894
1936
|
function frameSelector(name) {
|
|
1895
1937
|
const positional = /^nth:(\d+)$/.exec(name);
|
|
1896
1938
|
if (positional) return `iframe, frame >> nth=${positional[1]}`;
|
|
@@ -3506,6 +3548,7 @@ import { fileURLToPath } from "url";
|
|
|
3506
3548
|
import "playwright";
|
|
3507
3549
|
import fs32 from "fs";
|
|
3508
3550
|
import "playwright";
|
|
3551
|
+
import fs42 from "fs";
|
|
3509
3552
|
function makeUnique(now = Date.now()) {
|
|
3510
3553
|
return `${now.toString(36)}${randomBytes(3).toString("hex")}`;
|
|
3511
3554
|
}
|
|
@@ -4268,7 +4311,7 @@ async function fromPlan(page, step, plan, opts = {}) {
|
|
|
4268
4311
|
}));
|
|
4269
4312
|
root = containers.reduce((a, b2) => a.or(b2));
|
|
4270
4313
|
}
|
|
4271
|
-
if (plan.viaAdjacentLabel) return root.getByText(plan.arg
|
|
4314
|
+
if (plan.viaAdjacentLabel) return root.getByText(adjacentLabelPattern(plan.arg)).locator("xpath=..").getByRole(step.role || "textbox", { includeHidden: opts.includeHidden });
|
|
4272
4315
|
let loc;
|
|
4273
4316
|
switch (plan.method) {
|
|
4274
4317
|
case "getByTestId":
|
|
@@ -5982,25 +6025,17 @@ async function startRecordingSession(opts) {
|
|
|
5982
6025
|
},
|
|
5983
6026
|
addAssertion(assertion) {
|
|
5984
6027
|
const parsed = RecordedAssertionSchema.parse({ enabled: true, ...assertion });
|
|
5985
|
-
const step = {
|
|
6028
|
+
const step = mirrorCheckTargets([{
|
|
5986
6029
|
id: `st_${crypto.randomUUID().slice(0, 8)}`,
|
|
5987
6030
|
type: "assert",
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
name: parsed.target?.name ?? "",
|
|
5992
|
-
...parsed.target?.nameFrom ? { nameFrom: parsed.target.nameFrom } : {},
|
|
5993
|
-
scope: parsed.target?.scope ?? "",
|
|
5994
|
-
...parsed.target?.scopeRole ? { scopeRole: parsed.target.scopeRole } : {},
|
|
5995
|
-
...parsed.target?.frame?.length ? { frame: parsed.target.frame } : {},
|
|
5996
|
-
...parsed.target?.locator ? { locator: parsed.target.locator } : {},
|
|
5997
|
-
...parsed.target?.candidates?.length ? { candidates: parsed.target.candidates } : {},
|
|
5998
|
-
...parsed.target?.pageId ? { pageId: parsed.target.pageId } : {},
|
|
6031
|
+
role: "",
|
|
6032
|
+
name: "",
|
|
6033
|
+
scope: "",
|
|
5999
6034
|
value: "",
|
|
6000
6035
|
secret: false,
|
|
6001
6036
|
legacySelector: "",
|
|
6002
6037
|
proposals: [parsed]
|
|
6003
|
-
};
|
|
6038
|
+
}])[0];
|
|
6004
6039
|
if ((parsed.kind === "text" || parsed.kind === "class" || parsed.kind === "attribute") && identifiedByOwnWords(parsed.target)) {
|
|
6005
6040
|
step.warning = "Nothing identifies this element except the text being checked, so a change to that text reads as a missing element rather than a failed check. Give it a test ID, or choose a locator.";
|
|
6006
6041
|
}
|
|
@@ -6586,23 +6621,17 @@ async function startDebugSession(opts) {
|
|
|
6586
6621
|
},
|
|
6587
6622
|
addAssertion(assertion) {
|
|
6588
6623
|
const parsed = RecordedAssertionSchema.parse({ enabled: true, ...assertion });
|
|
6589
|
-
const step = {
|
|
6624
|
+
const step = mirrorCheckTargets([{
|
|
6590
6625
|
id: `st_${crypto.randomUUID().slice(0, 8)}`,
|
|
6591
6626
|
type: "assert",
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
name: parsed.target?.name ?? "",
|
|
6596
|
-
...parsed.target?.nameFrom ? { nameFrom: parsed.target.nameFrom } : {},
|
|
6597
|
-
scope: parsed.target?.scope ?? "",
|
|
6598
|
-
...parsed.target?.scopeRole ? { scopeRole: parsed.target.scopeRole } : {},
|
|
6599
|
-
...parsed.target?.frame?.length ? { frame: parsed.target.frame } : {},
|
|
6600
|
-
...parsed.target?.locator ? { locator: parsed.target.locator } : {},
|
|
6627
|
+
role: "",
|
|
6628
|
+
name: "",
|
|
6629
|
+
scope: "",
|
|
6601
6630
|
value: "",
|
|
6602
6631
|
secret: false,
|
|
6603
6632
|
legacySelector: "",
|
|
6604
6633
|
proposals: [parsed]
|
|
6605
|
-
};
|
|
6634
|
+
}])[0];
|
|
6606
6635
|
RecordedStepSchema.parse(step);
|
|
6607
6636
|
const at = cursor ? steps.findIndex((s2) => s2.id === cursor) : steps.length;
|
|
6608
6637
|
const insertAt = at === -1 ? steps.length : at;
|
|
@@ -6626,6 +6655,29 @@ async function startDebugSession(opts) {
|
|
|
6626
6655
|
};
|
|
6627
6656
|
return session;
|
|
6628
6657
|
}
|
|
6658
|
+
var script = null;
|
|
6659
|
+
async function fieldNames(page) {
|
|
6660
|
+
script ??= fs42.readFileSync(accNameScriptPath(), "utf8");
|
|
6661
|
+
if (!await page.evaluate(() => Boolean(window.__flCreateTargetIdentity)).catch(() => false)) {
|
|
6662
|
+
await page.evaluate(script).catch(() => void 0);
|
|
6663
|
+
}
|
|
6664
|
+
return page.evaluate(() => {
|
|
6665
|
+
const w = window;
|
|
6666
|
+
if (!w.__flCreateTargetIdentity) return [];
|
|
6667
|
+
const clean = (s2) => (s2 || "").replace(/\s+/g, " ").trim();
|
|
6668
|
+
const { identify, roleOf, accName } = w.__flCreateTargetIdentity(w, clean, "button");
|
|
6669
|
+
const found = [];
|
|
6670
|
+
for (const el of Array.from(document.querySelectorAll("input:not([type=hidden]),select,textarea"))) {
|
|
6671
|
+
const who = identify(el);
|
|
6672
|
+
if (who.nameFrom !== "adjacent-label") continue;
|
|
6673
|
+
const placeholder = clean(el.placeholder);
|
|
6674
|
+
const title = clean(el.title);
|
|
6675
|
+
const hint = placeholder || title || accName(el);
|
|
6676
|
+
if (hint) found.push({ role: roleOf(el), hint, hintFrom: placeholder ? "placeholder" : title ? "title" : "name", label: who.name });
|
|
6677
|
+
}
|
|
6678
|
+
return found;
|
|
6679
|
+
}).catch(() => []);
|
|
6680
|
+
}
|
|
6629
6681
|
|
|
6630
6682
|
// ../results/dist/chunk-LYCTVHPR.js
|
|
6631
6683
|
import { z as z5 } from "zod";
|
|
@@ -11218,6 +11270,7 @@ export {
|
|
|
11218
11270
|
resolveService,
|
|
11219
11271
|
connect,
|
|
11220
11272
|
RecordedStepSchema,
|
|
11273
|
+
mirrorCheckTargets,
|
|
11221
11274
|
runtimeValue,
|
|
11222
11275
|
authenticationResolver,
|
|
11223
11276
|
checkAssertion,
|
|
@@ -11225,6 +11278,7 @@ export {
|
|
|
11225
11278
|
closeRunSession,
|
|
11226
11279
|
replayFlow,
|
|
11227
11280
|
executeStep,
|
|
11281
|
+
fieldNames,
|
|
11228
11282
|
helperRunner,
|
|
11229
11283
|
resolveCheckouts,
|
|
11230
11284
|
start,
|
package/dist/cli.js
CHANGED
|
@@ -10,7 +10,9 @@ import {
|
|
|
10
10
|
disconnect,
|
|
11
11
|
doctor,
|
|
12
12
|
executeStep,
|
|
13
|
+
fieldNames,
|
|
13
14
|
helperRunner,
|
|
15
|
+
mirrorCheckTargets,
|
|
14
16
|
openRunSession,
|
|
15
17
|
prepareBrowsers,
|
|
16
18
|
replayFlow,
|
|
@@ -19,7 +21,7 @@ import {
|
|
|
19
21
|
runtimeValue,
|
|
20
22
|
start,
|
|
21
23
|
status
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-3UUCI66O.js";
|
|
23
25
|
|
|
24
26
|
// src/cli.ts
|
|
25
27
|
import { parseArgs } from "util";
|
|
@@ -152,6 +154,20 @@ var ServiceClient = class {
|
|
|
152
154
|
body: JSON.stringify({ steps, ...signIn ? { signIn } : {} })
|
|
153
155
|
});
|
|
154
156
|
}
|
|
157
|
+
/** This person's open branches that Claude wrote on this project. */
|
|
158
|
+
agentChanges(projectId) {
|
|
159
|
+
return this.call(
|
|
160
|
+
`/api/agent/changes?projectId=${encodeURIComponent(projectId)}`
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
/** Delete one — refused by the service unless it is all Claude's own,
|
|
164
|
+
* unedited, unpublished work. */
|
|
165
|
+
discardChange(projectId, changeId) {
|
|
166
|
+
return this.call(
|
|
167
|
+
`/api/agent/changes/${encodeURIComponent(changeId)}?projectId=${encodeURIComponent(projectId)}`,
|
|
168
|
+
{ method: "DELETE" }
|
|
169
|
+
);
|
|
170
|
+
}
|
|
155
171
|
saveFlow(projectId, title, flow) {
|
|
156
172
|
return this.call(
|
|
157
173
|
`/api/agent/flows?projectId=${encodeURIComponent(projectId)}`,
|
|
@@ -171,6 +187,21 @@ function scopeOf(within) {
|
|
|
171
187
|
if (!said) return { scope: "" };
|
|
172
188
|
return LANDMARKS.has(said.toLowerCase()) ? { scope: "", scopeRole: said.toLowerCase() } : { scope: said };
|
|
173
189
|
}
|
|
190
|
+
function asLabelled(target, fields) {
|
|
191
|
+
const field = fields.find((f) => f.role === target.role && (f.label === target.name || f.hint === target.name));
|
|
192
|
+
if (!field) return target;
|
|
193
|
+
return {
|
|
194
|
+
...target,
|
|
195
|
+
name: field.label,
|
|
196
|
+
nameFrom: "adjacent-label",
|
|
197
|
+
...field.hintFrom === "name" ? {} : { candidates: [{ strategy: field.hintFrom, value: field.hint }] }
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function labelTree(tree, fields) {
|
|
201
|
+
let out = tree;
|
|
202
|
+
for (const f of fields) out = out.split(`- ${f.role} ${JSON.stringify(f.hint)}`).join(`- ${f.role} ${JSON.stringify(f.label)}`);
|
|
203
|
+
return out;
|
|
204
|
+
}
|
|
174
205
|
function describe(step) {
|
|
175
206
|
const target = step.name ? `${step.role || "element"} "${step.name}"` : step.role || "";
|
|
176
207
|
const where = step.scope ? ` in "${step.scope}"` : step.scopeRole ? ` in the ${step.scopeRole}` : "";
|
|
@@ -275,7 +306,10 @@ var AuthoringSession = class {
|
|
|
275
306
|
async snapshot() {
|
|
276
307
|
const { page, draft } = this.requireOpen();
|
|
277
308
|
await page.waitForLoadState("domcontentloaded", { timeout: 1e4 }).catch(() => void 0);
|
|
278
|
-
let tree =
|
|
309
|
+
let tree = labelTree(
|
|
310
|
+
await page.locator("body").ariaSnapshot({ timeout: 8e3 }).catch((e) => `(could not read the page: ${e.message})`),
|
|
311
|
+
await fieldNames(page)
|
|
312
|
+
);
|
|
279
313
|
if (tree.length > MAX_TREE) tree = `${tree.slice(0, MAX_TREE)}
|
|
280
314
|
\u2026 (cut \u2014 the page is long; act on what is above, or scroll with press "PageDown")`;
|
|
281
315
|
const title = await page.title().catch(() => "");
|
|
@@ -294,11 +328,11 @@ ${tree}`;
|
|
|
294
328
|
if ((input.action === "fill" || input.action === "select" || input.action === "press" || input.action === "navigate") && input.value === void 0) {
|
|
295
329
|
throw new Error(`${input.action} needs a value`);
|
|
296
330
|
}
|
|
331
|
+
const target = navigating ? { role: "", name: "" } : asLabelled({ role: input.role ?? "", name: input.name ?? "" }, await fieldNames(page));
|
|
297
332
|
const step = RecordedStepSchema.parse({
|
|
298
333
|
id: `s${draft.steps.length + 1}_${Date.now().toString(36)}`,
|
|
299
334
|
type: input.action,
|
|
300
|
-
|
|
301
|
-
name: navigating ? "" : input.name ?? "",
|
|
335
|
+
...target,
|
|
302
336
|
...scopeOf(input.within),
|
|
303
337
|
value: input.action === "check" ? input.value === "false" ? "false" : "true" : input.value ?? "",
|
|
304
338
|
secret: false,
|
|
@@ -339,7 +373,7 @@ ${await this.snapshot()}`;
|
|
|
339
373
|
value: input.value,
|
|
340
374
|
enabled: true,
|
|
341
375
|
...input.op && input.op !== "equals" ? { op: input.op } : {},
|
|
342
|
-
...input.role ? { target: { role: input.role, name: input.name ?? "", ...scopeOf(input.within) } } : {}
|
|
376
|
+
...input.role ? { target: { ...asLabelled({ role: input.role, name: input.name ?? "" }, await fieldNames(page)), ...scopeOf(input.within) } } : {}
|
|
343
377
|
});
|
|
344
378
|
const filled = (text2) => text2.replace(/\{\{([a-zA-Z][a-zA-Z0-9_]*)\}\}/g, (_, name) => runtimeValue(this.values, name));
|
|
345
379
|
const expected = Array.isArray(assertion.value) ? assertion.value.map(filled) : filled(assertion.value);
|
|
@@ -348,7 +382,7 @@ ${await this.snapshot()}`;
|
|
|
348
382
|
} catch (error) {
|
|
349
383
|
throw new Error(`That is not true of the page right now, so it was not kept: ${error.message.split("\n")[0]}`);
|
|
350
384
|
}
|
|
351
|
-
const step = RecordedStepSchema.parse({
|
|
385
|
+
const step = RecordedStepSchema.parse(mirrorCheckTargets([{
|
|
352
386
|
id: `c${draft.steps.length + 1}_${Date.now().toString(36)}`,
|
|
353
387
|
type: "assert",
|
|
354
388
|
role: "",
|
|
@@ -358,7 +392,7 @@ ${await this.snapshot()}`;
|
|
|
358
392
|
secret: false,
|
|
359
393
|
legacySelector: "",
|
|
360
394
|
proposals: [assertion]
|
|
361
|
-
});
|
|
395
|
+
}])[0]);
|
|
362
396
|
draft.steps.push(step);
|
|
363
397
|
return `Step ${draft.steps.length} kept: ${describe(step)}.`;
|
|
364
398
|
}
|
|
@@ -453,8 +487,11 @@ ${lines.join("\n")}`;
|
|
|
453
487
|
...draft.signIn ? { signIn: draft.signIn } : {}
|
|
454
488
|
});
|
|
455
489
|
const review = `${this.service.origin}/projects/${draft.projectId}/changes/${saved.changeId}`;
|
|
490
|
+
const others = await this.service.agentChanges(draft.projectId).then((r) => r.changes.filter((c) => c.id !== saved.changeId)).catch(() => []);
|
|
491
|
+
const note = others.length ? `
|
|
492
|
+
Claude also has ${others.length} other open branch${others.length === 1 ? "" : "es"} on this project \u2014 list_my_branches shows them, if one is now superseded.` : "";
|
|
456
493
|
return `Saved "${draft.name}" on a new branch, ${saved.branch}. Nothing is published yet.
|
|
457
|
-
Review and publish it here: ${review}`;
|
|
494
|
+
Review and publish it here: ${review}${note}`;
|
|
458
495
|
}
|
|
459
496
|
async close() {
|
|
460
497
|
const run = this.run;
|
|
@@ -501,6 +538,10 @@ How to write a good Flowriki test:
|
|
|
501
538
|
7. Before saving, call replay_flow to run the whole flow from the start. If a
|
|
502
539
|
step fails there, fix it (remove_step, act again) and replay again.
|
|
503
540
|
8. Save with save_flow and give the person the review link it returns.
|
|
541
|
+
9. Redoing a flow? Each save is a new branch, so clear the superseded one with
|
|
542
|
+
list_my_branches and discard_branch \u2014 only after the person asks for it, or
|
|
543
|
+
agrees, because it deletes the branch. Only Claude's own unedited branches
|
|
544
|
+
can go this way; anything a person touched is theirs to delete.
|
|
504
545
|
Test data you invent (a new user's email or password for a sign-up) is fine to
|
|
505
546
|
type. For anything that must be NEW on every run \u2014 a sign-up's email or
|
|
506
547
|
username \u2014 use {{unique}}: it is different on every run and the same within
|
|
@@ -746,6 +787,37 @@ ${page}`);
|
|
|
746
787
|
inputSchema: { type: "object", properties: { title: { type: "string", description: "The branch's title \u2014 what this change adds." } }, additionalProperties: false },
|
|
747
788
|
run: async (args) => text(await session.save(str(args["title"])))
|
|
748
789
|
},
|
|
790
|
+
{
|
|
791
|
+
name: "list_my_branches",
|
|
792
|
+
title: "List Claude's open branches",
|
|
793
|
+
description: "The project's open, unpublished branches that Claude wrote for this person, newest first, with review links. Use it to find a superseded branch to discard.",
|
|
794
|
+
inputSchema: { type: "object", properties: { projectId: { type: "string", description: "Optional when you are on one project." } }, additionalProperties: false },
|
|
795
|
+
annotations: { readOnlyHint: true },
|
|
796
|
+
run: async (args) => {
|
|
797
|
+
const projectId = await projectFor(args["projectId"]);
|
|
798
|
+
const { changes } = await service.agentChanges(projectId);
|
|
799
|
+
if (!changes.length) return text("Claude has no open branches on this project.");
|
|
800
|
+
return text(changes.map((c) => `- ${c.id} \u2014 "${c.title}" (${new Date(c.createdAt).toISOString().slice(0, 16).replace("T", " ")}) ${service.origin}${c.path}`).join("\n"));
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
name: "discard_branch",
|
|
805
|
+
title: "Delete one of Claude's branches",
|
|
806
|
+
description: "Delete an open branch Claude wrote, with the flows on it \u2014 e.g. one a redo replaced. Only after the person asked for it or agreed. Refused for a branch a person started, edited, or published; those are deleted in the dashboard.",
|
|
807
|
+
inputSchema: {
|
|
808
|
+
type: "object",
|
|
809
|
+
properties: { changeId: { type: "string", description: "The branch's id from list_my_branches (chg_\u2026)." }, projectId: { type: "string" } },
|
|
810
|
+
required: ["changeId"],
|
|
811
|
+
additionalProperties: false
|
|
812
|
+
},
|
|
813
|
+
annotations: { destructiveHint: true },
|
|
814
|
+
run: async (args) => {
|
|
815
|
+
const projectId = await projectFor(args["projectId"]);
|
|
816
|
+
const changeId = str(args["changeId"]) ?? "";
|
|
817
|
+
const { deleted } = await service.discardChange(projectId, changeId);
|
|
818
|
+
return text(`Deleted ${changeId} and its branch ${deleted}.`);
|
|
819
|
+
}
|
|
820
|
+
},
|
|
749
821
|
{
|
|
750
822
|
name: "close_browser",
|
|
751
823
|
title: "Close the browser",
|
package/dist/engine.js
CHANGED
package/package.json
CHANGED