@flowriki/agent 0.1.0-beta.22 → 0.1.0-beta.24
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-O3S4QSN4.js → chunk-EBT7VSPY.js} +410 -42
- package/dist/cli.js +1 -1
- 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 l(n){let u=e.__flAccName;if(u){let a=u(n);return a||t(n.placeholder)||t(n.title)||""}return y(n)}function y(n){let u=n.getAttribute&&n.getAttribute("aria-labelledby");if(u){let m=u.split(/\s+/).map(b=>document.getElementById(b)).filter(Boolean).map(b=>t(b.textContent)).filter(Boolean).join(" ");if(m)return m}let a=t(n.getAttribute&&n.getAttribute("aria-label"));if(a)return a;if(n.id){let m=document.querySelector('label[for="'+CSS.escape(n.id)+'"]');if(m&&t(m.textContent))return t(m.textContent)}let o=n.closest&&n.closest("label");if(o&&t(o.textContent))return t(o.textContent);let s=n.tagName.toLowerCase(),p=(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(p)&&n.value?t(n.value):t(n.placeholder)||t(n.title)||""}let E="input,select,textarea,button,meter,output,progress,[contenteditable]";function v(n){let u=n.parentElement;if(!u||!n.matches?.(E))return"";for(let a of Array.from(u.querySelectorAll("label"))){let o=a.getAttribute("for");if(o&&document.getElementById(o))continue;let s=t(a.textContent);if(s)return s}return""}let x=new WeakMap,_=crypto.randomUUID(),j=0;function L(n){let u=n.getRootNode(),a=h=>u.querySelectorAll(h).length===1,o=[],s=n.getAttribute?.("data-testid");s&&a(`[data-testid=${JSON.stringify(s)}]`)&&o.push({strategy:"testId",value:s});let p=t(n.placeholder);p&&a(`[placeholder=${JSON.stringify(n.placeholder)}]`)&&o.push({strategy:"placeholder",value:p});let m=t(n.getAttribute?.("alt"));m&&a(`[alt=${JSON.stringify(n.getAttribute("alt"))}]`)&&o.push({strategy:"altText",value:m});let b=n.getAttribute?.("title");return b&&a(`[title=${JSON.stringify(b)}]`)&&o.push({strategy:"title",value:t(b)}),n.id&&!/:r|[a-f0-9]{12}|\d{6}/i.test(n.id)&&a(`#${CSS.escape(n.id)}`)&&o.push({strategy:"css",value:`#${CSS.escape(n.id)}`}),o.slice(0,4)}function C(n){let u=x.get(n);u||(u=`${_}:${++j}`,x.set(n,u));let a=L(n),o={__targetId:u,...a.length?{candidates:a}:{}},s=n.getRootNode(),p=l(n);if(p)return{...o,name:p};let m=v(n);if(m)return{...o,name:m,nameFrom:"adjacent-label"};let b=t(Array.from(n.childNodes||[]).filter(N=>N.nodeType===3).map(N=>N.textContent).join(" "));if(b&&b.length<=80)return{...o,name:b,nameFrom:"text"};let h=a[0];return h?{...o,name:"",locator:h.strategy==="placeholder"||h.strategy==="altText"?{strategy:"css",value:`[${h.strategy==="altText"?"alt":"placeholder"}=${JSON.stringify(h.value)}]`}:h}:{...o,name:""}}function k(n){let u=n.getAttribute&&n.getAttribute("role");if(u)return u;let a=n.tagName.toLowerCase(),o=(n.type||"").toLowerCase();return a==="button"?"button":a==="a"&&n.href?"link":a==="select"?n.multiple||n.size>1?"listbox":"combobox":a==="textarea"?"textbox":a==="input"?["submit","button","reset","file"].includes(o)?"button":o==="checkbox"||o==="radio"?o:o==="number"?"spinbutton":o==="search"?"searchbox":o==="range"?"slider":"textbox":n.isContentEditable?"textbox":H[a]??""}let H={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 I(n){let u=n,a=null;for(let o=0;u&&o<6&&!(u===document.body||u===document.documentElement);o++){let s="";try{s=getComputedStyle(u).cursor}catch{break}if(s==="pointer")a=u;else if(a)break;u=u.parentElement}return a}let T="tr, [role=row], li, [role=listitem], [role=article], [role=gridcell]";function $(n){try{let u=n.cloneNode(!0);for(let a of Array.from(u.querySelectorAll(i+", input, select, textarea")))a.remove();for(let a of Array.from(u.querySelectorAll("td, th, li, p, div, span, tr")))a.append(" ");return t(u.textContent).slice(0,120)}catch{return""}}function V(n,u,a){if(!a)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 p of o)if(p!==n&&k(p)===u&&C(p).name===a&&++s>0)return!0;return!1}function A(n,u,a){if(!V(n,u,a))return null;let o=n.closest&&n.closest(T);if(!o)return null;let s=$(o);if(!s)return null;let p=o.getAttribute&&o.getAttribute("role"),m=o.tagName.toLowerCase();return{scope:s,scopeRole:p||(m==="tr"?"row":m==="li"?"listitem":m)}}function r(n,u,a){let o=A(n,u,a);return o||{scope:f(n)}}function f(n){let u=n.closest&&n.closest("form, fieldset, section, [role=group], [role=region], [role=dialog], [role=alertdialog], dialog");return u?l(u):""}function c(n){if(n.id)return"#"+CSS.escape(n.id);let u=[],a=n;for(;a&&a.nodeType===1&&a!==document.body;){let o=Array.from(a.parentNode?a.parentNode.children:[]).filter(s=>s.tagName===a.tagName);u.unshift(o.length>1?`${a.tagName.toLowerCase()}:nth-of-type(${o.indexOf(a)+1})`:a.tagName.toLowerCase()),a=a.parentElement}return"body > "+u.join(" > ")}return{accName:l,identify:C,roleOf:k,pointerTarget:I,scoping:r,cssPath:c}}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 w(e,t){var i=Array,l=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 y=ve(l.length),E=Q(i)?Object(new i(y)):new Array(y),v=0,x;v<y;)x=l[v],t?E[v]=t(x,v):E[v]=x,v+=1;return E.length=y,E}function O(e){"@babel/helpers - typeof";return O=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},O(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 l=t[i];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,Y(l.key),l)}}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 O(t)=="symbol"?t:t+""}function xe(e,t){if(O(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var l=i.call(e,t||"default");if(O(l)!="object")return l;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 l=this.items.length;return this.items=this.items.filter(function(y){return y!==i}),l!==this.items.length}},{key:"forEach",value:function(i){var l=this;this.items.forEach(function(y){i(y,y,l)})}},{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 g(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 l;return e.hasAttribute(i)&&!((l=Le[t])!==null&&l!==void 0&&l.has(i))})}function ee(e,t){return Ne(e,t)}function D(e){var t=Ie(e);if(t===null||R.indexOf(t)!==-1){var i=Ce(e);if(R.indexOf(t||"")===-1||ee(e,i||""))return i}return t}function Ce(e){var t=Te[g(e)];if(t!==void 0)return t;switch(g(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,l=i.type;switch(l){case"button":case"image":case"reset":case"submit":return"button";case"checkbox":case"radio":return l;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 Ie(e){var t=e.getAttribute("role");if(t!==null){var i=t.trim().split(" ")[0];if(i.length>0)return i}return null}var R=["presentation","none"];function d(e){return e!==null&&e.nodeType===e.ELEMENT_NODE}function B(e){return d(e)&&g(e)==="caption"}function M(e){return d(e)&&g(e)==="input"}function te(e){return d(e)&&g(e)==="optgroup"}function re(e){return d(e)&&g(e)==="select"}function ne(e){return d(e)&&g(e)==="table"}function ie(e){return d(e)&&g(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)&&g(e)==="fieldset"}function ue(e){return d(e)&&g(e)==="legend"}function le(e){return d(e)&&g(e)==="slot"}function Oe(e){return d(e)&&e.ownerSVGElement!==void 0}function se(e){return d(e)&&g(e)==="svg"}function fe(e){return Oe(e)&&g(e)==="title"}function P(e,t){if(d(e)&&e.hasAttribute(t)){var i=e.getAttribute(t).split(" "),l=e.getRootNode?e.getRootNode():e.ownerDocument;return i.map(function(y){return l.getElementById(y)}).filter(function(y){return y!==null})}return[]}function S(e,t){return d(e)?t.indexOf(D(e))!==-1:!1}function Re(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 S(e,["button","combobox","listbox","textbox"])||pe(e,"range")}function pe(e,t){if(!d(e))return!1;if(t==="range")return S(e,["meter","progressbar","scrollbar","slider","spinbutton"]);throw new TypeError("No knowledge about abstract role '".concat(t,"'. This is likely a bug :("))}function ce(e,t){var i=w(e.querySelectorAll(t));return P(e,"aria-owns").forEach(function(l){i.push.apply(i,w(l.querySelectorAll(t)))}),i}function _e(e){return re(e)?e.selectedOptions||ce(e,"[selected]"):ce(e,'[aria-selected="true"]')}function je(e){return S(e,R)}function ke(e){return B(e)}function He(e){return S(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 M(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=g(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 l=be(i);l!==null&&(t=l)}}),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 w(t);if(!me(e))return null;var i=e.ownerDocument;return w(i.querySelectorAll("label")).filter(function(l){return Ve(l)===e})}function Ge(e){var t=e.assignedNodes();return t.length===0?w(e.childNodes):t}function J(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=new Z,l=typeof Map>"u"?void 0:new Map,y=ae(e),E=t.compute,v=E===void 0?"name":E,x=t.computedStyleSupportsPseudoElements,_=x===void 0?t.getComputedStyle!==void 0:x,j=t.getComputedStyle,L=j===void 0?y.getComputedStyle.bind(y):j,C=t.hidden,k=C===void 0?!1:C,H=function(f,c){if(c!==void 0)throw new Error("use uncachedGetComputedStyle directly for pseudo elements");if(l===void 0)return L(f);var n=l.get(f);if(n)return n;var u=L(f,c);return l.set(f,u),u};function I(r,f){var c="";if(d(r)&&_){var n=L(r,"::before"),u=de(n);c="".concat(u," ").concat(c)}var a=le(r)?Ge(r):w(r.childNodes).concat(P(r,"aria-owns"));if(a.forEach(function(p){var m=A(p,{isEmbeddedInLabel:f.isEmbeddedInLabel,isReferenced:!1,recursion:!0}),b=d(p)?H(p).getPropertyValue("display"):"inline",h=b!=="inline"?" ":"";c+="".concat(h).concat(m).concat(h)}),d(r)&&_){var o=L(r,"::after"),s=de(o);c="".concat(c," ").concat(s)}return c.trim()}function T(r,f){var c=r.getAttributeNode(f);return c!==null&&!i.has(c)&&c.value.trim()!==""?(i.add(c),c.value):null}function $(r){return d(r)?T(r,"title"):null}function V(r){if(!d(r))return null;if(oe(r)){i.add(r);for(var f=w(r.childNodes),c=0;c<f.length;c+=1){var n=f[c];if(ue(n))return A(n,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(ne(r)){i.add(r);for(var u=w(r.childNodes),a=0;a<u.length;a+=1){var o=u[a];if(B(o))return A(o,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(se(r)){i.add(r);for(var s=w(r.childNodes),p=0;p<s.length;p+=1){var m=s[p];if(fe(m))return m.textContent}return null}else if(g(r)==="img"||g(r)==="area"){var b=T(r,"alt");if(b!==null)return b}else if(te(r)){var h=T(r,"label");if(h!==null)return h}if(M(r)&&(r.type==="button"||r.type==="submit"||r.type==="reset")){var N=T(r,"value");if(N!==null)return N;if(r.type==="submit")return"Submit";if(r.type==="reset")return"Reset"}var q=qe(r);if(q!==null&&q.length!==0)return i.add(r),w(q).map(function(G){return A(G,{isEmbeddedInLabel:!0,isReferenced:!1,recursion:!0})}).filter(function(G){return G.length>0}).join(" ");if(M(r)&&r.type==="image"){var z=T(r,"alt");if(z!==null)return z;var F=T(r,"title");return F!==null?F:"Submit Query"}if(S(r,["button"])){var K=I(r,{isEmbeddedInLabel:!1,isReferenced:!1});if(K!=="")return K}return null}function A(r,f){if(i.has(r))return"";if(!k&&Me(r,H)&&!f.isReferenced)return i.add(r),"";var c=d(r)?r.getAttributeNode("aria-labelledby"):null,n=c!==null&&!i.has(c)?P(r,"aria-labelledby"):[];if(v==="name"&&!f.isReferenced&&n.length>0)return i.add(c),n.map(function(b){return A(b,{isEmbeddedInLabel:f.isEmbeddedInLabel,isReferenced:!0,recursion:!1})}).join(" ");var u=f.recursion&&Pe(r)&&v==="name";if(!u){var a=(d(r)&&r.getAttribute("aria-label")||"").trim();if(a!==""&&v==="name")return i.add(r),a;if(!je(r)){var o=V(r);if(o!==null)return i.add(r),o}}if(S(r,["menu"]))return i.add(r),"";if(u||f.isEmbeddedInLabel||f.isReferenced){if(S(r,["combobox","listbox"])){i.add(r);var s=_e(r);return s.length===0?M(r)?r.value:"":w(s).map(function(b){return A(b,{isEmbeddedInLabel:f.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(S(r,["textbox"]))return i.add(r),$e(r)}if(He(r)||d(r)&&f.isReferenced||ke(r)||De(r)){var p=I(r,{isEmbeddedInLabel:f.isEmbeddedInLabel,isReferenced:!1});if(p!=="")return i.add(r),p}if(r.nodeType===r.TEXT_NODE)return i.add(r),r.textContent||"";if(f.recursion)return i.add(r),I(r,{isEmbeddedInLabel:f.isEmbeddedInLabel,isReferenced:!1});var m=$(r);return m!==null?(i.add(r),m):(i.add(r),"")}return Re(A(e,{isEmbeddedInLabel:!1,isReferenced:v==="description",recursion:!1}))}function Be(e){return S(e,["caption","code","deletion","emphasis","generic","insertion","none","paragraph","presentation","strong","subscript","superscript"])}function W(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Be(e)?"":J(e,t)}window.__flAccName=e=>{try{return W(e).replace(/\s+/g," ").trim()}catch{return""}};window.__flCreateTargetIdentity=U;})();
|
|
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;})();
|
|
@@ -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.24";
|
|
10
10
|
async function prepareBrowsers() {
|
|
11
11
|
if (browsersReady()) {
|
|
12
12
|
return { ok: true, already: true, message: "chromium is already installed" };
|
|
@@ -135,7 +135,7 @@ function forgetConnection(service, env = process.env) {
|
|
|
135
135
|
}
|
|
136
136
|
var fingerprint = (secret) => crypto2.createHash("sha256").update(secret).digest("hex").slice(0, 12);
|
|
137
137
|
|
|
138
|
-
// ../contracts/dist/chunk-
|
|
138
|
+
// ../contracts/dist/chunk-MQTBBCDK.js
|
|
139
139
|
import { z } from "zod";
|
|
140
140
|
var PROTOCOL_VERSION = 1;
|
|
141
141
|
var PAIRING_CODE_TTL_MS = 5 * 60 * 1e3;
|
|
@@ -290,7 +290,10 @@ var AGENT_FEATURES = /* @__PURE__ */ new Set([
|
|
|
290
290
|
"authentication.v1",
|
|
291
291
|
/** More than one participant, each with a browser session of its own —
|
|
292
292
|
* which also covers starting one over and sharing a captured output. */
|
|
293
|
-
"actors.v1"
|
|
293
|
+
"actors.v1",
|
|
294
|
+
/** Replaying other flows' steps before a recording starts capturing, so a
|
|
295
|
+
* flow can be recorded from where its prerequisites leave the browser. */
|
|
296
|
+
"prerequisites.v1"
|
|
294
297
|
]);
|
|
295
298
|
var AgentMessageSchema = z.discriminatedUnion("type", [
|
|
296
299
|
AckSchema,
|
|
@@ -458,7 +461,7 @@ import path7 from "path";
|
|
|
458
461
|
// ../engine-playwright/dist/index.js
|
|
459
462
|
import path3 from "path";
|
|
460
463
|
|
|
461
|
-
// ../test-model/dist/chunk-
|
|
464
|
+
// ../test-model/dist/chunk-TSFRTYLG.js
|
|
462
465
|
import { z as z3 } from "zod";
|
|
463
466
|
var LocatorOverrideSchema = z3.object({
|
|
464
467
|
strategy: z3.enum(["css", "xpath", "id", "testId", "text", "label", "placeholder", "altText", "title"]),
|
|
@@ -759,6 +762,12 @@ var ActorDefinitionSchema = z3.object({
|
|
|
759
762
|
name: z3.string().min(1),
|
|
760
763
|
startSignedIn: z3.object({ profileId: z3.string().min(1), accountId: z3.string().optional() }).strict().optional()
|
|
761
764
|
}).strict();
|
|
765
|
+
var FlowSignInSchema = z3.object({
|
|
766
|
+
profileId: z3.string().min(1),
|
|
767
|
+
accountId: z3.string().optional(),
|
|
768
|
+
from: z3.enum(["loginPage", "here"]).optional()
|
|
769
|
+
}).strict();
|
|
770
|
+
var FlowPrerequisitesSchema = z3.array(z3.object({ flowId: z3.string().min(1) }).strict());
|
|
762
771
|
var CURRENT_SCHEMA_VERSION = 5;
|
|
763
772
|
var FlowDocumentSchema = z3.object({
|
|
764
773
|
schemaVersion: z3.literal(CURRENT_SCHEMA_VERSION),
|
|
@@ -800,6 +809,24 @@ var FlowDocumentSchema = z3.object({
|
|
|
800
809
|
path: z3.string().optional(),
|
|
801
810
|
actors: z3.array(ActorDefinitionSchema).optional(),
|
|
802
811
|
defaultActorId: z3.string().optional(),
|
|
812
|
+
/** SIGN IN FIRST: the account this flow starts as, before anything else runs.
|
|
813
|
+
*
|
|
814
|
+
* A setting rather than step one, which is what it used to be saved as. As a
|
|
815
|
+
* step it could not be switched off without deleting it, and a flow reused
|
|
816
|
+
* as somebody else's prerequisite could not tell "my own sign-in" from a
|
|
817
|
+
* sign-in that is part of what it tests. `parseFlowDocument` lifts an old
|
|
818
|
+
* step one into this field, so both spellings read the same. A reference to
|
|
819
|
+
* a profile, never a copy of its steps. */
|
|
820
|
+
signIn: FlowSignInSchema.optional(),
|
|
821
|
+
/** Flows replayed, in this order, after signing in and before this flow's
|
|
822
|
+
* own steps — to reach the state it starts from.
|
|
823
|
+
*
|
|
824
|
+
* LINKS, NOT COPIES: re-record "Save basic info" once and every flow that
|
|
825
|
+
* starts after it follows. Each runs WITHOUT its own sign-in; this flow's
|
|
826
|
+
* is the only one. Explicit and flat — nothing here pulls in a
|
|
827
|
+
* prerequisite's prerequisites at run time, so what runs is exactly this
|
|
828
|
+
* list. The editor fills those in when a flow is added. */
|
|
829
|
+
prerequisites: FlowPrerequisitesSchema.optional(),
|
|
803
830
|
/** Bumped on every save. An edit carries the revision it was made against,
|
|
804
831
|
* so a save built on a stale copy is refused instead of overwriting work
|
|
805
832
|
* somebody else — or a debug session on the same machine — has since done.
|
|
@@ -895,8 +922,19 @@ function parseFlowDocument(input) {
|
|
|
895
922
|
version += 1;
|
|
896
923
|
raw.schemaVersion = version;
|
|
897
924
|
}
|
|
925
|
+
liftSignInFirst(raw);
|
|
898
926
|
return FlowDocumentSchema.parse(raw);
|
|
899
927
|
}
|
|
928
|
+
var SIGN_IN_FIRST_STEP_ID = "sign-in-first";
|
|
929
|
+
function liftSignInFirst(raw) {
|
|
930
|
+
const first = raw.steps?.[0];
|
|
931
|
+
const auth = first?.auth;
|
|
932
|
+
if (!first || first.type !== "signIn" || first.disabled === true || first.actorId !== void 0) return;
|
|
933
|
+
if (!auth || typeof auth.profileId !== "string" || !auth.profileId) return;
|
|
934
|
+
if (raw["signIn"] !== void 0 || Array.isArray(raw["actors"]) && raw["actors"].length > 0) return;
|
|
935
|
+
raw["signIn"] = auth;
|
|
936
|
+
raw.steps = raw.steps.slice(1);
|
|
937
|
+
}
|
|
900
938
|
|
|
901
939
|
// ../test-model/dist/index.js
|
|
902
940
|
import { z as z4 } from "zod";
|
|
@@ -1177,6 +1215,65 @@ function sessionLanes(occurrences, defaultActorId) {
|
|
|
1177
1215
|
}
|
|
1178
1216
|
return rows;
|
|
1179
1217
|
}
|
|
1218
|
+
function randomUUID() {
|
|
1219
|
+
const crypto5 = globalThis.crypto;
|
|
1220
|
+
if (crypto5?.randomUUID) return crypto5.randomUUID();
|
|
1221
|
+
return `${Date.now().toString(16)}-${Math.random().toString(16).slice(2, 14)}`;
|
|
1222
|
+
}
|
|
1223
|
+
var mintPage = (remap, pageId) => {
|
|
1224
|
+
if (pageId === "main") return "main";
|
|
1225
|
+
const existing = remap.pages.get(pageId);
|
|
1226
|
+
if (existing) return existing;
|
|
1227
|
+
const fresh = `pg_${randomUUID().replace(/-/g, "").slice(0, 12)}`;
|
|
1228
|
+
remap.pages.set(pageId, fresh);
|
|
1229
|
+
return fresh;
|
|
1230
|
+
};
|
|
1231
|
+
function retarget(target, remap) {
|
|
1232
|
+
if (!target.pageId) return target;
|
|
1233
|
+
return { ...target, pageId: mintPage(remap, target.pageId) };
|
|
1234
|
+
}
|
|
1235
|
+
function copyStep(step, remap) {
|
|
1236
|
+
const copied = retarget({ ...step, id: remap.steps.get(step.id) }, remap);
|
|
1237
|
+
if (copied.opensPage) copied.opensPage = mintPage(remap, copied.opensPage);
|
|
1238
|
+
if (copied.to) copied.to = retarget({ ...copied.to }, remap);
|
|
1239
|
+
if (copied.scroll?.container) {
|
|
1240
|
+
copied.scroll = { ...copied.scroll, container: retarget({ ...copied.scroll.container }, remap) };
|
|
1241
|
+
}
|
|
1242
|
+
copied.proposals = step.proposals.map((assertion) => ({ ...assertion }));
|
|
1243
|
+
return copied;
|
|
1244
|
+
}
|
|
1245
|
+
function copyFlowIntoCase(flow, context) {
|
|
1246
|
+
const remap = { steps: /* @__PURE__ */ new Map(), pages: /* @__PURE__ */ new Map() };
|
|
1247
|
+
for (const step of flow.steps) {
|
|
1248
|
+
remap.steps.set(step.id, `st_${randomUUID().replace(/-/g, "").slice(0, 12)}`);
|
|
1249
|
+
}
|
|
1250
|
+
const steps = flow.steps.map((step) => copyStep(step, remap));
|
|
1251
|
+
return {
|
|
1252
|
+
occurrenceId: `occ_${randomUUID().replace(/-/g, "").slice(0, 12)}`,
|
|
1253
|
+
name: flow.name,
|
|
1254
|
+
// WHO RUNS THIS COPY. The flow said which of its participants it belongs
|
|
1255
|
+
// to; dropping that here made every copy run as the main participant, so a
|
|
1256
|
+
// flow recorded as the approver silently became the buyer doing approvals.
|
|
1257
|
+
// The case has to be given the participant too — see `mergeParticipants`.
|
|
1258
|
+
...flow.defaultActorId && flow.defaultActorId !== "default" ? { actorId: flow.defaultActorId } : {},
|
|
1259
|
+
...flow.baseUrl ? { baseUrl: flow.baseUrl } : {},
|
|
1260
|
+
startPath: flow.startPath,
|
|
1261
|
+
navigateFirst: false,
|
|
1262
|
+
steps,
|
|
1263
|
+
...flow.environment ? { environment: flow.environment } : {},
|
|
1264
|
+
origin: {
|
|
1265
|
+
flowId: flow.id,
|
|
1266
|
+
schemaVersion: flow.schemaVersion,
|
|
1267
|
+
revision: flow.revision,
|
|
1268
|
+
...context.commit ? { commit: context.commit } : {},
|
|
1269
|
+
featureId: flow.featureId,
|
|
1270
|
+
featureName: context.featureName,
|
|
1271
|
+
flowName: flow.name,
|
|
1272
|
+
stepIds: Object.fromEntries(remap.steps),
|
|
1273
|
+
copiedAt: (context.at ?? /* @__PURE__ */ new Date()).toISOString()
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1180
1277
|
function caseDebugPlan(testCase, baseUrl) {
|
|
1181
1278
|
const owners = {};
|
|
1182
1279
|
const steps = [];
|
|
@@ -1396,6 +1493,85 @@ function sameIdentity(a, b2) {
|
|
|
1396
1493
|
if (a.accountId && b2.accountId) return a.accountId === b2.accountId;
|
|
1397
1494
|
return true;
|
|
1398
1495
|
}
|
|
1496
|
+
var PrerequisiteProblem = class extends Error {
|
|
1497
|
+
constructor(message) {
|
|
1498
|
+
super(message);
|
|
1499
|
+
this.name = "PrerequisiteProblem";
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1502
|
+
function signInFirstStep(flow, id = SIGN_IN_FIRST_STEP_ID) {
|
|
1503
|
+
if (!flow.signIn) return null;
|
|
1504
|
+
return {
|
|
1505
|
+
id,
|
|
1506
|
+
type: "signIn",
|
|
1507
|
+
auth: flow.signIn,
|
|
1508
|
+
name: "Sign in first",
|
|
1509
|
+
role: "",
|
|
1510
|
+
scope: "",
|
|
1511
|
+
value: "",
|
|
1512
|
+
secret: false,
|
|
1513
|
+
legacySelector: "",
|
|
1514
|
+
proposals: []
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1517
|
+
function stepsWithoutSignIn(flow) {
|
|
1518
|
+
const first = flow.steps[0];
|
|
1519
|
+
return first && first.type === "signIn" && !first.disabled ? flow.steps.slice(1) : flow.steps;
|
|
1520
|
+
}
|
|
1521
|
+
var idsOf = (flow) => (flow.prerequisites ?? []).map((p) => p.flowId);
|
|
1522
|
+
function prerequisiteProblems(flow, lookup) {
|
|
1523
|
+
const problems = [];
|
|
1524
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1525
|
+
for (const id of idsOf(flow)) {
|
|
1526
|
+
if (id === flow.id) {
|
|
1527
|
+
problems.push(`"${flow.name}" cannot run before itself`);
|
|
1528
|
+
continue;
|
|
1529
|
+
}
|
|
1530
|
+
if (seen.has(id)) {
|
|
1531
|
+
problems.push(`"${lookup(id)?.name ?? id}" is listed twice before "${flow.name}"`);
|
|
1532
|
+
continue;
|
|
1533
|
+
}
|
|
1534
|
+
seen.add(id);
|
|
1535
|
+
const prerequisite = lookup(id);
|
|
1536
|
+
if (!prerequisite) {
|
|
1537
|
+
problems.push(`a flow "${flow.name}" runs after no longer exists \u2014 remove it from the list`);
|
|
1538
|
+
continue;
|
|
1539
|
+
}
|
|
1540
|
+
if (reaches(prerequisite, flow.id, lookup, /* @__PURE__ */ new Set())) {
|
|
1541
|
+
problems.push(`"${prerequisite.name}" already runs after "${flow.name}", so it cannot also run before it`);
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
return problems;
|
|
1545
|
+
}
|
|
1546
|
+
function reaches(from, target, lookup, visited) {
|
|
1547
|
+
if (visited.has(from.id)) return false;
|
|
1548
|
+
visited.add(from.id);
|
|
1549
|
+
return idsOf(from).some((id) => {
|
|
1550
|
+
if (id === target) return true;
|
|
1551
|
+
const next = lookup(id);
|
|
1552
|
+
return next ? reaches(next, target, lookup, visited) : false;
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
function prerequisitesOf(flow, lookup) {
|
|
1556
|
+
const problems = prerequisiteProblems(flow, lookup);
|
|
1557
|
+
if (problems.length > 0) throw new PrerequisiteProblem(problems.join("; "));
|
|
1558
|
+
return idsOf(flow).map((id) => lookup(id));
|
|
1559
|
+
}
|
|
1560
|
+
function stepsForHost(prerequisite) {
|
|
1561
|
+
return copyFlowIntoCase({ ...prerequisite, steps: stepsWithoutSignIn(prerequisite) }, { featureName: "" }).steps;
|
|
1562
|
+
}
|
|
1563
|
+
function preparationFor(flow, lookup) {
|
|
1564
|
+
return {
|
|
1565
|
+
signIn: signInFirstStep(flow),
|
|
1566
|
+
steps: prerequisitesOf(flow, lookup).flatMap(stepsForHost)
|
|
1567
|
+
};
|
|
1568
|
+
}
|
|
1569
|
+
function expandForRun(flow, lookup) {
|
|
1570
|
+
const { signIn: _signIn, prerequisites: _prerequisites, ...rest } = flow;
|
|
1571
|
+
if (!flow.signIn && idsOf(flow).length === 0) return rest;
|
|
1572
|
+
const { signIn, steps } = preparationFor(flow, lookup);
|
|
1573
|
+
return { ...rest, steps: [...signIn ? [signIn] : [], ...steps, ...flow.steps] };
|
|
1574
|
+
}
|
|
1399
1575
|
|
|
1400
1576
|
// ../engine-playwright/dist/index.js
|
|
1401
1577
|
import { createHmac, randomBytes } from "crypto";
|
|
@@ -1561,7 +1737,7 @@ function describePlan(step, p) {
|
|
|
1561
1737
|
if (p.method === "goForward") return "page.goForward()";
|
|
1562
1738
|
let root = "page";
|
|
1563
1739
|
for (const frame of step.frame ?? []) root += `.frameLocator(${quote(frameSelector(frame))})`;
|
|
1564
|
-
if (!p.overridden && step.scope) root = scopeExpression(root, step.scope, step.scopeRole);
|
|
1740
|
+
if (!p.overridden && (step.scope || step.scopeRole)) root = scopeExpression(root, step.scope ?? "", step.scopeRole);
|
|
1565
1741
|
let base = p.viaAdjacentLabel ? `${root}.getByText(${quote(p.arg)}, { exact: true }).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} }` : ""})`;
|
|
1566
1742
|
if (p.inputRole) base = `${root}.getByRole(${quote(p.inputRole)}, { name: ${quote(p.arg)}, exact: true }).or(${base}.and(${root}.locator(${quote(inputSelector(p.inputRole))})))`;
|
|
1567
1743
|
if (p.visible) base += ".filter({ visible: true })";
|
|
@@ -1580,7 +1756,9 @@ function inputSelector(role) {
|
|
|
1580
1756
|
}
|
|
1581
1757
|
var SCOPE_ROLES = ["form", "group", "region", "dialog", "alertdialog"];
|
|
1582
1758
|
function scopeExpression(root, name, role) {
|
|
1583
|
-
const parts = (role ? [role] : SCOPE_ROLES).map(
|
|
1759
|
+
const parts = (role ? [role] : SCOPE_ROLES).map(
|
|
1760
|
+
(r) => name ? `${root}.getByRole(${quote(r)}, { name: ${quote(name)}, exact: ${!role} })` : `${root}.getByRole(${quote(r)})`
|
|
1761
|
+
);
|
|
1584
1762
|
return parts.reduce((a, b2) => `${a}.or(${b2})`);
|
|
1585
1763
|
}
|
|
1586
1764
|
var CHECKS = [
|
|
@@ -1650,6 +1828,37 @@ function describeAssertion(a, subject) {
|
|
|
1650
1828
|
const label = check.label.replace("attribute", `attribute${attr}`);
|
|
1651
1829
|
return who ? `\u201C${who}\u201D ${label}${expects}` : `${label}${expects}`;
|
|
1652
1830
|
}
|
|
1831
|
+
var NAME_FROM_CONTENT = /* @__PURE__ */ new Set([
|
|
1832
|
+
"button",
|
|
1833
|
+
"link",
|
|
1834
|
+
"heading",
|
|
1835
|
+
"cell",
|
|
1836
|
+
"columnheader",
|
|
1837
|
+
"rowheader",
|
|
1838
|
+
"menuitem",
|
|
1839
|
+
"menuitemcheckbox",
|
|
1840
|
+
"menuitemradio",
|
|
1841
|
+
"option",
|
|
1842
|
+
"tab",
|
|
1843
|
+
"treeitem",
|
|
1844
|
+
"gridcell",
|
|
1845
|
+
"switch",
|
|
1846
|
+
"checkbox",
|
|
1847
|
+
"radio"
|
|
1848
|
+
]);
|
|
1849
|
+
function identifiedByOwnWords(target) {
|
|
1850
|
+
if (!target || target.locator || !target.name) return false;
|
|
1851
|
+
return target.nameFrom === "text" || NAME_FROM_CONTENT.has(target.role ?? "");
|
|
1852
|
+
}
|
|
1853
|
+
function textIndependent(candidates) {
|
|
1854
|
+
if (!candidates?.length) return void 0;
|
|
1855
|
+
const order = ["testId", "css", "id", "title", "altText"];
|
|
1856
|
+
for (const strategy of order) {
|
|
1857
|
+
const found = candidates.find((each) => each.strategy === strategy && each.value.trim());
|
|
1858
|
+
if (found) return found;
|
|
1859
|
+
}
|
|
1860
|
+
return void 0;
|
|
1861
|
+
}
|
|
1653
1862
|
var STEP_PRESENTATION = {
|
|
1654
1863
|
fill: { label: "Fill", tone: "accent" },
|
|
1655
1864
|
select: { label: "Select", tone: "accent" },
|
|
@@ -1777,7 +1986,7 @@ function installRecorder() {
|
|
|
1777
1986
|
if (!visible(el)) return false;
|
|
1778
1987
|
return getComputedStyle(el).opacity !== "0";
|
|
1779
1988
|
};
|
|
1780
|
-
const { accName, identify, roleOf, pointerTarget, scoping, cssPath } = w.__flCreateTargetIdentity(w, clean, CLICKABLE);
|
|
1989
|
+
const { accName, identify, roleOf, pointerTarget, scoping, cssPath, isAmbiguous, landmarkScope, remember } = w.__flCreateTargetIdentity(w, clean, CLICKABLE);
|
|
1781
1990
|
function isOurs(el) {
|
|
1782
1991
|
return Boolean(el?.closest?.("[data-flowriki],[data-flowriki-debug]"));
|
|
1783
1992
|
}
|
|
@@ -1815,10 +2024,14 @@ function installRecorder() {
|
|
|
1815
2024
|
w.__flMuted = Boolean(on);
|
|
1816
2025
|
};
|
|
1817
2026
|
const inFlight = /* @__PURE__ */ new Set();
|
|
1818
|
-
const
|
|
2027
|
+
const tickets = /* @__PURE__ */ new WeakMap();
|
|
2028
|
+
let nextTicket = 0;
|
|
2029
|
+
const send = (a, el) => {
|
|
1819
2030
|
if (w.__flMuted) return;
|
|
1820
2031
|
if (a.type && !["back", "forward", "scroll"].includes(a.type) && !a.name && !a.locator) a.warning = "This target has no stable accessible name or test ID. Choose a locator before running.";
|
|
1821
2032
|
if (FRAME_CHAIN.length && a && a.__sig === void 0) a.frame = FRAME_CHAIN;
|
|
2033
|
+
const ticket = el ? tickets.get(el) : void 0;
|
|
2034
|
+
if (ticket !== void 0) a.__toldApart = ticket;
|
|
1822
2035
|
if (w.__flRecord) {
|
|
1823
2036
|
const pending = Promise.resolve(w.__flRecord(a));
|
|
1824
2037
|
inFlight.add(pending);
|
|
@@ -1867,6 +2080,32 @@ function installRecorder() {
|
|
|
1867
2080
|
}, true);
|
|
1868
2081
|
document.addEventListener("pointerdown", flushScroll, true);
|
|
1869
2082
|
document.addEventListener("keydown", flushScroll, true);
|
|
2083
|
+
const asked = /* @__PURE__ */ new WeakSet();
|
|
2084
|
+
const tellApart2 = (hit) => {
|
|
2085
|
+
if (w.__flMuted || !hit || !w.__flTellApart) return;
|
|
2086
|
+
const el = (hit.closest ? hit.closest(CLICKABLE) : null) ?? pointerTarget(hit) ?? hit;
|
|
2087
|
+
if (!el || asked.has(el)) return;
|
|
2088
|
+
const role = roleOf(el);
|
|
2089
|
+
const { name } = identify(el);
|
|
2090
|
+
if (!name || !isAmbiguous(el, role, name)) return;
|
|
2091
|
+
asked.add(el);
|
|
2092
|
+
w.__flTellingApart = el;
|
|
2093
|
+
const ticket = ++nextTicket;
|
|
2094
|
+
tickets.set(el, ticket);
|
|
2095
|
+
void Promise.resolve(
|
|
2096
|
+
w.__flTellApart({
|
|
2097
|
+
ticket,
|
|
2098
|
+
target: { role, ...identify(el), ...scoping(el, role, name) },
|
|
2099
|
+
suggested: landmarkScope(el),
|
|
2100
|
+
marker: "__flTellingApart"
|
|
2101
|
+
})
|
|
2102
|
+
).then((told) => {
|
|
2103
|
+
if (told) remember(el, told);
|
|
2104
|
+
}).catch(() => {
|
|
2105
|
+
});
|
|
2106
|
+
};
|
|
2107
|
+
document.addEventListener("pointerdown", (e) => tellApart2(actualTarget(e)), true);
|
|
2108
|
+
document.addEventListener("focusin", (e) => tellApart2(actualTarget(e)), true);
|
|
1870
2109
|
const sendSignature = () => {
|
|
1871
2110
|
if (!inTopFrame) return;
|
|
1872
2111
|
try {
|
|
@@ -2078,17 +2317,6 @@ function installRecorder() {
|
|
|
2078
2317
|
const above = r.top > 26;
|
|
2079
2318
|
pickLabel.style.transform = `translate(${Math.max(4, r.left)}px, ${above ? r.top - 24 : r.bottom + 4}px)`;
|
|
2080
2319
|
}
|
|
2081
|
-
function stableId(el) {
|
|
2082
|
-
const id = el.id;
|
|
2083
|
-
if (!id || /:r|[a-f0-9]{12}|\d{6}/i.test(id)) return null;
|
|
2084
|
-
const root = el.getRootNode();
|
|
2085
|
-
const sel = `#${CSS.escape(id)}`;
|
|
2086
|
-
try {
|
|
2087
|
-
return root.querySelectorAll(sel).length === 1 ? sel : null;
|
|
2088
|
-
} catch {
|
|
2089
|
-
return null;
|
|
2090
|
-
}
|
|
2091
|
-
}
|
|
2092
2320
|
function pickTargetAt(e) {
|
|
2093
2321
|
const hit = actualTarget(e);
|
|
2094
2322
|
if (!hit || !hit.closest) return null;
|
|
@@ -2121,15 +2349,16 @@ function installRecorder() {
|
|
|
2121
2349
|
...identity,
|
|
2122
2350
|
...scoping(el, role, identity.name),
|
|
2123
2351
|
// An element named by its own TEXT is a circular identity for an
|
|
2124
|
-
// assertion about that text
|
|
2125
|
-
//
|
|
2126
|
-
//
|
|
2127
|
-
//
|
|
2128
|
-
|
|
2352
|
+
// assertion about that text. The driver settles it — see
|
|
2353
|
+
// `preferIndependentIdentity` — because only there is there one list
|
|
2354
|
+
// of everything that identifies this element. The version here knew
|
|
2355
|
+
// about `id` and nothing else, so a heading carrying the `data-testid`
|
|
2356
|
+
// somebody had added for exactly this purpose was recorded by its
|
|
2357
|
+
// words anyway.
|
|
2129
2358
|
...FRAME_CHAIN.length ? { frame: FRAME_CHAIN } : {}
|
|
2130
2359
|
},
|
|
2131
2360
|
readings: read
|
|
2132
|
-
});
|
|
2361
|
+
}, el);
|
|
2133
2362
|
}
|
|
2134
2363
|
function onPickKey(e) {
|
|
2135
2364
|
if (e.key !== "Escape") return;
|
|
@@ -2180,7 +2409,7 @@ function installRecorder() {
|
|
|
2180
2409
|
...identify(el),
|
|
2181
2410
|
...scoping(el, role, identify(el).name),
|
|
2182
2411
|
legacySelector: cssPath(el)
|
|
2183
|
-
});
|
|
2412
|
+
}, el);
|
|
2184
2413
|
}
|
|
2185
2414
|
document.addEventListener(
|
|
2186
2415
|
"click",
|
|
@@ -2236,7 +2465,7 @@ function installRecorder() {
|
|
|
2236
2465
|
// app's own handler runs and before any navigation starts. This is
|
|
2237
2466
|
// the only moment the true "before" state is observable.
|
|
2238
2467
|
__before: w.__flSignature()
|
|
2239
|
-
});
|
|
2468
|
+
}, el);
|
|
2240
2469
|
setTimeout(sendSignature, 350);
|
|
2241
2470
|
},
|
|
2242
2471
|
true
|
|
@@ -2259,7 +2488,7 @@ function installRecorder() {
|
|
|
2259
2488
|
to: describe(to),
|
|
2260
2489
|
legacySelector: cssPath(from),
|
|
2261
2490
|
__before: w.__flSignature()
|
|
2262
|
-
});
|
|
2491
|
+
}, from);
|
|
2263
2492
|
setTimeout(sendSignature, 350);
|
|
2264
2493
|
}
|
|
2265
2494
|
document.addEventListener(
|
|
@@ -2382,7 +2611,7 @@ function installRecorder() {
|
|
|
2382
2611
|
// Same reasoning as the click listener: the capture phase is the only
|
|
2383
2612
|
// moment the pre-submit state is still observable.
|
|
2384
2613
|
__before: w.__flSignature()
|
|
2385
|
-
});
|
|
2614
|
+
}, el);
|
|
2386
2615
|
setTimeout(sendSignature, 350);
|
|
2387
2616
|
},
|
|
2388
2617
|
true
|
|
@@ -2423,7 +2652,7 @@ function installRecorder() {
|
|
|
2423
2652
|
legacySelector: cssPath(el),
|
|
2424
2653
|
value: picked.join(", "),
|
|
2425
2654
|
values: picked
|
|
2426
|
-
});
|
|
2655
|
+
}, el);
|
|
2427
2656
|
return;
|
|
2428
2657
|
}
|
|
2429
2658
|
const values = tag === "select" ? Array.from(el.selectedOptions).map((o) => o.value) : void 0;
|
|
@@ -2441,7 +2670,7 @@ function installRecorder() {
|
|
|
2441
2670
|
value,
|
|
2442
2671
|
...values ? { values } : {},
|
|
2443
2672
|
secret: looksSecret(el, type, identity.name)
|
|
2444
|
-
});
|
|
2673
|
+
}, el);
|
|
2445
2674
|
};
|
|
2446
2675
|
document.addEventListener("input", onEdit, true);
|
|
2447
2676
|
document.addEventListener("change", onEdit, true);
|
|
@@ -2487,6 +2716,8 @@ function installDebugPanel() {
|
|
|
2487
2716
|
if (r.interactive) {
|
|
2488
2717
|
first.push("visible", "enabled");
|
|
2489
2718
|
if (r.text) first.push("text");
|
|
2719
|
+
} else if (r.text && r.namedByOwnWords) {
|
|
2720
|
+
first.push("visible");
|
|
2490
2721
|
} else if (r.text) {
|
|
2491
2722
|
first.push("text-contains", "text");
|
|
2492
2723
|
}
|
|
@@ -3820,9 +4051,12 @@ async function locateAll(page, step, opts = {}) {
|
|
|
3820
4051
|
}
|
|
3821
4052
|
async function fromPlan(page, step, plan, opts = {}) {
|
|
3822
4053
|
let root = rootFor(page, step);
|
|
3823
|
-
if (step.scope && !plan.overridden) {
|
|
4054
|
+
if ((step.scope || step.scopeRole) && !plan.overridden) {
|
|
3824
4055
|
const roles = step.scopeRole ? [step.scopeRole] : [...SCOPE_ROLES];
|
|
3825
|
-
const containers = roles.map((role) => root.getByRole(role, {
|
|
4056
|
+
const containers = roles.map((role) => root.getByRole(role, {
|
|
4057
|
+
...step.scope ? { name: step.scope, exact: !step.scopeRole } : {},
|
|
4058
|
+
includeHidden: opts.includeHidden
|
|
4059
|
+
}));
|
|
3826
4060
|
root = containers.reduce((a, b2) => a.or(b2));
|
|
3827
4061
|
}
|
|
3828
4062
|
if (plan.viaAdjacentLabel) return root.getByText(plan.arg, { exact: true }).locator("xpath=..").getByRole(step.role || "textbox", { includeHidden: opts.includeHidden });
|
|
@@ -4013,7 +4247,14 @@ async function checkAssertion(page, kind, value, timeoutMs = 3e3, assertion) {
|
|
|
4013
4247
|
const target = assertion?.target && kind !== "count" ? await locate(page, asStep(assertion.target), { includeHidden: aboutAbsence }) : void 0;
|
|
4014
4248
|
if (kind === "fields_visible") {
|
|
4015
4249
|
for (const name of Array.isArray(value) ? value : [value]) {
|
|
4016
|
-
|
|
4250
|
+
const field = page.getByLabel(name, { exact: true }).or(page.getByRole("textbox", { name, exact: true })).filter({ visible: true });
|
|
4251
|
+
let seen = 0;
|
|
4252
|
+
do {
|
|
4253
|
+
seen = await field.count().catch(() => 0);
|
|
4254
|
+
if (seen > 0) break;
|
|
4255
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
4256
|
+
} while (Date.now() < deadline);
|
|
4257
|
+
if (seen === 0) throw new Error(`no visible field named "${name}"`);
|
|
4017
4258
|
}
|
|
4018
4259
|
return `fields visible: ${Array.isArray(value) ? value.join(", ") : value}`;
|
|
4019
4260
|
}
|
|
@@ -4323,6 +4564,26 @@ var checkStep = (id, proposals) => ({
|
|
|
4323
4564
|
legacySelector: "",
|
|
4324
4565
|
proposals
|
|
4325
4566
|
});
|
|
4567
|
+
async function replayInto(target, steps, opts) {
|
|
4568
|
+
const session = {
|
|
4569
|
+
ownsBrowser: false,
|
|
4570
|
+
browser: target.browser,
|
|
4571
|
+
context: target.context,
|
|
4572
|
+
page: target.page,
|
|
4573
|
+
pages: new ExecutionPages(target.context, target.page),
|
|
4574
|
+
config: target.config,
|
|
4575
|
+
artifacts: resolveCapture({ policy: { screenshot: "off", video: "off", trace: "off", console: false } }),
|
|
4576
|
+
consoleLines: [],
|
|
4577
|
+
runArtifacts: []
|
|
4578
|
+
};
|
|
4579
|
+
const outcome = await runStepsIn(session, steps, {
|
|
4580
|
+
startUrl: null,
|
|
4581
|
+
...opts.resolveSecret ? { resolveSecret: opts.resolveSecret } : {},
|
|
4582
|
+
...opts.resolveAuth ? { resolveAuth: opts.resolveAuth } : {},
|
|
4583
|
+
...opts.baseUrl ? { baseUrl: opts.baseUrl } : {}
|
|
4584
|
+
});
|
|
4585
|
+
return outcome.status === "passed" ? { ok: true } : { ok: false, error: outcome.error ?? "a step before recording did not complete" };
|
|
4586
|
+
}
|
|
4326
4587
|
function opensItsOwnEntry(steps, opts) {
|
|
4327
4588
|
const first = steps.find((step) => !step.disabled);
|
|
4328
4589
|
if (!first || first.type !== "signIn" || !first.auth) return false;
|
|
@@ -5007,6 +5268,50 @@ async function describePick(page, payload) {
|
|
|
5007
5268
|
} catch {
|
|
5008
5269
|
}
|
|
5009
5270
|
}
|
|
5271
|
+
function preferIndependentIdentity(target) {
|
|
5272
|
+
if (!identifiedByOwnWords(target)) return;
|
|
5273
|
+
const independent = textIndependent(target["candidates"]);
|
|
5274
|
+
if (independent) target["locator"] = independent;
|
|
5275
|
+
}
|
|
5276
|
+
async function tellApart(page, target, suggested, marker) {
|
|
5277
|
+
const asStep = (over = {}) => ({
|
|
5278
|
+
id: "pick",
|
|
5279
|
+
type: "click",
|
|
5280
|
+
value: "",
|
|
5281
|
+
secret: false,
|
|
5282
|
+
legacySelector: "",
|
|
5283
|
+
proposals: [],
|
|
5284
|
+
scope: "",
|
|
5285
|
+
...target,
|
|
5286
|
+
...over
|
|
5287
|
+
});
|
|
5288
|
+
const matches = async (over) => {
|
|
5289
|
+
try {
|
|
5290
|
+
return await (await locateAll(page, asStep(over))).count();
|
|
5291
|
+
} catch {
|
|
5292
|
+
return -1;
|
|
5293
|
+
}
|
|
5294
|
+
};
|
|
5295
|
+
const bare = await matches();
|
|
5296
|
+
if (bare <= 1) return {};
|
|
5297
|
+
if (suggested?.scopeRole) {
|
|
5298
|
+
const scoped = { scope: suggested.scope ?? "", scopeRole: suggested.scopeRole };
|
|
5299
|
+
if (await matches(scoped) === 1) return scoped;
|
|
5300
|
+
}
|
|
5301
|
+
const all = await (await locateAll(page, asStep())).elementHandles();
|
|
5302
|
+
try {
|
|
5303
|
+
for (const [index, handle] of all.entries()) {
|
|
5304
|
+
const isIt = await handle.evaluate((el, key) => el === window[key], marker).catch(() => false);
|
|
5305
|
+
if (isIt) return { nth: index };
|
|
5306
|
+
}
|
|
5307
|
+
} finally {
|
|
5308
|
+
await Promise.all(all.map((h) => h.dispose().catch(() => {
|
|
5309
|
+
})));
|
|
5310
|
+
}
|
|
5311
|
+
return {
|
|
5312
|
+
warning: `${bare} elements on this page are called "${String(target["name"] ?? "")}" and nothing here tells them apart \u2014 give it a test ID, or choose a locator before running.`
|
|
5313
|
+
};
|
|
5314
|
+
}
|
|
5010
5315
|
var OUTCOME_WINDOW_MS = 2500;
|
|
5011
5316
|
var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
5012
5317
|
var COMMITS = /* @__PURE__ */ new Set([
|
|
@@ -5188,6 +5493,11 @@ async function startRecordingSession(opts) {
|
|
|
5188
5493
|
...payload.nameFrom ? { nameFrom: payload.nameFrom } : {},
|
|
5189
5494
|
scope: payload.scope ?? "",
|
|
5190
5495
|
...payload.scopeRole ? { scopeRole: payload.scopeRole } : {},
|
|
5496
|
+
// WHICH OF SEVERAL IDENTICAL ONES, when nothing else separates them.
|
|
5497
|
+
// Worked out by the driver while the page still showed both — see
|
|
5498
|
+
// `tellApart` — and dropped here until now, so the answer was computed
|
|
5499
|
+
// and then quietly thrown away.
|
|
5500
|
+
...typeof payload.nth === "number" ? { nth: payload.nth } : {},
|
|
5191
5501
|
...payload.frame?.length ? { frame: payload.frame } : {},
|
|
5192
5502
|
...payload.to ? { to: payload.to } : {},
|
|
5193
5503
|
...payload.locator ? { locator: payload.locator } : {},
|
|
@@ -5231,6 +5541,18 @@ async function startRecordingSession(opts) {
|
|
|
5231
5541
|
}
|
|
5232
5542
|
const before = payload.__before ?? signature;
|
|
5233
5543
|
delete payload.__before;
|
|
5544
|
+
const ticket = payload.__toldApart;
|
|
5545
|
+
delete payload.__toldApart;
|
|
5546
|
+
if (typeof ticket === "number" && answers.has(ticket)) {
|
|
5547
|
+
const told = await answers.get(ticket);
|
|
5548
|
+
answers.delete(ticket);
|
|
5549
|
+
if (told?.scopeRole) {
|
|
5550
|
+
payload.scope = told.scope ?? "";
|
|
5551
|
+
payload.scopeRole = told.scopeRole;
|
|
5552
|
+
}
|
|
5553
|
+
if (told?.nth !== void 0) payload.nth = told.nth;
|
|
5554
|
+
if (told?.warning && !payload.warning) payload.warning = told.warning;
|
|
5555
|
+
}
|
|
5234
5556
|
const chain = src?.frame ? frameChains.get(src.frame) : void 0;
|
|
5235
5557
|
if (chain?.length) payload.frame = chain;
|
|
5236
5558
|
if (payload.type === "press" && payload.value === "Enter") {
|
|
@@ -5259,10 +5581,22 @@ async function startRecordingSession(opts) {
|
|
|
5259
5581
|
const chain = src?.frame ? frameChains.get(src.frame) : void 0;
|
|
5260
5582
|
if (chain?.length) payload.target.frame = chain;
|
|
5261
5583
|
if (src.page) payload.target.pageId = pageIds.get(src.page) ?? "main";
|
|
5584
|
+
preferIndependentIdentity(payload.target);
|
|
5262
5585
|
await describePick(src.page ?? page, payload);
|
|
5586
|
+
if (payload.readings) payload.readings.namedByOwnWords = identifiedByOwnWords(payload.target);
|
|
5263
5587
|
void session.setPicking(false);
|
|
5264
5588
|
void toPanel({ picked: payload });
|
|
5265
5589
|
});
|
|
5590
|
+
const answers = /* @__PURE__ */ new Map();
|
|
5591
|
+
await context.exposeBinding("__flTellApart", async (src, payload) => {
|
|
5592
|
+
if (paused || stopped || !payload?.target) return {};
|
|
5593
|
+
const work = tellApart(src.page ?? page, payload.target, payload.suggested, String(payload.marker ?? "__flTellingApart")).catch(() => ({}));
|
|
5594
|
+
if (typeof payload.ticket === "number") {
|
|
5595
|
+
answers.set(payload.ticket, work);
|
|
5596
|
+
void work.finally(() => setTimeout(() => answers.delete(payload.ticket), 1e4).unref?.());
|
|
5597
|
+
}
|
|
5598
|
+
return await work;
|
|
5599
|
+
});
|
|
5266
5600
|
await context.exposeBinding("__flStop", () => {
|
|
5267
5601
|
onStopRequested?.(true);
|
|
5268
5602
|
});
|
|
@@ -5303,6 +5637,25 @@ async function startRecordingSession(opts) {
|
|
|
5303
5637
|
throw new Error(`${firstLine2(error)} \u2014 the browser was on ${landed || "/"}${title ? ` ("${title}")` : ""}`);
|
|
5304
5638
|
}
|
|
5305
5639
|
}
|
|
5640
|
+
const prepared = Boolean(opts.preparation?.steps.length);
|
|
5641
|
+
if (opts.preparation && prepared) {
|
|
5642
|
+
try {
|
|
5643
|
+
if (!opts.authentication) await page.goto(url, { waitUntil: "domcontentloaded" });
|
|
5644
|
+
const replayed = await replayInto({ browser, context, page, config }, opts.preparation.steps, {
|
|
5645
|
+
resolveSecret: opts.preparation.resolveSecret,
|
|
5646
|
+
...opts.preparation.resolveAuth ? { resolveAuth: opts.preparation.resolveAuth } : {},
|
|
5647
|
+
baseUrl: url
|
|
5648
|
+
});
|
|
5649
|
+
if (!replayed.ok) throw new Error(replayed.error);
|
|
5650
|
+
} catch (error) {
|
|
5651
|
+
const landed = page.url().replace(/^https?:\/\/[^/]+/, "");
|
|
5652
|
+
const title = await page.title().catch(() => "");
|
|
5653
|
+
stopped = true;
|
|
5654
|
+
await browser.close().catch(() => {
|
|
5655
|
+
});
|
|
5656
|
+
throw new Error(`the flows this one starts after did not finish: ${firstLine2(error)} \u2014 the browser was on ${landed || "/"}${title ? ` ("${title}")` : ""}`);
|
|
5657
|
+
}
|
|
5658
|
+
}
|
|
5306
5659
|
await context.addInitScript({ content: INIT_SCRIPT });
|
|
5307
5660
|
const ensureInstalled = async (p) => {
|
|
5308
5661
|
try {
|
|
@@ -5355,7 +5708,7 @@ async function startRecordingSession(opts) {
|
|
|
5355
5708
|
});
|
|
5356
5709
|
});
|
|
5357
5710
|
try {
|
|
5358
|
-
if (!opts.authentication) await page.goto(url, { waitUntil: "domcontentloaded", timeout: 45e3 });
|
|
5711
|
+
if (!opts.authentication && !prepared) await page.goto(url, { waitUntil: "domcontentloaded", timeout: 45e3 });
|
|
5359
5712
|
else await ensureInstalled(page);
|
|
5360
5713
|
} catch (err) {
|
|
5361
5714
|
stopped = true;
|
|
@@ -5411,8 +5764,8 @@ async function startRecordingSession(opts) {
|
|
|
5411
5764
|
legacySelector: "",
|
|
5412
5765
|
proposals: [parsed]
|
|
5413
5766
|
};
|
|
5414
|
-
if ((parsed.kind === "text" || parsed.kind === "class" || parsed.kind === "attribute") && parsed.target
|
|
5415
|
-
step.warning = "
|
|
5767
|
+
if ((parsed.kind === "text" || parsed.kind === "class" || parsed.kind === "attribute") && identifiedByOwnWords(parsed.target)) {
|
|
5768
|
+
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.";
|
|
5416
5769
|
}
|
|
5417
5770
|
RecordedStepSchema.parse(step);
|
|
5418
5771
|
if (pendingScrollPos) {
|
|
@@ -5703,6 +6056,7 @@ async function startDebugSession(opts) {
|
|
|
5703
6056
|
return;
|
|
5704
6057
|
}
|
|
5705
6058
|
if (!payload?.target) return;
|
|
6059
|
+
preferIndependentIdentity(payload.target);
|
|
5706
6060
|
await describePick(src.page ?? page, payload);
|
|
5707
6061
|
void session.setPicking(false);
|
|
5708
6062
|
void toPanel({ picked: payload });
|
|
@@ -7623,8 +7977,15 @@ var LOCAL_CHROMIUM = { id: "chromium", provider: "local", engine: "chromium" };
|
|
|
7623
7977
|
async function executeFlow(opts) {
|
|
7624
7978
|
const { store, storage = null, flowId, trigger, watch = false, onEvent } = opts;
|
|
7625
7979
|
const headless = watch ? false : opts.headless ?? store.readConfig().headless;
|
|
7626
|
-
const
|
|
7627
|
-
if (!
|
|
7980
|
+
const found = store.getFlow(flowId);
|
|
7981
|
+
if (!found) throw new FlowNotRunnable(`flow not found: ${flowId}`, "not_found");
|
|
7982
|
+
let flow = found;
|
|
7983
|
+
try {
|
|
7984
|
+
flow = expandForRun(found, (id) => store.getFlow(id));
|
|
7985
|
+
} catch (problem) {
|
|
7986
|
+
if (problem instanceof PrerequisiteProblem) throw new FlowNotRunnable(problem.message, "empty");
|
|
7987
|
+
throw problem;
|
|
7988
|
+
}
|
|
7628
7989
|
if (opts.expectedRevision !== void 0 && flow.revision !== opts.expectedRevision) {
|
|
7629
7990
|
throw new FlowConflict("the flow changed before execution \u2014 reload it before running", flow.revision);
|
|
7630
7991
|
}
|
|
@@ -8174,6 +8535,11 @@ var RecordingCoordinator = class {
|
|
|
8174
8535
|
resolveAuth: authenticationResolver(opts.authentications),
|
|
8175
8536
|
resolveSecret: (ref) => opts.secrets?.[ref]
|
|
8176
8537
|
} } : {},
|
|
8538
|
+
...opts.preparation?.length ? { preparation: {
|
|
8539
|
+
steps: opts.preparation,
|
|
8540
|
+
resolveAuth: authenticationResolver(opts.authentications),
|
|
8541
|
+
resolveSecret: (ref) => opts.secrets?.[ref]
|
|
8542
|
+
} } : {},
|
|
8177
8543
|
// The project's saved defaults, unless this recording asks for
|
|
8178
8544
|
// something else. Without the fallback the settings screen would write
|
|
8179
8545
|
// a file nothing ever read.
|
|
@@ -8618,7 +8984,7 @@ function resolveCheckouts(dirs) {
|
|
|
8618
8984
|
return { projects, skipped };
|
|
8619
8985
|
}
|
|
8620
8986
|
|
|
8621
|
-
// ../agent-core/dist/chunk-
|
|
8987
|
+
// ../agent-core/dist/chunk-4MOK25KG.js
|
|
8622
8988
|
import { WebSocket, WebSocketServer } from "ws";
|
|
8623
8989
|
var HEARTBEAT_MS = 3e4;
|
|
8624
8990
|
function adapt(socket) {
|
|
@@ -9688,8 +10054,10 @@ function recordingHandlers({ recorder, onActivity }) {
|
|
|
9688
10054
|
// returned on stop for the service to commit to the repository. A
|
|
9689
10055
|
// machine that has the project checked out still records into it.
|
|
9690
10056
|
root,
|
|
9691
|
-
...command.args["authentication"] ? {
|
|
9692
|
-
|
|
10057
|
+
...command.args["authentication"] ? { authentication: AuthReferenceSchema.parse(command.args["authentication"]) } : {},
|
|
10058
|
+
// The flows this recording starts after, replayed before capturing.
|
|
10059
|
+
...Array.isArray(command.args["preparation"]) && command.args["preparation"].length > 0 ? { preparation: RecordedStepSchema.array().parse(command.args["preparation"]) } : {},
|
|
10060
|
+
...command.args["authentication"] || command.args["preparation"] ? {
|
|
9693
10061
|
authentications: command.args["authentications"],
|
|
9694
10062
|
secrets: command.args["secrets"] ?? {}
|
|
9695
10063
|
} : {},
|
package/dist/cli.js
CHANGED
package/dist/engine.js
CHANGED
package/package.json
CHANGED