@capagents/forgeqe 3.2.7 → 3.2.8

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 (96) hide show
  1. package/dist/forgeqe.js +2 -2
  2. package/dist/web/assets/{3d-force-graph-CUGt_TSW.js → 3d-force-graph-CbGbqGhp.js} +1 -1
  3. package/dist/web/assets/Agent-g57O0gf2.js +8 -0
  4. package/dist/web/assets/{AgentWork-BpfMY_xu.js → AgentWork-DEZxLOeM.js} +1 -1
  5. package/dist/web/assets/ApiTests-DhxqD5GK.js +15 -0
  6. package/dist/web/assets/Browse-DfvSk_5f.js +1 -0
  7. package/dist/web/assets/Chat-CuuX_MnF.js +3 -0
  8. package/dist/web/assets/{CommandPalette-CKJHtRjo.js → CommandPalette-DLXhO1e4.js} +1 -1
  9. package/dist/web/assets/{Compare-DtW2g-qb.js → Compare-DFRzCXyA.js} +1 -1
  10. package/dist/web/assets/{Cost-DW-kVEL8.js → Cost-CZ1xMPze.js} +1 -1
  11. package/dist/web/assets/Data-jxeBry5m.js +6 -0
  12. package/dist/web/assets/Desktop-4S45Nhc5.js +1 -0
  13. package/dist/web/assets/DesktopReview-CUyNT0Hl.js +2 -0
  14. package/dist/web/assets/{DeviceScreen-DzVNfMwl.js → DeviceScreen-DlJqIxZ-.js} +1 -1
  15. package/dist/web/assets/Evidence-BP-fY7HX.js +1 -0
  16. package/dist/web/assets/{Explore-ChpAuezG.js → Explore-DY5e98Jz.js} +2 -2
  17. package/dist/web/assets/Features-CKpQ7ilm.js +1 -0
  18. package/dist/web/assets/{Flags-Do-pvmCF.js → Flags-CLm40jFw.js} +2 -2
  19. package/dist/web/assets/Flaky-CQx5RPZt.js +1 -0
  20. package/dist/web/assets/Impact-DsvECtFV.js +3 -0
  21. package/dist/web/assets/Jobs-Dzgeugby.js +5 -0
  22. package/dist/web/assets/KindPage-Dy8mhe14.js +6 -0
  23. package/dist/web/assets/{LiveDevice-OyxEiqBt.js → LiveDevice-DGXIulGh.js} +1 -1
  24. package/dist/web/assets/Migration-ecdFw6JR.js +8 -0
  25. package/dist/web/assets/Mobile-89JRhyfb.js +1 -0
  26. package/dist/web/assets/{Observability-DdTOLp2C.js → Observability-BTxPNYcK.js} +1 -1
  27. package/dist/web/assets/PageAgent-CtHfmMj1.js +1 -0
  28. package/dist/web/assets/Product-DutzjAnI.js +12 -0
  29. package/dist/web/assets/{Production-oTXhv40a.js → Production-DVc4vly0.js} +1 -1
  30. package/dist/web/assets/Quality-DDRPOOgr.js +1 -0
  31. package/dist/web/assets/{Readiness-Bv9uTTiI.js → Readiness-BRtsOnY7.js} +1 -1
  32. package/dist/web/assets/Record-BgX9IgVU.js +1 -0
  33. package/dist/web/assets/Regression-B5TZmljh.js +5 -0
  34. package/dist/web/assets/{RelationGraph-BQl3M4zd.js → RelationGraph-Bf7JxnoO.js} +1 -1
  35. package/dist/web/assets/Reports-Ckul-6_Z.js +2 -0
  36. package/dist/web/assets/Responsive-BuFvnY-7.js +3 -0
  37. package/dist/web/assets/{RunDiff-BBT1sQLh.js → RunDiff-lbzcjQPB.js} +1 -1
  38. package/dist/web/assets/Settings-DICPHvyS.js +21 -0
  39. package/dist/web/assets/{Steps-C_vL6-8p.js → Steps-Bgta9n5a.js} +3 -3
  40. package/dist/web/assets/TestData-DhzYxkRb.js +2 -0
  41. package/dist/web/assets/TestManagement-DOTikKBJ.js +4 -0
  42. package/dist/web/assets/{WhatsNew-DTcaqdOJ.js → WhatsNew-BNpscacD.js} +1 -1
  43. package/dist/web/assets/{agentSettingsSheet-DM1aa237.js → agentSettingsSheet-CE2-cOUE.js} +1 -1
  44. package/dist/web/assets/{choice-B6z9CWyZ.js → choice-DPE-97iI.js} +1 -1
  45. package/dist/web/assets/{coverage-BhtF065n.js → coverage-8y4Ntf5j.js} +4 -4
  46. package/dist/web/assets/{dataParts-BNDVxwFb.js → dataParts-BWLBAktB.js} +3 -3
  47. package/dist/web/assets/desktopAppPath-CNgKUGx-.js +1 -0
  48. package/dist/web/assets/frame-CILGAQMi.js +13 -0
  49. package/dist/web/assets/index-CAiu49as.css +2 -0
  50. package/dist/web/assets/index-jQktxp_0.js +56 -0
  51. package/dist/web/assets/{markdown-BhU7ng6c.js → markdown-C3_rYFsI.js} +4 -4
  52. package/dist/web/assets/pageBack-CpPsn9m9.js +3 -0
  53. package/dist/web/assets/{palette-BsY8OLxd.js → palette-B4gvOIk7.js} +1 -1
  54. package/dist/web/assets/{paletteCommands-DflHQ05x.js → paletteCommands-Df6J2Ddx.js} +1 -1
  55. package/dist/web/assets/parts-CoaptHZw.js +1 -0
  56. package/dist/web/assets/{preload-helper-qorOEK5q.js → preload-helper-Bjdk4wEa.js} +1 -1
  57. package/dist/web/assets/{productParts-Dxl-TQKY.js → productParts-yX7pkb5g.js} +1 -1
  58. package/dist/web/assets/{qualityParts-ClGKtjEv.js → qualityParts-DfUjhv4u.js} +1 -1
  59. package/dist/web/assets/{radio-DDxnnflQ.js → radio-BerZ8bce.js} +1 -1
  60. package/dist/web/assets/{recordTest-B33rIncn.js → recordTest-CYjGtHjQ.js} +1 -1
  61. package/dist/web/assets/{route-D9uPlFWw.js → route-M6BKgobp.js} +1 -1
  62. package/dist/web/assets/{sectionList-e5mFDaS2.js → sectionList-K06uJ9W7.js} +1 -1
  63. package/dist/web/assets/{stepper-DSDz0uu8.js → stepper-yRhSVs0I.js} +1 -1
  64. package/dist/web/index.html +9 -9
  65. package/package.json +1 -1
  66. package/dist/web/assets/Agent-DiX8ljlC.js +0 -8
  67. package/dist/web/assets/ApiTests-4jfzlfVd.js +0 -15
  68. package/dist/web/assets/Browse-ByDemInL.js +0 -1
  69. package/dist/web/assets/Chat-C3wKV0CI.js +0 -3
  70. package/dist/web/assets/Data--HGneNun.js +0 -6
  71. package/dist/web/assets/Desktop-DQf5gv7D.js +0 -1
  72. package/dist/web/assets/DesktopReview-BaPYt0kl.js +0 -2
  73. package/dist/web/assets/Evidence-CxRMnZch.js +0 -1
  74. package/dist/web/assets/Features-VsLb8QTH.js +0 -1
  75. package/dist/web/assets/Flaky-CyhTszAg.js +0 -1
  76. package/dist/web/assets/Impact-BWBAXRuw.js +0 -3
  77. package/dist/web/assets/Jobs-C_MjXv0_.js +0 -5
  78. package/dist/web/assets/KindPage-Bb3Kp4-q.js +0 -6
  79. package/dist/web/assets/Migration-C80mGA3h.js +0 -8
  80. package/dist/web/assets/Mobile-C4wVBYfr.js +0 -1
  81. package/dist/web/assets/PageAgent-Bi53-H99.js +0 -1
  82. package/dist/web/assets/Product-0LXndvp-.js +0 -12
  83. package/dist/web/assets/Quality-CY0CJF9e.js +0 -1
  84. package/dist/web/assets/Record-C-kyOkYq.js +0 -1
  85. package/dist/web/assets/Regression-CwKxvG1h.js +0 -5
  86. package/dist/web/assets/Reports-Ck8rc3br.js +0 -2
  87. package/dist/web/assets/Responsive-COmV2NXo.js +0 -3
  88. package/dist/web/assets/Settings-7aMk9Sqx.js +0 -21
  89. package/dist/web/assets/TestData-KzMy9N9f.js +0 -2
  90. package/dist/web/assets/TestManagement-BCEhOGB9.js +0 -4
  91. package/dist/web/assets/desktopAppPath-D4hHP56R.js +0 -1
  92. package/dist/web/assets/frame-CNYHTG4T.js +0 -13
  93. package/dist/web/assets/index-B1Q2Dlqw.js +0 -56
  94. package/dist/web/assets/index-sxUpjgyw.css +0 -2
  95. package/dist/web/assets/pageBack-BoSbGSU6.js +0 -3
  96. package/dist/web/assets/parts-C4QMgN_N.js +0 -1
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{A as t,Et as n,M as r,O as i,Un as a,Ur as o,dt as s,it as c,lr as l,qn as u,qr as d,r as f,st as p,vn as m,wr as h,zn as g}from"./route-D9uPlFWw.js";import{D as _,E as v,Ht as y,Vt as b,Z as x,q as S}from"./preload-helper-qorOEK5q.js";import{t as C}from"./jsx-runtime-LKYXHABd.js";import{L as w}from"./palette-BsY8OLxd.js";import{F as T,N as E,O as D,P as O,c as k,i as A,l as j,n as M}from"./pageBack-BoSbGSU6.js";import{Ct as N,It as P,bt as F,gt as I,ht as ee,s as te,t as ne,ut as re,vt as L,xt as R,yt as z}from"./frame-CNYHTG4T.js";import{t as B}from"./when-BuWCTaKm.js";import{W as V}from"./index-B1Q2Dlqw.js";import{a as H,c as U,d as W,i as ie,l as G,m as ae,n as K,o as oe,s as q,t as se}from"./dataParts-BNDVxwFb.js";var J=e(d(),1),Y=C(),X=[`requests`,`kept`,`specs`,`batches`],ce={requests:g,kept:u,specs:n,batches:l},Z={fetch:`kept`,request:`requests`,gen:`specs`,files:`specs`,insert:`specs`,batches:`batches`,clean:`batches`},Q=e=>Object.values(e.row_counts||{}).reduce((e,t)=>e+t,0);function le({e,kept:t,busy:n,act:r}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 px-1 py-2`,children:[(0,Y.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-body-sm`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:`Asked for`}),(0,Y.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:e.need}),(0,Y.jsx)(`dt`,{className:`text-muted`,children:`When`}),(0,Y.jsxs)(`dd`,{className:`m-0`,children:[new Date(e.at).toLocaleString(),e.ms===void 0?``:` · answered in ${(e.ms/1e3).toFixed(1)} s`]}),(0,Y.jsx)(`dt`,{className:`text-muted`,children:`How`}),(0,Y.jsxs)(`dd`,{className:`m-0`,children:[e.source===`fetch`?`A kept request fetched again, with no model`:`Asked Miner for ${e.asked===`existing`?`existing rows`:e.asked===`new`?`new rows`:`either`}`,e.name?(0,Y.jsxs)(Y.Fragment,{children:[` · `,(0,Y.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.name})]}):null]}),e.why&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:`The answer`}),(0,Y.jsx)(`dd`,{className:`m-0`,children:e.why})]})]}),e.error&&(0,Y.jsx)(G,{text:e.error}),Object.entries(e.sample||{}).map(([t,n])=>(0,Y.jsx)(W,{title:t===`result`?`Rows found`:t,rows:n,total:e.row_counts?.[t]??n.length},t)),e.sql&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm font-medium`,children:`The query`}),(0,Y.jsx)(K,{label:`SQL`,children:e.sql})]}),e.script_preview?.length?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm font-medium`,children:`INSERT script`}),(0,Y.jsx)(K,{label:`INSERT script`,children:e.script_preview.join(`
2
- `)})]}):null,t&&e.name&&(0,Y.jsx)(`div`,{children:(0,Y.jsxs)(E,{size:`sm`,disabled:n,onClick:()=>r(`fetch`,{name:e.name}),"data-tip":`Fetch again`,children:[(0,Y.jsx)(a,{"aria-hidden":`true`}),`Refresh`]})})]})}function $({view:e,log:i,busy:a,act:o}){let[s,c]=(0,J.useState)(`all`),[l,u]=(0,J.useState)(``),[d,p]=(0,J.useState)(``),[h,g]=(0,J.useState)(``),v=i??[],y=(0,J.useMemo)(()=>[...new Set(v.map(e=>e.requester))].sort(),[i]),x=(0,J.useMemo)(()=>[...new Set(v.map(e=>e.database).filter(Boolean))].sort(),[i]),S=v.filter(e=>!e.ok).length,C=v.filter(e=>(s===`all`||s===`ok`===e.ok)&&(!l||e.requester===l)&&(!d||e.database===d)),w=new Set(e.requests.map(e=>e.name));return i===null?(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading the requests…`}):v.length?(0,Y.jsx)(ee,{label:`Requests`,resetKey:`${s}|${l}|${d}`,minWidth:760,fixed:!0,height:I,placeholder:`Find a request`,tools:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(A,{value:s,onChange:c,items:[{id:`all`,label:`All`,n:v.length},{id:`ok`,label:`Answered`,n:v.length-S},{id:`failed`,label:`Failed`,n:S,alert:!0}]}),y.length>1&&(0,Y.jsxs)(_,{size:`sm`,"aria-label":`Who asked`,value:l,onChange:e=>u(e.target.value),className:`w-[180px]`,children:[(0,Y.jsx)(`option`,{value:``,children:`Anyone`}),y.map(e=>(0,Y.jsx)(`option`,{children:e},e))]}),x.length>1&&(0,Y.jsxs)(_,{size:`sm`,"aria-label":`Database`,value:d,onChange:e=>p(e.target.value),className:`w-[160px]`,children:[(0,Y.jsx)(`option`,{value:``,children:`Any database`}),x.map(e=>(0,Y.jsx)(`option`,{children:e},e))]})]}),head:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`th`,{scope:`col`,className:b(F,`w-9`),children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Open`})}),(0,Y.jsx)(`th`,{scope:`col`,className:b(F,`w-[110px]`),children:`When`}),(0,Y.jsx)(`th`,{scope:`col`,className:b(F,`w-[150px]`),children:`Who asked`}),(0,Y.jsx)(`th`,{scope:`col`,className:F,children:`What for`}),(0,Y.jsx)(`th`,{scope:`col`,className:b(F,`w-[110px]`),children:`Database`}),(0,Y.jsx)(`th`,{scope:`col`,className:b(F,`w-[140px]`),children:`Answer`}),(0,Y.jsx)(`th`,{scope:`col`,className:b(R,`w-[70px]`),children:`Rows`})]}),empty:`No requests match these filters. Pick All and Anyone to see every request.`,children:C.map(e=>{let n=h===e.id;return(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsxs)(`tr`,{className:b(N,n&&`bg-surface-muted`),onClick:()=>g(n?``:e.id),children:[(0,Y.jsx)(`td`,{className:b(L,`pr-0`),children:(0,Y.jsx)(E,{variant:`icon`,size:`icon-xs`,"aria-expanded":n,"aria-label":n?`Close the request`:`Open the request`,onClick:t=>(t.stopPropagation(),g(n?``:e.id)),children:n?(0,Y.jsx)(t,{"aria-hidden":`true`}):(0,Y.jsx)(r,{"aria-hidden":`true`})})}),(0,Y.jsx)(`td`,{className:b(L,`whitespace-nowrap text-muted`),"data-tip":new Date(e.at).toLocaleString(),"data-sort":new Date(e.at).getTime()||0,children:B(e.at)}),(0,Y.jsx)(`td`,{className:b(L,`truncate`),"data-tip":e.requester,children:e.requester}),(0,Y.jsxs)(`td`,{className:b(L,`truncate`),"data-tip":e.need,children:[e.need,e.source===`fetch`?(0,Y.jsx)(`span`,{className:`text-muted`,children:` · fetched again`}):null]}),(0,Y.jsx)(`td`,{className:b(L,`truncate`),"data-tip":e.database,children:e.database||(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:b(L,`whitespace-nowrap`),children:(0,Y.jsx)(k,{tone:e.ok?`pass`:`fail`,children:e.ok?q[e.kind||``]||`Answered`:`Failed`})}),(0,Y.jsx)(`td`,{className:z,"data-sort":e.ok?Q(e):-1,children:e.ok?Q(e):``})]}),n&&(0,Y.jsx)(`tr`,{className:`border-t border-line-soft bg-surface-muted/40`,children:(0,Y.jsx)(`td`,{colSpan:7,className:b(`px-4 py-2`,`max-w-0`),children:(0,Y.jsx)(le,{e,kept:!!e.name&&w.has(e.name),busy:a,act:o})})})]},e.id)})}):(0,Y.jsx)(j,{icon:n,title:`No test data asked for yet`,action:(0,Y.jsxs)(`a`,{href:f(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:b(O({size:`sm`}),`no-underline`),children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),`Ask`]}),children:`The agents ask before a test runs, or you can ask yourself.`})}function ue({view:e,job:t,busy:n,act:r,onNote:i}){let o=t&&!t.running&&t.kind===`fetch`?t:null,s=o?.result;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:`Each request is kept in test-data/requests with its query or INSERT script. Fetch one again to get the same data with no model: a query reads the rows there now, a spec makes the same rows.`}),o&&(0,Y.jsxs)(V,{level:3,icon:a,title:o.target,className:`rounded-lg bg-bg p-6 shadow-sm`,children:[s&&!s.ok&&(0,Y.jsx)(G,{text:s.error||`It could not fetch the data.`}),s?.ok&&(0,Y.jsx)(se,{r:s,onNote:i})]}),e.requests.length===0?(0,Y.jsxs)(j,{className:`py-4`,children:[`No kept requests yet. Each request Miner answers is kept here; `,(0,Y.jsx)(`a`,{href:f(`data`,`ask`,`test-data`),children:`ask for test data`}),` to make the first.`]}):(0,Y.jsx)(U,{items:e.requests,text:e=>`${e.need} ${e.name} ${e.database} ${e.requester||``}`,label:`Kept requests`,size:15,children:e=>(0,Y.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-4 border-t border-line-soft py-2 text-body-sm first:border-t-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:e.need}),(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` · `,e.database,` · `,q[e.kind],e.rows?` · ${y(e.rows,`row`)}`:``,e.created?` · ${B(e.created)}`:``,e.requester?` · asked by ${e.requester}`:``]})]}),(0,Y.jsx)(E,{size:`icon`,variant:`icon`,disabled:n,onClick:()=>r(`fetch`,{name:e.name}),"aria-label":`Fetch ${e.name} again`,"data-tip":`Fetch ${e.name} again`,className:`size-8`,children:(0,Y.jsx)(a,{"aria-hidden":`true`})})]},e.name)})]})}function de({view:e,job:t,busy:r,act:i,onNote:a}){let[l,u]=(0,J.useState)(e.specs[0]??``),[d,h]=(0,J.useState)(``),[g,y]=(0,J.useState)(``),[x,C]=(0,J.useState)(`csv`),[w,O]=(0,J.useState)(!1),k={spec:l,...d?{db:d}:{},...g?{seed:g}:{}},A=t&&!t.running?t:null,M=A&&[`gen`,`files`,`insert`].includes(A.kind)&&A.target===l?A.result:void 0,N=e.databases.find(e=>e.name===d),P=async()=>{try{let{id:e}=await S.start(`Write a test data spec for this project (a YAML file with tables: under test-data/), from the database's schema. Show me the spec and a preview before you save it.`,{});location.hash=f(`chats`,e)}catch(e){a(e.message)}};return(0,Y.jsx)(V,{id:`spec`,icon:n,title:`Make test data from a spec`,actions:(0,Y.jsxs)(E,{variant:`ghost`,onClick:()=>void P(),"data-tip":`Write a spec in a chat`,children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),`Chat`]}),description:`A spec is a YAML file with tables: and what goes in each column. The same spec and seed make the same data again, so a test or a pipeline can rely on it. No model is used.`,children:e.specs.length===0?(0,Y.jsx)(j,{className:`py-4`,children:`No specs in this project yet: a YAML file with tables: in test-data/, data/ or specs/. Write one in a chat, from a database's schema.`}):(0,Y.jsxs)(`div`,{className:b(D,`flex flex-col gap-4`),children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,Y.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_260px] flex-col gap-2 text-body-sm font-medium`,children:[`Spec`,(0,Y.jsx)(_,{value:l,onChange:e=>u(e.target.value),children:e.specs.map(e=>(0,Y.jsx)(`option`,{children:e},e))})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-2 text-body-sm font-medium`,children:[`Database`,(0,Y.jsxs)(_,{value:d,onChange:e=>h(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`The spec's own`}),e.databases.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,e.writable?``:` (read only)`]},e.name))]})]}),(0,Y.jsxs)(`label`,{className:`flex w-[120px] flex-col gap-2 text-body-sm font-medium`,children:[`Seed`,(0,Y.jsx)(v,{value:g,inputMode:`numeric`,placeholder:`Random`,onChange:e=>y(e.target.value.replace(/\D/g,``).slice(0,9))})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(E,{variant:w?void 0:`primary`,disabled:r||!l,onClick:()=>i(`gen`,k),children:[(0,Y.jsx)(s,{"aria-hidden":`true`}),`Preview`]}),(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsxs)(E,{disabled:r||!l,onClick:()=>i(`gen`,{...k,mode:`files`,format:x}),"data-tip":`Write files (${x})`,children:[(0,Y.jsx)(p,{"aria-hidden":`true`}),`Export`]}),(0,Y.jsx)(_,{"aria-label":`File format`,value:x,onChange:e=>C(e.target.value),className:`w-[88px]`,children:[`csv`,`json`,`sql`].map(e=>(0,Y.jsx)(`option`,{children:e},e))})]}),(0,Y.jsxs)(E,{disabled:r||!l||!N?.writable,"data-tip":N?.writable?`Insert into ${N.name}`:`Pick a writable database to insert into`,onClick:()=>O(!0),children:[(0,Y.jsx)(c,{"aria-hidden":`true`}),`Insert`]})]}),w&&N&&(0,Y.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Insert test data`,className:b(T.warn,`flex flex-col gap-4`),children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[`Insert the rows of `,l,` into `,N.name,`?`]}),(0,Y.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:`They go in as one batch, which you can remove again under Batches. Only on a test database.`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(E,{variant:`primary`,onClick:()=>{O(!1),i(`gen`,{...k,mode:`insert`,confirmed:!0})},children:[(0,Y.jsx)(c,{"aria-hidden":`true`}),`Insert`]}),(0,Y.jsxs)(E,{onClick:()=>O(!1),"data-tip":`Don't insert`,children:[(0,Y.jsx)(o,{"aria-hidden":`true`}),`Cancel`]})]})]}),M&&!M.ok&&(0,Y.jsx)(G,{text:M.error||`It did not make the data.`}),M?.ok&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[M.batch&&(0,Y.jsxs)(`p`,{className:b(T.pass,`m-0`),children:[`Inserted as batch `,(0,Y.jsx)(`span`,{className:`font-mono text-body-sm`,children:M.batch}),`.`]}),M.files?.length?(0,Y.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-body-sm`,children:[`Wrote`,M.files.map(e=>(0,Y.jsx)(ie,{file:e,onNote:a},e))]}):null,(0,Y.jsx)(H,{r:M})]})]})})}function fe({view:e,job:t,busy:n,act:r}){let a=e.databases.filter(e=>e.writable),[o,c]=(0,J.useState)(a[0]?.name??``),[u,d]=(0,J.useState)(``),f=t&&!t.running?t:null,p=f?.kind===`batches`?(Array.isArray(f.result)?f.result.flatMap(e=>e.batches||[]):f.result?.batches)??[]:null;return(0,Y.jsx)(V,{id:`batch`,icon:l,title:`Inserted batches`,description:`Rows inserted from a spec go in as a batch. Remove a batch to take exactly those rows out again, children first.`,children:a.length===0?(0,Y.jsx)(j,{className:`py-4`,children:`No writable database: test data is inserted only into one marked writable in Settings, Databases.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(_,{"aria-label":`Database`,value:o,onChange:e=>c(e.target.value),className:`w-[220px]`,children:a.map(e=>(0,Y.jsx)(`option`,{children:e.name},e.name))}),(0,Y.jsxs)(E,{disabled:n||!o,onClick:()=>r(`batches`,{db:o}),"data-tip":`List batches`,children:[(0,Y.jsx)(s,{"aria-hidden":`true`}),`Show`]})]}),p&&p.length===0&&(0,Y.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`No batches in `,f?.target,`.`]}),p&&p.length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:p.map(e=>(0,Y.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-4 border-t border-line-soft py-2 text-body-sm first:border-t-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.batch}),(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[(0,Y.jsx)(`span`,{"data-tip":new Date(e.created).toLocaleString(),children:B(e.created)}),e.spec?` · ${e.spec}`:``,` ·`,` `,Object.entries(e.rows).map(([e,t])=>`${e} ${t}`).join(`, `)]})]}),u===e.batch?(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`text-body-sm text-warn`,children:[`Remove its rows from `,f?.target,`?`]}),(0,Y.jsxs)(E,{variant:`danger`,size:`sm`,onClick:()=>{d(``),r(`clean`,{db:f?.target,batch:e.batch,confirmed:!0})},children:[(0,Y.jsx)(h,{"aria-hidden":`true`}),`Remove`]}),(0,Y.jsxs)(E,{size:`sm`,onClick:()=>d(``),children:[(0,Y.jsx)(i,{"aria-hidden":`true`}),`Keep`]})]}):(0,Y.jsx)(E,{size:`icon`,variant:`icon`,disabled:n,onClick:()=>d(e.batch),"aria-label":`Remove batch ${e.batch}`,"data-tip":`Remove batch ${e.batch}`,className:`size-8`,children:(0,Y.jsx)(h,{"aria-hidden":`true`})})]},e.batch))}),f?.kind===`clean`&&f.result?.ok&&(0,Y.jsxs)(`p`,{className:b(T.pass,`m-0`),children:[`Removed:`,` `,Object.entries(f.result.removed||{}).map(([e,t])=>`${e} ${t}`).join(`, `)]})]})})}function pe({sub:e}){let{view:t,error:n,busy:r,act:i,stop:a,job:o}=ae(),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(``),d=X.includes(e)?e:`requests`,p=o&&!o.running?o.endedAt:``;(0,J.useEffect)(()=>{x.log().then(c,e=>u(e.message))},[p]);let h=(s||[]).filter(e=>!e.ok).length,g=new Set((s||[]).map(e=>e.requester)).size,_={requests:`Requests${s?` (${s.length})`:``}`,kept:`Kept${t?` (${t.requests.length})`:``}`,specs:`Specs${t?` (${t.specs.length})`:``}`,batches:`Batches`};return(0,Y.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Y.jsx)(te,{}),(0,Y.jsxs)(`main`,{className:b(ne,`@container flex-auto gap-4`),children:[(0,Y.jsx)(M,{to:{href:f(`data`,`databases`),label:`All databases`}}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Y.jsx)(P,{pixel:w[`test-data`],size:`lg`}),(0,Y.jsx)(`h1`,{className:`m-0 text-headline-lg`,children:`Test data`}),t&&(0,Y.jsx)(re,{label:`Test data`,className:`mb-0`,current:d,hrefOf:e=>f(`test-data`,e),tabs:X.map(e=>({id:e,label:_[e],icon:ce[e]}))}),(0,Y.jsx)(`span`,{className:`flex-auto`}),(0,Y.jsxs)(`a`,{href:f(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:b(O(),`no-underline`),children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),`Ask`]})]}),(0,Y.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:`Every request for test data: which agent asked, what for, when, and what Miner sent back. Kept requests fetch the same data again with no model; specs make data you can insert as batches and remove again.`}),s&&s.length>0&&(0,Y.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2 tabular-nums`,children:[y(s.length,`request`),` · `,y(g,`asker`),` · `,(0,Y.jsxs)(`span`,{className:h?`text-fail`:``,children:[h,` failed`]}),t?` · ${t.requests.length} kept`:``]}),(n||l)&&(0,Y.jsx)(`p`,{role:`alert`,className:b(T.fail,`m-0`),children:n||l}),!t&&!n&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),t&&(0,Y.jsxs)(Y.Fragment,{children:[o&&(o.running?Z[o.kind]!==void 0:Z[o.kind]===d)&&(0,Y.jsx)(oe,{job:o,onStop:a}),(0,Y.jsxs)(`div`,{id:`panel-${d}`,children:[d===`requests`&&(0,Y.jsx)($,{view:t,log:s,busy:r,act:i}),d===`kept`&&(0,Y.jsx)(ue,{view:t,job:o,busy:r,act:i,onNote:u}),d===`specs`&&(0,Y.jsx)(de,{view:t,job:o,busy:r,act:i,onNote:u}),d===`batches`&&(0,Y.jsx)(fe,{view:t,job:o,busy:r,act:i})]})]})]})]})}export{$ as Requests,pe as TestData};
@@ -1,4 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Br as t,D as n,Dr as r,J as i,Kn as a,L as o,O as s,Qn as c,R as l,Rn as u,U as d,Un as f,Ur as p,W as m,Wt as h,Y as g,Zn as _,Zt as v,cn as y,cr as b,dt as x,er as S,et as C,hr as ee,kr as te,lt as w,mt as T,n as E,nn as ne,pr as D,qr as O,r as k,rt as re,sn as A,tn as j,u as ie,ur as ae,ut as oe,v as se,vt as ce,w as le,wr as ue,yr as de,z as fe}from"./route-D9uPlFWw.js";import{B as pe,D as M,E as N,K as P,O as me,Pt as he,Vt as F,q as ge}from"./preload-helper-qorOEK5q.js";import{t as _e}from"./jsx-runtime-LKYXHABd.js";import{L as ve}from"./palette-BsY8OLxd.js";import{A as ye,F as I,N as L,O as R,P as z,c as B,i as be,l as V,n as xe}from"./pageBack-BoSbGSU6.js";import{Ct as Se,Gt as Ce,It as we,Kt as Te,St as H,at as U,bt as W,gt as Ee,ht as G,n as De,ot as Oe,qt as K,s as ke,ut as Ae,vt as q,xt as je,yt as Me}from"./frame-CNYHTG4T.js";import{t as J}from"./when-BuWCTaKm.js";import{t as Ne}from"./code-DzYywAs5.js";import{o as Pe}from"./markdown-BhU7ng6c.js";import{G as Fe,U as Ie,W as Y}from"./index-B1Q2Dlqw.js";import{_ as Le,o as Re}from"./qualityParts-ClGKtjEv.js";import{t as ze}from"./AgentWork-BpfMY_xu.js";var X=e(O(),1),Z={view:()=>P(`GET`,`/api/testmgmt`),cases:()=>P(`GET`,`/api/testmgmt/cases`),case:e=>P(`GET`,`/api/testmgmt/case/${encodeURIComponent(e).replace(/%3A/gi,`:`)}`),sync:()=>P(`POST`,`/api/testmgmt/sync`),schedule:()=>P(`GET`,`/api/testmgmt/schedule`),setSchedule:e=>P(`POST`,`/api/testmgmt/schedule`,e),gaps:()=>P(`GET`,`/api/testmgmt/gaps`),tags:()=>P(`GET`,`/api/testmgmt/tags`),tag:(e,t=!1)=>P(`POST`,`/api/testmgmt/tags`,{...e,...t?{confirmed:!0}:{}}),suites:()=>P(`GET`,`/api/testmgmt/suites`),suite:e=>P(`GET`,`/api/testmgmt/suites/${encodeURIComponent(e)}`),buildSuite:(e,t)=>P(`POST`,`/api/testmgmt/suites/agent`,{request:e,...t?{open:t}:{}}),saveSuite:e=>P(`POST`,`/api/testmgmt/suites`,e),deleteSuite:e=>P(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/delete`,{confirmed:!0}),runSuite:(e,t,n=!1)=>P(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/run`,{...t,...n?{confirmed:!0}:{}}),run:(e,t,n=!1)=>P(`POST`,`/api/testmgmt/run`,{keys:e,...t?{env:t}:{},...n?{confirmed:!0}:{}}),job:()=>P(`GET`,`/api/testmgmt/job`),writeBack:(e,t,n,r)=>P(`POST`,`/api/testmgmt/writeback/${e}`,{keys:t,...r?{tags:r}:{},...n?{digest:n}:{}}),suiteTracker:(e,t,n)=>P(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/tracker`,{...t?{target:t}:{},...n?{digest:n}:{}}),stop:()=>P(`POST`,`/api/testmgmt/stop`),tests:()=>P(`GET`,`/api/testmgmt/tests`),test:e=>P(`GET`,`/api/testmgmt/test/${encodeURIComponent(e)}`),discoveryPlan:()=>P(`GET`,`/api/testmgmt/discover`),discover:e=>P(`POST`,`/api/testmgmt/discover`,{digest:e}),link:e=>P(`POST`,`/api/testmgmt/links`,{changes:e}),setMain:(e,t)=>P(`POST`,`/api/testmgmt/links/main`,{case:e,test:t}),proposeLinks:(e=[])=>P(`POST`,`/api/testmgmt/links/propose`,{keys:e}),ask:(e,t,n,r)=>P(`POST`,`/api/testmgmt/ask`,{intent:e,keys:t,...n?{words:n}:{},...r?.length?{stories:r}:{}}),readStories:e=>P(`POST`,`/api/testmgmt/stories`,{scope:e})},Be={automated:`Automated`,not_automated:`Not automated`,pending:`Pending`,known_defect:`Known defect`,needs_attention:`Needs attention`},Ve={mapping:`ForgeQE's mapping`,manual:`Linked by a person`,attribute:`Its marker or attribute names the case`,tracker:`The case's system names it`,agent:`Linked by the mapping agent`,name:`The case's id is in its name or tags`},He={framework:`Listed by its framework`,code:`Read from the code`,runs:`Known from runs`},Ue={passed:`Passed`,failed:`Failed`,blocked:`Blocked`,not_run:`Not run`},Q=_e();function We({title:e,about:t,onClose:n,children:r,footer:i}){return(0,Q.jsxs)(`aside`,{"aria-label":e,className:`flex w-full flex-none flex-col border-t border-line-soft bg-surface-muted xl:sticky xl:top-0 xl:h-(--screen) xl:w-[320px] 2xl:w-[380px] xl:border-t-0 xl:border-l`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-line-soft px-6 py-4`,children:[(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:(0,Q.jsx)(Fe,{icon:b,title:e,description:t})}),n&&(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Close the ${e}`,"data-tip":`Close`,onClick:n,children:(0,Q.jsx)(p,{"aria-hidden":`true`})})]}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 py-6`,children:r}),i&&(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft px-6 py-4`,children:i})]})}function Ge({title:e,about:t,looking:n,context:r,suggestions:i,placeholder:a,onClose:o,keys:s}){let[c,l]=(0,X.useState)(null),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(!1),v=async(e,t,n,r,i)=>{p(!0),h(``);try{let{request:a}=await Z.ask(e,t,r,i),{id:o}=await ge.start(a,{});l({id:o,said:n}),_(!1),d(``)}catch(e){h(e.message)}finally{p(!1)}};return(0,Q.jsxs)(We,{title:e,about:t,onClose:o,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:i.map(e=>(0,Q.jsxs)(L,{size:`sm`,disabled:f||!!e.disabled,"data-tip":e.disabled??e.label,onClick:()=>void v(e.intent,e.keys,e.label,void 0,e.stories),children:[(0,Q.jsx)(e.icon,{"aria-hidden":`true`}),e.label]},e.label))}),(0,Q.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),u.trim()&&v(`ask`,(s??i[0]?.keys??[]).slice(0,50),u.trim(),u.trim())},children:[(0,Q.jsxs)(`label`,{className:`sr-only`,htmlFor:`tm-agent-words`,children:[`Message the `,e]}),(0,Q.jsx)(me,{id:`tm-agent-words`,rows:2,maxLength:1e3,value:u,placeholder:a,onChange:e=>d(e.target.value),className:`min-h-11 flex-1 resize-none`}),(0,Q.jsx)(L,{size:`icon`,variant:`primary`,type:`submit`,disabled:f||!u.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,Q.jsx)(S,{"aria-hidden":`true`})})]})]}),children:[(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,Q.jsx)(ye,{state:f||c&&!g?`thinking`:`working`,px:96,label:f?`Starting`:c&&!g?`Working`:`Ready`}),(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:c?g?`Done. Ask again, or open the chat.`:`Working on it…`:n}),r.length>0&&(0,Q.jsx)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:r.map(e=>(0,Q.jsx)(B,{tone:`neutral`,icon:!1,children:e},e))}),c&&(0,Q.jsx)(`p`,{className:`m-0 text-body-lg leading-relaxed text-ink-2`,children:c.said})]}),m&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:m}),c?(0,Q.jsx)(ze,{id:c.id,label:`The ${e} at work`,onEnd:()=>_(!0)},c.id):(0,Q.jsxs)(`p`,{className:F(`m-0 text-center text-body-sm text-muted`),children:[`Pick what to do below, or say it in your own words. It works in a chat you can open: `,(0,Q.jsx)(`a`,{href:k(`chats`),children:`All chats`}),`.`]})]})}var Ke={automation:`Mark automated in their tracker`,tags:`Write ForgeQE's tags to their tracker`,untag:`Take ForgeQE's tags off in their tracker`},qe={automation:`Each case's tracker records its automated test: Azure DevOps' Associated Automation, or the automated label on a Jira or Xray test. Only cases whose test ForgeQE knows, from its mapping or a link, are marked.`,tags:`ForgeQE's own tags are added to each case's tags in Azure DevOps, or its labels in Jira. Tags the case already has stay; nothing is taken away.`,untag:`ForgeQE's own tags are taken off each case's tags in Azure DevOps, or its labels in Jira. Only a tag ForgeQE keeps for the case is taken off; the tracker's other tags stay.`},Je=e=>e.system===`azure_devops`?`Azure DevOps plan ${e.plan}`:`Xray Test Set in ${e.project}`,Ye=e=>e.system===`azure_devops`?`ado:${e.plan}`:`xray:${e.project}`,Xe=e=>e?.url&&/^https:\/\//i.test(e.url)?e.url:void 0,Ze=e=>e.system===`azure_devops`?`Azure DevOps suite ${e.suite} in plan ${e.plan}`:`Xray Test Set ${e.key}`;function Qe({plan:e,outcome:t}){let n=new Map((t?.failed??[]).map(e=>[e.key,e.error])),r=new Set((t?.done??[]).map(e=>e.key)),i=(e,t,i=!1)=>(0,Q.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 first:border-t-0`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r.has(e.key)&&(0,Q.jsx)(o,{size:14,"aria-label":`Written`,className:`flex-none text-pass`}),n.has(e.key)&&(0,Q.jsx)(d,{size:14,"aria-label":`Refused`,className:`flex-none text-fail`}),e.key!==`suite`&&(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.key.replace(/^[a-z_]+:/,``)}),(0,Q.jsx)(`span`,{className:i?`text-muted`:`text-ink-2`,children:e.what})]}),n.has(e.key)&&(0,Q.jsx)(`span`,{className:`text-fail [overflow-wrap:anywhere]`,children:n.get(e.key)})]},`${e.key}-${t}`);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 text-body-sm`,children:[e.changes.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.changes.map((e,t)=>i(e,t))}):(0,Q.jsx)(`p`,{className:`m-0 text-ink-2`,children:`Nothing to write: the trackers already say so.`}),e.skipped.length>0&&(0,Q.jsxs)(`details`,{children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-muted`,children:[`Left out: `,e.skipped.length]}),(0,Q.jsx)(`ul`,{className:`m-0 mt-2 flex list-none flex-col p-0`,children:e.skipped.map((e,t)=>i(e,t,!0))})]})]})}function $e(e,t,n){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),d=(0,X.useRef)(!1);return(0,X.useEffect)(()=>{if(e&&d.current||(d.current=!1,i(null),o(null),c(``),!e))return;let t=!0;return e().then(e=>t&&i(e??null),e=>t&&c(e.message)),()=>{t=!1}},[e]),{plan:r,outcome:a,error:s,busy:l,go:async()=>{if(r){u(!0),c(``);try{let e=await t(r.digest);e&&(d.current=!0,o(e),n(`Wrote ${e.done.length}${e.failed.length?`; the tracker refused ${e.failed.length}`:``}.`))}catch(e){c(e.message)}finally{u(!1)}}}}}function et({kind:e,keys:t,tags:n,onClose:r,onDone:i}){let[a,o]=(0,X.useState)(null),s=`${t.join(`
2
- `)}|${(n??[]).join(`
3
- `)}`;(0,X.useEffect)(()=>o(e?()=>()=>Z.writeBack(e,t,void 0,n).then(e=>e.plan):null),[e,s]);let c=$e(a,r=>Z.writeBack(e,t,r,n).then(e=>e.outcome),i);return(0,Q.jsx)(K,{open:!!e,onClose:r,title:e?Ke[e]:``,description:e?qe[e]:``,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(L,{onClick:r,children:[(0,Q.jsx)(p,{"aria-hidden":`true`}),c.outcome?`Close`:`Cancel`]}),!c.outcome&&(0,Q.jsxs)(L,{variant:`primary`,disabled:c.busy||!c.plan?.changes.length,onClick:()=>void c.go(),"data-tip":`Write these changes`,children:[e===`untag`?(0,Q.jsx)(w,{"aria-hidden":`true`}):(0,Q.jsx)(te,{"aria-hidden":`true`}),c.busy?`Writing…`:`${e===`untag`?`Take off`:`Write`} ${c.plan?.changes.length??``}`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[!c.plan&&!c.error&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Working out what would change…`}),c.error&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:c.error}),c.plan&&(0,Q.jsx)(Qe,{plan:c.plan,outcome:c.outcome})]})})}function tt({open:e,suite:t,targets:n,onClose:r,onDone:i}){let[a,o]=(0,X.useState)(``),c=t.tracker?void 0:n.find(e=>Ye(e)===(a||(n[0]?Ye(n[0]):``))),[l,u]=(0,X.useState)(null);(0,X.useEffect)(()=>u(e&&(t.tracker||c)?()=>()=>Z.suiteTracker(t.id,c).then(e=>e.plan):null),[e,t.id,t.tracker?Ze(t.tracker):``,c&&Ye(c)]);let d=$e(l,e=>Z.suiteTracker(t.id,c,e).then(e=>e.outcome),i),f=t.tracker;return(0,Q.jsx)(K,{open:e,onClose:r,title:f?`Keep ${t.name} in step`:`Keep ${t.name} in a tracker`,description:f?`It is ${Ze(f)}. Cases the suite gained are added there, and cases it lost are taken out.`:`The suite is made in the tracker with its cases, so the team sees it there. Later, Keep in step makes it match the suite again.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(L,{onClick:r,children:[(0,Q.jsx)(p,{"aria-hidden":`true`}),d.outcome?`Close`:`Cancel`]}),!d.outcome&&(0,Q.jsxs)(L,{variant:`primary`,disabled:d.busy||!d.plan?.changes.length,onClick:()=>void d.go(),children:[(0,Q.jsx)(s,{"aria-hidden":`true`}),d.busy?`Writing…`:f?`Keep in step`:`Make it there`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[!f&&(n.length?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Where`,(0,Q.jsx)(M,{value:c?Ye(c):``,onChange:e=>o(e.target.value),children:n.map(e=>(0,Q.jsx)(`option`,{value:Ye(e),children:Je(e)},Ye(e)))})]}):(0,Q.jsx)(`p`,{className:`m-0 text-ink-2`,children:`This suite's cases are in no connected Azure DevOps plan or Xray project. Connect one in Settings › Integrations.`})),(f||c)&&!d.plan&&!d.error&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Working out what would change…`}),d.error&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:d.error}),d.plan&&(0,Q.jsx)(Qe,{plan:d.plan,outcome:d.outcome}),d.outcome&&!d.outcome.failed.length&&(0,Q.jsx)(B,{tone:`pass`,children:`Done`})]})})}var nt={automated:o,not_automated:l,pending:fe,known_defect:r,needs_attention:r},rt={passed:`pass`,failed:`fail`,blocked:`warn`,not_run:`neutral`};function it({text:e,tip:t,className:n}){return(0,Q.jsx)(`span`,{"data-tip":t??e,className:F(`line-clamp-2 [overflow-wrap:anywhere]`,n),children:e})}function at({a:e}){let t=nt[e];return(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body-sm whitespace-nowrap`,children:[(0,Q.jsx)(t,{size:15,"aria-hidden":`true`,className:F(`flex-none`,e===`automated`?`text-pass`:e===`known_defect`?`text-fail`:e===`not_automated`?`text-muted`:`text-warn`)}),Be[e]]})}function ot({o:e}){return(0,Q.jsx)(B,{tone:rt[e],icon:e!==`not_run`,children:Ue[e]})}function st({runs:e}){return e.length?(0,Q.jsx)(`span`,{role:`img`,"aria-label":`Last runs: ${e.map(e=>e===`p`?`passed`:`failed`).join(`, `)}`,className:`inline-flex items-end gap-1`,children:e.map((e,t)=>(0,Q.jsx)(`span`,{className:F(`inline-block h-4 w-2 rounded-sm`,e===`p`?`bg-pass`:`bg-fail`)},t))}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`–`})}function ct({tags:e,max:t=3}){return e.length?(0,Q.jsxs)(`span`,{className:`inline-flex flex-wrap gap-1`,children:[e.slice(0,t).map(e=>(0,Q.jsxs)(B,{tone:`neutral`,icon:!1,children:[(0,Q.jsx)(de,{size:11,"aria-hidden":`true`}),e]},e)),e.length>t&&(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,"data-tip":e.slice(t).join(`, `),children:[`+`,e.length-t,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`: `,e.slice(t).join(`, `)]})]})]}):null}function lt({label:e,items:t,value:n,onChange:r}){let i=t.find(e=>e.id===n);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(M,{size:`sm`,"aria-label":e,value:n,onChange:e=>r(e.target.value),className:F(`w-auto`,i?.alert&&i.n?`text-fail`:void 0),children:t.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.n===void 0?e.label:`${e.label} (${e.n})`},e.id))}),i?.tip&&(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:i.tip})]})}function ut({points:e,label:t,format:n=e=>String(e),height:r=160}){if(e.length<2)return(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`The trend starts after a second day of numbers: each visit of Test management keeps the day's.`});let i=r,a=Math.min(...e.map(e=>e.y)),o=Math.max(...e.map(e=>e.y)),s=Math.max(0,a-(o-a||1)*.2),c=o+(o-a||1)*.2,l=t=>8+t*584/(e.length-1),u=e=>i-20-(e-s)/(c-s||1)*(i-36),d=e.map((e,t)=>`${l(t).toFixed(1)},${u(e.y).toFixed(1)}`),f=e.at(-1);return(0,Q.jsxs)(`figure`,{className:`m-0 flex flex-col gap-1`,children:[(0,Q.jsxs)(`svg`,{viewBox:`0 0 600 ${i}`,role:`img`,"aria-label":`${t}: from ${n(e[0].y)} on ${e[0].x} to ${n(f.y)} on ${f.x}`,className:`h-auto w-full text-accent`,children:[[.25,.5,.75].map(e=>(0,Q.jsx)(`line`,{x1:`0`,x2:600,y1:(i-20)*e+4,y2:(i-20)*e+4,className:`stroke-line-soft`,strokeWidth:`1`},e)),(0,Q.jsx)(`path`,{d:`M${d.join(` L`)} L${l(e.length-1)},${i-20} L${l(0)},${i-20} Z`,fill:`currentColor`,fillOpacity:`0.1`}),(0,Q.jsx)(`polyline`,{points:d.join(` `),fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,Q.jsx)(`circle`,{cx:l(e.length-1),cy:u(f.y),r:`4`,fill:`currentColor`,className:`stroke-bg`,strokeWidth:`2`})]}),(0,Q.jsxs)(`figcaption`,{className:`flex justify-between text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{children:e[0].x}),(0,Q.jsxs)(`span`,{className:`font-medium text-ink`,children:[n(f.y),` now`]}),(0,Q.jsx)(`span`,{children:f.x})]})]})}function dt({items:e,series:t,label:n,empty:r}){if(r&&!e.some(e=>e.values.some(e=>e>0)))return(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:r});let i=Math.max(1,...e.flatMap(e=>e.values));return(0,Q.jsxs)(`figure`,{className:`m-0 flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-4 text-body-sm text-ink-2`,children:t.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:F(`inline-block size-[10px] rounded-sm`,e.className),"aria-hidden":`true`}),e.name]},e.name))}),(0,Q.jsx)(`div`,{role:`img`,"aria-label":`${n}: ${e.map(e=>`${e.x} ${e.values.join(` and `)}`).join(`; `)}`,className:`flex h-[140px] items-end gap-2 border-b border-line`,children:e.map(e=>(0,Q.jsx)(`span`,{className:`flex h-full flex-1 items-end justify-center gap-1`,"data-tip":`${e.x}: ${e.values.map((e,n)=>`${t[n]?.name.toLowerCase()} ${e}`).join(`, `)}`,children:e.values.map((e,n)=>(0,Q.jsx)(`span`,{className:F(`w-full max-w-[14px] rounded-t-[4px]`,t[n]?.className),style:{height:`${Math.max(e?3:0,e/i*100)}%`}},n))},e.x))}),(0,Q.jsxs)(`span`,{className:`flex justify-between text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{children:e[0]?.x}),(0,Q.jsx)(`span`,{children:e.at(-1)?.x})]})]})}function ft({label:e,part:t,whole:n,className:r=`bg-accent`}){let i=n?Math.round(t/n*100):0;return(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,140px)_1fr_auto] items-center gap-4 text-body-sm`,children:[(0,Q.jsx)(it,{text:e,className:`text-ink-2`}),(0,Q.jsx)(`span`,{className:`h-2 overflow-hidden rounded-full bg-surface-strong`,role:`img`,"aria-label":`${e}: ${t} of ${n}`,children:(0,Q.jsx)(`span`,{className:F(`block h-full rounded-full`,r),style:{width:`${i}%`}})}),(0,Q.jsxs)(`span`,{className:`w-[86px] text-right tabular-nums text-ink-2`,children:[t,` of `,n]})]})}function pt({open:e,onClose:t,title:n,preview:r,onStarted:i}){let[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(``),[l,d]=(0,X.useState)(null),[f,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&(d(null),m(``),Z.suites().then(e=>{o({list:e.environments,...e.active?{active:e.active}:{}}),c(e.active&&e.environments.includes(e.active)?e.active:e.environments[0]??``)},e=>m(e.message)))},[e]),(0,X.useEffect)(()=>{if(!e||a===null)return;let t=!0;return d(null),m(``),r(s||void 0,!1).then(e=>{t&&d(e.preview??null)},e=>t&&m(e.message)),()=>{t=!1}},[e,s,a]);let _=async()=>{g(!0);try{await r(s||void 0,!0),i(),t()}catch(e){m(e.message)}finally{g(!1)}};return(0,Q.jsx)(K,{open:e,onClose:t,title:n,description:`ForgeQE runs these with forgeqe suite, on the environment you pick here. Results go to Runs and back to each case's system, as your settings say.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(L,{onClick:t,children:[(0,Q.jsx)(p,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(L,{variant:`primary`,disabled:h||!l,onClick:()=>void _(),"data-tip":`Start the run`,children:[(0,Q.jsx)(u,{"aria-hidden":`true`}),`Run `,l?l.cases:``]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[a&&a.list.length>0&&(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Environment`,(0,Q.jsx)(M,{value:s,onChange:e=>c(e.target.value),children:a.list.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),l&&(0,Q.jsxs)(`p`,{role:`status`,className:`m-0 text-ink-2`,children:[l.cases,` test case`,l.cases===1?``:`s`,` on `,l.env??`the active environment`,`.`]}),f&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:f})]})})}var mt=e=>e.lastRun.outcome===`failed`||e.lastRun.outcome===`blocked`,ht=e=>k(`test-management`,`cases`,encodeURIComponent(e)),gt=e=>k(`test-management`,`tests`,encodeURIComponent(e));function _t({cases:e,onChanged:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(`all`),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),p=()=>Z.tests().then(e=>{r(e),a(``)},e=>a(e.message));(0,X.useEffect)(()=>{p()},[]),(0,X.useEffect)(()=>{if(!n?.busy)return;let e=Te(()=>void p(),3e3);return()=>Ce(e)},[n?.busy]),St(n?.busy??null,()=>t(`Done: the tests and their links are up to date.`));let m=(0,X.useMemo)(()=>new Map(e.map(e=>[e.key,e])),[e]);if(i)return(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:i});if(!n)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});let h=n.tests,g={all:h.length,unlinked:h.filter(e=>!e.cases.length).length,linked:h.filter(e=>e.cases.length).length,code:h.filter(e=>e.via===`code`).length},_=h.filter(e=>o===`all`||(o===`unlinked`?!e.cases.length:o===`linked`?e.cases.length>0:e.via===`code`)),v=bt(_.map(e=>e.file).filter(e=>!!e)),y=async()=>{try{t(`The mapping agent is looking at ${(await Z.proposeLinks()).cases} cases with no test.`),p()}catch(e){t(e.message)}};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(L,{variant:`primary`,onClick:()=>u(!0),disabled:!!n.busy,children:[(0,Q.jsx)(c,{"aria-hidden":`true`}),`Discover`]}),(0,Q.jsxs)(L,{onClick:()=>void y(),disabled:!!n.busy||!h.length,"data-tip":`The mapping agent links cases that have no test to the tests that check them`,children:[(0,Q.jsx)(b,{"aria-hidden":`true`}),`Link`]}),(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[n.busy?n.busy.what===`discover`?`Discovering tests, started ${J(n.busy.started)}…`:`The mapping agent is at work, started ${J(n.busy.started)}…`:n.discovery?`Discovered ${J(n.discovery.at)}.`:`Not discovered yet: these are read from the code.`,n.proposed>0&&` ${n.proposed} link${n.proposed===1?``:`s`} proposed, waiting on the cases' pages.`]})]}),n.error&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:n.error}),n.discovery&&n.discovery.projects.length>0&&(0,Q.jsx)(Ct,{projects:n.discovery.projects}),(0,Q.jsx)(G,{label:`Automated tests`,placeholder:`Find a test by id, name, file or tag`,height:Ee,resetKey:o,empty:h.length?`No test matches.`:`No automated test found yet. Discover asks each test project's framework (pytest, .NET, Playwright, Vitest, Jest, Mocha, Robot Framework) for its tests; set the automation repository in Settings › Code first.`,tools:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,Q.jsx)(lt,{label:`Tests to show`,items:[{id:`all`,label:`All tests`,n:g.all},{id:`unlinked`,label:`No test case`,n:g.unlinked},{id:`linked`,label:`Linked`,n:g.linked},{id:`code`,label:`Read from the code`,n:g.code,tip:`Their framework was not asked, or could not list them`}],value:o,onChange:s}),v&&(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`Files in `,(0,Q.jsx)(`span`,{className:`font-mono`,children:v})]})]}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`w-[45%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @2xl:table-cell`),children:`Framework`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Test cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @3xl:table-cell`),children:`Tags`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @2xl:table-cell`),children:`Last runs`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:_.map(t=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:F(q,`max-w-0`),children:(0,Q.jsxs)(yt,{uid:t.uid,children:[(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t.name}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-x-2 text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`flex-none font-mono text-accent-fg`,children:t.uid??`No id yet`}),t.file&&(0,Q.jsx)(vt,{path:t.file.slice(v.length),line:t.line}),t.flaky&&(0,Q.jsx)(B,{tone:`warn`,children:`Flaky`})]})]})}),(0,Q.jsx)(`td`,{className:F(q,`hidden text-body-sm @2xl:table-cell`),children:(0,Q.jsxs)(`span`,{"data-tip":He[t.via??`runs`],children:[t.framework&&t.framework!==`code`?xt[t.framework]:(0,Q.jsx)(`span`,{className:`text-muted`,children:`Not known yet`}),t.framework===`gherkin`?`, ${t.runner??`no runner found`}`:``,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`, `,He[t.via??`runs`]]})]})}),(0,Q.jsx)(`td`,{className:F(q,`text-body-sm`),"data-sort":t.cases.length,children:t.cases.length?(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-x-2`,children:[t.cases.slice(0,4).map(e=>(0,Q.jsx)(`a`,{href:ht(e),className:`font-mono`,"data-tip":m.get(e)?.title,children:m.get(e)?.id??e},e)),t.cases.length>4&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[`+`,t.cases.length-4]})]}):(0,Q.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,Q.jsx)(`td`,{className:F(q,`hidden @3xl:table-cell`),children:(0,Q.jsx)(ct,{tags:t.tags})}),(0,Q.jsx)(`td`,{className:F(q,`hidden @2xl:table-cell`),"data-sort":t.runs.length?t.runs.filter(e=>e===`p`).length/t.runs.length:-1,children:(0,Q.jsx)(st,{runs:t.runs})}),(0,Q.jsx)(`td`,{className:F(q,`text-right`),children:(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,onClick:()=>f(t),"aria-label":`Link ${t.name} to a test case`,disabled:!e.length||!t.uid,"data-tip":t.uid?`Link to a test case`:`Known from runs only: Discover gives it an id to link`,children:(0,Q.jsx)(A,{"aria-hidden":`true`})})})]},t.uid??t.key))}),(0,Q.jsx)(wt,{open:l,onClose:()=>u(!1),onStarted:()=>{u(!1),t(`Discovering tests: each project's framework lists its tests.`),p()}}),(0,Q.jsx)(Tt,{open:!!d,title:`Link to a test case`,description:d?`Pick the test case ${d.name} checks. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`:void 0,items:e.filter(e=>!d?.cases.includes(e.key)).map(e=>({id:e.key,label:e.title,sub:e.id})),onClose:()=>f(null),onPick:async e=>{d?.uid&&(await Z.link([{case:e,test:d.uid,action:`link`}]),f(null),t(`Linked ${d.uid} to ${m.get(e)?.id??e}.`),p())}})]})}function vt({path:e,line:t}){let n=e.lastIndexOf(`/`)+1;return(0,Q.jsxs)(`span`,{className:`flex min-w-0 font-mono whitespace-nowrap`,children:[n>0&&(0,Q.jsx)(`span`,{className:`min-w-0 shrink-[999] truncate`,children:e.slice(0,n)}),(0,Q.jsx)(`span`,{className:`min-w-[10ch] truncate`,children:e.slice(n)}),t?`:${t}`:``]})}function yt({uid:e,children:t}){let n=`flex min-w-0 flex-col gap-1 text-ink no-underline`;return e?(0,Q.jsx)(`a`,{href:gt(e),className:n,children:t}):(0,Q.jsx)(`span`,{className:n,children:t})}function bt(e){if(!e.length)return``;let t=e[0].split(`/`).slice(0,-1);for(let n of e.slice(1)){let e=n.split(`/`).slice(0,-1),r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];)r++;t=t.slice(0,r)}return t.length?`${t.join(`/`)}/`:``}var xt={pytest:`pytest`,dotnet:`.NET`,playwright:`Playwright`,jest:`Jest`,vitest:`Vitest`,mocha:`Mocha`,robot:`Robot Framework`,gherkin:`Gherkin`,code:`Code`};function St(e,t){let[n,r]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{e?r(!0):n&&(r(!1),t())},[e]),n}function Ct({projects:e}){return(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:e.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-start gap-2`,children:[e.ok?(0,Q.jsx)(o,{size:14,"aria-label":`Listed`,className:`mt-1 flex-none text-pass`}):(0,Q.jsx)(r,{size:14,"aria-label":`Not listed`,className:`mt-1 flex-none text-warn`}),(0,Q.jsxs)(`span`,{children:[e.label,` in `,e.dir?(0,Q.jsx)(`span`,{className:`font-mono`,children:e.dir}):`the repository's root`,`: `,e.ok?`${e.tests} test${e.tests===1?``:`s`}`:`not listed by its framework, read from the code`,e.error&&(0,Q.jsx)(`span`,{className:`block text-muted [overflow-wrap:anywhere]`,children:e.error})]})]},`${e.framework}-${e.dir}-${t}`))})}function wt({open:e,onClose:t,onStarted:n}){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&(i(null),o(``),Z.discoveryPlan().then(i,e=>o(e.message)))},[e]);let l=async()=>{if(r){c(!0);try{await Z.discover(r.digest),n()}catch(e){o(e.message)}finally{c(!1)}}};return(0,Q.jsx)(K,{open:e,onClose:t,title:`Discover tests`,description:`Each test project's framework lists its tests, as a test explorer asks it. This runs the repository's code (pytest imports conftest.py, .NET builds the project) with no secret of ForgeQE's, so look at what will run first.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(L,{onClick:t,children:`Cancel`}),(0,Q.jsxs)(L,{variant:`primary`,onClick:()=>void l(),disabled:!r||s,children:[(0,Q.jsx)(u,{"aria-hidden":`true`}),`Discover`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 text-body-sm`,children:[a&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:a}),!r&&!a&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Finding the test projects…`}),r&&!r.steps.length&&(0,Q.jsx)(`p`,{className:`m-0 text-ink-2`,children:`No test project was found whose framework can be asked. Gherkin features and the code are still read.`}),r&&r.steps.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:r.steps.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{children:[xt[e.project.framework],` in `,e.project.dir?(0,Q.jsx)(`span`,{className:`font-mono`,children:e.project.dir}):`the repository's root`]}),(0,Q.jsx)(`code`,{className:`font-mono text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.command})]},t))})]})})}function Tt({open:e,title:t,description:n,items:r,onClose:i,onPick:a}){let[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``);(0,X.useEffect)(()=>s(``),[e]);let u=async e=>{l(e),s(``);try{await a(e)}catch(e){s(e.message)}finally{l(``)}};return(0,Q.jsx)(K,{open:e,onClose:i,title:t,description:n,wide:!0,footer:(0,Q.jsx)(L,{onClick:i,children:`Close`}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o&&(0,Q.jsxs)(`p`,{role:`alert`,className:F(I.fail,`m-0 flex items-center gap-2`),children:[(0,Q.jsx)(d,{size:14,"aria-hidden":`true`}),o]}),(0,Q.jsx)(G,{label:t,placeholder:`Find by id or words`,resetKey:String(e),empty:`Nothing to pick.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Name`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Pick`})})]}),children:r.map(e=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsxs)(`td`,{className:F(q,`max-w-0`),children:[(0,Q.jsx)(it,{text:e.label}),e.sub&&(0,Q.jsx)(`span`,{className:`block truncate font-mono text-body-sm text-muted`,children:e.sub})]}),(0,Q.jsx)(`td`,{className:F(q,`w-24 text-right`),children:(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,onClick:()=>void u(e.id),disabled:!!c,"aria-label":`Link ${e.label}`,"data-tip":`Link`,children:(0,Q.jsx)(A,{"aria-hidden":`true`})})})]},e.id))})]})})}var Et=e=>e&&/^https:\/\//i.test(e)?e:void 0;function Dt({caseKey:e,onRun:t,onChanged:n=()=>{}}){let[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),[d,f]=(0,X.useState)(``);(0,X.useEffect)(()=>{let t=!0;return a(null),s(``),f(``),Z.case(e).then(e=>{t&&(a(e),s(``))},e=>t&&s(e.message)),()=>{t=!1}},[e]);let p=t=>{f(t),n(),Z.case(e).then(a,e=>f(`${t} Reading the case again failed: ${e.message}`))},h=(0,Q.jsx)(xe,{to:{href:k(`test-management`,`cases`),label:`Test cases`}});if(o)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[h,(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:o})]});if(!i)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});let g=i.case,y=[g.key],x=Et(g.url);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[h,(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_420px] flex-col gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:g.id}),` · `,g.plans.join(`, `)||`Not in a synced plan`]}),(0,Q.jsx)(Fe,{icon:m,title:g.title}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[g.priority&&(0,Q.jsxs)(B,{tone:g.priority===1?`fail`:g.priority===2?`warn`:`neutral`,icon:!1,children:[`Priority `,g.priority]}),g.state&&(0,Q.jsx)(B,{tone:`neutral`,children:g.state}),(0,Q.jsx)(at,{a:g.automation}),g.origin===`forgeqe`&&(0,Q.jsxs)(B,{tone:`running`,icon:!1,children:[(0,Q.jsx)(b,{size:12,"aria-hidden":`true`}),`Written by ForgeQE`,g.createdAt?` ${J(g.createdAt)}`:``]})]})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[x&&(0,Q.jsxs)(`a`,{className:z(),href:x,target:`_blank`,rel:`noreferrer noopener`,"data-tip":`Open in its system`,children:[(0,Q.jsx)(oe,{"aria-hidden":`true`}),`Open`]}),g.how!==`none`&&g.how!==`tracker`&&!!g.test?.file&&g.trackerAutomated!==!0&&(0,Q.jsxs)(L,{onClick:()=>l(`automation`),"data-tip":`Mark it automated in its system`,children:[(0,Q.jsx)(te,{"aria-hidden":`true`}),`Mark automated`]}),g.ownTags.some(e=>!g.trackerTags.includes(e))&&(0,Q.jsxs)(L,{onClick:()=>l(`tags`),"data-tip":`Write ForgeQE's tags to its system`,children:[(0,Q.jsx)(te,{"aria-hidden":`true`}),`Write tags`]}),g.ownTags.some(e=>g.trackerTags.includes(e))&&(0,Q.jsxs)(L,{onClick:()=>l(`untag`),"data-tip":`Take ForgeQE's tags off in its system`,children:[(0,Q.jsx)(w,{"aria-hidden":`true`}),`Untag`]}),(0,Q.jsxs)(L,{variant:`primary`,onClick:()=>t([g.key]),children:[(0,Q.jsx)(u,{"aria-hidden":`true`}),`Run`]})]})]}),(0,Q.jsx)(et,{kind:c,keys:y,onClose:()=>l(null),onDone:p}),d&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2`,children:d}),(g.stale||g.drift)&&(0,Q.jsxs)(`p`,{role:`status`,className:F(I.warn,`m-0 flex items-start gap-2`),children:[(0,Q.jsx)(r,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Q.jsxs)(`span`,{children:[g.stale&&`Its steps changed in its system after its test was written: the next run updates the test. `,g.drift&&(g.trackerAutomated?`Its system marks it automated, but ForgeQE knows no test for it.`:`ForgeQE has a test for it, but its system does not mark it automated.`)]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsx)(G,{label:`Steps`,search:!1,sortable:!1,empty:`Its system holds no steps for it, or it is not in a synced plan.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`w-10`),children:`#`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Action`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Expected result`})]}),children:i.steps.map((e,t)=>(0,Q.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Q.jsx)(`td`,{className:F(q,`text-body-sm text-muted tabular-nums`),children:t+1}),(0,Q.jsx)(`td`,{className:F(q,`text-body-sm [overflow-wrap:anywhere]`),children:e.action}),(0,Q.jsx)(`td`,{className:F(q,`text-body-sm text-ink-2 [overflow-wrap:anywhere]`),children:e.expected??`–`})]},t))}),(0,Q.jsx)(Ot,{detail:i,onChanged:p})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsx)(Y,{level:3,icon:v,title:`Details`,className:F(R,`text-body-sm`),children:(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[96px_1fr] gap-x-4 gap-y-2`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Last run`}),(0,Q.jsxs)(`dd`,{className:`m-0 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(ot,{o:g.lastRun.outcome}),g.lastRun.at&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[J(g.lastRun.at),g.lastRun.by===`tracker`?`, in its system`:``]})]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Suite`}),(0,Q.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:g.suite??`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Area`}),(0,Q.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:g.group??`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Stories`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:g.stories.join(`, `)||`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Tags`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:g.tags.length?(0,Q.jsx)(ct,{tags:g.tags,max:10}):`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Steps`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:g.steps})]})}),(0,Q.jsx)(Y,{level:3,icon:j,title:`In suites and packs`,className:F(R,`text-body-sm`),children:i.suites.length||g.packs.length?(0,Q.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[i.suites.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`a`,{href:k(`test-management`,`suites`,e.id),children:e.name})},e.id)),g.packs.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`a`,{href:k(`regression`,e),children:[`Pack `,e]})},e))]}):(0,Q.jsx)(`p`,{className:`m-0 text-muted`,children:`In no suite or regression pack.`})}),i.changes.length>0&&(0,Q.jsx)(Y,{level:3,icon:_,title:`What ForgeQE did`,className:F(`rounded-lg bg-bg p-6 shadow-sm`,`text-body-sm`),children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:i.changes.map((e,t)=>(0,Q.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`text-muted`,children:J(e.at)}),` `,e.action,e.story?` for ${e.story}`:``,e.reason?`: ${e.reason}`:``]},t))})})]})]})]})}function Ot({detail:e,onChanged:t}){let n=e.case,[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),[c,l]=(0,X.useState)(``);(0,X.useEffect)(()=>{(n.proposed.length||a)&&Z.tests().then(e=>i(e.tests),()=>{})},[n.proposed.length,a]);let u=new Map((r??[]).filter(e=>e.uid).map(e=>[e.uid,e])),d=async(e,r,i)=>{l(``);try{await Z.link([{case:n.key,test:e,action:r}]),t(i)}catch(e){l(e.message)}},f=async e=>{l(``);try{t(`${e} is the main test now${(await Z.setMain(n.key,e)).mapped?`, and ForgeQE's mapping records it`:``}. Mark automated writes it to the tracker.`)}catch(e){l(e.message)}},m=async()=>{l(``);try{await Z.proposeLinks([n.key]),t(`The mapping agent is looking for this case's tests. Open the case again in a moment.`)}catch(e){l(e.message)}};return(0,Q.jsxs)(Y,{level:3,icon:g,title:`Automated tests`,className:R,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(L,{size:`sm`,onClick:()=>o(!0),"data-tip":`Link a test`,children:[(0,Q.jsx)(A,{"aria-hidden":`true`}),`Link`]}),(0,Q.jsxs)(L,{size:`sm`,onClick:()=>void m(),"data-tip":`The mapping agent picks the tests that check this case`,children:[(0,Q.jsx)(b,{"aria-hidden":`true`}),`Ask`]})]}),children:[c&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:c}),n.tests.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0 text-body-sm`,children:n.tests.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-start gap-2 border-t border-line-soft py-2 first:border-t-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 [overflow-wrap:anywhere]`,children:[e.name,e.main&&n.tests.length>1&&(0,Q.jsx)(`span`,{"data-tip":`What its tracker records as its automated test, and what a run reuses first`,children:(0,Q.jsx)(B,{tone:`pass`,icon:!1,children:`Main test`})})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-body-sm text-muted`,children:[e.uid&&(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.uid}),e.file&&(0,Q.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:e.file})]}),(0,Q.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[Ve[e.how],e.why&&e.why!==Ve[e.how]?`: ${e.why}`:``]})]}),e.uid&&n.tests.length>1&&!e.main&&(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,onClick:()=>void f(e.uid),"aria-label":`Make ${e.name} the main test`,"data-tip":`Make main: its tracker records this one as the case's automated test`,children:(0,Q.jsx)(ee,{"aria-hidden":`true`})}),e.uid&&e.how!==`mapping`&&(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,onClick:()=>void d(e.uid,`unlink`,`Unlinked ${e.uid}. It is not linked again by itself.`),"aria-label":`Unlink ${e.name}`,"data-tip":`Unlink`,children:(0,Q.jsx)(p,{"aria-hidden":`true`})})]},e.uid??e.key))}):n.test?(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[120px_1fr] gap-x-4 gap-y-2 text-body-sm`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Test`}),(0,Q.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:n.test.name}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`File`}),(0,Q.jsx)(`dd`,{className:`m-0 font-mono [overflow-wrap:anywhere]`,children:n.test.file??`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Known from`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:n.how===`none`?`–`:Ve[n.how]})]}):(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No automated test is linked. Link one, ask the agent, or ask the agent on the right to automate it.`}),(n.tests.length>0||n.test)&&(0,Q.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-muted`,children:[`Last runs `,(0,Q.jsx)(st,{runs:e.test?.runs??n.runs})]}),n.proposed.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-base bg-surface-muted p-4 text-body-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Proposed by the mapping agent`}),n.proposed.map(e=>{let t=u.get(e.test);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,Q.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t?.name??e.test}),(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.test}),e.confidence?` · ${e.confidence} confidence`:``,e.why?` · ${e.why}`:``]})]}),(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,onClick:()=>void d(e.test,`accept`,`Linked ${e.test}.`),"aria-label":`Accept ${t?.name??e.test}`,"data-tip":`Accept`,children:(0,Q.jsx)(s,{"aria-hidden":`true`})}),(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,onClick:()=>void d(e.test,`refuse`,`Refused ${e.test}.`),"aria-label":`Refuse ${t?.name??e.test}`,"data-tip":`Refuse`,children:(0,Q.jsx)(p,{"aria-hidden":`true`})})]},e.test)})]}),(0,Q.jsx)(Tt,{open:a,title:`Link a test`,description:`Pick a test that checks ${n.id}. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`,items:(r??[]).filter(e=>e.uid&&!n.tests.some(t=>t.uid===e.uid)).map(e=>({id:e.uid,label:e.name,sub:`${e.uid}${e.file?` · ${e.file}`:``}`})),onClose:()=>o(!1),onPick:async e=>{await Z.link([{case:n.key,test:e,action:`link`}]),o(!1),t(`Linked ${e}.`)}})]})}var kt=[{id:`all`,label:`All cases`,icon:y,test:()=>!0},{id:`not_automated`,label:`Not automated`,icon:l,test:e=>e.automation===`not_automated`},{id:`failing`,label:`Failing`,icon:d,test:mt,alert:!0},{id:`pending`,label:`Pending`,icon:fe,test:e=>e.automation===`pending`},{id:`generated`,label:`Generated by ForgeQE`,icon:b,test:e=>e.origin===`forgeqe`},{id:`stale`,label:`Steps changed`,icon:r,test:e=>e.stale},{id:`drift`,label:`Tracker disagrees`,icon:r,test:e=>e.drift}],At=``,jt=e=>[...new Set(e.filter(e=>!!e))].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}));function Mt({cases:e,tests:t=0,selected:n,onSelect:r,onRun:i,onChanged:a}){let[o,s]=(0,X.useState)(`all`),[c,l]=(0,X.useState)(At),[d,f]=(0,X.useState)(At),[p,m]=(0,X.useState)(At),[h,g]=(0,X.useState)(At),[_,v]=(0,X.useState)(!1),[y,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(null),ee=(0,X.useMemo)(()=>jt(e.flatMap(e=>e.plans)),[e]),w=(0,X.useMemo)(()=>jt(e.map(e=>e.suite)),[e]),T=(0,X.useMemo)(()=>jt(e.flatMap(e=>e.tags)),[e]),E=e.filter(e=>(!c||e.plans.includes(c))&&(!d||e.suite===d)&&(!p||String(e.priority??``)===p)&&(!h||e.tags.includes(h))),ne=kt.find(e=>e.id===o),D=E.filter(ne.test),O=new Set(n),k=(e,t)=>r(t?[...n,e]:n.filter(t=>t!==e)),re=D.length>0&&D.every(e=>O.has(e.key));return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(G,{label:`Test cases`,placeholder:`Find a case by id, title, tag or test`,height:Ee,selection:{count:n.length,onClear:()=>r([]),actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(L,{size:`sm`,onClick:()=>v(!0),children:[(0,Q.jsx)(de,{"aria-hidden":`true`}),`Tag`]}),(0,Q.jsxs)(L,{size:`sm`,onClick:()=>x(!0),"data-tip":`Make a suite of the picked cases`,children:[(0,Q.jsx)(j,{"aria-hidden":`true`}),`Suite`]}),(0,Q.jsxs)(L,{size:`sm`,onClick:()=>C(`automation`),"data-tip":`Mark the picked cases automated in their tracker`,children:[(0,Q.jsx)(te,{"aria-hidden":`true`}),`Mark automated`]}),(0,Q.jsxs)(L,{size:`sm`,onClick:()=>C(`tags`),"data-tip":`Write ForgeQE's tags to their tracker`,children:[(0,Q.jsx)(te,{"aria-hidden":`true`}),`Write tags`]}),(0,Q.jsxs)(L,{size:`sm`,variant:`primary`,onClick:()=>i(n),children:[(0,Q.jsx)(u,{"aria-hidden":`true`}),`Run`]})]})},resetKey:`${o}|${c}|${d}|${p}|${h}`,empty:e.length?`Nothing matches.`:t?`No test cases yet. The repository's ${t} automated test${t===1?` is`:`s are`} on the Automated tab.`:`No test cases yet.`,tools:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsx)(lt,{label:`Show`,items:kt.map(e=>({id:e.id,label:e.label,n:E.filter(e.test).length,...e.alert?{alert:!0}:{}})),value:o,onChange:s}),ee.length>1&&(0,Q.jsxs)(M,{size:`sm`,"aria-label":`Plan`,value:c,onChange:e=>l(e.target.value),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:At,children:`Every plan`}),ee.map(e=>(0,Q.jsx)(`option`,{children:e},e))]}),w.length>0&&(0,Q.jsxs)(M,{size:`sm`,"aria-label":`Suite`,value:d,onChange:e=>f(e.target.value),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:At,children:`Every suite`}),w.map(e=>(0,Q.jsx)(`option`,{children:e},e))]}),(0,Q.jsxs)(M,{size:`sm`,"aria-label":`Priority`,value:p,onChange:e=>m(e.target.value),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:At,children:`Any priority`}),[`1`,`2`,`3`,`4`].map(e=>(0,Q.jsxs)(`option`,{value:e,children:[`Priority `,e]},e))]}),T.length>0&&(0,Q.jsxs)(M,{size:`sm`,"aria-label":`Tag`,value:h,onChange:e=>g(e.target.value),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:At,children:`Any tag`}),T.map(e=>(0,Q.jsx)(`option`,{children:e},e))]})]}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`w-10`),children:(0,Q.jsx)(Ie,{"aria-label":`Select every case shown`,checked:re,onCheckedChange:e=>r(e?jt([...n,...D.map(e=>e.key)]):n.filter(e=>!D.some(t=>t.key===e)))})}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @2xl:table-cell`),children:`Suite`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @2xl:table-cell`),children:`Priority`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @xl:table-cell`),children:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @4xl:table-cell`),children:`Last runs`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @xl:table-cell`),children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:D.map(e=>(0,Q.jsxs)(`tr`,{className:H,"data-state":O.has(e.key)?`selected`:void 0,children:[(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(Ie,{"aria-label":`Select ${e.id}`,checked:O.has(e.key),onCheckedChange:t=>k(e.key,t)})}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsxs)(`a`,{href:ht(e.key),className:`flex min-w-[160px] flex-col gap-1 text-ink no-underline @xl:min-w-[220px]`,children:[(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.id}),e.origin===`forgeqe`&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"data-tip":`ForgeQE wrote this case`,children:[(0,Q.jsx)(b,{size:12,"aria-hidden":`true`}),`ForgeQE`]}),e.stories[0]&&(0,Q.jsx)(`span`,{children:e.stories[0]}),(0,Q.jsx)(ct,{tags:e.tags,max:2})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 @xl:hidden`,children:[(0,Q.jsx)(at,{a:e.automation}),(0,Q.jsx)(ot,{o:e.lastRun.outcome})]})]})}),(0,Q.jsx)(`td`,{className:F(q,`hidden min-w-[120px] max-w-[220px] text-body-sm text-ink-2 [overflow-wrap:anywhere] @2xl:table-cell`),children:e.suite??e.plans[0]??`–`}),(0,Q.jsx)(`td`,{className:F(q,`hidden text-body-sm @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Q.jsxs)(`td`,{className:F(q,`hidden @xl:table-cell`),children:[(0,Q.jsx)(at,{a:e.automation}),e.stale&&(0,Q.jsx)(`span`,{className:`mt-1 block text-body-sm text-warn`,children:`Steps changed`})]}),(0,Q.jsx)(`td`,{className:F(q,`hidden @4xl:table-cell`),"data-sort":e.runs.length?e.runs.filter(e=>e===`p`).length/e.runs.length:-1,children:(0,Q.jsx)(st,{runs:e.runs})}),(0,Q.jsx)(`td`,{className:F(q,`hidden @xl:table-cell`),"data-sort":e.lastRun.at&&Date.parse(e.lastRun.at)||0,children:(0,Q.jsxs)(`span`,{"data-tip":e.lastRun.at?`${J(e.lastRun.at)}${e.lastRun.by===`tracker`?`, in its system`:``}`:void 0,children:[(0,Q.jsx)(ot,{o:e.lastRun.outcome}),e.lastRun.at&&(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`, `,J(e.lastRun.at),e.lastRun.by===`tracker`?`, in its system`:``]})]})}),(0,Q.jsx)(`td`,{className:F(q,`text-right whitespace-nowrap`),children:(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":mt(e)?`Run again`:`Run`,onClick:()=>i([e.key]),children:(0,Q.jsx)(u,{"aria-hidden":`true`})})})]},e.key))}),(0,Q.jsx)(et,{kind:S,keys:n,onClose:()=>C(null),onDone:e=>a(e)}),(0,Q.jsx)(Nt,{open:_,keys:n,onClose:()=>v(!1),onDone:e=>a(e)}),(0,Q.jsx)(Pt,{open:y,keys:n,onClose:()=>x(!1),onDone:e=>a(e)})]})}function Nt({open:e,keys:t,onClose:n,onDone:r}){let[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,m]=(0,X.useState)(null),h=`${o?`-`:`+`}${i.trim()}|${t.join(`
4
- `)}`,g=f?.asked===h?f:null;(0,X.useEffect)(()=>{e||m(null)},[e]);let _=async()=>{d(!0),l(``);try{let e={[o?`remove`:`add`]:[i.trim()],cases:t};if(!g){let t=await Z.tag(e);m({asked:h,items:t.preview?.items??0});return}let s=await Z.tag(e,!0);m(null),r(`${o?`Removed`:`Added`} the tag ${i.trim()} ${o?`from`:`on`} ${s.changed??0} case${s.changed===1?``:`s`}.`),a(``),n()}catch(e){l(e.message)}finally{d(!1)}};return(0,Q.jsx)(K,{open:e,onClose:n,title:`Tag ${t.length} test case${t.length===1?``:`s`}`,description:`ForgeQE keeps its tags in .forgeqe/testmgmt/tags.json, shared with the team through the repository. The case's own tags in its system do not change.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(L,{onClick:n,children:[(0,Q.jsx)(p,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(L,{variant:`primary`,disabled:u||!i.trim()||!!g&&g.items===0,onClick:()=>void _(),children:[(0,Q.jsx)(de,{"aria-hidden":`true`}),g?`${o?`Remove from`:`Add to`} ${g.items}`:`Preview`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Tag`,(0,Q.jsx)(N,{value:i,maxLength:40,placeholder:`smoke, release-24.11`,onChange:e=>a(e.target.value)})]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Ie,{checked:o,onCheckedChange:s}),`Remove it instead`]}),g&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-ink-2`,children:g.items===0?`No case would change.`:`${g.items} case${g.items===1?``:`s`} would change. ${o?`Remove`:`Add`} to confirm.`}),c&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:c})]})})}function Pt({open:e,keys:t,onClose:n,onDone:r}){let[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(!1),u=async()=>{l(!0),s(``);try{let{suite:e}=await Z.saveSuite({name:i.trim(),groups:[],exclude:[],picked:t});r(`Made the suite ${e.name}.`),a(``),n(),location.hash=k(`test-management`,`suites`,e.id)}catch(e){s(e.message)}finally{l(!1)}};return(0,Q.jsx)(K,{open:e,onClose:n,title:`A suite of ${t.length} test case${t.length===1?``:`s`}`,description:`Kept in .forgeqe/testmgmt/suites.json. For a suite that keeps up as plans change, ask the Suite agent on Suites.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(L,{onClick:n,children:[(0,Q.jsx)(p,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(L,{variant:`primary`,disabled:c||!i.trim(),onClick:()=>void u(),children:[(0,Q.jsx)(j,{"aria-hidden":`true`}),`Make the suite`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Name`,(0,Q.jsx)(N,{value:i,maxLength:80,placeholder:`Saved cards`,onChange:e=>a(e.target.value)})]}),o&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:o})]})})}var Ft=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString([],{month:`short`,day:`numeric`,timeZone:`UTC`}),It=(e,t)=>t?Math.round(e/t*100):0;function Lt(e,t,n){if(e.length<2)return;let r=e.at(-1),i=new Date(`${r.day}T00:00:00Z`).getTime()-6048e5,a=e.findLast(e=>new Date(`${e.day}T00:00:00Z`).getTime()<=i)??e[0],o=t(r)-t(a);return{text:`${o>0?`+`:``}${o}`,dir:o>0?`up`:o<0?`down`:`same`,...n===void 0||o===0?{}:{good:o>0===n},against:`since ${Ft(a.day)}`}}function Rt({view:e,onRunSuite:t}){let r=e.summary;if(!r.cases&&!e.plans.length&&r.tests)return(0,Q.jsx)(V,{icon:i,title:`${r.tests} automated test${r.tests===1?``:`s`} found, no test case yet`,action:(0,Q.jsxs)(`a`,{className:z({size:`sm`}),href:k(`test-management`,`tests`),"data-tip":`Open the Automated tab`,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`}),`Tests`]}),children:`These are the tests in the automation repository's code. Add a test plan in Settings › Integrations (Azure DevOps, Xray, TestRail, Zephyr Scale or qTest) to see the test cases they cover, which are automated and which are not.`});if(!r.cases&&!e.plans.length)return(0,Q.jsx)(V,{icon:y,title:`No test plans connected yet`,action:(0,Q.jsxs)(`a`,{className:z({size:`sm`}),href:k(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`}),`Settings`]}),children:`Add a test plan under Test plans in Test management, in your test case system's settings (Azure DevOps, Xray, TestRail, Zephyr Scale or qTest). Its cases show here with their automation, runs and gaps. Cases ForgeQE wrote or automated show here already.`});let s=e.trend;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(Oe,{label:`Headline numbers`,children:[(0,Q.jsx)(U,{label:`Test cases`,icon:y,value:r.cases,change:Lt(s,e=>e.cases,void 0),note:`${e.plans.length} plan${e.plans.length===1?``:`s`}`}),(0,Q.jsx)(U,{label:`Automated`,icon:o,value:`${r.automated} · ${It(r.automated,r.cases)}%`,change:Lt(s,e=>e.automated,!0),note:`${r.newlyAutomated} newly this week`}),(0,Q.jsx)(U,{label:`Not automated`,icon:l,value:r.notAutomated,change:Lt(s,e=>e.notAutomated,!1)}),(0,Q.jsx)(U,{label:`Pending`,icon:fe,value:r.pending,tone:r.pending?`text-warn`:void 0,change:Lt(s,e=>e.pending,!1),note:`in Design or not ready`}),(0,Q.jsx)(U,{label:`Failing`,icon:d,value:r.failing,tone:r.failing?`text-fail`:void 0,change:Lt(s,e=>e.failing,!1),note:`their last run`}),(0,Q.jsx)(U,{label:`Generated by ForgeQE`,icon:b,value:r.generated,change:Lt(s,e=>e.generated,!0)})]}),(0,Q.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-2`,children:[(0,Q.jsx)(Y,{icon:re,title:`Automation coverage`,divider:!1,className:R,children:(0,Q.jsx)(ut,{label:`Share of test cases automated`,points:s.map(e=>({x:Ft(e.day),y:It(e.automated,e.cases)})),format:e=>`${e}%`})}),(0,Q.jsx)(Y,{icon:n,title:`Generated and automated, by week`,divider:!1,className:R,children:(0,Q.jsx)(dt,{label:`Test cases generated and automated each week`,empty:`Nothing generated or automated in these weeks yet.`,series:[{name:`Generated`,className:`bg-accent-line`},{name:`Automated`,className:`bg-accent`}],items:e.weekly.map(e=>({x:Ft(e.week),values:[e.generated,e.automated]}))})}),(0,Q.jsxs)(Y,{icon:u,title:`Last run of every case`,divider:!1,className:R,children:[(0,Q.jsxs)(`div`,{role:`img`,"aria-label":`Passed ${r.cases-r.failing-r.neverRun}, failing ${r.failing}, not run ${r.neverRun}`,className:`flex h-3 gap-1 overflow-hidden rounded-full`,children:[(0,Q.jsx)(`span`,{className:`bg-pass`,style:{flex:r.cases-r.failing-r.neverRun}}),(0,Q.jsx)(`span`,{className:`bg-fail`,style:{flex:r.failing}}),(0,Q.jsx)(`span`,{className:`bg-line-strong`,style:{flex:r.neverRun}})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-4 text-body-sm`,children:[(0,Q.jsx)(`a`,{href:k(`test-management`,`cases`),className:`no-underline`,children:(0,Q.jsxs)(B,{tone:`pass`,children:[`Passed `,r.cases-r.failing-r.neverRun]})}),(0,Q.jsx)(`a`,{href:k(`test-management`,`gaps`),className:`no-underline`,children:(0,Q.jsxs)(B,{tone:`fail`,children:[`Failing `,r.failing]})}),(0,Q.jsx)(`a`,{href:k(`test-management`,`gaps`),className:`no-underline`,children:(0,Q.jsxs)(B,{tone:`neutral`,children:[`Not run `,r.neverRun]})})]})]}),(0,Q.jsx)(Y,{icon:j,title:`Automated, by suite`,divider:!1,className:R,actions:(0,Q.jsx)(`a`,{href:k(`test-management`,`gaps`),className:`text-body-sm`,children:`Find gaps`}),children:e.coverage.length?e.coverage.slice(0,8).map(e=>(0,Q.jsx)(ft,{label:e.suite,part:e.automated,whole:e.cases},e.suite)):(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No suites yet.`})})]}),(0,Q.jsx)(G,{label:`Suites`,placeholder:`Find a suite`,empty:`No suites yet: ask the Suite agent for one on Suites.`,search:e.suites.length>8,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Suite`}),(0,Q.jsx)(`th`,{scope:`col`,className:je,children:`Cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.suites.map(e=>(0,Q.jsxs)(`tr`,{className:Se,onClick:()=>location.hash=k(`test-management`,`suites`,e.id),children:[(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(`a`,{href:k(`test-management`,`suites`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium`,children:e.name})}),(0,Q.jsx)(`td`,{className:Me,children:e.cases}),(0,Q.jsx)(`td`,{className:q,"data-sort":e.last&&Date.parse(e.last.at)||0,children:e.last?(0,Q.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2 text-body-sm`,children:[(0,Q.jsxs)(B,{tone:e.last.failed?`fail`:`pass`,children:[e.last.passed,` passed`,e.last.failed?`, ${e.last.failed} failed`:``]}),(0,Q.jsx)(`span`,{className:`text-muted`,children:J(e.last.at)})]}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not run`})}),(0,Q.jsxs)(`td`,{className:`${q} text-right whitespace-nowrap`,onClick:e=>e.stopPropagation(),children:[!!e.last?.failed&&(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Rerun the failed cases of ${e.name}`,"data-tip":`Rerun failed`,onClick:()=>t(e.id,`failed`),children:(0,Q.jsx)(a,{"aria-hidden":`true`})}),(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.name}`,"data-tip":`Run`,onClick:()=>t(e.id),children:(0,Q.jsx)(u,{"aria-hidden":`true`})})]})]},e.id))}),(0,Q.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsx)(i,{size:14,"aria-hidden":`true`}),r.tests,` automated tests known, `,r.testsWithoutCase,` with no test case behind them.`]})]})}var zt=e=>e&&/^https:\/\//i.test(e)?e:void 0;function Bt({id:e,title:t,url:n}){let r=zt(n);return(0,Q.jsxs)(`span`,{className:`flex min-w-[220px] flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t}),r?(0,Q.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:`font-mono text-body-sm text-accent-fg`,children:e}):(0,Q.jsx)(`span`,{className:`font-mono text-body-sm text-accent-fg`,children:e})]})}var Vt={azure_devops:[{key:`sprint`,label:`Sprint`,placeholder:`current, or Sprint 24`},{key:`iteration`,label:`Iteration path`,placeholder:`Shop\\Release 3`},{key:`area`,label:`Area path`,placeholder:`Shop\\Checkout`},{key:`parent`,label:`Epic or feature`,placeholder:`1234`,number:!0},{key:`ids`,label:`Work item ids`,placeholder:`101, 102`,list:`numbers`},{key:`project`,label:`Project`,placeholder:`When Settings names none`}],jira:[{key:`sprint`,label:`Sprint`,placeholder:`current, or Sprint 24`},{key:`fixVersion`,label:`Fix version`,placeholder:`2.4.0`},{key:`epic`,label:`Epic`,placeholder:`SHOP-12`},{key:`keys`,label:`Story keys`,placeholder:`SHOP-101, SHOP-102`,list:`keys`},{key:`project`,label:`Project key`,placeholder:`SHOP`}],qtest:[{key:`module`,label:`Requirements module`,placeholder:`Module id, e.g. 1203`,number:!0},{key:`ids`,label:`Requirement ids`,placeholder:`5101, 5102`,list:`numbers`}]};function Ht(e,t){let n={system:e};for(let r of Vt[e]){let i=(t[r.key]??``).trim();i&&(r.list===`numbers`?n[r.key]=i.split(/[\s,]+/).filter(Boolean).map(Number):r.list===`keys`?n[r.key]=i.split(/[\s,]+/).filter(Boolean).map(e=>e.toUpperCase()):r.number?n[r.key]=Number(i):n[r.key]=r.key===`project`&&e===`jira`?i.toUpperCase():i)}return n}var Ut=e=>Object.fromEntries(Object.entries(e??{}).filter(([e])=>e!==`system`).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]));function Wt({gaps:e,onRead:t}){let[n,r]=(0,X.useState)(e.live?.system??`azure_devops`),[i,a]=(0,X.useState)(Ut(e.live)),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(``);(0,X.useEffect)(()=>{e.live&&(r(e.live.system),a(Ut(e.live)))},[e.live]);let u=async()=>{s(!0),l(``);try{await Z.readStories(Ht(n,i)),t()}catch(e){l(e.message)}finally{s(!1)}};return(0,Q.jsxs)(`form`,{className:F(R,`flex flex-col gap-4`),onSubmit:e=>{e.preventDefault(),u()},children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-sm`,children:[(0,Q.jsx)(`span`,{className:`text-muted`,children:`Stories in`}),(0,Q.jsxs)(M,{size:`sm`,value:n,onChange:e=>(r(e.target.value),a({})),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:`azure_devops`,children:`Azure DevOps`}),(0,Q.jsx)(`option`,{value:`jira`,children:`Jira (also Xray and Zephyr Scale)`}),(0,Q.jsx)(`option`,{value:`qtest`,children:`qTest requirements`})]})]}),Vt[n].map(e=>(0,Q.jsxs)(`label`,{className:`flex min-w-[140px] flex-[1_1_140px] flex-col gap-1 text-body-sm`,children:[(0,Q.jsx)(`span`,{className:`text-muted`,children:e.label}),(0,Q.jsx)(N,{size:`sm`,value:i[e.key]??``,maxLength:e.list?2e3:200,placeholder:e.placeholder,onChange:t=>a({...i,[e.key]:t.target.value})})]},e.key)),(0,Q.jsxs)(L,{size:`sm`,variant:`primary`,type:`submit`,disabled:o||!Vt[n].some(e=>e.key!==`project`&&(i[e.key]??``).trim()),children:[(0,Q.jsx)(f,{"aria-hidden":`true`}),o?`Reading…`:`Read`]})]}),c&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:c})]})}function Gt({kind:e,gaps:t,picked:n=[],onPick:r=()=>{},onRead:i=()=>{}}){let a=(0,Q.jsx)(Wt,{gaps:t,onRead:i});if(!t.report)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a,(0,Q.jsx)(V,{icon:se,title:`No stories read yet`,children:`Say which stories to read: a sprint, an iteration, an area, an epic or the ids. ForgeQE reads each story with its test cases and acceptance criteria from the tracker, as Release readiness does, and reads them again with every sync.`})]});let o=(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[t.report.id===`live`?`Read from the tracker${t.report.at?` ${J(t.report.at)}`:``}: ${t.report.scope}`:`From the readiness report of ${t.report.scope||t.report.id}`,` (`,t.stories,` stor`,t.stories===1?`y`:`ies`,`).`,e===`stories`&&n.length>0&&` ${n.length} picked for the Gap agent's "Cases for stories".`]}),s=new Set(t.noCase.map(e=>e.id)),c=new Set(n.filter(e=>s.has(e)));return e===`stories`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o,(0,Q.jsx)(G,{label:`Stories with no test case`,placeholder:`Find a story`,empty:`Every story of the release has a test case.`,selection:{count:c.size,onClear:()=>r([])},head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`w-10`),children:(0,Q.jsx)(Ie,{"aria-label":`Pick every story shown`,checked:t.noCase.length>0&&t.noCase.every(e=>c.has(e.id)),onCheckedChange:e=>r(e?t.noCase.map(e=>e.id).slice(0,50):[])})}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`w-[55%]`),children:`Story`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @2xl:table-cell`),children:`Type`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`State`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @2xl:table-cell`),children:`Area`})]}),children:t.noCase.map(e=>(0,Q.jsxs)(`tr`,{className:H,"data-state":c.has(e.id)?`selected`:void 0,children:[(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(Ie,{"aria-label":`Pick ${e.id}`,checked:c.has(e.id),onCheckedChange:t=>r(t?[...c,e.id].slice(0,50):[...c].filter(t=>t!==e.id))})}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(Bt,{id:e.id,title:e.title,url:e.url})}),(0,Q.jsx)(`td`,{className:F(q,`hidden text-body-sm @2xl:table-cell`),children:e.type||`–`}),(0,Q.jsx)(`td`,{className:q,children:e.state?(0,Q.jsx)(B,{tone:`neutral`,icon:!1,children:e.state}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`–`})}),(0,Q.jsx)(`td`,{className:F(q,`hidden text-body-sm @2xl:table-cell [overflow-wrap:anywhere]`),children:e.area||`–`})]},e.id))})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o,(0,Q.jsx)(G,{label:`Acceptance criteria no test case covers`,placeholder:`Find a criterion`,empty:`Every traced acceptance criterion has a test case.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`w-[55%]`),children:`Criterion`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Story`})]}),children:t.criteria.map((e,t)=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:F(q,`[overflow-wrap:anywhere]`),children:e.text}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(Bt,{id:e.story,title:e.storyTitle,url:e.url})})]},`${e.story}-${t}`))})]})}var Kt=[{id:`stories`,label:`Stories with no case`,icon:se},{id:`criteria`,label:`Criteria not covered`,icon:y}],qt=[{id:`not_automated`,label:`Not automated`,icon:l},{id:`pending`,label:`Pending`,icon:fe},{id:`never_run`,label:`Never run`,icon:l},{id:`failing`,label:`Failing`,icon:d,alert:!0},{id:`stale`,label:`Steps changed`,icon:r},{id:`drift`,label:`Tracker disagrees`,icon:r},{id:`no_case`,label:`Tests with no case`,icon:i}];function Jt({gaps:e,cases:t,tests:n,selected:r,onSelect:i,onRun:a,pickedStories:o=[],onPickStories:s=()=>{},onStoriesRead:c=()=>{}}){let[l,d]=(0,X.useState)(t.length||!n.length?`not_automated`:`no_case`),f=new Map(t.map(e=>[e.key,e])),p=new Map(e.ranked.map(e=>[e.key,e.why])),m=e.ranked.map(e=>e.key),h=new Set(m),g=l===`no_case`||l===`stories`||l===`criteria`?[]:l===`not_automated`?[...m,...e.lists.not_automated.filter(e=>!h.has(e))]:e.lists[l],_=e.stories??{stories:0,noCase:[],criteria:[]},v={stories:_.noCase.length,criteria:_.criteria.length},b=g.map(e=>f.get(e)).filter(e=>!!e),x=new Set(r),S=(e,t)=>i(t?[...r,e]:r.filter(t=>t!==e)),C=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsx)(lt,{label:`Gaps to show`,items:[...qt.map(t=>({id:t.id,label:t.label,n:e.counts[t.id],...t.alert?{alert:!0}:{}})),...Kt.map(e=>({id:e.id,label:e.label,n:v[e.id],tip:_.report?_.report.id===`live`?`Read from the tracker: ${_.report.scope}`:`From the readiness report of ${_.report.scope||_.report.id}`:`Read the release's stories from the tracker first`}))],value:l,onChange:e=>d(e)}),l===`not_automated`&&b.length>0&&(0,Q.jsxs)(L,{size:`sm`,onClick:()=>i(b.slice(0,20).map(e=>e.key)),"data-tip":`Pick the 20 that matter most: priority, failing when run, in a pack, tagged smoke`,children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Top 20`]})]});return(0,Q.jsx)(`div`,{className:`flex flex-col gap-6`,children:l===`stories`||l===`criteria`?(0,Q.jsxs)(Q.Fragment,{children:[C,(0,Q.jsx)(Gt,{kind:l,gaps:_,picked:o,onPick:s,onRead:c})]}):l===`no_case`?(0,Q.jsx)(G,{label:`Tests with no test case`,placeholder:`Find a test`,height:Ee,empty:`Every test ForgeQE knows has a test case behind it.`,tools:C,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`w-[55%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Tags`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Last runs`})]}),children:e.testsWithoutCase.map(e=>{let t=n.find(t=>t.key===e);return t?(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsxs)(`td`,{className:q,children:[t.uid?(0,Q.jsx)(`a`,{href:gt(t.uid),className:`font-medium [overflow-wrap:anywhere]`,children:t.name}):(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t.name}),t.file&&(0,Q.jsx)(`span`,{className:`block font-mono text-body-sm text-muted [overflow-wrap:anywhere]`,children:t.file}),t.flaky&&(0,Q.jsx)(B,{tone:`warn`,className:`mt-1`,children:`Flaky`})]}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(ct,{tags:t.tags})}),(0,Q.jsx)(`td`,{className:q,"data-sort":t.runs.length?t.runs.filter(e=>e===`p`).length/t.runs.length:-1,children:(0,Q.jsx)(st,{runs:t.runs})})]},e):null})}):(0,Q.jsx)(G,{label:qt.find(e=>e.id===l).label,placeholder:`Find a case`,resetKey:l,height:Ee,selection:{count:r.length,onClear:()=>i([])},empty:`No gap of this kind.`,tools:C,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`w-10`),children:(0,Q.jsx)(Ie,{"aria-label":`Select every case shown`,checked:b.length>0&&b.every(e=>x.has(e.key)),onCheckedChange:e=>i(e?[...new Set([...r,...b.map(e=>e.key)])]:r.filter(e=>!b.some(t=>t.key===e)))})}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @2xl:table-cell`),children:`Priority`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @xl:table-cell`),children:l===`not_automated`?`Why it matters`:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @2xl:table-cell`),children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:b.map(e=>(0,Q.jsxs)(`tr`,{className:H,"data-state":x.has(e.key)?`selected`:void 0,children:[(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(Ie,{"aria-label":`Select ${e.id}`,checked:x.has(e.key),onCheckedChange:t=>S(e.key,t)})}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsxs)(`a`,{href:ht(e.key),className:`flex min-w-[160px] flex-col gap-1 text-ink no-underline @xl:min-w-[220px]`,children:[(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.id}),e.suite&&(0,Q.jsx)(`span`,{children:e.suite}),(0,Q.jsx)(ct,{tags:e.tags,max:2})]}),(0,Q.jsx)(`span`,{className:`flex flex-wrap items-center gap-1 @xl:hidden`,children:l===`not_automated`?(p.get(e.key)??[]).map(e=>(0,Q.jsx)(B,{tone:`running`,icon:!1,children:e},e)):(0,Q.jsx)(at,{a:e.automation})})]})}),(0,Q.jsx)(`td`,{className:F(q,`hidden text-body-sm @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Q.jsx)(`td`,{className:F(q,`hidden @xl:table-cell`),children:l===`not_automated`?(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-1`,children:[(p.get(e.key)??[]).map(e=>(0,Q.jsx)(B,{tone:`running`,icon:!1,children:e},e)),!(p.get(e.key)??[]).length&&(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`–`})]}):(0,Q.jsx)(at,{a:e.automation})}),(0,Q.jsx)(`td`,{className:F(q,`hidden @2xl:table-cell`),children:(0,Q.jsx)(ot,{o:e.lastRun.outcome})}),(0,Q.jsx)(`td`,{className:F(q,`text-right`),children:(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":`Run`,onClick:()=>a([e.key]),children:(0,Q.jsx)(u,{"aria-hidden":`true`})})})]},e.key))})})}var Yt=e=>e.from===`report`?`From the run's own report`:`From each case's latest result since the run started (its report is not written yet)`,Xt={system:`system`,plan:`plan`,suite:`suite`,priority:`priority`,state:`state`,automation:`automation`,tag:`tag`,last_run:`last run`,origin:`origin`,stale:`steps changed`,in_pack:`in pack`};function Zt({suites:e,onRun:t}){return(0,Q.jsx)(G,{label:`Suites`,placeholder:`Find a suite`,height:Ee,empty:e.length?`Nothing matches.`:`No suites yet. Tell the Suite agent what a suite is for, such as “regression for the payments suite, P1 and anything failing lately”: it picks the cases from your plans, tags and runs.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`w-[40%]`),children:`Suite`}),(0,Q.jsx)(`th`,{scope:`col`,className:je,children:`Cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(je,`hidden @xl:table-cell`),children:`Automated`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.map(e=>(0,Q.jsxs)(`tr`,{className:Se,onClick:()=>location.hash=k(`test-management`,`suites`,e.id),children:[(0,Q.jsxs)(`td`,{className:F(q,`max-w-0`),children:[(0,Q.jsxs)(`a`,{href:k(`test-management`,`suites`,e.id),onClick:e=>e.stopPropagation(),className:`flex items-center gap-2 font-medium`,children:[e.built===`agent`?(0,Q.jsx)(b,{size:14,"aria-hidden":`true`,className:`flex-none`}):(0,Q.jsx)(j,{size:14,"aria-hidden":`true`,className:`flex-none`}),(0,Q.jsx)(it,{text:e.name})]}),e.description&&(0,Q.jsx)(it,{text:e.description,className:`mt-1 text-body-sm text-muted`})]}),(0,Q.jsx)(`td`,{className:Me,children:e.cases}),(0,Q.jsxs)(`td`,{className:F(Me,`hidden @xl:table-cell`),children:[e.cases?Math.round(e.automated/e.cases*100):0,`%`]}),(0,Q.jsx)(`td`,{className:q,"data-sort":e.last&&Date.parse(e.last.at)||0,children:e.last?(0,Q.jsxs)(`span`,{className:`flex flex-col items-start gap-1 text-body-sm`,"data-tip":Yt(e.last),children:[(0,Q.jsxs)(B,{tone:e.last.failed?`fail`:`pass`,children:[e.last.passed,` passed`,e.last.failed?`, ${e.last.failed} failed`:``]}),(0,Q.jsx)(`span`,{className:`text-muted`,children:J(e.last.at)})]}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not run`})}),(0,Q.jsxs)(`td`,{className:F(q,`text-right whitespace-nowrap`),onClick:e=>e.stopPropagation(),children:[!!e.last?.failed&&(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Rerun the failed cases of ${e.name}`,"data-tip":`Rerun failed`,onClick:()=>t(e.id,`failed`),children:(0,Q.jsx)(a,{"aria-hidden":`true`})}),(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.name}`,"data-tip":`Run`,onClick:()=>t(e.id),children:(0,Q.jsx)(u,{"aria-hidden":`true`})})]})]},e.id))})}function Qt({id:e,onRun:t,onDeleted:n}){let[r,i]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1);(0,X.useEffect)(()=>{i(null),Z.suite(e).then(e=>{i(e),s(``)},e=>s(e.message))},[e]);let m=(0,Q.jsx)(xe,{to:{href:k(`test-management`,`suites`),label:`All suites`}});if(o)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[m,(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:o})]});if(!r)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});let h=r.suite,g=r.members.filter(e=>e.case.lastRun.outcome===`failed`||e.case.lastRun.outcome===`blocked`).length;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[m,(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[(0,Q.jsx)(Fe,{icon:j,title:h.name}),h.description&&(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:h.description}),h.tracker&&(0,Q.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[`Kept as`,` `,Xe(h.tracker)?(0,Q.jsx)(`a`,{href:Xe(h.tracker),target:`_blank`,rel:`noreferrer noopener`,children:Ze(h.tracker)}):Ze(h.tracker)]})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(h.tracker||r.targets.length>0)&&(0,Q.jsxs)(L,{onClick:()=>f(!0),"data-tip":h.tracker?`Keep it in step with its tracker`:`Keep it in a tracker`,children:[(0,Q.jsx)(te,{"aria-hidden":`true`}),h.tracker?`Update`:`Keep`]}),(0,Q.jsxs)(L,{variant:`danger`,onClick:()=>l(!0),children:[(0,Q.jsx)(ue,{"aria-hidden":`true`}),`Delete`]}),g>0&&(0,Q.jsxs)(L,{onClick:()=>t(h.id,`failed`),children:[(0,Q.jsx)(a,{"aria-hidden":`true`}),`Rerun `,g,` failed`]}),(0,Q.jsxs)(L,{variant:`primary`,onClick:()=>t(h.id),children:[(0,Q.jsx)(u,{"aria-hidden":`true`}),`Run`]})]})]}),(0,Q.jsxs)(Oe,{label:`The suite`,children:[(0,Q.jsx)(U,{compact:!0,label:`Cases`,value:h.cases,note:`${h.automated} automated`}),(0,Q.jsx)(U,{compact:!0,label:`Last run`,value:h.last?`${h.last.passed} passed`:`Not run`,tone:h.last?.failed?`text-fail`:void 0,note:h.last?`${h.last.failed} failed · ${J(h.last.at)}${h.last.from===`report`?``:` · so far`}`:void 0}),(0,Q.jsx)(U,{compact:!0,label:`Runs on`,value:h.env??`Active`,note:h.runs.length?`${h.runs.length} run${h.runs.length===1?``:`s`}`:`never run`}),(0,Q.jsx)(U,{compact:!0,label:`Built`,value:h.built===`agent`?`Suite agent`:h.built===`rules`?`Rules`:`Picked`,note:`updated ${J(h.updatedAt)}`})]}),h.groupsCount.length>0&&(0,Q.jsx)(Y,{level:3,icon:T,title:`Why these cases`,className:F(`rounded-lg bg-bg p-6 shadow-sm`,`text-body-sm`),children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:h.groupsCount.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`text-muted`,children:h.groups[t]?.rules.map(e=>`${Xt[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(` and `)}),(0,Q.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.cases})]},e.label))})}),(0,Q.jsx)(G,{label:`Cases`,placeholder:`Find a case`,empty:`No case meets the suite's rules now.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`w-[45%]`),children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @xl:table-cell`),children:`Why it is in`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Last run`})]}),children:r.members.map(e=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:F(q,`max-w-0`),children:(0,Q.jsxs)(`a`,{href:ht(e.case.key),className:`flex min-w-0 flex-col gap-1 text-ink no-underline`,children:[(0,Q.jsx)(it,{text:e.case.title,className:`font-medium`}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.case.id}),(0,Q.jsx)(ct,{tags:e.case.tags})]})]})}),(0,Q.jsx)(`td`,{className:F(q,`hidden text-body-sm text-ink-2 @xl:table-cell`),children:e.group}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(at,{a:e.case.automation})}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(ot,{o:e.case.lastRun.outcome})})]},e.case.key))}),(0,Q.jsx)(tt,{open:d,suite:h,targets:r.targets,onClose:()=>f(!1),onDone:()=>void Z.suite(e).then(i,()=>{})}),(0,Q.jsx)(K,{open:c,onClose:()=>l(!1),title:`Delete ${h.name}?`,description:`The suite goes from .forgeqe/testmgmt/suites.json. Its cases and their runs stay.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(L,{onClick:()=>l(!1),children:[(0,Q.jsx)(p,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(L,{variant:`destructive`,onClick:()=>void Z.deleteSuite(h.id).then(()=>{l(!1),n()},e=>s(e.message)),children:[(0,Q.jsx)(ue,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,Q.jsx)(`p`,{className:`m-0 pt-4 text-body-sm text-ink-2`,children:`Runs already made are kept in Runs.`})})]})}function $t({open:e,onSaved:t}){let[n,r]=(0,X.useState)([]),[i,a]=(0,X.useState)(``),[o,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(``),d=n.findLast(e=>`built`in e)?.built,f=n.filter(e=>`you`in e).map(e=>e.you).join(`. `),p=async t=>{let n=t.trim();if(n){c(!0),u(``),r(e=>[...e,{you:n}]),a(``);try{let t=await Z.buildSuite(f?`${f}. ${n}`:n,e?.id);r(e=>[...e,{built:t}])}catch(e){u(e.message)}finally{c(!1)}}},m=async n=>{if(d){c(!0);try{let{suite:i}=await Z.saveSuite({...n&&e?{id:e.id}:{},name:n&&e?e.name:d.name,description:d.summary,groups:d.groups,exclude:d.exclude,built:`agent`});r([]),t(i)}catch(e){u(e.message)}finally{c(!1)}}};return(0,Q.jsxs)(We,{title:`Suite agent`,about:`Builds and changes suites from your plans, tags and runs.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(e?[`Leave out cases that are not automated`,`Add everything failing lately`,`Only priority 1 and 2`]:[`Smoke suite`,`P1 cases that failed lately`,`Everything not automated in one suite`]).map(e=>(0,Q.jsxs)(L,{size:`sm`,disabled:o,onClick:()=>void p(e),children:[(0,Q.jsx)(b,{"aria-hidden":`true`}),e]},e))}),(0,Q.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),p(i)},children:[(0,Q.jsx)(`label`,{className:`sr-only`,htmlFor:`tm-suite-words`,children:`Tell the Suite agent what the suite is for`}),(0,Q.jsx)(me,{id:`tm-suite-words`,rows:2,maxLength:1e3,value:i,placeholder:e?`Change ${e.name}, or ask about it`:`Describe the suite you need, e.g. regression for Payments under 30 minutes`,onChange:e=>a(e.target.value),className:`min-h-11 flex-1 resize-none`}),(0,Q.jsx)(L,{size:`icon`,variant:`primary`,type:`submit`,disabled:o||!i.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,Q.jsx)(S,{"aria-hidden":`true`})})]})]}),children:[(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,Q.jsx)(ye,{state:o?`thinking`:`working`,px:96,label:o?`Building the suite`:`Ready`}),(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:o?`Building the suite…`:e?`Looking at ${e.name}.`:`Ready. Say what the suite is for.`})]}),n.map((e,t)=>`you`in e?(0,Q.jsx)(`p`,{className:`m-0 text-center text-body-lg leading-relaxed text-ink-2`,children:e.you},t):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`p`,{className:`m-0 text-center text-headline-sm`,children:[e.built.name,`: `,e.built.cases,` case`,e.built.cases===1?``:`s`,`, `,e.built.automated,` automated.`]}),e.built.summary&&(0,Q.jsx)(`p`,{className:`m-0 text-center text-body-sm text-ink-2`,children:e.built.summary}),e.built.note&&(0,Q.jsx)(`p`,{className:`m-0 text-center text-body-sm text-muted`,children:e.built.note}),(0,Q.jsxs)(`div`,{className:F(R,`flex flex-col gap-2 text-body-sm`),children:[e.built.perGroup.map(e=>(0,Q.jsxs)(`span`,{className:`flex items-baseline gap-2`,"data-tip":e.why,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.cases})]},e.label)),e.built.exclude.length>0&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[`Leaves out: `,e.built.exclude.map(e=>`${Xt[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(`, `)]})]}),e.built.question&&t===n.length-1&&(0,Q.jsxs)(`div`,{className:F(`rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2 text-body-sm`),children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.built.question.text}),e.built.question.options.map(e=>(0,Q.jsx)(L,{size:`sm`,disabled:o,onClick:()=>void p(e),className:`justify-start`,children:e},e))]}),e.built.sample.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:e.built.sample.slice(0,5).map(e=>(0,Q.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`flex-none font-mono text-accent-fg`,children:e.case.id}),(0,Q.jsx)(it,{text:e.case.title,className:`min-w-0 text-ink-2`})]},e.case.key))})]},t)),l&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:l}),d&&(0,Q.jsxs)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:[e&&(0,Q.jsxs)(L,{disabled:o,onClick:()=>void m(!0),children:[(0,Q.jsx)(s,{"aria-hidden":`true`}),`Update `,e.name]}),(0,Q.jsxs)(L,{variant:`primary`,disabled:o,onClick:()=>void m(!1),"data-tip":e?`Save as a new suite`:`Save the suite`,children:[(0,Q.jsx)(s,{"aria-hidden":`true`}),e?`Save new`:`Save`]})]})]})}var en=[{id:`off`,label:`Off`,icon:l},{id:`hourly`,label:`Every hour`,icon:f},{id:`daily`,label:`Daily`,icon:le}];function tn(e){return!e||e.every===`off`?`Sync: off`:e.every===`hourly`?`Sync: hourly`:e.every===`daily`?`Sync: daily ${e.at}`:`Sync: custom`}function nn({disabled:e}){let[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(null);return(0,X.useEffect)(()=>{Z.schedule().then(e=>i(e.schedule),()=>{})},[]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(L,{size:`icon`,"aria-label":`Schedule`,disabled:e,onClick:()=>n(!0),"data-tip":`Schedule: ${tn(r)}${r?.nextAt?`, next ${Le(r.nextAt)}`:``}. Set when the plans are synced`,children:(0,Q.jsx)(le,{"aria-hidden":`true`})}),(0,Q.jsx)(on,{open:t,onClose:()=>n(!1),now:r,onSaved:i})]})}var rn=(e,t)=>!!e&&!!t&&e===t.digest&&t.steps.length>0,an=(e,t,n)=>e!==`off`&&t&&n&&n.steps.length>0?n.digest:void 0;function on({open:e,onClose:t,now:n,onSaved:r}){let[i,a]=(0,X.useState)(`off`),[o,c]=(0,X.useState)(`06:00`),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(!1),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(`loading`),[v,y]=(0,X.useState)(!1),b=n&&n.every!==`off`&&n.every!==`custom`?n.discover:void 0;(0,X.useEffect)(()=>{e&&(u(``),y(!1),h(null),_(`loading`),Z.discoveryPlan().then(e=>{h(e),_(`ready`),y(rn(b,e))},()=>_(`failed`)),a(n&&n.every!==`custom`?n.every:`off`),n?.every===`daily`&&c(n.at))},[e,n]);let x=async()=>{f(!0);try{let e=an(i,v,m),n=e?{discover:e}:{};r((await Z.setSchedule(i===`daily`?{every:i,at:o,...n}:i===`hourly`?{every:i,...n}:{every:i})).schedule),t()}catch(e){u(e.message)}finally{f(!1)}};return(0,Q.jsx)(K,{open:e,onClose:t,title:`Sync on a schedule`,description:`ForgeQE reads every case of the connected test plans again, as Sync does, and the stories Gaps read, in the jobs service (forgeqe testmgmt sync). It can also discover the tests first. It runs while this computer is on.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(L,{onClick:t,children:[(0,Q.jsx)(p,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(L,{variant:`primary`,disabled:d||g===`loading`||i===`daily`&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(o),onClick:()=>void x(),children:[(0,Q.jsx)(s,{"aria-hidden":`true`}),`Save`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":`When to sync`,className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(be,{items:en.map(e=>({id:e.id,label:e.label,icon:e.icon})),value:i,onChange:a})}),i===`daily`&&(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Time (this computer's clock)`,(0,Q.jsx)(N,{type:`time`,step:60,value:o,onChange:e=>c(e.target.value)})]}),i!==`off`&&m&&m.steps.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(Ie,{checked:v,onCheckedChange:e=>y(e===!0),"aria-label":`Also discover the tests`}),(0,Q.jsx)(`span`,{children:`Also discover the tests first. This runs the repository's code with these commands, with no secret of ForgeQE's. If the test projects change, the schedule stops discovering until you confirm again.`})]}),!!b&&b!==m.digest&&!v&&(0,Q.jsx)(`p`,{className:`m-0 text-warn`,children:`The test projects changed since discovery was agreed to: tick the box to agree to these commands, or the schedule only syncs.`}),v&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:m.steps.map((e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`font-mono text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.command})},t))})]}),i!==`off`&&g===`loading`&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Reading what discovery would run…`}),i!==`off`&&g===`failed`&&!!b&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 text-warn`,children:`What discovery would run could not be read, so saving here turns scheduled discovery off. Close and open this again to try once more.`}),n?.every===`custom`&&(0,Q.jsxs)(`p`,{className:`m-0 text-warn`,children:[`The sync job was changed outside this page (`,n.text,`). Saving here replaces it.`]}),n?.enabled===!1&&(0,Q.jsx)(`p`,{className:`m-0 text-warn`,children:`The sync job is disabled in the jobs service.`}),n?.last&&(0,Q.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`Last scheduled sync `,Le(n.last.at),`: `,n.last.status.replace(`_`,` `),`.`]}),l&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:l})]})})}var sn={forgeqe:{label:`ForgeQE`,icon:b},script:{label:`Tests`,icon:i}},cn=e=>sn[e]??{label:e===`azure_devops`?`Azure DevOps`:e===`jira`?`Jira`:e,icon:t},ln=e=>e!==`forgeqe`&&e!==`script`,un=[];function dn({tags:e,cases:t=[],onChanged:n}){let[r,i]=(0,X.useState)(`all`),[a,o]=(0,X.useState)(null),s=e=>e.system===`azure_devops`||e.system===`jira`,c=e=>t.filter(t=>t.ownTags.includes(e)&&!t.trackerTags.includes(e)&&s(t)).map(e=>e.key),l=e=>t.filter(t=>t.ownTags.includes(e)&&t.trackerTags.includes(e)&&s(t)).map(e=>e.key),u=e.tags.filter(e=>r===`all`||(r===`out`?e.outOfStep>0:r===`tracker`?e.from.some(ln):e.from.includes(r))),d=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap gap-x-6 gap-y-1 text-body-sm text-muted`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.tags.length}),` tag`,e.tags.length===1?``:`s`,` in use`]}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`b`,{className:`text-ink tabular-nums`,children:d(e.casesTagged,e.cases)}),` of test cases tagged (`,e.casesTagged,` of `,e.cases,`)`]}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`b`,{className:`text-ink tabular-nums`,children:d(e.testsTagged,e.tests)}),` of tests tagged (`,e.testsTagged,` of `,e.tests,`)`]}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`b`,{className:F(`tabular-nums`,e.tags.some(e=>e.outOfStep)?`text-warn`:`text-ink`),children:e.tags.filter(e=>e.outOfStep).length}),` out of step (a case's tag its test lacks)`]})]}),(0,Q.jsx)(G,{label:`Tags`,placeholder:`Find a tag`,height:Ee,resetKey:r,empty:e.tags.length?`Nothing matches.`:`No tags yet: tag cases in Test cases, or in their system.`,tools:(0,Q.jsx)(lt,{label:`Tags to show`,items:[{id:`all`,label:`All tags`,n:e.tags.length},{id:`tracker`,label:`From their systems`,n:e.tags.filter(e=>e.from.some(ln)).length},{id:`script`,label:`From tests`,n:e.tags.filter(e=>e.from.includes(`script`)).length},{id:`forgeqe`,label:`ForgeQE's`,n:e.tags.filter(e=>e.from.includes(`forgeqe`)).length},{id:`out`,label:`Out of step`,n:e.tags.filter(e=>e.outOfStep).length,alert:!0}],value:r,onChange:i}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`w-[28%]`),children:`Tag`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Comes from`}),(0,Q.jsx)(`th`,{scope:`col`,className:je,children:`Test cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:je,children:`Tests`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @xl:table-cell`),children:`Out of step`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @2xl:table-cell`),children:`Used by suites`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:u.map(e=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsxs)(B,{tone:`neutral`,icon:!1,children:[(0,Q.jsx)(de,{size:12,"aria-hidden":`true`}),e.name]})}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.from.map(e=>{let t=cn(e);return(0,Q.jsxs)(B,{tone:`neutral`,icon:!1,children:[(0,Q.jsx)(t.icon,{size:12,"aria-hidden":`true`}),t.label]},e)})})}),(0,Q.jsx)(`td`,{className:Me,children:e.cases}),(0,Q.jsx)(`td`,{className:Me,children:e.tests}),(0,Q.jsx)(`td`,{className:F(q,`hidden @xl:table-cell`),"data-sort":e.outOfStep||0,children:e.outOfStep?(0,Q.jsx)(B,{tone:`warn`,children:e.outOfStep}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`–`})}),(0,Q.jsx)(`td`,{className:F(q,`hidden text-body-sm text-ink-2 @2xl:table-cell`),children:e.suites.join(`, `)||`–`}),(0,Q.jsxs)(`td`,{className:F(q,`text-right`),children:[c(e.name).length>0&&(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Write the tag ${e.name} to the trackers of ${c(e.name).length} cases`,"data-tip":`Write to the trackers of ${c(e.name).length} cases`,onClick:()=>o({kind:`tags`,keys:c(e.name)}),children:(0,Q.jsx)(te,{"aria-hidden":`true`})}),l(e.name).length>0&&(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Take the tag ${e.name} off in the trackers of ${l(e.name).length} cases`,"data-tip":`Take off in the trackers of ${l(e.name).length} cases`,onClick:()=>o({kind:`untag`,keys:l(e.name),tags:[e.name]}),children:(0,Q.jsx)(w,{"aria-hidden":`true`})})]})]},e.name))}),(0,Q.jsx)(et,{kind:a?.kind??null,keys:a?.keys??un,tags:a?.tags,onClose:()=>o(null),onDone:e=>n?.(e)})]})}function fn({uid:e,cases:t,onChanged:n}){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(``),m=(0,X.useCallback)(()=>Z.test(e).then(e=>{i(e),o(``)},e=>o(e.message)),[e]);(0,X.useEffect)(()=>{i(null),m()},[m]);let h=(0,Q.jsx)(xe,{to:{href:k(`test-management`,`tests`),label:`Automated tests`}});if(a)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[h,(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:a})]});if(!r)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});let _=r.test,y=_.framework&&_.framework!==`code`?xt[_.framework]:`Not known yet`,b=e=>{f(``),u(e),n(e),m()},x=async(t,n)=>{try{await Z.link([{case:t,test:e,action:`unlink`}]),b(`Unlinked ${e} from ${n}. It is not linked again by itself.`)}catch(e){f(e.message)}};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[h,(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_420px] flex-col gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:_.uid}),` · `,y]}),(0,Q.jsx)(Fe,{icon:g,title:_.name}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[_.last&&(0,Q.jsx)(pn,{status:_.last.status}),_.flaky&&(0,Q.jsx)(B,{tone:`warn`,children:`Flaky`}),_.quarantined&&(0,Q.jsx)(B,{tone:`neutral`,children:`Quarantined`})]})]}),(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsxs)(L,{onClick:()=>c(!0),disabled:!t.length,"data-tip":`Link to a test case`,children:[(0,Q.jsx)(A,{"aria-hidden":`true`}),`Link`]})})]}),l&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:l}),d&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:d}),(0,Q.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsxs)(Y,{level:3,icon:g,title:`Code`,className:F(R,`text-body-sm`),children:[_.file&&(0,Q.jsxs)(`span`,{className:`font-mono text-muted [overflow-wrap:anywhere]`,children:[_.file,_.line?`:${_.line}`:``]}),r.source?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`pre`,{tabIndex:0,role:`region`,"aria-label":`Code of ${_.name}`,className:F(Ne,`m-0 max-h-[560px] whitespace-pre focus-visible:outline-offset-[-2px]`),children:r.source.lines.map((e,t)=>{let n=r.source.from+t;return(0,Q.jsxs)(`span`,{className:F(`flex`,n===_.line&&`bg-accent-soft`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`w-12 flex-none pr-4 text-right text-muted tabular-nums select-none`,children:n}),(0,Q.jsx)(`span`,{className:`pr-4 whitespace-pre`,children:e})]},n)})}),r.source.more&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[`Lines `,r.source.from,`–`,r.source.from+r.source.lines.length-1,` of `,r.source.total,`.`]})]}):(0,Q.jsx)(`p`,{className:`m-0 text-muted`,children:_.file?`Its file could not be read from the repository.`:`Known from runs only: no file is known for it.`})]}),(0,Q.jsx)(G,{label:`Linked test cases`,search:!1,empty:`Linked to no test case yet. Link it to the case it checks.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`hidden @2xl:table-cell`),children:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:r.cases.map(e=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsxs)(`a`,{href:ht(e.key),className:`flex flex-col gap-1 text-ink no-underline`,children:[(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Q.jsx)(`span`,{className:`font-mono text-body-sm text-accent-fg`,children:e.id})]})}),(0,Q.jsx)(`td`,{className:F(q,`hidden @2xl:table-cell`),children:(0,Q.jsx)(at,{a:e.automation})}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(ot,{o:e.lastRun.outcome})}),(0,Q.jsx)(`td`,{className:F(q,`text-right`),children:e.how!==`mapping`&&(0,Q.jsx)(L,{size:`icon-sm`,variant:`icon`,onClick:()=>void x(e.key,e.id),"aria-label":`Unlink ${e.id}`,"data-tip":`Unlink`,children:(0,Q.jsx)(p,{"aria-hidden":`true`})})})]},e.key))})]}),(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:(0,Q.jsx)(Y,{level:3,icon:v,title:`Details`,className:F(R,`text-body-sm`),children:(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[96px_1fr] gap-x-4 gap-y-2`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Framework`}),(0,Q.jsxs)(`dd`,{className:`m-0`,children:[y,_.framework===`gherkin`?`, ${_.runner??`no runner found`}`:``]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Found`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:He[_.via??`runs`]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Its own id`}),(0,Q.jsx)(`dd`,{className:`m-0 font-mono [overflow-wrap:anywhere]`,children:_.nativeId??`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Last run`}),(0,Q.jsx)(`dd`,{className:`m-0 flex flex-wrap items-center gap-2`,children:_.last?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pn,{status:_.last.status}),(0,Q.jsx)(`span`,{className:`text-muted`,children:J(_.last.at)})]}):(0,Q.jsx)(ot,{o:`not_run`})}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Last runs`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:(0,Q.jsx)(st,{runs:_.runs})}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Tags`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:_.tags.length?(0,Q.jsx)(ct,{tags:_.tags,max:10}):`–`})]})})})]}),(0,Q.jsx)(Tt,{open:s,title:`Link to a test case`,description:`Pick the test case ${_.name} checks. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`,items:t.filter(e=>!_.cases.includes(e.key)).map(e=>({id:e.key,label:e.title,sub:e.id})),onClose:()=>c(!1),onPick:async n=>{await Z.link([{case:n,test:e,action:`link`}]),c(!1),b(`Linked ${e} to ${t.find(e=>e.key===n)?.id??n}.`)}})]})}function pn({status:e}){return e===`skipped`?(0,Q.jsx)(B,{tone:`neutral`,children:`Skipped`}):(0,Q.jsx)(ot,{o:e})}var mn=[{id:`azure_devops`,label:`Azure DevOps`},{id:`jira`,label:`Jira`},{id:`testrail`,label:`TestRail`},{id:`zephyr`,label:`Zephyr Scale`},{id:`qtest`,label:`qTest`}],hn=e=>mn.some(t=>t.id===e),gn=e=>e&&Pe(e)===`web`?e:void 0,_n=(e,t)=>`${e} ${t}${e===1?``:`s`}`,vn=e=>`${e.kind}:${e.id}`;function yn(e){return e.found===`reuse`||e.kind===`link`?`Link`:e.found===`extends`||e.kind===`extend`?`Add ${_n((e.insert??[]).reduce((e,t)=>e+t.steps.length,0),`step`)}`:`Update steps`}function bn(e,t){let n=`Story ${t} asks for it: ${e.wrote}`,r=e.link?{link:!0}:{};return e.kind===`link`?{kind:`link`,id:e.id}:e.kind===`extend`?{kind:`extend`,id:e.id,insert:e.insert??[],reason:n,...r}:{kind:`update`,id:e.id,steps:e.steps??[],reason:n,...r}}function xn(){let[e,t]=(0,X.useState)(mn.map(e=>e.id)),[n,r]=(0,X.useState)(``);return(0,X.useEffect)(()=>{pe.settings().then(e=>{let n=e.config.sources??{},r=mn.map(e=>e.id).filter(e=>n[e]&&typeof n[e]==`object`);r.length&&t(r)},e=>r(`The settings could not be read, so every system is offered: ${e.message}`))},[]),{systems:mn.filter(t=>e.includes(t.id)),error:n}}function Sn({view:e,onApplied:t,onError:n}){let[i,a]=(0,X.useState)([]),[o,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),g=e.story.id,_=e.proposals.filter(e=>i.includes(vn(e))),v=async()=>{let t=_.map(e=>bn(e,g));u(!0);try{let r=await he.preview(e.system,g,t);c({lines:r.lines,changes:t}),n(``)}catch(e){n(e.message)}finally{u(!1)}},b=async()=>{if(o){u(!0);try{let r=await he.apply(e.system,g,o.changes);f({applied:r.applied,failed:r.failed}),c(null),a([]),n(``),t()}catch(e){n(e.message)}finally{u(!1)}}},S=gn(e.story.url);return(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-headline-sm [overflow-wrap:anywhere]`,children:[S?(0,Q.jsxs)(`a`,{href:S,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[g,(0,Q.jsx)(oe,{size:14,"aria-hidden":`true`})]}):(0,Q.jsx)(`span`,{children:g}),e.story.title&&(0,Q.jsx)(`span`,{className:`font-normal text-ink-2`,children:e.story.title})]}),e.changed&&(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,"data-tip":new Date(e.changed.when).toLocaleString(),children:[`The story's `,e.changed.field,` changed `,J(e.changed.when),`.`]})]}),(0,Q.jsx)(Y,{id:`cases`,icon:m,title:`Linked cases`,children:(0,Q.jsx)(G,{label:`Linked cases`,empty:`No test case is linked to this story.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Case`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Title`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`text-right`),children:`Steps`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`State`})]}),children:e.cases.map(e=>{let t=gn(e.url);return(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:F(q,`whitespace-nowrap`),children:t?(0,Q.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[e.id,(0,Q.jsx)(oe,{size:12,"aria-hidden":`true`})]}):e.id}),(0,Q.jsx)(`td`,{className:F(q,`[overflow-wrap:anywhere]`),children:e.title}),(0,Q.jsx)(`td`,{className:F(q,`text-right tabular-nums`),children:e.steps}),(0,Q.jsx)(`td`,{className:F(q,e.stale?`text-warn`:`text-muted`),"data-sort":e.changed&&Date.parse(e.changed)||0,children:e.stale?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(r,{size:13,"aria-hidden":`true`,className:`flex-none`}),`older than the story's last change`]}):e.changed?(0,Q.jsxs)(`span`,{"data-tip":new Date(e.changed).toLocaleString(),children:[`changed `,J(e.changed)]}):`–`})]},e.id)})})}),(0,Q.jsx)(Y,{id:`criteria`,icon:y,title:`Acceptance criteria`,children:(0,Q.jsx)(G,{label:`Acceptance criteria`,empty:`No acceptance criteria were read for this story.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Criterion`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Cases`})]}),children:e.criteria.map((e,t)=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:F(q,`[overflow-wrap:anywhere]`),children:e.text}),(0,Q.jsx)(`td`,{className:F(q,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,Q.jsxs)(Y,{id:`proposals`,icon:ce,title:`Proposed changes`,children:[(0,Q.jsx)(G,{label:`Proposed changes`,empty:`No change is waiting. save_test_cases in a chat proposes them.`,selection:{count:_.length,onClear:()=>a([]),actions:(0,Q.jsxs)(L,{size:`sm`,variant:`primary`,disabled:l||!_.length||!!o,"data-tip":`Review ${_n(_.length,`change`)}`,onClick:()=>void v(),children:[(0,Q.jsx)(x,{"aria-hidden":`true`}),`Review`]})},head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(W,`w-10`),children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Change`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Existing case`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`The agent wrote`})]}),children:e.proposals.map(e=>{let t=vn(e);return(0,Q.jsxs)(`tr`,{className:H,"data-state":i.includes(t)?`selected`:void 0,children:[(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(Ie,{"aria-label":`${yn(e)}: ${e.id} ${e.title}`,checked:i.includes(t),disabled:l||!!o,onCheckedChange:e=>a(e?[...i,t]:i.filter(e=>e!==t))})}),(0,Q.jsxs)(`td`,{className:F(q,`whitespace-nowrap font-medium`),children:[yn(e),e.link&&e.kind!==`link`&&(0,Q.jsx)(`span`,{className:`block text-body-sm font-normal text-muted`,children:`and link it`})]}),(0,Q.jsxs)(`td`,{className:F(q,`[overflow-wrap:anywhere]`),children:[(0,Q.jsx)(`span`,{className:`font-mono text-body-sm text-ink-2`,children:e.id}),` `,e.title]}),(0,Q.jsx)(`td`,{className:F(q,`text-ink-2 [overflow-wrap:anywhere]`),children:e.wrote})]},t)})}),o&&(0,Q.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Apply the changes`,className:F(I.info,`flex flex-col gap-2`),children:[(0,Q.jsxs)(`span`,{className:`font-medium`,children:[`Apply `,_n(o.changes.length,`change`),` to `,mn.find(t=>t.id===e.system)?.label,`?`]}),(0,Q.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:o.lines.map((e,t)=>(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(L,{size:`sm`,variant:`primary`,disabled:l,onClick:()=>void b(),children:[(0,Q.jsx)(s,{"aria-hidden":`true`}),`Apply`]}),(0,Q.jsxs)(L,{size:`sm`,disabled:l,onClick:()=>c(null),children:[(0,Q.jsx)(p,{"aria-hidden":`true`}),`Cancel`]})]})]}),d&&d.applied.length>0&&(0,Q.jsxs)(`p`,{role:`status`,className:`m-0 text-body-sm text-pass`,children:[`Applied: `,d.applied.join(`, `)]}),d&&d.failed.length>0&&(0,Q.jsxs)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:[`Not applied: `,d.failed.map(e=>`${e.id||`a change`}: ${e.error}`).join(`; `)]})]}),(0,Q.jsx)(Y,{id:`changes`,icon:h,title:`Recent changes`,children:e.changes.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm text-ink-2`,children:e.changes.map((e,t)=>(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}):(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`ForgeQE has not changed this story's cases.`})}),e.notes.map((e,t)=>(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted [overflow-wrap:anywhere]`,children:e},t))]})}function Cn({sub:e}){let{systems:t,error:n}=xn(),r=e?e.indexOf(`/`):-1,i=r>0?e.slice(0,r):e,a=hn(i)?i:void 0,o=a&&r>0?E(e.slice(r+1)):``,[s,c]=(0,X.useState)(a??`azure_devops`),[l,u]=(0,X.useState)(o),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1);(0,X.useEffect)(()=>{a&&c(a),u(o)},[a,o]),(0,X.useEffect)(()=>{!a&&t.length&&!t.some(e=>e.id===s)&&c(t[0].id)},[t,s,a]);let _=(0,X.useCallback)(()=>{!a||!o?f(null):(g(!0),he.view(a,o).then(e=>{f(e),m(``),g(!1)},e=>{m(e.message),g(!1)}))},[a,o]);return(0,X.useEffect)(()=>f(null),[a,o]),(0,X.useEffect)(_,[_]),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`A story's test cases in your test management system: which are older than the story's last change, which acceptance criteria no case covers, and the changes save_test_cases proposed. Tick the ones to make; nothing is written until you review and apply them. The tests that run them are on `,(0,Q.jsx)(`a`,{href:k(`regression`),children:`Regression`}),`; their results on `,(0,Q.jsx)(`a`,{href:k(`runs`),children:`Runs`}),`.`]}),(0,Q.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=l.trim();if(!t)return;let n=k(`test-management`,`stories`,s,encodeURIComponent(t));location.hash===n?_():location.hash=n},className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":`System`,className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(be,{items:t,value:s,onChange:c})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_320px] flex-col gap-1 text-body-sm font-medium`,children:[`Story`,(0,Q.jsx)(N,{value:l,maxLength:120,spellCheck:!1,placeholder:s===`azure_devops`?`1234`:s===`qtest`?`5678`:s===`testrail`?`R12`:`SHOP-12`,onChange:e=>u(e.target.value)})]}),(0,Q.jsxs)(L,{type:`submit`,variant:`primary`,disabled:!l.trim()||h,"data-tip":`Open the story's test cases`,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`}),`Open`]})]})]}),[n,p].filter(Boolean).map(e=>(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:e},e)),h&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),d&&(0,Q.jsx)(Sn,{view:d,onApplied:_,onError:m},`${d.system}:${d.story.id}`),!o&&!d&&(0,Q.jsx)(V,{icon:y,title:`No story opened yet`,children:`Pick the system and type a story's id to see its linked test cases, its acceptance criteria and which cases trace to them. When save_test_cases runs in a chat for a story, the changes it proposes to existing cases show here to apply.`})]})}var wn={view:()=>P(`GET`,`/api/testdebt`),refresh:()=>P(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>P(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},Tn=[`untested`,`signal`,`duplicates`,`cases`],En={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},Dn={test:`Test`,recording:`Recording`,case:`Test case`},On={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},kn={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},An=e=>`${Math.round(e*100)}%`,jn=e=>Tn.includes(e)?e:`untested`;function Mn({part:e,what:t,action:n}){return(0,Q.jsxs)(V,{icon:r,title:e.state===`empty`?`No ${t} yet`:`${t[0].toUpperCase()}${t.slice(1)}: not connected`,action:(0,Q.jsxs)(`a`,{className:z({size:`sm`}),href:n.to,"data-tip":`Open ${n.label}`,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`}),n.label]}),children:[`To see this list, set `,e.set,`.`]})}function $({text:e,tip:t}){return(0,Q.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function Nn({sub:e}){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(``),[a,s]=(0,X.useState)(!1),[c,u]=(0,X.useState)(``),p=jn(e),[m,h]=(0,X.useState)(`all`),[g,_]=(0,X.useState)(`manual`),[v,b]=(0,X.useState)(``),[x,S]=(0,X.useState)(``);(0,X.useEffect)(()=>{wn.view().then(e=>{n(e),i(``)},e=>i(e.message))},[]);let ee=(0,X.useCallback)(async(e,t)=>{s(!0),u(``);try{n(await e()),i(``),t&&u(t)}catch(e){i(e.message)}finally{s(!1)}},[]),w=async e=>{if(e){s(!0);try{let{id:t}=await ge.start(e,{});location.hash=k(`chats`,t)}catch(e){i(e.message),s(!1)}}},T=(e,t)=>(0,Q.jsx)(L,{size:`icon`,variant:`icon`,className:`size-8`,disabled:a||!e,onClick:()=>void w(e),"aria-label":`Draft a test for this ${t} in a chat`,"data-tip":e?`Draft a test for this ${t} in a chat`:`Its id or file is not of a plain shape, so no chat request names it: open it where it lives instead.`,children:(0,Q.jsx)(D,{"aria-hidden":`true`})}),E=t?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],ne=v||E[0]?.id||``,O=t?.cases.filter(e=>!e.automated).length??0,re=t?.areas.filter(e=>m===`all`||e.kind===m)??[],A=t?.cases.filter(e=>g===`all`||(g===`manual`?!e.automated:e.automated))??[],j={untested:(t?.areas.length??0)+(t?.rules.length??0),signal:(t?.quiet.length??0)+(t?.gone.length??0),duplicates:t?.duplicates.length??0,cases:O};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap items-center gap-4`,children:t&&(0,Q.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsxs)(`span`,{"data-tip":Le(t.at),children:[`Worked out `,J(t.at)]}),(0,Q.jsxs)(L,{size:`sm`,disabled:a,onClick:()=>void ee(wn.refresh,`Worked out again.`),children:[(0,Q.jsx)(f,{"aria-hidden":`true`}),`Refresh`]})]})}),(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`What no test checks yet, and tests that tell little: code and business rules no test reaches in the `,(0,Q.jsx)(`a`,{href:k(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,t?.repo&&t.repo!==`.`?(0,Q.jsx)(`code`,{className:`font-mono text-body-sm`,children:t.repo}):`the test repository`,`, tests that read alike, and each test case with whether it is automated. It only reads; Draft the test asks in a chat, and nothing changes until you agree there.`]}),r&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:r}),!t&&!r&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),c&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2`,children:c}),t&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-6 @xl:divide-x @xl:divide-line-soft`,children:[(0,Q.jsx)(Re,{label:`Untested code`,value:t.graph.state===`ok`?t.areas.length:`–`,tone:t.areas.length?`text-warn`:void 0,sub:t.graph.state===`ok`?`of ${t.graph.checked} areas`:`graph not built`}),(0,Q.jsx)(Re,{label:`Untested rules`,value:t.rules.length,tone:t.rules.length?`text-warn`:void 0,sub:`of ${t.graph.rulesChecked} rules`}),(0,Q.jsx)(Re,{label:`Never fail`,value:t.quiet.length,sub:`30 passes in a row`}),(0,Q.jsx)(Re,{label:`Code gone`,value:t.gone.length,tone:t.gone.length?`text-fail`:void 0,sub:`of ${t.files.count} files listed`}),(0,Q.jsx)(Re,{label:`Near-duplicates`,value:t.duplicates.length,sub:`from ${An(t.threshold)} alike`}),(0,Q.jsx)(Re,{label:`Not automated`,value:O,tone:O?`text-warn`:void 0,sub:`of ${t.cases.length} test cases`})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(be,{items:[{id:`untested`,label:`Untested code and rules`,n:j.untested},{id:`signal`,label:`Low-signal tests`,n:j.signal},{id:`duplicates`,label:`Near-duplicates`,n:j.duplicates},{id:`cases`,label:`Test cases`,n:j.cases}],value:p,onChange:e=>location.hash=k(`test-management`,`debt`,e)})}),t.notes.map(e=>(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:e},e)),p===`untested`&&(0,Q.jsxs)(Q.Fragment,{children:[t.graph.state===`ok`?(0,Q.jsx)(G,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:m,empty:t.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(be,{items:[{id:`all`,label:`All`,n:t.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${En[e]}s`,n:t.areas.filter(t=>t.kind===e).length}))],value:m,onChange:h})}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`w-[34%]`),children:`Code`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Kind`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @xl:table-cell`),children:`Where`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @2xl:table-cell`),children:`Used by`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:re.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(l,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,Q.jsx)($,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`text-body-sm whitespace-nowrap`),children:En[e.kind]}),(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`hidden max-w-0 font-mono text-body-sm text-ink-2 @xl:table-cell`),children:(0,Q.jsx)($,{text:e.where})}),(0,Q.jsx)(`td`,{className:F(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:T(e.draft,En[e.kind].toLowerCase())})]},e.id))}):(0,Q.jsx)(Mn,{part:t.graph,what:`product graph`,action:{label:`Product`,to:k(`product`)}}),(0,Q.jsx)(G,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:t.graph.rulesChecked?`Every business rule found is checked by a test.`:`No business rules found: the product graph's rules come from the code; the knowledge folder's from a business-rules.md file.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`w-[46%]`),children:`Rule`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`From`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @xl:table-cell`),children:`Where`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @2xl:table-cell`),children:`Closest test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.rules.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(l,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,Q.jsx)($,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`text-body-sm whitespace-nowrap`),"data-tip":e.from===`graph`?`Found in the code by forgeqe knowledge build`:`A rule of the knowledge folder, matched to tests by its words`,children:e.from===`graph`?`Code`:`Knowledge`}),(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`hidden max-w-0 font-mono text-body-sm text-ink-2 @xl:table-cell`),children:(0,Q.jsx)($,{text:e.where})}),(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`hidden max-w-0 text-body-sm text-ink-2 @2xl:table-cell`),children:e.nearest?(0,Q.jsx)($,{text:`${e.nearest.name} (${An(e.nearest.score)})`,tip:`${An(e.nearest.score)} of the rule's words are in ${e.nearest.name}`}):`–`}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:T(e.draft,`rule`)})]},e.id))})]}),p===`signal`&&(t.history.state===`ok`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{label:`Tests that never fail`,placeholder:`Find a test`,empty:`No test has passed 30 runs in a row without a failure or a retry.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`w-[50%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Passes`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @xl:table-cell`),children:`Since`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.quiet.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(o,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,Q.jsx)($,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,Q.jsx)(`td`,{className:F(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`text-muted`),children:e.runs}),(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`hidden text-body-sm whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.since?Le(e.since):void 0,"data-sort":e.since&&new Date(e.since).getTime()||0,children:e.since?J(e.since):`–`}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:T(e.draft,`test`)})]},e.key))}),(0,Q.jsx)(G,{label:`Tests whose file is gone`,placeholder:`Find a test or file`,empty:`Every test file the history names is in the test repository (${t.files.count} files, listed by ${t.files.by===`git`?`git`:`walking the folder`}).`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`w-[40%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`File`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @xl:table-cell`),children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.gone.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(d,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,Q.jsx)($,{text:e.name})]})}),(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`max-w-0 font-mono text-body-sm text-ink-2`),children:(0,Q.jsx)($,{text:e.file})}),(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`hidden text-body-sm whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.last?Le(e.last):void 0,"data-sort":e.last&&new Date(e.last).getTime()||0,children:e.last?J(e.last):`–`}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:T(e.draft,`test`)})]},e.key))})]}):(0,Q.jsx)(Mn,{part:t.history,what:`test history`,action:{label:`Regression`,to:k(`regression`)}})),p===`duplicates`&&(0,Q.jsx)(G,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,height:`max(320px, calc(var(--screen) - 288px))`,empty:`No two tests, recordings or test cases share ${An(t.threshold)} of their words (${t.compared} pairs compared).`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Alike`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`w-[30%]`),children:`First`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`w-[30%]`),children:`Second`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @2xl:table-cell`),children:`Shared words`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.duplicates.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:F(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,e.score>=.85?`text-warn`:`text-muted`),"data-sort":e.score,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(C,{size:14,"aria-hidden":`true`}),An(e.score)]})}),[e.a,e.b].map((e,t)=>(0,Q.jsxs)(`td`,{className:F(`px-4 py-2`,`max-w-0`),children:[(0,Q.jsx)($,{text:e.name,tip:`${Dn[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,Q.jsx)(`span`,{className:`block text-body-sm text-muted`,children:Dn[e.kind]})]},t)),(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`hidden max-w-0 text-body-sm text-ink-2 @2xl:table-cell`),children:(0,Q.jsx)($,{text:e.shared.join(`, `)})}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:T(e.draft,`pair`)})]},`${e.a.kind}:${e.a.key}|${e.b.kind}:${e.b.key}`))}),p===`cases`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Test management`}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:t.sources.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,Q.jsx)(o,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,Q.jsx)(l,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`text-ink-2`,children:e.connected?e.scopes.length?e.scopes.map(e=>`${e.scope}: ${e.cases} read ${J(e.at)}`).join(` · `):e.id===`jira`?`connected: its cases show once ForgeQE has indexed or automated them`:`connected`:`not connected: set ${e.set}`})]},e.id))})]}),E.length>0&&(0,Q.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),ne&&ee(()=>wn.readCases(ne,x.trim()),`Test cases read.`)},children:[(0,Q.jsx)(M,{size:`sm`,"aria-label":`Source`,value:ne,onChange:e=>b(e.target.value),children:E.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,Q.jsx)(N,{size:`sm`,"aria-label":`Scope`,placeholder:ne&&ne!==`jira`?kn[ne]:``,value:x,maxLength:80,onChange:e=>S(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,Q.jsxs)(L,{size:`sm`,type:`submit`,disabled:a||!x.trim(),"data-tip":`Read the test cases`,children:[(0,Q.jsx)(te,{"aria-hidden":`true`}),`Import`]})]}),t.cases.length?(0,Q.jsx)(G,{label:`Test cases`,placeholder:`Find a test case by id or title`,height:`max(320px, calc(var(--screen) - 288px))`,resetKey:g,empty:`Nothing matches.`,tools:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(be,{items:[{id:`manual`,label:`Not automated`,n:O,alert:!0},{id:`automated`,label:`Automated`,n:t.cases.length-O},{id:`all`,label:`All`,n:t.cases.length}],value:g,onChange:_})}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Case`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`w-[36%]`),children:`Title`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @xl:table-cell`),children:`Source`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Automated`}),(0,Q.jsx)(`th`,{scope:`col`,className:F(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @2xl:table-cell`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:A.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`font-mono text-body-sm whitespace-nowrap`),children:/^https?:\/\//i.test(e.url)?(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`max-w-0`),children:(0,Q.jsx)($,{text:e.title||`–`})}),(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`hidden text-body-sm whitespace-nowrap @xl:table-cell`),"data-tip":`From ${e.scope}`,children:On[e.source]}),(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`text-body-sm whitespace-nowrap`),children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,"data-tip":e.how===`mapping`?`Its test is in the automated tests' mapping`:e.how===`name`?`A test in the history names its id`:`No automated test names it`,children:[e.automated?(0,Q.jsx)(o,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,Q.jsx)(l,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,Q.jsx)(`td`,{className:F(`px-4 py-2`,`hidden max-w-0 text-body-sm text-ink-2 @2xl:table-cell`),children:e.test?(0,Q.jsx)($,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:!e.automated&&T(e.draft,`test case`)})]},`${e.source}|${e.id}`))}):(0,Q.jsx)(V,{icon:y,title:`No test cases yet`,action:(0,Q.jsxs)(`a`,{className:z({size:`sm`}),href:k(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`}),`Settings`]}),children:`Test cases show here from ForgeQE's case index, the automated tests' mapping (.forgeqe/test-cases.json), and the plans, runs or cycles you read above from a connected source.`})]})]})]})}var Pn=[`dashboard`,`cases`,`tests`,`gaps`,`debt`,`stories`,`suites`,`tags`];function Fn({sub:e}){let t=(e??``).split(`/`).filter(Boolean),n=Pn.includes(t[0])?t[0]:`dashboard`,a=n===`cases`&&t[1]?E(t[1]):void 0,o=n===`tests`&&t[1]?E(t[1]):void 0,s=n===`suites`&&t[1]?E(t[1]):void 0,[c,p]=(0,X.useState)(null),[h,_]=(0,X.useState)(null),[v,x]=(0,X.useState)(null),[S,C]=(0,X.useState)([]),[ee,te]=(0,X.useState)(null),[w,T]=(0,X.useState)(null),[D,O]=(0,X.useState)(null),[re,A]=(0,X.useState)(``),[ie,oe]=(0,X.useState)(``),[se,ce]=(0,X.useState)(!1),[le,ue]=(0,X.useState)([]),[fe,pe]=(0,X.useState)(null),[M,N]=(0,X.useState)(!0),P=(0,X.useCallback)(async()=>{try{let[e,t]=await Promise.all([Z.view(),Z.cases()]);p(e),_(t),T(e.suites),O(e.job),A(``)}catch(e){A(e.message)}},[]);(0,X.useEffect)(()=>{P()},[P]),(0,X.useEffect)(()=>{n===`gaps`&&Z.gaps().then(x,e=>A(e.message)),n===`tags`&&Z.tags().then(te,e=>A(e.message)),n===`suites`&&Z.suites().then(e=>T(e.suites),e=>A(e.message))},[n,c]),(0,X.useEffect)(()=>{if(!D?.running)return;let e=Te(()=>{Z.job().then(e=>{O(e.job),e.job?.running||P()},()=>{})},2e3);return()=>Ce(e)},[D?.running,P]);let me=async()=>{ce(!0),oe(``);try{let e=await Z.sync(),t=e.plans.filter(e=>e.error),n=t.length?t.map(e=>`${e.label}: ${e.error}`).join(` · `):`Synced ${e.plans.map(e=>`${e.label} (${e.cases} cases)`).join(`, `)}.`;oe(e.storiesError?`${n} The release's stories were not read again: ${e.storiesError}`:n),await P()}catch(e){A(e.message)}finally{ce(!1)}},he=e=>pe({title:`Run ${e.length} test case${e.length===1?``:`s`}`,go:(t,n)=>Z.run(e,t,n)}),ge=(e,t)=>{let n=w?.find(t=>t.id===e)??c?.suites.find(t=>t.id===e);pe({title:`${t?`Rerun the failed cases of`:`Run`} ${n?.name??`the suite`}`,go:(n,r)=>Z.runSuite(e,{...n?{env:n}:{},...t?{only:t}:{}},r)})},_e=()=>{oe(`The run started: it shows here while it runs, and in Runs.`),Z.job().then(e=>O(e.job),()=>{})},ye=e=>{oe(e),ue([]),P()},R=new Map((h?.cases??[]).map(e=>[e.key,e])),z=le.filter(e=>R.has(e)),be=e=>e.map(e=>R.get(e).id),V=z.filter(e=>[`failed`,`blocked`].includes(R.get(e).lastRun.outcome)),Se=z.filter(e=>R.get(e).automation!==`automated`),H=[{intent:`automate`,label:Se.length?`Automate ${Se.length}`:`Automate`,icon:i,keys:Se.slice(0,50),...Se.length?{}:{disabled:`Pick test cases that are not automated`}},{intent:`investigate`,label:V.length?`Why ${V.length} fail`:`Why they fail`,icon:d,keys:V.slice(0,50),...V.length?{}:{disabled:`Pick failing test cases`}},{intent:`tag`,label:`Suggest tags`,icon:de,keys:z.slice(0,50),...z.length?{}:{disabled:`Pick test cases in the list first`}},{intent:`tag_tests`,label:`Write tags into tests`,icon:i,keys:z.filter(e=>R.get(e).tests.length>0&&R.get(e).tags.length>0).slice(0,50),...z.filter(e=>R.get(e).tests.length>0&&R.get(e).tags.length>0).length?{}:{disabled:`Pick tagged cases that have a linked test`}}],U=(v?.ranked??[]).slice(0,20).map(e=>e.key),W=[{intent:`automate`,label:z.length?`Automate ${z.length}`:`Automate the top ${U.length}`,icon:i,keys:(z.length?z:U).slice(0,50),...z.length||U.length?{}:{disabled:`Nothing left to automate`}},{intent:`investigate`,label:`Why the failing fail`,icon:d,keys:(v?.lists.failing??[]).slice(0,50),...v?.lists.failing.length?{}:{disabled:`Nothing is failing`}},{intent:`cases_for_stories`,label:S.length?`Cases for ${S.length} stor${S.length===1?`y`:`ies`}`:`Cases for stories with none`,icon:b,keys:[],stories:(S.length?S:(v?.stories?.noCase??[]).map(e=>e.id)).slice(0,50),...S.length||v?.stories?.noCase.length?{}:{disabled:`Read the release's stories in Gaps, Stories with no case, first`}}],Ee=h?h.cases.filter(e=>e.automation===`not_automated`||e.automation===`pending`||e.lastRun.outcome===`failed`||e.lastRun.outcome===`blocked`).length:(c?.summary.notAutomated??0)+(c?.summary.pending??0),G=s?w?.find(e=>e.id===s):void 0,Oe=(0,Q.jsxs)(`main`,{className:F(De,`@container flex-auto gap-4`),children:[!a&&!o&&!s&&(0,Q.jsx)(xe,{}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,Q.jsx)(we,{pixel:ve[`test-management`],size:`lg`}),(0,Q.jsx)(`h1`,{className:`m-0 text-headline-lg`,children:`Test management`}),c&&(0,Q.jsx)(`div`,{className:`order-last flex min-w-0 basis-full @[74rem]:order-none @[74rem]:basis-auto`,children:(0,Q.jsx)(Ae,{label:`Test management`,className:`mb-0 max-w-full`,current:n,hrefOf:e=>k(`test-management`,e),tabs:[{id:`dashboard`,label:`Dashboard`,icon:ne},{id:`cases`,label:`Test cases`,n:c.summary.cases,icon:m},{id:`tests`,label:`Automated`,n:c.summary.tests,icon:g},{id:`gaps`,label:`Gaps`,n:Ee,icon:l},{id:`debt`,label:`Test debt`,icon:r},{id:`stories`,label:`Stories`,icon:y},{id:`suites`,label:`Suites`,n:c.suites.length,icon:j},{id:`tags`,label:`Tags`,icon:de}]})}),c&&(0,Q.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[c.plans.length>0&&(0,Q.jsx)(L,{size:`icon`,disabled:se,onClick:()=>void me(),"aria-label":se?`Syncing`:`Sync`,"data-tip":se?`Syncing…`:`Sync: read every case of the connected plans again`,children:(0,Q.jsx)(f,{"aria-hidden":`true`})}),(c.plans.length>0||c.summary.tests>0)&&(0,Q.jsx)(nn,{disabled:se}),(n===`cases`||n===`gaps`||n===`suites`)&&!M&&(0,Q.jsx)(L,{size:`icon`,onClick:()=>N(!0),"aria-label":n===`suites`?`Open the Suite agent`:`Open the agent`,"data-tip":n===`suites`?`Open the Suite agent`:`Open the agent`,children:(0,Q.jsx)(b,{"aria-hidden":`true`})})]})]}),c&&!a&&!o&&!s&&(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`Every case of the connected test plans: which are automated and by what, what ran, and what is left.`,` `,c.plans.length>0?(0,Q.jsxs)(`span`,{"data-tip":c.plans.map(e=>`${e.label}: ${e.cases} cases${e.at?`, synced ${Le(e.at)}`:``}`).join(` · `),children:[c.plans.length,` plan`,c.plans.length===1?``:`s`,c.plans[0]?.at?`, synced ${J(c.plans.map(e=>e.at??``).sort()[0])}.`:`, not synced yet.`]}):(0,Q.jsx)(`a`,{href:k(`settings`,`integrations`),children:`Connect a test plan in Settings`})]}),re&&(0,Q.jsx)(`p`,{role:`alert`,className:F(I.fail,`m-0`),children:re}),!c&&!re&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),ie&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:ie}),c&&c.refused.length>0&&(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm text-warn`,children:[`Not read, as their system does not write a plan that way: `,c.refused.join(` · `),`. Fix them in Settings › Integrations.`]}),D&&(0,Q.jsxs)(`div`,{role:`status`,className:F(`rounded-lg bg-bg p-6 shadow-sm`,`flex flex-wrap items-center gap-2 text-body-sm`),children:[(0,Q.jsx)(B,{tone:D.running?`running`:D.exitCode===0?`pass`:`fail`,children:D.running?`Running`:D.exitCode===0?`Finished`:`Stopped`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink-2`,"data-tip":D.command,children:D.lines.at(-1)??D.command}),D.running?(0,Q.jsxs)(L,{size:`sm`,variant:`danger`,onClick:()=>void Z.stop().then(e=>O(e.job),e=>A(e.message)),children:[(0,Q.jsx)(ae,{"aria-hidden":`true`}),`Stop`]}):(0,Q.jsx)(`a`,{href:k(`runs`),className:`text-body-sm`,children:`Runs`})]}),c&&(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)(`div`,{id:`panel-${n}`,className:`flex flex-col gap-4`,children:[n===`dashboard`&&(0,Q.jsx)(Rt,{view:c,onRunSuite:ge}),n===`cases`&&(a?(0,Q.jsx)(Dt,{caseKey:a,onRun:he,onChanged:()=>void P()},a):h&&(0,Q.jsx)(Mt,{cases:h.cases,tests:h.tests.length,selected:z,onSelect:ue,onRun:he,onChanged:ye})),n===`tests`&&h&&(o?(0,Q.jsx)(fn,{uid:o,cases:h.cases,onChanged:()=>void P()},o):(0,Q.jsx)(_t,{cases:h.cases,onChanged:ye})),n===`gaps`&&(v&&h?(0,Q.jsx)(Jt,{gaps:v,cases:h.cases,tests:h.tests,selected:z,onSelect:ue,onRun:he,pickedStories:S,onPickStories:C,onStoriesRead:()=>(C([]),void P())}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`})),n===`debt`&&(0,Q.jsx)(Nn,{sub:t[1]}),n===`stories`&&(0,Q.jsx)(Cn,{sub:t.slice(1).join(`/`)||void 0}),n===`suites`&&(s?(0,Q.jsx)(Qt,{id:s,onRun:ge,onDeleted:()=>(location.hash=k(`test-management`,`suites`),void P())},s):w&&(0,Q.jsx)(Zt,{suites:w,onRun:ge})),n===`tags`&&(ee?(0,Q.jsx)(dn,{tags:ee,cases:h?.cases,onChanged:ye}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}))]})}),(0,Q.jsx)(pt,{open:!!fe,onClose:()=>pe(null),title:fe?.title??`Run`,preview:(e,t)=>fe.go(e,t),onStarted:_e})]}),K=a?R.get(a):void 0;return(0,Q.jsxs)(`div`,{className:`@container flex min-h-(--screen) flex-col`,children:[(0,Q.jsx)(ke,{}),(0,Q.jsxs)(`div`,{className:`flex flex-auto flex-col xl:flex-row`,children:[(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-auto flex-col`,children:Oe}),c&&M&&n===`cases`&&(0,Q.jsx)(Ge,{title:`Test case agent`,about:`Automates, runs and tags the cases you pick.`,looking:K?`Looking at ${K.id}.`:z.length?`Looking at the ${z.length} cases you picked.`:`Looking at ${c.summary.cases} test cases. Pick some in the list.`,context:K?[K.id,...K.plans.slice(0,1)]:z.length?be(z).slice(0,4):[],suggestions:K?[{intent:K.automation===`automated`?`run`:`automate`,label:K.automation===`automated`?`Run it and explain`:`Automate it`,icon:K.automation===`automated`?u:i,keys:[K.key]},{intent:`investigate`,label:`Why it fails`,icon:d,keys:[K.key],...[`failed`,`blocked`].includes(K.lastRun.outcome)?{}:{disabled:`Its last run did not fail`}},{intent:`tag`,label:`Suggest tags`,icon:de,keys:[K.key]}]:H,keys:K?[K.key]:z,placeholder:`Ask about these cases, or say what to do`,onClose:()=>N(!1)},a??`list`),c&&M&&n===`gaps`&&(0,Q.jsx)(Ge,{title:`Gap agent`,about:`Finds what to close first and closes it with you.`,looking:`Looking at ${c.summary.notAutomated} cases not automated, ${c.summary.pending} pending and ${c.summary.failing} failing.`,context:z.length?be(z).slice(0,4):[],suggestions:W,keys:z.length?z:U,placeholder:`What should we close first?`,onClose:()=>N(!1)}),c&&M&&n===`suites`&&(0,Q.jsx)($t,{open:G,onSaved:e=>{oe(`Saved the suite ${e.name}.`),P(),location.hash=k(`test-management`,`suites`,e.id)}},s??`list`)]})]})}export{Fn as TestManagement};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{jt as t,qr as n}from"./route-D9uPlFWw.js";import{E as r,Q as i,Vt as a}from"./preload-helper-qorOEK5q.js";import{t as o}from"./jsx-runtime-LKYXHABd.js";import{N as s}from"./pageBack-BoSbGSU6.js";var c=e(n(),1),l=o();function u(e){return(e.replace(/(?<![\\/])[\\/]+$/,``).split(/[\\/]/).pop()||``).replace(/\.(exe|app)$/i,``).toLowerCase().replace(/[^a-z0-9_.-]+/g,`-`).replace(/^[^a-z]+/,``).replace(/(?<!-)-+$/,``).slice(0,40)||`app`}function d({value:e,onChange:n,onPicked:o,onError:u,className:d}){let[f,p]=(0,c.useState)(!1),m=async()=>{p(!0),u(``);try{let e=await i.browse();`path`in e?(n(e.path),o?.(e.path,e.name)):`unavailable`in e&&u(e.unavailable)}catch(e){u(e.message)}finally{p(!1)}};return(0,l.jsxs)(`div`,{className:a(`flex min-w-0 gap-2`,d),children:[(0,l.jsx)(r,{"aria-label":`App's path`,value:e,spellCheck:!1,placeholder:`C:\\Program Files\\Contoso\\Billing.exe`,onChange:e=>n(e.target.value),className:`min-w-0 flex-1 font-mono text-body-sm`}),(0,l.jsxs)(s,{type:`button`,disabled:f,onClick:()=>void m(),"data-tip":`Choose the app's .exe on this computer`,children:[(0,l.jsx)(t,{"aria-hidden":`true`}),f?`Choosing…`:`Browse…`]})]})}export{u as n,d as t};