@capagents/forgeqe 3.2.5 → 3.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/HOW_TO_USE.md +9 -5
  2. package/dist/docs-site/docs/architecture-reference/index.html +1 -0
  3. package/dist/docs-site/docs/area-api/index.html +17 -4
  4. package/dist/docs-site/docs/get-started/index.html +7 -4
  5. package/dist/docs-site/docs/overview/index.html +1 -1
  6. package/dist/docs-site/docs/search.js +1 -1
  7. package/dist/docs-site/docs/web-app/index.html +4 -1
  8. package/dist/forgeqe.js +1823 -1816
  9. package/dist/web/assets/{3d-force-graph-D62h_vvb.js → 3d-force-graph-CNVqakzA.js} +1 -1
  10. package/dist/web/assets/{Agent-BadQe1GY.js → Agent-CAp1dIHx.js} +6 -6
  11. package/dist/web/assets/{AgentWork-BGc6uVxB.js → AgentWork-DxO8FN6U.js} +1 -1
  12. package/dist/web/assets/{ApiTests-Bo4ds0wk.js → ApiTests-XQ8wXCBj.js} +8 -8
  13. package/dist/web/assets/Browse-BP1oToo4.js +1 -0
  14. package/dist/web/assets/Chat-DjIdHvHj.js +3 -0
  15. package/dist/web/assets/{CommandPalette-Dl_DibqU.js → CommandPalette-rNWxEO_C.js} +1 -1
  16. package/dist/web/assets/{Compare-Dlzg7S1a.js → Compare-DwUP21-2.js} +1 -1
  17. package/dist/web/assets/{Cost-DRKVox_i.js → Cost-qZ-gGn2T.js} +1 -1
  18. package/dist/web/assets/Data-AlbKk5zW.js +6 -0
  19. package/dist/web/assets/Desktop-yGPlxyBz.js +1 -0
  20. package/dist/web/assets/DesktopReview-BlpxN07L.js +2 -0
  21. package/dist/web/assets/{DeviceScreen-CCDj-wqV.js → DeviceScreen-BQKsJonx.js} +1 -1
  22. package/dist/web/assets/{Evidence-BQmhYE2G.js → Evidence-BCodp0GV.js} +1 -1
  23. package/dist/web/assets/{Explore-CVurlUoU.js → Explore-Ck5EEDy7.js} +2 -2
  24. package/dist/web/assets/{Features-DPc3_RSA.js → Features-BOQomaU8.js} +1 -1
  25. package/dist/web/assets/{Flags-D4d9STIv.js → Flags-DjolLE4S.js} +2 -2
  26. package/dist/web/assets/{Flaky-Dt3iYOZg.js → Flaky-D-xnPfil.js} +1 -1
  27. package/dist/web/assets/{Impact-CKy2Ezzt.js → Impact-CoNLaNwy.js} +3 -3
  28. package/dist/web/assets/Jobs-_kBd2W3F.js +5 -0
  29. package/dist/web/assets/KindPage-DfnkzpPj.js +6 -0
  30. package/dist/web/assets/{LiveDevice-DQNdKoh3.js → LiveDevice-DRAN4Gl4.js} +1 -1
  31. package/dist/web/assets/{Migration-EO--lNV1.js → Migration-PETc1Ckc.js} +5 -5
  32. package/dist/web/assets/Mobile-B193VBXu.js +1 -0
  33. package/dist/web/assets/{Observability-DPjKbwcO.js → Observability-CvdV37XD.js} +1 -1
  34. package/dist/web/assets/PageAgent-BJguufGW.js +1 -0
  35. package/dist/web/assets/{Product-ddlw8A_d.js → Product-Cmgcj9fr.js} +4 -4
  36. package/dist/web/assets/{Production-svTscJhy.js → Production-DM62n03j.js} +1 -1
  37. package/dist/web/assets/{Quality-CgIo3fM8.js → Quality-DbgAAeel.js} +1 -1
  38. package/dist/web/assets/{Readiness-D6s73wXK.js → Readiness-CojmD235.js} +1 -1
  39. package/dist/web/assets/Record-C4VFM97k.js +1 -0
  40. package/dist/web/assets/Regression-5mma_vyD.js +5 -0
  41. package/dist/web/assets/{RelationGraph-BZYcwCVA.js → RelationGraph-bDvvcead.js} +1 -1
  42. package/dist/web/assets/{Reports-CDv_x9iB.js → Reports-BeSrlzKk.js} +2 -2
  43. package/dist/web/assets/Responsive-B4CkMBwF.js +3 -0
  44. package/dist/web/assets/{RunDiff-CO8asgjK.js → RunDiff-DGThx7bk.js} +1 -1
  45. package/dist/web/assets/Settings-IjfPYiuf.js +21 -0
  46. package/dist/web/assets/{Steps-Dn12ePte.js → Steps-BPSNI3aY.js} +1 -1
  47. package/dist/web/assets/{TestCases-CzXHBm5G.js → TestCases-hIuP5BLu.js} +1 -1
  48. package/dist/web/assets/TestData-DpAMEMLP.js +2 -0
  49. package/dist/web/assets/{TestDebt-B1_-OBJe.js → TestDebt-D6UjJCpY.js} +1 -1
  50. package/dist/web/assets/TestManagement-CTWh-aA8.js +4 -0
  51. package/dist/web/assets/{WhatsNew-DLE9LimG.js → WhatsNew-DMDg1zmv.js} +1 -1
  52. package/dist/web/assets/agentSettingsSheet-CUogAKga.js +1 -0
  53. package/dist/web/assets/{dataParts-DAuDeT2W.js → dataParts-s8iIR3Ad.js} +3 -3
  54. package/dist/web/assets/{desktopAppPath-C_bB4dWx.js → desktopAppPath-CnmfVr-s.js} +1 -1
  55. package/dist/web/assets/frame-DNgVKrlp.js +13 -0
  56. package/dist/web/assets/index-BBJ_SKdO.js +56 -0
  57. package/dist/web/assets/index-hysPD6U9.css +2 -0
  58. package/dist/web/assets/input-FbzQKk3L.js +1 -0
  59. package/dist/web/assets/{markdown-Cj6qWQq7.js → markdown-1z66EzBR.js} +1 -1
  60. package/dist/web/assets/pageBack-B6bY6ZUl.js +3 -0
  61. package/dist/web/assets/palette-C5Ok5Zd1.js +1 -0
  62. package/dist/web/assets/paletteCommands-CwHwpVqt.js +1 -0
  63. package/dist/web/assets/{parts-BQWLwMBf.js → parts-Dqq6noWp.js} +1 -1
  64. package/dist/web/assets/{productParts-2Ar8qxlW.js → productParts-DNSo4bn5.js} +1 -1
  65. package/dist/web/assets/qualityParts-kh6SukEP.js +1 -0
  66. package/dist/web/assets/{recordTest-CL1Z2YWn.js → recordTest-BCxsm3gC.js} +1 -1
  67. package/dist/web/assets/sectionList-BlwEtA8S.js +1 -0
  68. package/dist/web/assets/{stepper-p4Pkqn9_.js → stepper-ByKrM1LP.js} +1 -1
  69. package/dist/web/index.html +8 -8
  70. package/docs/ARCHITECTURE_REFERENCE.md +1 -0
  71. package/docs/WEB_APP.md +4 -1
  72. package/docs/user-guide.html +16 -3
  73. package/forgeqe.example.yaml +3 -2
  74. package/llms.example.json +22 -0
  75. package/package.json +1 -1
  76. package/prompts/test-agent.md +0 -2
  77. package/prompts/test-rules.md +3 -8
  78. package/py/forgeqe_desktop/replay.py +46 -1
  79. package/py/forgeqe_desktop/workflow.py +60 -7
  80. package/py/forgeqe_engine/copilot_gateway.py +208 -23
  81. package/py/forgeqe_mobile/maestro.py +3 -0
  82. package/dist/web/assets/Browse-CmVZJZ72.js +0 -1
  83. package/dist/web/assets/Chat-LTtQQHqr.js +0 -3
  84. package/dist/web/assets/Data-c2c1QLI9.js +0 -6
  85. package/dist/web/assets/Desktop-BMLYLWq1.js +0 -1
  86. package/dist/web/assets/DesktopReview-CO0vz-8o.js +0 -2
  87. package/dist/web/assets/Jobs-BZ4zn_7P.js +0 -5
  88. package/dist/web/assets/KindPage-joSX8gyV.js +0 -6
  89. package/dist/web/assets/Mobile-DWGNs3HT.js +0 -1
  90. package/dist/web/assets/PageAgent-h70DL1L7.js +0 -1
  91. package/dist/web/assets/Record-Cmzr-0-f.js +0 -1
  92. package/dist/web/assets/Regression--3mygZAw.js +0 -5
  93. package/dist/web/assets/Responsive-BhRYdJlZ.js +0 -3
  94. package/dist/web/assets/Settings-D3zWorNs.js +0 -21
  95. package/dist/web/assets/TestData-CL9bxSAI.js +0 -2
  96. package/dist/web/assets/TestManagement-MwMgDuO_.js +0 -4
  97. package/dist/web/assets/agents-DPabR9dS.js +0 -1
  98. package/dist/web/assets/frame-DBWtBguh.js +0 -13
  99. package/dist/web/assets/index-ByIauY65.css +0 -2
  100. package/dist/web/assets/index-Tsofflw2.js +0 -57
  101. package/dist/web/assets/input-DX7REka8.js +0 -1
  102. package/dist/web/assets/pageBack-DmmT2q53.js +0 -3
  103. package/dist/web/assets/palette-CtM-T-2Q.js +0 -1
  104. package/dist/web/assets/paletteCommands-BYTeXpSW.js +0 -1
  105. package/dist/web/assets/qualityParts-_Sify8OE.js +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{A as t,Er as n,H as r,I as i,Kr as a,R as o,_n as s,_t as c,n as l,r as u}from"./route-D8G-pTdk.js";import{t as d}from"./jsx-runtime-LKYXHABd.js";import{A as f,Z as p,a as m,kt as h,n as g}from"./input-DX7REka8.js";import{D as _,E as v,i as y,l as b,n as x}from"./pageBack-DmmT2q53.js";import{L as S}from"./palette-CtM-T-2Q.js";import{Et as C,Pt as w,dt as T,s as E,t as D}from"./frame-DBWtBguh.js";import{t as O}from"./when-BuWCTaKm.js";import{A as k}from"./index-Tsofflw2.js";import{_ as A,o as j}from"./qualityParts-_Sify8OE.js";var M=e(a(),1),N=d(),P={server:{label:`The server answered differently`,hint:`A call returned another status: likely a product or backend change, not the test. File it as a defect if the first run was right.`},locator:{label:`An element was not found`,hint:`The page likely changed under the test. If the change was intended, heal the test; if not, it is a product bug.`},navigation:{label:`It reached another page`,hint:`A redirect, a sign-in, a feature flag or the environment's settings may differ between the runs.`},path:{label:`It took another path`,hint:`The run did something else here: the flow changed, or the agent found another way through it.`},data:{label:`Same step, another outcome`,hint:`The step was the same but ended otherwise: the test data, the account or what the page held likely differs.`},timing:{label:`Only the timing differs`,hint:`A slow environment, or a wait that races the page: a likely cause of flaky failures.`},errors:{label:`New browser errors`,hint:`The page raised errors in the second run that it did not in the first.`},missing:{label:`A step only one run did`,hint:`One run has a step the other does not: a dialog, a retry or a changed flow.`}},F=e=>`${(e/1e3).toFixed(1)}s`,I=e=>`${e.goal.slice(0,80)} · ${e.status} · ${O(e.at)}`;function L(e,t){let n=e.find(e=>e.id===t),r=e.filter(e=>e.id!==t);if(!n)return{same:[],other:r};let i=n.goal.trim().toLowerCase();return{same:r.filter(e=>e.goal.trim().toLowerCase()===i),other:r.filter(e=>e.goal.trim().toLowerCase()!==i)}}function R({run:e,step:t}){let[n,r]=(0,M.useState)(``),[i,a]=(0,M.useState)(!1);return(0,M.useEffect)(()=>{let n=!1;return r(``),a(!1),t?.shot&&h.shot(e,t.n,t.shot).then(e=>!n&&r(e),()=>!n&&a(!0)),()=>{n=!0}},[e,t?.n,t?.shot]),t?!t.shot||i?(0,N.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-6 text-center text-[13px] text-muted`,children:`No screenshot`}):n?(0,N.jsx)(`img`,{src:n,alt:`Step ${t.n} of ${e}`,className:`max-h-[420px] w-full rounded-[12px] border border-line-soft object-contain object-top`}):(0,N.jsx)(`div`,{className:`min-h-24 rounded-[12px] bg-surface-muted`}):(0,N.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-6 text-center text-[13px] text-muted`,children:`Not in this run`})}function z({step:e,other:t}){if(!e)return(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not in this run`});let n=e.ok?i:r,a=new Set((t?.calls??[]).map(e=>`${e.method} ${e.path} ${e.status}`)),o=t?e.calls.filter(e=>!a.has(`${e.method} ${e.path} ${e.status}`)):[];return(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[(0,N.jsx)(n,{size:14,"aria-label":e.ok?`Passed`:`Failed`,className:f(`mt-1 flex-none`,e.ok?`text-pass`:`text-fail`)}),(0,N.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:e.action||`–`})]}),(0,N.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,"data-tip":e.title?`${e.title} · ${e.page}`:e.page,children:[e.page,typeof e.ms==`number`?` · ${F(e.ms)}`:``]}),e.error&&(0,N.jsx)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error}),o.slice(0,3).map(e=>(0,N.jsxs)(`span`,{className:f(`truncate font-mono text-[13px]`,e.status>=400||e.failed?`text-fail`:`text-muted`),"data-tip":`${e.method} ${e.path}`,children:[e.method,` `,e.path,` `,e.failed?`no answer`:e.status]},`${e.method} ${e.path}`)),e.problems.slice(0,2).map(e=>(0,N.jsx)(`span`,{className:`truncate text-[13px] text-warn`,"data-tip":e,children:e},e))]})}function B({row:e,i:n,a:r,b:i,focus:a,open:o,onToggle:s}){let c=e.a?.n,l=e.b?.n;return(0,N.jsxs)(`li`,{id:a?`look-here`:void 0,className:f(`border-t border-line-soft`,!e.same&&`bg-warn-soft/40`,a&&`outline-2 -outline-offset-2 outline-warn`),children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] items-start gap-4 px-4 py-2 text-[13px]`,children:[(0,N.jsx)(`span`,{className:`pt-1 text-muted tabular-nums`,"data-tip":c!==void 0&&l!==void 0&&c!==l?`Step ${c} of the first run, ${l} of the second`:void 0,children:c!==void 0&&l!==void 0&&c!==l?`${c}·${l}`:c??l??n+1}),(0,N.jsx)(z,{step:e.a,other:e.b}),(0,N.jsx)(z,{step:e.b,other:e.a}),(0,N.jsx)(v,{variant:`icon`,size:`icon-sm`,"aria-label":o?`Hide screenshots`:`Show screenshots`,"aria-expanded":o,onClick:s,"data-tip":o?`Hide screenshots`:`Show screenshots`,children:(0,N.jsx)(t,{"aria-hidden":`true`,className:f(`transition-transform`,o&&`rotate-180`)})})]}),!e.same&&(0,N.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 pb-2 pl-[3.75rem] text-[13px] text-ink-2`,children:[a&&e.kind&&(0,N.jsxs)(`span`,{className:`font-medium text-warn`,children:[`Look here first: `,P[e.kind].label]}),e.differences.map(e=>(0,N.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},e))]}),(0,N.jsx)(w,{open:o,children:(0,N.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-4 px-4 pb-4 @2xl:grid-cols-2`,children:[(0,N.jsx)(R,{run:r,step:e.a}),(0,N.jsx)(R,{run:i,step:e.b})]})})]})}function V({runs:e,a:t,b:n}){let[r,i]=(0,M.useState)(t??``),[a,o]=(0,M.useState)(n??``);(0,M.useEffect)(()=>{i(t??``),o(n??``)},[t,n]);let{same:s,other:l}=L(e,r);return(0,N.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),r&&a&&r!==a&&(location.hash=u(`run-diff`,`${encodeURIComponent(r)}~${encodeURIComponent(a)}`))},children:[(0,N.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`First run (as expected)`,(0,N.jsxs)(g,{size:`sm`,value:r,onChange:e=>i(e.target.value),children:[(0,N.jsx)(`option`,{value:``,children:`Pick a run`}),e.map(e=>(0,N.jsx)(`option`,{value:e.id,children:I(e)},e.id))]})]}),(0,N.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`Second run`,(0,N.jsxs)(g,{size:`sm`,value:a,onChange:e=>o(e.target.value),disabled:!r,children:[(0,N.jsx)(`option`,{value:``,children:r?`Pick a run to compare`:`Pick the first run`}),s.length>0&&(0,N.jsx)(`optgroup`,{label:`Same test`,children:s.map(e=>(0,N.jsx)(`option`,{value:e.id,children:I(e)},e.id))}),(0,N.jsx)(`optgroup`,{label:s.length?`Other runs`:`Runs`,children:l.map(e=>(0,N.jsx)(`option`,{value:e.id,children:I(e)},e.id))})]})]}),(0,N.jsxs)(v,{size:`sm`,variant:`primary`,type:`submit`,disabled:!r||!a||r===a,children:[(0,N.jsx)(c,{"aria-hidden":`true`}),`Compare`]})]})}function H({sub:e}){let[t,r]=(0,M.useState)(null),[i,a]=(0,M.useState)(null),[c,d]=(0,M.useState)(``),[g,w]=(0,M.useState)(`all`),[O,I]=(0,M.useState)(new Set),[L,R]=(0,M.useState)(``),[z,H]=(0,M.useMemo)(()=>{let t=(e?l(e):``).split(`~`);return t.length===2&&t[0]&&t[1]?[t[0],t[1]]:[void 0,void 0]},[e]);(0,M.useEffect)(()=>{h.runs().then(e=>r(e.runs),e=>d(e.message))},[]),(0,M.useEffect)(()=>{let e=!1;if(a(null),R(``),z&&H)return h.diff(z,H).then(t=>{e||(a(t),d(``),I(new Set(t.focus===void 0?[]:[t.focus])))},t=>!e&&d(t.message)),()=>{e=!0}},[z,H]);let U=async()=>{if(i)try{let{id:e}=await p.start(`Compare the browser runs ${i.a.id} and ${i.b.id} in the reports folder, step by step (their steps.json, network.json and screenshots). Say where they first differ and whether that is a product bug, a test that needs healing, test data or the environment, and what to do next.`,{});location.hash=u(`chats`,e)}catch(e){R(e.message)}},W=i?.rows??[],G=W.map((e,t)=>({r:e,i:t})).filter(({r:e})=>g===`all`||!e.same),K=e=>e===void 0?void 0:W[e]?.b?.n??W[e]?.a?.n,q=K(i?.first),J=K(i?.focus);return(0,N.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,N.jsx)(E,{}),(0,N.jsxs)(`main`,{className:f(D,`@container flex-auto gap-4`),children:[(0,N.jsx)(x,{}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,N.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,N.jsx)(C,{pixel:S[`run-diff`],size:`lg`}),(0,N.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Run diff`})]}),(0,N.jsx)(T,{label:`Runs and reports`,links:k,current:`run-diff`})]}),(0,N.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:`Two browser runs side by side, step by step: a run that passed and one that failed, the same test on two environments or devices, or a test before and after it was healed. Steps are lined up by page and action, and the first one that differs is marked with what it likely means.`}),c&&(0,N.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c}),!t&&!c&&(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),t&&t.length<2&&(0,N.jsx)(b,{icon:n,title:`Two runs are needed`,action:(0,N.jsxs)(`a`,{className:_({size:`sm`}),href:u(`record`),"data-tip":`Record a flow`,children:[(0,N.jsx)(o,{"aria-hidden":`true`}),`Record`]}),children:`Every browser run keeps its steps in the reports folder. Run a flow from a chat or the Record page twice, or a test case on two environments, and compare them here.`}),t&&t.length>=2&&(0,N.jsx)(V,{runs:t,a:z,b:H}),z&&H&&!i&&!c&&(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Comparing…`}),i&&(0,N.jsxs)(`section`,{"aria-label":`Comparison`,className:`flex min-w-0 flex-col gap-4`,children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-3 @4xl:grid-cols-6 @4xl:divide-x @4xl:divide-line-soft`,children:[(0,N.jsx)(j,{label:`Verdict`,value:i.first===void 0?`Same`:`Differ`,tone:i.first===void 0?`text-pass`:`text-warn`,sub:i.first===void 0?`every step alike`:`from step ${q??`?`}`}),(0,N.jsx)(j,{label:`Steps differing`,value:i.counts.differing,tone:i.counts.differing?`text-warn`:void 0,sub:`of ${W.length} lined up`}),(0,N.jsx)(j,{label:`Steps`,value:`${i.a.steps} · ${i.b.steps}`,sub:`first · second`}),(0,N.jsx)(j,{label:`Time`,value:`${F(i.a.ms)} · ${F(i.b.ms)}`,sub:`first · second`}),(0,N.jsx)(j,{label:`Calls answered otherwise`,value:i.counts.calls,tone:i.counts.calls?`text-fail`:void 0,sub:`steps with a different status`}),(0,N.jsx)(j,{label:`New browser errors`,value:i.counts.errors,tone:i.counts.errors?`text-fail`:void 0,sub:`steps with new errors`})]}),(0,N.jsx)(`div`,{className:`grid grid-cols-1 gap-2 text-[13px] @2xl:grid-cols-2`,children:[i.a,i.b].map((e,t)=>(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:t?`Second run`:`First run`}),(0,N.jsx)(`span`,{className:`truncate font-medium`,"data-tip":e.goal,children:e.goal}),(0,N.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,"data-tip":e.startUrl??e.id,children:[e.status,` · `,A(e.at),` · `,e.host??e.id]})]},e.id))}),!i.sameGoal&&(0,N.jsx)(`p`,{className:`m-0 text-[13px] text-warn`,children:`These runs had different goals: they may not be the same test.`}),i.kind&&(0,N.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4 rounded-[12px] bg-warn-soft px-4 py-2 text-[13px]`,children:[(0,N.jsx)(n,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-warn`}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-1`,children:[(0,N.jsxs)(`span`,{className:`font-medium`,children:[`Look at step `,J??`?`,` of the second run: `,P[i.kind].label]}),(0,N.jsx)(`span`,{className:`text-ink-2`,children:P[i.kind].hint}),i.first!==i.focus&&i.first!==void 0&&W[i.first]?.kind&&(0,N.jsxs)(`span`,{className:`text-ink-2`,children:[`They first differ at step `,q,`: `,P[W[i.first].kind].label.toLowerCase(),`.`]})]}),(0,N.jsx)(`a`,{href:`#look-here`,onClick:e=>(e.preventDefault(),document.getElementById(`look-here`)?.scrollIntoView({behavior:m(),block:`center`})),className:`self-center text-[13px]`,children:`Go to it`})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,N.jsx)(y,{items:[{id:`all`,label:`All steps`,n:W.length},{id:`diff`,label:`Only differences`,n:i.counts.differing,alert:!0}],value:g,onChange:w})}),(0,N.jsxs)(v,{size:`sm`,variant:`ghost`,"data-tip":`Ask in a chat`,onClick:()=>void U(),className:`ml-auto`,children:[(0,N.jsx)(s,{"aria-hidden":`true`}),`Chat`]})]}),L&&(0,N.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:L}),(0,N.jsxs)(`div`,{className:`overflow-hidden rounded-[10px] border border-line`,children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] gap-4 bg-surface-muted px-4 py-2 text-[13px] text-muted`,children:[(0,N.jsx)(`span`,{children:`Step`}),(0,N.jsx)(`span`,{children:`First run`}),(0,N.jsx)(`span`,{children:`Second run`}),(0,N.jsx)(`span`,{className:`sr-only`,children:`Screenshots`})]}),G.length?(0,N.jsx)(`ol`,{className:`m-0 list-none p-0`,children:G.map(({r:e,i:t})=>(0,N.jsx)(B,{row:e,i:t,a:i.a.id,b:i.b.id,focus:t===i.focus,open:O.has(t),onToggle:()=>{let e=new Set(O);e.has(t)?e.delete(t):e.add(t),I(e)}},t))}):(0,N.jsx)(`p`,{className:`m-0 border-t border-line-soft px-4 py-4 text-[13px] text-muted`,children:`Nothing differs.`})]})]})]})]})}export{P as KIND_TEXT,H as RunDiff,L as choicesFor};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{A as t,Er as n,H as r,I as i,Kr as a,R as o,_n as s,_t as c,n as l,r as u}from"./route-D8G-pTdk.js";import{t as d}from"./jsx-runtime-LKYXHABd.js";import{A as f,Z as p,a as m,kt as h,n as g}from"./input-FbzQKk3L.js";import{D as _,E as v,i as y,l as b,n as x}from"./pageBack-B6bY6ZUl.js";import{L as S}from"./palette-C5Ok5Zd1.js";import{Ht as C,Pt as w,_t as T,s as E,t as D}from"./frame-DNgVKrlp.js";import{t as O}from"./when-BuWCTaKm.js";import{I as k}from"./index-BBJ_SKdO.js";import{_ as A,o as j}from"./qualityParts-kh6SukEP.js";var M=e(a(),1),N=d(),P={server:{label:`The server answered differently`,hint:`A call returned another status: likely a product or backend change, not the test. File it as a defect if the first run was right.`},locator:{label:`An element was not found`,hint:`The page likely changed under the test. If the change was intended, heal the test; if not, it is a product bug.`},navigation:{label:`It reached another page`,hint:`A redirect, a sign-in, a feature flag or the environment's settings may differ between the runs.`},path:{label:`It took another path`,hint:`The run did something else here: the flow changed, or the agent found another way through it.`},data:{label:`Same step, another outcome`,hint:`The step was the same but ended otherwise: the test data, the account or what the page held likely differs.`},timing:{label:`Only the timing differs`,hint:`A slow environment, or a wait that races the page: a likely cause of flaky failures.`},errors:{label:`New browser errors`,hint:`The page raised errors in the second run that it did not in the first.`},missing:{label:`A step only one run did`,hint:`One run has a step the other does not: a dialog, a retry or a changed flow.`}},F=e=>`${(e/1e3).toFixed(1)}s`,I=e=>`${e.goal.slice(0,80)} · ${e.status} · ${O(e.at)}`;function L(e,t){let n=e.find(e=>e.id===t),r=e.filter(e=>e.id!==t);if(!n)return{same:[],other:r};let i=n.goal.trim().toLowerCase();return{same:r.filter(e=>e.goal.trim().toLowerCase()===i),other:r.filter(e=>e.goal.trim().toLowerCase()!==i)}}function R({run:e,step:t}){let[n,r]=(0,M.useState)(``),[i,a]=(0,M.useState)(!1);return(0,M.useEffect)(()=>{let n=!1;return r(``),a(!1),t?.shot&&h.shot(e,t.n,t.shot).then(e=>!n&&r(e),()=>!n&&a(!0)),()=>{n=!0}},[e,t?.n,t?.shot]),t?!t.shot||i?(0,N.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-6 text-center text-[13px] text-muted`,children:`No screenshot`}):n?(0,N.jsx)(`img`,{src:n,alt:`Step ${t.n} of ${e}`,className:`max-h-[420px] w-full rounded-[12px] border border-line-soft object-contain object-top`}):(0,N.jsx)(`div`,{className:`min-h-24 rounded-[12px] bg-surface-muted`}):(0,N.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-6 text-center text-[13px] text-muted`,children:`Not in this run`})}function z({step:e,other:t}){if(!e)return(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not in this run`});let n=e.ok?i:r,a=new Set((t?.calls??[]).map(e=>`${e.method} ${e.path} ${e.status}`)),o=t?e.calls.filter(e=>!a.has(`${e.method} ${e.path} ${e.status}`)):[];return(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[(0,N.jsx)(n,{size:14,"aria-label":e.ok?`Passed`:`Failed`,className:f(`mt-1 flex-none`,e.ok?`text-pass`:`text-fail`)}),(0,N.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:e.action||`–`})]}),(0,N.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,"data-tip":e.title?`${e.title} · ${e.page}`:e.page,children:[e.page,typeof e.ms==`number`?` · ${F(e.ms)}`:``]}),e.error&&(0,N.jsx)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error}),o.slice(0,3).map(e=>(0,N.jsxs)(`span`,{className:f(`truncate font-mono text-[13px]`,e.status>=400||e.failed?`text-fail`:`text-muted`),"data-tip":`${e.method} ${e.path}`,children:[e.method,` `,e.path,` `,e.failed?`no answer`:e.status]},`${e.method} ${e.path}`)),e.problems.slice(0,2).map(e=>(0,N.jsx)(`span`,{className:`truncate text-[13px] text-warn`,"data-tip":e,children:e},e))]})}function B({row:e,i:n,a:r,b:i,focus:a,open:o,onToggle:s}){let c=e.a?.n,l=e.b?.n;return(0,N.jsxs)(`li`,{id:a?`look-here`:void 0,className:f(`border-t border-line-soft`,!e.same&&`bg-warn-soft/40`,a&&`outline-2 -outline-offset-2 outline-warn`),children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] items-start gap-4 px-4 py-2 text-[13px]`,children:[(0,N.jsx)(`span`,{className:`pt-1 text-muted tabular-nums`,"data-tip":c!==void 0&&l!==void 0&&c!==l?`Step ${c} of the first run, ${l} of the second`:void 0,children:c!==void 0&&l!==void 0&&c!==l?`${c}·${l}`:c??l??n+1}),(0,N.jsx)(z,{step:e.a,other:e.b}),(0,N.jsx)(z,{step:e.b,other:e.a}),(0,N.jsx)(v,{variant:`icon`,size:`icon-sm`,"aria-label":o?`Hide screenshots`:`Show screenshots`,"aria-expanded":o,onClick:s,"data-tip":o?`Hide screenshots`:`Show screenshots`,children:(0,N.jsx)(t,{"aria-hidden":`true`,className:f(`transition-transform`,o&&`rotate-180`)})})]}),!e.same&&(0,N.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 pb-2 pl-[3.75rem] text-[13px] text-ink-2`,children:[a&&e.kind&&(0,N.jsxs)(`span`,{className:`font-medium text-warn`,children:[`Look here first: `,P[e.kind].label]}),e.differences.map(e=>(0,N.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},e))]}),(0,N.jsx)(C,{open:o,children:(0,N.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-4 px-4 pb-4 @2xl:grid-cols-2`,children:[(0,N.jsx)(R,{run:r,step:e.a}),(0,N.jsx)(R,{run:i,step:e.b})]})})]})}function V({runs:e,a:t,b:n}){let[r,i]=(0,M.useState)(t??``),[a,o]=(0,M.useState)(n??``);(0,M.useEffect)(()=>{i(t??``),o(n??``)},[t,n]);let{same:s,other:l}=L(e,r);return(0,N.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),r&&a&&r!==a&&(location.hash=u(`run-diff`,`${encodeURIComponent(r)}~${encodeURIComponent(a)}`))},children:[(0,N.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`First run (as expected)`,(0,N.jsxs)(g,{size:`sm`,value:r,onChange:e=>i(e.target.value),children:[(0,N.jsx)(`option`,{value:``,children:`Pick a run`}),e.map(e=>(0,N.jsx)(`option`,{value:e.id,children:I(e)},e.id))]})]}),(0,N.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`Second run`,(0,N.jsxs)(g,{size:`sm`,value:a,onChange:e=>o(e.target.value),disabled:!r,children:[(0,N.jsx)(`option`,{value:``,children:r?`Pick a run to compare`:`Pick the first run`}),s.length>0&&(0,N.jsx)(`optgroup`,{label:`Same test`,children:s.map(e=>(0,N.jsx)(`option`,{value:e.id,children:I(e)},e.id))}),(0,N.jsx)(`optgroup`,{label:s.length?`Other runs`:`Runs`,children:l.map(e=>(0,N.jsx)(`option`,{value:e.id,children:I(e)},e.id))})]})]}),(0,N.jsxs)(v,{size:`sm`,variant:`primary`,type:`submit`,disabled:!r||!a||r===a,children:[(0,N.jsx)(c,{"aria-hidden":`true`}),`Compare`]})]})}function H({sub:e}){let[t,r]=(0,M.useState)(null),[i,a]=(0,M.useState)(null),[c,d]=(0,M.useState)(``),[g,C]=(0,M.useState)(`all`),[O,I]=(0,M.useState)(new Set),[L,R]=(0,M.useState)(``),[z,H]=(0,M.useMemo)(()=>{let t=(e?l(e):``).split(`~`);return t.length===2&&t[0]&&t[1]?[t[0],t[1]]:[void 0,void 0]},[e]);(0,M.useEffect)(()=>{h.runs().then(e=>r(e.runs),e=>d(e.message))},[]),(0,M.useEffect)(()=>{let e=!1;if(a(null),R(``),z&&H)return h.diff(z,H).then(t=>{e||(a(t),d(``),I(new Set(t.focus===void 0?[]:[t.focus])))},t=>!e&&d(t.message)),()=>{e=!0}},[z,H]);let U=async()=>{if(i)try{let{id:e}=await p.start(`Compare the browser runs ${i.a.id} and ${i.b.id} in the reports folder, step by step (their steps.json, network.json and screenshots). Say where they first differ and whether that is a product bug, a test that needs healing, test data or the environment, and what to do next.`,{});location.hash=u(`chats`,e)}catch(e){R(e.message)}},W=i?.rows??[],G=W.map((e,t)=>({r:e,i:t})).filter(({r:e})=>g===`all`||!e.same),K=e=>e===void 0?void 0:W[e]?.b?.n??W[e]?.a?.n,q=K(i?.first),J=K(i?.focus);return(0,N.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,N.jsx)(E,{}),(0,N.jsxs)(`main`,{className:f(D,`@container flex-auto gap-4`),children:[(0,N.jsx)(x,{}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,N.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,N.jsx)(w,{pixel:S[`run-diff`],size:`lg`}),(0,N.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Run diff`})]}),(0,N.jsx)(T,{label:`Runs and reports`,links:k,current:`run-diff`})]}),(0,N.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:`Two browser runs side by side, step by step: a run that passed and one that failed, the same test on two environments or devices, or a test before and after it was healed. Steps are lined up by page and action, and the first one that differs is marked with what it likely means.`}),c&&(0,N.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c}),!t&&!c&&(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),t&&t.length<2&&(0,N.jsx)(b,{icon:n,title:`Two runs are needed`,action:(0,N.jsxs)(`a`,{className:_({size:`sm`}),href:u(`record`),"data-tip":`Record a flow`,children:[(0,N.jsx)(o,{"aria-hidden":`true`}),`Record`]}),children:`Every browser run keeps its steps in the reports folder. Run a flow from a chat or the Record page twice, or a test case on two environments, and compare them here.`}),t&&t.length>=2&&(0,N.jsx)(V,{runs:t,a:z,b:H}),z&&H&&!i&&!c&&(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Comparing…`}),i&&(0,N.jsxs)(`section`,{"aria-label":`Comparison`,className:`flex min-w-0 flex-col gap-4`,children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-3 @4xl:grid-cols-6 @4xl:divide-x @4xl:divide-line-soft`,children:[(0,N.jsx)(j,{label:`Verdict`,value:i.first===void 0?`Same`:`Differ`,tone:i.first===void 0?`text-pass`:`text-warn`,sub:i.first===void 0?`every step alike`:`from step ${q??`?`}`}),(0,N.jsx)(j,{label:`Steps differing`,value:i.counts.differing,tone:i.counts.differing?`text-warn`:void 0,sub:`of ${W.length} lined up`}),(0,N.jsx)(j,{label:`Steps`,value:`${i.a.steps} · ${i.b.steps}`,sub:`first · second`}),(0,N.jsx)(j,{label:`Time`,value:`${F(i.a.ms)} · ${F(i.b.ms)}`,sub:`first · second`}),(0,N.jsx)(j,{label:`Calls answered otherwise`,value:i.counts.calls,tone:i.counts.calls?`text-fail`:void 0,sub:`steps with a different status`}),(0,N.jsx)(j,{label:`New browser errors`,value:i.counts.errors,tone:i.counts.errors?`text-fail`:void 0,sub:`steps with new errors`})]}),(0,N.jsx)(`div`,{className:`grid grid-cols-1 gap-2 text-[13px] @2xl:grid-cols-2`,children:[i.a,i.b].map((e,t)=>(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:t?`Second run`:`First run`}),(0,N.jsx)(`span`,{className:`truncate font-medium`,"data-tip":e.goal,children:e.goal}),(0,N.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,"data-tip":e.startUrl??e.id,children:[e.status,` · `,A(e.at),` · `,e.host??e.id]})]},e.id))}),!i.sameGoal&&(0,N.jsx)(`p`,{className:`m-0 text-[13px] text-warn`,children:`These runs had different goals: they may not be the same test.`}),i.kind&&(0,N.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4 rounded-[12px] bg-warn-soft px-4 py-2 text-[13px]`,children:[(0,N.jsx)(n,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-warn`}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-1`,children:[(0,N.jsxs)(`span`,{className:`font-medium`,children:[`Look at step `,J??`?`,` of the second run: `,P[i.kind].label]}),(0,N.jsx)(`span`,{className:`text-ink-2`,children:P[i.kind].hint}),i.first!==i.focus&&i.first!==void 0&&W[i.first]?.kind&&(0,N.jsxs)(`span`,{className:`text-ink-2`,children:[`They first differ at step `,q,`: `,P[W[i.first].kind].label.toLowerCase(),`.`]})]}),(0,N.jsx)(`a`,{href:`#look-here`,onClick:e=>(e.preventDefault(),document.getElementById(`look-here`)?.scrollIntoView({behavior:m(),block:`center`})),className:`self-center text-[13px]`,children:`Go to it`})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,N.jsx)(y,{items:[{id:`all`,label:`All steps`,n:W.length},{id:`diff`,label:`Only differences`,n:i.counts.differing,alert:!0}],value:g,onChange:C})}),(0,N.jsxs)(v,{size:`sm`,variant:`ghost`,"data-tip":`Ask in a chat`,onClick:()=>void U(),className:`ml-auto`,children:[(0,N.jsx)(s,{"aria-hidden":`true`}),`Chat`]})]}),L&&(0,N.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:L}),(0,N.jsxs)(`div`,{className:`overflow-hidden rounded-[10px] border border-line`,children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] gap-4 bg-surface-muted px-4 py-2 text-[13px] text-muted`,children:[(0,N.jsx)(`span`,{children:`Step`}),(0,N.jsx)(`span`,{children:`First run`}),(0,N.jsx)(`span`,{children:`Second run`}),(0,N.jsx)(`span`,{className:`sr-only`,children:`Screenshots`})]}),G.length?(0,N.jsx)(`ol`,{className:`m-0 list-none p-0`,children:G.map(({r:e,i:t})=>(0,N.jsx)(B,{row:e,i:t,a:i.a.id,b:i.b.id,focus:t===i.focus,open:O.has(t),onToggle:()=>{let e=new Set(O);e.has(t)?e.delete(t):e.add(t),I(e)}},t))}):(0,N.jsx)(`p`,{className:`m-0 border-t border-line-soft px-4 py-4 text-[13px] text-muted`,children:`Nothing differs.`})]})]})]})]})}export{P as KIND_TEXT,H as RunDiff,L as choicesFor};