@capagents/forgeqe 3.1.6 → 3.1.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 (65) hide show
  1. package/dist/forgeqe.js +1753 -1752
  2. package/dist/web/assets/{3d-force-graph-DhjnuSZ7.js → 3d-force-graph-OeCdKJJ-.js} +1 -1
  3. package/dist/web/assets/{Agent-BvZNnkYO.js → Agent-DrdDwck4.js} +1 -1
  4. package/dist/web/assets/{AgentWork-CXqq9ihT.js → AgentWork-wNaA-i2T.js} +1 -1
  5. package/dist/web/assets/ApiTests-B3X6NIn8.js +10 -0
  6. package/dist/web/assets/{Browse-DU423cZs.js → Browse-Cd1DEgYR.js} +1 -1
  7. package/dist/web/assets/{Chat-D128NJm9.js → Chat-4GknHS5Z.js} +1 -1
  8. package/dist/web/assets/{CommandPalette-CqHeNMlz.js → CommandPalette-zRrrp6F_.js} +1 -1
  9. package/dist/web/assets/{Compare-Cfhl9eEb.js → Compare-DJVhkzqO.js} +1 -1
  10. package/dist/web/assets/{Cost-BZ34Hxth.js → Cost-CbKnuQuB.js} +1 -1
  11. package/dist/web/assets/{Data-BQx6Yjyt.js → Data-Bt5yqqvq.js} +1 -1
  12. package/dist/web/assets/{Desktop-XvNM9FOF.js → Desktop-CPDo3Ir-.js} +1 -1
  13. package/dist/web/assets/{DesktopReview-hvUm15-5.js → DesktopReview-CCaqTSu5.js} +1 -1
  14. package/dist/web/assets/{Evidence-Cfk59P10.js → Evidence-BAuIgj1h.js} +1 -1
  15. package/dist/web/assets/{Explore-BDyb5dKe.js → Explore-BqzEPdP7.js} +1 -1
  16. package/dist/web/assets/{Features-XIqYxKc1.js → Features-DFuPCW9x.js} +1 -1
  17. package/dist/web/assets/{Flags-CdHPrNp4.js → Flags-UBakvqIq.js} +1 -1
  18. package/dist/web/assets/{Flaky-DwDQRut-.js → Flaky-DUzdfQW4.js} +1 -1
  19. package/dist/web/assets/{Impact-t9iOQDtS.js → Impact-jLZqUzz9.js} +1 -1
  20. package/dist/web/assets/{Jobs-48PdEMgf.js → Jobs-De3NyY5s.js} +1 -1
  21. package/dist/web/assets/{KindPage-Dy0J7L-M.js → KindPage-DWznWcLB.js} +1 -1
  22. package/dist/web/assets/{Migration-0HYN_JZm.js → Migration-BdOq6RO6.js} +1 -1
  23. package/dist/web/assets/{PageAgent-DY8YEIdr.js → PageAgent-dVvZtNoB.js} +1 -1
  24. package/dist/web/assets/{Product-Ba9C8kLQ.js → Product-ByZ8Qr3i.js} +3 -3
  25. package/dist/web/assets/{Production-DzfDMnnj.js → Production-D8L2TchK.js} +1 -1
  26. package/dist/web/assets/{Quality-CnURaQom.js → Quality-CSZEuhZo.js} +1 -1
  27. package/dist/web/assets/{Readiness-DlwnwSJ8.js → Readiness-bBu_84mx.js} +1 -1
  28. package/dist/web/assets/{Record-CrJyzp8u.js → Record-DWJEDj2C.js} +1 -1
  29. package/dist/web/assets/{Regression-D-qjvr44.js → Regression-D2VkPIhZ.js} +1 -1
  30. package/dist/web/assets/{Reports-BspqEzVg.js → Reports-dF-O5HTI.js} +1 -1
  31. package/dist/web/assets/{Response-BxvDBStv.js → Response-D4JW3pwi.js} +1 -1
  32. package/dist/web/assets/{Responsive-C4chhZcc.js → Responsive-CLX9S27s.js} +1 -1
  33. package/dist/web/assets/{RunDiff-D8NBOHwI.js → RunDiff-BuL_-GwF.js} +1 -1
  34. package/dist/web/assets/{Runs-Bb2krvLN.js → Runs-DyyaAiyA.js} +1 -1
  35. package/dist/web/assets/{Settings-D2Byn_Va.js → Settings-DnG6_QQj.js} +3 -3
  36. package/dist/web/assets/{Steps-CymeLF90.js → Steps-C-0zwG7T.js} +1 -1
  37. package/dist/web/assets/{TestCases-DYTIR2LB.js → TestCases-DXk9qsEL.js} +1 -1
  38. package/dist/web/assets/{TestData-UNmAG8Wi.js → TestData-D4al7-3Z.js} +1 -1
  39. package/dist/web/assets/{TestDebt-CQOYiRaK.js → TestDebt-BzOVDuS8.js} +1 -1
  40. package/dist/web/assets/{TestManagement-DWNUDF7y.js → TestManagement-T-NIlhc9.js} +1 -1
  41. package/dist/web/assets/{Tosca-BJsofAG8.js → Tosca-D7tqMGK0.js} +1 -1
  42. package/dist/web/assets/{WhatsNew-Gs-_0But.js → WhatsNew-DBViE2Qt.js} +1 -1
  43. package/dist/web/assets/{dataParts-DV44YXP9.js → dataParts-D56_9p6T.js} +1 -1
  44. package/dist/web/assets/{fold-CdtPs-3w.js → fold-UP5ihvz-.js} +1 -1
  45. package/dist/web/assets/{head-EHQVlLa5.js → head-BpR3dGRT.js} +1 -1
  46. package/dist/web/assets/{highlight-DIktyogB.js → highlight--Ayfy7Gy.js} +1 -1
  47. package/dist/web/assets/{index-Cq2sihjc.js → index-CljX5dI4.js} +5 -5
  48. package/dist/web/assets/{logos-B1BhmXnA.js → logos-B4e5nBuL.js} +1 -1
  49. package/dist/web/assets/{paletteCommands-w1UNWBRa.js → paletteCommands-ar4wAGok.js} +1 -1
  50. package/dist/web/assets/{qualityParts-B8bouYKy.js → qualityParts-D_U5zhKC.js} +1 -1
  51. package/dist/web/index.html +1 -1
  52. package/package.json +1 -1
  53. package/prompts/test-plan.md +1 -1
  54. package/prompts/test-reviewer.md +1 -1
  55. package/prompts/test-rules.md +6 -1
  56. package/py/forgeqe_engine/brand.py +45 -27
  57. package/py/forgeqe_engine/browser.py +34 -1
  58. package/py/forgeqe_engine/browserlaunch.py +16 -3
  59. package/py/forgeqe_engine/orb_assets.py +30 -0
  60. package/py/forgeqe_engine/profilename.py +168 -0
  61. package/py/forgeqe_engine/pwlaunch.mjs +3 -2
  62. package/py/forgeqe_engine/service.py +7 -1
  63. package/py/forgeqe_engine/settings.py +17 -0
  64. package/skills/bdd-gherkin/SKILL.md +3 -0
  65. package/dist/web/assets/ApiTests-B26ezscO.js +0 -10
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$t as t,Bn as n,Er as r,Fn as i,H as a,Hr as o,I as s,Ir as c,L as l,O as u,R as d,Rr as f,Un as p,Yn as m,Zn as h,an as g,ar as _,ct as v,fr as y,gr as b,l as ee,lt as x,n as te,on as S,q as C,r as w,sr as ne,u as T,v as E,w as D,wr as O,xr as re}from"./route-Dg53WdFu.js";import{t as k}from"./jsx-runtime-LKYXHABd.js";import{A,X as j,Z as ie,n as M,t as N}from"./input-D7iHeNXz.js";import{a as P,c as ae,d as F,f as I,o as L,t as R}from"./filters-Culzq1j1.js";import{L as oe}from"./palette-lUno7fso.js";import{Bn as se,Bt as ce,Dn as le,Ft as z,H as ue,Ht as de,It as B,K as fe,Kn as V,Lt as H,Pt as U,Rt as W,Vn as pe,Vt as G,W as me,Wt as he,g as K,u as q}from"./index-Cq2sihjc.js";import{_ as ge}from"./qualityParts-B8bouYKy.js";import{t as _e}from"./AgentWork-CXqq9ihT.js";var J=e(o(),1),Y={view:()=>j(`GET`,`/api/testmgmt`),cases:()=>j(`GET`,`/api/testmgmt/cases`),case:e=>j(`GET`,`/api/testmgmt/case/${encodeURIComponent(e).replace(/%3A/gi,`:`)}`),sync:()=>j(`POST`,`/api/testmgmt/sync`),schedule:()=>j(`GET`,`/api/testmgmt/schedule`),setSchedule:e=>j(`POST`,`/api/testmgmt/schedule`,e),gaps:()=>j(`GET`,`/api/testmgmt/gaps`),tags:()=>j(`GET`,`/api/testmgmt/tags`),tag:(e,t=!1)=>j(`POST`,`/api/testmgmt/tags`,{...e,...t?{confirmed:!0}:{}}),suites:()=>j(`GET`,`/api/testmgmt/suites`),suite:e=>j(`GET`,`/api/testmgmt/suites/${encodeURIComponent(e)}`),buildSuite:(e,t)=>j(`POST`,`/api/testmgmt/suites/agent`,{request:e,...t?{open:t}:{}}),saveSuite:e=>j(`POST`,`/api/testmgmt/suites`,e),deleteSuite:e=>j(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/delete`,{confirmed:!0}),runSuite:(e,t,n=!1)=>j(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/run`,{...t,...n?{confirmed:!0}:{}}),run:(e,t,n=!1)=>j(`POST`,`/api/testmgmt/run`,{keys:e,...t?{env:t}:{},...n?{confirmed:!0}:{}}),job:()=>j(`GET`,`/api/testmgmt/job`),writeBack:(e,t,n,r)=>j(`POST`,`/api/testmgmt/writeback/${e}`,{keys:t,...r?{tags:r}:{},...n?{digest:n}:{}}),suiteTracker:(e,t,n)=>j(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/tracker`,{...t?{target:t}:{},...n?{digest:n}:{}}),stop:()=>j(`POST`,`/api/testmgmt/stop`),tests:()=>j(`GET`,`/api/testmgmt/tests`),discoveryPlan:()=>j(`GET`,`/api/testmgmt/discover`),discover:e=>j(`POST`,`/api/testmgmt/discover`,{digest:e}),link:e=>j(`POST`,`/api/testmgmt/links`,{changes:e}),setMain:(e,t)=>j(`POST`,`/api/testmgmt/links/main`,{case:e,test:t}),proposeLinks:(e=[])=>j(`POST`,`/api/testmgmt/links/propose`,{keys:e}),ask:(e,t,n,r)=>j(`POST`,`/api/testmgmt/ask`,{intent:e,keys:t,...n?{words:n}:{},...r?.length?{stories:r}:{}}),readStories:e=>j(`POST`,`/api/testmgmt/stories`,{scope:e})},ve={automated:`Automated`,not_automated:`Not automated`,pending:`Pending`,known_defect:`Known defect`,needs_attention:`Needs attention`},ye={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`},be={framework:`Listed by its framework`,code:`Read from the code`,runs:`Known from runs`},X={passed:`Passed`,failed:`Failed`,blocked:`Blocked`,not_run:`Not run`},Z=k();function xe({title:e,about:t,onClose:n,children:r,footer:i}){return(0,Z.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,Z.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-line-soft px-6 py-4`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[20px] font-semibold`,children:e}),(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:t})]}),n&&(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Close the ${e}`,"data-tip":`Close`,onClick:n,children:(0,Z.jsx)(f,{"aria-hidden":`true`})})]}),(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 py-6`,children:r}),i&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft px-6 py-4`,children:i})]})}function Se({title:e,about:t,looking:n,context:r,suggestions:i,placeholder:a,onClose:o}){let[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(``),[g,_]=(0,J.useState)(!1),v=async(e,t,n,r,i)=>{f(!0),m(``);try{let{request:a}=await Y.ask(e,t,r,i),{id:o}=await ie.start(a,{});c({id:o,said:n}),_(!1),u(``)}catch(e){m(e.message)}finally{f(!1)}};return(0,Z.jsxs)(xe,{title:e,about:t,onClose:o,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:i.map(e=>(0,Z.jsxs)(F,{size:`sm`,disabled:d||!!e.disabled,"data-tip":e.disabled??e.label,onClick:()=>void v(e.intent,e.keys,e.label,void 0,e.stories),children:[(0,Z.jsx)(e.icon,{"aria-hidden":`true`}),e.label]},e.label))}),(0,Z.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),l.trim()&&v(`ask`,i[0]?.keys.slice(0,50)??[],l.trim(),l.trim())},children:[(0,Z.jsxs)(`label`,{className:`sr-only`,htmlFor:`tm-agent-words`,children:[`Message the `,e]}),(0,Z.jsx)(`textarea`,{id:`tm-agent-words`,rows:2,maxLength:1e3,value:l,placeholder:a,onChange:e=>u(e.target.value),className:`min-h-11 flex-1 resize-none rounded-[10px] border border-line bg-bg px-4 py-2 text-[13px] text-ink outline-none focus:border-accent`}),(0,Z.jsx)(F,{size:`icon`,variant:`primary`,type:`submit`,disabled:d||!l.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,Z.jsx)(h,{"aria-hidden":`true`})})]})]}),children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,Z.jsx)(ae,{state:d||s&&!g?`thinking`:`working`,px:96,label:d?`Starting`:s&&!g?`Working`:`Ready`}),(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:s?g?`Done. Ask again, or open the chat.`:`Working on it…`:n}),r.length>0&&(0,Z.jsx)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:r.map(e=>(0,Z.jsx)(`span`,{className:`rounded-[8px] border border-line bg-bg px-2 text-[13px] text-ink-2`,children:e},e))}),s&&(0,Z.jsx)(`p`,{className:`m-0 text-[16px] leading-relaxed text-ink-2`,children:s.said})]}),p&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:p}),s?(0,Z.jsx)(_e,{id:s.id,label:`The ${e} at work`,onEnd:()=>_(!0)},s.id):(0,Z.jsxs)(`p`,{className:A(`m-0 text-center text-[13px] text-muted`),children:[`Pick what to do below, or say it in your own words. It works in a chat you can open: `,(0,Z.jsx)(`a`,{href:w(`chats`),children:`Chats`}),`.`]})]})}var Ce={automation:`Mark automated in their tracker`,tags:`Write ForgeQE's tags to their tracker`,untag:`Take ForgeQE's tags off in their tracker`},we={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.`},Te=e=>e.system===`azure_devops`?`Azure DevOps plan ${e.plan}`:`Xray Test Set in ${e.project}`,Ee=e=>e.system===`azure_devops`?`ado:${e.plan}`:`xray:${e.project}`,De=e=>e?.url&&/^https:\/\//i.test(e.url)?e.url:void 0,Oe=e=>e.system===`azure_devops`?`Azure DevOps suite ${e.suite} in plan ${e.plan}`:`Xray Test Set ${e.key}`;function ke({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,Z.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 first:border-t-0`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r.has(e.key)&&(0,Z.jsx)(s,{size:14,"aria-label":`Written`,className:`flex-none text-pass`}),n.has(e.key)&&(0,Z.jsx)(a,{size:14,"aria-label":`Refused`,className:`flex-none text-fail`}),e.key!==`suite`&&(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.key.replace(/^[a-z_]+:/,``)}),(0,Z.jsx)(`span`,{className:i?`text-muted`:`text-ink-2`,children:e.what})]}),n.has(e.key)&&(0,Z.jsx)(`span`,{className:`text-fail [overflow-wrap:anywhere]`,children:n.get(e.key)})]},`${e.key}-${t}`);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-[13px]`,children:[e.changes.length?(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.changes.map((e,t)=>i(e,t))}):(0,Z.jsx)(`p`,{className:`m-0 text-ink-2`,children:`Nothing to write: the trackers already say so.`}),e.skipped.length>0&&(0,Z.jsxs)(`details`,{children:[(0,Z.jsxs)(`summary`,{className:`cursor-pointer text-muted`,children:[`Left out: `,e.skipped.length]}),(0,Z.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 Ae(e,t,n){let[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{i(null),o(null),c(``),e&&e().then(e=>i(e??null),e=>c(e.message))},[e]),{plan:r,outcome:a,error:s,busy:l,go:async()=>{if(r){u(!0),c(``);try{let e=await t(r.digest);e&&(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 je({kind:e,keys:t,tags:n,onClose:i,onDone:a}){let[o,s]=(0,J.useState)(null);(0,J.useEffect)(()=>s(e?()=>()=>Y.writeBack(e,t,void 0,n).then(e=>e.plan):null),[e,t,n]);let c=Ae(o,r=>Y.writeBack(e,t,r,n).then(e=>e.outcome),a);return(0,Z.jsx)(V,{open:!!e,onClose:i,title:e?Ce[e]:``,description:e?we[e]:``,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:i,children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),c.outcome?`Close`:`Cancel`]}),!c.outcome&&(0,Z.jsxs)(F,{variant:`primary`,disabled:c.busy||!c.plan?.changes.length,onClick:()=>void c.go(),"data-tip":`Write these changes`,children:[e===`untag`?(0,Z.jsx)(v,{"aria-hidden":`true`}):(0,Z.jsx)(r,{"aria-hidden":`true`}),c.busy?`Writing…`:`${e===`untag`?`Take off`:`Write`} ${c.plan?.changes.length??``}`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[!c.plan&&!c.error&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Working out what would change…`}),c.error&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c.error}),c.plan&&(0,Z.jsx)(ke,{plan:c.plan,outcome:c.outcome})]})})}function Me({open:e,suite:t,targets:n,onClose:r,onDone:i}){let[a,o]=(0,J.useState)(``),s=t.tracker?void 0:n.find(e=>Ee(e)===(a||(n[0]?Ee(n[0]):``))),[c,l]=(0,J.useState)(null);(0,J.useEffect)(()=>l(e&&(t.tracker||s)?()=>()=>Y.suiteTracker(t.id,s).then(e=>e.plan):null),[e,t.id,t.tracker,s&&Ee(s)]);let d=Ae(c,e=>Y.suiteTracker(t.id,s,e).then(e=>e.outcome),i),p=t.tracker;return(0,Z.jsx)(V,{open:e,onClose:r,title:p?`Keep ${t.name} in step`:`Keep ${t.name} in a tracker`,description:p?`It is ${Oe(p)}. 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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:r,children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),d.outcome?`Close`:`Cancel`]}),!d.outcome&&(0,Z.jsxs)(F,{variant:`primary`,disabled:d.busy||!d.plan?.changes.length,onClick:()=>void d.go(),children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),d.busy?`Writing…`:p?`Keep in step`:`Make it there`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[!p&&(n.length?(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Where`,(0,Z.jsx)(M,{value:s?Ee(s):``,onChange:e=>o(e.target.value),children:n.map(e=>(0,Z.jsx)(`option`,{value:Ee(e),children:Te(e)},Ee(e)))})]}):(0,Z.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.`})),(p||s)&&!d.plan&&!d.error&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Working out what would change…`}),d.error&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:d.error}),d.plan&&(0,Z.jsx)(ke,{plan:d.plan,outcome:d.outcome}),d.outcome&&!d.outcome.failed.length&&(0,Z.jsx)(P,{tone:`pass`,children:`Done`})]})})}var Ne={automated:s,not_automated:l,pending:d,known_defect:O,needs_attention:O},Pe={passed:`pass`,failed:`fail`,blocked:`warn`,not_run:`neutral`};function Q({text:e,tip:t,className:n}){return(0,Z.jsx)(`span`,{"data-tip":t??e,className:A(`block truncate`,n),children:e})}function Fe({a:e}){let t=Ne[e];return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-[13px] whitespace-nowrap`,children:[(0,Z.jsx)(t,{size:15,"aria-hidden":`true`,className:A(`flex-none`,e===`automated`?`text-pass`:e===`known_defect`?`text-fail`:e===`not_automated`?`text-muted`:`text-warn`)}),ve[e]]})}function Ie({o:e}){return(0,Z.jsx)(P,{tone:Pe[e],icon:e!==`not_run`,children:X[e]})}function Le({runs:e}){return e.length?(0,Z.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,Z.jsx)(`span`,{className:A(`inline-block h-4 w-2 rounded-[2px]`,e===`p`?`bg-pass`:`bg-fail`)},t))}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})}function Re({tags:e,max:t=3}){return e.length?(0,Z.jsxs)(`span`,{className:`inline-flex flex-wrap gap-1`,children:[e.slice(0,t).map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-[6px] bg-surface-strong px-2 text-[13px] text-ink-2`,children:[(0,Z.jsx)(b,{size:11,"aria-hidden":`true`}),e]},e)),e.length>t&&(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,"data-tip":e.slice(t).join(`, `),children:[`+`,e.length-t]})]}):null}function ze({points:e,label:t,format:n=e=>String(e),height:r=160}){if(e.length<2)return(0,Z.jsx)(`p`,{className:`m-0 text-[13px] 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,Z.jsxs)(`figure`,{className:`m-0 flex flex-col gap-1`,children:[(0,Z.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,Z.jsx)(`line`,{x1:`0`,x2:600,y1:(i-20)*e+4,y2:(i-20)*e+4,className:`stroke-line-soft`,strokeWidth:`1`},e)),(0,Z.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,Z.jsx)(`polyline`,{points:d.join(` `),fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,Z.jsx)(`circle`,{cx:l(e.length-1),cy:u(f.y),r:`4`,fill:`currentColor`,className:`stroke-bg`,strokeWidth:`2`})]}),(0,Z.jsxs)(`figcaption`,{className:`flex justify-between text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{children:e[0].x}),(0,Z.jsxs)(`span`,{className:`font-medium text-ink`,children:[n(f.y),` now`]}),(0,Z.jsx)(`span`,{children:f.x})]})]})}function Be({items:e,series:t,label:n}){let r=Math.max(1,...e.flatMap(e=>e.values));return(0,Z.jsxs)(`figure`,{className:`m-0 flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`flex flex-wrap gap-4 text-[13px] text-ink-2`,children:t.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:A(`inline-block size-[10px] rounded-[3px]`,e.className),"aria-hidden":`true`}),e.name]},e.name))}),(0,Z.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,Z.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,Z.jsx)(`span`,{className:A(`w-full max-w-[14px] rounded-t-[4px]`,t[n]?.className),style:{height:`${Math.max(e?3:0,e/r*100)}%`}},n))},e.x))}),(0,Z.jsxs)(`span`,{className:`flex justify-between text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{children:e[0]?.x}),(0,Z.jsx)(`span`,{children:e.at(-1)?.x})]})]})}function Ve({label:e,part:t,whole:n,className:r=`bg-accent`}){let i=n?Math.round(t/n*100):0;return(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,140px)_1fr_auto] items-center gap-4 text-[13px]`,children:[(0,Z.jsx)(Q,{text:e,className:`text-ink-2`}),(0,Z.jsx)(`span`,{className:`h-2 overflow-hidden rounded-full bg-surface-strong`,role:`img`,"aria-label":`${e}: ${t} of ${n}`,children:(0,Z.jsx)(`span`,{className:A(`block h-full rounded-full`,r),style:{width:`${i}%`}})}),(0,Z.jsxs)(`span`,{className:`w-[86px] text-right tabular-nums text-ink-2`,children:[t,` of `,n]})]})}function He({open:e,onClose:t,title:n,preview:r,onStarted:a}){let[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(null),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(!1);(0,J.useEffect)(()=>{e&&(d(null),m(``),Y.suites().then(e=>{s({list:e.environments,...e.active?{active:e.active}:{}}),l(e.active&&e.environments.includes(e.active)?e.active:e.environments[0]??``)},e=>m(e.message)))},[e]),(0,J.useEffect)(()=>{e&&o!==null&&r(c||void 0,!1).then(e=>{d(e.preview??null),m(``)},e=>m(e.message))},[e,c,o]);let _=async()=>{g(!0);try{await r(c||void 0,!0),a(),t()}catch(e){m(e.message)}finally{g(!1)}};return(0,Z.jsx)(V,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:t,children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:h||!u,onClick:()=>void _(),"data-tip":`Start the run`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Run `,u?u.cases:``]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[o&&o.list.length>0&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Environment`,(0,Z.jsx)(M,{value:c,onChange:e=>l(e.target.value),children:o.list.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))})]}),u&&(0,Z.jsxs)(`p`,{role:`status`,className:`m-0 text-ink-2`,children:[u.cases,` test case`,u.cases===1?``:`s`,` on `,u.env??`the active environment`,`.`]}),p&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:p})]})})}var Ue=e=>e.lastRun.outcome===`failed`||e.lastRun.outcome===`blocked`,We=e=>w(`test-management`,`cases`,encodeURIComponent(e));function Ge({cases:e,onChanged:t}){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(`all`),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(null),f=()=>Y.tests().then(e=>{r(e),a(``)},e=>a(e.message));(0,J.useEffect)(()=>{f()},[]),(0,J.useEffect)(()=>{if(!n?.busy)return;let e=pe(()=>void f(),3e3);return()=>se(e)},[n?.busy]),qe(n?.busy??null,()=>t(`Done: the tests and their links are up to date.`));let p=(0,J.useMemo)(()=>new Map(e.map(e=>[e.key,e])),[e]);if(i)return(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:i});if(!n)return(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let h=n.tests.filter(e=>e.uid),v={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},y=h.filter(e=>o===`all`||(o===`unlinked`?!e.cases.length:o===`linked`?e.cases.length>0:e.via===`code`)),b=async()=>{try{t(`The mapping agent is looking at ${(await Y.proposeLinks()).cases} cases with no test.`),f()}catch(e){t(e.message)}};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(F,{variant:`primary`,onClick:()=>l(!0),disabled:!!n.busy,children:[(0,Z.jsx)(m,{"aria-hidden":`true`}),`Discover tests`]}),(0,Z.jsxs)(F,{onClick:()=>void b(),disabled:!!n.busy||!h.length,"data-tip":`The mapping agent links cases that have no test to the tests that check them`,children:[(0,Z.jsx)(_,{"aria-hidden":`true`}),`Link with the agent`]}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[n.busy?n.busy.what===`discover`?`Discovering tests, started ${K(n.busy.started)}…`:`The mapping agent is at work, started ${K(n.busy.started)}…`:n.discovery?`Discovered ${K(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,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:n.error}),n.discovery&&n.discovery.projects.length>0&&(0,Z.jsx)(Je,{projects:n.discovery.projects}),h.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(R,{items:[{id:`all`,label:`All`,n:v.all},{id:`unlinked`,label:`No test case`,n:v.unlinked},{id:`linked`,label:`Linked`,n:v.linked},{id:`code`,label:`Read from the code`,n:v.code,tip:`Their framework was not asked, or could not list them`}],value:o,onChange:s})}),(0,Z.jsx)(U,{label:`Automated tests`,placeholder:`Find a test by id, name, file or tag`,resetKey:o,empty:`No test matches.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-[45%]`),children:`Test`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Framework`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Test cases`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @3xl:table-cell`),children:`Tags`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Last runs`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:y.map(t=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsxs)(`td`,{className:A(z,`max-w-0`),children:[(0,Z.jsx)(Q,{text:t.name,tip:t.nativeId??t.name}),(0,Z.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:t.uid}),t.file&&(0,Z.jsxs)(`span`,{className:`truncate font-mono`,children:[t.file,t.line?`:${t.line}`:``]}),t.flaky&&(0,Z.jsx)(P,{tone:`warn`,children:`Flaky`})]})]}),(0,Z.jsx)(`td`,{className:A(z,`hidden text-[13px] @2xl:table-cell`),children:(0,Z.jsxs)(`span`,{className:`flex flex-col`,children:[(0,Z.jsxs)(`span`,{children:[Ke[t.framework??`code`],t.framework===`gherkin`?`, ${t.runner??`no runner found`}`:``]}),(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:be[t.via??`runs`]})]})}),(0,Z.jsx)(`td`,{className:A(z,`text-[13px]`),children:t.cases.length?(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-x-2`,children:[t.cases.slice(0,4).map(e=>(0,Z.jsx)(`a`,{href:We(e),className:`font-mono`,"data-tip":p.get(e)?.title,children:p.get(e)?.id??e},e)),t.cases.length>4&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[`+`,t.cases.length-4]})]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,Z.jsx)(`td`,{className:A(z,`hidden @3xl:table-cell`),children:(0,Z.jsx)(Re,{tags:t.tags})}),(0,Z.jsx)(`td`,{className:A(z,`hidden @2xl:table-cell`),children:(0,Z.jsx)(Le,{runs:t.runs})}),(0,Z.jsx)(`td`,{className:A(z,`text-right`),children:(0,Z.jsxs)(F,{size:`sm`,onClick:()=>d(t),"aria-label":`Link ${t.name} to a test case`,disabled:!e.length,children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),`Link`]})})]},t.uid))})]}):(0,Z.jsx)(L,{icon:C,title:`No automated test found yet`,children:`Discover tests 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.`}),(0,Z.jsx)(Ye,{open:c,onClose:()=>l(!1),onStarted:()=>{l(!1),t(`Discovering tests: each project's framework lists its tests.`),f()}}),(0,Z.jsx)(Xe,{open:!!u,title:`Link to a test case`,description:u?`Pick the test case ${u.name} checks. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`:void 0,items:e.filter(e=>!u?.cases.includes(e.key)).map(e=>({id:e.key,label:e.title,sub:e.id})),onClose:()=>d(null),onPick:async e=>{u?.uid&&(await Y.link([{case:e,test:u.uid,action:`link`}]),d(null),t(`Linked ${u.uid} to ${p.get(e)?.id??e}.`),f())}})]})}var Ke={pytest:`pytest`,dotnet:`.NET`,playwright:`Playwright`,jest:`Jest`,vitest:`Vitest`,mocha:`Mocha`,robot:`Robot Framework`,gherkin:`Gherkin`,code:`Code`};function qe(e,t){let[n,r]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{e?r(!0):n&&(r(!1),t())},[e]),n}function Je({projects:e}){return(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:e.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-start gap-2`,children:[e.ok?(0,Z.jsx)(s,{size:14,"aria-label":`Listed`,className:`mt-1 flex-none text-pass`}):(0,Z.jsx)(O,{size:14,"aria-label":`Not listed`,className:`mt-1 flex-none text-warn`}),(0,Z.jsxs)(`span`,{children:[e.label,` in `,e.dir?(0,Z.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,Z.jsx)(`span`,{className:`block text-muted [overflow-wrap:anywhere]`,children:e.error})]})]},`${e.framework}-${e.dir}-${t}`))})}function Ye({open:e,onClose:t,onStarted:n}){let[r,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1);(0,J.useEffect)(()=>{e&&(a(null),s(``),Y.discoveryPlan().then(a,e=>s(e.message)))},[e]);let u=async()=>{if(r){l(!0);try{await Y.discover(r.digest),n()}catch(e){s(e.message)}finally{l(!1)}}};return(0,Z.jsx)(V,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(F,{onClick:t,children:`Cancel`}),(0,Z.jsxs)(F,{variant:`primary`,onClick:()=>void u(),disabled:!r||c,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Discover`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-[13px]`,children:[o&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:o}),!r&&!o&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Finding the test projects…`}),r&&!r.steps.length&&(0,Z.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,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:r.steps.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`span`,{children:[Ke[e.project.framework],` in `,e.project.dir?(0,Z.jsx)(`span`,{className:`font-mono`,children:e.project.dir}):`the repository's root`]}),(0,Z.jsx)(`code`,{className:`rounded-[8px] bg-surface-strong px-2 py-1 font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.command})]},t))})]})})}function Xe({open:e,title:t,description:n,items:r,onClose:i,onPick:o}){let[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(``);(0,J.useEffect)(()=>c(``),[e]);let d=async e=>{u(e),c(``);try{await o(e)}catch(e){c(e.message)}finally{u(``)}};return(0,Z.jsx)(V,{open:e,onClose:i,title:t,description:n,wide:!0,footer:(0,Z.jsx)(F,{onClick:i,children:`Close`}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[s&&(0,Z.jsxs)(`p`,{role:`alert`,className:`m-0 flex items-center gap-2 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[(0,Z.jsx)(a,{size:14,"aria-hidden":`true`}),s]}),(0,Z.jsx)(U,{label:t,placeholder:`Find by id or words`,resetKey:String(e),empty:`Nothing to pick.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Name`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Pick`})})]}),children:r.map(e=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsxs)(`td`,{className:A(z,`max-w-0`),children:[(0,Z.jsx)(Q,{text:e.label}),e.sub&&(0,Z.jsx)(`span`,{className:`block truncate font-mono text-[13px] text-muted`,children:e.sub})]}),(0,Z.jsx)(`td`,{className:A(z,`w-24 text-right`),children:(0,Z.jsxs)(F,{size:`sm`,onClick:()=>void d(e.id),disabled:!!l,children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),`Link`]})})]},e.id))})]})})}var Ze=e=>e&&/^https:\/\//i.test(e)?e:void 0;function Qe({caseKey:e,onRun:n}){let[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(``);(0,J.useEffect)(()=>{o(null),Y.case(e).then(e=>{o(e),c(``)},e=>c(e.message))},[e]);let p=(0,Z.jsxs)(`a`,{href:w(`test-management`,`cases`),className:`inline-flex w-fit items-center gap-2 text-[13px]`,children:[(0,Z.jsx)(ee,{size:14,"aria-hidden":`true`}),`Test cases`]});if(s)return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[p,(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:s})]});if(!a)return(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let m=a.case,h=Ze(m.url);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[p,(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_420px] flex-col gap-2`,children:[(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:m.id}),` · `,m.plans.join(`, `)||`Not in a synced plan`]}),(0,Z.jsx)(`h2`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:m.title}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[m.priority&&(0,Z.jsxs)(P,{tone:m.priority===1?`fail`:m.priority===2?`warn`:`neutral`,icon:!1,children:[`Priority `,m.priority]}),m.state&&(0,Z.jsx)(P,{tone:`neutral`,children:m.state}),(0,Z.jsx)(Fe,{a:m.automation}),m.origin===`forgeqe`&&(0,Z.jsxs)(P,{tone:`running`,icon:!1,children:[(0,Z.jsx)(_,{size:12,"aria-hidden":`true`}),`Written by ForgeQE`,m.createdAt?` ${K(m.createdAt)}`:``]})]})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[h&&(0,Z.jsxs)(`a`,{className:I(),href:h,target:`_blank`,rel:`noreferrer noopener`,children:[(0,Z.jsx)(x,{"aria-hidden":`true`}),`Open in its system`]}),m.how!==`none`&&m.how!==`tracker`&&!!m.test?.file&&m.trackerAutomated!==!0&&(0,Z.jsxs)(F,{onClick:()=>u(`automation`),children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),`Mark automated in its system`]}),m.ownTags.some(e=>!m.trackerTags.includes(e))&&(0,Z.jsxs)(F,{onClick:()=>u(`tags`),children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),`Write tags to its system`]}),m.ownTags.some(e=>m.trackerTags.includes(e))&&(0,Z.jsxs)(F,{onClick:()=>u(`untag`),children:[(0,Z.jsx)(v,{"aria-hidden":`true`}),`Take tags off in its system`]}),(0,Z.jsxs)(F,{variant:`primary`,onClick:()=>n([m.key]),children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Run`]})]})]}),(0,Z.jsx)(je,{kind:l,keys:[m.key],onClose:()=>u(null),onDone:t=>(f(t),void Y.case(e).then(o,()=>{}))}),d&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:d}),(m.stale||m.drift)&&(0,Z.jsxs)(`p`,{role:`status`,className:`m-0 flex items-start gap-2 rounded-[12px] bg-warn-soft px-4 py-2 text-[13px] text-warn`,children:[(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Z.jsxs)(`span`,{children:[m.stale&&`Its steps changed in its system after its test was written: the next run updates the test. `,m.drift&&(m.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,Z.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Z.jsx)(U,{label:`Steps`,search:!1,empty:`Its system holds no steps for it, or it is not in a synced plan.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-10`),children:`#`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Action`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Expected result`})]}),children:a.steps.map((e,t)=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Z.jsx)(`td`,{className:A(z,`text-[13px] text-muted tabular-nums`),children:t+1}),(0,Z.jsx)(`td`,{className:A(z,`text-[13px] [overflow-wrap:anywhere]`),children:e.action}),(0,Z.jsx)(`td`,{className:A(z,`text-[13px] text-ink-2 [overflow-wrap:anywhere]`),children:e.expected??`–`})]},t))}),(0,Z.jsx)($e,{detail:a,onChanged:t=>(f(t),void Y.case(e).then(o,()=>{}))})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6 text-[13px]`,children:[(0,Z.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:`Details`}),(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[96px_1fr] gap-x-4 gap-y-2`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Last run`}),(0,Z.jsxs)(`dd`,{className:`m-0 flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(Ie,{o:m.lastRun.outcome}),m.lastRun.at&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[K(m.lastRun.at),m.lastRun.by===`tracker`?`, in its system`:``]})]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Suite`}),(0,Z.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:m.suite??`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Area`}),(0,Z.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:m.group??`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Stories`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:m.stories.join(`, `)||`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Tags`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:m.tags.length?(0,Z.jsx)(Re,{tags:m.tags,max:10}):`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Steps`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:m.steps})]})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-2 rounded-[14px] border p-6 text-[13px]`,children:[(0,Z.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-[16px] font-semibold`,children:[(0,Z.jsx)(t,{size:16,"aria-hidden":`true`}),`In suites and packs`]}),a.suites.length||m.packs.length?(0,Z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[a.suites.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`a`,{href:w(`test-management`,`suites`,e.id),children:e.name})},e.id)),m.packs.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:w(`regression`,e),children:[`Pack `,e]})},e))]}):(0,Z.jsx)(`p`,{className:`m-0 text-muted`,children:`In no suite or regression pack.`})]}),a.changes.length>0&&(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-2 rounded-[14px] border p-6 text-[13px]`,children:[(0,Z.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:`What ForgeQE did`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.changes.map((e,t)=>(0,Z.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:K(e.at)}),` `,e.action,e.story?` for ${e.story}`:``,e.reason?`: ${e.reason}`:``]},t))})]})]})]})]})}function $e({detail:e,onChanged:t}){let n=e.case,[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(``);(0,J.useEffect)(()=>{(n.proposed.length||a)&&Y.tests().then(e=>i(e.tests),()=>{})},[n.proposed.length,a]);let l=new Map((r??[]).filter(e=>e.uid).map(e=>[e.uid,e])),d=async(e,r,i)=>{c(``);try{await Y.link([{case:n.key,test:e,action:r}]),t(i)}catch(e){c(e.message)}},p=async e=>{c(``);try{t(`${e} is the main test now${(await Y.setMain(n.key,e)).mapped?`, and ForgeQE's mapping records it`:``}. Mark automated writes it to the tracker.`)}catch(e){c(e.message)}},m=async()=>{c(``);try{await Y.proposeLinks([n.key]),t(`The mapping agent is looking for this case's tests. Open the case again in a moment.`)}catch(e){c(e.message)}};return(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-[16px] font-semibold`,children:[(0,Z.jsx)(C,{size:16,"aria-hidden":`true`}),`Automated tests`]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>o(!0),children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),`Link a test`]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>void m(),"data-tip":`The mapping agent picks the tests that check this case`,children:[(0,Z.jsx)(_,{"aria-hidden":`true`}),`Ask the agent`]})]}),s&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:s}),n.tests.length?(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0 text-[13px]`,children:n.tests.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-start gap-2 border-t border-line-soft py-2 first:border-t-0`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1`,children:[(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 [overflow-wrap:anywhere]`,children:[e.name,e.main&&n.tests.length>1&&(0,Z.jsx)(`span`,{"data-tip":`What its tracker records as its automated test, and what a run reuses first`,children:(0,Z.jsx)(P,{tone:`pass`,icon:!1,children:`Main test`})})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-[13px] text-muted`,children:[e.uid&&(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.uid}),e.file&&(0,Z.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:e.file})]}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[ye[e.how],e.why&&e.why!==ye[e.how]?`: ${e.why}`:``]})]}),e.uid&&n.tests.length>1&&!e.main&&(0,Z.jsxs)(F,{size:`sm`,variant:`ghost`,onClick:()=>void p(e.uid),"aria-label":`Make ${e.name} the main test`,"data-tip":`Its tracker records this one as the case's automated test`,children:[(0,Z.jsx)(y,{"aria-hidden":`true`}),`Make main`]}),e.uid&&e.how!==`mapping`&&(0,Z.jsxs)(F,{size:`sm`,variant:`ghost`,onClick:()=>void d(e.uid,`unlink`,`Unlinked ${e.uid}. It is not linked again by itself.`),"aria-label":`Unlink ${e.name}`,children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Unlink`]})]},e.uid??e.key))}):n.test?(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[120px_1fr] gap-x-4 gap-y-2 text-[13px]`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Test`}),(0,Z.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:n.test.name}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`File`}),(0,Z.jsx)(`dd`,{className:`m-0 font-mono [overflow-wrap:anywhere]`,children:n.test.file??`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Known from`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:n.how===`none`?`–`:ye[n.how]})]}):(0,Z.jsx)(`p`,{className:`m-0 text-[13px] 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,Z.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-[13px] text-muted`,children:[`Last runs `,(0,Z.jsx)(Le,{runs:e.test?.runs??n.runs})]}),n.proposed.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] bg-surface-muted p-4 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Proposed by the mapping agent`}),n.proposed.map(e=>{let t=l.get(e.test);return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,Z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t?.name??e.test}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.test}),e.confidence?` · ${e.confidence} confidence`:``,e.why?` · ${e.why}`:``]})]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>void d(e.test,`accept`,`Linked ${e.test}.`),children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Accept`]}),(0,Z.jsxs)(F,{size:`sm`,variant:`ghost`,onClick:()=>void d(e.test,`refuse`,`Refused ${e.test}.`),children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Refuse`]})]},e.test)})]}),(0,Z.jsx)(Xe,{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 Y.link([{case:n.key,test:e,action:`link`}]),o(!1),t(`Linked ${e}.`)}})]})}var et=[{id:`all`,label:`All`,icon:S,test:()=>!0},{id:`not_automated`,label:`Not automated`,icon:l,test:e=>e.automation===`not_automated`},{id:`failing`,label:`Failing`,icon:a,test:Ue,alert:!0},{id:`pending`,label:`Pending`,icon:d,test:e=>e.automation===`pending`},{id:`generated`,label:`Generated by ForgeQE`,icon:_,test:e=>e.origin===`forgeqe`},{id:`stale`,label:`Steps changed`,icon:O,test:e=>e.stale},{id:`drift`,label:`Tracker disagrees`,icon:O,test:e=>e.drift}],$=``,tt=e=>[...new Set(e.filter(e=>!!e))].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}));function nt({cases:e,tests:n=0,selected:a,onSelect:o,onRun:s,onChanged:c}){let[l,u]=(0,J.useState)(`all`),[d,p]=(0,J.useState)($),[m,h]=(0,J.useState)($),[g,v]=(0,J.useState)($),[y,ee]=(0,J.useState)($),[x,te]=(0,J.useState)(!1),[S,C]=(0,J.useState)(!1),[w,ne]=(0,J.useState)(null),T=(0,J.useMemo)(()=>tt(e.flatMap(e=>e.plans)),[e]),E=(0,J.useMemo)(()=>tt(e.map(e=>e.suite)),[e]),D=(0,J.useMemo)(()=>tt(e.flatMap(e=>e.tags)),[e]),O=e.filter(e=>(!d||e.plans.includes(d))&&(!m||e.suite===m)&&(!g||String(e.priority??``)===g)&&(!y||e.tags.includes(y))),re=et.find(e=>e.id===l),k=O.filter(re.test),j=new Set(a),ie=(e,t)=>o(t?[...a,e]:a.filter(t=>t!==e)),N=k.length>0&&k.every(e=>j.has(e.key));return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a.length>0&&(0,Z.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-2 rounded-[12px] bg-accent-soft px-4 py-2 text-[13px] text-accent-fg`,children:[(0,Z.jsxs)(`span`,{className:`font-medium`,children:[a.length,` selected`]}),(0,Z.jsxs)(F,{size:`sm`,variant:`ghost`,onClick:()=>o([]),children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Clear`]}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>te(!0),children:[(0,Z.jsx)(b,{"aria-hidden":`true`}),`Tag`]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>C(!0),children:[(0,Z.jsx)(t,{"aria-hidden":`true`}),`Make a suite`]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>ne(`automation`),"data-tip":`Mark the picked cases automated in their tracker`,children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),`Mark automated`]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>ne(`tags`),"data-tip":`Write ForgeQE's tags to their tracker`,children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),`Write tags`]}),(0,Z.jsxs)(F,{size:`sm`,variant:`primary`,onClick:()=>s(a),children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Run `,a.length]})]}),(0,Z.jsx)(U,{label:`Test cases`,placeholder:`Find a case by id, title, tag or test`,resetKey:`${l}|${d}|${m}|${g}|${y}`,empty:e.length?`Nothing matches.`:n?`No test cases yet. The repository's ${n} automated test${n===1?` is`:`s are`} on the Automated tab.`:`No test cases yet.`,tools:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(R,{items:et.map(e=>({id:e.id,label:e.label,icon:e.icon,n:O.filter(e.test).length,...e.alert?{alert:!0}:{}})),value:l,onChange:u})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[T.length>1&&(0,Z.jsxs)(M,{size:`sm`,"aria-label":`Plan`,value:d,onChange:e=>p(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Every plan`}),T.map(e=>(0,Z.jsx)(`option`,{children:e},e))]}),E.length>0&&(0,Z.jsxs)(M,{size:`sm`,"aria-label":`Suite`,value:m,onChange:e=>h(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Every suite`}),E.map(e=>(0,Z.jsx)(`option`,{children:e},e))]}),(0,Z.jsxs)(M,{size:`sm`,"aria-label":`Priority`,value:g,onChange:e=>v(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Any priority`}),[`1`,`2`,`3`,`4`].map(e=>(0,Z.jsxs)(`option`,{value:e,children:[`Priority `,e]},e))]}),D.length>0&&(0,Z.jsxs)(M,{size:`sm`,"aria-label":`Tag`,value:y,onChange:e=>ee(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Any tag`}),D.map(e=>(0,Z.jsx)(`option`,{children:e},e))]})]})]}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-10`),children:(0,Z.jsx)(q,{"aria-label":`Select every case shown`,checked:N,onCheckedChange:e=>o(e?tt([...a,...k.map(e=>e.key)]):a.filter(e=>!k.some(t=>t.key===e)))})}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Test case`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Suite`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Priority`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Automation`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @4xl:table-cell`),children:`Last runs`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Last run`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:k.map(e=>(0,Z.jsxs)(`tr`,{className:A(`border-t border-line-soft align-top hover:bg-surface-muted`,j.has(e.key)&&`bg-accent-soft hover:bg-accent-soft`),children:[(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(q,{"aria-label":`Select ${e.id}`,checked:j.has(e.key),onCheckedChange:t=>ie(e.key,t)})}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsxs)(`a`,{href:We(e.key),className:`flex min-w-[220px] flex-col gap-1 text-ink no-underline`,children:[(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.id}),e.origin===`forgeqe`&&(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"data-tip":`ForgeQE wrote this case`,children:[(0,Z.jsx)(_,{size:12,"aria-hidden":`true`}),`ForgeQE`]}),e.stories[0]&&(0,Z.jsx)(`span`,{children:e.stories[0]}),(0,Z.jsx)(Re,{tags:e.tags,max:2})]})]})}),(0,Z.jsx)(`td`,{className:A(z,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:(0,Z.jsx)(Q,{text:e.suite??e.plans[0]??`–`})}),(0,Z.jsx)(`td`,{className:A(z,`hidden text-[13px] @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Z.jsxs)(`td`,{className:z,children:[(0,Z.jsx)(Fe,{a:e.automation}),e.stale&&(0,Z.jsx)(`span`,{className:`mt-1 block text-[13px] text-warn`,children:`Steps changed`})]}),(0,Z.jsx)(`td`,{className:A(z,`hidden @4xl:table-cell`),children:(0,Z.jsx)(Le,{runs:e.runs})}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(`span`,{"data-tip":e.lastRun.at?`${K(e.lastRun.at)}${e.lastRun.by===`tracker`?`, in its system`:``}`:void 0,children:(0,Z.jsx)(Ie,{o:e.lastRun.outcome})})}),(0,Z.jsx)(`td`,{className:A(z,`text-right whitespace-nowrap`),children:(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":Ue(e)?`Run again`:`Run`,onClick:()=>s([e.key]),children:(0,Z.jsx)(i,{"aria-hidden":`true`})})})]},e.key))}),(0,Z.jsx)(je,{kind:w,keys:a,onClose:()=>ne(null),onDone:e=>c(e)}),(0,Z.jsx)(rt,{open:x,keys:a,onClose:()=>te(!1),onDone:e=>c(e)}),(0,Z.jsx)(it,{open:S,keys:a,onClose:()=>C(!1),onDone:e=>c(e)})]})}function rt({open:e,keys:t,onClose:n,onDone:r}){let[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(!1),p=async()=>{d(!0),l(``);try{let e={[o?`remove`:`add`]:[i.trim()],cases:t};await Y.tag(e);let s=await Y.tag(e,!0);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,Z.jsx)(V,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:n,children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:u||!i.trim(),onClick:()=>void p(),children:[(0,Z.jsx)(b,{"aria-hidden":`true`}),o?`Remove`:`Add`,` tag`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Tag`,(0,Z.jsx)(N,{value:i,maxLength:40,placeholder:`smoke, release-24.11`,onChange:e=>a(e.target.value)})]}),(0,Z.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(q,{checked:o,onCheckedChange:s}),`Remove it instead`]}),c&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:c})]})})}function it({open:e,keys:n,onClose:r,onDone:i}){let[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),d=async()=>{u(!0),c(``);try{let{suite:e}=await Y.saveSuite({name:a.trim(),groups:[],exclude:[],picked:n});i(`Made the suite ${e.name}.`),o(``),r(),location.hash=w(`test-management`,`suites`,e.id)}catch(e){c(e.message)}finally{u(!1)}};return(0,Z.jsx)(V,{open:e,onClose:r,title:`A suite of ${n.length} test case${n.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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:r,children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:l||!a.trim(),onClick:()=>void d(),children:[(0,Z.jsx)(t,{"aria-hidden":`true`}),`Make the suite`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Name`,(0,Z.jsx)(N,{value:a,maxLength:80,placeholder:`Saved cards`,onChange:e=>o(e.target.value)})]}),s&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:s})]})})}var at=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString([],{month:`short`,day:`numeric`,timeZone:`UTC`}),ot=(e,t)=>t?Math.round(e/t*100):0;function st(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 ${at(a.day)}`}}function ct({view:e,onRunSuite:t}){let n=e.summary;if(!n.cases&&!e.plans.length&&n.tests)return(0,Z.jsx)(L,{icon:C,title:`${n.tests} automated test${n.tests===1?``:`s`} found, no test case yet`,action:(0,Z.jsxs)(`a`,{className:I({size:`sm`}),href:w(`test-management`,`tests`),"data-tip":`Open the Automated tab`,children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),`See the 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(!n.cases&&!e.plans.length)return(0,Z.jsx)(L,{icon:S,title:`No test plans connected yet`,action:(0,Z.jsxs)(`a`,{className:I({size:`sm`}),href:w(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,Z.jsx)(T,{"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 r=e.trend;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(de,{label:`Headline numbers`,children:[(0,Z.jsx)(G,{label:`Test cases`,icon:S,value:n.cases,change:st(r,e=>e.cases,void 0),note:`${e.plans.length} plan${e.plans.length===1?``:`s`}`}),(0,Z.jsx)(G,{label:`Automated`,icon:s,value:`${n.automated} · ${ot(n.automated,n.cases)}%`,change:st(r,e=>e.automated,!0),note:`${n.newlyAutomated} newly this week`}),(0,Z.jsx)(G,{label:`Not automated`,icon:l,value:n.notAutomated,change:st(r,e=>e.notAutomated,!1)}),(0,Z.jsx)(G,{label:`Pending`,icon:d,value:n.pending,tone:n.pending?`text-warn`:void 0,change:st(r,e=>e.pending,!1),note:`in Design or not ready`}),(0,Z.jsx)(G,{label:`Failing`,icon:a,value:n.failing,tone:n.failing?`text-fail`:void 0,change:st(r,e=>e.failing,!1),note:`their last run`}),(0,Z.jsx)(G,{label:`Generated by ForgeQE`,icon:_,value:n.generated,change:st(r,e=>e.generated,!0)})]}),(0,Z.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-2`,children:[(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Automation coverage`}),(0,Z.jsx)(ze,{label:`Share of test cases automated`,points:r.map(e=>({x:at(e.day),y:ot(e.automated,e.cases)})),format:e=>`${e}%`})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Generated and automated, by week`}),(0,Z.jsx)(Be,{label:`Test cases generated and automated each week`,series:[{name:`Generated`,className:`bg-accent-line`},{name:`Automated`,className:`bg-accent`}],items:e.weekly.map(e=>({x:at(e.week),values:[e.generated,e.automated]}))})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Last run of every case`}),(0,Z.jsxs)(`div`,{role:`img`,"aria-label":`Passed ${n.cases-n.failing-n.neverRun}, failing ${n.failing}, not run ${n.neverRun}`,className:`flex h-3 gap-1 overflow-hidden rounded-full`,children:[(0,Z.jsx)(`span`,{className:`bg-pass`,style:{flex:n.cases-n.failing-n.neverRun}}),(0,Z.jsx)(`span`,{className:`bg-fail`,style:{flex:n.failing}}),(0,Z.jsx)(`span`,{className:`bg-line-strong`,style:{flex:n.neverRun}})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-4 text-[13px]`,children:[(0,Z.jsx)(`a`,{href:w(`test-management`,`cases`),className:`no-underline`,children:(0,Z.jsxs)(P,{tone:`pass`,children:[`Passed `,n.cases-n.failing-n.neverRun]})}),(0,Z.jsx)(`a`,{href:w(`test-management`,`gaps`),className:`no-underline`,children:(0,Z.jsxs)(P,{tone:`fail`,children:[`Failing `,n.failing]})}),(0,Z.jsx)(`a`,{href:w(`test-management`,`gaps`),className:`no-underline`,children:(0,Z.jsxs)(P,{tone:`neutral`,children:[`Not run `,n.neverRun]})})]})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline justify-between gap-4`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Automated, by suite`}),(0,Z.jsx)(`a`,{href:w(`test-management`,`gaps`),className:`text-[13px]`,children:`Find gaps`})]}),e.coverage.length?e.coverage.slice(0,8).map(e=>(0,Z.jsx)(Ve,{label:e.suite,part:e.automated,whole:e.cases},e.suite)):(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`No suites yet.`})]})]}),(0,Z.jsx)(U,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Suite`}),(0,Z.jsx)(`th`,{scope:`col`,className:W,children:`Cases`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Last run`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.suites.map(e=>(0,Z.jsxs)(`tr`,{className:ce,onClick:()=>location.hash=w(`test-management`,`suites`,e.id),children:[(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(`a`,{href:w(`test-management`,`suites`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium`,children:e.name})}),(0,Z.jsx)(`td`,{className:B,children:e.cases}),(0,Z.jsx)(`td`,{className:z,children:e.last?(0,Z.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2 text-[13px]`,children:[(0,Z.jsxs)(P,{tone:e.last.failed?`fail`:`pass`,children:[e.last.passed,` passed`,e.last.failed?`, ${e.last.failed} failed`:``]}),(0,Z.jsx)(`span`,{className:`text-muted`,children:K(e.last.at)})]}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not run`})}),(0,Z.jsxs)(`td`,{className:`${z} text-right whitespace-nowrap`,onClick:e=>e.stopPropagation(),children:[!!e.last?.failed&&(0,Z.jsx)(F,{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,Z.jsx)(p,{"aria-hidden":`true`})}),(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.name}`,"data-tip":`Run`,onClick:()=>t(e.id),children:(0,Z.jsx)(i,{"aria-hidden":`true`})})]})]},e.id))}),(0,Z.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-[13px] text-muted`,children:[(0,Z.jsx)(C,{size:14,"aria-hidden":`true`}),n.tests,` automated tests known, `,n.testsWithoutCase,` with no test case behind them.`]})]})}var lt=e=>e&&/^https:\/\//i.test(e)?e:void 0;function ut({id:e,title:t,url:n}){let r=lt(n);return(0,Z.jsxs)(`span`,{className:`flex min-w-[220px] flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t}),r?(0,Z.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:`font-mono text-[13px] text-accent-fg`,children:e}):(0,Z.jsx)(`span`,{className:`font-mono text-[13px] text-accent-fg`,children:e})]})}var dt={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 ft(e,t){let n={system:e};for(let r of dt[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 pt=e=>Object.fromEntries(Object.entries(e??{}).filter(([e])=>e!==`system`).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]));function mt({gaps:e,onRead:t}){let[r,i]=(0,J.useState)(e.live?.system??`azure_devops`),[a,o]=(0,J.useState)(pt(e.live)),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(``);(0,J.useEffect)(()=>{e.live&&(i(e.live.system),o(pt(e.live)))},[e.live]);let d=async()=>{c(!0),u(``);try{await Y.readStories(ft(r,a)),t()}catch(e){u(e.message)}finally{c(!1)}};return(0,Z.jsxs)(`form`,{className:`card flex flex-col gap-4 rounded-[14px] border p-4`,onSubmit:e=>{e.preventDefault(),d()},children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:`Stories in`}),(0,Z.jsxs)(M,{size:`sm`,value:r,onChange:e=>(i(e.target.value),o({})),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:`azure_devops`,children:`Azure DevOps`}),(0,Z.jsx)(`option`,{value:`jira`,children:`Jira (also Xray and Zephyr Scale)`}),(0,Z.jsx)(`option`,{value:`qtest`,children:`qTest requirements`})]})]}),dt[r].map(e=>(0,Z.jsxs)(`label`,{className:`flex min-w-[140px] flex-[1_1_140px] flex-col gap-1 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:e.label}),(0,Z.jsx)(N,{size:`sm`,value:a[e.key]??``,maxLength:e.list?2e3:200,placeholder:e.placeholder,onChange:t=>o({...a,[e.key]:t.target.value})})]},e.key)),(0,Z.jsxs)(F,{size:`sm`,variant:`primary`,type:`submit`,disabled:s||!dt[r].some(e=>e.key!==`project`&&(a[e.key]??``).trim()),children:[(0,Z.jsx)(n,{"aria-hidden":`true`}),s?`Reading…`:`Read stories`]})]}),l&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:l})]})}function ht({kind:e,gaps:t,picked:n=[],onPick:r=()=>{},onRead:i=()=>{}}){let a=(0,Z.jsx)(mt,{gaps:t,onRead:i});if(!t.report)return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a,(0,Z.jsx)(L,{icon:E,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,Z.jsxs)(`p`,{className:`m-0 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[t.report.id===`live`?`Read from the tracker${t.report.at?` ${K(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,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o,(0,Z.jsx)(U,{label:`Stories with no test case`,placeholder:`Find a story`,empty:`Every story of the release has a test case.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-10`),children:(0,Z.jsx)(q,{"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,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-[55%]`),children:`Story`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Type`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`State`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Area`})]}),children:t.noCase.map(e=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(q,{"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,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(ut,{id:e.id,title:e.title,url:e.url})}),(0,Z.jsx)(`td`,{className:A(z,`hidden text-[13px] @2xl:table-cell`),children:e.type||`–`}),(0,Z.jsx)(`td`,{className:z,children:e.state?(0,Z.jsx)(P,{tone:`neutral`,icon:!1,children:e.state}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})}),(0,Z.jsx)(`td`,{className:A(z,`hidden text-[13px] @2xl:table-cell [overflow-wrap:anywhere]`),children:e.area||`–`})]},e.id))})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o,(0,Z.jsx)(U,{label:`Acceptance criteria no test case covers`,placeholder:`Find a criterion`,empty:`Every traced acceptance criterion has a test case.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-[55%]`),children:`Criterion`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Story`})]}),children:t.criteria.map((e,t)=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:A(z,`[overflow-wrap:anywhere]`),children:e.text}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(ut,{id:e.story,title:e.storyTitle,url:e.url})})]},`${e.story}-${t}`))})]})}var gt=[{id:`stories`,label:`Stories with no case`,icon:E},{id:`criteria`,label:`Criteria not covered`,icon:S}],_t=[{id:`not_automated`,label:`Not automated`,icon:l},{id:`pending`,label:`Pending`,icon:d},{id:`never_run`,label:`Never run`,icon:l},{id:`failing`,label:`Failing`,icon:a,alert:!0},{id:`stale`,label:`Steps changed`,icon:O},{id:`drift`,label:`Tracker disagrees`,icon:O},{id:`no_case`,label:`Tests with no case`,icon:C}];function vt({gaps:e,cases:t,tests:n,selected:r,onSelect:a,onRun:o,pickedStories:s=[],onPickStories:c=()=>{},onStoriesRead:l=()=>{}}){let[u,d]=(0,J.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=u===`no_case`||u===`stories`||u===`criteria`?[]:u===`not_automated`?e.ranked.map(e=>e.key):e.lists[u],h=e.stories??{stories:0,noCase:[],criteria:[]},g={stories:h.noCase.length,criteria:h.criteria.length},_=m.map(e=>f.get(e)).filter(e=>!!e),v=new Set(r),y=(e,t)=>a(t?[...r,e]:r.filter(t=>t!==e));return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(R,{items:[..._t.map(t=>({id:t.id,label:t.label,icon:t.icon,n:e.counts[t.id],...t.alert?{alert:!0}:{}})),...gt.map(e=>({id:e.id,label:e.label,icon:e.icon,n:g[e.id],tip:h.report?h.report.id===`live`?`Read from the tracker: ${h.report.scope}`:`From the readiness report of ${h.report.scope||h.report.id}`:`Read the release's stories from the tracker first`}))],value:u,onChange:e=>d(e)})}),u===`not_automated`&&_.length>0&&(0,Z.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-[13px] text-ink-2`,children:[`Highest value first: priority, failing when run, in a pack, tagged smoke.`,(0,Z.jsx)(F,{size:`sm`,onClick:()=>a(_.slice(0,20).map(e=>e.key)),children:`Pick the top 20`})]})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Not automated, by suite`}),e.bySuite.length?e.bySuite.slice(0,8).map(e=>(0,Z.jsx)(Ve,{label:e.suite,part:e.notAutomated+e.pending,whole:e.cases,className:`bg-warn`},e.suite)):(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Nothing left to automate.`})]})]}),u===`stories`||u===`criteria`?(0,Z.jsx)(ht,{kind:u,gaps:h,picked:s,onPick:c,onRead:l}):u===`no_case`?(0,Z.jsx)(U,{label:`Tests with no test case`,placeholder:`Find a test`,empty:`Every test ForgeQE knows has a test case behind it.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-[55%]`),children:`Test`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Tags`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Last runs`})]}),children:e.testsWithoutCase.map(e=>{let t=n.find(t=>t.key===e);return t?(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsxs)(`td`,{className:A(z,`max-w-0`),children:[(0,Z.jsx)(Q,{text:t.name,tip:t.file?`${t.name} · ${t.file}`:t.name}),t.flaky&&(0,Z.jsx)(P,{tone:`warn`,className:`mt-1`,children:`Flaky`})]}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(Re,{tags:t.tags})}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(Le,{runs:t.runs})})]},e):null})}):(0,Z.jsx)(U,{label:_t.find(e=>e.id===u).label,placeholder:`Find a case`,resetKey:u,empty:`No gap of this kind.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-10`),children:(0,Z.jsx)(q,{"aria-label":`Select every case shown`,checked:_.length>0&&_.every(e=>v.has(e.key)),onCheckedChange:e=>a(e?[...new Set([...r,..._.map(e=>e.key)])]:r.filter(e=>!_.some(t=>t.key===e)))})}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Test case`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Priority`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:u===`not_automated`?`Why it matters`:`Automation`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Last run`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:_.map(e=>(0,Z.jsxs)(`tr`,{className:A(`border-t border-line-soft align-top hover:bg-surface-muted`,v.has(e.key)&&`bg-accent-soft hover:bg-accent-soft`),children:[(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(q,{"aria-label":`Select ${e.id}`,checked:v.has(e.key),onCheckedChange:t=>y(e.key,t)})}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsxs)(`a`,{href:We(e.key),className:`flex min-w-[220px] flex-col gap-1 text-ink no-underline`,children:[(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.id}),e.suite&&(0,Z.jsx)(`span`,{children:e.suite}),(0,Z.jsx)(Re,{tags:e.tags,max:2})]})]})}),(0,Z.jsx)(`td`,{className:A(z,`hidden text-[13px] @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Z.jsx)(`td`,{className:z,children:u===`not_automated`?(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-1`,children:[(p.get(e.key)??[]).map(e=>(0,Z.jsx)(P,{tone:`running`,icon:!1,children:e},e)),!(p.get(e.key)??[]).length&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})]}):(0,Z.jsx)(Fe,{a:e.automation})}),(0,Z.jsx)(`td`,{className:A(z,`hidden @2xl:table-cell`),children:(0,Z.jsx)(Ie,{o:e.lastRun.outcome})}),(0,Z.jsx)(`td`,{className:A(z,`text-right`),children:(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":`Run`,onClick:()=>o([e.key]),children:(0,Z.jsx)(i,{"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)`,bt={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 xt({suites:e,onRun:n}){return e.length?(0,Z.jsx)(U,{label:`Suites`,placeholder:`Find a suite`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-[40%]`),children:`Suite`}),(0,Z.jsx)(`th`,{scope:`col`,className:W,children:`Cases`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(W,`hidden @xl:table-cell`),children:`Automated`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Last run`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.map(e=>(0,Z.jsxs)(`tr`,{className:ce,onClick:()=>location.hash=w(`test-management`,`suites`,e.id),children:[(0,Z.jsxs)(`td`,{className:A(z,`max-w-0`),children:[(0,Z.jsxs)(`a`,{href:w(`test-management`,`suites`,e.id),onClick:e=>e.stopPropagation(),className:`flex items-center gap-2 font-medium`,children:[e.built===`agent`?(0,Z.jsx)(_,{size:14,"aria-hidden":`true`,className:`flex-none`}):(0,Z.jsx)(t,{size:14,"aria-hidden":`true`,className:`flex-none`}),(0,Z.jsx)(Q,{text:e.name})]}),e.description&&(0,Z.jsx)(Q,{text:e.description,className:`mt-1 text-[13px] text-muted`})]}),(0,Z.jsx)(`td`,{className:B,children:e.cases}),(0,Z.jsxs)(`td`,{className:A(B,`hidden @xl:table-cell`),children:[e.cases?Math.round(e.automated/e.cases*100):0,`%`]}),(0,Z.jsx)(`td`,{className:z,children:e.last?(0,Z.jsxs)(`span`,{className:`flex flex-col items-start gap-1 text-[13px]`,"data-tip":yt(e.last),children:[(0,Z.jsxs)(P,{tone:e.last.failed?`fail`:`pass`,children:[e.last.passed,` passed`,e.last.failed?`, ${e.last.failed} failed`:``]}),(0,Z.jsx)(`span`,{className:`text-muted`,children:K(e.last.at)})]}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not run`})}),(0,Z.jsxs)(`td`,{className:A(z,`text-right whitespace-nowrap`),onClick:e=>e.stopPropagation(),children:[!!e.last?.failed&&(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Rerun the failed cases of ${e.name}`,"data-tip":`Rerun failed`,onClick:()=>n(e.id,`failed`),children:(0,Z.jsx)(p,{"aria-hidden":`true`})}),(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.name}`,"data-tip":`Run`,onClick:()=>n(e.id),children:(0,Z.jsx)(i,{"aria-hidden":`true`})})]})]},e.id))}):(0,Z.jsx)(L,{icon:t,title:`No suites yet`,children:`Tell the Suite agent on the right what the 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.`})}function St({id:e,onRun:t,onDeleted:n}){let[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,m]=(0,J.useState)(!1);(0,J.useEffect)(()=>{o(null),Y.suite(e).then(e=>{o(e),c(``)},e=>c(e.message))},[e]);let h=(0,Z.jsxs)(`a`,{href:w(`test-management`,`suites`),className:`inline-flex w-fit items-center gap-2 text-[13px]`,children:[(0,Z.jsx)(ee,{size:14,"aria-hidden":`true`}),`All suites`]});if(s)return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[h,(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail`,children:s})]});if(!a)return(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let g=a.suite,_=a.members.filter(e=>e.case.lastRun.outcome===`failed`||e.case.lastRun.outcome===`blocked`).length;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[h,(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:g.name}),g.description&&(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:g.description}),g.tracker&&(0,Z.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[`Kept as`,` `,De(g.tracker)?(0,Z.jsx)(`a`,{href:De(g.tracker),target:`_blank`,rel:`noreferrer noopener`,children:Oe(g.tracker)}):Oe(g.tracker)]})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(g.tracker||a.targets.length>0)&&(0,Z.jsxs)(F,{onClick:()=>m(!0),children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),g.tracker?`Keep in step`:`Keep in tracker`]}),(0,Z.jsxs)(F,{variant:`danger`,onClick:()=>u(!0),children:[(0,Z.jsx)(re,{"aria-hidden":`true`}),`Delete`]}),_>0&&(0,Z.jsxs)(F,{onClick:()=>t(g.id,`failed`),children:[(0,Z.jsx)(p,{"aria-hidden":`true`}),`Rerun `,_,` failed`]}),(0,Z.jsxs)(F,{variant:`primary`,onClick:()=>t(g.id),children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Run suite`]})]})]}),(0,Z.jsxs)(de,{label:`The suite`,children:[(0,Z.jsx)(G,{compact:!0,label:`Cases`,value:g.cases,note:`${g.automated} automated`}),(0,Z.jsx)(G,{compact:!0,label:`Last run`,value:g.last?`${g.last.passed} passed`:`Not run`,tone:g.last?.failed?`text-fail`:void 0,note:g.last?`${g.last.failed} failed · ${K(g.last.at)}${g.last.from===`report`?``:` · so far`}`:void 0}),(0,Z.jsx)(G,{compact:!0,label:`Runs on`,value:g.env??`Active`,note:g.runs.length?`${g.runs.length} run${g.runs.length===1?``:`s`}`:`never run`}),(0,Z.jsx)(G,{compact:!0,label:`Built`,value:g.built===`agent`?`Suite agent`:g.built===`rules`?`Rules`:`Picked`,note:`updated ${K(g.updatedAt)}`})]}),g.groupsCount.length>0&&(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-2 rounded-[14px] border p-6 text-[13px]`,children:[(0,Z.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:`Why these cases`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:g.groupsCount.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Z.jsx)(`span`,{className:`text-muted`,children:g.groups[t]?.rules.map(e=>`${bt[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(` and `)}),(0,Z.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.cases})]},e.label))})]}),(0,Z.jsx)(U,{label:`Cases`,placeholder:`Find a case`,empty:`No case meets the suite's rules now.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-[45%]`),children:`Test case`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @xl:table-cell`),children:`Why it is in`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Automation`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Last run`})]}),children:a.members.map(e=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:A(z,`max-w-0`),children:(0,Z.jsxs)(`a`,{href:We(e.case.key),className:`flex min-w-0 flex-col gap-1 text-ink no-underline`,children:[(0,Z.jsx)(Q,{text:e.case.title,className:`font-medium`}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.case.id}),(0,Z.jsx)(Re,{tags:e.case.tags})]})]})}),(0,Z.jsx)(`td`,{className:A(z,`hidden text-[13px] text-ink-2 @xl:table-cell`),children:e.group}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(Fe,{a:e.case.automation})}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(Ie,{o:e.case.lastRun.outcome})})]},e.case.key))}),(0,Z.jsx)(Me,{open:d,suite:g,targets:a.targets,onClose:()=>m(!1),onDone:()=>void Y.suite(e).then(o,()=>{})}),(0,Z.jsx)(V,{open:l,onClose:()=>u(!1),title:`Delete ${g.name}?`,description:`The suite goes from .forgeqe/testmgmt/suites.json. Its cases and their runs stay.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:()=>u(!1),children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`destructive`,onClick:()=>void Y.deleteSuite(g.id).then(()=>{u(!1),n()},e=>c(e.message)),children:[(0,Z.jsx)(re,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,Z.jsx)(`p`,{className:`m-0 pt-4 text-[13px] text-ink-2`,children:`Runs already made are kept in Runs.`})})]})}function Ct({open:e,onSaved:t}){let[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.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){s(!0),l(``),r(e=>[...e,{you:n}]),a(``);try{let t=await Y.buildSuite(f?`${f}. ${n}`:n,e?.id);r(e=>[...e,{built:t}])}catch(e){l(e.message)}finally{s(!1)}}},m=async n=>{if(d){s(!0);try{let{suite:i}=await Y.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){l(e.message)}finally{s(!1)}}};return(0,Z.jsxs)(xe,{title:`Suite agent`,about:`Builds and changes suites from your plans, tags and runs.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.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,Z.jsx)(F,{size:`sm`,disabled:o,onClick:()=>void p(e),children:e},e))}),(0,Z.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),p(i)},children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`tm-suite-words`,children:`Tell the Suite agent what the suite is for`}),(0,Z.jsx)(`textarea`,{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 rounded-[10px] border border-line bg-bg px-4 py-2 text-[13px] text-ink outline-none focus:border-accent`}),(0,Z.jsx)(F,{size:`icon`,variant:`primary`,type:`submit`,disabled:o||!i.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,Z.jsx)(h,{"aria-hidden":`true`})})]})]}),children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,Z.jsx)(ae,{state:o?`thinking`:`working`,px:96,label:o?`Building the suite`:`Ready`}),(0,Z.jsx)(`span`,{className:`text-[13px] 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,Z.jsx)(`p`,{className:`m-0 text-center text-[16px] leading-relaxed text-ink-2`,children:e.you},t):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`p`,{className:`m-0 text-center text-[20px] leading-snug`,children:[e.built.name,`: `,e.built.cases,` case`,e.built.cases===1?``:`s`,`, `,e.built.automated,` automated.`]}),e.built.summary&&(0,Z.jsx)(`p`,{className:`m-0 text-center text-[13px] text-ink-2`,children:e.built.summary}),e.built.note&&(0,Z.jsx)(`p`,{className:`m-0 text-center text-[13px] text-muted`,children:e.built.note}),(0,Z.jsxs)(`div`,{className:`card flex flex-col gap-2 rounded-[14px] border bg-bg p-4 text-[13px]`,children:[e.built.perGroup.map(e=>(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-2`,"data-tip":e.why,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Z.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.cases})]},e.label)),e.built.exclude.length>0&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[`Leaves out: `,e.built.exclude.map(e=>`${bt[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(`, `)]})]}),e.built.question&&t===n.length-1&&(0,Z.jsxs)(`div`,{className:`card flex flex-col gap-2 rounded-[14px] border bg-bg p-4 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.built.question.text}),e.built.question.options.map(e=>(0,Z.jsx)(F,{size:`sm`,disabled:o,onClick:()=>void p(e),className:`justify-start`,children:e},e))]}),e.built.sample.length>0&&(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:e.built.sample.slice(0,5).map(e=>(0,Z.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`flex-none font-mono text-accent-fg`,children:e.case.id}),(0,Z.jsx)(Q,{text:e.case.title,className:`min-w-0 text-ink-2`})]},e.case.key))})]},t)),c&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c}),d&&(0,Z.jsxs)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:[e&&(0,Z.jsxs)(F,{disabled:o,onClick:()=>void m(!0),children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Update `,e.name]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:o,onClick:()=>void m(!1),children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Save `,e?`as a new suite`:`suite`]})]})]})}var wt=[{id:`off`,label:`Off`,icon:l},{id:`hourly`,label:`Every hour`,icon:n},{id:`daily`,label:`Daily`,icon:D}];function Tt(e){return!e||e.every===`off`?`Sync: off`:e.every===`hourly`?`Sync: hourly`:e.every===`daily`?`Sync: daily ${e.at}`:`Sync: custom`}function Et({disabled:e}){let[t,n]=(0,J.useState)(!1),[r,i]=(0,J.useState)(null);return(0,J.useEffect)(()=>{Y.schedule().then(e=>i(e.schedule),()=>{})},[]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{size:`sm`,disabled:e,onClick:()=>n(!0),"data-tip":r?.nextAt?`Next sync ${ge(r.nextAt)}`:`Set when the plans are synced`,children:[(0,Z.jsx)(D,{"aria-hidden":`true`}),Tt(r)]}),(0,Z.jsx)(Dt,{open:t,onClose:()=>n(!1),now:r,onSaved:i})]})}function Dt({open:e,onClose:t,now:n,onSaved:r}){let[i,a]=(0,J.useState)(`off`),[o,s]=(0,J.useState)(`06:00`),[c,l]=(0,J.useState)(``),[d,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(null),[g,_]=(0,J.useState)(!1);(0,J.useEffect)(()=>{e&&(l(``),_(!!n&&n.every!==`off`&&n.every!==`custom`&&!!n.discover),Y.discoveryPlan().then(h,()=>h(null)),a(n&&n.every!==`custom`?n.every:`off`),n?.every===`daily`&&s(n.at))},[e,n]);let v=async()=>{p(!0);try{let e=g&&m&&i!==`off`?{discover:m.digest}:{};r((await Y.setSchedule(i===`daily`?{every:i,at:o,...e}:i===`hourly`?{every:i,...e}:{every:i})).schedule),t()}catch(e){l(e.message)}finally{p(!1)}};return(0,Z.jsx)(V,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:t,children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:d||i===`daily`&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(o),onClick:()=>void v(),children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Save`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[(0,Z.jsx)(`div`,{role:`group`,"aria-label":`When to sync`,className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(R,{items:wt.map(e=>({id:e.id,label:e.label,icon:e.icon})),value:i,onChange:a})}),i===`daily`&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Time (this computer's clock)`,(0,Z.jsx)(N,{type:`time`,step:60,value:o,onChange:e=>s(e.target.value)})]}),i!==`off`&&m&&m.steps.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(q,{checked:g,onCheckedChange:e=>_(e===!0),"aria-label":`Also discover the tests`}),(0,Z.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.`})]}),g&&(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:m.steps.map((e,t)=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`rounded-[8px] bg-surface-strong px-2 py-1 font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.command})},t))})]}),n?.every===`custom`&&(0,Z.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,Z.jsx)(`p`,{className:`m-0 text-warn`,children:`The sync job is disabled in the jobs service.`}),n?.last&&(0,Z.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`Last scheduled sync `,ge(n.last.at),`: `,n.last.status.replace(`_`,` `),`.`]}),c&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:c})]})})}var Ot={forgeqe:{label:`ForgeQE`,icon:_},script:{label:`Tests`,icon:C}},kt=e=>Ot[e]??{label:e===`azure_devops`?`Azure DevOps`:e===`jira`?`Jira`:e,icon:c},At=e=>e!==`forgeqe`&&e!==`script`,jt=[];function Mt({tags:e,cases:t=[],onChanged:n}){let[i,a]=(0,J.useState)(`all`),[o,s]=(0,J.useState)(null),l=e=>e.system===`azure_devops`||e.system===`jira`,u=e=>t.filter(t=>t.ownTags.includes(e)&&!t.trackerTags.includes(e)&&l(t)).map(e=>e.key),d=e=>t.filter(t=>t.ownTags.includes(e)&&t.trackerTags.includes(e)&&l(t)).map(e=>e.key),f=e.tags.filter(e=>i===`all`||(i===`out`?e.outOfStep>0:i===`tracker`?e.from.some(At):e.from.includes(i))),p=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(de,{label:`Tags`,children:[(0,Z.jsx)(G,{compact:!0,label:`Tags in use`,icon:b,value:e.tags.length}),(0,Z.jsx)(G,{compact:!0,label:`Test cases with a tag`,value:p(e.casesTagged,e.cases),note:`${e.casesTagged} of ${e.cases}`}),(0,Z.jsx)(G,{compact:!0,label:`Tests with a tag`,value:p(e.testsTagged,e.tests),note:`${e.testsTagged} of ${e.tests}`}),(0,Z.jsx)(G,{compact:!0,label:`Out of step`,icon:O,value:e.tags.filter(e=>e.outOfStep).length,tone:e.tags.some(e=>e.outOfStep)?`text-warn`:void 0,note:`a case's tag its test lacks`})]}),(0,Z.jsx)(U,{label:`Tags`,placeholder:`Find a tag`,resetKey:i,empty:e.tags.length?`Nothing matches.`:`No tags yet: tag cases in Test cases, or in their system.`,tools:(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(R,{items:[{id:`all`,label:`All`,n:e.tags.length},{id:`tracker`,label:`From their systems`,icon:c,n:e.tags.filter(e=>e.from.some(At)).length},{id:`script`,label:`From tests`,icon:C,n:e.tags.filter(e=>e.from.includes(`script`)).length},{id:`forgeqe`,label:`ForgeQE's`,icon:_,n:e.tags.filter(e=>e.from.includes(`forgeqe`)).length},{id:`out`,label:`Out of step`,icon:O,n:e.tags.filter(e=>e.outOfStep).length,alert:!0}],value:i,onChange:a})}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-[28%]`),children:`Tag`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Comes from`}),(0,Z.jsx)(`th`,{scope:`col`,className:W,children:`Test cases`}),(0,Z.jsx)(`th`,{scope:`col`,className:W,children:`Tests`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @xl:table-cell`),children:`Out of step`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Used by suites`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:f.map(e=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-[6px] bg-surface-strong px-2 text-[13px] font-medium`,children:[(0,Z.jsx)(b,{size:12,"aria-hidden":`true`}),e.name]})}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.from.map(e=>{let t=kt(e);return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-[6px] border border-line px-2 text-[13px] text-ink-2`,children:[(0,Z.jsx)(t.icon,{size:12,"aria-hidden":`true`}),t.label]},e)})})}),(0,Z.jsx)(`td`,{className:B,children:e.cases}),(0,Z.jsx)(`td`,{className:B,children:e.tests}),(0,Z.jsx)(`td`,{className:A(z,`hidden @xl:table-cell`),children:e.outOfStep?(0,Z.jsx)(P,{tone:`warn`,children:e.outOfStep}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})}),(0,Z.jsx)(`td`,{className:A(z,`hidden text-[13px] text-ink-2 @2xl:table-cell`),children:e.suites.join(`, `)||`–`}),(0,Z.jsxs)(`td`,{className:A(z,`text-right`),children:[u(e.name).length>0&&(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Write the tag ${e.name} to the trackers of ${u(e.name).length} cases`,"data-tip":`Write to the trackers of ${u(e.name).length} cases`,onClick:()=>s({kind:`tags`,keys:u(e.name)}),children:(0,Z.jsx)(r,{"aria-hidden":`true`})}),d(e.name).length>0&&(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Take the tag ${e.name} off in the trackers of ${d(e.name).length} cases`,"data-tip":`Take off in the trackers of ${d(e.name).length} cases`,onClick:()=>s({kind:`untag`,keys:d(e.name),tags:[e.name]}),children:(0,Z.jsx)(v,{"aria-hidden":`true`})})]})]},e.name))}),(0,Z.jsx)(je,{kind:o?.kind??null,keys:o?.keys??jt,tags:o?.tags,onClose:()=>s(null),onDone:e=>n?.(e)})]})}var Nt=[`dashboard`,`cases`,`tests`,`gaps`,`suites`,`tags`];function Pt({sub:e}){let t=(e??``).split(`/`).filter(Boolean),r=Nt.includes(t[0])?t[0]:`dashboard`,o=r===`cases`&&t[1]?te(t[1]):void 0,s=r===`suites`&&t[1]?te(t[1]):void 0,[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)([]),[g,v]=(0,J.useState)(null),[y,ee]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),[T,E]=(0,J.useState)(``),[D,O]=(0,J.useState)(``),[re,k]=(0,J.useState)(!1),[j,ie]=(0,J.useState)([]),[M,N]=(0,J.useState)(null),[ae,I]=(0,J.useState)(!0),L=(0,J.useCallback)(async()=>{try{let[e,t]=await Promise.all([Y.view(),Y.cases()]);l(e),d(t),ee(e.suites),S(e.job),E(``)}catch(e){E(e.message)}},[]);(0,J.useEffect)(()=>{L()},[L]),(0,J.useEffect)(()=>{r===`gaps`&&Y.gaps().then(p,e=>E(e.message)),r===`tags`&&Y.tags().then(v,e=>E(e.message)),r===`suites`&&Y.suites().then(e=>ee(e.suites),e=>E(e.message))},[r,c]),(0,J.useEffect)(()=>{if(!x?.running)return;let e=pe(()=>{Y.job().then(e=>{S(e.job),e.job?.running||L()},()=>{})},2e3);return()=>se(e)},[x?.running,L]);let R=async()=>{k(!0),O(``);try{let e=await Y.sync(),t=e.plans.filter(e=>e.error);O(t.length?t.map(e=>`${e.label}: ${e.error}`).join(` · `):`Synced ${e.plans.map(e=>`${e.label} (${e.cases} cases)`).join(`, `)}.`),await L()}catch(e){E(e.message)}finally{k(!1)}},ce=e=>N({title:`Run ${e.length} test case${e.length===1?``:`s`}`,go:(t,n)=>Y.run(e,t,n)}),z=(e,t)=>{let n=y?.find(t=>t.id===e)??c?.suites.find(t=>t.id===e);N({title:`${t?`Rerun the failed cases of`:`Run`} ${n?.name??`the suite`}`,go:(n,r)=>Y.runSuite(e,{...n?{env:n}:{},...t?{only:t}:{}},r)})},de=()=>{O(`The run started: it shows here while it runs, and in Runs.`),Y.job().then(e=>S(e.job),()=>{})},B=e=>{O(e),ie([]),L()},V=new Map((u?.cases??[]).map(e=>[e.key,e])),H=j.filter(e=>V.has(e)),U=e=>e.map(e=>V.get(e).id),W=H.filter(e=>[`failed`,`blocked`].includes(V.get(e).lastRun.outcome)),G=H.filter(e=>V.get(e).automation!==`automated`),q=[{intent:`automate`,label:G.length?`Automate ${G.length}`:`Automate`,icon:C,keys:G.slice(0,50),...G.length?{}:{disabled:`Pick test cases that are not automated`}},{intent:`investigate`,label:W.length?`Why ${W.length} fail`:`Why they fail`,icon:a,keys:W.slice(0,50),...W.length?{}:{disabled:`Pick failing test cases`}},{intent:`tag`,label:`Suggest tags`,icon:b,keys:H.slice(0,50),...H.length?{}:{disabled:`Pick test cases in the list first`}},{intent:`tag_tests`,label:`Write tags into tests`,icon:C,keys:H.filter(e=>V.get(e).tests.length>0&&V.get(e).tags.length>0).slice(0,50),...H.filter(e=>V.get(e).tests.length>0&&V.get(e).tags.length>0).length?{}:{disabled:`Pick tagged cases that have a linked test`}}],_e=(f?.ranked??[]).slice(0,20).map(e=>e.key),ve=[{intent:`automate`,label:H.length?`Automate ${H.length}`:`Automate the top ${_e.length}`,icon:C,keys:(H.length?H:_e).slice(0,50),...H.length||_e.length?{}:{disabled:`Nothing left to automate`}},{intent:`investigate`,label:`Why the failing fail`,icon:a,keys:(f?.lists.failing??[]).slice(0,50),...f?.lists.failing.length?{}:{disabled:`Nothing is failing`}},{intent:`cases_for_stories`,label:m.length?`Cases for ${m.length} stor${m.length===1?`y`:`ies`}`:`Cases for stories with none`,icon:_,keys:[],stories:(m.length?m:(f?.stories?.noCase??[]).map(e=>e.id)).slice(0,50),...m.length||f?.stories?.noCase.length?{}:{disabled:`Read the release's stories in Gaps, Stories with no case, first`}}],ye=s?y?.find(e=>e.id===s):void 0,be=(0,Z.jsxs)(`main`,{className:A(me,`@container flex-auto gap-4`),children:[(0,Z.jsx)(ue,{}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Z.jsx)(le,{pixel:oe[`test-management`],size:`lg`}),(0,Z.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test management`}),c&&(0,Z.jsx)(he,{label:`Test management`,className:`mb-0`,current:r,onPick:e=>location.hash=w(`test-management`,e),tabs:[{id:`dashboard`,label:`Dashboard`},{id:`cases`,label:`Test cases`,n:c.summary.cases},{id:`tests`,label:`Automated`,n:c.summary.tests},{id:`gaps`,label:`Gaps`,n:c.summary.notAutomated+c.summary.pending+c.summary.failing},{id:`suites`,label:`Suites`,n:c.suites.length},{id:`tags`,label:`Tags`}]}),c&&(0,Z.jsxs)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[c.plans.length>0&&(0,Z.jsxs)(`span`,{"data-tip":c.plans.map(e=>`${e.label}: ${e.cases} cases${e.at?`, synced ${ge(e.at)}`:``}`).join(` · `),children:[c.plans.length,` plan`,c.plans.length===1?``:`s`,c.plans[0]?.at?`, synced ${K(c.plans.map(e=>e.at??``).sort()[0])}`:`, not synced yet`]}),c.plans.length>0&&(0,Z.jsxs)(F,{size:`sm`,disabled:re,onClick:()=>void R(),"data-tip":`Read every case of the connected plans again`,children:[(0,Z.jsx)(n,{"aria-hidden":`true`}),re?`Syncing…`:`Sync`]}),(c.plans.length>0||c.summary.tests>0)&&(0,Z.jsx)(Et,{disabled:re}),(r===`cases`||r===`gaps`||r===`suites`)&&!ae&&(0,Z.jsxs)(F,{size:`sm`,onClick:()=>I(!0),children:[(0,Z.jsx)(_,{"aria-hidden":`true`}),r===`suites`?`Suite agent`:`Agent`]})]})]}),T&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:T}),!c&&!T&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),D&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:D}),c&&c.refused.length>0&&(0,Z.jsxs)(`p`,{className:`m-0 text-[13px] text-warn`,children:[`Not read, as their system does not write a plan that way: `,c.refused.join(` · `),`. Fix them in Settings › Integrations.`]}),x&&(0,Z.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-2 rounded-[12px] border border-line px-4 py-2 text-[13px]`,children:[(0,Z.jsx)(P,{tone:x.running?`running`:x.exitCode===0?`pass`:`fail`,children:x.running?`Running`:x.exitCode===0?`Finished`:`Stopped`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink-2`,"data-tip":x.command,children:x.lines.at(-1)??x.command}),x.running?(0,Z.jsxs)(F,{size:`sm`,variant:`danger`,onClick:()=>void Y.stop().then(e=>S(e.job)),children:[(0,Z.jsx)(ne,{"aria-hidden":`true`}),`Stop`]}):(0,Z.jsx)(`a`,{href:w(`runs`),className:`text-[13px]`,children:`Runs`})]}),c&&(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsxs)(`div`,{id:`panel-${r}`,role:`tabpanel`,"aria-labelledby":`tab-${r}`,className:`flex flex-col gap-4`,children:[r===`dashboard`&&(0,Z.jsx)(ct,{view:c,onRunSuite:z}),r===`cases`&&(o?(0,Z.jsx)(Qe,{caseKey:o,onRun:ce}):u&&(0,Z.jsx)(nt,{cases:u.cases,tests:u.tests.length,selected:H,onSelect:ie,onRun:ce,onChanged:B})),r===`tests`&&u&&(0,Z.jsx)(Ge,{cases:u.cases,onChanged:B}),r===`gaps`&&(f&&u?(0,Z.jsx)(vt,{gaps:f,cases:u.cases,tests:u.tests,selected:H,onSelect:ie,onRun:ce,pickedStories:m,onPickStories:h,onStoriesRead:()=>(h([]),void L())}):(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`})),r===`suites`&&(s?(0,Z.jsx)(St,{id:s,onRun:z,onDeleted:()=>(location.hash=w(`test-management`,`suites`),void L())},s):y&&(0,Z.jsx)(xt,{suites:y,onRun:z})),r===`tags`&&(g?(0,Z.jsx)(Mt,{tags:g,cases:u?.cases,onChanged:B}):(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}))]})}),(0,Z.jsx)(He,{open:!!M,onClose:()=>N(null),title:M?.title??`Run`,preview:(e,t)=>M.go(e,t),onStarted:de})]}),X=o?V.get(o):void 0;return(0,Z.jsxs)(`div`,{className:`@container flex min-h-(--screen) flex-col`,children:[(0,Z.jsx)(fe,{}),(0,Z.jsxs)(`div`,{className:`flex flex-auto flex-col xl:flex-row`,children:[(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-auto flex-col`,children:be}),c&&ae&&r===`cases`&&(0,Z.jsx)(Se,{title:`Test case agent`,about:`Automates, runs and tags the cases you pick.`,looking:X?`Looking at ${X.id}.`:H.length?`Looking at the ${H.length} cases you picked.`:`Looking at ${c.summary.cases} test cases. Pick some in the list.`,context:X?[X.id,...X.plans.slice(0,1)]:H.length?U(H).slice(0,4):[],suggestions:X?[{intent:X.automation===`automated`?`run`:`automate`,label:X.automation===`automated`?`Run it and explain`:`Automate it`,icon:X.automation===`automated`?i:C,keys:[X.key]},{intent:`investigate`,label:`Why it fails`,icon:a,keys:[X.key],...[`failed`,`blocked`].includes(X.lastRun.outcome)?{}:{disabled:`Its last run did not fail`}},{intent:`tag`,label:`Suggest tags`,icon:b,keys:[X.key]}]:q,placeholder:`Ask about these cases, or say what to do`,onClose:()=>I(!1)},o??`list`),c&&ae&&r===`gaps`&&(0,Z.jsx)(Se,{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:H.length?U(H).slice(0,4):[],suggestions:ve,placeholder:`What should we close first?`,onClose:()=>I(!1)}),c&&ae&&r===`suites`&&(0,Z.jsx)(Ct,{open:ye,onSaved:e=>{O(`Saved the suite ${e.name}.`),L(),location.hash=w(`test-management`,`suites`,e.id)}})]})]})}export{Pt as TestManagement};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$t as t,Bn as n,Er as r,Fn as i,H as a,Hr as o,I as s,Ir as c,L as l,O as u,R as d,Rr as f,Un as p,Yn as m,Zn as h,an as g,ar as _,ct as v,fr as y,gr as b,l as ee,lt as x,n as te,on as S,q as C,r as w,sr as ne,u as T,v as E,w as D,wr as O,xr as re}from"./route-Dg53WdFu.js";import{t as k}from"./jsx-runtime-LKYXHABd.js";import{A,X as j,Z as ie,n as M,t as N}from"./input-D7iHeNXz.js";import{a as P,c as ae,d as F,f as I,o as L,t as R}from"./filters-Culzq1j1.js";import{L as oe}from"./palette-lUno7fso.js";import{Bn as se,Bt as ce,Dn as le,Ft as z,H as ue,Ht as de,It as B,K as fe,Kn as V,Lt as H,Pt as U,Rt as W,Vn as pe,Vt as G,W as me,Wt as he,g as K,u as q}from"./index-CljX5dI4.js";import{_ as ge}from"./qualityParts-D_U5zhKC.js";import{t as _e}from"./AgentWork-wNaA-i2T.js";var J=e(o(),1),Y={view:()=>j(`GET`,`/api/testmgmt`),cases:()=>j(`GET`,`/api/testmgmt/cases`),case:e=>j(`GET`,`/api/testmgmt/case/${encodeURIComponent(e).replace(/%3A/gi,`:`)}`),sync:()=>j(`POST`,`/api/testmgmt/sync`),schedule:()=>j(`GET`,`/api/testmgmt/schedule`),setSchedule:e=>j(`POST`,`/api/testmgmt/schedule`,e),gaps:()=>j(`GET`,`/api/testmgmt/gaps`),tags:()=>j(`GET`,`/api/testmgmt/tags`),tag:(e,t=!1)=>j(`POST`,`/api/testmgmt/tags`,{...e,...t?{confirmed:!0}:{}}),suites:()=>j(`GET`,`/api/testmgmt/suites`),suite:e=>j(`GET`,`/api/testmgmt/suites/${encodeURIComponent(e)}`),buildSuite:(e,t)=>j(`POST`,`/api/testmgmt/suites/agent`,{request:e,...t?{open:t}:{}}),saveSuite:e=>j(`POST`,`/api/testmgmt/suites`,e),deleteSuite:e=>j(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/delete`,{confirmed:!0}),runSuite:(e,t,n=!1)=>j(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/run`,{...t,...n?{confirmed:!0}:{}}),run:(e,t,n=!1)=>j(`POST`,`/api/testmgmt/run`,{keys:e,...t?{env:t}:{},...n?{confirmed:!0}:{}}),job:()=>j(`GET`,`/api/testmgmt/job`),writeBack:(e,t,n,r)=>j(`POST`,`/api/testmgmt/writeback/${e}`,{keys:t,...r?{tags:r}:{},...n?{digest:n}:{}}),suiteTracker:(e,t,n)=>j(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/tracker`,{...t?{target:t}:{},...n?{digest:n}:{}}),stop:()=>j(`POST`,`/api/testmgmt/stop`),tests:()=>j(`GET`,`/api/testmgmt/tests`),discoveryPlan:()=>j(`GET`,`/api/testmgmt/discover`),discover:e=>j(`POST`,`/api/testmgmt/discover`,{digest:e}),link:e=>j(`POST`,`/api/testmgmt/links`,{changes:e}),setMain:(e,t)=>j(`POST`,`/api/testmgmt/links/main`,{case:e,test:t}),proposeLinks:(e=[])=>j(`POST`,`/api/testmgmt/links/propose`,{keys:e}),ask:(e,t,n,r)=>j(`POST`,`/api/testmgmt/ask`,{intent:e,keys:t,...n?{words:n}:{},...r?.length?{stories:r}:{}}),readStories:e=>j(`POST`,`/api/testmgmt/stories`,{scope:e})},ve={automated:`Automated`,not_automated:`Not automated`,pending:`Pending`,known_defect:`Known defect`,needs_attention:`Needs attention`},ye={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`},be={framework:`Listed by its framework`,code:`Read from the code`,runs:`Known from runs`},X={passed:`Passed`,failed:`Failed`,blocked:`Blocked`,not_run:`Not run`},Z=k();function xe({title:e,about:t,onClose:n,children:r,footer:i}){return(0,Z.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,Z.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-line-soft px-6 py-4`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[20px] font-semibold`,children:e}),(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:t})]}),n&&(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Close the ${e}`,"data-tip":`Close`,onClick:n,children:(0,Z.jsx)(f,{"aria-hidden":`true`})})]}),(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 py-6`,children:r}),i&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft px-6 py-4`,children:i})]})}function Se({title:e,about:t,looking:n,context:r,suggestions:i,placeholder:a,onClose:o}){let[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(``),[g,_]=(0,J.useState)(!1),v=async(e,t,n,r,i)=>{f(!0),m(``);try{let{request:a}=await Y.ask(e,t,r,i),{id:o}=await ie.start(a,{});c({id:o,said:n}),_(!1),u(``)}catch(e){m(e.message)}finally{f(!1)}};return(0,Z.jsxs)(xe,{title:e,about:t,onClose:o,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:i.map(e=>(0,Z.jsxs)(F,{size:`sm`,disabled:d||!!e.disabled,"data-tip":e.disabled??e.label,onClick:()=>void v(e.intent,e.keys,e.label,void 0,e.stories),children:[(0,Z.jsx)(e.icon,{"aria-hidden":`true`}),e.label]},e.label))}),(0,Z.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),l.trim()&&v(`ask`,i[0]?.keys.slice(0,50)??[],l.trim(),l.trim())},children:[(0,Z.jsxs)(`label`,{className:`sr-only`,htmlFor:`tm-agent-words`,children:[`Message the `,e]}),(0,Z.jsx)(`textarea`,{id:`tm-agent-words`,rows:2,maxLength:1e3,value:l,placeholder:a,onChange:e=>u(e.target.value),className:`min-h-11 flex-1 resize-none rounded-[10px] border border-line bg-bg px-4 py-2 text-[13px] text-ink outline-none focus:border-accent`}),(0,Z.jsx)(F,{size:`icon`,variant:`primary`,type:`submit`,disabled:d||!l.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,Z.jsx)(h,{"aria-hidden":`true`})})]})]}),children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,Z.jsx)(ae,{state:d||s&&!g?`thinking`:`working`,px:96,label:d?`Starting`:s&&!g?`Working`:`Ready`}),(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:s?g?`Done. Ask again, or open the chat.`:`Working on it…`:n}),r.length>0&&(0,Z.jsx)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:r.map(e=>(0,Z.jsx)(`span`,{className:`rounded-[8px] border border-line bg-bg px-2 text-[13px] text-ink-2`,children:e},e))}),s&&(0,Z.jsx)(`p`,{className:`m-0 text-[16px] leading-relaxed text-ink-2`,children:s.said})]}),p&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:p}),s?(0,Z.jsx)(_e,{id:s.id,label:`The ${e} at work`,onEnd:()=>_(!0)},s.id):(0,Z.jsxs)(`p`,{className:A(`m-0 text-center text-[13px] text-muted`),children:[`Pick what to do below, or say it in your own words. It works in a chat you can open: `,(0,Z.jsx)(`a`,{href:w(`chats`),children:`Chats`}),`.`]})]})}var Ce={automation:`Mark automated in their tracker`,tags:`Write ForgeQE's tags to their tracker`,untag:`Take ForgeQE's tags off in their tracker`},we={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.`},Te=e=>e.system===`azure_devops`?`Azure DevOps plan ${e.plan}`:`Xray Test Set in ${e.project}`,Ee=e=>e.system===`azure_devops`?`ado:${e.plan}`:`xray:${e.project}`,De=e=>e?.url&&/^https:\/\//i.test(e.url)?e.url:void 0,Oe=e=>e.system===`azure_devops`?`Azure DevOps suite ${e.suite} in plan ${e.plan}`:`Xray Test Set ${e.key}`;function ke({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,Z.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 first:border-t-0`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r.has(e.key)&&(0,Z.jsx)(s,{size:14,"aria-label":`Written`,className:`flex-none text-pass`}),n.has(e.key)&&(0,Z.jsx)(a,{size:14,"aria-label":`Refused`,className:`flex-none text-fail`}),e.key!==`suite`&&(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.key.replace(/^[a-z_]+:/,``)}),(0,Z.jsx)(`span`,{className:i?`text-muted`:`text-ink-2`,children:e.what})]}),n.has(e.key)&&(0,Z.jsx)(`span`,{className:`text-fail [overflow-wrap:anywhere]`,children:n.get(e.key)})]},`${e.key}-${t}`);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-[13px]`,children:[e.changes.length?(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.changes.map((e,t)=>i(e,t))}):(0,Z.jsx)(`p`,{className:`m-0 text-ink-2`,children:`Nothing to write: the trackers already say so.`}),e.skipped.length>0&&(0,Z.jsxs)(`details`,{children:[(0,Z.jsxs)(`summary`,{className:`cursor-pointer text-muted`,children:[`Left out: `,e.skipped.length]}),(0,Z.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 Ae(e,t,n){let[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{i(null),o(null),c(``),e&&e().then(e=>i(e??null),e=>c(e.message))},[e]),{plan:r,outcome:a,error:s,busy:l,go:async()=>{if(r){u(!0),c(``);try{let e=await t(r.digest);e&&(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 je({kind:e,keys:t,tags:n,onClose:i,onDone:a}){let[o,s]=(0,J.useState)(null);(0,J.useEffect)(()=>s(e?()=>()=>Y.writeBack(e,t,void 0,n).then(e=>e.plan):null),[e,t,n]);let c=Ae(o,r=>Y.writeBack(e,t,r,n).then(e=>e.outcome),a);return(0,Z.jsx)(V,{open:!!e,onClose:i,title:e?Ce[e]:``,description:e?we[e]:``,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:i,children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),c.outcome?`Close`:`Cancel`]}),!c.outcome&&(0,Z.jsxs)(F,{variant:`primary`,disabled:c.busy||!c.plan?.changes.length,onClick:()=>void c.go(),"data-tip":`Write these changes`,children:[e===`untag`?(0,Z.jsx)(v,{"aria-hidden":`true`}):(0,Z.jsx)(r,{"aria-hidden":`true`}),c.busy?`Writing…`:`${e===`untag`?`Take off`:`Write`} ${c.plan?.changes.length??``}`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[!c.plan&&!c.error&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Working out what would change…`}),c.error&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c.error}),c.plan&&(0,Z.jsx)(ke,{plan:c.plan,outcome:c.outcome})]})})}function Me({open:e,suite:t,targets:n,onClose:r,onDone:i}){let[a,o]=(0,J.useState)(``),s=t.tracker?void 0:n.find(e=>Ee(e)===(a||(n[0]?Ee(n[0]):``))),[c,l]=(0,J.useState)(null);(0,J.useEffect)(()=>l(e&&(t.tracker||s)?()=>()=>Y.suiteTracker(t.id,s).then(e=>e.plan):null),[e,t.id,t.tracker,s&&Ee(s)]);let d=Ae(c,e=>Y.suiteTracker(t.id,s,e).then(e=>e.outcome),i),p=t.tracker;return(0,Z.jsx)(V,{open:e,onClose:r,title:p?`Keep ${t.name} in step`:`Keep ${t.name} in a tracker`,description:p?`It is ${Oe(p)}. 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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:r,children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),d.outcome?`Close`:`Cancel`]}),!d.outcome&&(0,Z.jsxs)(F,{variant:`primary`,disabled:d.busy||!d.plan?.changes.length,onClick:()=>void d.go(),children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),d.busy?`Writing…`:p?`Keep in step`:`Make it there`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[!p&&(n.length?(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Where`,(0,Z.jsx)(M,{value:s?Ee(s):``,onChange:e=>o(e.target.value),children:n.map(e=>(0,Z.jsx)(`option`,{value:Ee(e),children:Te(e)},Ee(e)))})]}):(0,Z.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.`})),(p||s)&&!d.plan&&!d.error&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Working out what would change…`}),d.error&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:d.error}),d.plan&&(0,Z.jsx)(ke,{plan:d.plan,outcome:d.outcome}),d.outcome&&!d.outcome.failed.length&&(0,Z.jsx)(P,{tone:`pass`,children:`Done`})]})})}var Ne={automated:s,not_automated:l,pending:d,known_defect:O,needs_attention:O},Pe={passed:`pass`,failed:`fail`,blocked:`warn`,not_run:`neutral`};function Q({text:e,tip:t,className:n}){return(0,Z.jsx)(`span`,{"data-tip":t??e,className:A(`block truncate`,n),children:e})}function Fe({a:e}){let t=Ne[e];return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-[13px] whitespace-nowrap`,children:[(0,Z.jsx)(t,{size:15,"aria-hidden":`true`,className:A(`flex-none`,e===`automated`?`text-pass`:e===`known_defect`?`text-fail`:e===`not_automated`?`text-muted`:`text-warn`)}),ve[e]]})}function Ie({o:e}){return(0,Z.jsx)(P,{tone:Pe[e],icon:e!==`not_run`,children:X[e]})}function Le({runs:e}){return e.length?(0,Z.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,Z.jsx)(`span`,{className:A(`inline-block h-4 w-2 rounded-[2px]`,e===`p`?`bg-pass`:`bg-fail`)},t))}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})}function Re({tags:e,max:t=3}){return e.length?(0,Z.jsxs)(`span`,{className:`inline-flex flex-wrap gap-1`,children:[e.slice(0,t).map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-[6px] bg-surface-strong px-2 text-[13px] text-ink-2`,children:[(0,Z.jsx)(b,{size:11,"aria-hidden":`true`}),e]},e)),e.length>t&&(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,"data-tip":e.slice(t).join(`, `),children:[`+`,e.length-t]})]}):null}function ze({points:e,label:t,format:n=e=>String(e),height:r=160}){if(e.length<2)return(0,Z.jsx)(`p`,{className:`m-0 text-[13px] 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,Z.jsxs)(`figure`,{className:`m-0 flex flex-col gap-1`,children:[(0,Z.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,Z.jsx)(`line`,{x1:`0`,x2:600,y1:(i-20)*e+4,y2:(i-20)*e+4,className:`stroke-line-soft`,strokeWidth:`1`},e)),(0,Z.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,Z.jsx)(`polyline`,{points:d.join(` `),fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,Z.jsx)(`circle`,{cx:l(e.length-1),cy:u(f.y),r:`4`,fill:`currentColor`,className:`stroke-bg`,strokeWidth:`2`})]}),(0,Z.jsxs)(`figcaption`,{className:`flex justify-between text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{children:e[0].x}),(0,Z.jsxs)(`span`,{className:`font-medium text-ink`,children:[n(f.y),` now`]}),(0,Z.jsx)(`span`,{children:f.x})]})]})}function Be({items:e,series:t,label:n}){let r=Math.max(1,...e.flatMap(e=>e.values));return(0,Z.jsxs)(`figure`,{className:`m-0 flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`flex flex-wrap gap-4 text-[13px] text-ink-2`,children:t.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:A(`inline-block size-[10px] rounded-[3px]`,e.className),"aria-hidden":`true`}),e.name]},e.name))}),(0,Z.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,Z.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,Z.jsx)(`span`,{className:A(`w-full max-w-[14px] rounded-t-[4px]`,t[n]?.className),style:{height:`${Math.max(e?3:0,e/r*100)}%`}},n))},e.x))}),(0,Z.jsxs)(`span`,{className:`flex justify-between text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{children:e[0]?.x}),(0,Z.jsx)(`span`,{children:e.at(-1)?.x})]})]})}function Ve({label:e,part:t,whole:n,className:r=`bg-accent`}){let i=n?Math.round(t/n*100):0;return(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,140px)_1fr_auto] items-center gap-4 text-[13px]`,children:[(0,Z.jsx)(Q,{text:e,className:`text-ink-2`}),(0,Z.jsx)(`span`,{className:`h-2 overflow-hidden rounded-full bg-surface-strong`,role:`img`,"aria-label":`${e}: ${t} of ${n}`,children:(0,Z.jsx)(`span`,{className:A(`block h-full rounded-full`,r),style:{width:`${i}%`}})}),(0,Z.jsxs)(`span`,{className:`w-[86px] text-right tabular-nums text-ink-2`,children:[t,` of `,n]})]})}function He({open:e,onClose:t,title:n,preview:r,onStarted:a}){let[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(null),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(!1);(0,J.useEffect)(()=>{e&&(d(null),m(``),Y.suites().then(e=>{s({list:e.environments,...e.active?{active:e.active}:{}}),l(e.active&&e.environments.includes(e.active)?e.active:e.environments[0]??``)},e=>m(e.message)))},[e]),(0,J.useEffect)(()=>{e&&o!==null&&r(c||void 0,!1).then(e=>{d(e.preview??null),m(``)},e=>m(e.message))},[e,c,o]);let _=async()=>{g(!0);try{await r(c||void 0,!0),a(),t()}catch(e){m(e.message)}finally{g(!1)}};return(0,Z.jsx)(V,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:t,children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:h||!u,onClick:()=>void _(),"data-tip":`Start the run`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Run `,u?u.cases:``]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[o&&o.list.length>0&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Environment`,(0,Z.jsx)(M,{value:c,onChange:e=>l(e.target.value),children:o.list.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))})]}),u&&(0,Z.jsxs)(`p`,{role:`status`,className:`m-0 text-ink-2`,children:[u.cases,` test case`,u.cases===1?``:`s`,` on `,u.env??`the active environment`,`.`]}),p&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:p})]})})}var Ue=e=>e.lastRun.outcome===`failed`||e.lastRun.outcome===`blocked`,We=e=>w(`test-management`,`cases`,encodeURIComponent(e));function Ge({cases:e,onChanged:t}){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(`all`),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(null),f=()=>Y.tests().then(e=>{r(e),a(``)},e=>a(e.message));(0,J.useEffect)(()=>{f()},[]),(0,J.useEffect)(()=>{if(!n?.busy)return;let e=pe(()=>void f(),3e3);return()=>se(e)},[n?.busy]),qe(n?.busy??null,()=>t(`Done: the tests and their links are up to date.`));let p=(0,J.useMemo)(()=>new Map(e.map(e=>[e.key,e])),[e]);if(i)return(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:i});if(!n)return(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let h=n.tests.filter(e=>e.uid),v={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},y=h.filter(e=>o===`all`||(o===`unlinked`?!e.cases.length:o===`linked`?e.cases.length>0:e.via===`code`)),b=async()=>{try{t(`The mapping agent is looking at ${(await Y.proposeLinks()).cases} cases with no test.`),f()}catch(e){t(e.message)}};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(F,{variant:`primary`,onClick:()=>l(!0),disabled:!!n.busy,children:[(0,Z.jsx)(m,{"aria-hidden":`true`}),`Discover tests`]}),(0,Z.jsxs)(F,{onClick:()=>void b(),disabled:!!n.busy||!h.length,"data-tip":`The mapping agent links cases that have no test to the tests that check them`,children:[(0,Z.jsx)(_,{"aria-hidden":`true`}),`Link with the agent`]}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[n.busy?n.busy.what===`discover`?`Discovering tests, started ${K(n.busy.started)}…`:`The mapping agent is at work, started ${K(n.busy.started)}…`:n.discovery?`Discovered ${K(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,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:n.error}),n.discovery&&n.discovery.projects.length>0&&(0,Z.jsx)(Je,{projects:n.discovery.projects}),h.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(R,{items:[{id:`all`,label:`All`,n:v.all},{id:`unlinked`,label:`No test case`,n:v.unlinked},{id:`linked`,label:`Linked`,n:v.linked},{id:`code`,label:`Read from the code`,n:v.code,tip:`Their framework was not asked, or could not list them`}],value:o,onChange:s})}),(0,Z.jsx)(U,{label:`Automated tests`,placeholder:`Find a test by id, name, file or tag`,resetKey:o,empty:`No test matches.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-[45%]`),children:`Test`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Framework`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Test cases`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @3xl:table-cell`),children:`Tags`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Last runs`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:y.map(t=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsxs)(`td`,{className:A(z,`max-w-0`),children:[(0,Z.jsx)(Q,{text:t.name,tip:t.nativeId??t.name}),(0,Z.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:t.uid}),t.file&&(0,Z.jsxs)(`span`,{className:`truncate font-mono`,children:[t.file,t.line?`:${t.line}`:``]}),t.flaky&&(0,Z.jsx)(P,{tone:`warn`,children:`Flaky`})]})]}),(0,Z.jsx)(`td`,{className:A(z,`hidden text-[13px] @2xl:table-cell`),children:(0,Z.jsxs)(`span`,{className:`flex flex-col`,children:[(0,Z.jsxs)(`span`,{children:[Ke[t.framework??`code`],t.framework===`gherkin`?`, ${t.runner??`no runner found`}`:``]}),(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:be[t.via??`runs`]})]})}),(0,Z.jsx)(`td`,{className:A(z,`text-[13px]`),children:t.cases.length?(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-x-2`,children:[t.cases.slice(0,4).map(e=>(0,Z.jsx)(`a`,{href:We(e),className:`font-mono`,"data-tip":p.get(e)?.title,children:p.get(e)?.id??e},e)),t.cases.length>4&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[`+`,t.cases.length-4]})]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,Z.jsx)(`td`,{className:A(z,`hidden @3xl:table-cell`),children:(0,Z.jsx)(Re,{tags:t.tags})}),(0,Z.jsx)(`td`,{className:A(z,`hidden @2xl:table-cell`),children:(0,Z.jsx)(Le,{runs:t.runs})}),(0,Z.jsx)(`td`,{className:A(z,`text-right`),children:(0,Z.jsxs)(F,{size:`sm`,onClick:()=>d(t),"aria-label":`Link ${t.name} to a test case`,disabled:!e.length,children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),`Link`]})})]},t.uid))})]}):(0,Z.jsx)(L,{icon:C,title:`No automated test found yet`,children:`Discover tests 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.`}),(0,Z.jsx)(Ye,{open:c,onClose:()=>l(!1),onStarted:()=>{l(!1),t(`Discovering tests: each project's framework lists its tests.`),f()}}),(0,Z.jsx)(Xe,{open:!!u,title:`Link to a test case`,description:u?`Pick the test case ${u.name} checks. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`:void 0,items:e.filter(e=>!u?.cases.includes(e.key)).map(e=>({id:e.key,label:e.title,sub:e.id})),onClose:()=>d(null),onPick:async e=>{u?.uid&&(await Y.link([{case:e,test:u.uid,action:`link`}]),d(null),t(`Linked ${u.uid} to ${p.get(e)?.id??e}.`),f())}})]})}var Ke={pytest:`pytest`,dotnet:`.NET`,playwright:`Playwright`,jest:`Jest`,vitest:`Vitest`,mocha:`Mocha`,robot:`Robot Framework`,gherkin:`Gherkin`,code:`Code`};function qe(e,t){let[n,r]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{e?r(!0):n&&(r(!1),t())},[e]),n}function Je({projects:e}){return(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:e.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-start gap-2`,children:[e.ok?(0,Z.jsx)(s,{size:14,"aria-label":`Listed`,className:`mt-1 flex-none text-pass`}):(0,Z.jsx)(O,{size:14,"aria-label":`Not listed`,className:`mt-1 flex-none text-warn`}),(0,Z.jsxs)(`span`,{children:[e.label,` in `,e.dir?(0,Z.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,Z.jsx)(`span`,{className:`block text-muted [overflow-wrap:anywhere]`,children:e.error})]})]},`${e.framework}-${e.dir}-${t}`))})}function Ye({open:e,onClose:t,onStarted:n}){let[r,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1);(0,J.useEffect)(()=>{e&&(a(null),s(``),Y.discoveryPlan().then(a,e=>s(e.message)))},[e]);let u=async()=>{if(r){l(!0);try{await Y.discover(r.digest),n()}catch(e){s(e.message)}finally{l(!1)}}};return(0,Z.jsx)(V,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(F,{onClick:t,children:`Cancel`}),(0,Z.jsxs)(F,{variant:`primary`,onClick:()=>void u(),disabled:!r||c,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Discover`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-[13px]`,children:[o&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:o}),!r&&!o&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Finding the test projects…`}),r&&!r.steps.length&&(0,Z.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,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:r.steps.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`span`,{children:[Ke[e.project.framework],` in `,e.project.dir?(0,Z.jsx)(`span`,{className:`font-mono`,children:e.project.dir}):`the repository's root`]}),(0,Z.jsx)(`code`,{className:`rounded-[8px] bg-surface-strong px-2 py-1 font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.command})]},t))})]})})}function Xe({open:e,title:t,description:n,items:r,onClose:i,onPick:o}){let[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(``);(0,J.useEffect)(()=>c(``),[e]);let d=async e=>{u(e),c(``);try{await o(e)}catch(e){c(e.message)}finally{u(``)}};return(0,Z.jsx)(V,{open:e,onClose:i,title:t,description:n,wide:!0,footer:(0,Z.jsx)(F,{onClick:i,children:`Close`}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[s&&(0,Z.jsxs)(`p`,{role:`alert`,className:`m-0 flex items-center gap-2 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[(0,Z.jsx)(a,{size:14,"aria-hidden":`true`}),s]}),(0,Z.jsx)(U,{label:t,placeholder:`Find by id or words`,resetKey:String(e),empty:`Nothing to pick.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Name`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Pick`})})]}),children:r.map(e=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsxs)(`td`,{className:A(z,`max-w-0`),children:[(0,Z.jsx)(Q,{text:e.label}),e.sub&&(0,Z.jsx)(`span`,{className:`block truncate font-mono text-[13px] text-muted`,children:e.sub})]}),(0,Z.jsx)(`td`,{className:A(z,`w-24 text-right`),children:(0,Z.jsxs)(F,{size:`sm`,onClick:()=>void d(e.id),disabled:!!l,children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),`Link`]})})]},e.id))})]})})}var Ze=e=>e&&/^https:\/\//i.test(e)?e:void 0;function Qe({caseKey:e,onRun:n}){let[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(``);(0,J.useEffect)(()=>{o(null),Y.case(e).then(e=>{o(e),c(``)},e=>c(e.message))},[e]);let p=(0,Z.jsxs)(`a`,{href:w(`test-management`,`cases`),className:`inline-flex w-fit items-center gap-2 text-[13px]`,children:[(0,Z.jsx)(ee,{size:14,"aria-hidden":`true`}),`Test cases`]});if(s)return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[p,(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:s})]});if(!a)return(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let m=a.case,h=Ze(m.url);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[p,(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_420px] flex-col gap-2`,children:[(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:m.id}),` · `,m.plans.join(`, `)||`Not in a synced plan`]}),(0,Z.jsx)(`h2`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:m.title}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[m.priority&&(0,Z.jsxs)(P,{tone:m.priority===1?`fail`:m.priority===2?`warn`:`neutral`,icon:!1,children:[`Priority `,m.priority]}),m.state&&(0,Z.jsx)(P,{tone:`neutral`,children:m.state}),(0,Z.jsx)(Fe,{a:m.automation}),m.origin===`forgeqe`&&(0,Z.jsxs)(P,{tone:`running`,icon:!1,children:[(0,Z.jsx)(_,{size:12,"aria-hidden":`true`}),`Written by ForgeQE`,m.createdAt?` ${K(m.createdAt)}`:``]})]})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[h&&(0,Z.jsxs)(`a`,{className:I(),href:h,target:`_blank`,rel:`noreferrer noopener`,children:[(0,Z.jsx)(x,{"aria-hidden":`true`}),`Open in its system`]}),m.how!==`none`&&m.how!==`tracker`&&!!m.test?.file&&m.trackerAutomated!==!0&&(0,Z.jsxs)(F,{onClick:()=>u(`automation`),children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),`Mark automated in its system`]}),m.ownTags.some(e=>!m.trackerTags.includes(e))&&(0,Z.jsxs)(F,{onClick:()=>u(`tags`),children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),`Write tags to its system`]}),m.ownTags.some(e=>m.trackerTags.includes(e))&&(0,Z.jsxs)(F,{onClick:()=>u(`untag`),children:[(0,Z.jsx)(v,{"aria-hidden":`true`}),`Take tags off in its system`]}),(0,Z.jsxs)(F,{variant:`primary`,onClick:()=>n([m.key]),children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Run`]})]})]}),(0,Z.jsx)(je,{kind:l,keys:[m.key],onClose:()=>u(null),onDone:t=>(f(t),void Y.case(e).then(o,()=>{}))}),d&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:d}),(m.stale||m.drift)&&(0,Z.jsxs)(`p`,{role:`status`,className:`m-0 flex items-start gap-2 rounded-[12px] bg-warn-soft px-4 py-2 text-[13px] text-warn`,children:[(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Z.jsxs)(`span`,{children:[m.stale&&`Its steps changed in its system after its test was written: the next run updates the test. `,m.drift&&(m.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,Z.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Z.jsx)(U,{label:`Steps`,search:!1,empty:`Its system holds no steps for it, or it is not in a synced plan.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-10`),children:`#`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Action`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Expected result`})]}),children:a.steps.map((e,t)=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Z.jsx)(`td`,{className:A(z,`text-[13px] text-muted tabular-nums`),children:t+1}),(0,Z.jsx)(`td`,{className:A(z,`text-[13px] [overflow-wrap:anywhere]`),children:e.action}),(0,Z.jsx)(`td`,{className:A(z,`text-[13px] text-ink-2 [overflow-wrap:anywhere]`),children:e.expected??`–`})]},t))}),(0,Z.jsx)($e,{detail:a,onChanged:t=>(f(t),void Y.case(e).then(o,()=>{}))})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6 text-[13px]`,children:[(0,Z.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:`Details`}),(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[96px_1fr] gap-x-4 gap-y-2`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Last run`}),(0,Z.jsxs)(`dd`,{className:`m-0 flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(Ie,{o:m.lastRun.outcome}),m.lastRun.at&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[K(m.lastRun.at),m.lastRun.by===`tracker`?`, in its system`:``]})]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Suite`}),(0,Z.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:m.suite??`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Area`}),(0,Z.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:m.group??`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Stories`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:m.stories.join(`, `)||`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Tags`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:m.tags.length?(0,Z.jsx)(Re,{tags:m.tags,max:10}):`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Steps`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:m.steps})]})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-2 rounded-[14px] border p-6 text-[13px]`,children:[(0,Z.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-[16px] font-semibold`,children:[(0,Z.jsx)(t,{size:16,"aria-hidden":`true`}),`In suites and packs`]}),a.suites.length||m.packs.length?(0,Z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[a.suites.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`a`,{href:w(`test-management`,`suites`,e.id),children:e.name})},e.id)),m.packs.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:w(`regression`,e),children:[`Pack `,e]})},e))]}):(0,Z.jsx)(`p`,{className:`m-0 text-muted`,children:`In no suite or regression pack.`})]}),a.changes.length>0&&(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-2 rounded-[14px] border p-6 text-[13px]`,children:[(0,Z.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:`What ForgeQE did`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.changes.map((e,t)=>(0,Z.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:K(e.at)}),` `,e.action,e.story?` for ${e.story}`:``,e.reason?`: ${e.reason}`:``]},t))})]})]})]})]})}function $e({detail:e,onChanged:t}){let n=e.case,[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(``);(0,J.useEffect)(()=>{(n.proposed.length||a)&&Y.tests().then(e=>i(e.tests),()=>{})},[n.proposed.length,a]);let l=new Map((r??[]).filter(e=>e.uid).map(e=>[e.uid,e])),d=async(e,r,i)=>{c(``);try{await Y.link([{case:n.key,test:e,action:r}]),t(i)}catch(e){c(e.message)}},p=async e=>{c(``);try{t(`${e} is the main test now${(await Y.setMain(n.key,e)).mapped?`, and ForgeQE's mapping records it`:``}. Mark automated writes it to the tracker.`)}catch(e){c(e.message)}},m=async()=>{c(``);try{await Y.proposeLinks([n.key]),t(`The mapping agent is looking for this case's tests. Open the case again in a moment.`)}catch(e){c(e.message)}};return(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-[16px] font-semibold`,children:[(0,Z.jsx)(C,{size:16,"aria-hidden":`true`}),`Automated tests`]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>o(!0),children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),`Link a test`]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>void m(),"data-tip":`The mapping agent picks the tests that check this case`,children:[(0,Z.jsx)(_,{"aria-hidden":`true`}),`Ask the agent`]})]}),s&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:s}),n.tests.length?(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0 text-[13px]`,children:n.tests.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-start gap-2 border-t border-line-soft py-2 first:border-t-0`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1`,children:[(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 [overflow-wrap:anywhere]`,children:[e.name,e.main&&n.tests.length>1&&(0,Z.jsx)(`span`,{"data-tip":`What its tracker records as its automated test, and what a run reuses first`,children:(0,Z.jsx)(P,{tone:`pass`,icon:!1,children:`Main test`})})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-[13px] text-muted`,children:[e.uid&&(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.uid}),e.file&&(0,Z.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:e.file})]}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[ye[e.how],e.why&&e.why!==ye[e.how]?`: ${e.why}`:``]})]}),e.uid&&n.tests.length>1&&!e.main&&(0,Z.jsxs)(F,{size:`sm`,variant:`ghost`,onClick:()=>void p(e.uid),"aria-label":`Make ${e.name} the main test`,"data-tip":`Its tracker records this one as the case's automated test`,children:[(0,Z.jsx)(y,{"aria-hidden":`true`}),`Make main`]}),e.uid&&e.how!==`mapping`&&(0,Z.jsxs)(F,{size:`sm`,variant:`ghost`,onClick:()=>void d(e.uid,`unlink`,`Unlinked ${e.uid}. It is not linked again by itself.`),"aria-label":`Unlink ${e.name}`,children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Unlink`]})]},e.uid??e.key))}):n.test?(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[120px_1fr] gap-x-4 gap-y-2 text-[13px]`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Test`}),(0,Z.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:n.test.name}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`File`}),(0,Z.jsx)(`dd`,{className:`m-0 font-mono [overflow-wrap:anywhere]`,children:n.test.file??`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Known from`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:n.how===`none`?`–`:ye[n.how]})]}):(0,Z.jsx)(`p`,{className:`m-0 text-[13px] 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,Z.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-[13px] text-muted`,children:[`Last runs `,(0,Z.jsx)(Le,{runs:e.test?.runs??n.runs})]}),n.proposed.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] bg-surface-muted p-4 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Proposed by the mapping agent`}),n.proposed.map(e=>{let t=l.get(e.test);return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,Z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t?.name??e.test}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.test}),e.confidence?` · ${e.confidence} confidence`:``,e.why?` · ${e.why}`:``]})]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>void d(e.test,`accept`,`Linked ${e.test}.`),children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Accept`]}),(0,Z.jsxs)(F,{size:`sm`,variant:`ghost`,onClick:()=>void d(e.test,`refuse`,`Refused ${e.test}.`),children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Refuse`]})]},e.test)})]}),(0,Z.jsx)(Xe,{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 Y.link([{case:n.key,test:e,action:`link`}]),o(!1),t(`Linked ${e}.`)}})]})}var et=[{id:`all`,label:`All`,icon:S,test:()=>!0},{id:`not_automated`,label:`Not automated`,icon:l,test:e=>e.automation===`not_automated`},{id:`failing`,label:`Failing`,icon:a,test:Ue,alert:!0},{id:`pending`,label:`Pending`,icon:d,test:e=>e.automation===`pending`},{id:`generated`,label:`Generated by ForgeQE`,icon:_,test:e=>e.origin===`forgeqe`},{id:`stale`,label:`Steps changed`,icon:O,test:e=>e.stale},{id:`drift`,label:`Tracker disagrees`,icon:O,test:e=>e.drift}],$=``,tt=e=>[...new Set(e.filter(e=>!!e))].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}));function nt({cases:e,tests:n=0,selected:a,onSelect:o,onRun:s,onChanged:c}){let[l,u]=(0,J.useState)(`all`),[d,p]=(0,J.useState)($),[m,h]=(0,J.useState)($),[g,v]=(0,J.useState)($),[y,ee]=(0,J.useState)($),[x,te]=(0,J.useState)(!1),[S,C]=(0,J.useState)(!1),[w,ne]=(0,J.useState)(null),T=(0,J.useMemo)(()=>tt(e.flatMap(e=>e.plans)),[e]),E=(0,J.useMemo)(()=>tt(e.map(e=>e.suite)),[e]),D=(0,J.useMemo)(()=>tt(e.flatMap(e=>e.tags)),[e]),O=e.filter(e=>(!d||e.plans.includes(d))&&(!m||e.suite===m)&&(!g||String(e.priority??``)===g)&&(!y||e.tags.includes(y))),re=et.find(e=>e.id===l),k=O.filter(re.test),j=new Set(a),ie=(e,t)=>o(t?[...a,e]:a.filter(t=>t!==e)),N=k.length>0&&k.every(e=>j.has(e.key));return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a.length>0&&(0,Z.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-2 rounded-[12px] bg-accent-soft px-4 py-2 text-[13px] text-accent-fg`,children:[(0,Z.jsxs)(`span`,{className:`font-medium`,children:[a.length,` selected`]}),(0,Z.jsxs)(F,{size:`sm`,variant:`ghost`,onClick:()=>o([]),children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Clear`]}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>te(!0),children:[(0,Z.jsx)(b,{"aria-hidden":`true`}),`Tag`]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>C(!0),children:[(0,Z.jsx)(t,{"aria-hidden":`true`}),`Make a suite`]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>ne(`automation`),"data-tip":`Mark the picked cases automated in their tracker`,children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),`Mark automated`]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>ne(`tags`),"data-tip":`Write ForgeQE's tags to their tracker`,children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),`Write tags`]}),(0,Z.jsxs)(F,{size:`sm`,variant:`primary`,onClick:()=>s(a),children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Run `,a.length]})]}),(0,Z.jsx)(U,{label:`Test cases`,placeholder:`Find a case by id, title, tag or test`,resetKey:`${l}|${d}|${m}|${g}|${y}`,empty:e.length?`Nothing matches.`:n?`No test cases yet. The repository's ${n} automated test${n===1?` is`:`s are`} on the Automated tab.`:`No test cases yet.`,tools:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(R,{items:et.map(e=>({id:e.id,label:e.label,icon:e.icon,n:O.filter(e.test).length,...e.alert?{alert:!0}:{}})),value:l,onChange:u})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[T.length>1&&(0,Z.jsxs)(M,{size:`sm`,"aria-label":`Plan`,value:d,onChange:e=>p(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Every plan`}),T.map(e=>(0,Z.jsx)(`option`,{children:e},e))]}),E.length>0&&(0,Z.jsxs)(M,{size:`sm`,"aria-label":`Suite`,value:m,onChange:e=>h(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Every suite`}),E.map(e=>(0,Z.jsx)(`option`,{children:e},e))]}),(0,Z.jsxs)(M,{size:`sm`,"aria-label":`Priority`,value:g,onChange:e=>v(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Any priority`}),[`1`,`2`,`3`,`4`].map(e=>(0,Z.jsxs)(`option`,{value:e,children:[`Priority `,e]},e))]}),D.length>0&&(0,Z.jsxs)(M,{size:`sm`,"aria-label":`Tag`,value:y,onChange:e=>ee(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Any tag`}),D.map(e=>(0,Z.jsx)(`option`,{children:e},e))]})]})]}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-10`),children:(0,Z.jsx)(q,{"aria-label":`Select every case shown`,checked:N,onCheckedChange:e=>o(e?tt([...a,...k.map(e=>e.key)]):a.filter(e=>!k.some(t=>t.key===e)))})}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Test case`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Suite`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Priority`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Automation`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @4xl:table-cell`),children:`Last runs`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Last run`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:k.map(e=>(0,Z.jsxs)(`tr`,{className:A(`border-t border-line-soft align-top hover:bg-surface-muted`,j.has(e.key)&&`bg-accent-soft hover:bg-accent-soft`),children:[(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(q,{"aria-label":`Select ${e.id}`,checked:j.has(e.key),onCheckedChange:t=>ie(e.key,t)})}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsxs)(`a`,{href:We(e.key),className:`flex min-w-[220px] flex-col gap-1 text-ink no-underline`,children:[(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.id}),e.origin===`forgeqe`&&(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"data-tip":`ForgeQE wrote this case`,children:[(0,Z.jsx)(_,{size:12,"aria-hidden":`true`}),`ForgeQE`]}),e.stories[0]&&(0,Z.jsx)(`span`,{children:e.stories[0]}),(0,Z.jsx)(Re,{tags:e.tags,max:2})]})]})}),(0,Z.jsx)(`td`,{className:A(z,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:(0,Z.jsx)(Q,{text:e.suite??e.plans[0]??`–`})}),(0,Z.jsx)(`td`,{className:A(z,`hidden text-[13px] @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Z.jsxs)(`td`,{className:z,children:[(0,Z.jsx)(Fe,{a:e.automation}),e.stale&&(0,Z.jsx)(`span`,{className:`mt-1 block text-[13px] text-warn`,children:`Steps changed`})]}),(0,Z.jsx)(`td`,{className:A(z,`hidden @4xl:table-cell`),children:(0,Z.jsx)(Le,{runs:e.runs})}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(`span`,{"data-tip":e.lastRun.at?`${K(e.lastRun.at)}${e.lastRun.by===`tracker`?`, in its system`:``}`:void 0,children:(0,Z.jsx)(Ie,{o:e.lastRun.outcome})})}),(0,Z.jsx)(`td`,{className:A(z,`text-right whitespace-nowrap`),children:(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":Ue(e)?`Run again`:`Run`,onClick:()=>s([e.key]),children:(0,Z.jsx)(i,{"aria-hidden":`true`})})})]},e.key))}),(0,Z.jsx)(je,{kind:w,keys:a,onClose:()=>ne(null),onDone:e=>c(e)}),(0,Z.jsx)(rt,{open:x,keys:a,onClose:()=>te(!1),onDone:e=>c(e)}),(0,Z.jsx)(it,{open:S,keys:a,onClose:()=>C(!1),onDone:e=>c(e)})]})}function rt({open:e,keys:t,onClose:n,onDone:r}){let[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(!1),p=async()=>{d(!0),l(``);try{let e={[o?`remove`:`add`]:[i.trim()],cases:t};await Y.tag(e);let s=await Y.tag(e,!0);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,Z.jsx)(V,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:n,children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:u||!i.trim(),onClick:()=>void p(),children:[(0,Z.jsx)(b,{"aria-hidden":`true`}),o?`Remove`:`Add`,` tag`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Tag`,(0,Z.jsx)(N,{value:i,maxLength:40,placeholder:`smoke, release-24.11`,onChange:e=>a(e.target.value)})]}),(0,Z.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(q,{checked:o,onCheckedChange:s}),`Remove it instead`]}),c&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:c})]})})}function it({open:e,keys:n,onClose:r,onDone:i}){let[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),d=async()=>{u(!0),c(``);try{let{suite:e}=await Y.saveSuite({name:a.trim(),groups:[],exclude:[],picked:n});i(`Made the suite ${e.name}.`),o(``),r(),location.hash=w(`test-management`,`suites`,e.id)}catch(e){c(e.message)}finally{u(!1)}};return(0,Z.jsx)(V,{open:e,onClose:r,title:`A suite of ${n.length} test case${n.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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:r,children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:l||!a.trim(),onClick:()=>void d(),children:[(0,Z.jsx)(t,{"aria-hidden":`true`}),`Make the suite`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Name`,(0,Z.jsx)(N,{value:a,maxLength:80,placeholder:`Saved cards`,onChange:e=>o(e.target.value)})]}),s&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:s})]})})}var at=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString([],{month:`short`,day:`numeric`,timeZone:`UTC`}),ot=(e,t)=>t?Math.round(e/t*100):0;function st(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 ${at(a.day)}`}}function ct({view:e,onRunSuite:t}){let n=e.summary;if(!n.cases&&!e.plans.length&&n.tests)return(0,Z.jsx)(L,{icon:C,title:`${n.tests} automated test${n.tests===1?``:`s`} found, no test case yet`,action:(0,Z.jsxs)(`a`,{className:I({size:`sm`}),href:w(`test-management`,`tests`),"data-tip":`Open the Automated tab`,children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),`See the 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(!n.cases&&!e.plans.length)return(0,Z.jsx)(L,{icon:S,title:`No test plans connected yet`,action:(0,Z.jsxs)(`a`,{className:I({size:`sm`}),href:w(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,Z.jsx)(T,{"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 r=e.trend;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(de,{label:`Headline numbers`,children:[(0,Z.jsx)(G,{label:`Test cases`,icon:S,value:n.cases,change:st(r,e=>e.cases,void 0),note:`${e.plans.length} plan${e.plans.length===1?``:`s`}`}),(0,Z.jsx)(G,{label:`Automated`,icon:s,value:`${n.automated} · ${ot(n.automated,n.cases)}%`,change:st(r,e=>e.automated,!0),note:`${n.newlyAutomated} newly this week`}),(0,Z.jsx)(G,{label:`Not automated`,icon:l,value:n.notAutomated,change:st(r,e=>e.notAutomated,!1)}),(0,Z.jsx)(G,{label:`Pending`,icon:d,value:n.pending,tone:n.pending?`text-warn`:void 0,change:st(r,e=>e.pending,!1),note:`in Design or not ready`}),(0,Z.jsx)(G,{label:`Failing`,icon:a,value:n.failing,tone:n.failing?`text-fail`:void 0,change:st(r,e=>e.failing,!1),note:`their last run`}),(0,Z.jsx)(G,{label:`Generated by ForgeQE`,icon:_,value:n.generated,change:st(r,e=>e.generated,!0)})]}),(0,Z.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-2`,children:[(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Automation coverage`}),(0,Z.jsx)(ze,{label:`Share of test cases automated`,points:r.map(e=>({x:at(e.day),y:ot(e.automated,e.cases)})),format:e=>`${e}%`})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Generated and automated, by week`}),(0,Z.jsx)(Be,{label:`Test cases generated and automated each week`,series:[{name:`Generated`,className:`bg-accent-line`},{name:`Automated`,className:`bg-accent`}],items:e.weekly.map(e=>({x:at(e.week),values:[e.generated,e.automated]}))})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Last run of every case`}),(0,Z.jsxs)(`div`,{role:`img`,"aria-label":`Passed ${n.cases-n.failing-n.neverRun}, failing ${n.failing}, not run ${n.neverRun}`,className:`flex h-3 gap-1 overflow-hidden rounded-full`,children:[(0,Z.jsx)(`span`,{className:`bg-pass`,style:{flex:n.cases-n.failing-n.neverRun}}),(0,Z.jsx)(`span`,{className:`bg-fail`,style:{flex:n.failing}}),(0,Z.jsx)(`span`,{className:`bg-line-strong`,style:{flex:n.neverRun}})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-4 text-[13px]`,children:[(0,Z.jsx)(`a`,{href:w(`test-management`,`cases`),className:`no-underline`,children:(0,Z.jsxs)(P,{tone:`pass`,children:[`Passed `,n.cases-n.failing-n.neverRun]})}),(0,Z.jsx)(`a`,{href:w(`test-management`,`gaps`),className:`no-underline`,children:(0,Z.jsxs)(P,{tone:`fail`,children:[`Failing `,n.failing]})}),(0,Z.jsx)(`a`,{href:w(`test-management`,`gaps`),className:`no-underline`,children:(0,Z.jsxs)(P,{tone:`neutral`,children:[`Not run `,n.neverRun]})})]})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline justify-between gap-4`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Automated, by suite`}),(0,Z.jsx)(`a`,{href:w(`test-management`,`gaps`),className:`text-[13px]`,children:`Find gaps`})]}),e.coverage.length?e.coverage.slice(0,8).map(e=>(0,Z.jsx)(Ve,{label:e.suite,part:e.automated,whole:e.cases},e.suite)):(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`No suites yet.`})]})]}),(0,Z.jsx)(U,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Suite`}),(0,Z.jsx)(`th`,{scope:`col`,className:W,children:`Cases`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Last run`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.suites.map(e=>(0,Z.jsxs)(`tr`,{className:ce,onClick:()=>location.hash=w(`test-management`,`suites`,e.id),children:[(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(`a`,{href:w(`test-management`,`suites`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium`,children:e.name})}),(0,Z.jsx)(`td`,{className:B,children:e.cases}),(0,Z.jsx)(`td`,{className:z,children:e.last?(0,Z.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2 text-[13px]`,children:[(0,Z.jsxs)(P,{tone:e.last.failed?`fail`:`pass`,children:[e.last.passed,` passed`,e.last.failed?`, ${e.last.failed} failed`:``]}),(0,Z.jsx)(`span`,{className:`text-muted`,children:K(e.last.at)})]}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not run`})}),(0,Z.jsxs)(`td`,{className:`${z} text-right whitespace-nowrap`,onClick:e=>e.stopPropagation(),children:[!!e.last?.failed&&(0,Z.jsx)(F,{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,Z.jsx)(p,{"aria-hidden":`true`})}),(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.name}`,"data-tip":`Run`,onClick:()=>t(e.id),children:(0,Z.jsx)(i,{"aria-hidden":`true`})})]})]},e.id))}),(0,Z.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-[13px] text-muted`,children:[(0,Z.jsx)(C,{size:14,"aria-hidden":`true`}),n.tests,` automated tests known, `,n.testsWithoutCase,` with no test case behind them.`]})]})}var lt=e=>e&&/^https:\/\//i.test(e)?e:void 0;function ut({id:e,title:t,url:n}){let r=lt(n);return(0,Z.jsxs)(`span`,{className:`flex min-w-[220px] flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t}),r?(0,Z.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:`font-mono text-[13px] text-accent-fg`,children:e}):(0,Z.jsx)(`span`,{className:`font-mono text-[13px] text-accent-fg`,children:e})]})}var dt={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 ft(e,t){let n={system:e};for(let r of dt[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 pt=e=>Object.fromEntries(Object.entries(e??{}).filter(([e])=>e!==`system`).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]));function mt({gaps:e,onRead:t}){let[r,i]=(0,J.useState)(e.live?.system??`azure_devops`),[a,o]=(0,J.useState)(pt(e.live)),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(``);(0,J.useEffect)(()=>{e.live&&(i(e.live.system),o(pt(e.live)))},[e.live]);let d=async()=>{c(!0),u(``);try{await Y.readStories(ft(r,a)),t()}catch(e){u(e.message)}finally{c(!1)}};return(0,Z.jsxs)(`form`,{className:`card flex flex-col gap-4 rounded-[14px] border p-4`,onSubmit:e=>{e.preventDefault(),d()},children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:`Stories in`}),(0,Z.jsxs)(M,{size:`sm`,value:r,onChange:e=>(i(e.target.value),o({})),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:`azure_devops`,children:`Azure DevOps`}),(0,Z.jsx)(`option`,{value:`jira`,children:`Jira (also Xray and Zephyr Scale)`}),(0,Z.jsx)(`option`,{value:`qtest`,children:`qTest requirements`})]})]}),dt[r].map(e=>(0,Z.jsxs)(`label`,{className:`flex min-w-[140px] flex-[1_1_140px] flex-col gap-1 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:e.label}),(0,Z.jsx)(N,{size:`sm`,value:a[e.key]??``,maxLength:e.list?2e3:200,placeholder:e.placeholder,onChange:t=>o({...a,[e.key]:t.target.value})})]},e.key)),(0,Z.jsxs)(F,{size:`sm`,variant:`primary`,type:`submit`,disabled:s||!dt[r].some(e=>e.key!==`project`&&(a[e.key]??``).trim()),children:[(0,Z.jsx)(n,{"aria-hidden":`true`}),s?`Reading…`:`Read stories`]})]}),l&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:l})]})}function ht({kind:e,gaps:t,picked:n=[],onPick:r=()=>{},onRead:i=()=>{}}){let a=(0,Z.jsx)(mt,{gaps:t,onRead:i});if(!t.report)return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a,(0,Z.jsx)(L,{icon:E,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,Z.jsxs)(`p`,{className:`m-0 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[t.report.id===`live`?`Read from the tracker${t.report.at?` ${K(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,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o,(0,Z.jsx)(U,{label:`Stories with no test case`,placeholder:`Find a story`,empty:`Every story of the release has a test case.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-10`),children:(0,Z.jsx)(q,{"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,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-[55%]`),children:`Story`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Type`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`State`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Area`})]}),children:t.noCase.map(e=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(q,{"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,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(ut,{id:e.id,title:e.title,url:e.url})}),(0,Z.jsx)(`td`,{className:A(z,`hidden text-[13px] @2xl:table-cell`),children:e.type||`–`}),(0,Z.jsx)(`td`,{className:z,children:e.state?(0,Z.jsx)(P,{tone:`neutral`,icon:!1,children:e.state}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})}),(0,Z.jsx)(`td`,{className:A(z,`hidden text-[13px] @2xl:table-cell [overflow-wrap:anywhere]`),children:e.area||`–`})]},e.id))})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o,(0,Z.jsx)(U,{label:`Acceptance criteria no test case covers`,placeholder:`Find a criterion`,empty:`Every traced acceptance criterion has a test case.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-[55%]`),children:`Criterion`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Story`})]}),children:t.criteria.map((e,t)=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:A(z,`[overflow-wrap:anywhere]`),children:e.text}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(ut,{id:e.story,title:e.storyTitle,url:e.url})})]},`${e.story}-${t}`))})]})}var gt=[{id:`stories`,label:`Stories with no case`,icon:E},{id:`criteria`,label:`Criteria not covered`,icon:S}],_t=[{id:`not_automated`,label:`Not automated`,icon:l},{id:`pending`,label:`Pending`,icon:d},{id:`never_run`,label:`Never run`,icon:l},{id:`failing`,label:`Failing`,icon:a,alert:!0},{id:`stale`,label:`Steps changed`,icon:O},{id:`drift`,label:`Tracker disagrees`,icon:O},{id:`no_case`,label:`Tests with no case`,icon:C}];function vt({gaps:e,cases:t,tests:n,selected:r,onSelect:a,onRun:o,pickedStories:s=[],onPickStories:c=()=>{},onStoriesRead:l=()=>{}}){let[u,d]=(0,J.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=u===`no_case`||u===`stories`||u===`criteria`?[]:u===`not_automated`?e.ranked.map(e=>e.key):e.lists[u],h=e.stories??{stories:0,noCase:[],criteria:[]},g={stories:h.noCase.length,criteria:h.criteria.length},_=m.map(e=>f.get(e)).filter(e=>!!e),v=new Set(r),y=(e,t)=>a(t?[...r,e]:r.filter(t=>t!==e));return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(R,{items:[..._t.map(t=>({id:t.id,label:t.label,icon:t.icon,n:e.counts[t.id],...t.alert?{alert:!0}:{}})),...gt.map(e=>({id:e.id,label:e.label,icon:e.icon,n:g[e.id],tip:h.report?h.report.id===`live`?`Read from the tracker: ${h.report.scope}`:`From the readiness report of ${h.report.scope||h.report.id}`:`Read the release's stories from the tracker first`}))],value:u,onChange:e=>d(e)})}),u===`not_automated`&&_.length>0&&(0,Z.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-[13px] text-ink-2`,children:[`Highest value first: priority, failing when run, in a pack, tagged smoke.`,(0,Z.jsx)(F,{size:`sm`,onClick:()=>a(_.slice(0,20).map(e=>e.key)),children:`Pick the top 20`})]})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Not automated, by suite`}),e.bySuite.length?e.bySuite.slice(0,8).map(e=>(0,Z.jsx)(Ve,{label:e.suite,part:e.notAutomated+e.pending,whole:e.cases,className:`bg-warn`},e.suite)):(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Nothing left to automate.`})]})]}),u===`stories`||u===`criteria`?(0,Z.jsx)(ht,{kind:u,gaps:h,picked:s,onPick:c,onRead:l}):u===`no_case`?(0,Z.jsx)(U,{label:`Tests with no test case`,placeholder:`Find a test`,empty:`Every test ForgeQE knows has a test case behind it.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-[55%]`),children:`Test`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Tags`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Last runs`})]}),children:e.testsWithoutCase.map(e=>{let t=n.find(t=>t.key===e);return t?(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsxs)(`td`,{className:A(z,`max-w-0`),children:[(0,Z.jsx)(Q,{text:t.name,tip:t.file?`${t.name} · ${t.file}`:t.name}),t.flaky&&(0,Z.jsx)(P,{tone:`warn`,className:`mt-1`,children:`Flaky`})]}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(Re,{tags:t.tags})}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(Le,{runs:t.runs})})]},e):null})}):(0,Z.jsx)(U,{label:_t.find(e=>e.id===u).label,placeholder:`Find a case`,resetKey:u,empty:`No gap of this kind.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-10`),children:(0,Z.jsx)(q,{"aria-label":`Select every case shown`,checked:_.length>0&&_.every(e=>v.has(e.key)),onCheckedChange:e=>a(e?[...new Set([...r,..._.map(e=>e.key)])]:r.filter(e=>!_.some(t=>t.key===e)))})}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Test case`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Priority`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:u===`not_automated`?`Why it matters`:`Automation`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Last run`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:_.map(e=>(0,Z.jsxs)(`tr`,{className:A(`border-t border-line-soft align-top hover:bg-surface-muted`,v.has(e.key)&&`bg-accent-soft hover:bg-accent-soft`),children:[(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(q,{"aria-label":`Select ${e.id}`,checked:v.has(e.key),onCheckedChange:t=>y(e.key,t)})}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsxs)(`a`,{href:We(e.key),className:`flex min-w-[220px] flex-col gap-1 text-ink no-underline`,children:[(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.id}),e.suite&&(0,Z.jsx)(`span`,{children:e.suite}),(0,Z.jsx)(Re,{tags:e.tags,max:2})]})]})}),(0,Z.jsx)(`td`,{className:A(z,`hidden text-[13px] @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Z.jsx)(`td`,{className:z,children:u===`not_automated`?(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-1`,children:[(p.get(e.key)??[]).map(e=>(0,Z.jsx)(P,{tone:`running`,icon:!1,children:e},e)),!(p.get(e.key)??[]).length&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})]}):(0,Z.jsx)(Fe,{a:e.automation})}),(0,Z.jsx)(`td`,{className:A(z,`hidden @2xl:table-cell`),children:(0,Z.jsx)(Ie,{o:e.lastRun.outcome})}),(0,Z.jsx)(`td`,{className:A(z,`text-right`),children:(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":`Run`,onClick:()=>o([e.key]),children:(0,Z.jsx)(i,{"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)`,bt={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 xt({suites:e,onRun:n}){return e.length?(0,Z.jsx)(U,{label:`Suites`,placeholder:`Find a suite`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-[40%]`),children:`Suite`}),(0,Z.jsx)(`th`,{scope:`col`,className:W,children:`Cases`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(W,`hidden @xl:table-cell`),children:`Automated`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Last run`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.map(e=>(0,Z.jsxs)(`tr`,{className:ce,onClick:()=>location.hash=w(`test-management`,`suites`,e.id),children:[(0,Z.jsxs)(`td`,{className:A(z,`max-w-0`),children:[(0,Z.jsxs)(`a`,{href:w(`test-management`,`suites`,e.id),onClick:e=>e.stopPropagation(),className:`flex items-center gap-2 font-medium`,children:[e.built===`agent`?(0,Z.jsx)(_,{size:14,"aria-hidden":`true`,className:`flex-none`}):(0,Z.jsx)(t,{size:14,"aria-hidden":`true`,className:`flex-none`}),(0,Z.jsx)(Q,{text:e.name})]}),e.description&&(0,Z.jsx)(Q,{text:e.description,className:`mt-1 text-[13px] text-muted`})]}),(0,Z.jsx)(`td`,{className:B,children:e.cases}),(0,Z.jsxs)(`td`,{className:A(B,`hidden @xl:table-cell`),children:[e.cases?Math.round(e.automated/e.cases*100):0,`%`]}),(0,Z.jsx)(`td`,{className:z,children:e.last?(0,Z.jsxs)(`span`,{className:`flex flex-col items-start gap-1 text-[13px]`,"data-tip":yt(e.last),children:[(0,Z.jsxs)(P,{tone:e.last.failed?`fail`:`pass`,children:[e.last.passed,` passed`,e.last.failed?`, ${e.last.failed} failed`:``]}),(0,Z.jsx)(`span`,{className:`text-muted`,children:K(e.last.at)})]}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not run`})}),(0,Z.jsxs)(`td`,{className:A(z,`text-right whitespace-nowrap`),onClick:e=>e.stopPropagation(),children:[!!e.last?.failed&&(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Rerun the failed cases of ${e.name}`,"data-tip":`Rerun failed`,onClick:()=>n(e.id,`failed`),children:(0,Z.jsx)(p,{"aria-hidden":`true`})}),(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.name}`,"data-tip":`Run`,onClick:()=>n(e.id),children:(0,Z.jsx)(i,{"aria-hidden":`true`})})]})]},e.id))}):(0,Z.jsx)(L,{icon:t,title:`No suites yet`,children:`Tell the Suite agent on the right what the 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.`})}function St({id:e,onRun:t,onDeleted:n}){let[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,m]=(0,J.useState)(!1);(0,J.useEffect)(()=>{o(null),Y.suite(e).then(e=>{o(e),c(``)},e=>c(e.message))},[e]);let h=(0,Z.jsxs)(`a`,{href:w(`test-management`,`suites`),className:`inline-flex w-fit items-center gap-2 text-[13px]`,children:[(0,Z.jsx)(ee,{size:14,"aria-hidden":`true`}),`All suites`]});if(s)return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[h,(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail`,children:s})]});if(!a)return(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let g=a.suite,_=a.members.filter(e=>e.case.lastRun.outcome===`failed`||e.case.lastRun.outcome===`blocked`).length;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[h,(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:g.name}),g.description&&(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:g.description}),g.tracker&&(0,Z.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[`Kept as`,` `,De(g.tracker)?(0,Z.jsx)(`a`,{href:De(g.tracker),target:`_blank`,rel:`noreferrer noopener`,children:Oe(g.tracker)}):Oe(g.tracker)]})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(g.tracker||a.targets.length>0)&&(0,Z.jsxs)(F,{onClick:()=>m(!0),children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),g.tracker?`Keep in step`:`Keep in tracker`]}),(0,Z.jsxs)(F,{variant:`danger`,onClick:()=>u(!0),children:[(0,Z.jsx)(re,{"aria-hidden":`true`}),`Delete`]}),_>0&&(0,Z.jsxs)(F,{onClick:()=>t(g.id,`failed`),children:[(0,Z.jsx)(p,{"aria-hidden":`true`}),`Rerun `,_,` failed`]}),(0,Z.jsxs)(F,{variant:`primary`,onClick:()=>t(g.id),children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Run suite`]})]})]}),(0,Z.jsxs)(de,{label:`The suite`,children:[(0,Z.jsx)(G,{compact:!0,label:`Cases`,value:g.cases,note:`${g.automated} automated`}),(0,Z.jsx)(G,{compact:!0,label:`Last run`,value:g.last?`${g.last.passed} passed`:`Not run`,tone:g.last?.failed?`text-fail`:void 0,note:g.last?`${g.last.failed} failed · ${K(g.last.at)}${g.last.from===`report`?``:` · so far`}`:void 0}),(0,Z.jsx)(G,{compact:!0,label:`Runs on`,value:g.env??`Active`,note:g.runs.length?`${g.runs.length} run${g.runs.length===1?``:`s`}`:`never run`}),(0,Z.jsx)(G,{compact:!0,label:`Built`,value:g.built===`agent`?`Suite agent`:g.built===`rules`?`Rules`:`Picked`,note:`updated ${K(g.updatedAt)}`})]}),g.groupsCount.length>0&&(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-2 rounded-[14px] border p-6 text-[13px]`,children:[(0,Z.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:`Why these cases`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:g.groupsCount.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Z.jsx)(`span`,{className:`text-muted`,children:g.groups[t]?.rules.map(e=>`${bt[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(` and `)}),(0,Z.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.cases})]},e.label))})]}),(0,Z.jsx)(U,{label:`Cases`,placeholder:`Find a case`,empty:`No case meets the suite's rules now.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-[45%]`),children:`Test case`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @xl:table-cell`),children:`Why it is in`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Automation`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Last run`})]}),children:a.members.map(e=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:A(z,`max-w-0`),children:(0,Z.jsxs)(`a`,{href:We(e.case.key),className:`flex min-w-0 flex-col gap-1 text-ink no-underline`,children:[(0,Z.jsx)(Q,{text:e.case.title,className:`font-medium`}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.case.id}),(0,Z.jsx)(Re,{tags:e.case.tags})]})]})}),(0,Z.jsx)(`td`,{className:A(z,`hidden text-[13px] text-ink-2 @xl:table-cell`),children:e.group}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(Fe,{a:e.case.automation})}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(Ie,{o:e.case.lastRun.outcome})})]},e.case.key))}),(0,Z.jsx)(Me,{open:d,suite:g,targets:a.targets,onClose:()=>m(!1),onDone:()=>void Y.suite(e).then(o,()=>{})}),(0,Z.jsx)(V,{open:l,onClose:()=>u(!1),title:`Delete ${g.name}?`,description:`The suite goes from .forgeqe/testmgmt/suites.json. Its cases and their runs stay.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:()=>u(!1),children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`destructive`,onClick:()=>void Y.deleteSuite(g.id).then(()=>{u(!1),n()},e=>c(e.message)),children:[(0,Z.jsx)(re,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,Z.jsx)(`p`,{className:`m-0 pt-4 text-[13px] text-ink-2`,children:`Runs already made are kept in Runs.`})})]})}function Ct({open:e,onSaved:t}){let[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.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){s(!0),l(``),r(e=>[...e,{you:n}]),a(``);try{let t=await Y.buildSuite(f?`${f}. ${n}`:n,e?.id);r(e=>[...e,{built:t}])}catch(e){l(e.message)}finally{s(!1)}}},m=async n=>{if(d){s(!0);try{let{suite:i}=await Y.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){l(e.message)}finally{s(!1)}}};return(0,Z.jsxs)(xe,{title:`Suite agent`,about:`Builds and changes suites from your plans, tags and runs.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.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,Z.jsx)(F,{size:`sm`,disabled:o,onClick:()=>void p(e),children:e},e))}),(0,Z.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),p(i)},children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`tm-suite-words`,children:`Tell the Suite agent what the suite is for`}),(0,Z.jsx)(`textarea`,{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 rounded-[10px] border border-line bg-bg px-4 py-2 text-[13px] text-ink outline-none focus:border-accent`}),(0,Z.jsx)(F,{size:`icon`,variant:`primary`,type:`submit`,disabled:o||!i.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,Z.jsx)(h,{"aria-hidden":`true`})})]})]}),children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,Z.jsx)(ae,{state:o?`thinking`:`working`,px:96,label:o?`Building the suite`:`Ready`}),(0,Z.jsx)(`span`,{className:`text-[13px] 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,Z.jsx)(`p`,{className:`m-0 text-center text-[16px] leading-relaxed text-ink-2`,children:e.you},t):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`p`,{className:`m-0 text-center text-[20px] leading-snug`,children:[e.built.name,`: `,e.built.cases,` case`,e.built.cases===1?``:`s`,`, `,e.built.automated,` automated.`]}),e.built.summary&&(0,Z.jsx)(`p`,{className:`m-0 text-center text-[13px] text-ink-2`,children:e.built.summary}),e.built.note&&(0,Z.jsx)(`p`,{className:`m-0 text-center text-[13px] text-muted`,children:e.built.note}),(0,Z.jsxs)(`div`,{className:`card flex flex-col gap-2 rounded-[14px] border bg-bg p-4 text-[13px]`,children:[e.built.perGroup.map(e=>(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-2`,"data-tip":e.why,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Z.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.cases})]},e.label)),e.built.exclude.length>0&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[`Leaves out: `,e.built.exclude.map(e=>`${bt[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(`, `)]})]}),e.built.question&&t===n.length-1&&(0,Z.jsxs)(`div`,{className:`card flex flex-col gap-2 rounded-[14px] border bg-bg p-4 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.built.question.text}),e.built.question.options.map(e=>(0,Z.jsx)(F,{size:`sm`,disabled:o,onClick:()=>void p(e),className:`justify-start`,children:e},e))]}),e.built.sample.length>0&&(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:e.built.sample.slice(0,5).map(e=>(0,Z.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`flex-none font-mono text-accent-fg`,children:e.case.id}),(0,Z.jsx)(Q,{text:e.case.title,className:`min-w-0 text-ink-2`})]},e.case.key))})]},t)),c&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c}),d&&(0,Z.jsxs)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:[e&&(0,Z.jsxs)(F,{disabled:o,onClick:()=>void m(!0),children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Update `,e.name]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:o,onClick:()=>void m(!1),children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Save `,e?`as a new suite`:`suite`]})]})]})}var wt=[{id:`off`,label:`Off`,icon:l},{id:`hourly`,label:`Every hour`,icon:n},{id:`daily`,label:`Daily`,icon:D}];function Tt(e){return!e||e.every===`off`?`Sync: off`:e.every===`hourly`?`Sync: hourly`:e.every===`daily`?`Sync: daily ${e.at}`:`Sync: custom`}function Et({disabled:e}){let[t,n]=(0,J.useState)(!1),[r,i]=(0,J.useState)(null);return(0,J.useEffect)(()=>{Y.schedule().then(e=>i(e.schedule),()=>{})},[]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{size:`sm`,disabled:e,onClick:()=>n(!0),"data-tip":r?.nextAt?`Next sync ${ge(r.nextAt)}`:`Set when the plans are synced`,children:[(0,Z.jsx)(D,{"aria-hidden":`true`}),Tt(r)]}),(0,Z.jsx)(Dt,{open:t,onClose:()=>n(!1),now:r,onSaved:i})]})}function Dt({open:e,onClose:t,now:n,onSaved:r}){let[i,a]=(0,J.useState)(`off`),[o,s]=(0,J.useState)(`06:00`),[c,l]=(0,J.useState)(``),[d,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(null),[g,_]=(0,J.useState)(!1);(0,J.useEffect)(()=>{e&&(l(``),_(!!n&&n.every!==`off`&&n.every!==`custom`&&!!n.discover),Y.discoveryPlan().then(h,()=>h(null)),a(n&&n.every!==`custom`?n.every:`off`),n?.every===`daily`&&s(n.at))},[e,n]);let v=async()=>{p(!0);try{let e=g&&m&&i!==`off`?{discover:m.digest}:{};r((await Y.setSchedule(i===`daily`?{every:i,at:o,...e}:i===`hourly`?{every:i,...e}:{every:i})).schedule),t()}catch(e){l(e.message)}finally{p(!1)}};return(0,Z.jsx)(V,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:t,children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:d||i===`daily`&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(o),onClick:()=>void v(),children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Save`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[(0,Z.jsx)(`div`,{role:`group`,"aria-label":`When to sync`,className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(R,{items:wt.map(e=>({id:e.id,label:e.label,icon:e.icon})),value:i,onChange:a})}),i===`daily`&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Time (this computer's clock)`,(0,Z.jsx)(N,{type:`time`,step:60,value:o,onChange:e=>s(e.target.value)})]}),i!==`off`&&m&&m.steps.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(q,{checked:g,onCheckedChange:e=>_(e===!0),"aria-label":`Also discover the tests`}),(0,Z.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.`})]}),g&&(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:m.steps.map((e,t)=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`rounded-[8px] bg-surface-strong px-2 py-1 font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.command})},t))})]}),n?.every===`custom`&&(0,Z.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,Z.jsx)(`p`,{className:`m-0 text-warn`,children:`The sync job is disabled in the jobs service.`}),n?.last&&(0,Z.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`Last scheduled sync `,ge(n.last.at),`: `,n.last.status.replace(`_`,` `),`.`]}),c&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:c})]})})}var Ot={forgeqe:{label:`ForgeQE`,icon:_},script:{label:`Tests`,icon:C}},kt=e=>Ot[e]??{label:e===`azure_devops`?`Azure DevOps`:e===`jira`?`Jira`:e,icon:c},At=e=>e!==`forgeqe`&&e!==`script`,jt=[];function Mt({tags:e,cases:t=[],onChanged:n}){let[i,a]=(0,J.useState)(`all`),[o,s]=(0,J.useState)(null),l=e=>e.system===`azure_devops`||e.system===`jira`,u=e=>t.filter(t=>t.ownTags.includes(e)&&!t.trackerTags.includes(e)&&l(t)).map(e=>e.key),d=e=>t.filter(t=>t.ownTags.includes(e)&&t.trackerTags.includes(e)&&l(t)).map(e=>e.key),f=e.tags.filter(e=>i===`all`||(i===`out`?e.outOfStep>0:i===`tracker`?e.from.some(At):e.from.includes(i))),p=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(de,{label:`Tags`,children:[(0,Z.jsx)(G,{compact:!0,label:`Tags in use`,icon:b,value:e.tags.length}),(0,Z.jsx)(G,{compact:!0,label:`Test cases with a tag`,value:p(e.casesTagged,e.cases),note:`${e.casesTagged} of ${e.cases}`}),(0,Z.jsx)(G,{compact:!0,label:`Tests with a tag`,value:p(e.testsTagged,e.tests),note:`${e.testsTagged} of ${e.tests}`}),(0,Z.jsx)(G,{compact:!0,label:`Out of step`,icon:O,value:e.tags.filter(e=>e.outOfStep).length,tone:e.tags.some(e=>e.outOfStep)?`text-warn`:void 0,note:`a case's tag its test lacks`})]}),(0,Z.jsx)(U,{label:`Tags`,placeholder:`Find a tag`,resetKey:i,empty:e.tags.length?`Nothing matches.`:`No tags yet: tag cases in Test cases, or in their system.`,tools:(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(R,{items:[{id:`all`,label:`All`,n:e.tags.length},{id:`tracker`,label:`From their systems`,icon:c,n:e.tags.filter(e=>e.from.some(At)).length},{id:`script`,label:`From tests`,icon:C,n:e.tags.filter(e=>e.from.includes(`script`)).length},{id:`forgeqe`,label:`ForgeQE's`,icon:_,n:e.tags.filter(e=>e.from.includes(`forgeqe`)).length},{id:`out`,label:`Out of step`,icon:O,n:e.tags.filter(e=>e.outOfStep).length,alert:!0}],value:i,onChange:a})}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`w-[28%]`),children:`Tag`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:`Comes from`}),(0,Z.jsx)(`th`,{scope:`col`,className:W,children:`Test cases`}),(0,Z.jsx)(`th`,{scope:`col`,className:W,children:`Tests`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @xl:table-cell`),children:`Out of step`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(H,`hidden @2xl:table-cell`),children:`Used by suites`}),(0,Z.jsx)(`th`,{scope:`col`,className:H,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:f.map(e=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-[6px] bg-surface-strong px-2 text-[13px] font-medium`,children:[(0,Z.jsx)(b,{size:12,"aria-hidden":`true`}),e.name]})}),(0,Z.jsx)(`td`,{className:z,children:(0,Z.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.from.map(e=>{let t=kt(e);return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-[6px] border border-line px-2 text-[13px] text-ink-2`,children:[(0,Z.jsx)(t.icon,{size:12,"aria-hidden":`true`}),t.label]},e)})})}),(0,Z.jsx)(`td`,{className:B,children:e.cases}),(0,Z.jsx)(`td`,{className:B,children:e.tests}),(0,Z.jsx)(`td`,{className:A(z,`hidden @xl:table-cell`),children:e.outOfStep?(0,Z.jsx)(P,{tone:`warn`,children:e.outOfStep}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})}),(0,Z.jsx)(`td`,{className:A(z,`hidden text-[13px] text-ink-2 @2xl:table-cell`),children:e.suites.join(`, `)||`–`}),(0,Z.jsxs)(`td`,{className:A(z,`text-right`),children:[u(e.name).length>0&&(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Write the tag ${e.name} to the trackers of ${u(e.name).length} cases`,"data-tip":`Write to the trackers of ${u(e.name).length} cases`,onClick:()=>s({kind:`tags`,keys:u(e.name)}),children:(0,Z.jsx)(r,{"aria-hidden":`true`})}),d(e.name).length>0&&(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Take the tag ${e.name} off in the trackers of ${d(e.name).length} cases`,"data-tip":`Take off in the trackers of ${d(e.name).length} cases`,onClick:()=>s({kind:`untag`,keys:d(e.name),tags:[e.name]}),children:(0,Z.jsx)(v,{"aria-hidden":`true`})})]})]},e.name))}),(0,Z.jsx)(je,{kind:o?.kind??null,keys:o?.keys??jt,tags:o?.tags,onClose:()=>s(null),onDone:e=>n?.(e)})]})}var Nt=[`dashboard`,`cases`,`tests`,`gaps`,`suites`,`tags`];function Pt({sub:e}){let t=(e??``).split(`/`).filter(Boolean),r=Nt.includes(t[0])?t[0]:`dashboard`,o=r===`cases`&&t[1]?te(t[1]):void 0,s=r===`suites`&&t[1]?te(t[1]):void 0,[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)([]),[g,v]=(0,J.useState)(null),[y,ee]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),[T,E]=(0,J.useState)(``),[D,O]=(0,J.useState)(``),[re,k]=(0,J.useState)(!1),[j,ie]=(0,J.useState)([]),[M,N]=(0,J.useState)(null),[ae,I]=(0,J.useState)(!0),L=(0,J.useCallback)(async()=>{try{let[e,t]=await Promise.all([Y.view(),Y.cases()]);l(e),d(t),ee(e.suites),S(e.job),E(``)}catch(e){E(e.message)}},[]);(0,J.useEffect)(()=>{L()},[L]),(0,J.useEffect)(()=>{r===`gaps`&&Y.gaps().then(p,e=>E(e.message)),r===`tags`&&Y.tags().then(v,e=>E(e.message)),r===`suites`&&Y.suites().then(e=>ee(e.suites),e=>E(e.message))},[r,c]),(0,J.useEffect)(()=>{if(!x?.running)return;let e=pe(()=>{Y.job().then(e=>{S(e.job),e.job?.running||L()},()=>{})},2e3);return()=>se(e)},[x?.running,L]);let R=async()=>{k(!0),O(``);try{let e=await Y.sync(),t=e.plans.filter(e=>e.error);O(t.length?t.map(e=>`${e.label}: ${e.error}`).join(` · `):`Synced ${e.plans.map(e=>`${e.label} (${e.cases} cases)`).join(`, `)}.`),await L()}catch(e){E(e.message)}finally{k(!1)}},ce=e=>N({title:`Run ${e.length} test case${e.length===1?``:`s`}`,go:(t,n)=>Y.run(e,t,n)}),z=(e,t)=>{let n=y?.find(t=>t.id===e)??c?.suites.find(t=>t.id===e);N({title:`${t?`Rerun the failed cases of`:`Run`} ${n?.name??`the suite`}`,go:(n,r)=>Y.runSuite(e,{...n?{env:n}:{},...t?{only:t}:{}},r)})},de=()=>{O(`The run started: it shows here while it runs, and in Runs.`),Y.job().then(e=>S(e.job),()=>{})},B=e=>{O(e),ie([]),L()},V=new Map((u?.cases??[]).map(e=>[e.key,e])),H=j.filter(e=>V.has(e)),U=e=>e.map(e=>V.get(e).id),W=H.filter(e=>[`failed`,`blocked`].includes(V.get(e).lastRun.outcome)),G=H.filter(e=>V.get(e).automation!==`automated`),q=[{intent:`automate`,label:G.length?`Automate ${G.length}`:`Automate`,icon:C,keys:G.slice(0,50),...G.length?{}:{disabled:`Pick test cases that are not automated`}},{intent:`investigate`,label:W.length?`Why ${W.length} fail`:`Why they fail`,icon:a,keys:W.slice(0,50),...W.length?{}:{disabled:`Pick failing test cases`}},{intent:`tag`,label:`Suggest tags`,icon:b,keys:H.slice(0,50),...H.length?{}:{disabled:`Pick test cases in the list first`}},{intent:`tag_tests`,label:`Write tags into tests`,icon:C,keys:H.filter(e=>V.get(e).tests.length>0&&V.get(e).tags.length>0).slice(0,50),...H.filter(e=>V.get(e).tests.length>0&&V.get(e).tags.length>0).length?{}:{disabled:`Pick tagged cases that have a linked test`}}],_e=(f?.ranked??[]).slice(0,20).map(e=>e.key),ve=[{intent:`automate`,label:H.length?`Automate ${H.length}`:`Automate the top ${_e.length}`,icon:C,keys:(H.length?H:_e).slice(0,50),...H.length||_e.length?{}:{disabled:`Nothing left to automate`}},{intent:`investigate`,label:`Why the failing fail`,icon:a,keys:(f?.lists.failing??[]).slice(0,50),...f?.lists.failing.length?{}:{disabled:`Nothing is failing`}},{intent:`cases_for_stories`,label:m.length?`Cases for ${m.length} stor${m.length===1?`y`:`ies`}`:`Cases for stories with none`,icon:_,keys:[],stories:(m.length?m:(f?.stories?.noCase??[]).map(e=>e.id)).slice(0,50),...m.length||f?.stories?.noCase.length?{}:{disabled:`Read the release's stories in Gaps, Stories with no case, first`}}],ye=s?y?.find(e=>e.id===s):void 0,be=(0,Z.jsxs)(`main`,{className:A(me,`@container flex-auto gap-4`),children:[(0,Z.jsx)(ue,{}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Z.jsx)(le,{pixel:oe[`test-management`],size:`lg`}),(0,Z.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test management`}),c&&(0,Z.jsx)(he,{label:`Test management`,className:`mb-0`,current:r,onPick:e=>location.hash=w(`test-management`,e),tabs:[{id:`dashboard`,label:`Dashboard`},{id:`cases`,label:`Test cases`,n:c.summary.cases},{id:`tests`,label:`Automated`,n:c.summary.tests},{id:`gaps`,label:`Gaps`,n:c.summary.notAutomated+c.summary.pending+c.summary.failing},{id:`suites`,label:`Suites`,n:c.suites.length},{id:`tags`,label:`Tags`}]}),c&&(0,Z.jsxs)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[c.plans.length>0&&(0,Z.jsxs)(`span`,{"data-tip":c.plans.map(e=>`${e.label}: ${e.cases} cases${e.at?`, synced ${ge(e.at)}`:``}`).join(` · `),children:[c.plans.length,` plan`,c.plans.length===1?``:`s`,c.plans[0]?.at?`, synced ${K(c.plans.map(e=>e.at??``).sort()[0])}`:`, not synced yet`]}),c.plans.length>0&&(0,Z.jsxs)(F,{size:`sm`,disabled:re,onClick:()=>void R(),"data-tip":`Read every case of the connected plans again`,children:[(0,Z.jsx)(n,{"aria-hidden":`true`}),re?`Syncing…`:`Sync`]}),(c.plans.length>0||c.summary.tests>0)&&(0,Z.jsx)(Et,{disabled:re}),(r===`cases`||r===`gaps`||r===`suites`)&&!ae&&(0,Z.jsxs)(F,{size:`sm`,onClick:()=>I(!0),children:[(0,Z.jsx)(_,{"aria-hidden":`true`}),r===`suites`?`Suite agent`:`Agent`]})]})]}),T&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:T}),!c&&!T&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),D&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:D}),c&&c.refused.length>0&&(0,Z.jsxs)(`p`,{className:`m-0 text-[13px] text-warn`,children:[`Not read, as their system does not write a plan that way: `,c.refused.join(` · `),`. Fix them in Settings › Integrations.`]}),x&&(0,Z.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-2 rounded-[12px] border border-line px-4 py-2 text-[13px]`,children:[(0,Z.jsx)(P,{tone:x.running?`running`:x.exitCode===0?`pass`:`fail`,children:x.running?`Running`:x.exitCode===0?`Finished`:`Stopped`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink-2`,"data-tip":x.command,children:x.lines.at(-1)??x.command}),x.running?(0,Z.jsxs)(F,{size:`sm`,variant:`danger`,onClick:()=>void Y.stop().then(e=>S(e.job)),children:[(0,Z.jsx)(ne,{"aria-hidden":`true`}),`Stop`]}):(0,Z.jsx)(`a`,{href:w(`runs`),className:`text-[13px]`,children:`Runs`})]}),c&&(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsxs)(`div`,{id:`panel-${r}`,role:`tabpanel`,"aria-labelledby":`tab-${r}`,className:`flex flex-col gap-4`,children:[r===`dashboard`&&(0,Z.jsx)(ct,{view:c,onRunSuite:z}),r===`cases`&&(o?(0,Z.jsx)(Qe,{caseKey:o,onRun:ce}):u&&(0,Z.jsx)(nt,{cases:u.cases,tests:u.tests.length,selected:H,onSelect:ie,onRun:ce,onChanged:B})),r===`tests`&&u&&(0,Z.jsx)(Ge,{cases:u.cases,onChanged:B}),r===`gaps`&&(f&&u?(0,Z.jsx)(vt,{gaps:f,cases:u.cases,tests:u.tests,selected:H,onSelect:ie,onRun:ce,pickedStories:m,onPickStories:h,onStoriesRead:()=>(h([]),void L())}):(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`})),r===`suites`&&(s?(0,Z.jsx)(St,{id:s,onRun:z,onDeleted:()=>(location.hash=w(`test-management`,`suites`),void L())},s):y&&(0,Z.jsx)(xt,{suites:y,onRun:z})),r===`tags`&&(g?(0,Z.jsx)(Mt,{tags:g,cases:u?.cases,onChanged:B}):(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}))]})}),(0,Z.jsx)(He,{open:!!M,onClose:()=>N(null),title:M?.title??`Run`,preview:(e,t)=>M.go(e,t),onStarted:de})]}),X=o?V.get(o):void 0;return(0,Z.jsxs)(`div`,{className:`@container flex min-h-(--screen) flex-col`,children:[(0,Z.jsx)(fe,{}),(0,Z.jsxs)(`div`,{className:`flex flex-auto flex-col xl:flex-row`,children:[(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-auto flex-col`,children:be}),c&&ae&&r===`cases`&&(0,Z.jsx)(Se,{title:`Test case agent`,about:`Automates, runs and tags the cases you pick.`,looking:X?`Looking at ${X.id}.`:H.length?`Looking at the ${H.length} cases you picked.`:`Looking at ${c.summary.cases} test cases. Pick some in the list.`,context:X?[X.id,...X.plans.slice(0,1)]:H.length?U(H).slice(0,4):[],suggestions:X?[{intent:X.automation===`automated`?`run`:`automate`,label:X.automation===`automated`?`Run it and explain`:`Automate it`,icon:X.automation===`automated`?i:C,keys:[X.key]},{intent:`investigate`,label:`Why it fails`,icon:a,keys:[X.key],...[`failed`,`blocked`].includes(X.lastRun.outcome)?{}:{disabled:`Its last run did not fail`}},{intent:`tag`,label:`Suggest tags`,icon:b,keys:[X.key]}]:q,placeholder:`Ask about these cases, or say what to do`,onClose:()=>I(!1)},o??`list`),c&&ae&&r===`gaps`&&(0,Z.jsx)(Se,{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:H.length?U(H).slice(0,4):[],suggestions:ve,placeholder:`What should we close first?`,onClose:()=>I(!1)}),c&&ae&&r===`suites`&&(0,Z.jsx)(Ct,{open:ye,onSaved:e=>{O(`Saved the suite ${e.name}.`),L(),location.hash=w(`test-management`,`suites`,e.id)}})]})]})}export{Pt as TestManagement};