@capagents/forgeqe 3.1.8 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HOW_TO_USE.md +51 -4
- package/THIRD_PARTY_NOTICES.md +2 -1
- package/dist/docs-site/docs/area-operations/index.html +25 -2
- package/dist/docs-site/docs/area-quality/index.html +17 -3
- package/dist/docs-site/docs/area-setup/index.html +1 -1
- package/dist/docs-site/docs/get-started/index.html +18 -2
- package/dist/docs-site/docs/overview/index.html +1 -1
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/forgeqe.js +1972 -1930
- package/dist/template.html +12 -12
- package/dist/vendor/ibm-ace.js +2 -0
- package/dist/web/THIRD_PARTY_NOTICES.md +29 -0
- package/dist/web/assets/{3d-force-graph-OeCdKJJ-.js → 3d-force-graph-Bhmgjf_7.js} +1 -1
- package/dist/web/assets/Agent-Dx4aOB_h.js +8 -0
- package/dist/web/assets/AgentWork-D0MS10up.js +2 -0
- package/dist/web/assets/ApiTests-DUoEh0nX.js +10 -0
- package/dist/web/assets/Browse-BGgyLuL3.js +1 -0
- package/dist/web/assets/Chat-CEHUI2ty.js +3 -0
- package/dist/web/assets/{CommandPalette-zRrrp6F_.js → CommandPalette-rY8rp79k.js} +1 -1
- package/dist/web/assets/Compare-B_NCvogR.js +1 -0
- package/dist/web/assets/Cost-sm-6tWRQ.js +1 -0
- package/dist/web/assets/Data-CFyxbwPS.js +6 -0
- package/dist/web/assets/Desktop-A_D4LTis.js +1 -0
- package/dist/web/assets/DesktopReview-CM7xmpHS.js +2 -0
- package/dist/web/assets/Evidence-BlTkmzfE.js +1 -0
- package/dist/web/assets/Explore-DyGqAEff.js +2 -0
- package/dist/web/assets/Features-BjPR9gCe.js +1 -0
- package/dist/web/assets/Flags-C_DneXS9.js +2 -0
- package/dist/web/assets/Flaky-l5ugC_ER.js +1 -0
- package/dist/web/assets/Impact-7TXQHcsW.js +3 -0
- package/dist/web/assets/Jobs-xRLNI-8l.js +5 -0
- package/dist/web/assets/KindPage-BZu1Zo4S.js +6 -0
- package/dist/web/assets/Migration-DKsyDwDO.js +8 -0
- package/dist/web/assets/Observability-CVwKJ-fI.js +1 -0
- package/dist/web/assets/PageAgent-C1X5ot6v.js +1 -0
- package/dist/web/assets/Product-iHqLyIhD.js +12 -0
- package/dist/web/assets/Production-C8eGcwCi.js +1 -0
- package/dist/web/assets/Quality-BVsN6u0E.js +1 -0
- package/dist/web/assets/Readiness-BWlbiTeu.js +1 -0
- package/dist/web/assets/Record-C7qgNFqs.js +1 -0
- package/dist/web/assets/Regression-ChleHlqe.js +5 -0
- package/dist/web/assets/RelationGraph-CzR_Hs8A.js +1 -0
- package/dist/web/assets/Reports-CIcKyoHH.js +2 -0
- package/dist/web/assets/Response-D2ZeO8uW.js +9 -0
- package/dist/web/assets/Responsive-DCfw-Oz3.js +3 -0
- package/dist/web/assets/RunDiff-COaxhvKm.js +1 -0
- package/dist/web/assets/Runs-3qx2qf56.js +2 -0
- package/dist/web/assets/Settings-DG2k3Lno.js +21 -0
- package/dist/web/assets/Steps-CN4n8U1I.js +3 -0
- package/dist/web/assets/TestCases-BEfJFp5h.js +1 -0
- package/dist/web/assets/TestData-SO2qqaAF.js +2 -0
- package/dist/web/assets/TestDebt-DIYhbhjh.js +1 -0
- package/dist/web/assets/TestManagement-D7q6G3YN.js +4 -0
- package/dist/web/assets/WhatsNew-DqBLhhgk.js +1 -0
- package/dist/web/assets/{agents-C0Jg2pN8.js → agents-BUWN-VJv.js} +1 -1
- package/dist/web/assets/{coverage-BB9BLjGz.js → coverage-DCtiu73T.js} +4 -4
- package/dist/web/assets/dataParts-BdmBLsU9.js +3 -0
- package/dist/web/assets/{diff-cbn6NGtL.js → diff-DEgLgw6R.js} +1 -1
- package/dist/web/assets/families-CrnKBjis.js +1 -0
- package/dist/web/assets/{highlight--Ayfy7Gy.js → highlight-DSLpJ_Dq.js} +1 -1
- package/dist/web/assets/index-DAteDsgB.css +2 -0
- package/dist/web/assets/index-RJ1kEHuo.js +64 -0
- package/dist/web/assets/input-Be3YOEK2.js +1 -0
- package/dist/web/assets/logLevel-Dq8s6DZz.js +3 -0
- package/dist/web/assets/palette-Dcoz5crU.js +1 -0
- package/dist/web/assets/{paletteCommands-ar4wAGok.js → paletteCommands-fwv5XVOS.js} +1 -1
- package/dist/web/assets/parts-CkI14hIv.js +1 -0
- package/dist/web/assets/productParts-BOUMBM_H.js +1 -0
- package/dist/web/assets/qualityParts-8KI3JCY8.js +1 -0
- package/dist/web/assets/recordTest-kf2ykEQF.js +1 -0
- package/dist/web/assets/route-D8G-pTdk.js +1 -0
- package/dist/web/assets/stepper-CQSK6KS0.js +1 -0
- package/dist/web/index.html +7 -7
- package/docs/OBSERVABILITY.md +233 -0
- package/docs/user-guide.html +59 -6
- package/forgeqe.example.yaml +5 -1
- package/llms.example.json +1 -1
- package/package.json +2 -1
- package/prompts/browser-persona.md +1 -1
- package/py/forgeqe_desktop/handhooks.py +106 -4
- package/py/forgeqe_desktop/handrecord.py +77 -2
- package/py/forgeqe_desktop/service.py +22 -5
- package/py/forgeqe_desktop/workflow.py +47 -2
- package/py/forgeqe_engine/copilot_gateway.py +139 -5
- package/py/forgeqe_engine/copilot_models.py +186 -0
- package/py/forgeqe_engine/diagnostics.py +119 -2
- package/py/forgeqe_engine/llm.py +85 -1
- package/py/forgeqe_engine/persona.py +3 -2
- package/py/forgeqe_engine/service.py +36 -10
- package/py/forgeqe_mobile/record.py +95 -5
- package/dist/web/assets/Agent-DrdDwck4.js +0 -8
- package/dist/web/assets/AgentWork-wNaA-i2T.js +0 -2
- package/dist/web/assets/ApiTests-B3X6NIn8.js +0 -10
- package/dist/web/assets/Browse-Cd1DEgYR.js +0 -1
- package/dist/web/assets/Chat-4GknHS5Z.js +0 -3
- package/dist/web/assets/Compare-DJVhkzqO.js +0 -1
- package/dist/web/assets/Cost-CbKnuQuB.js +0 -1
- package/dist/web/assets/Data-Bt5yqqvq.js +0 -6
- package/dist/web/assets/Desktop-CPDo3Ir-.js +0 -1
- package/dist/web/assets/DesktopReview-CCaqTSu5.js +0 -1
- package/dist/web/assets/Evidence-BAuIgj1h.js +0 -1
- package/dist/web/assets/Explore-BqzEPdP7.js +0 -2
- package/dist/web/assets/Features-DFuPCW9x.js +0 -1
- package/dist/web/assets/Flags-UBakvqIq.js +0 -2
- package/dist/web/assets/Flaky-DUzdfQW4.js +0 -1
- package/dist/web/assets/Impact-jLZqUzz9.js +0 -3
- package/dist/web/assets/Jobs-De3NyY5s.js +0 -5
- package/dist/web/assets/KindPage-DWznWcLB.js +0 -6
- package/dist/web/assets/Migration-BdOq6RO6.js +0 -2
- package/dist/web/assets/PageAgent-dVvZtNoB.js +0 -1
- package/dist/web/assets/Product-ByZ8Qr3i.js +0 -12
- package/dist/web/assets/Production-D8L2TchK.js +0 -1
- package/dist/web/assets/Quality-CSZEuhZo.js +0 -1
- package/dist/web/assets/Readiness-bBu_84mx.js +0 -1
- package/dist/web/assets/Record-DWJEDj2C.js +0 -1
- package/dist/web/assets/Regression-D2VkPIhZ.js +0 -5
- package/dist/web/assets/RelationGraph-q5H4bYjq.js +0 -1
- package/dist/web/assets/Reports-dF-O5HTI.js +0 -2
- package/dist/web/assets/Response-D4JW3pwi.js +0 -9
- package/dist/web/assets/Responsive-CLX9S27s.js +0 -3
- package/dist/web/assets/RunDiff-BuL_-GwF.js +0 -1
- package/dist/web/assets/Runs-DyyaAiyA.js +0 -2
- package/dist/web/assets/Settings-DnG6_QQj.js +0 -21
- package/dist/web/assets/Steps-C-0zwG7T.js +0 -2
- package/dist/web/assets/TestCases-DXk9qsEL.js +0 -1
- package/dist/web/assets/TestData-D4al7-3Z.js +0 -2
- package/dist/web/assets/TestDebt-BzOVDuS8.js +0 -1
- package/dist/web/assets/TestManagement-T-NIlhc9.js +0 -1
- package/dist/web/assets/Tosca-D7tqMGK0.js +0 -3
- package/dist/web/assets/WhatsNew-DBViE2Qt.js +0 -1
- package/dist/web/assets/dataParts-D56_9p6T.js +0 -3
- package/dist/web/assets/families-gkpkloLT.js +0 -1
- package/dist/web/assets/filters-Culzq1j1.js +0 -1
- package/dist/web/assets/fold-UP5ihvz-.js +0 -1
- package/dist/web/assets/head-BpR3dGRT.js +0 -1
- package/dist/web/assets/index-CljX5dI4.js +0 -64
- package/dist/web/assets/index-CwAqcn-z.css +0 -2
- package/dist/web/assets/input-D7iHeNXz.js +0 -1
- package/dist/web/assets/logos-B4e5nBuL.js +0 -1
- package/dist/web/assets/palette-lUno7fso.js +0 -1
- package/dist/web/assets/parts-DbdUgAZS.js +0 -1
- package/dist/web/assets/productParts-DSrnTFn8.js +0 -1
- package/dist/web/assets/qualityParts-D_U5zhKC.js +0 -1
- package/dist/web/assets/recordTest-D9zuJ-aG.js +0 -1
- package/dist/web/assets/route-Dg53WdFu.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Hr as t,lt as n,r}from"./route-Dg53WdFu.js";import{t as i}from"./jsx-runtime-LKYXHABd.js";import{A as a,Rt as o,a as s}from"./input-D7iHeNXz.js";import{a as c,f as l,i as u,n as d,o as f}from"./filters-Culzq1j1.js";import{E as p,M as m}from"./index-CljX5dI4.js";import{C as h,b as g,f as _,g as v,l as y,x as b}from"./logos-B4e5nBuL.js";var x=e(t(),1),S=i(),C=(e,t)=>t?r(`tosca`,e,`compare`,encodeURIComponent(t)):r(`tosca`,e,`compare`),w=50,T={before:`Before`,after:`After`,block:`Reusable block`,folder:`Folder`};function E({nodes:e,status:t,pick:n,onPick:r,depth:i=0}){return(0,S.jsx)(`ul`,{className:a(`m-0 flex list-none flex-col p-0`,i>0&&`ml-4 border-l border-line-soft pl-4`),children:e.map((e,o)=>{if(e.kind===`group`)return(0,S.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,S.jsxs)(`span`,{className:`text-[13px] font-medium text-muted`,children:[T[e.role||`folder`]||`Folder`,`: `,(0,S.jsx)(`span`,{className:`text-ink-2`,children:e.name})]}),(0,S.jsx)(E,{nodes:e.body||[],status:t,pick:n,onPick:r,depth:i+1})]},`g${o}`);if(e.kind===`if`||e.kind===`loop`){let a=e.condition;return(0,S.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,S.jsxs)(`span`,{className:`text-[13px] font-medium text-muted`,children:[e.kind===`if`?`If`:`Loop`,` `,e.name,`: `,(0,S.jsx)(`code`,{className:`font-mono text-[13px] text-ink-2`,children:a?.tosca}),a?.constant!==void 0&&(0,S.jsxs)(`span`,{children:[` · always `,a.constant?`true`:`false`]})]}),[`then`,`else`,`loop`].map(a=>e[a]?.length?(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`span`,{className:`ml-4 text-[13px] text-muted`,children:a===`then`?`Then`:a===`else`?`Else`:`Each time`}),(0,S.jsx)(E,{nodes:e[a],status:t,pick:n,onPick:r,depth:i+1})]},a):null)]},`i${o}`)}let s=e.id?t.get(e.id):void 0,c=s?y[s]:void 0;return(0,S.jsx)(`li`,{children:(0,S.jsxs)(`button`,{type:`button`,"aria-pressed":n===e.id,onClick:()=>r(e),className:a(`flex w-full min-w-0 cursor-pointer items-start gap-2 rounded-[8px] border-0 px-2 py-2 text-left text-[13px]`,n===e.id?`bg-accent-soft`:`bg-transparent hover:bg-surface-muted`),children:[(0,S.jsx)(`span`,{role:`img`,"aria-label":c?.label||`Not converted yet`,"data-tip":c?.label||`Not converted yet`,className:a(`mt-2 size-2 flex-none rounded-full`,c?.dot||`bg-line`)}),(0,S.jsx)(`span`,{className:`w-9 flex-none font-mono text-[13px] text-muted`,children:e.id}),(0,S.jsxs)(`span`,{className:a(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`unsupported`?`text-warn`:`text-ink`),children:[h(e),e.tosca?.step&&(0,S.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[`Tosca step "`,e.tosca.step,`"`]})]})]})},e.id||o)})})}function D(e,t){for(let n of e){if(n.id===t)return n;for(let e of[`body`,`then`,`else`,`loop`]){let r=n[e]&&D(n[e],t);if(r)return r}}}function O({view:e,pick:t,engine:n}){let r=e.target,i=r?.text||``,o=i.split(`
|
|
2
|
-
`),c=m(i||null,r?.lang||`plaintext`),l=(0,x.useMemo)(()=>{if(!t)return new Set;let e=RegExp(`tosca:[\\sn\\d,]*\\b${t}\\b`,`i`);return new Set(o.flatMap((t,n)=>e.test(t)?[n]:[]))},[t,i]),u=(0,x.useRef)(null);(0,x.useEffect)(()=>{u.current?.scrollIntoView({block:`center`,behavior:s()})},[t,l.size]);let d=Math.min(...l);return(0,S.jsxs)(`figure`,{className:`pane-swap m-0 flex min-h-0 min-w-0 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,S.jsxs)(`figcaption`,{className:`flex min-h-10 items-center gap-2 border-b border-line-soft pr-1 pl-4`,children:[(0,S.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[0.04em] text-muted uppercase`,children:n?b({kind:`test`,engine:n}):`Converted test`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[13px] text-ink-2`,"data-tip":r?.path,children:r?.path||``}),i&&(0,S.jsx)(p,{text:i,label:`Copy ${r?.path||`the test`}`})]}),i?(0,S.jsxs)(`div`,{className:`flex min-h-[260px] flex-1 overflow-auto font-mono text-[13px] leading-[1.6]`,children:[(0,S.jsx)(`pre`,{"aria-hidden":`true`,className:`m-0 min-h-full flex-none self-stretch border-r border-line-soft py-4 text-right text-muted select-none`,children:o.map((e,t)=>(0,S.jsx)(`span`,{ref:t===d?u:void 0,className:a(`block px-4`,l.has(t)&&`bg-accent-soft font-semibold text-accent-fg`),children:t+1},t))}),(0,S.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 px-4 py-4`,children:(0,S.jsx)(`code`,{className:`hljs`,children:c})})]}):(0,S.jsx)(`p`,{className:`m-0 flex min-h-[260px] flex-1 items-center justify-center px-4 text-center text-sm text-muted`,children:r?`Not written yet.`:`This test case is left out of the plan.`}),t&&i&&(0,S.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft px-4 py-2 text-[13px] text-muted`,children:l.size?`${t} is done on line ${[...l].map(e=>e+1).join(`, `)}.`:`No line of the test is marked ${t}.`})]})}function k({view:e,node:t}){if(!t?.target)return null;let[n,r]=t.target.split(`.`),i=e.pages.find(e=>e.id===n),a=i?.elements.find(e=>e.id===r);return a?(0,S.jsxs)(`section`,{"aria-label":`Locators Tosca recorded`,className:`flex flex-col gap-2 rounded-[12px] card border px-4 py-4 text-[13px]`,children:[(0,S.jsxs)(`span`,{className:`font-medium`,children:[a.name,` `,(0,S.jsxs)(`span`,{className:`font-normal text-muted`,children:[`on `,i?.name,a.scope?.length?`, inside ${a.scope.join(` › `)}`:``,a.nth===void 0?``:`, number ${a.nth+1}`]})]}),a.locators.length?(0,S.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.locators.slice(0,6).map((e,t)=>(0,S.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`w-14 flex-none text-[13px] text-muted`,children:e.strategy}),(0,S.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.strategy===`role`?`${e.role} "${e.name}"`:e.attr?`[${e.attr}="${e.value}"]`:e.value}),e.fragile&&(0,S.jsx)(c,{tone:`warn`,children:`Fragile`})]},t))}):(0,S.jsx)(`span`,{className:`text-muted`,children:`Tosca recorded no locator for it.`})]}):null}function A({id:e,plan:t,result:r,initial:i,full:s,onPick:c}){let p=t.cases.filter(e=>e.included),[m,h]=(0,x.useState)(``),[y,b]=(0,x.useState)(i||p[0]?.id||``),[T,A]=(0,x.useState)(null),[j,M]=(0,x.useState)(``),[N,P]=(0,x.useState)(``);(0,x.useEffect)(()=>{y&&(P(``),o.case(e,y).then(A,e=>P(e.message)))},[e,y,r?.units.length,r?.status]),(0,x.useEffect)(()=>{M(``),y&&c?.(y)},[y]);let F=new Map((T?.fidelity||[]).map(e=>[e.id,e.status])),I=p.filter(e=>!m||e.name.toLowerCase().includes(m.toLowerCase())),[L,R]=(0,x.useState)(0);(0,x.useEffect)(()=>R(0),[m]),(0,x.useEffect)(()=>{let e=I.findIndex(e=>e.id===y);e>=0&&Math.floor(e/w)!==L&&R(Math.floor(e/w))},[y]);let z=I.slice(L*w,L*w+w),B=e=>r?.units.find(t=>t.kind===`test`&&t.case===e);if(!p.length)return(0,S.jsx)(f,{center:!0,className:`py-6`,children:`No test case of this plan is converted.`});let V=(0,S.jsxs)(`div`,{className:a(`grid grid-cols-[minmax(0,1fr)] gap-4 @5xl:grid-cols-[220px_minmax(0,1fr)_minmax(0,1fr)]`,s?`@5xl:min-h-0 @5xl:flex-1`:`@5xl:h-[calc(var(--screen)-368px)] @5xl:min-h-[540px]`),children:[(0,S.jsxs)(`nav`,{"aria-label":`Test cases`,className:`flex max-h-[320px] min-h-0 min-w-0 flex-col gap-2 overflow-hidden rounded-[14px] card border p-4 @5xl:max-h-none`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-1 px-1`,children:[(0,S.jsx)(`span`,{className:`text-sm font-semibold`,children:`Test cases`}),(0,S.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[p.filter(e=>B(e.id)?.status===`converted`).length,` converted · `,p.some(e=>B(e.id)?.status===`written`)?`${p.filter(e=>B(e.id)?.status===`written`).length} written · `:``,p.filter(e=>[`failed`,`blocked`].includes(B(e.id)?.status||``)).length,` failed · `,g(p.length,`test case`)]})]}),(0,S.jsx)(u,{id:`find-a-case`,label:`Find a test case`,value:m,onChange:h,className:`max-w-none flex-none`}),(0,S.jsxs)(`ul`,{className:`m-0 flex min-h-0 flex-1 list-none flex-col gap-1 overflow-y-auto p-0`,children:[z.map(e=>{let t=B(e.id);return(0,S.jsx)(`li`,{children:(0,S.jsxs)(`button`,{type:`button`,"aria-pressed":y===e.id,onClick:()=>b(e.id),className:a(`flex w-full cursor-pointer items-start gap-2 rounded-[8px] border-0 px-2 py-2 text-left text-[13px]`,y===e.id?`bg-accent-soft text-ink`:`bg-transparent text-ink-2 hover:bg-surface-muted`),children:[(0,S.jsx)(`span`,{role:`img`,"aria-label":t?v[t.status].label:`Waiting`,className:a(`mt-2 size-2 flex-none rounded-full`,t?.status===`converted`?`bg-pass`:t?.status===`failed`?`bg-fail`:t?.status===`blocked`?`bg-warn`:`bg-line`)}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.name,(0,S.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[g(e.steps,`step`),` · `,g(e.asserts,`check`),t?.fidelity?` · ${t.fidelity.matched}/${t.fidelity.required} in the test`:``]})]})]})},e.id)}),!z.length&&(0,S.jsx)(`li`,{className:`px-2 py-4 text-[13px] text-muted`,children:`No test case matches.`})]}),I.length>w&&(0,S.jsx)(d,{page:L,size:w,total:I.length,onPage:R,label:`Test case pages`})]}),(0,S.jsxs)(`section`,{"aria-label":`Tosca steps`,className:`flex min-h-[360px] min-w-0 flex-col gap-4 overflow-hidden`,children:[N&&(0,S.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:N}),(0,S.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,S.jsxs)(`header`,{className:`flex min-h-10 flex-wrap items-center gap-2 border-b border-line-soft px-4 py-2`,children:[(0,S.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[0.04em] text-muted uppercase`,children:`Tosca steps`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:T?.name}),T&&t.cases.find(e=>e.id===y)&&(0,S.jsx)(`span`,{className:`text-[13px] text-muted`,children:_[t.cases.find(e=>e.id===y).route]||``})]}),(0,S.jsx)(`div`,{className:`pane-swap min-h-0 flex-1 overflow-y-auto px-2 py-2`,children:T?(0,S.jsx)(E,{nodes:T.body,status:F,pick:j,onPick:e=>M(e.id||``)}):N?(0,S.jsx)(`p`,{className:`m-0 px-2 text-sm text-muted`,children:`Nothing to show.`}):(0,S.jsx)(`p`,{role:`status`,className:`m-0 px-2 text-sm text-muted`,children:`Loading…`})},T?.case||``),T&&(T.env.length>0||T.warnings.length>0)&&(0,S.jsxs)(`footer`,{className:`flex flex-col gap-1 border-t border-line-soft px-4 py-2 text-[13px] text-ink-2`,children:[T.env.length>0&&(0,S.jsxs)(`span`,{children:[`Environment variables: `,T.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),`.`]}),T.warnings.slice(0,3).map(e=>(0,S.jsx)(`span`,{className:`text-warn`,children:e},e))]})]}),T&&(0,S.jsx)(k,{view:T,node:D(T.body,j)})]}),T?(0,S.jsx)(O,{view:T,pick:j,engine:t.units.find(e=>e.kind===`test`&&e.case===T.case)?.engine},T.case):(0,S.jsx)(`p`,{className:`m-0 flex min-h-[260px] items-center justify-center rounded-[12px] card border px-4 text-center text-sm text-muted`,children:N?`Nothing to show.`:`Loading…`})]});return s?V:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`flex justify-end`,children:(0,S.jsxs)(`a`,{href:C(e,y),target:`_blank`,rel:`noopener noreferrer`,"data-tip":`Tosca steps beside the converted test, in a tab of their own`,className:l({variant:`ghost`,size:`sm`}),children:[(0,S.jsx)(n,{"aria-hidden":`true`}),`Open in a new tab`]})}),V]})}export{C as n,A as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Hr as t,Ht as n,O as r,Rr as i,U as a,lt as o,n as s,on as c,r as l,sn as u,u as d,ut as f,wr as p}from"./route-Dg53WdFu.js";import{t as m}from"./jsx-runtime-LKYXHABd.js";import{A as h,It as g,W as _,t as v}from"./input-D7iHeNXz.js";import{d as y,l as b,o as x,t as S}from"./filters-Culzq1j1.js";import{L as C}from"./palette-lUno7fso.js";import{Dn as w,Ft as T,H as E,K as D,Lt as O,Pt as k,U as A,g as j,j as M,u as N,zt as P}from"./index-CljX5dI4.js";var F=e(t(),1),I=m(),L=[{id:`azure_devops`,label:`Azure DevOps`},{id:`jira`,label:`Jira`},{id:`testrail`,label:`TestRail`},{id:`zephyr`,label:`Zephyr Scale`},{id:`qtest`,label:`qTest`}],R=e=>L.some(t=>t.id===e),z=e=>e&&M(e)===`web`?e:void 0,B=(e,t)=>`${e} ${t}${e===1?``:`s`}`,V=e=>`${e.kind}:${e.id}`;function H(e){return e.found===`reuse`||e.kind===`link`?`Link`:e.found===`extends`||e.kind===`extend`?`Add ${B((e.insert??[]).reduce((e,t)=>e+t.steps.length,0),`step`)}`:`Update steps`}function U(e,t){let n=`Story ${t} asks for it: ${e.wrote}`,r=e.link?{link:!0}:{};return e.kind===`link`?{kind:`link`,id:e.id}:e.kind===`extend`?{kind:`extend`,id:e.id,insert:e.insert??[],reason:n,...r}:{kind:`update`,id:e.id,steps:e.steps??[],reason:n,...r}}function W(){let[e,t]=(0,F.useState)(L.map(e=>e.id)),[n,r]=(0,F.useState)(``);return(0,F.useEffect)(()=>{_.settings().then(e=>{let n=e.config.sources??{},r=L.map(e=>e.id).filter(e=>n[e]&&typeof n[e]==`object`);r.length&&t(r)},e=>r(`The settings could not be read, so every system is offered: ${e.message}`))},[]),{systems:L.filter(t=>e.includes(t.id)),error:n}}function G({id:e,icon:t,title:n,children:r}){return(0,I.jsxs)(`section`,{"aria-labelledby":e,className:`flex min-w-0 flex-col gap-4`,children:[(0,I.jsxs)(`h2`,{id:e,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,I.jsx)(b,{icon:t,size:18,className:`text-accent-fg`}),n]}),r]})}function K({view:e,onApplied:t,onError:s}){let[l,d]=(0,F.useState)([]),[m,_]=(0,F.useState)(null),[v,b]=(0,F.useState)(!1),[x,S]=(0,F.useState)(null),C=e.story.id,w=e.proposals.filter(e=>l.includes(V(e))),E=async()=>{let t=w.map(e=>U(e,C));b(!0);try{let n=await g.preview(e.system,C,t);_({lines:n.lines,changes:t}),s(``)}catch(e){s(e.message)}finally{b(!1)}},D=async()=>{if(m){b(!0);try{let n=await g.apply(e.system,C,m.changes);S({applied:n.applied,failed:n.failed}),_(null),d([]),s(``),t()}catch(e){s(e.message)}finally{b(!1)}}},A=z(e.story.url);return(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,I.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-lg font-semibold [overflow-wrap:anywhere]`,children:[A?(0,I.jsxs)(`a`,{href:A,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[C,(0,I.jsx)(o,{size:14,"aria-hidden":`true`})]}):(0,I.jsx)(`span`,{children:C}),e.story.title&&(0,I.jsx)(`span`,{className:`font-normal text-ink-2`,children:e.story.title})]}),e.changed&&(0,I.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,"data-tip":new Date(e.changed.when).toLocaleString(),children:[`The story's `,e.changed.field,` changed `,j(e.changed.when),`.`]})]}),(0,I.jsx)(G,{id:`cases-h`,icon:c,title:`Linked cases`,children:(0,I.jsx)(k,{label:`Linked cases`,empty:`No test case is linked to this story.`,head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`th`,{scope:`col`,className:O,children:`Case`}),(0,I.jsx)(`th`,{scope:`col`,className:O,children:`Title`}),(0,I.jsx)(`th`,{scope:`col`,className:h(O,`text-right`),children:`Steps`}),(0,I.jsx)(`th`,{scope:`col`,className:O,children:`State`})]}),children:e.cases.map(e=>{let t=z(e.url);return(0,I.jsxs)(`tr`,{className:P,children:[(0,I.jsx)(`td`,{className:h(T,`whitespace-nowrap`),children:t?(0,I.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[e.id,(0,I.jsx)(o,{size:12,"aria-hidden":`true`})]}):e.id}),(0,I.jsx)(`td`,{className:h(T,`[overflow-wrap:anywhere]`),children:e.title}),(0,I.jsx)(`td`,{className:h(T,`text-right tabular-nums`),children:e.steps}),(0,I.jsx)(`td`,{className:h(T,e.stale?`text-warn`:`text-muted`),children:e.stale?(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,I.jsx)(p,{size:13,"aria-hidden":`true`,className:`flex-none`}),`older than the story's last change`]}):e.changed?(0,I.jsxs)(`span`,{"data-tip":new Date(e.changed).toLocaleString(),children:[`changed `,j(e.changed)]}):`–`})]},e.id)})})}),(0,I.jsx)(G,{id:`criteria-h`,icon:a,title:`Acceptance criteria`,children:(0,I.jsx)(k,{label:`Acceptance criteria`,empty:`No acceptance criteria were read for this story.`,head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`th`,{scope:`col`,className:O,children:`Criterion`}),(0,I.jsx)(`th`,{scope:`col`,className:O,children:`Cases`})]}),children:e.criteria.map((e,t)=>(0,I.jsxs)(`tr`,{className:P,children:[(0,I.jsx)(`td`,{className:h(T,`[overflow-wrap:anywhere]`),children:e.text}),(0,I.jsx)(`td`,{className:h(T,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,I.jsxs)(G,{id:`proposals-h`,icon:u,title:`Proposed changes`,children:[(0,I.jsx)(k,{label:`Proposed changes`,empty:`No change is waiting. save_test_cases in a chat proposes them.`,tools:(0,I.jsxs)(y,{size:`sm`,variant:`primary`,disabled:v||!w.length||!!m,"data-tip":`Review ${B(w.length,`change`)}`,onClick:()=>void E(),children:[(0,I.jsx)(f,{"aria-hidden":`true`}),`Review (`,w.length,`)`]}),head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`th`,{scope:`col`,className:h(O,`w-10`),children:(0,I.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,I.jsx)(`th`,{scope:`col`,className:O,children:`Change`}),(0,I.jsx)(`th`,{scope:`col`,className:O,children:`Existing case`}),(0,I.jsx)(`th`,{scope:`col`,className:O,children:`The agent wrote`})]}),children:e.proposals.map(e=>{let t=V(e);return(0,I.jsxs)(`tr`,{className:P,children:[(0,I.jsx)(`td`,{className:T,children:(0,I.jsx)(N,{"aria-label":`${H(e)}: ${e.id} ${e.title}`,checked:l.includes(t),disabled:v||!!m,onCheckedChange:e=>d(e?[...l,t]:l.filter(e=>e!==t))})}),(0,I.jsxs)(`td`,{className:h(T,`whitespace-nowrap font-medium`),children:[H(e),e.link&&e.kind!==`link`&&(0,I.jsx)(`span`,{className:`block text-[13px] font-normal text-muted`,children:`and link it`})]}),(0,I.jsxs)(`td`,{className:h(T,`[overflow-wrap:anywhere]`),children:[(0,I.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2`,children:e.id}),` `,e.title]}),(0,I.jsx)(`td`,{className:h(T,`text-ink-2 [overflow-wrap:anywhere]`),children:e.wrote})]},t)})}),m&&(0,I.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Apply the changes`,className:`flex flex-col gap-2 rounded-[10px] border border-accent-line bg-accent-soft p-4 text-[13px]`,children:[(0,I.jsxs)(`span`,{className:`font-medium`,children:[`Apply `,B(m.changes.length,`change`),` to `,L.find(t=>t.id===e.system)?.label,`?`]}),(0,I.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:m.lines.map((e,t)=>(0,I.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsxs)(y,{size:`sm`,variant:`primary`,disabled:v,onClick:()=>void D(),children:[(0,I.jsx)(r,{"aria-hidden":`true`}),`Apply`]}),(0,I.jsxs)(y,{size:`sm`,disabled:v,onClick:()=>_(null),children:[(0,I.jsx)(i,{"aria-hidden":`true`}),`Cancel`]})]})]}),x&&x.applied.length>0&&(0,I.jsxs)(`p`,{role:`status`,className:`m-0 text-[13px] text-pass`,children:[`Applied: `,x.applied.join(`, `)]}),x&&x.failed.length>0&&(0,I.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Not applied: `,x.failed.map(e=>`${e.id||`a change`}: ${e.error}`).join(`; `)]})]}),(0,I.jsx)(G,{id:`changes-h`,icon:n,title:`Recent changes`,children:e.changes.length?(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:e.changes.map((e,t)=>(0,I.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}):(0,I.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`ForgeQE has not changed this story's cases.`})}),e.notes.map((e,t)=>(0,I.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e},t))]})}function q({sub:e}){let{systems:t,error:n}=W(),r=e?e.indexOf(`/`):-1,i=r>0?e.slice(0,r):e,a=R(i)?i:void 0,o=a&&r>0?s(e.slice(r+1)):``,[u,f]=(0,F.useState)(a??`azure_devops`),[p,m]=(0,F.useState)(o),[_,b]=(0,F.useState)(null),[T,O]=(0,F.useState)(``),[k,j]=(0,F.useState)(!1);(0,F.useEffect)(()=>{a&&f(a),m(o)},[a,o]),(0,F.useEffect)(()=>{!a&&t.length&&!t.some(e=>e.id===u)&&f(t[0].id)},[t,u,a]);let M=(0,F.useCallback)(()=>{!a||!o?b(null):(j(!0),g.view(a,o).then(e=>{b(e),O(``),j(!1)},e=>{O(e.message),j(!1)}))},[a,o]);return(0,F.useEffect)(()=>b(null),[a,o]),(0,F.useEffect)(M,[M]),(0,I.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,I.jsx)(D,{}),(0,I.jsxs)(`main`,{className:h(A,`@container flex-auto gap-4`),children:[(0,I.jsx)(E,{}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,I.jsx)(w,{pixel:C[`test-cases`],size:`lg`}),(0,I.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test cases`})]}),(0,I.jsxs)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:[`A story's test cases in your test management system: which are older than the story's last change, which acceptance criteria no case covers, and the changes save_test_cases proposed. Tick the ones to make; nothing is written until you review and apply them. The tests that run them are on `,(0,I.jsx)(`a`,{href:l(`regression`),children:`Regression`}),`; their results on `,(0,I.jsx)(`a`,{href:l(`runs`),children:`Runs`}),`.`]}),(0,I.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=p.trim();if(!t)return;let n=l(`test-cases`,u,encodeURIComponent(t));location.hash===n?M():location.hash=n},className:`flex flex-col gap-4`,children:[(0,I.jsx)(`div`,{role:`group`,"aria-label":`System`,className:`flex flex-wrap gap-2`,children:(0,I.jsx)(S,{items:t,value:u,onChange:f})}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,I.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_320px] flex-col gap-1 text-[13px] font-medium`,children:[`Story`,(0,I.jsx)(v,{value:p,maxLength:120,spellCheck:!1,placeholder:u===`azure_devops`?`1234`:u===`qtest`?`5678`:u===`testrail`?`R12`:`SHOP-12`,onChange:e=>m(e.target.value)})]}),(0,I.jsxs)(y,{type:`submit`,variant:`primary`,disabled:!p.trim()||k,"data-tip":`Open the story's test cases`,children:[(0,I.jsx)(d,{"aria-hidden":`true`}),`Open`]})]})]}),[n,T].filter(Boolean).map(e=>(0,I.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e},e)),k&&(0,I.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),_&&(0,I.jsx)(K,{view:_,onApplied:M,onError:O},`${_.system}:${_.story.id}`),!o&&!_&&(0,I.jsx)(x,{icon:c,title:`No story opened yet`,children:`Pick the system and type a story's id to see its linked test cases, its acceptance criteria and which cases trace to them. When save_test_cases runs in a chat for a story, the changes it proposes to existing cases show here to apply.`})]})]})}export{q as TestCases};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{A as t,Bn as n,Hr as r,M as i,O as a,Rr as o,Tt as s,gn as c,or as l,ot as u,r as d,rt as f,ut as p,xr as m}from"./route-Dg53WdFu.js";import{t as h}from"./jsx-runtime-LKYXHABd.js";import{A as g,Z as _,j as v,n as y,t as b,tt as x}from"./input-D7iHeNXz.js";import{a as S,d as C,f as w,l as T,o as E,t as D}from"./filters-Culzq1j1.js";import{L as O}from"./palette-lUno7fso.js";import{Bt as k,Dn as A,Ft as j,It as M,K as N,Lt as P,Pt as ee,Rt as F,U as I,V as L,Wt as R,g as z}from"./index-CljX5dI4.js";import{a as te,c as B,f as ne,i as V,n as H,o as U,r as W,s as G,t as K,u as q}from"./dataParts-D56_9p6T.js";var J=e(r(),1),Y=h(),X=[`requests`,`kept`,`specs`,`batches`],Z={fetch:`kept`,request:`requests`,gen:`specs`,files:`specs`,insert:`specs`,batches:`batches`,clean:`batches`},Q=e=>Object.values(e.row_counts||{}).reduce((e,t)=>e+t,0);function re({e,kept:t,busy:r,act:i}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 px-1 py-2`,children:[(0,Y.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-[13px]`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:`Asked for`}),(0,Y.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:e.need}),(0,Y.jsx)(`dt`,{className:`text-muted`,children:`When`}),(0,Y.jsxs)(`dd`,{className:`m-0`,children:[new Date(e.at).toLocaleString(),e.ms===void 0?``:` · answered in ${(e.ms/1e3).toFixed(1)} s`]}),(0,Y.jsx)(`dt`,{className:`text-muted`,children:`How`}),(0,Y.jsxs)(`dd`,{className:`m-0`,children:[e.source===`fetch`?`A kept request fetched again, with no model`:`Asked Miner for ${e.asked===`existing`?`existing rows`:e.asked===`new`?`new rows`:`either`}`,e.name?(0,Y.jsxs)(Y.Fragment,{children:[` · `,(0,Y.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.name})]}):null]}),e.why&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:`The answer`}),(0,Y.jsx)(`dd`,{className:`m-0`,children:e.why})]})]}),e.error&&(0,Y.jsx)(B,{text:e.error}),Object.entries(e.sample||{}).map(([t,n])=>(0,Y.jsx)(q,{title:t===`result`?`Rows found`:t,rows:n,total:e.row_counts?.[t]??n.length},t)),e.sql&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:`The query`}),(0,Y.jsx)(H,{label:`SQL`,children:e.sql})]}),e.script_preview?.length?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:`INSERT script`}),(0,Y.jsx)(H,{label:`INSERT script`,children:e.script_preview.join(`
|
|
2
|
-
`)})]}):null,t&&e.name&&(0,Y.jsx)(`div`,{children:(0,Y.jsxs)(C,{size:`sm`,disabled:r,onClick:()=>i(`fetch`,{name:e.name}),"data-tip":`Fetch again`,children:[(0,Y.jsx)(n,{"aria-hidden":`true`}),`Refresh`]})})]})}function $({view:e,log:n,busy:r,act:a}){let[o,l]=(0,J.useState)(`all`),[u,f]=(0,J.useState)(``),[p,m]=(0,J.useState)(``),[h,_]=(0,J.useState)(``),v=n??[],b=(0,J.useMemo)(()=>[...new Set(v.map(e=>e.requester))].sort(),[n]),x=(0,J.useMemo)(()=>[...new Set(v.map(e=>e.database).filter(Boolean))].sort(),[n]),C=v.filter(e=>!e.ok).length,T=v.filter(e=>(o===`all`||o===`ok`===e.ok)&&(!u||e.requester===u)&&(!p||e.database===p)),O=new Set(e.requests.map(e=>e.name));return n===null?(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading the requests…`}):v.length?(0,Y.jsx)(ee,{label:`Requests`,resetKey:`${o}|${u}|${p}`,minWidth:760,fixed:!0,placeholder:`Find a request`,tools:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(D,{value:o,onChange:l,items:[{id:`all`,label:`All`,n:v.length},{id:`ok`,label:`Answered`,n:v.length-C},{id:`failed`,label:`Failed`,n:C,alert:!0}]}),b.length>1&&(0,Y.jsxs)(y,{size:`sm`,"aria-label":`Who asked`,value:u,onChange:e=>f(e.target.value),className:`w-[180px]`,children:[(0,Y.jsx)(`option`,{value:``,children:`Anyone`}),b.map(e=>(0,Y.jsx)(`option`,{children:e},e))]}),x.length>1&&(0,Y.jsxs)(y,{size:`sm`,"aria-label":`Database`,value:p,onChange:e=>m(e.target.value),className:`w-[160px]`,children:[(0,Y.jsx)(`option`,{value:``,children:`Any database`}),x.map(e=>(0,Y.jsx)(`option`,{children:e},e))]})]}),head:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`th`,{scope:`col`,className:g(P,`w-9`),children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Open`})}),(0,Y.jsx)(`th`,{scope:`col`,className:g(P,`w-[110px]`),children:`When`}),(0,Y.jsx)(`th`,{scope:`col`,className:g(P,`w-[150px]`),children:`Who asked`}),(0,Y.jsx)(`th`,{scope:`col`,className:P,children:`What for`}),(0,Y.jsx)(`th`,{scope:`col`,className:g(P,`w-[110px]`),children:`Database`}),(0,Y.jsx)(`th`,{scope:`col`,className:g(P,`w-[140px]`),children:`Answer`}),(0,Y.jsx)(`th`,{scope:`col`,className:g(F,`w-[70px]`),children:`Rows`})]}),empty:`No requests match these filters. Pick All and Anyone to see every request.`,children:T.map(e=>{let n=h===e.id;return(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsxs)(`tr`,{className:g(k,n&&`bg-surface-muted`),onClick:()=>_(n?``:e.id),children:[(0,Y.jsx)(`td`,{className:g(j,`pr-0`),children:(0,Y.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-label":n?`Close the request`:`Open the request`,onClick:t=>(t.stopPropagation(),_(n?``:e.id)),className:`flex cursor-pointer items-center border-0 bg-transparent p-0 text-muted`,children:n?(0,Y.jsx)(t,{size:16,"aria-hidden":`true`}):(0,Y.jsx)(i,{size:16,"aria-hidden":`true`})})}),(0,Y.jsx)(`td`,{className:g(j,`whitespace-nowrap text-muted`),"data-tip":new Date(e.at).toLocaleString(),children:z(e.at)}),(0,Y.jsx)(`td`,{className:g(j,`truncate`),"data-tip":e.requester,children:e.requester}),(0,Y.jsxs)(`td`,{className:g(j,`truncate`),"data-tip":e.need,children:[e.need,e.source===`fetch`?(0,Y.jsx)(`span`,{className:`text-muted`,children:` · fetched again`}):null]}),(0,Y.jsx)(`td`,{className:g(j,`truncate`),"data-tip":e.database,children:e.database||(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:g(j,`whitespace-nowrap`),children:(0,Y.jsx)(S,{tone:e.ok?`pass`:`fail`,children:e.ok?U[e.kind||``]||`Answered`:`Failed`})}),(0,Y.jsx)(`td`,{className:M,children:e.ok?Q(e):``})]}),n&&(0,Y.jsx)(`tr`,{className:`border-t border-line-soft bg-surface-muted/40`,children:(0,Y.jsx)(`td`,{colSpan:7,className:g(`px-4 py-2`,`max-w-0`),children:(0,Y.jsx)(re,{e,kept:!!e.name&&O.has(e.name),busy:r,act:a})})})]},e.id)})}):(0,Y.jsx)(E,{icon:s,title:`No test data asked for yet`,action:(0,Y.jsxs)(`a`,{href:d(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:g(w({size:`sm`}),`no-underline`),children:[(0,Y.jsx)(c,{"aria-hidden":`true`}),`Ask`]}),children:`The agents ask before a test runs, or you can ask yourself.`})}function ie({view:e,job:t,busy:r,act:i,onNote:a}){let o=t&&!t.running&&t.kind===`fetch`?t:null,s=o?.result;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Each request is kept in test-data/requests with its query or INSERT script. Fetch one again to get the same data with no model: a query reads the rows there now, a spec makes the same rows.`}),o&&(0,Y.jsxs)(`section`,{"aria-label":`Fetched ${o.target}`,className:`flex flex-col gap-4 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`h2`,{className:`m-0 text-base font-semibold [overflow-wrap:anywhere]`,children:o.target}),s&&!s.ok&&(0,Y.jsx)(B,{text:s.error||`It could not fetch the data.`}),s?.ok&&(0,Y.jsx)(K,{r:s,onNote:a})]}),e.requests.length===0?(0,Y.jsxs)(E,{className:`py-4`,children:[`No kept requests yet. Each request Miner answers is kept here; `,(0,Y.jsx)(`a`,{href:d(`data`,`ask`,`test-data`),children:`ask for test data`}),` to make the first.`]}):(0,Y.jsx)(G,{items:e.requests,text:e=>`${e.need} ${e.name} ${e.database} ${e.requester||``}`,label:`Kept requests`,size:15,children:e=>(0,Y.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-4 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium [overflow-wrap:anywhere]`,children:e.need}),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` · `,e.database,` · `,U[e.kind],e.rows?` · ${v(e.rows,`row`)}`:``,e.created?` · ${z(e.created)}`:``,e.requester?` · asked by ${e.requester}`:``]})]}),(0,Y.jsx)(C,{size:`icon`,variant:`icon`,disabled:r,onClick:()=>i(`fetch`,{name:e.name}),"aria-label":`Fetch ${e.name} again`,"data-tip":`Fetch ${e.name} again`,className:`size-8`,children:(0,Y.jsx)(n,{"aria-hidden":`true`})})]},e.name)})]})}function ae({view:e,job:t,busy:n,act:r,onNote:i}){let[a,l]=(0,J.useState)(e.specs[0]??``),[m,h]=(0,J.useState)(``),[g,v]=(0,J.useState)(``),[x,S]=(0,J.useState)(`csv`),[w,D]=(0,J.useState)(!1),O={spec:a,...m?{db:m}:{},...g?{seed:g}:{}},k=t&&!t.running?t:null,A=k&&[`gen`,`files`,`insert`].includes(k.kind)&&k.target===a?k.result:void 0,j=e.databases.find(e=>e.name===m),M=async()=>{try{let{id:e}=await _.start(`Write a test data spec for this project (a YAML file with tables: under test-data/), from the database's schema. Show me the spec and a preview before you save it.`,{});location.hash=d(`chats`,e)}catch(e){i(e.message)}};return(0,Y.jsxs)(`section`,{"aria-labelledby":`spec-h`,className:`flex flex-col gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Y.jsxs)(`h2`,{id:`spec-h`,className:`m-0 flex flex-1 items-center gap-2 text-lg font-semibold`,children:[(0,Y.jsx)(T,{icon:s,size:18,className:`text-accent-fg`}),`Make test data from a spec`]}),(0,Y.jsxs)(C,{variant:`ghost`,onClick:()=>void M(),"data-tip":`Write a spec in a chat`,children:[(0,Y.jsx)(c,{"aria-hidden":`true`}),`Chat`]})]}),(0,Y.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`A spec is a YAML file with tables: and what goes in each column. The same spec and seed make the same data again, so a test or a pipeline can rely on it. No model is used.`}),e.specs.length===0?(0,Y.jsx)(E,{className:`py-4`,children:`No specs in this project yet: a YAML file with tables: in test-data/, data/ or specs/. Write one in a chat, from a database's schema.`}):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-[14px] card border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,Y.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_260px] flex-col gap-2 text-sm font-medium`,children:[`Spec`,(0,Y.jsx)(y,{value:a,onChange:e=>l(e.target.value),children:e.specs.map(e=>(0,Y.jsx)(`option`,{children:e},e))})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-2 text-sm font-medium`,children:[`Database`,(0,Y.jsxs)(y,{value:m,onChange:e=>h(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`The spec's own`}),e.databases.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,e.writable?``:` (read only)`]},e.name))]})]}),(0,Y.jsxs)(`label`,{className:`flex w-[120px] flex-col gap-2 text-sm font-medium`,children:[`Seed`,(0,Y.jsx)(b,{value:g,inputMode:`numeric`,placeholder:`Random`,onChange:e=>v(e.target.value.replace(/\D/g,``).slice(0,9))})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(C,{variant:w?void 0:`primary`,disabled:n||!a,onClick:()=>r(`gen`,O),children:[(0,Y.jsx)(p,{"aria-hidden":`true`}),`Preview`]}),(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsxs)(C,{disabled:n||!a,onClick:()=>r(`gen`,{...O,mode:`files`,format:x}),"data-tip":`Write files (${x})`,children:[(0,Y.jsx)(u,{"aria-hidden":`true`}),`Export`]}),(0,Y.jsx)(y,{"aria-label":`File format`,value:x,onChange:e=>S(e.target.value),className:`w-[88px]`,children:[`csv`,`json`,`sql`].map(e=>(0,Y.jsx)(`option`,{children:e},e))})]}),(0,Y.jsxs)(C,{disabled:n||!a||!j?.writable,"data-tip":j?.writable?`Insert into ${j.name}`:`Pick a writable database to insert into`,onClick:()=>D(!0),children:[(0,Y.jsx)(f,{"aria-hidden":`true`}),`Insert`]})]}),w&&j&&(0,Y.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Insert test data`,className:`flex flex-col gap-4 rounded-[12px] border border-warn bg-warn-soft p-4`,children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[`Insert the rows of `,a,` into `,j.name,`?`]}),(0,Y.jsx)(`span`,{className:`text-sm text-ink-2`,children:`They go in as one batch, which you can remove again under Batches. Only on a test database.`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(C,{variant:`primary`,onClick:()=>{D(!1),r(`gen`,{...O,mode:`insert`,confirmed:!0})},children:[(0,Y.jsx)(f,{"aria-hidden":`true`}),`Insert`]}),(0,Y.jsxs)(C,{onClick:()=>D(!1),"data-tip":`Don't insert`,children:[(0,Y.jsx)(o,{"aria-hidden":`true`}),`Cancel`]})]})]}),A&&!A.ok&&(0,Y.jsx)(B,{text:A.error||`It did not make the data.`}),A?.ok&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[A.batch&&(0,Y.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-4 py-2 text-sm text-pass`,children:[`Inserted as batch `,(0,Y.jsx)(`span`,{className:`font-mono text-[13px]`,children:A.batch}),`.`]}),A.files?.length?(0,Y.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[`Wrote`,A.files.map(e=>(0,Y.jsx)(W,{file:e,onNote:i},e))]}):null,(0,Y.jsx)(V,{r:A})]})]})]})}function oe({view:e,job:t,busy:n,act:r}){let i=e.databases.filter(e=>e.writable),[o,s]=(0,J.useState)(i[0]?.name??``),[c,u]=(0,J.useState)(``),d=t&&!t.running?t:null,f=d?.kind===`batches`?(Array.isArray(d.result)?d.result.flatMap(e=>e.batches||[]):d.result?.batches)??[]:null;return(0,Y.jsxs)(`section`,{"aria-labelledby":`batch-h`,className:`flex flex-col gap-4`,children:[(0,Y.jsxs)(`h2`,{id:`batch-h`,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,Y.jsx)(T,{icon:l,size:18,className:`text-accent-fg`}),`Inserted batches`]}),(0,Y.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Rows inserted from a spec go in as a batch. Remove a batch to take exactly those rows out again, children first.`}),i.length===0?(0,Y.jsx)(E,{className:`py-4`,children:`No writable database: test data is inserted only into one marked writable in Settings, Databases.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(y,{"aria-label":`Database`,value:o,onChange:e=>s(e.target.value),className:`w-[220px]`,children:i.map(e=>(0,Y.jsx)(`option`,{children:e.name},e.name))}),(0,Y.jsxs)(C,{disabled:n||!o,onClick:()=>r(`batches`,{db:o}),"data-tip":`List batches`,children:[(0,Y.jsx)(p,{"aria-hidden":`true`}),`Show`]})]}),f&&f.length===0&&(0,Y.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No batches in `,d?.target,`.`]}),f&&f.length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:f.map(e=>(0,Y.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-4 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.batch}),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[(0,Y.jsx)(`span`,{"data-tip":new Date(e.created).toLocaleString(),children:z(e.created)}),e.spec?` · ${e.spec}`:``,` ·`,` `,Object.entries(e.rows).map(([e,t])=>`${e} ${t}`).join(`, `)]})]}),c===e.batch?(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`text-[13px] text-warn`,children:[`Remove its rows from `,d?.target,`?`]}),(0,Y.jsxs)(C,{variant:`danger`,size:`sm`,onClick:()=>{u(``),r(`clean`,{db:d?.target,batch:e.batch,confirmed:!0})},children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),`Remove`]}),(0,Y.jsxs)(C,{size:`sm`,onClick:()=>u(``),children:[(0,Y.jsx)(a,{"aria-hidden":`true`}),`Keep`]})]}):(0,Y.jsx)(C,{size:`icon`,variant:`icon`,disabled:n,onClick:()=>u(e.batch),"aria-label":`Remove batch ${e.batch}`,"data-tip":`Remove batch ${e.batch}`,className:`size-8`,children:(0,Y.jsx)(m,{"aria-hidden":`true`})})]},e.batch))}),d?.kind===`clean`&&d.result?.ok&&(0,Y.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-4 py-2 text-sm text-pass`,children:[`Removed:`,` `,Object.entries(d.result.removed||{}).map(([e,t])=>`${e} ${t}`).join(`, `)]})]})]})}function se({sub:e}){let{view:t,error:n,busy:r,act:i,stop:a,job:o}=ne(),[s,l]=(0,J.useState)(null),[u,f]=(0,J.useState)(``),p=X.includes(e)?e:`requests`,m=o&&!o.running?o.endedAt:``;(0,J.useEffect)(()=>{x.log().then(l,e=>f(e.message))},[m]);let h=(s||[]).filter(e=>!e.ok).length,_=new Set((s||[]).map(e=>e.requester)).size,y={requests:`Requests${s?` (${s.length})`:``}`,kept:`Kept${t?` (${t.requests.length})`:``}`,specs:`Specs${t?` (${t.specs.length})`:``}`,batches:`Batches`};return(0,Y.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Y.jsx)(N,{}),(0,Y.jsxs)(`main`,{className:g(I,`@container flex-auto gap-4`),children:[(0,Y.jsx)(L,{href:d(`data`,`databases`),label:`All databases`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Y.jsx)(A,{pixel:O[`test-data`],size:`lg`}),(0,Y.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test data`}),t&&(0,Y.jsx)(R,{label:`Test data`,className:`mb-0`,current:p,onPick:e=>location.hash=d(`test-data`,e),tabs:X.map(e=>({id:e,label:y[e]}))}),(0,Y.jsx)(`span`,{className:`flex-auto`}),(0,Y.jsxs)(`a`,{href:d(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:g(w(),`no-underline`),children:[(0,Y.jsx)(c,{"aria-hidden":`true`}),`Ask`]})]}),(0,Y.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Every request for test data: which agent asked, what for, when, and what Miner sent back. Kept requests fetch the same data again with no model; specs make data you can insert as batches and remove again.`}),s&&s.length>0&&(0,Y.jsxs)(`p`,{className:`m-0 text-sm text-ink-2 tabular-nums`,children:[v(s.length,`request`),` · `,v(_,`asker`),` · `,(0,Y.jsxs)(`span`,{className:h?`text-fail`:``,children:[h,` failed`]}),t?` · ${t.requests.length} kept`:``]}),(n||u)&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:n||u}),!t&&!n&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,Y.jsxs)(Y.Fragment,{children:[o&&(o.running?Z[o.kind]!==void 0:Z[o.kind]===p)&&(0,Y.jsx)(te,{job:o,onStop:a}),(0,Y.jsxs)(`div`,{role:`tabpanel`,id:`panel-${p}`,"aria-labelledby":`tab-${p}`,children:[p===`requests`&&(0,Y.jsx)($,{view:t,log:s,busy:r,act:i}),p===`kept`&&(0,Y.jsx)(ie,{view:t,job:o,busy:r,act:i,onNote:f}),p===`specs`&&(0,Y.jsx)(ae,{view:t,job:o,busy:r,act:i,onNote:f}),p===`batches`&&(0,Y.jsx)(oe,{view:t,job:o,busy:r,act:i})]})]})]})]})}export{$ as Requests,se as TestData};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,Bn as n,Er as r,H as i,Hr as a,I as o,L as s,on as c,r as l,u,ur as d,wr as f}from"./route-Dg53WdFu.js";import{t as p}from"./jsx-runtime-LKYXHABd.js";import{A as m,X as h,Z as ee,n as te,t as ne}from"./input-D7iHeNXz.js";import{d as g,f as _,o as v,t as y}from"./filters-Culzq1j1.js";import{L as re}from"./palette-lUno7fso.js";import{Dn as b,H as ie,K as ae,Pt as x,U as oe,g as S}from"./index-CljX5dI4.js";import{_ as C,o as w}from"./qualityParts-D_U5zhKC.js";var T=e(a(),1),E={view:()=>h(`GET`,`/api/testdebt`),refresh:()=>h(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>h(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},D=p(),O=[`untested`,`signal`,`duplicates`,`cases`],k={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},A={test:`Test`,recording:`Recording`,case:`Test case`},j={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},M={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},N=e=>`${Math.round(e*100)}%`,se=e=>O.includes(e)?e:`untested`;function P({part:e,what:t,action:n}){return(0,D.jsxs)(v,{icon:f,title:e.state===`empty`?`No ${t} yet`:`${t[0].toUpperCase()}${t.slice(1)}: not connected`,action:(0,D.jsxs)(`a`,{className:_({size:`sm`}),href:n.to,"data-tip":`Open ${n.label}`,children:[(0,D.jsx)(u,{"aria-hidden":`true`}),n.label]}),children:[`To see this list, set `,e.set,`.`]})}function F({text:e,tip:t}){return(0,D.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function I({sub:e}){let[a,f]=(0,T.useState)(null),[p,h]=(0,T.useState)(``),[O,I]=(0,T.useState)(!1),[L,R]=(0,T.useState)(``),z=se(e),[B,V]=(0,T.useState)(`all`),[H,U]=(0,T.useState)(`manual`),[W,G]=(0,T.useState)(``),[K,ce]=(0,T.useState)(``);(0,T.useEffect)(()=>{E.view().then(e=>{f(e),h(``)},e=>h(e.message))},[]);let q=(0,T.useCallback)(async(e,t)=>{I(!0),R(``);try{f(await e()),h(``),t&&R(t)}catch(e){h(e.message)}finally{I(!1)}},[]),le=async e=>{if(e){I(!0);try{let{id:t}=await ee.start(e,{});location.hash=l(`chats`,t)}catch(e){h(e.message),I(!1)}}},J=(e,t)=>(0,D.jsx)(g,{size:`icon`,variant:`icon`,className:`size-8`,disabled:O||!e,onClick:()=>void le(e),"aria-label":`Draft a test for this ${t} in a chat`,"data-tip":e?`Draft a test for this ${t} in a chat`:`Its id or file is not of a plain shape, so no chat request names it: open it where it lives instead.`,children:(0,D.jsx)(d,{"aria-hidden":`true`})}),Y=a?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],X=W||Y[0]?.id||``,Z=a?.cases.filter(e=>!e.automated).length??0,ue=a?.areas.filter(e=>B===`all`||e.kind===B)??[],de=a?.cases.filter(e=>H===`all`||(H===`manual`?!e.automated:e.automated))??[],Q=`py-2 pr-4 text-right tabular-nums`,$={untested:(a?.areas.length??0)+(a?.rules.length??0),signal:(a?.quiet.length??0)+(a?.gone.length??0),duplicates:a?.duplicates.length??0,cases:Z};return(0,D.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,D.jsx)(ae,{}),(0,D.jsxs)(`main`,{className:m(oe,`@container flex-auto gap-4`),children:[(0,D.jsx)(ie,{}),(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,D.jsx)(b,{pixel:re[`test-debt`],size:`lg`}),(0,D.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test debt`}),a&&(0,D.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-[13px] text-muted`,children:[(0,D.jsxs)(`span`,{"data-tip":C(a.at),children:[`Worked out `,S(a.at)]}),(0,D.jsxs)(g,{size:`sm`,disabled:O,onClick:()=>void q(E.refresh,`Worked out again.`),children:[(0,D.jsx)(n,{"aria-hidden":`true`}),`Refresh`]})]})]}),(0,D.jsxs)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:[`What no test checks yet, and tests that tell little: code and business rules no test reaches in the `,(0,D.jsx)(`a`,{href:l(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,a?.repo&&a.repo!==`.`?(0,D.jsx)(`code`,{className:`font-mono text-[13px]`,children:a.repo}):`the test repository`,`, tests that read alike, and each test case with whether it is automated. It only reads; Draft the test asks in a chat, and nothing changes until you agree there.`]}),p&&(0,D.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}),!a&&!p&&(0,D.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),L&&(0,D.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:L}),a&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-6 @xl:divide-x @xl:divide-line-soft`,children:[(0,D.jsx)(w,{label:`Untested code`,value:a.graph.state===`ok`?a.areas.length:`–`,tone:a.areas.length?`text-warn`:void 0,sub:a.graph.state===`ok`?`of ${a.graph.checked} areas`:`graph not built`}),(0,D.jsx)(w,{label:`Untested rules`,value:a.rules.length,tone:a.rules.length?`text-warn`:void 0,sub:`of ${a.graph.rulesChecked} rules`}),(0,D.jsx)(w,{label:`Never fail`,value:a.quiet.length,sub:`30 passes in a row`}),(0,D.jsx)(w,{label:`Code gone`,value:a.gone.length,tone:a.gone.length?`text-fail`:void 0,sub:`of ${a.files.count} files listed`}),(0,D.jsx)(w,{label:`Near-duplicates`,value:a.duplicates.length,sub:`from ${N(a.threshold)} alike`}),(0,D.jsx)(w,{label:`Not automated`,value:Z,tone:Z?`text-warn`:void 0,sub:`of ${a.cases.length} test cases`})]}),(0,D.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,D.jsx)(y,{items:[{id:`untested`,label:`Untested code and rules`,n:$.untested},{id:`signal`,label:`Low-signal tests`,n:$.signal},{id:`duplicates`,label:`Near-duplicates`,n:$.duplicates},{id:`cases`,label:`Test cases`,n:$.cases}],value:z,onChange:e=>location.hash=l(`test-debt`,e)})}),a.notes.map(e=>(0,D.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:e},e)),z===`untested`&&(0,D.jsxs)(D.Fragment,{children:[a.graph.state===`ok`?(0,D.jsx)(x,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:B,empty:a.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,D.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,D.jsx)(y,{items:[{id:`all`,label:`All`,n:a.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${k[e]}s`,n:a.areas.filter(t=>t.kind===e).length}))],value:B,onChange:V})}),head:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[34%]`),children:`Code`}),(0,D.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Kind`}),(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Where`}),(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Used by`}),(0,D.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,D.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:ue.map(e=>(0,D.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`max-w-0`),children:(0,D.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(s,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,D.jsx)(F,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`text-[13px] whitespace-nowrap`),children:k[e.kind]}),(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`hidden max-w-0 font-mono text-[13px] text-ink-2 @xl:table-cell`),children:(0,D.jsx)(F,{text:e.where})}),(0,D.jsx)(`td`,{className:m(Q,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,D.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,k[e.kind].toLowerCase())})]},e.id))}):(0,D.jsx)(P,{part:a.graph,what:`product graph`,action:{label:`Product`,to:l(`product`)}}),(0,D.jsx)(x,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:a.graph.rulesChecked?`Every business rule found is checked by a test.`:`No business rules found: the product graph's rules come from the code; the knowledge folder's from a business-rules.md file.`,head:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[46%]`),children:`Rule`}),(0,D.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`From`}),(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Where`}),(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Closest test`}),(0,D.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,D.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.rules.map(e=>(0,D.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`max-w-0`),children:(0,D.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(s,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,D.jsx)(F,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`text-[13px] whitespace-nowrap`),"data-tip":e.from===`graph`?`Found in the code by forgeqe knowledge build`:`A rule of the knowledge folder, matched to tests by its words`,children:e.from===`graph`?`Code`:`Knowledge`}),(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`hidden max-w-0 font-mono text-[13px] text-ink-2 @xl:table-cell`),children:(0,D.jsx)(F,{text:e.where})}),(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:e.nearest?(0,D.jsx)(F,{text:`${e.nearest.name} (${N(e.nearest.score)})`,tip:`${N(e.nearest.score)} of the rule's words are in ${e.nearest.name}`}):`–`}),(0,D.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`rule`)})]},e.id))})]}),z===`signal`&&(a.history.state===`ok`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(x,{label:`Tests that never fail`,placeholder:`Find a test`,empty:`No test has passed 30 runs in a row without a failure or a retry.`,head:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[50%]`),children:`Test`}),(0,D.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Passes`}),(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Since`}),(0,D.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,D.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.quiet.map(e=>(0,D.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`max-w-0`),children:(0,D.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(o,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,D.jsx)(F,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,D.jsx)(`td`,{className:m(Q,`text-muted`),children:e.runs}),(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.since?C(e.since):void 0,children:e.since?S(e.since):`–`}),(0,D.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`test`)})]},e.key))}),(0,D.jsx)(x,{label:`Tests whose file is gone`,placeholder:`Find a test or file`,empty:`Every test file the history names is in the test repository (${a.files.count} files, listed by ${a.files.by===`git`?`git`:`walking the folder`}).`,head:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[40%]`),children:`Test`}),(0,D.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`File`}),(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Last run`}),(0,D.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,D.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.gone.map(e=>(0,D.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`max-w-0`),children:(0,D.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(i,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,D.jsx)(F,{text:e.name})]})}),(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`max-w-0 font-mono text-[13px] text-ink-2`),children:(0,D.jsx)(F,{text:e.file})}),(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.last?C(e.last):void 0,children:e.last?S(e.last):`–`}),(0,D.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`test`)})]},e.key))})]}):(0,D.jsx)(P,{part:a.history,what:`test history`,action:{label:`Regression`,to:l(`regression`)}})),z===`duplicates`&&(0,D.jsx)(x,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,empty:`No two tests, recordings or test cases share ${N(a.threshold)} of their words (${a.compared} pairs compared).`,head:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Alike`}),(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[30%]`),children:`First`}),(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[30%]`),children:`Second`}),(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Shared words`}),(0,D.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,D.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.duplicates.map(e=>(0,D.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,D.jsx)(`td`,{className:m(Q,`pl-4`,e.score>=.85?`text-warn`:`text-muted`),children:(0,D.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,D.jsx)(t,{size:14,"aria-hidden":`true`}),N(e.score)]})}),[e.a,e.b].map((e,t)=>(0,D.jsxs)(`td`,{className:m(`px-4 py-2`,`max-w-0`),children:[(0,D.jsx)(F,{text:e.name,tip:`${A[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,D.jsx)(`span`,{className:`block text-[13px] text-muted`,children:A[e.kind]})]},t)),(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:(0,D.jsx)(F,{text:e.shared.join(`, `)})}),(0,D.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`pair`)})]},`${e.a.kind}:${e.a.key}|${e.b.kind}:${e.b.key}`))}),z===`cases`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsx)(`span`,{className:`text-[13px] font-medium`,children:`Test management`}),(0,D.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:a.sources.map(e=>(0,D.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,D.jsx)(o,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,D.jsx)(s,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,D.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,D.jsx)(`span`,{className:`text-ink-2`,children:e.connected?e.scopes.length?e.scopes.map(e=>`${e.scope}: ${e.cases} read ${S(e.at)}`).join(` · `):e.id===`jira`?`connected: its cases show once ForgeQE has indexed or automated them`:`connected`:`not connected: set ${e.set}`})]},e.id))})]}),Y.length>0&&(0,D.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),X&&q(()=>E.readCases(X,K.trim()),`Test cases read.`)},children:[(0,D.jsx)(te,{size:`sm`,"aria-label":`Source`,value:X,onChange:e=>G(e.target.value),children:Y.map(e=>(0,D.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,D.jsx)(ne,{size:`sm`,"aria-label":`Scope`,placeholder:X&&X!==`jira`?M[X]:``,value:K,maxLength:80,onChange:e=>ce(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,D.jsxs)(g,{size:`sm`,type:`submit`,disabled:O||!K.trim(),"data-tip":`Read the test cases`,children:[(0,D.jsx)(r,{"aria-hidden":`true`}),`Import`]})]}),a.cases.length?(0,D.jsx)(x,{label:`Test cases`,placeholder:`Find a test case by id or title`,resetKey:H,empty:`Nothing matches.`,tools:(0,D.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,D.jsx)(y,{items:[{id:`manual`,label:`Not automated`,n:Z,alert:!0},{id:`automated`,label:`Automated`,n:a.cases.length-Z},{id:`all`,label:`All`,n:a.cases.length}],value:H,onChange:U})}),head:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Case`}),(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[36%]`),children:`Title`}),(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Source`}),(0,D.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Automated`}),(0,D.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Test`}),(0,D.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,D.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:de.map(e=>(0,D.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`font-mono text-[13px] whitespace-nowrap`),children:/^https?:\/\//i.test(e.url)?(0,D.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`max-w-0`),children:(0,D.jsx)(F,{text:e.title||`–`})}),(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap @xl:table-cell`),"data-tip":`From ${e.scope}`,children:j[e.source]}),(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`text-[13px] whitespace-nowrap`),children:(0,D.jsxs)(`span`,{className:`inline-flex items-center gap-2`,"data-tip":e.how===`mapping`?`Its test is in the automated tests' mapping`:e.how===`name`?`A test in the history names its id`:`No automated test names it`,children:[e.automated?(0,D.jsx)(o,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,D.jsx)(s,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,D.jsx)(`td`,{className:m(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:e.test?(0,D.jsx)(F,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,D.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:!e.automated&&J(e.draft,`test case`)})]},`${e.source}|${e.id}`))}):(0,D.jsx)(v,{icon:c,title:`No test cases yet`,action:(0,D.jsxs)(`a`,{className:_({size:`sm`}),href:l(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,D.jsx)(u,{"aria-hidden":`true`}),`Settings`]}),children:`Test cases show here from ForgeQE's case index, the automated tests' mapping (.forgeqe/test-cases.json), and the plans, runs or cycles you read above from a connected source.`})]})]})]})]})}export{I as TestDebt};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|