@capagents/forgeqe 3.2.1 → 3.2.3
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 +9 -8
- package/dist/docs-site/docs/area-api/index.html +1 -1
- package/dist/docs-site/docs/get-started/index.html +8 -7
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/forgeqe.js +1842 -1838
- package/dist/web/assets/{3d-force-graph-ByL874l5.js → 3d-force-graph-Bt0kE6fK.js} +1 -1
- package/dist/web/assets/{Agent-Drs4mcil.js → Agent-CsZ7vFCx.js} +6 -6
- package/dist/web/assets/{AgentWork-DLcCZTgu.js → AgentWork-Bjy58QJs.js} +1 -1
- package/dist/web/assets/ApiTests-_8-mU4o4.js +10 -0
- package/dist/web/assets/{Browse-D9eaDrZT.js → Browse-DXN091Tl.js} +1 -1
- package/dist/web/assets/Chat--mi_QDYP.js +3 -0
- package/dist/web/assets/{CommandPalette-Bcf1Muan.js → CommandPalette-DpYwTkxH.js} +1 -1
- package/dist/web/assets/{Compare-V5xKnwGO.js → Compare-CBatuMuQ.js} +1 -1
- package/dist/web/assets/Cost-Biq5Isox.js +1 -0
- package/dist/web/assets/{Data-DzrP-MdL.js → Data-0_y_XKGw.js} +3 -3
- package/dist/web/assets/Desktop-DPKPECCb.js +1 -0
- package/dist/web/assets/DesktopReview-COQqvQ7S.js +2 -0
- package/dist/web/assets/{DeviceScreen-CoArZGyY.js → DeviceScreen-D8u68b5B.js} +1 -1
- package/dist/web/assets/{Evidence-D6VvlFNK.js → Evidence-_PkdHSff.js} +1 -1
- package/dist/web/assets/{Explore-YkonRPmA.js → Explore-Bum9glmY.js} +2 -2
- package/dist/web/assets/{Features-BKB4iSRj.js → Features-OENuS23e.js} +1 -1
- package/dist/web/assets/Flags-BqepPJcc.js +2 -0
- package/dist/web/assets/{Flaky-BRcLjYrP.js → Flaky-CCLSqsfC.js} +1 -1
- package/dist/web/assets/Impact-9PxyQO57.js +3 -0
- package/dist/web/assets/Jobs-BGuNihAj.js +5 -0
- package/dist/web/assets/{KindPage-Ige-qO2t.js → KindPage-T4AUKlMQ.js} +3 -3
- package/dist/web/assets/{LiveDevice-DI7Bq6ag.js → LiveDevice-CP5RZ30S.js} +1 -1
- package/dist/web/assets/{Migration-CEwXGs4c.js → Migration-CrkuTtB7.js} +5 -5
- package/dist/web/assets/{Mobile-BqyFTBeG.js → Mobile-BlHPt6gb.js} +1 -1
- package/dist/web/assets/{Observability-B2Y1pHpD.js → Observability-nbCRQf-p.js} +1 -1
- package/dist/web/assets/PageAgent-B17N29Vg.js +1 -0
- package/dist/web/assets/{Product-CXIbmmMF.js → Product-y5qWviku.js} +4 -4
- package/dist/web/assets/Production-3yYw4c-9.js +1 -0
- package/dist/web/assets/Quality-DZjyRpSa.js +1 -0
- package/dist/web/assets/{Readiness-B53Drc7i.js → Readiness-DR-KExeM.js} +1 -1
- package/dist/web/assets/Record-DNByPZFL.js +1 -0
- package/dist/web/assets/{Regression-BpPXCQIv.js → Regression-Dewx-pZm.js} +3 -3
- package/dist/web/assets/{RelationGraph-UXFyQOKO.js → RelationGraph-BlR8ewL9.js} +1 -1
- package/dist/web/assets/{Reports-CWCa9uof.js → Reports-Ca7Kewsb.js} +2 -2
- package/dist/web/assets/Response-CQMw9bTX.js +9 -0
- package/dist/web/assets/{Responsive-Bl6i7kB3.js → Responsive-CEuJK8lj.js} +2 -2
- package/dist/web/assets/{RunDiff-CWf9Bkmu.js → RunDiff-CYVCUyER.js} +1 -1
- package/dist/web/assets/Runs-DPqjZhbv.js +2 -0
- package/dist/web/assets/{Settings-tgCcBEwu.js → Settings-DmFBERmV.js} +15 -15
- package/dist/web/assets/{Steps-xASPoq1N.js → Steps-AUxLKS75.js} +3 -3
- package/dist/web/assets/{TestCases-Cm4KwWIP.js → TestCases-ZZx3n1uf.js} +1 -1
- package/dist/web/assets/TestData-aY6U1NQz.js +2 -0
- package/dist/web/assets/TestDebt-C6y5j1or.js +1 -0
- package/dist/web/assets/TestManagement-8O_G3MDS.js +4 -0
- package/dist/web/assets/{WhatsNew-Dp-zP-jw.js → WhatsNew-CABuR9OZ.js} +1 -1
- package/dist/web/assets/{dataParts-BPff7ClX.js → dataParts-DqE6xkYJ.js} +2 -2
- package/dist/web/assets/{desktopAppPath-BVJxel_D.js → desktopAppPath-CqwJou-7.js} +1 -1
- package/dist/web/assets/{diff-BXu8cULX.js → diff-CdVbBfvE.js} +1 -1
- package/dist/web/assets/{highlight-DCCKhwHj.js → highlight-BbSbwn5i.js} +1 -1
- package/dist/web/assets/{index-BsAaOk_G.js → index-CeVry7Jo.js} +12 -12
- package/dist/web/assets/index-FhirFP-O.css +2 -0
- package/dist/web/assets/input-CK9KiscI.js +1 -0
- package/dist/web/assets/{pageBack-BNLSF2VR.js → pageBack-CGpBg0rz.js} +1 -1
- package/dist/web/assets/{palette-BS9ixqiJ.js → palette-sQXAx0hh.js} +1 -1
- package/dist/web/assets/{paletteCommands-C3knXWbA.js → paletteCommands-BUbZcBfs.js} +1 -1
- package/dist/web/assets/{parts-69Ei7EPi.js → parts-CY9Brfn9.js} +1 -1
- package/dist/web/assets/{productParts-CrAb3-j0.js → productParts-DLa8Xzv7.js} +1 -1
- package/dist/web/assets/{qualityParts-BQTnBwPs.js → qualityParts-Dfn1l_k_.js} +1 -1
- package/dist/web/assets/{recordTest-DVJCNI0y.js → recordTest-CPRlUK1r.js} +1 -1
- package/dist/web/assets/{stepper-t0O_8eQo.js → stepper-D9tX3bS5.js} +1 -1
- package/dist/web/index.html +5 -5
- package/docs/user-guide.html +29 -16
- package/package.json +1 -1
- package/prompts/brain.md +1 -1
- package/py/forgeqe_engine/copilot_gateway.py +8 -9
- package/py/forgeqe_engine/recordsession.py +2 -2
- package/py/forgeqe_engine/webrecord.py +9 -3
- package/py/forgeqe_engine/webrecord_page.py +87 -10
- package/dist/web/assets/ApiTests-BcrTspwJ.js +0 -10
- package/dist/web/assets/Chat-CMNf9-ys.js +0 -3
- package/dist/web/assets/Cost-DC3DYthD.js +0 -1
- package/dist/web/assets/Desktop-DjTq9eAr.js +0 -1
- package/dist/web/assets/DesktopReview-Buecn3n5.js +0 -2
- package/dist/web/assets/Flags-4GGW38Xu.js +0 -2
- package/dist/web/assets/Impact-CvuahLDQ.js +0 -3
- package/dist/web/assets/Jobs-DBCw8Z8I.js +0 -5
- package/dist/web/assets/PageAgent-BRhWi7LL.js +0 -1
- package/dist/web/assets/Production-BOy7ew7l.js +0 -1
- package/dist/web/assets/Quality-Dtcq2AWE.js +0 -1
- package/dist/web/assets/Record-BuCIDb1d.js +0 -1
- package/dist/web/assets/Response-C6EmnnQz.js +0 -9
- package/dist/web/assets/Runs-C0tfrB_j.js +0 -2
- package/dist/web/assets/TestData-DMV5S00V.js +0 -2
- package/dist/web/assets/TestDebt-D54mt0ZT.js +0 -1
- package/dist/web/assets/TestManagement-DBFlK8Xe.js +0 -4
- package/dist/web/assets/index-CgpH1pj9.css +0 -2
- package/dist/web/assets/input-BmJ7dt1C.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Br as t,Er as n,H as r,I as i,Kr as a,L as o,U as s,lt as c,r as l,sn as u}from"./route-D8G-pTdk.js";import{t as d}from"./jsx-runtime-LKYXHABd.js";import{A as f,Bt as p,a as m,n as h}from"./input-
|
|
2
|
-
`):[],h=
|
|
3
|
-
`).flatMap((t,n)=>e.test(t)?[n]:[]))},[t,a]),s=i?.path?i.path.slice(i.path.lastIndexOf(`/`)+1):n?P({kind:`test`,engine:n}):`Converted test`;return(0,D.jsx)(J,{label:`Converted test`,className:f(`pane-swap`,r),files:[{name:s,code:a,lang:i?.lang||`plaintext`,...i?.path?{title:i.path}:{},marked:o}],empty:i?`Not written yet.`:`This test case is left out of the plan.`,footer:t&&a?o.size?`${t} is done on line ${[...o].map(e=>e+1).join(`, `)}.`:`No line of the test is marked ${t}.`:void 0})}function oe({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,D.jsxs)(`section`,{"aria-label":`Locators Tosca recorded`,className:`flex flex-col gap-2 border-t border-line-soft pt-4 text-[13px]`,children:[(0,D.jsxs)(`span`,{className:`font-medium`,children:[a.name,` `,(0,D.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,D.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.locators.slice(0,6).map((e,t)=>(0,D.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`w-14 flex-none text-[13px] text-muted`,children:e.strategy}),(0,D.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,D.jsx)(v,{tone:`warn`,children:`Fragile`})]},t))}):(0,D.jsx)(`span`,{className:`text-muted`,children:`Tosca recorded no locator for it.`})]}):null}function se({id:e,plan:t,result:a,initial:l,full:d,onPick:m}){let b=t.cases.filter(e=>e.included),[C
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Br as t,Er as n,H as r,I as i,Kr as a,L as o,U as s,lt as c,r as l,sn as u}from"./route-D8G-pTdk.js";import{t as d}from"./jsx-runtime-LKYXHABd.js";import{A as f,Bt as p,a as m,n as h}from"./input-CK9KiscI.js";import{D as g,a as _,c as v,l as y,r as b,s as x}from"./pageBack-CGpBg0rz.js";import{E as S,b as C,en as w}from"./index-CeVry7Jo.js";import{f as T}from"./parts-CY9Brfn9.js";var E=e(a(),1),D=d();function O({error:e}){return e?(0,D.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e}):null}var k=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,A={ok:{label:`Ready to start`,tone:`pass`},limits:{label:`Ready, with limits`,tone:`warn`},blocked:{label:`Not possible`,tone:`fail`}},j={converted:{label:`Converted`,tone:`pass`},partial:{label:`Needs review`,tone:`warn`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`},running:{label:`Running`,tone:`running`}},M={converted:{label:`Converted`,tone:`pass`},written:{label:`Written`,tone:`neutral`},failed:{label:`Failed`,tone:`fail`},blocked:{label:`Not possible`,tone:`warn`},skipped:{label:`Skipped`,tone:`neutral`}},N={setup:`Set-up`,page:`Page`,test:`Test`},P=e=>e.engine?e.engine===`mobile`?`Mobile workflow`:`Desktop workflow`:N[e.kind],F={matched:{label:`In the test`,dot:`bg-pass`},missing:{label:`Missing from the test`,dot:`bg-fail`},elided:{label:`Not needed: this branch never runs`,dot:`bg-line-strong`},marked:{label:`Left for a person to finish`,dot:`bg-warn`}},I=e=>e.route===`web`||e.route===`api`||(e.routes?.web??0)>0||(e.routes?.api??0)>0||(e.workflow?.steps??0)>0;function L(e){if(e.workflow&&e.workflow.steps>0)return`${e.workflow.engine===`mobile`?`Mobile`:`Desktop`} workflow${e.workflow.skipped?` + notes`:``}`;let t=e.route===`web`||(e.routes?.web??0)>0,n=e.route===`api`||(e.routes?.api??0)>0,r=(e.unsupported??0)>0||(e.routes?.unsupported??0)>0;return`${t&&n?`Web and API`:n?`API`:`Web`}${r?` + notes`:``}`}var R={web:`Web`,api:`API`,desktop:`Desktop`,mobile:`Mobile`,data:`Data`,mixed:`Mixed`,unsupported:`Not supported`},z={prepare:`Prepare`,setup:`Set up`,pages:`Pages`,tests:`Tests`,validate:`Validate`,review:`Review`},B=[`prepare`,`setup`,`pages`,`tests`,`validate`,`review`];function V(e,t){if(!t)return 0;if(t.status===`converted`||t.stages?.review.status===`done`)return 100;let n=t.stages?.validate.status===`done`?8:0,r=Math.min(t.units.length,e.units.length);return Math.min(99,Math.round(r/Math.max(1,e.units.length)*90+n))}function H(e){let t=e?.status||`pending`,n=e?.startedAt&&e?.endedAt?T(Date.parse(e.endedAt)-Date.parse(e.startedAt)):``;return t===`running`?e?.startedAt?`Running for ${T(Date.now()-Date.parse(e.startedAt))}`:`Running`:t===`done`?e?.note||(n?`Done in ${n}`:`Done`):t===`failed`?e?.note||`Did not finish`:t===`skipped`?e?.note||`Skipped`:`Waiting`}function U(e){return e?`literal`in e?JSON.stringify(e.literal):`env`in e?`env ${String(e.env)}${e.secret?` (secret)`:``}`:`var`in e?`variable ${String(e.var)}`:`param`in e?`parameter ${String(e.param)}`:`data`in e?`test data ${String(e.data)}`:`expr`in e?`expression ${String(e.expr)}`:`concat`in e&&Array.isArray(e.concat)?e.concat.map(U).join(` + `):``:``}var W={exact:`is`,contains:`contains`,not:`is not`,gt:`is more than`,gte:`is at least`,lt:`is less than`,lte:`is at most`,exists:`is there`,absent:`is not there`},G=new Set([`gt`,`gte`,`lt`,`lte`]);function K(e){let t=e.expected;return t&&`literal`in t&&/^-?\d+(\.\d+)?$/.test(String(t.literal))&&(G.has(e.match||``)||e.op===`api_status`)?String(t.literal):U(t)}function q(e,t,n){return e===`api_status`||t===`status`?`the status`:e===`api_header`||t===`header`?`the header ${n}`:e===`api_body`||t===`body`?`the body`:`the JSON value ${n}`}function ee(e){if(e.op===`api_request`){let t=e.method&&`literal`in e.method?String(e.method.literal):``,n=[e.endpoint,e.resource].filter(Boolean).map(e=>U(e)).join(` + `),r=(e,t,n)=>{let r=e?Object.keys(e).length:0;return r?`${r} ${r===1?t:n}`:``},i=[e.payload?.fields?.length?`${e.payload.fields.length} body ${e.payload.fields.length===1?`field`:`fields`}`:e.payload?.raw?`a body`:``,r(e.pathParams,`path parameter`,`path parameters`),r(e.query,`query parameter`,`query parameters`),r(e.headers,`header`,`headers`)].filter(Boolean);return`Call ${t?`${t} `:e.method?`(method ${U(e.method)}) `:``}${n||`with no address`}${i.length?`, with ${i.join(`, `)}`:``}`}if(e.kind===`assert`&&(e.op===`api_status`||e.op===`api_header`||e.op===`api_json`||e.op===`api_body`)){let t=q(e.op,void 0,e.target),n=e.match||`exact`;return`Check ${t} of the response ${W[n]||`is`}${n===`exists`||n===`absent`?``:` ${K(e)}`}`}return e.op===`api_store`?`Read ${q(void 0,e.property,e.target)} of the response into ${e.var}`:null}function te(e){let t=ee(e);if(t!==null)return t;let n=e.target?e.target.slice(e.target.indexOf(`.`)+1).replace(/_/g,` `):``;if(e.kind===`action`){let t=e.op===`navigate`?`Open ${U(e.value)}`:e.op===`close`?`Close the browser`:e.op===`fill`?`Fill ${n} with ${U(e.value)}`:e.op===`press`?`Press ${e.key} on ${n}`:e.op===`select`?`Select in ${n}`:`${e.op[0].toUpperCase()}${e.op.slice(1)} ${n}`;return e.optional?`${t} (if it is there)`:t}return e.kind===`assert`?`Check ${n} ${e.op===`text`||e.op===`value`?`${e.match===`contains`?`contains`:`is`} ${U(e.expected)}`:`is ${e.op}`}${e.wait?`, waiting`:``}`:e.kind===`store`?`Read ${n} into ${e.var}`:e.kind===`set_var`?`Set ${e.var} to ${U(e.value)}`:e.kind===`wait`?`Wait ${e.ms} ms`:e.kind===`unsupported`?e.reason||`Cannot be converted`:e.name||e.kind}var ne={prepare:`Read the plan and the Tosca exports.`,setup:`Set up the new project and its packages.`,pages:`Write a page object for each Tosca module.`,tests:`Write each test case from its Tosca steps.`,validate:`Run every converted test, and fix what fails.`,review:`Check each test against its Tosca steps.`};function re(e){return B.map(t=>({id:t,name:z[t],about:ne[t],status:e?.[t]?.status||`pending`,line:H(e?.[t])}))}function ie({icon:e,title:t,aside:n,children:r}){return(0,D.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,D.jsxs)(`h4`,{className:`m-0 flex items-center gap-2 text-[16px] font-semibold`,children:[(0,D.jsx)(e,{size:18,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,D.jsx)(`span`,{className:`flex-1`,children:t}),n&&(0,D.jsx)(`span`,{className:`text-[13px] font-normal text-muted tabular-nums`,children:n})]}),r]})}function J({files:e,footer:n,empty:r,className:i,label:a}){let[o,s]=(0,E.useState)(0),[c,l]=(0,E.useState)(!1),u=e[Math.min(o,e.length-1)],d=u?.code||``,p=d?d.split(`
|
|
2
|
+
`):[],h=S(u?.log?null:d||null,u?.lang||`plaintext`),g=u?.log?(0,D.jsx)(b,{text:d}):h,_=u?.marked??new Set,v=(0,E.useRef)(null),y=_.size?Math.min(..._):-1;return(0,E.useEffect)(()=>{v.current?.scrollIntoView({block:`center`,behavior:m()})},[y,u?.name]),(0,D.jsxs)(`figure`,{"aria-label":a,className:f(`m-0 flex min-h-0 min-w-0 flex-col overflow-hidden rounded-[14px] bg-surface-strong`,i),children:[(0,D.jsxs)(`div`,{className:`flex min-h-12 items-center gap-1 px-2`,children:[(0,D.jsx)(`div`,{role:`group`,"aria-label":`Files`,className:`flex min-w-0 flex-1 items-center gap-1 overflow-x-auto`,children:e.map((e,t)=>(0,D.jsx)(`button`,{type:`button`,"aria-pressed":t===o,onClick:()=>s(t),"data-tip":e.title,className:f(`min-h-8 flex-none cursor-pointer truncate rounded-[8px] border-0 px-2 font-mono text-[13px]`,t===o?`bg-line text-ink`:`bg-transparent text-muted hover:text-ink`),children:e.name},e.name+t))}),d&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`button`,{type:`button`,"aria-pressed":c,"aria-label":c?`Do not wrap long lines`:`Wrap long lines`,"data-tip":c?`Do not wrap long lines`:`Wrap long lines`,onClick:()=>l(!c),className:f(`inline-flex size-8 flex-none cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent hover:bg-line hover:text-ink`,c?`text-ink`:`text-muted`),children:(0,D.jsx)(t,{size:14,"aria-hidden":`true`})}),(0,D.jsx)(C,{text:d,label:`Copy ${u?.name||`the code`}`})]})]}),d?(0,D.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-auto pb-4 font-mono text-[13px] leading-[1.7]`,children:[(0,D.jsx)(`pre`,{"aria-hidden":`true`,className:`m-0 min-h-full flex-none self-start pt-1 text-right text-muted/70 select-none`,children:p.map((e,t)=>(0,D.jsx)(`span`,{ref:t===y?v:void 0,className:f(`block px-4`,_.has(t)&&`font-semibold text-ink`),children:t+1},t))}),(0,D.jsxs)(`pre`,{className:f(`relative m-0 min-w-0 flex-1 pt-1 pr-4`,c?`whitespace-pre-wrap [overflow-wrap:anywhere]`:`whitespace-pre`),children:[!c&&[..._].map(e=>(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute right-0 left-[-16px] bg-accent-soft`,style:{top:`calc(4px + ${e} * 1.7em)`,height:`1.7em`}},e)),(0,D.jsx)(`code`,{className:`hljs relative`,children:g})]})]}):(0,D.jsx)(`div`,{className:`flex min-h-[200px] flex-1 items-center justify-center px-4 text-center text-sm text-muted`,children:r??`Nothing to show.`}),n&&(0,D.jsx)(`div`,{className:`border-t border-line px-4 py-2 text-[13px] text-muted`,children:n})]})}var Y=(e,t)=>t?l(`tosca`,e,`compare`,encodeURIComponent(t)):l(`tosca`,e,`compare`),X=50,ae={before:`Before`,after:`After`,block:`Reusable block`,folder:`Folder`};function Z({nodes:e,status:t,pick:n,onPick:r,depth:i=0}){return(0,D.jsx)(`ul`,{className:f(`m-0 flex list-none flex-col p-0`,i>0&&`ml-4 border-l border-line-soft pl-4`),children:e.map((e,a)=>{if(e.kind===`group`)return(0,D.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,D.jsxs)(`span`,{className:`text-[13px] font-medium text-muted`,children:[ae[e.role||`folder`]||`Folder`,`: `,(0,D.jsx)(`span`,{className:`text-ink-2`,children:e.name})]}),(0,D.jsx)(Z,{nodes:e.body||[],status:t,pick:n,onPick:r,depth:i+1})]},`g${a}`);if(e.kind===`if`||e.kind===`loop`){let o=e.condition;return(0,D.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,D.jsxs)(`span`,{className:`text-[13px] font-medium text-muted`,children:[e.kind===`if`?`If`:`Loop`,` `,e.name,`: `,(0,D.jsx)(`code`,{className:`font-mono text-[13px] text-ink-2`,children:o?.tosca}),o?.constant!==void 0&&(0,D.jsxs)(`span`,{children:[`, always `,o.constant?`true`:`false`]})]}),[`then`,`else`,`loop`].map(a=>e[a]?.length?(0,D.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,D.jsx)(`span`,{className:`ml-4 text-[13px] text-muted`,children:a===`then`?`Then`:a===`else`?`Else`:`Each time`}),(0,D.jsx)(Z,{nodes:e[a],status:t,pick:n,onPick:r,depth:i+1})]},a):null)]},`i${a}`)}let o=e.id?t.get(e.id):void 0,s=o?F[o]:void 0;return(0,D.jsx)(`li`,{children:(0,D.jsxs)(`button`,{type:`button`,"aria-pressed":n===e.id,onClick:()=>r(e),className:f(`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,D.jsx)(`span`,{role:`img`,"aria-label":s?.label||`Not converted yet`,"data-tip":s?.label||`Not converted yet`,className:f(`mt-2 size-2 flex-none rounded-full`,s?.dot||`bg-line`)}),(0,D.jsx)(`span`,{className:`w-9 flex-none font-mono text-[13px] text-muted`,children:e.id}),(0,D.jsxs)(`span`,{className:f(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`unsupported`?`text-warn`:`text-ink`),children:[te(e),e.tosca?.step&&(0,D.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[`Tosca step "`,e.tosca.step,`"`]})]})]})},e.id||a)})})}function Q(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]&&Q(n[e],t);if(r)return r}}}function $({view:e,pick:t,engine:n,className:r}){let i=e.target,a=i?.text||``,o=(0,E.useMemo)(()=>{if(!t||!a)return new Set;let e=RegExp(`tosca:[\\sn\\d,]*\\b${t}\\b`,`i`);return new Set(a.split(`
|
|
3
|
+
`).flatMap((t,n)=>e.test(t)?[n]:[]))},[t,a]),s=i?.path?i.path.slice(i.path.lastIndexOf(`/`)+1):n?P({kind:`test`,engine:n}):`Converted test`;return(0,D.jsx)(J,{label:`Converted test`,className:f(`pane-swap`,r),files:[{name:s,code:a,lang:i?.lang||`plaintext`,...i?.path?{title:i.path}:{},marked:o}],empty:i?`Not written yet.`:`This test case is left out of the plan.`,footer:t&&a?o.size?`${t} is done on line ${[...o].map(e=>e+1).join(`, `)}.`:`No line of the test is marked ${t}.`:void 0})}function oe({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,D.jsxs)(`section`,{"aria-label":`Locators Tosca recorded`,className:`flex flex-col gap-2 border-t border-line-soft pt-4 text-[13px]`,children:[(0,D.jsxs)(`span`,{className:`font-medium`,children:[a.name,` `,(0,D.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,D.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.locators.slice(0,6).map((e,t)=>(0,D.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`w-14 flex-none text-[13px] text-muted`,children:e.strategy}),(0,D.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,D.jsx)(v,{tone:`warn`,children:`Fragile`})]},t))}):(0,D.jsx)(`span`,{className:`text-muted`,children:`Tosca recorded no locator for it.`})]}):null}function se({id:e,plan:t,result:a,initial:l,full:d,onPick:m}){let b=t.cases.filter(e=>e.included),[S,C]=(0,E.useState)(``),[T,O]=(0,E.useState)(l||b[0]?.id||``),[A,j]=(0,E.useState)(null),[N,P]=(0,E.useState)(``),[F,I]=(0,E.useState)(``);(0,E.useEffect)(()=>{T&&(I(``),p.case(e,T).then(j,e=>I(e.message)))},[e,T,a?.units.length,a?.status]),(0,E.useEffect)(()=>{P(``),T&&m?.(T)},[T]);let L=new Map((A?.fidelity||[]).map(e=>[e.id,e.status])),z=b.filter(e=>!S||e.name.toLowerCase().includes(S.toLowerCase())),[B,V]=(0,E.useState)(0);(0,E.useEffect)(()=>V(0),[S]),(0,E.useEffect)(()=>{let e=z.findIndex(e=>e.id===T);e>=0&&Math.floor(e/X)!==B&&V(Math.floor(e/X))},[T]);let H=z.slice(B*X,B*X+X),U=e=>a?.units.find(t=>t.kind===`test`&&t.case===e),W=e=>b.filter(t=>e.includes(U(t.id)?.status||``)).length,G=[`${W([`converted`])} converted`,...W([`written`])?[`${W([`written`])} written`]:[],`${W([`failed`,`blocked`])} failed`,`of ${k(b.length,`test case`)}`].join(`, `);if(!b.length)return(0,D.jsx)(y,{center:!0,className:`py-6`,children:`No test case of this plan is converted.`});if(d){let e=t.cases.find(e=>e.id===T),a=U(T),c=A?.fidelity,l=c?c.filter(e=>e.status===`matched`).length:0;return(0,D.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 @5xl:flex-row`,children:[(0,D.jsxs)(`nav`,{"aria-label":`Test cases`,className:`flex max-h-[360px] min-h-0 w-full flex-none flex-col overflow-hidden rounded-[14px] border border-line bg-bg @5xl:max-h-none @5xl:w-80`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 border-b border-line-soft px-4 py-4`,children:[(0,D.jsx)(w,{level:3,icon:s,title:`Test cases`,description:`${G}. Pick one to see its Tosca steps beside its test.`}),(0,D.jsx)(x,{id:`find-a-case`,label:`Find a test case`,value:S,onChange:C,className:`max-w-none flex-none`})]}),(0,D.jsxs)(`ul`,{className:`m-0 flex min-h-0 flex-1 list-none flex-col overflow-y-auto p-2`,children:[H.map(e=>{let t=U(e.id),a=t?.status===`converted`?{icon:i,tone:`text-pass`}:t?.status===`failed`?{icon:r,tone:`text-fail`}:t?.status===`blocked`?{icon:n,tone:`text-warn`}:t?.status===`written`?{icon:i,tone:`text-muted`}:{icon:o,tone:`text-muted`},s=T===e.id;return(0,D.jsx)(`li`,{children:(0,D.jsxs)(`button`,{type:`button`,"aria-pressed":s,onClick:()=>O(e.id),className:f(`relative flex w-full cursor-pointer items-start gap-2 overflow-hidden rounded-[10px] border-0 px-4 py-2 text-left text-[13px]`,s?`bg-surface-strong`:`bg-transparent hover:bg-surface-muted`),children:[s&&(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 left-0 w-1 bg-accent`}),(0,D.jsx)(a.icon,{size:16,"aria-label":t?M[t.status].label:`Waiting`,className:f(`translate-y-0.5 flex-none`,a.tone)}),(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,D.jsx)(`span`,{className:`font-medium text-ink [overflow-wrap:anywhere]`,children:e.name}),(0,D.jsxs)(`span`,{className:`text-muted`,children:[k(e.steps,`step`),`, `,k(e.asserts,`check`),t?.fidelity?`, ${t.fidelity.matched}/${t.fidelity.required} kept`:``]})]})]})},e.id)}),!H.length&&(0,D.jsx)(`li`,{className:`px-4 py-4 text-[13px] text-muted`,children:`No test case matches.`})]}),z.length>X&&(0,D.jsx)(_,{page:B,size:X,total:z.length,onPage:V,label:`Test case pages`})]}),(0,D.jsxs)(`section`,{"aria-label":`Comparison`,className:`flex min-h-[480px] min-w-0 flex-1 flex-col overflow-hidden rounded-[14px] border border-line bg-bg`,children:[(0,D.jsx)(`header`,{className:`border-b border-line-soft px-4 py-4`,children:(0,D.jsx)(w,{level:3,icon:s,title:A?.name||e?.name||`Test case`,actions:(0,D.jsxs)(D.Fragment,{children:[e&&R[e.route]&&(0,D.jsx)(`span`,{className:`rounded-[8px] bg-surface-strong px-2 py-1 text-[13px] text-ink-2`,children:R[e.route]}),c&&c.length>0&&(0,D.jsxs)(`span`,{className:`text-[13px] text-ink-2 tabular-nums`,children:[l,` of `,c.length,` Tosca steps in the test`]}),a&&(0,D.jsx)(v,{tone:M[a.status].tone,children:M[a.status].label})]})})}),F&&(0,D.jsx)(`p`,{role:`alert`,className:`m-0 border-b border-line-soft bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:F}),(0,D.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 @5xl:grid-cols-2`,children:[(0,D.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col border-line-soft @5xl:border-r`,children:[(0,D.jsxs)(`div`,{className:`flex min-h-12 items-center gap-2 border-b border-line-soft px-4 text-[13px]`,children:[(0,D.jsx)(u,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,D.jsx)(`span`,{className:`font-semibold text-ink`,children:`Tosca steps`}),(0,D.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted`,children:`Pick a step to find it in the test`})]}),(0,D.jsx)(`div`,{className:`pane-swap min-h-0 flex-1 overflow-y-auto px-2 py-2`,children:A?(0,D.jsx)(Z,{nodes:A.body,status:L,pick:N,onPick:e=>P(e.id||``)}):(0,D.jsx)(`p`,{role:`status`,className:`m-0 px-2 text-sm text-muted`,children:F?`Nothing to show.`:`Loading…`})},A?.case||``),A&&(A.env.length>0||A.warnings.length>0)&&(0,D.jsxs)(`footer`,{className:`flex flex-col gap-1 border-t border-line-soft px-4 py-2 text-[13px] text-ink-2`,children:[A.env.length>0&&(0,D.jsxs)(`span`,{children:[`Environment variables: `,A.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),`.`]}),A.warnings.slice(0,3).map(e=>(0,D.jsx)(`span`,{className:`text-warn`,children:e},e))]}),A&&Q(A.body,N)?.target&&(0,D.jsx)(`div`,{className:`px-4 pb-4`,children:(0,D.jsx)(oe,{view:A,node:Q(A.body,N)})})]}),(0,D.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-col`,children:A?(0,D.jsx)($,{view:A,pick:N,engine:t.units.find(e=>e.kind===`test`&&e.case===A.case)?.engine,className:`h-full rounded-none bg-bg`},A.case):(0,D.jsx)(`p`,{className:`m-0 flex flex-1 items-center justify-center px-4 text-center text-sm text-muted`,children:F?`Nothing to show.`:`Loading…`})})]})]})]})}return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,D.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-2 text-sm font-medium`,children:[`Test case`,(0,D.jsx)(h,{value:T,onChange:e=>O(e.target.value),children:b.map(e=>{let t=U(e.id);return(0,D.jsxs)(`option`,{value:e.id,children:[e.name,t?` (${M[t.status].label.toLowerCase()})`:``]},e.id)})})]}),(0,D.jsx)(`span`,{className:`pb-2 text-[13px] text-muted`,children:G}),(0,D.jsx)(`span`,{className:`flex-1`}),(0,D.jsxs)(`a`,{href:Y(e,T),target:`_blank`,rel:`noopener noreferrer`,"data-tip":`Tosca steps beside the converted test, in a tab of their own`,className:g({variant:`ghost`,size:`sm`}),children:[(0,D.jsx)(c,{"aria-hidden":`true`}),`Compare in a new tab`]})]}),F&&(0,D.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:F}),A?(0,D.jsx)($,{view:A,pick:``,engine:t.units.find(e=>e.kind===`test`&&e.case===A.case)?.engine,className:`max-h-[calc(var(--screen)-360px)] min-h-[320px]`},A.case):(0,D.jsx)(`p`,{role:`status`,className:`m-0 flex min-h-[260px] items-center justify-center px-4 text-center text-sm text-muted`,children:F?`Nothing to show.`:`Loading…`})]})}export{V as _,F as a,R as c,M as d,A as f,P as g,k as h,ie as i,B as l,I as m,Y as n,O as o,L as p,J as r,j as s,se as t,z as u,re as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Er as t,Hr as n,Kr as r,O as i,U as a,Ut as o,_t as s,lt as c,n as l,r as u,sn as d,u as f,ut as p}from"./route-D8G-pTdk.js";import{t as m}from"./jsx-runtime-LKYXHABd.js";import{A as h,Rt as g,W as _,t as v}from"./input-BmJ7dt1C.js";import{E as y,i as b,l as x,n as S}from"./pageBack-BNLSF2VR.js";import{L as C}from"./palette-BS9ixqiJ.js";import{At as w,Cn as T,Dt as E,F as D,Mt as O,Ot as k,Qt as A,T as j,Yt as M,d as N,z as P}from"./index-BsAaOk_G.js";var F=e(r(),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&&j(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({view:e,onApplied:r,onError:l}){let[u,f]=(0,F.useState)([]),[m,_]=(0,F.useState)(null),[v,b]=(0,F.useState)(!1),[x,S]=(0,F.useState)(null),C=e.story.id,T=e.proposals.filter(e=>u.includes(V(e))),D=async()=>{let t=T.map(e=>U(e,C));b(!0);try{let n=await g.preview(e.system,C,t);_({lines:n.lines,changes:t}),l(``)}catch(e){l(e.message)}finally{b(!1)}},j=async()=>{if(m){b(!0);try{let t=await g.apply(e.system,C,m.changes);S({applied:t.applied,failed:t.failed}),_(null),f([]),l(``),r()}catch(e){l(e.message)}finally{b(!1)}}},P=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:[P?(0,I.jsxs)(`a`,{href:P,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[C,(0,I.jsx)(c,{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 `,M(e.changed.when),`.`]})]}),(0,I.jsx)(A,{id:`cases`,icon:a,title:`Linked cases`,children:(0,I.jsx)(E,{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:w,children:`Case`}),(0,I.jsx)(`th`,{scope:`col`,className:w,children:`Title`}),(0,I.jsx)(`th`,{scope:`col`,className:h(w,`text-right`),children:`Steps`}),(0,I.jsx)(`th`,{scope:`col`,className:w,children:`State`})]}),children:e.cases.map(e=>{let n=z(e.url);return(0,I.jsxs)(`tr`,{className:O,children:[(0,I.jsx)(`td`,{className:h(k,`whitespace-nowrap`),children:n?(0,I.jsxs)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[e.id,(0,I.jsx)(c,{size:12,"aria-hidden":`true`})]}):e.id}),(0,I.jsx)(`td`,{className:h(k,`[overflow-wrap:anywhere]`),children:e.title}),(0,I.jsx)(`td`,{className:h(k,`text-right tabular-nums`),children:e.steps}),(0,I.jsx)(`td`,{className:h(k,e.stale?`text-warn`:`text-muted`),children:e.stale?(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,I.jsx)(t,{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 `,M(e.changed)]}):`–`})]},e.id)})})}),(0,I.jsx)(A,{id:`criteria`,icon:d,title:`Acceptance criteria`,children:(0,I.jsx)(E,{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:w,children:`Criterion`}),(0,I.jsx)(`th`,{scope:`col`,className:w,children:`Cases`})]}),children:e.criteria.map((e,t)=>(0,I.jsxs)(`tr`,{className:O,children:[(0,I.jsx)(`td`,{className:h(k,`[overflow-wrap:anywhere]`),children:e.text}),(0,I.jsx)(`td`,{className:h(k,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,I.jsxs)(A,{id:`proposals`,icon:s,title:`Proposed changes`,children:[(0,I.jsx)(E,{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||!T.length||!!m,"data-tip":`Review ${B(T.length,`change`)}`,onClick:()=>void D(),children:[(0,I.jsx)(p,{"aria-hidden":`true`}),`Review (`,T.length,`)`]}),head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`th`,{scope:`col`,className:h(w,`w-10`),children:(0,I.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,I.jsx)(`th`,{scope:`col`,className:w,children:`Change`}),(0,I.jsx)(`th`,{scope:`col`,className:w,children:`Existing case`}),(0,I.jsx)(`th`,{scope:`col`,className:w,children:`The agent wrote`})]}),children:e.proposals.map(e=>{let t=V(e);return(0,I.jsxs)(`tr`,{className:O,children:[(0,I.jsx)(`td`,{className:k,children:(0,I.jsx)(N,{"aria-label":`${H(e)}: ${e.id} ${e.title}`,checked:u.includes(t),disabled:v||!!m,onCheckedChange:e=>f(e?[...u,t]:u.filter(e=>e!==t))})}),(0,I.jsxs)(`td`,{className:h(k,`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(k,`[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(k,`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 j(),children:[(0,I.jsx)(i,{"aria-hidden":`true`}),`Apply`]}),(0,I.jsxs)(y,{size:`sm`,disabled:v,onClick:()=>_(null),children:[(0,I.jsx)(n,{"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)(A,{id:`changes`,icon:o,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 K({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?l(e.slice(r+1)):``,[s,c]=(0,F.useState)(a??`azure_devops`),[p,m]=(0,F.useState)(o),[_,w]=(0,F.useState)(null),[E,O]=(0,F.useState)(``),[k,A]=(0,F.useState)(!1);(0,F.useEffect)(()=>{a&&c(a),m(o)},[a,o]),(0,F.useEffect)(()=>{!a&&t.length&&!t.some(e=>e.id===s)&&c(t[0].id)},[t,s,a]);let j=(0,F.useCallback)(()=>{!a||!o?w(null):(A(!0),g.view(a,o).then(e=>{w(e),O(``),A(!1)},e=>{O(e.message),A(!1)}))},[a,o]);return(0,F.useEffect)(()=>w(null),[a,o]),(0,F.useEffect)(j,[j]),(0,I.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,I.jsx)(P,{}),(0,I.jsxs)(`main`,{className:h(D,`@container flex-auto gap-4`),children:[(0,I.jsx)(S,{}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,I.jsx)(T,{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:u(`regression`),children:`Regression`}),`; their results on `,(0,I.jsx)(`a`,{href:u(`runs`),children:`Runs`}),`.`]}),(0,I.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=p.trim();if(!t)return;let n=u(`test-cases`,s,encodeURIComponent(t));location.hash===n?j():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)(b,{items:t,value:s,onChange:c})}),(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:s===`azure_devops`?`1234`:s===`qtest`?`5678`:s===`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)(f,{"aria-hidden":`true`}),`Open`]})]})]}),[n,E].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)(G,{view:_,onApplied:j,onError:O},`${_.system}:${_.story.id}`),!o&&!_&&(0,I.jsx)(x,{icon:d,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{K as TestCases};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Er as t,Hr as n,Kr as r,O as i,U as a,Ut as o,_t as s,lt as c,n as l,r as u,sn as d,u as f,ut as p}from"./route-D8G-pTdk.js";import{t as m}from"./jsx-runtime-LKYXHABd.js";import{A as h,Rt as g,W as _,t as v}from"./input-CK9KiscI.js";import{E as y,i as b,l as x,n as S}from"./pageBack-CGpBg0rz.js";import{L as C}from"./palette-sQXAx0hh.js";import{$t as w,F as T,Nt as E,Ot as D,T as O,Xt as k,d as A,jt as j,kt as M,wn as N,z as P}from"./index-CeVry7Jo.js";var F=e(r(),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&&O(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({view:e,onApplied:r,onError:l}){let[u,f]=(0,F.useState)([]),[m,_]=(0,F.useState)(null),[v,b]=(0,F.useState)(!1),[x,S]=(0,F.useState)(null),C=e.story.id,T=e.proposals.filter(e=>u.includes(V(e))),O=async()=>{let t=T.map(e=>U(e,C));b(!0);try{let n=await g.preview(e.system,C,t);_({lines:n.lines,changes:t}),l(``)}catch(e){l(e.message)}finally{b(!1)}},N=async()=>{if(m){b(!0);try{let t=await g.apply(e.system,C,m.changes);S({applied:t.applied,failed:t.failed}),_(null),f([]),l(``),r()}catch(e){l(e.message)}finally{b(!1)}}},P=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:[P?(0,I.jsxs)(`a`,{href:P,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[C,(0,I.jsx)(c,{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 `,k(e.changed.when),`.`]})]}),(0,I.jsx)(w,{id:`cases`,icon:a,title:`Linked cases`,children:(0,I.jsx)(D,{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:j,children:`Case`}),(0,I.jsx)(`th`,{scope:`col`,className:j,children:`Title`}),(0,I.jsx)(`th`,{scope:`col`,className:h(j,`text-right`),children:`Steps`}),(0,I.jsx)(`th`,{scope:`col`,className:j,children:`State`})]}),children:e.cases.map(e=>{let n=z(e.url);return(0,I.jsxs)(`tr`,{className:E,children:[(0,I.jsx)(`td`,{className:h(M,`whitespace-nowrap`),children:n?(0,I.jsxs)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[e.id,(0,I.jsx)(c,{size:12,"aria-hidden":`true`})]}):e.id}),(0,I.jsx)(`td`,{className:h(M,`[overflow-wrap:anywhere]`),children:e.title}),(0,I.jsx)(`td`,{className:h(M,`text-right tabular-nums`),children:e.steps}),(0,I.jsx)(`td`,{className:h(M,e.stale?`text-warn`:`text-muted`),children:e.stale?(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,I.jsx)(t,{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 `,k(e.changed)]}):`–`})]},e.id)})})}),(0,I.jsx)(w,{id:`criteria`,icon:d,title:`Acceptance criteria`,children:(0,I.jsx)(D,{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:j,children:`Criterion`}),(0,I.jsx)(`th`,{scope:`col`,className:j,children:`Cases`})]}),children:e.criteria.map((e,t)=>(0,I.jsxs)(`tr`,{className:E,children:[(0,I.jsx)(`td`,{className:h(M,`[overflow-wrap:anywhere]`),children:e.text}),(0,I.jsx)(`td`,{className:h(M,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,I.jsxs)(w,{id:`proposals`,icon:s,title:`Proposed changes`,children:[(0,I.jsx)(D,{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||!T.length||!!m,"data-tip":`Review ${B(T.length,`change`)}`,onClick:()=>void O(),children:[(0,I.jsx)(p,{"aria-hidden":`true`}),`Review (`,T.length,`)`]}),head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`th`,{scope:`col`,className:h(j,`w-10`),children:(0,I.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,I.jsx)(`th`,{scope:`col`,className:j,children:`Change`}),(0,I.jsx)(`th`,{scope:`col`,className:j,children:`Existing case`}),(0,I.jsx)(`th`,{scope:`col`,className:j,children:`The agent wrote`})]}),children:e.proposals.map(e=>{let t=V(e);return(0,I.jsxs)(`tr`,{className:E,children:[(0,I.jsx)(`td`,{className:M,children:(0,I.jsx)(A,{"aria-label":`${H(e)}: ${e.id} ${e.title}`,checked:u.includes(t),disabled:v||!!m,onCheckedChange:e=>f(e?[...u,t]:u.filter(e=>e!==t))})}),(0,I.jsxs)(`td`,{className:h(M,`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(M,`[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(M,`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 N(),children:[(0,I.jsx)(i,{"aria-hidden":`true`}),`Apply`]}),(0,I.jsxs)(y,{size:`sm`,disabled:v,onClick:()=>_(null),children:[(0,I.jsx)(n,{"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)(w,{id:`changes`,icon:o,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 K({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?l(e.slice(r+1)):``,[s,c]=(0,F.useState)(a??`azure_devops`),[p,m]=(0,F.useState)(o),[_,w]=(0,F.useState)(null),[E,D]=(0,F.useState)(``),[O,k]=(0,F.useState)(!1);(0,F.useEffect)(()=>{a&&c(a),m(o)},[a,o]),(0,F.useEffect)(()=>{!a&&t.length&&!t.some(e=>e.id===s)&&c(t[0].id)},[t,s,a]);let A=(0,F.useCallback)(()=>{!a||!o?w(null):(k(!0),g.view(a,o).then(e=>{w(e),D(``),k(!1)},e=>{D(e.message),k(!1)}))},[a,o]);return(0,F.useEffect)(()=>w(null),[a,o]),(0,F.useEffect)(A,[A]),(0,I.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,I.jsx)(P,{}),(0,I.jsxs)(`main`,{className:h(T,`@container flex-auto gap-4`),children:[(0,I.jsx)(S,{}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,I.jsx)(N,{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:u(`regression`),children:`Regression`}),`; their results on `,(0,I.jsx)(`a`,{href:u(`runs`),children:`Runs`}),`.`]}),(0,I.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=p.trim();if(!t)return;let n=u(`test-cases`,s,encodeURIComponent(t));location.hash===n?A():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)(b,{items:t,value:s,onChange:c})}),(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:s===`azure_devops`?`1234`:s===`qtest`?`5678`:s===`testrail`?`R12`:`SHOP-12`,onChange:e=>m(e.target.value)})]}),(0,I.jsxs)(y,{type:`submit`,variant:`primary`,disabled:!p.trim()||O,"data-tip":`Open the story's test cases`,children:[(0,I.jsx)(f,{"aria-hidden":`true`}),`Open`]})]})]}),[n,E].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)),O&&(0,I.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),_&&(0,I.jsx)(G,{view:_,onApplied:A,onError:D},`${_.system}:${_.story.id}`),!o&&!_&&(0,I.jsx)(x,{icon:d,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{K as TestCases};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{A as t,Cr as n,Hn as r,Hr as i,Kn as a,Kr as o,M as s,O as c,Rn as l,Tt as u,_n as d,cr as f,ot as p,r as m,rt as h,ut as g}from"./route-D8G-pTdk.js";import{t as _}from"./jsx-runtime-LKYXHABd.js";import{A as v,Z as y,j as b,n as x,t as S,tt as C}from"./input-CK9KiscI.js";import{D as w,E as T,c as E,i as D,l as O,t as k}from"./pageBack-CGpBg0rz.js";import{L as A}from"./palette-sQXAx0hh.js";import{$t as j,At as M,F as ee,Mt as N,Ot as P,Pt as F,Rt as te,Xt as I,jt as L,kt as R,wn as z,z as B}from"./index-CeVry7Jo.js";import{a as V,c as H,d as U,i as W,l as G,m as K,n as q,o as ne,s as J,t as re}from"./dataParts-DqE6xkYJ.js";var Y=e(o(),1),X=_(),Z=[`requests`,`kept`,`specs`,`batches`],ie={requests:l,kept:a,specs:u,batches:f},Q={fetch:`kept`,request:`requests`,gen:`specs`,files:`specs`,insert:`specs`,batches:`batches`,clean:`batches`},ae=e=>Object.values(e.row_counts||{}).reduce((e,t)=>e+t,0);function oe({e,kept:t,busy:n,act:i}){return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 px-1 py-2`,children:[(0,X.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-[13px]`,children:[(0,X.jsx)(`dt`,{className:`text-muted`,children:`Asked for`}),(0,X.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:e.need}),(0,X.jsx)(`dt`,{className:`text-muted`,children:`When`}),(0,X.jsxs)(`dd`,{className:`m-0`,children:[new Date(e.at).toLocaleString(),e.ms===void 0?``:` · answered in ${(e.ms/1e3).toFixed(1)} s`]}),(0,X.jsx)(`dt`,{className:`text-muted`,children:`How`}),(0,X.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,X.jsxs)(X.Fragment,{children:[` · `,(0,X.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.name})]}):null]}),e.why&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted`,children:`The answer`}),(0,X.jsx)(`dd`,{className:`m-0`,children:e.why})]})]}),e.error&&(0,X.jsx)(G,{text:e.error}),Object.entries(e.sample||{}).map(([t,n])=>(0,X.jsx)(U,{title:t===`result`?`Rows found`:t,rows:n,total:e.row_counts?.[t]??n.length},t)),e.sql&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:`The query`}),(0,X.jsx)(q,{label:`SQL`,children:e.sql})]}),e.script_preview?.length?(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:`INSERT script`}),(0,X.jsx)(q,{label:`INSERT script`,children:e.script_preview.join(`
|
|
2
|
+
`)})]}):null,t&&e.name&&(0,X.jsx)(`div`,{children:(0,X.jsxs)(T,{size:`sm`,disabled:n,onClick:()=>i(`fetch`,{name:e.name}),"data-tip":`Fetch again`,children:[(0,X.jsx)(r,{"aria-hidden":`true`}),`Refresh`]})})]})}function $({view:e,log:n,busy:r,act:i}){let[a,o]=(0,Y.useState)(`all`),[c,l]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(``),_=n??[],y=(0,Y.useMemo)(()=>[...new Set(_.map(e=>e.requester))].sort(),[n]),b=(0,Y.useMemo)(()=>[...new Set(_.map(e=>e.database).filter(Boolean))].sort(),[n]),S=_.filter(e=>!e.ok).length,C=_.filter(e=>(a===`all`||a===`ok`===e.ok)&&(!c||e.requester===c)&&(!f||e.database===f)),T=new Set(e.requests.map(e=>e.name));return n===null?(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading the requests…`}):_.length?(0,X.jsx)(P,{label:`Requests`,resetKey:`${a}|${c}|${f}`,minWidth:760,fixed:!0,placeholder:`Find a request`,tools:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D,{value:a,onChange:o,items:[{id:`all`,label:`All`,n:_.length},{id:`ok`,label:`Answered`,n:_.length-S},{id:`failed`,label:`Failed`,n:S,alert:!0}]}),y.length>1&&(0,X.jsxs)(x,{size:`sm`,"aria-label":`Who asked`,value:c,onChange:e=>l(e.target.value),className:`w-[180px]`,children:[(0,X.jsx)(`option`,{value:``,children:`Anyone`}),y.map(e=>(0,X.jsx)(`option`,{children:e},e))]}),b.length>1&&(0,X.jsxs)(x,{size:`sm`,"aria-label":`Database`,value:f,onChange:e=>p(e.target.value),className:`w-[160px]`,children:[(0,X.jsx)(`option`,{value:``,children:`Any database`}),b.map(e=>(0,X.jsx)(`option`,{children:e},e))]})]}),head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:v(L,`w-9`),children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Open`})}),(0,X.jsx)(`th`,{scope:`col`,className:v(L,`w-[110px]`),children:`When`}),(0,X.jsx)(`th`,{scope:`col`,className:v(L,`w-[150px]`),children:`Who asked`}),(0,X.jsx)(`th`,{scope:`col`,className:L,children:`What for`}),(0,X.jsx)(`th`,{scope:`col`,className:v(L,`w-[110px]`),children:`Database`}),(0,X.jsx)(`th`,{scope:`col`,className:v(L,`w-[140px]`),children:`Answer`}),(0,X.jsx)(`th`,{scope:`col`,className:v(N,`w-[70px]`),children:`Rows`})]}),empty:`No requests match these filters. Pick All and Anyone to see every request.`,children:C.map(e=>{let n=h===e.id;return(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsxs)(`tr`,{className:v(F,n&&`bg-surface-muted`),onClick:()=>g(n?``:e.id),children:[(0,X.jsx)(`td`,{className:v(R,`pr-0`),children:(0,X.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-label":n?`Close the request`:`Open the request`,onClick:t=>(t.stopPropagation(),g(n?``:e.id)),className:`flex cursor-pointer items-center border-0 bg-transparent p-0 text-muted`,children:n?(0,X.jsx)(t,{size:16,"aria-hidden":`true`}):(0,X.jsx)(s,{size:16,"aria-hidden":`true`})})}),(0,X.jsx)(`td`,{className:v(R,`whitespace-nowrap text-muted`),"data-tip":new Date(e.at).toLocaleString(),children:I(e.at)}),(0,X.jsx)(`td`,{className:v(R,`truncate`),"data-tip":e.requester,children:e.requester}),(0,X.jsxs)(`td`,{className:v(R,`truncate`),"data-tip":e.need,children:[e.need,e.source===`fetch`?(0,X.jsx)(`span`,{className:`text-muted`,children:` · fetched again`}):null]}),(0,X.jsx)(`td`,{className:v(R,`truncate`),"data-tip":e.database,children:e.database||(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:v(R,`whitespace-nowrap`),children:(0,X.jsx)(E,{tone:e.ok?`pass`:`fail`,children:e.ok?J[e.kind||``]||`Answered`:`Failed`})}),(0,X.jsx)(`td`,{className:M,children:e.ok?ae(e):``})]}),n&&(0,X.jsx)(`tr`,{className:`border-t border-line-soft bg-surface-muted/40`,children:(0,X.jsx)(`td`,{colSpan:7,className:v(`px-4 py-2`,`max-w-0`),children:(0,X.jsx)(oe,{e,kept:!!e.name&&T.has(e.name),busy:r,act:i})})})]},e.id)})}):(0,X.jsx)(O,{icon:u,title:`No test data asked for yet`,action:(0,X.jsxs)(`a`,{href:m(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:v(w({size:`sm`}),`no-underline`),children:[(0,X.jsx)(d,{"aria-hidden":`true`}),`Ask`]}),children:`The agents ask before a test runs, or you can ask yourself.`})}function se({view:e,job:t,busy:n,act:i,onNote:a}){let o=t&&!t.running&&t.kind===`fetch`?t:null,s=o?.result;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.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,X.jsxs)(j,{level:3,icon:r,title:o.target,className:`rounded-[14px] card border p-4`,children:[s&&!s.ok&&(0,X.jsx)(G,{text:s.error||`It could not fetch the data.`}),s?.ok&&(0,X.jsx)(re,{r:s,onNote:a})]}),e.requests.length===0?(0,X.jsxs)(O,{className:`py-4`,children:[`No kept requests yet. Each request Miner answers is kept here; `,(0,X.jsx)(`a`,{href:m(`data`,`ask`,`test-data`),children:`ask for test data`}),` to make the first.`]}):(0,X.jsx)(H,{items:e.requests,text:e=>`${e.need} ${e.name} ${e.database} ${e.requester||``}`,label:`Kept requests`,size:15,children:e=>(0,X.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,X.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium [overflow-wrap:anywhere]`,children:e.need}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-mono`,children:e.name}),` · `,e.database,` · `,J[e.kind],e.rows?` · ${b(e.rows,`row`)}`:``,e.created?` · ${I(e.created)}`:``,e.requester?` · asked by ${e.requester}`:``]})]}),(0,X.jsx)(T,{size:`icon`,variant:`icon`,disabled:n,onClick:()=>i(`fetch`,{name:e.name}),"aria-label":`Fetch ${e.name} again`,"data-tip":`Fetch ${e.name} again`,className:`size-8`,children:(0,X.jsx)(r,{"aria-hidden":`true`})})]},e.name)})]})}function ce({view:e,job:t,busy:n,act:r,onNote:a}){let[o,s]=(0,Y.useState)(e.specs[0]??``),[c,l]=(0,Y.useState)(``),[f,_]=(0,Y.useState)(``),[v,b]=(0,Y.useState)(`csv`),[C,w]=(0,Y.useState)(!1),E={spec:o,...c?{db:c}:{},...f?{seed:f}:{}},D=t&&!t.running?t:null,k=D&&[`gen`,`files`,`insert`].includes(D.kind)&&D.target===o?D.result:void 0,A=e.databases.find(e=>e.name===c),M=async()=>{try{let{id:e}=await y.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=m(`chats`,e)}catch(e){a(e.message)}};return(0,X.jsx)(j,{id:`spec`,icon:u,title:`Make test data from a spec`,actions:(0,X.jsxs)(T,{variant:`ghost`,onClick:()=>void M(),"data-tip":`Write a spec in a chat`,children:[(0,X.jsx)(d,{"aria-hidden":`true`}),`Chat`]}),description:`A spec is a YAML file with tables: and what goes in each column. The same spec and seed make the same data again, so a test or a pipeline can rely on it. No model is used.`,children:e.specs.length===0?(0,X.jsx)(O,{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,X.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-[14px] card border p-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_260px] flex-col gap-2 text-sm font-medium`,children:[`Spec`,(0,X.jsx)(x,{value:o,onChange:e=>s(e.target.value),children:e.specs.map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-2 text-sm font-medium`,children:[`Database`,(0,X.jsxs)(x,{value:c,onChange:e=>l(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`The spec's own`}),e.databases.map(e=>(0,X.jsxs)(`option`,{value:e.name,children:[e.name,e.writable?``:` (read only)`]},e.name))]})]}),(0,X.jsxs)(`label`,{className:`flex w-[120px] flex-col gap-2 text-sm font-medium`,children:[`Seed`,(0,X.jsx)(S,{value:f,inputMode:`numeric`,placeholder:`Random`,onChange:e=>_(e.target.value.replace(/\D/g,``).slice(0,9))})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(T,{variant:C?void 0:`primary`,disabled:n||!o,onClick:()=>r(`gen`,E),children:[(0,X.jsx)(g,{"aria-hidden":`true`}),`Preview`]}),(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,X.jsxs)(T,{disabled:n||!o,onClick:()=>r(`gen`,{...E,mode:`files`,format:v}),"data-tip":`Write files (${v})`,children:[(0,X.jsx)(p,{"aria-hidden":`true`}),`Export`]}),(0,X.jsx)(x,{"aria-label":`File format`,value:v,onChange:e=>b(e.target.value),className:`w-[88px]`,children:[`csv`,`json`,`sql`].map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(T,{disabled:n||!o||!A?.writable,"data-tip":A?.writable?`Insert into ${A.name}`:`Pick a writable database to insert into`,onClick:()=>w(!0),children:[(0,X.jsx)(h,{"aria-hidden":`true`}),`Insert`]})]}),C&&A&&(0,X.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,X.jsxs)(`span`,{className:`font-medium`,children:[`Insert the rows of `,o,` into `,A.name,`?`]}),(0,X.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,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(T,{variant:`primary`,onClick:()=>{w(!1),r(`gen`,{...E,mode:`insert`,confirmed:!0})},children:[(0,X.jsx)(h,{"aria-hidden":`true`}),`Insert`]}),(0,X.jsxs)(T,{onClick:()=>w(!1),"data-tip":`Don't insert`,children:[(0,X.jsx)(i,{"aria-hidden":`true`}),`Cancel`]})]})]}),k&&!k.ok&&(0,X.jsx)(G,{text:k.error||`It did not make the data.`}),k?.ok&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[k.batch&&(0,X.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-4 py-2 text-sm text-pass`,children:[`Inserted as batch `,(0,X.jsx)(`span`,{className:`font-mono text-[13px]`,children:k.batch}),`.`]}),k.files?.length?(0,X.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[`Wrote`,k.files.map(e=>(0,X.jsx)(W,{file:e,onNote:a},e))]}):null,(0,X.jsx)(V,{r:k})]})]})})}function le({view:e,job:t,busy:r,act:i}){let a=e.databases.filter(e=>e.writable),[o,s]=(0,Y.useState)(a[0]?.name??``),[l,u]=(0,Y.useState)(``),d=t&&!t.running?t:null,p=d?.kind===`batches`?(Array.isArray(d.result)?d.result.flatMap(e=>e.batches||[]):d.result?.batches)??[]:null;return(0,X.jsx)(j,{id:`batch`,icon:f,title:`Inserted batches`,description:`Rows inserted from a spec go in as a batch. Remove a batch to take exactly those rows out again, children first.`,children:a.length===0?(0,X.jsx)(O,{className:`py-4`,children:`No writable database: test data is inserted only into one marked writable in Settings, Databases.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(x,{"aria-label":`Database`,value:o,onChange:e=>s(e.target.value),className:`w-[220px]`,children:a.map(e=>(0,X.jsx)(`option`,{children:e.name},e.name))}),(0,X.jsxs)(T,{disabled:r||!o,onClick:()=>i(`batches`,{db:o}),"data-tip":`List batches`,children:[(0,X.jsx)(g,{"aria-hidden":`true`}),`Show`]})]}),p&&p.length===0&&(0,X.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No batches in `,d?.target,`.`]}),p&&p.length>0&&(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:p.map(e=>(0,X.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,X.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.batch}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[(0,X.jsx)(`span`,{"data-tip":new Date(e.created).toLocaleString(),children:I(e.created)}),e.spec?` · ${e.spec}`:``,` ·`,` `,Object.entries(e.rows).map(([e,t])=>`${e} ${t}`).join(`, `)]})]}),l===e.batch?(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`text-[13px] text-warn`,children:[`Remove its rows from `,d?.target,`?`]}),(0,X.jsxs)(T,{variant:`danger`,size:`sm`,onClick:()=>{u(``),i(`clean`,{db:d?.target,batch:e.batch,confirmed:!0})},children:[(0,X.jsx)(n,{"aria-hidden":`true`}),`Remove`]}),(0,X.jsxs)(T,{size:`sm`,onClick:()=>u(``),children:[(0,X.jsx)(c,{"aria-hidden":`true`}),`Keep`]})]}):(0,X.jsx)(T,{size:`icon`,variant:`icon`,disabled:r,onClick:()=>u(e.batch),"aria-label":`Remove batch ${e.batch}`,"data-tip":`Remove batch ${e.batch}`,className:`size-8`,children:(0,X.jsx)(n,{"aria-hidden":`true`})})]},e.batch))}),d?.kind===`clean`&&d.result?.ok&&(0,X.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 ue({sub:e}){let{view:t,error:n,busy:r,act:i,stop:a,job:o}=K(),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(``),f=Z.includes(e)?e:`requests`,p=o&&!o.running?o.endedAt:``;(0,Y.useEffect)(()=>{C.log().then(c,e=>u(e.message))},[p]);let h=(s||[]).filter(e=>!e.ok).length,g=new Set((s||[]).map(e=>e.requester)).size,_={requests:`Requests${s?` (${s.length})`:``}`,kept:`Kept${t?` (${t.requests.length})`:``}`,specs:`Specs${t?` (${t.specs.length})`:``}`,batches:`Batches`};return(0,X.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,X.jsx)(B,{}),(0,X.jsxs)(`main`,{className:v(ee,`@container flex-auto gap-4`),children:[(0,X.jsx)(k,{href:m(`data`,`databases`),label:`All databases`}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,X.jsx)(z,{pixel:A[`test-data`],size:`lg`}),(0,X.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test data`}),t&&(0,X.jsx)(te,{label:`Test data`,className:`mb-0`,current:f,hrefOf:e=>m(`test-data`,e),tabs:Z.map(e=>({id:e,label:_[e],icon:ie[e]}))}),(0,X.jsx)(`span`,{className:`flex-auto`}),(0,X.jsxs)(`a`,{href:m(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:v(w(),`no-underline`),children:[(0,X.jsx)(d,{"aria-hidden":`true`}),`Ask`]})]}),(0,X.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,X.jsxs)(`p`,{className:`m-0 text-sm text-ink-2 tabular-nums`,children:[b(s.length,`request`),` · `,b(g,`asker`),` · `,(0,X.jsxs)(`span`,{className:h?`text-fail`:``,children:[h,` failed`]}),t?` · ${t.requests.length} kept`:``]}),(n||l)&&(0,X.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||l}),!t&&!n&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,X.jsxs)(X.Fragment,{children:[o&&(o.running?Q[o.kind]!==void 0:Q[o.kind]===f)&&(0,X.jsx)(ne,{job:o,onStop:a}),(0,X.jsxs)(`div`,{id:`panel-${f}`,children:[f===`requests`&&(0,X.jsx)($,{view:t,log:s,busy:r,act:i}),f===`kept`&&(0,X.jsx)(se,{view:t,job:o,busy:r,act:i,onNote:u}),f===`specs`&&(0,X.jsx)(ce,{view:t,job:o,busy:r,act:i,onNote:u}),f===`batches`&&(0,X.jsx)(le,{view:t,job:o,busy:r,act:i})]})]})]})]})}export{$ as Requests,ue as TestData};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,Er as n,H as r,Hn as i,I as a,Kr as o,L as s,Or as c,fr as ee,r as l,sn as u,u as d}from"./route-D8G-pTdk.js";import{t as f}from"./jsx-runtime-LKYXHABd.js";import{A as p,X as m,Z as te,n as ne,t as h}from"./input-CK9KiscI.js";import{D as g,E as _,i as v,l as y,n as re}from"./pageBack-CGpBg0rz.js";import{L as b}from"./palette-sQXAx0hh.js";import{F as ie,Ot as x,Xt as S,wn as ae,z as C}from"./index-CeVry7Jo.js";import{_ as w,o as T}from"./qualityParts-Dfn1l_k_.js";var E=e(o(),1),D={view:()=>m(`GET`,`/api/testdebt`),refresh:()=>m(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>m(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},O=f(),k=[`untested`,`signal`,`duplicates`,`cases`],A={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},j={test:`Test`,recording:`Recording`,case:`Test case`},M={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},oe={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=>k.includes(e)?e:`untested`;function P({part:e,what:t,action:r}){return(0,O.jsxs)(y,{icon:n,title:e.state===`empty`?`No ${t} yet`:`${t[0].toUpperCase()}${t.slice(1)}: not connected`,action:(0,O.jsxs)(`a`,{className:g({size:`sm`}),href:r.to,"data-tip":`Open ${r.label}`,children:[(0,O.jsx)(d,{"aria-hidden":`true`}),r.label]}),children:[`To see this list, set `,e.set,`.`]})}function F({text:e,tip:t}){return(0,O.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function I({sub:e}){let[n,o]=(0,E.useState)(null),[f,m]=(0,E.useState)(``),[k,I]=(0,E.useState)(!1),[L,R]=(0,E.useState)(``),z=se(e),[B,V]=(0,E.useState)(`all`),[H,U]=(0,E.useState)(`manual`),[W,G]=(0,E.useState)(``),[K,ce]=(0,E.useState)(``);(0,E.useEffect)(()=>{D.view().then(e=>{o(e),m(``)},e=>m(e.message))},[]);let q=(0,E.useCallback)(async(e,t)=>{I(!0),R(``);try{o(await e()),m(``),t&&R(t)}catch(e){m(e.message)}finally{I(!1)}},[]),le=async e=>{if(e){I(!0);try{let{id:t}=await te.start(e,{});location.hash=l(`chats`,t)}catch(e){m(e.message),I(!1)}}},J=(e,t)=>(0,O.jsx)(_,{size:`icon`,variant:`icon`,className:`size-8`,disabled:k||!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,O.jsx)(ee,{"aria-hidden":`true`})}),Y=n?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],X=W||Y[0]?.id||``,Z=n?.cases.filter(e=>!e.automated).length??0,ue=n?.areas.filter(e=>B===`all`||e.kind===B)??[],de=n?.cases.filter(e=>H===`all`||(H===`manual`?!e.automated:e.automated))??[],Q=`py-2 pr-4 text-right tabular-nums`,$={untested:(n?.areas.length??0)+(n?.rules.length??0),signal:(n?.quiet.length??0)+(n?.gone.length??0),duplicates:n?.duplicates.length??0,cases:Z};return(0,O.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,O.jsx)(C,{}),(0,O.jsxs)(`main`,{className:p(ie,`@container flex-auto gap-4`),children:[(0,O.jsx)(re,{}),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,O.jsx)(ae,{pixel:b[`test-debt`],size:`lg`}),(0,O.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test debt`}),n&&(0,O.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-[13px] text-muted`,children:[(0,O.jsxs)(`span`,{"data-tip":w(n.at),children:[`Worked out `,S(n.at)]}),(0,O.jsxs)(_,{size:`sm`,disabled:k,onClick:()=>void q(D.refresh,`Worked out again.`),children:[(0,O.jsx)(i,{"aria-hidden":`true`}),`Refresh`]})]})]}),(0,O.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,O.jsx)(`a`,{href:l(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,n?.repo&&n.repo!==`.`?(0,O.jsx)(`code`,{className:`font-mono text-[13px]`,children:n.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.`]}),f&&(0,O.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:f}),!n&&!f&&(0,O.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),L&&(0,O.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:L}),n&&(0,O.jsxs)(O.Fragment,{children:[(0,O.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,O.jsx)(T,{label:`Untested code`,value:n.graph.state===`ok`?n.areas.length:`–`,tone:n.areas.length?`text-warn`:void 0,sub:n.graph.state===`ok`?`of ${n.graph.checked} areas`:`graph not built`}),(0,O.jsx)(T,{label:`Untested rules`,value:n.rules.length,tone:n.rules.length?`text-warn`:void 0,sub:`of ${n.graph.rulesChecked} rules`}),(0,O.jsx)(T,{label:`Never fail`,value:n.quiet.length,sub:`30 passes in a row`}),(0,O.jsx)(T,{label:`Code gone`,value:n.gone.length,tone:n.gone.length?`text-fail`:void 0,sub:`of ${n.files.count} files listed`}),(0,O.jsx)(T,{label:`Near-duplicates`,value:n.duplicates.length,sub:`from ${N(n.threshold)} alike`}),(0,O.jsx)(T,{label:`Not automated`,value:Z,tone:Z?`text-warn`:void 0,sub:`of ${n.cases.length} test cases`})]}),(0,O.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,O.jsx)(v,{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)})}),n.notes.map(e=>(0,O.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:e},e)),z===`untested`&&(0,O.jsxs)(O.Fragment,{children:[n.graph.state===`ok`?(0,O.jsx)(x,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:B,empty:n.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,O.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,O.jsx)(v,{items:[{id:`all`,label:`All`,n:n.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${A[e]}s`,n:n.areas.filter(t=>t.kind===e).length}))],value:B,onChange:V})}),head:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[34%]`),children:`Code`}),(0,O.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Kind`}),(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Where`}),(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Used by`}),(0,O.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,O.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:ue.map(e=>(0,O.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,O.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(s,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,O.jsx)(F,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`text-[13px] whitespace-nowrap`),children:A[e.kind]}),(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 font-mono text-[13px] text-ink-2 @xl:table-cell`),children:(0,O.jsx)(F,{text:e.where})}),(0,O.jsx)(`td`,{className:p(Q,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,O.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,A[e.kind].toLowerCase())})]},e.id))}):(0,O.jsx)(P,{part:n.graph,what:`product graph`,action:{label:`Product`,to:l(`product`)}}),(0,O.jsx)(x,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:n.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,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[46%]`),children:`Rule`}),(0,O.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`From`}),(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Where`}),(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Closest test`}),(0,O.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,O.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:n.rules.map(e=>(0,O.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,O.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(s,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,O.jsx)(F,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,O.jsx)(`td`,{className:p(`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,O.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 font-mono text-[13px] text-ink-2 @xl:table-cell`),children:(0,O.jsx)(F,{text:e.where})}),(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:e.nearest?(0,O.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,O.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`rule`)})]},e.id))})]}),z===`signal`&&(n.history.state===`ok`?(0,O.jsxs)(O.Fragment,{children:[(0,O.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,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[50%]`),children:`Test`}),(0,O.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Passes`}),(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Since`}),(0,O.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,O.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:n.quiet.map(e=>(0,O.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,O.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(a,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,O.jsx)(F,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,O.jsx)(`td`,{className:p(Q,`text-muted`),children:e.runs}),(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.since?w(e.since):void 0,children:e.since?S(e.since):`–`}),(0,O.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`test`)})]},e.key))}),(0,O.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 (${n.files.count} files, listed by ${n.files.by===`git`?`git`:`walking the folder`}).`,head:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[40%]`),children:`Test`}),(0,O.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`File`}),(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Last run`}),(0,O.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,O.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:n.gone.map(e=>(0,O.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,O.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(r,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,O.jsx)(F,{text:e.name})]})}),(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0 font-mono text-[13px] text-ink-2`),children:(0,O.jsx)(F,{text:e.file})}),(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.last?w(e.last):void 0,children:e.last?S(e.last):`–`}),(0,O.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`test`)})]},e.key))})]}):(0,O.jsx)(P,{part:n.history,what:`test history`,action:{label:`Regression`,to:l(`regression`)}})),z===`duplicates`&&(0,O.jsx)(x,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,empty:`No two tests, recordings or test cases share ${N(n.threshold)} of their words (${n.compared} pairs compared).`,head:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Alike`}),(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[30%]`),children:`First`}),(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[30%]`),children:`Second`}),(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Shared words`}),(0,O.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,O.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:n.duplicates.map(e=>(0,O.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,O.jsx)(`td`,{className:p(Q,`pl-4`,e.score>=.85?`text-warn`:`text-muted`),children:(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,O.jsx)(t,{size:14,"aria-hidden":`true`}),N(e.score)]})}),[e.a,e.b].map((e,t)=>(0,O.jsxs)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:[(0,O.jsx)(F,{text:e.name,tip:`${j[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,O.jsx)(`span`,{className:`block text-[13px] text-muted`,children:j[e.kind]})]},t)),(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:(0,O.jsx)(F,{text:e.shared.join(`, `)})}),(0,O.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,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,O.jsx)(`span`,{className:`text-[13px] font-medium`,children:`Test management`}),(0,O.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:n.sources.map(e=>(0,O.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,O.jsx)(a,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,O.jsx)(s,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,O.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,O.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,O.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),X&&q(()=>D.readCases(X,K.trim()),`Test cases read.`)},children:[(0,O.jsx)(ne,{size:`sm`,"aria-label":`Source`,value:X,onChange:e=>G(e.target.value),children:Y.map(e=>(0,O.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,O.jsx)(h,{size:`sm`,"aria-label":`Scope`,placeholder:X&&X!==`jira`?oe[X]:``,value:K,maxLength:80,onChange:e=>ce(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,O.jsxs)(_,{size:`sm`,type:`submit`,disabled:k||!K.trim(),"data-tip":`Read the test cases`,children:[(0,O.jsx)(c,{"aria-hidden":`true`}),`Import`]})]}),n.cases.length?(0,O.jsx)(x,{label:`Test cases`,placeholder:`Find a test case by id or title`,resetKey:H,empty:`Nothing matches.`,tools:(0,O.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,O.jsx)(v,{items:[{id:`manual`,label:`Not automated`,n:Z,alert:!0},{id:`automated`,label:`Automated`,n:n.cases.length-Z},{id:`all`,label:`All`,n:n.cases.length}],value:H,onChange:U})}),head:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Case`}),(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[36%]`),children:`Title`}),(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Source`}),(0,O.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Automated`}),(0,O.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Test`}),(0,O.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,O.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:de.map(e=>(0,O.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`font-mono text-[13px] whitespace-nowrap`),children:/^https?:\/\//i.test(e.url)?(0,O.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,O.jsx)(F,{text:e.title||`–`})}),(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap @xl:table-cell`),"data-tip":`From ${e.scope}`,children:M[e.source]}),(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`text-[13px] whitespace-nowrap`),children:(0,O.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,O.jsx)(a,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,O.jsx)(s,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,O.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:e.test?(0,O.jsx)(F,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,O.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,O.jsx)(y,{icon:u,title:`No test cases yet`,action:(0,O.jsxs)(`a`,{className:g({size:`sm`}),href:l(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,O.jsx)(d,{"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};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$n as t,Cr as n,D as r,Er as i,Gn as a,H as o,Hn as s,Hr as c,I as l,J as u,Kr as d,L as f,Ln as p,O as m,Or as h,R as g,U as _,Xn as v,Xt as y,Zn as b,ct as x,en as S,lr as ee,lt as te,mr as ne,n as re,nt as C,on as w,pt as ie,q as T,r as E,sn as D,sr as O,tn as ae,u as oe,v as k,vr as se,w as ce,zr as le}from"./route-D8G-pTdk.js";import{t as ue}from"./jsx-runtime-LKYXHABd.js";import{A,X as j,Z as de,n as M,t as N}from"./input-CK9KiscI.js";import{C as fe,D as P,E as F,c as I,i as pe,l as me,n as he,t as ge}from"./pageBack-CGpBg0rz.js";import{L as _e}from"./palette-sQXAx0hh.js";import{$t as L,At as R,Ft as z,I as ve,It as B,Ln as ye,Mt as V,Ot as H,Pt as be,Rn as xe,Rt as Se,Un as U,Xt as W,d as G,en as Ce,jt as K,kt as q,wn as we,z as Te}from"./index-CeVry7Jo.js";import{_ as Ee}from"./qualityParts-Dfn1l_k_.js";import{t as De}from"./AgentWork-Bjy58QJs.js";var J=e(d(),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`),test:e=>j(`GET`,`/api/testmgmt/test/${encodeURIComponent(e)}`),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})},X={automated:`Automated`,not_automated:`Not automated`,pending:`Pending`,known_defect:`Known defect`,needs_attention:`Needs attention`},Oe={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`},ke={framework:`Listed by its framework`,code:`Read from the code`,runs:`Known from runs`},Ae={passed:`Passed`,failed:`Failed`,blocked:`Blocked`,not_run:`Not run`},Z=ue();function je({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.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:(0,Z.jsx)(Ce,{icon:O,title:e,description: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)(c,{"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 Me({title:e,about:n,looking:r,context:i,suggestions:a,placeholder:o,onClose:s,keys:c}){let[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(``),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(!1),y=async(e,t,n,r,i)=>{m(!0),g(``);try{let{request:a}=await Y.ask(e,t,r,i),{id:o}=await de.start(a,{});u({id:o,said:n}),v(!1),f(``)}catch(e){g(e.message)}finally{m(!1)}};return(0,Z.jsxs)(je,{title:e,about:n,onClose:s,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:a.map(e=>(0,Z.jsxs)(F,{size:`sm`,disabled:p||!!e.disabled,"data-tip":e.disabled??e.label,onClick:()=>void y(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(),d.trim()&&y(`ask`,(c??a[0]?.keys??[]).slice(0,50),d.trim(),d.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:d,placeholder:o,onChange:e=>f(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:p||!d.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,Z.jsx)(t,{"aria-hidden":`true`})})]})]}),children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,Z.jsx)(fe,{state:p||l&&!_?`thinking`:`working`,px:96,label:p?`Starting`:l&&!_?`Working`:`Ready`}),(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:l?_?`Done. Ask again, or open the chat.`:`Working on it…`:r}),i.length>0&&(0,Z.jsx)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:i.map(e=>(0,Z.jsx)(`span`,{className:`rounded-[8px] border border-line bg-bg px-2 text-[13px] text-ink-2`,children:e},e))}),l&&(0,Z.jsx)(`p`,{className:`m-0 text-[16px] leading-relaxed text-ink-2`,children:l.said})]}),h&&(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:h}),l?(0,Z.jsx)(De,{id:l.id,label:`The ${e} at work`,onEnd:()=>v(!0)},l.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:E(`chats`),children:`All chats`}),`.`]})]})}var Ne={automation:`Mark automated in their tracker`,tags:`Write ForgeQE's tags to their tracker`,untag:`Take ForgeQE's tags off in their tracker`},Pe={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.`},Fe=e=>e.system===`azure_devops`?`Azure DevOps plan ${e.plan}`:`Xray Test Set in ${e.project}`,Ie=e=>e.system===`azure_devops`?`ado:${e.plan}`:`xray:${e.project}`,Le=e=>e?.url&&/^https:\/\//i.test(e.url)?e.url:void 0,Re=e=>e.system===`azure_devops`?`Azure DevOps suite ${e.suite} in plan ${e.plan}`:`Xray Test Set ${e.key}`;function ze({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)(l,{size:14,"aria-label":`Written`,className:`flex-none text-pass`}),n.has(e.key)&&(0,Z.jsx)(o,{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 Be(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),d=(0,J.useRef)(!1);return(0,J.useEffect)(()=>{if(e&&d.current||(d.current=!1,i(null),o(null),c(``),!e))return;let t=!0;return e().then(e=>t&&i(e??null),e=>t&&c(e.message)),()=>{t=!1}},[e]),{plan:r,outcome:a,error:s,busy:l,go:async()=>{if(r){u(!0),c(``);try{let e=await t(r.digest);e&&(d.current=!0,o(e),n(`Wrote ${e.done.length}${e.failed.length?`; the tracker refused ${e.failed.length}`:``}.`))}catch(e){c(e.message)}finally{u(!1)}}}}}function Ve({kind:e,keys:t,tags:n,onClose:r,onDone:i}){let[a,o]=(0,J.useState)(null),s=`${t.join(`
|
|
2
|
+
`)}|${(n??[]).join(`
|
|
3
|
+
`)}`;(0,J.useEffect)(()=>o(e?()=>()=>Y.writeBack(e,t,void 0,n).then(e=>e.plan):null),[e,s]);let l=Be(a,r=>Y.writeBack(e,t,r,n).then(e=>e.outcome),i);return(0,Z.jsx)(U,{open:!!e,onClose:r,title:e?Ne[e]:``,description:e?Pe[e]:``,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:r,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),l.outcome?`Close`:`Cancel`]}),!l.outcome&&(0,Z.jsxs)(F,{variant:`primary`,disabled:l.busy||!l.plan?.changes.length,onClick:()=>void l.go(),"data-tip":`Write these changes`,children:[e===`untag`?(0,Z.jsx)(x,{"aria-hidden":`true`}):(0,Z.jsx)(h,{"aria-hidden":`true`}),l.busy?`Writing…`:`${e===`untag`?`Take off`:`Write`} ${l.plan?.changes.length??``}`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[!l.plan&&!l.error&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Working out what would change…`}),l.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:l.error}),l.plan&&(0,Z.jsx)(ze,{plan:l.plan,outcome:l.outcome})]})})}function He({open:e,suite:t,targets:n,onClose:r,onDone:i}){let[a,o]=(0,J.useState)(``),s=t.tracker?void 0:n.find(e=>Ie(e)===(a||(n[0]?Ie(n[0]):``))),[l,u]=(0,J.useState)(null);(0,J.useEffect)(()=>u(e&&(t.tracker||s)?()=>()=>Y.suiteTracker(t.id,s).then(e=>e.plan):null),[e,t.id,t.tracker?Re(t.tracker):``,s&&Ie(s)]);let d=Be(l,e=>Y.suiteTracker(t.id,s,e).then(e=>e.outcome),i),f=t.tracker;return(0,Z.jsx)(U,{open:e,onClose:r,title:f?`Keep ${t.name} in step`:`Keep ${t.name} in a tracker`,description:f?`It is ${Re(f)}. Cases the suite gained are added there, and cases it lost are taken out.`:`The suite is made in the tracker with its cases, so the team sees it there. Later, Keep in step makes it match the suite again.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:r,children:[(0,Z.jsx)(c,{"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)(m,{"aria-hidden":`true`}),d.busy?`Writing…`:f?`Keep in step`:`Make it there`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[!f&&(n.length?(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Where`,(0,Z.jsx)(M,{value:s?Ie(s):``,onChange:e=>o(e.target.value),children:n.map(e=>(0,Z.jsx)(`option`,{value:Ie(e),children:Fe(e)},Ie(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.`})),(f||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)(ze,{plan:d.plan,outcome:d.outcome}),d.outcome&&!d.outcome.failed.length&&(0,Z.jsx)(I,{tone:`pass`,children:`Done`})]})})}var Ue={automated:l,not_automated:f,pending:g,known_defect:i,needs_attention:i},We={passed:`pass`,failed:`fail`,blocked:`warn`,not_run:`neutral`};function Ge({text:e,tip:t,className:n}){return(0,Z.jsx)(`span`,{"data-tip":t??e,className:A(`line-clamp-2 [overflow-wrap:anywhere]`,n),children:e})}function Ke({a:e}){let t=Ue[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`)}),X[e]]})}function Q({o:e}){return(0,Z.jsx)(I,{tone:We[e],icon:e!==`not_run`,children:Ae[e]})}function qe({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 Je({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)(se,{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,(0,Z.jsxs)(`span`,{className:`sr-only`,children:[`: `,e.slice(t).join(`, `)]})]})]}):null}function Ye({label:e,items:t,value:n,onChange:r}){let i=t.find(e=>e.id===n);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(M,{size:`sm`,"aria-label":e,value:n,onChange:e=>r(e.target.value),className:A(`w-auto`,i?.alert&&i.n?`text-fail`:void 0),children:t.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.n===void 0?e.label:`${e.label} (${e.n})`},e.id))}),i?.tip&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:i.tip})]})}function Xe({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 Ze({items:e,series:t,label:n,empty:r}){if(r&&!e.some(e=>e.values.some(e=>e>0)))return(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:r});let i=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/i*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 Qe({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)(Ge,{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 $e({open:e,onClose:t,title:n,preview:r,onStarted:i}){let[a,o]=(0,J.useState)(null),[s,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(null),[f,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(!1);(0,J.useEffect)(()=>{e&&(d(null),m(``),Y.suites().then(e=>{o({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)(()=>{if(!e||a===null)return;let t=!0;return d(null),m(``),r(s||void 0,!1).then(e=>{t&&d(e.preview??null)},e=>t&&m(e.message)),()=>{t=!1}},[e,s,a]);let _=async()=>{g(!0);try{await r(s||void 0,!0),i(),t()}catch(e){m(e.message)}finally{g(!1)}};return(0,Z.jsx)(U,{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)(c,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:h||!u,onClick:()=>void _(),"data-tip":`Start the run`,children:[(0,Z.jsx)(p,{"aria-hidden":`true`}),`Run `,u?u.cases:``]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[a&&a.list.length>0&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Environment`,(0,Z.jsx)(M,{value:s,onChange:e=>l(e.target.value),children:a.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`,`.`]}),f&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:f})]})})}var et=e=>e.lastRun.outcome===`failed`||e.lastRun.outcome===`blocked`,tt=e=>E(`test-management`,`cases`,encodeURIComponent(e)),nt=e=>E(`test-management`,`tests`,encodeURIComponent(e));function rt({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=xe(()=>void f(),3e3);return()=>ye(e)},[n?.busy]),ct(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 m=n.tests,h={all:m.length,unlinked:m.filter(e=>!e.cases.length).length,linked:m.filter(e=>e.cases.length).length,code:m.filter(e=>e.via===`code`).length},g=m.filter(e=>o===`all`||(o===`unlinked`?!e.cases.length:o===`linked`?e.cases.length>0:e.via===`code`)),_=ot(g.map(e=>e.file).filter(e=>!!e)),v=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)(b,{"aria-hidden":`true`}),`Discover`]}),(0,Z.jsxs)(F,{onClick:()=>void v(),disabled:!!n.busy||!m.length,"data-tip":`The mapping agent links cases that have no test to the tests that check them`,children:[(0,Z.jsx)(O,{"aria-hidden":`true`}),`Link`]}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[n.busy?n.busy.what===`discover`?`Discovering tests, started ${W(n.busy.started)}…`:`The mapping agent is at work, started ${W(n.busy.started)}…`:n.discovery?`Discovered ${W(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)(lt,{projects:n.discovery.projects}),(0,Z.jsx)(H,{label:`Automated tests`,placeholder:`Find a test by id, name, file or tag`,resetKey:o,empty:m.length?`No test matches.`:`No automated test found yet. Discover asks each test project's framework (pytest, .NET, Playwright, Vitest, Jest, Mocha, Robot Framework) for its tests; set the automation repository in Settings › Code first.`,tools:(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,Z.jsx)(Ye,{label:`Tests to show`,items:[{id:`all`,label:`All tests`,n:h.all},{id:`unlinked`,label:`No test case`,n:h.unlinked},{id:`linked`,label:`Linked`,n:h.linked},{id:`code`,label:`Read from the code`,n:h.code,tip:`Their framework was not asked, or could not list them`}],value:o,onChange:s}),_&&(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`Files in `,(0,Z.jsx)(`span`,{className:`font-mono`,children:_})]})]}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`w-[45%]`),children:`Test`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @2xl:table-cell`),children:`Framework`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:`Test cases`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @3xl:table-cell`),children:`Tags`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @2xl:table-cell`),children:`Last runs`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:g.map(t=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:A(q,`max-w-0`),children:(0,Z.jsxs)(at,{uid:t.uid,children:[(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t.name}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-x-2 text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`flex-none font-mono text-accent-fg`,children:t.uid??`No id yet`}),t.file&&(0,Z.jsx)(it,{path:t.file.slice(_.length),line:t.line}),t.flaky&&(0,Z.jsx)(I,{tone:`warn`,children:`Flaky`})]})]})}),(0,Z.jsx)(`td`,{className:A(q,`hidden text-[13px] @2xl:table-cell`),children:(0,Z.jsxs)(`span`,{"data-tip":ke[t.via??`runs`],children:[t.framework&&t.framework!==`code`?st[t.framework]:(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not known yet`}),t.framework===`gherkin`?`, ${t.runner??`no runner found`}`:``,(0,Z.jsxs)(`span`,{className:`sr-only`,children:[`, `,ke[t.via??`runs`]]})]})}),(0,Z.jsx)(`td`,{className:A(q,`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:tt(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(q,`hidden @3xl:table-cell`),children:(0,Z.jsx)(Je,{tags:t.tags})}),(0,Z.jsx)(`td`,{className:A(q,`hidden @2xl:table-cell`),children:(0,Z.jsx)(qe,{runs:t.runs})}),(0,Z.jsx)(`td`,{className:A(q,`text-right`),children:(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,onClick:()=>d(t),"aria-label":`Link ${t.name} to a test case`,disabled:!e.length||!t.uid,"data-tip":t.uid?`Link to a test case`:`Known from runs only: Discover gives it an id to link`,children:(0,Z.jsx)(w,{"aria-hidden":`true`})})})]},t.uid??t.key))}),(0,Z.jsx)(ut,{open:c,onClose:()=>l(!1),onStarted:()=>{l(!1),t(`Discovering tests: each project's framework lists its tests.`),f()}}),(0,Z.jsx)(dt,{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())}})]})}function it({path:e,line:t}){let n=e.lastIndexOf(`/`)+1;return(0,Z.jsxs)(`span`,{className:`flex min-w-0 font-mono whitespace-nowrap`,children:[n>0&&(0,Z.jsx)(`span`,{className:`min-w-0 shrink-[999] truncate`,children:e.slice(0,n)}),(0,Z.jsx)(`span`,{className:`min-w-[10ch] truncate`,children:e.slice(n)}),t?`:${t}`:``]})}function at({uid:e,children:t}){let n=`flex min-w-0 flex-col gap-1 text-ink no-underline`;return e?(0,Z.jsx)(`a`,{href:nt(e),className:n,children:t}):(0,Z.jsx)(`span`,{className:n,children:t})}function ot(e){if(!e.length)return``;let t=e[0].split(`/`).slice(0,-1);for(let n of e.slice(1)){let e=n.split(`/`).slice(0,-1),r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];)r++;t=t.slice(0,r)}return t.length?`${t.join(`/`)}/`:``}var st={pytest:`pytest`,dotnet:`.NET`,playwright:`Playwright`,jest:`Jest`,vitest:`Vitest`,mocha:`Mocha`,robot:`Robot Framework`,gherkin:`Gherkin`,code:`Code`};function ct(e,t){let[n,r]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{e?r(!0):n&&(r(!1),t())},[e]),n}function lt({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)(l,{size:14,"aria-label":`Listed`,className:`mt-1 flex-none text-pass`}):(0,Z.jsx)(i,{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 ut({open:e,onClose:t,onStarted:n}){let[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(!1);(0,J.useEffect)(()=>{e&&(i(null),o(``),Y.discoveryPlan().then(i,e=>o(e.message)))},[e]);let l=async()=>{if(r){c(!0);try{await Y.discover(r.digest),n()}catch(e){o(e.message)}finally{c(!1)}}};return(0,Z.jsx)(U,{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 l(),disabled:!r||s,children:[(0,Z.jsx)(p,{"aria-hidden":`true`}),`Discover`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-[13px]`,children:[a&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:a}),!r&&!a&&(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:[st[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 dt({open:e,title:t,description:n,items:r,onClose:i,onPick:a}){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 a(e)}catch(e){c(e.message)}finally{u(``)}};return(0,Z.jsx)(U,{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)(o,{size:14,"aria-hidden":`true`}),s]}),(0,Z.jsx)(H,{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:K,children:`Name`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,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(q,`max-w-0`),children:[(0,Z.jsx)(Ge,{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(q,`w-24 text-right`),children:(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,onClick:()=>void d(e.id),disabled:!!l,"aria-label":`Link ${e.label}`,"data-tip":`Link`,children:(0,Z.jsx)(w,{"aria-hidden":`true`})})})]},e.id))})]})})}var ft=e=>e&&/^https:\/\//i.test(e)?e:void 0;function pt({caseKey:e,onRun:t,onChanged:n=()=>{}}){let[r,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(``);(0,J.useEffect)(()=>{let t=!0;return a(null),s(``),d(``),Y.case(e).then(e=>{t&&(a(e),s(``))},e=>t&&s(e.message)),()=>{t=!1}},[e]);let f=t=>{d(t),n(),Y.case(e).then(a,e=>d(`${t} Reading the case again failed: ${e.message}`))},m=(0,Z.jsx)(ge,{href:E(`test-management`,`cases`),label:`Test cases`});if(o)return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[m,(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:o})]});if(!r)return(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let g=r.case,b=[g.key],ee=ft(g.url);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[m,(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:g.id}),` · `,g.plans.join(`, `)||`Not in a synced plan`]}),(0,Z.jsx)(Ce,{icon:_,title:g.title}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[g.priority&&(0,Z.jsxs)(I,{tone:g.priority===1?`fail`:g.priority===2?`warn`:`neutral`,icon:!1,children:[`Priority `,g.priority]}),g.state&&(0,Z.jsx)(I,{tone:`neutral`,children:g.state}),(0,Z.jsx)(Ke,{a:g.automation}),g.origin===`forgeqe`&&(0,Z.jsxs)(I,{tone:`running`,icon:!1,children:[(0,Z.jsx)(O,{size:12,"aria-hidden":`true`}),`Written by ForgeQE`,g.createdAt?` ${W(g.createdAt)}`:``]})]})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[ee&&(0,Z.jsxs)(`a`,{className:P(),href:ee,target:`_blank`,rel:`noreferrer noopener`,"data-tip":`Open in its system`,children:[(0,Z.jsx)(te,{"aria-hidden":`true`}),`Open`]}),g.how!==`none`&&g.how!==`tracker`&&!!g.test?.file&&g.trackerAutomated!==!0&&(0,Z.jsxs)(F,{onClick:()=>l(`automation`),"data-tip":`Mark it automated in its system`,children:[(0,Z.jsx)(h,{"aria-hidden":`true`}),`Mark automated`]}),g.ownTags.some(e=>!g.trackerTags.includes(e))&&(0,Z.jsxs)(F,{onClick:()=>l(`tags`),"data-tip":`Write ForgeQE's tags to its system`,children:[(0,Z.jsx)(h,{"aria-hidden":`true`}),`Write tags`]}),g.ownTags.some(e=>g.trackerTags.includes(e))&&(0,Z.jsxs)(F,{onClick:()=>l(`untag`),"data-tip":`Take ForgeQE's tags off in its system`,children:[(0,Z.jsx)(x,{"aria-hidden":`true`}),`Untag`]}),(0,Z.jsxs)(F,{variant:`primary`,onClick:()=>t([g.key]),children:[(0,Z.jsx)(p,{"aria-hidden":`true`}),`Run`]})]})]}),(0,Z.jsx)(Ve,{kind:c,keys:b,onClose:()=>l(null),onDone:f}),u&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:u}),(g.stale||g.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)(i,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Z.jsxs)(`span`,{children:[g.stale&&`Its steps changed in its system after its test was written: the next run updates the test. `,g.drift&&(g.trackerAutomated?`Its system marks it automated, but ForgeQE knows no test for it.`:`ForgeQE has a test for it, but its system does not mark it automated.`)]})]}),(0,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)(H,{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(K,`w-10`),children:`#`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:`Action`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:`Expected result`})]}),children:r.steps.map((e,t)=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Z.jsx)(`td`,{className:A(q,`text-[13px] text-muted tabular-nums`),children:t+1}),(0,Z.jsx)(`td`,{className:A(q,`text-[13px] [overflow-wrap:anywhere]`),children:e.action}),(0,Z.jsx)(`td`,{className:A(q,`text-[13px] text-ink-2 [overflow-wrap:anywhere]`),children:e.expected??`–`})]},t))}),(0,Z.jsx)(mt,{detail:r,onChanged:f})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Z.jsx)(L,{level:3,icon:y,title:`Details`,className:`card rounded-[14px] border p-6 text-[13px]`,children:(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)(Q,{o:g.lastRun.outcome}),g.lastRun.at&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[W(g.lastRun.at),g.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:g.suite??`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Area`}),(0,Z.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:g.group??`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Stories`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:g.stories.join(`, `)||`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Tags`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:g.tags.length?(0,Z.jsx)(Je,{tags:g.tags,max:10}):`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Steps`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:g.steps})]})}),(0,Z.jsx)(L,{level:3,icon:S,title:`In suites and packs`,className:`card rounded-[14px] border p-6 text-[13px]`,children:r.suites.length||g.packs.length?(0,Z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[r.suites.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`a`,{href:E(`test-management`,`suites`,e.id),children:e.name})},e.id)),g.packs.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:E(`regression`,e),children:[`Pack `,e]})},e))]}):(0,Z.jsx)(`p`,{className:`m-0 text-muted`,children:`In no suite or regression pack.`})}),r.changes.length>0&&(0,Z.jsx)(L,{level:3,icon:v,title:`What ForgeQE did`,className:`card rounded-[14px] border p-6 text-[13px]`,children:(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:r.changes.map((e,t)=>(0,Z.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:W(e.at)}),` `,e.action,e.story?` for ${e.story}`:``,e.reason?`: ${e.reason}`:``]},t))})})]})]})]})}function mt({detail:e,onChanged:t}){let n=e.case,[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(!1),[s,l]=(0,J.useState)(``);(0,J.useEffect)(()=>{(n.proposed.length||a)&&Y.tests().then(e=>i(e.tests),()=>{})},[n.proposed.length,a]);let d=new Map((r??[]).filter(e=>e.uid).map(e=>[e.uid,e])),f=async(e,r,i)=>{l(``);try{await Y.link([{case:n.key,test:e,action:r}]),t(i)}catch(e){l(e.message)}},p=async e=>{l(``);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){l(e.message)}},h=async()=>{l(``);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){l(e.message)}};return(0,Z.jsxs)(L,{level:3,icon:u,title:`Automated tests`,className:`card rounded-[14px] border p-6`,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{size:`sm`,onClick:()=>o(!0),"data-tip":`Link a test`,children:[(0,Z.jsx)(w,{"aria-hidden":`true`}),`Link`]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>void h(),"data-tip":`The mapping agent picks the tests that check this case`,children:[(0,Z.jsx)(O,{"aria-hidden":`true`}),`Ask`]})]}),children:[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)(I,{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:[Oe[e.how],e.why&&e.why!==Oe[e.how]?`: ${e.why}`:``]})]}),e.uid&&n.tests.length>1&&!e.main&&(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,onClick:()=>void p(e.uid),"aria-label":`Make ${e.name} the main test`,"data-tip":`Make main: its tracker records this one as the case's automated test`,children:(0,Z.jsx)(ne,{"aria-hidden":`true`})}),e.uid&&e.how!==`mapping`&&(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,onClick:()=>void f(e.uid,`unlink`,`Unlinked ${e.uid}. It is not linked again by itself.`),"aria-label":`Unlink ${e.name}`,"data-tip":`Unlink`,children:(0,Z.jsx)(c,{"aria-hidden":`true`})})]},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`?`–`:Oe[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)(qe,{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=d.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.jsx)(F,{size:`icon-sm`,variant:`icon`,onClick:()=>void f(e.test,`accept`,`Linked ${e.test}.`),"aria-label":`Accept ${t?.name??e.test}`,"data-tip":`Accept`,children:(0,Z.jsx)(m,{"aria-hidden":`true`})}),(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,onClick:()=>void f(e.test,`refuse`,`Refused ${e.test}.`),"aria-label":`Refuse ${t?.name??e.test}`,"data-tip":`Refuse`,children:(0,Z.jsx)(c,{"aria-hidden":`true`})})]},e.test)})]}),(0,Z.jsx)(dt,{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 ht=[{id:`all`,label:`All cases`,icon:D,test:()=>!0},{id:`not_automated`,label:`Not automated`,icon:f,test:e=>e.automation===`not_automated`},{id:`failing`,label:`Failing`,icon:o,test:et,alert:!0},{id:`pending`,label:`Pending`,icon:g,test:e=>e.automation===`pending`},{id:`generated`,label:`Generated by ForgeQE`,icon:O,test:e=>e.origin===`forgeqe`},{id:`stale`,label:`Steps changed`,icon:i,test:e=>e.stale},{id:`drift`,label:`Tracker disagrees`,icon:i,test:e=>e.drift}],$=``,gt=e=>[...new Set(e.filter(e=>!!e))].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}));function _t({cases:e,tests:t=0,selected:n,onSelect:r,onRun:i,onChanged:a}){let[o,s]=(0,J.useState)(`all`),[l,u]=(0,J.useState)($),[d,f]=(0,J.useState)($),[m,g]=(0,J.useState)($),[_,v]=(0,J.useState)($),[y,b]=(0,J.useState)(!1),[x,ee]=(0,J.useState)(!1),[te,ne]=(0,J.useState)(null),re=(0,J.useMemo)(()=>gt(e.flatMap(e=>e.plans)),[e]),C=(0,J.useMemo)(()=>gt(e.map(e=>e.suite)),[e]),w=(0,J.useMemo)(()=>gt(e.flatMap(e=>e.tags)),[e]),ie=e.filter(e=>(!l||e.plans.includes(l))&&(!d||e.suite===d)&&(!m||String(e.priority??``)===m)&&(!_||e.tags.includes(_))),T=ht.find(e=>e.id===o),E=ie.filter(T.test),D=new Set(n),ae=(e,t)=>r(t?[...n,e]:n.filter(t=>t!==e)),oe=E.length>0&&E.every(e=>D.has(e.key));return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[n.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:[n.length,` selected`]}),(0,Z.jsxs)(F,{size:`sm`,variant:`ghost`,onClick:()=>r([]),children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Clear`]}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>b(!0),children:[(0,Z.jsx)(se,{"aria-hidden":`true`}),`Tag`]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>ee(!0),"data-tip":`Make a suite of the picked cases`,children:[(0,Z.jsx)(S,{"aria-hidden":`true`}),`Suite`]}),(0,Z.jsxs)(F,{size:`sm`,onClick:()=>ne(`automation`),"data-tip":`Mark the picked cases automated in their tracker`,children:[(0,Z.jsx)(h,{"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)(h,{"aria-hidden":`true`}),`Write tags`]}),(0,Z.jsxs)(F,{size:`sm`,variant:`primary`,onClick:()=>i(n),children:[(0,Z.jsx)(p,{"aria-hidden":`true`}),`Run `,n.length]})]}),(0,Z.jsx)(H,{label:`Test cases`,placeholder:`Find a case by id, title, tag or test`,resetKey:`${o}|${l}|${d}|${m}|${_}`,empty:e.length?`Nothing matches.`:t?`No test cases yet. The repository's ${t} automated test${t===1?` is`:`s are`} on the Automated tab.`:`No test cases yet.`,tools:(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(Ye,{label:`Show`,items:ht.map(e=>({id:e.id,label:e.label,n:ie.filter(e.test).length,...e.alert?{alert:!0}:{}})),value:o,onChange:s}),re.length>1&&(0,Z.jsxs)(M,{size:`sm`,"aria-label":`Plan`,value:l,onChange:e=>u(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Every plan`}),re.map(e=>(0,Z.jsx)(`option`,{children:e},e))]}),C.length>0&&(0,Z.jsxs)(M,{size:`sm`,"aria-label":`Suite`,value:d,onChange:e=>f(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Every suite`}),C.map(e=>(0,Z.jsx)(`option`,{children:e},e))]}),(0,Z.jsxs)(M,{size:`sm`,"aria-label":`Priority`,value:m,onChange:e=>g(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))]}),w.length>0&&(0,Z.jsxs)(M,{size:`sm`,"aria-label":`Tag`,value:_,onChange:e=>v(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Any tag`}),w.map(e=>(0,Z.jsx)(`option`,{children:e},e))]})]}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`w-10`),children:(0,Z.jsx)(G,{"aria-label":`Select every case shown`,checked:oe,onCheckedChange:e=>r(e?gt([...n,...E.map(e=>e.key)]):n.filter(e=>!E.some(t=>t.key===e)))})}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:`Test case`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @2xl:table-cell`),children:`Suite`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @2xl:table-cell`),children:`Priority`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @xl:table-cell`),children:`Automation`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @4xl:table-cell`),children:`Last runs`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @xl:table-cell`),children:`Last run`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:E.map(e=>(0,Z.jsxs)(`tr`,{className:A(`border-t border-line-soft align-top hover:bg-surface-muted`,D.has(e.key)&&`bg-accent-soft hover:bg-accent-soft`),children:[(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsx)(G,{"aria-label":`Select ${e.id}`,checked:D.has(e.key),onCheckedChange:t=>ae(e.key,t)})}),(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsxs)(`a`,{href:tt(e.key),className:`flex min-w-[160px] flex-col gap-1 text-ink no-underline @xl:min-w-[220px]`,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)(O,{size:12,"aria-hidden":`true`}),`ForgeQE`]}),e.stories[0]&&(0,Z.jsx)(`span`,{children:e.stories[0]}),(0,Z.jsx)(Je,{tags:e.tags,max:2})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 @xl:hidden`,children:[(0,Z.jsx)(Ke,{a:e.automation}),(0,Z.jsx)(Q,{o:e.lastRun.outcome})]})]})}),(0,Z.jsx)(`td`,{className:A(q,`hidden min-w-[120px] max-w-[220px] text-[13px] text-ink-2 [overflow-wrap:anywhere] @2xl:table-cell`),children:e.suite??e.plans[0]??`–`}),(0,Z.jsx)(`td`,{className:A(q,`hidden text-[13px] @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Z.jsxs)(`td`,{className:A(q,`hidden @xl:table-cell`),children:[(0,Z.jsx)(Ke,{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(q,`hidden @4xl:table-cell`),children:(0,Z.jsx)(qe,{runs:e.runs})}),(0,Z.jsx)(`td`,{className:A(q,`hidden @xl:table-cell`),children:(0,Z.jsxs)(`span`,{"data-tip":e.lastRun.at?`${W(e.lastRun.at)}${e.lastRun.by===`tracker`?`, in its system`:``}`:void 0,children:[(0,Z.jsx)(Q,{o:e.lastRun.outcome}),e.lastRun.at&&(0,Z.jsxs)(`span`,{className:`sr-only`,children:[`, `,W(e.lastRun.at),e.lastRun.by===`tracker`?`, in its system`:``]})]})}),(0,Z.jsx)(`td`,{className:A(q,`text-right whitespace-nowrap`),children:(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":et(e)?`Run again`:`Run`,onClick:()=>i([e.key]),children:(0,Z.jsx)(p,{"aria-hidden":`true`})})})]},e.key))}),(0,Z.jsx)(Ve,{kind:te,keys:n,onClose:()=>ne(null),onDone:e=>a(e)}),(0,Z.jsx)(vt,{open:y,keys:n,onClose:()=>b(!1),onDone:e=>a(e)}),(0,Z.jsx)(yt,{open:x,keys:n,onClose:()=>ee(!1),onDone:e=>a(e)})]})}function vt({open:e,keys:t,onClose:n,onDone:r}){let[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!1),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(null),h=`${o?`-`:`+`}${i.trim()}|${t.join(`
|
|
4
|
+
`)}`,g=p?.asked===h?p:null;(0,J.useEffect)(()=>{e||m(null)},[e]);let _=async()=>{f(!0),u(``);try{let e={[o?`remove`:`add`]:[i.trim()],cases:t};if(!g){let t=await Y.tag(e);m({asked:h,items:t.preview?.items??0});return}let s=await Y.tag(e,!0);m(null),r(`${o?`Removed`:`Added`} the tag ${i.trim()} ${o?`from`:`on`} ${s.changed??0} case${s.changed===1?``:`s`}.`),a(``),n()}catch(e){u(e.message)}finally{f(!1)}};return(0,Z.jsx)(U,{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)(c,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:d||!i.trim()||!!g&&g.items===0,onClick:()=>void _(),children:[(0,Z.jsx)(se,{"aria-hidden":`true`}),g?`${o?`Remove from`:`Add to`} ${g.items}`:`Preview`]})]}),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)(G,{checked:o,onCheckedChange:s}),`Remove it instead`]}),g&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-ink-2`,children:g.items===0?`No case would change.`:`${g.items} case${g.items===1?``:`s`} would change. ${o?`Remove`:`Add`} to confirm.`}),l&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:l})]})})}function yt({open:e,keys:t,onClose:n,onDone:r}){let[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),d=async()=>{u(!0),s(``);try{let{suite:e}=await Y.saveSuite({name:i.trim(),groups:[],exclude:[],picked:t});r(`Made the suite ${e.name}.`),a(``),n(),location.hash=E(`test-management`,`suites`,e.id)}catch(e){s(e.message)}finally{u(!1)}};return(0,Z.jsx)(U,{open:e,onClose:n,title:`A suite of ${t.length} test case${t.length===1?``:`s`}`,description:`Kept in .forgeqe/testmgmt/suites.json. For a suite that keeps up as plans change, ask the Suite agent on Suites.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(F,{onClick:n,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:l||!i.trim(),onClick:()=>void d(),children:[(0,Z.jsx)(S,{"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:i,maxLength:80,placeholder:`Saved cards`,onChange:e=>a(e.target.value)})]}),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})]})})}var bt=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString([],{month:`short`,day:`numeric`,timeZone:`UTC`}),xt=(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 ${bt(a.day)}`}}function Ct({view:e,onRunSuite:t}){let n=e.summary;if(!n.cases&&!e.plans.length&&n.tests)return(0,Z.jsx)(me,{icon:T,title:`${n.tests} automated test${n.tests===1?``:`s`} found, no test case yet`,action:(0,Z.jsxs)(`a`,{className:P({size:`sm`}),href:E(`test-management`,`tests`),"data-tip":`Open the Automated tab`,children:[(0,Z.jsx)(oe,{"aria-hidden":`true`}),`Tests`]}),children:`These are the tests in the automation repository's code. Add a test plan in Settings › Integrations (Azure DevOps, Xray, TestRail, Zephyr Scale or qTest) to see the test cases they cover, which are automated and which are not.`});if(!n.cases&&!e.plans.length)return(0,Z.jsx)(me,{icon:D,title:`No test plans connected yet`,action:(0,Z.jsxs)(`a`,{className:P({size:`sm`}),href:E(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,Z.jsx)(oe,{"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 i=e.trend;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(B,{label:`Headline numbers`,children:[(0,Z.jsx)(z,{label:`Test cases`,icon:D,value:n.cases,change:St(i,e=>e.cases,void 0),note:`${e.plans.length} plan${e.plans.length===1?``:`s`}`}),(0,Z.jsx)(z,{label:`Automated`,icon:l,value:`${n.automated} · ${xt(n.automated,n.cases)}%`,change:St(i,e=>e.automated,!0),note:`${n.newlyAutomated} newly this week`}),(0,Z.jsx)(z,{label:`Not automated`,icon:f,value:n.notAutomated,change:St(i,e=>e.notAutomated,!1)}),(0,Z.jsx)(z,{label:`Pending`,icon:g,value:n.pending,tone:n.pending?`text-warn`:void 0,change:St(i,e=>e.pending,!1),note:`in Design or not ready`}),(0,Z.jsx)(z,{label:`Failing`,icon:o,value:n.failing,tone:n.failing?`text-fail`:void 0,change:St(i,e=>e.failing,!1),note:`their last run`}),(0,Z.jsx)(z,{label:`Generated by ForgeQE`,icon:O,value:n.generated,change:St(i,e=>e.generated,!0)})]}),(0,Z.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-2`,children:[(0,Z.jsx)(L,{icon:C,title:`Automation coverage`,divider:!1,className:`card rounded-[14px] border p-6`,children:(0,Z.jsx)(Xe,{label:`Share of test cases automated`,points:i.map(e=>({x:bt(e.day),y:xt(e.automated,e.cases)})),format:e=>`${e}%`})}),(0,Z.jsx)(L,{icon:r,title:`Generated and automated, by week`,divider:!1,className:`card rounded-[14px] border p-6`,children:(0,Z.jsx)(Ze,{label:`Test cases generated and automated each week`,empty:`Nothing generated or automated in these weeks yet.`,series:[{name:`Generated`,className:`bg-accent-line`},{name:`Automated`,className:`bg-accent`}],items:e.weekly.map(e=>({x:bt(e.week),values:[e.generated,e.automated]}))})}),(0,Z.jsxs)(L,{icon:p,title:`Last run of every case`,divider:!1,className:`card rounded-[14px] border p-6`,children:[(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:E(`test-management`,`cases`),className:`no-underline`,children:(0,Z.jsxs)(I,{tone:`pass`,children:[`Passed `,n.cases-n.failing-n.neverRun]})}),(0,Z.jsx)(`a`,{href:E(`test-management`,`gaps`),className:`no-underline`,children:(0,Z.jsxs)(I,{tone:`fail`,children:[`Failing `,n.failing]})}),(0,Z.jsx)(`a`,{href:E(`test-management`,`gaps`),className:`no-underline`,children:(0,Z.jsxs)(I,{tone:`neutral`,children:[`Not run `,n.neverRun]})})]})]}),(0,Z.jsx)(L,{icon:S,title:`Automated, by suite`,divider:!1,className:`card rounded-[14px] border p-6`,actions:(0,Z.jsx)(`a`,{href:E(`test-management`,`gaps`),className:`text-[13px]`,children:`Find gaps`}),children:e.coverage.length?e.coverage.slice(0,8).map(e=>(0,Z.jsx)(Qe,{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)(H,{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:K,children:`Suite`}),(0,Z.jsx)(`th`,{scope:`col`,className:V,children:`Cases`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:`Last run`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.suites.map(e=>(0,Z.jsxs)(`tr`,{className:be,onClick:()=>location.hash=E(`test-management`,`suites`,e.id),children:[(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsx)(`a`,{href:E(`test-management`,`suites`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium`,children:e.name})}),(0,Z.jsx)(`td`,{className:R,children:e.cases}),(0,Z.jsx)(`td`,{className:q,children:e.last?(0,Z.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2 text-[13px]`,children:[(0,Z.jsxs)(I,{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:W(e.last.at)})]}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not run`})}),(0,Z.jsxs)(`td`,{className:`${q} 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)(a,{"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)(p,{"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)(T,{size:14,"aria-hidden":`true`}),n.tests,` automated tests known, `,n.testsWithoutCase,` with no test case behind them.`]})]})}var wt=e=>e&&/^https:\/\//i.test(e)?e:void 0;function Tt({id:e,title:t,url:n}){let r=wt(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 Et={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 Dt(e,t){let n={system:e};for(let r of Et[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 Ot=e=>Object.fromEntries(Object.entries(e??{}).filter(([e])=>e!==`system`).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]));function kt({gaps:e,onRead:t}){let[n,r]=(0,J.useState)(e.live?.system??`azure_devops`),[i,a]=(0,J.useState)(Ot(e.live)),[o,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(``);(0,J.useEffect)(()=>{e.live&&(r(e.live.system),a(Ot(e.live)))},[e.live]);let d=async()=>{c(!0),u(``);try{await Y.readStories(Dt(n,i)),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:n,onChange:e=>(r(e.target.value),a({})),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`})]})]}),Et[n].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:i[e.key]??``,maxLength:e.list?2e3:200,placeholder:e.placeholder,onChange:t=>a({...i,[e.key]:t.target.value})})]},e.key)),(0,Z.jsxs)(F,{size:`sm`,variant:`primary`,type:`submit`,disabled:o||!Et[n].some(e=>e.key!==`project`&&(i[e.key]??``).trim()),children:[(0,Z.jsx)(s,{"aria-hidden":`true`}),o?`Reading…`:`Read`]})]}),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 At({kind:e,gaps:t,picked:n=[],onPick:r=()=>{},onRead:i=()=>{}}){let a=(0,Z.jsx)(kt,{gaps:t,onRead:i});if(!t.report)return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a,(0,Z.jsx)(me,{icon:k,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?` ${W(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)(H,{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(K,`w-10`),children:(0,Z.jsx)(G,{"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(K,`w-[55%]`),children:`Story`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @2xl:table-cell`),children:`Type`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:`State`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`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:q,children:(0,Z.jsx)(G,{"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:q,children:(0,Z.jsx)(Tt,{id:e.id,title:e.title,url:e.url})}),(0,Z.jsx)(`td`,{className:A(q,`hidden text-[13px] @2xl:table-cell`),children:e.type||`–`}),(0,Z.jsx)(`td`,{className:q,children:e.state?(0,Z.jsx)(I,{tone:`neutral`,icon:!1,children:e.state}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})}),(0,Z.jsx)(`td`,{className:A(q,`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)(H,{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(K,`w-[55%]`),children:`Criterion`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,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(q,`[overflow-wrap:anywhere]`),children:e.text}),(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsx)(Tt,{id:e.story,title:e.storyTitle,url:e.url})})]},`${e.story}-${t}`))})]})}var jt=[{id:`stories`,label:`Stories with no case`,icon:k},{id:`criteria`,label:`Criteria not covered`,icon:D}],Mt=[{id:`not_automated`,label:`Not automated`,icon:f},{id:`pending`,label:`Pending`,icon:g},{id:`never_run`,label:`Never run`,icon:f},{id:`failing`,label:`Failing`,icon:o,alert:!0},{id:`stale`,label:`Steps changed`,icon:i},{id:`drift`,label:`Tracker disagrees`,icon:i},{id:`no_case`,label:`Tests with no case`,icon:T}];function Nt({gaps:e,cases:t,tests:n,selected:r,onSelect:i,onRun:a,pickedStories:o=[],onPickStories:s=()=>{},onStoriesRead:c=()=>{}}){let[l,u]=(0,J.useState)(t.length||!n.length?`not_automated`:`no_case`),d=new Map(t.map(e=>[e.key,e])),f=new Map(e.ranked.map(e=>[e.key,e.why])),m=e.ranked.map(e=>e.key),h=new Set(m),g=l===`no_case`||l===`stories`||l===`criteria`?[]:l===`not_automated`?[...m,...e.lists.not_automated.filter(e=>!h.has(e))]:e.lists[l],_=e.stories??{stories:0,noCase:[],criteria:[]},v={stories:_.noCase.length,criteria:_.criteria.length},y=g.map(e=>d.get(e)).filter(e=>!!e),b=new Set(r),x=(e,t)=>i(t?[...r,e]:r.filter(t=>t!==e)),S=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(Ye,{label:`Gaps to show`,items:[...Mt.map(t=>({id:t.id,label:t.label,n:e.counts[t.id],...t.alert?{alert:!0}:{}})),...jt.map(e=>({id:e.id,label:e.label,n:v[e.id],tip:_.report?_.report.id===`live`?`Read from the tracker: ${_.report.scope}`:`From the readiness report of ${_.report.scope||_.report.id}`:`Read the release's stories from the tracker first`}))],value:l,onChange:e=>u(e)}),l===`not_automated`&&y.length>0&&(0,Z.jsxs)(F,{size:`sm`,onClick:()=>i(y.slice(0,20).map(e=>e.key)),"data-tip":`Pick the 20 that matter most: priority, failing when run, in a pack, tagged smoke`,children:[(0,Z.jsx)(D,{"aria-hidden":`true`}),`Top 20`]})]});return(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:l===`stories`||l===`criteria`?(0,Z.jsxs)(Z.Fragment,{children:[S,(0,Z.jsx)(At,{kind:l,gaps:_,picked:o,onPick:s,onRead:c})]}):l===`no_case`?(0,Z.jsx)(H,{label:`Tests with no test case`,placeholder:`Find a test`,empty:`Every test ForgeQE knows has a test case behind it.`,tools:S,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`w-[55%]`),children:`Test`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:`Tags`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,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:q,children:[t.uid?(0,Z.jsx)(`a`,{href:nt(t.uid),className:`font-medium [overflow-wrap:anywhere]`,children:t.name}):(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t.name}),t.file&&(0,Z.jsx)(`span`,{className:`block font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:t.file}),t.flaky&&(0,Z.jsx)(I,{tone:`warn`,className:`mt-1`,children:`Flaky`})]}),(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsx)(Je,{tags:t.tags})}),(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsx)(qe,{runs:t.runs})})]},e):null})}):(0,Z.jsx)(H,{label:Mt.find(e=>e.id===l).label,placeholder:`Find a case`,resetKey:l,empty:`No gap of this kind.`,tools:S,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`w-10`),children:(0,Z.jsx)(G,{"aria-label":`Select every case shown`,checked:y.length>0&&y.every(e=>b.has(e.key)),onCheckedChange:e=>i(e?[...new Set([...r,...y.map(e=>e.key)])]:r.filter(e=>!y.some(t=>t.key===e)))})}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:`Test case`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @2xl:table-cell`),children:`Priority`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @xl:table-cell`),children:l===`not_automated`?`Why it matters`:`Automation`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @2xl:table-cell`),children:`Last run`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:y.map(e=>(0,Z.jsxs)(`tr`,{className:A(`border-t border-line-soft align-top hover:bg-surface-muted`,b.has(e.key)&&`bg-accent-soft hover:bg-accent-soft`),children:[(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsx)(G,{"aria-label":`Select ${e.id}`,checked:b.has(e.key),onCheckedChange:t=>x(e.key,t)})}),(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsxs)(`a`,{href:tt(e.key),className:`flex min-w-[160px] flex-col gap-1 text-ink no-underline @xl:min-w-[220px]`,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)(Je,{tags:e.tags,max:2})]}),(0,Z.jsx)(`span`,{className:`flex flex-wrap items-center gap-1 @xl:hidden`,children:l===`not_automated`?(f.get(e.key)??[]).map(e=>(0,Z.jsx)(I,{tone:`running`,icon:!1,children:e},e)):(0,Z.jsx)(Ke,{a:e.automation})})]})}),(0,Z.jsx)(`td`,{className:A(q,`hidden text-[13px] @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Z.jsx)(`td`,{className:A(q,`hidden @xl:table-cell`),children:l===`not_automated`?(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-1`,children:[(f.get(e.key)??[]).map(e=>(0,Z.jsx)(I,{tone:`running`,icon:!1,children:e},e)),!(f.get(e.key)??[]).length&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})]}):(0,Z.jsx)(Ke,{a:e.automation})}),(0,Z.jsx)(`td`,{className:A(q,`hidden @2xl:table-cell`),children:(0,Z.jsx)(Q,{o:e.lastRun.outcome})}),(0,Z.jsx)(`td`,{className:A(q,`text-right`),children:(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":`Run`,onClick:()=>a([e.key]),children:(0,Z.jsx)(p,{"aria-hidden":`true`})})})]},e.key))})})}var Pt=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)`,Ft={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 It({suites:e,onRun:t}){return(0,Z.jsx)(H,{label:`Suites`,placeholder:`Find a suite`,empty:e.length?`Nothing matches.`:`No suites yet. Tell the Suite agent what a suite is for, such as “regression for the payments suite, P1 and anything failing lately”: it picks the cases from your plans, tags and runs.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`w-[40%]`),children:`Suite`}),(0,Z.jsx)(`th`,{scope:`col`,className:V,children:`Cases`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(V,`hidden @xl:table-cell`),children:`Automated`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:`Last run`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.map(e=>(0,Z.jsxs)(`tr`,{className:be,onClick:()=>location.hash=E(`test-management`,`suites`,e.id),children:[(0,Z.jsxs)(`td`,{className:A(q,`max-w-0`),children:[(0,Z.jsxs)(`a`,{href:E(`test-management`,`suites`,e.id),onClick:e=>e.stopPropagation(),className:`flex items-center gap-2 font-medium`,children:[e.built===`agent`?(0,Z.jsx)(O,{size:14,"aria-hidden":`true`,className:`flex-none`}):(0,Z.jsx)(S,{size:14,"aria-hidden":`true`,className:`flex-none`}),(0,Z.jsx)(Ge,{text:e.name})]}),e.description&&(0,Z.jsx)(Ge,{text:e.description,className:`mt-1 text-[13px] text-muted`})]}),(0,Z.jsx)(`td`,{className:R,children:e.cases}),(0,Z.jsxs)(`td`,{className:A(R,`hidden @xl:table-cell`),children:[e.cases?Math.round(e.automated/e.cases*100):0,`%`]}),(0,Z.jsx)(`td`,{className:q,children:e.last?(0,Z.jsxs)(`span`,{className:`flex flex-col items-start gap-1 text-[13px]`,"data-tip":Pt(e.last),children:[(0,Z.jsxs)(I,{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:W(e.last.at)})]}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not run`})}),(0,Z.jsxs)(`td`,{className:A(q,`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)(a,{"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)(p,{"aria-hidden":`true`})})]})]},e.id))})}function Lt({id:e,onRun:t,onDeleted:r}){let[i,o]=(0,J.useState)(null),[s,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(!1),[f,m]=(0,J.useState)(!1);(0,J.useEffect)(()=>{o(null),Y.suite(e).then(e=>{o(e),l(``)},e=>l(e.message))},[e]);let g=(0,Z.jsx)(ge,{href:E(`test-management`,`suites`),label:`All suites`});if(s)return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[g,(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(!i)return(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let _=i.suite,v=i.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:[g,(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)(Ce,{icon:S,title:_.name}),_.description&&(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:_.description}),_.tracker&&(0,Z.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[`Kept as`,` `,Le(_.tracker)?(0,Z.jsx)(`a`,{href:Le(_.tracker),target:`_blank`,rel:`noreferrer noopener`,children:Re(_.tracker)}):Re(_.tracker)]})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(_.tracker||i.targets.length>0)&&(0,Z.jsxs)(F,{onClick:()=>m(!0),"data-tip":_.tracker?`Keep it in step with its tracker`:`Keep it in a tracker`,children:[(0,Z.jsx)(h,{"aria-hidden":`true`}),_.tracker?`Update`:`Keep`]}),(0,Z.jsxs)(F,{variant:`danger`,onClick:()=>d(!0),children:[(0,Z.jsx)(n,{"aria-hidden":`true`}),`Delete`]}),v>0&&(0,Z.jsxs)(F,{onClick:()=>t(_.id,`failed`),children:[(0,Z.jsx)(a,{"aria-hidden":`true`}),`Rerun `,v,` failed`]}),(0,Z.jsxs)(F,{variant:`primary`,onClick:()=>t(_.id),children:[(0,Z.jsx)(p,{"aria-hidden":`true`}),`Run`]})]})]}),(0,Z.jsxs)(B,{label:`The suite`,children:[(0,Z.jsx)(z,{compact:!0,label:`Cases`,value:_.cases,note:`${_.automated} automated`}),(0,Z.jsx)(z,{compact:!0,label:`Last run`,value:_.last?`${_.last.passed} passed`:`Not run`,tone:_.last?.failed?`text-fail`:void 0,note:_.last?`${_.last.failed} failed · ${W(_.last.at)}${_.last.from===`report`?``:` · so far`}`:void 0}),(0,Z.jsx)(z,{compact:!0,label:`Runs on`,value:_.env??`Active`,note:_.runs.length?`${_.runs.length} run${_.runs.length===1?``:`s`}`:`never run`}),(0,Z.jsx)(z,{compact:!0,label:`Built`,value:_.built===`agent`?`Suite agent`:_.built===`rules`?`Rules`:`Picked`,note:`updated ${W(_.updatedAt)}`})]}),_.groupsCount.length>0&&(0,Z.jsx)(L,{level:3,icon:ie,title:`Why these cases`,className:`card rounded-[14px] border p-6 text-[13px]`,children:(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:_.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:_.groups[t]?.rules.map(e=>`${Ft[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)(H,{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(K,`w-[45%]`),children:`Test case`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @xl:table-cell`),children:`Why it is in`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:`Automation`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:`Last run`})]}),children:i.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(q,`max-w-0`),children:(0,Z.jsxs)(`a`,{href:tt(e.case.key),className:`flex min-w-0 flex-col gap-1 text-ink no-underline`,children:[(0,Z.jsx)(Ge,{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)(Je,{tags:e.case.tags})]})]})}),(0,Z.jsx)(`td`,{className:A(q,`hidden text-[13px] text-ink-2 @xl:table-cell`),children:e.group}),(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsx)(Ke,{a:e.case.automation})}),(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsx)(Q,{o:e.case.lastRun.outcome})})]},e.case.key))}),(0,Z.jsx)(He,{open:f,suite:_,targets:i.targets,onClose:()=>m(!1),onDone:()=>void Y.suite(e).then(o,()=>{})}),(0,Z.jsx)(U,{open:u,onClose:()=>d(!1),title:`Delete ${_.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:()=>d(!1),children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`destructive`,onClick:()=>void Y.deleteSuite(_.id).then(()=>{d(!1),r()},e=>l(e.message)),children:[(0,Z.jsx)(n,{"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 Rt({open:e,onSaved:n}){let[r,i]=(0,J.useState)([]),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(``),d=r.findLast(e=>`built`in e)?.built,f=r.filter(e=>`you`in e).map(e=>e.you).join(`. `),p=async t=>{let n=t.trim();if(n){c(!0),u(``),i(e=>[...e,{you:n}]),o(``);try{let t=await Y.buildSuite(f?`${f}. ${n}`:n,e?.id);i(e=>[...e,{built:t}])}catch(e){u(e.message)}finally{c(!1)}}},h=async t=>{if(d){c(!0);try{let{suite:r}=await Y.saveSuite({...t&&e?{id:e.id}:{},name:t&&e?e.name:d.name,description:d.summary,groups:d.groups,exclude:d.exclude,built:`agent`});i([]),n(r)}catch(e){u(e.message)}finally{c(!1)}}};return(0,Z.jsxs)(je,{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.jsxs)(F,{size:`sm`,disabled:s,onClick:()=>void p(e),children:[(0,Z.jsx)(O,{"aria-hidden":`true`}),e]},e))}),(0,Z.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),p(a)},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:a,placeholder:e?`Change ${e.name}, or ask about it`:`Describe the suite you need, e.g. regression for Payments under 30 minutes`,onChange:e=>o(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:s||!a.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,Z.jsx)(t,{"aria-hidden":`true`})})]})]}),children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,Z.jsx)(fe,{state:s?`thinking`:`working`,px:96,label:s?`Building the suite`:`Ready`}),(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:s?`Building the suite…`:e?`Looking at ${e.name}.`:`Ready. Say what the suite is for.`})]}),r.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=>`${Ft[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(`, `)]})]}),e.built.question&&t===r.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:s,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)(Ge,{text:e.case.title,className:`min-w-0 text-ink-2`})]},e.case.key))})]},t)),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}),d&&(0,Z.jsxs)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:[e&&(0,Z.jsxs)(F,{disabled:s,onClick:()=>void h(!0),children:[(0,Z.jsx)(m,{"aria-hidden":`true`}),`Update `,e.name]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:s,onClick:()=>void h(!1),"data-tip":e?`Save as a new suite`:`Save the suite`,children:[(0,Z.jsx)(m,{"aria-hidden":`true`}),e?`Save new`:`Save`]})]})]})}var zt=[{id:`off`,label:`Off`,icon:f},{id:`hourly`,label:`Every hour`,icon:s},{id:`daily`,label:`Daily`,icon:ce}];function Bt(e){return!e||e.every===`off`?`Sync: off`:e.every===`hourly`?`Sync: hourly`:e.every===`daily`?`Sync: daily ${e.at}`:`Sync: custom`}function Vt({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.jsx)(F,{size:`icon`,"aria-label":`Schedule`,disabled:e,onClick:()=>n(!0),"data-tip":`Schedule: ${Bt(r)}${r?.nextAt?`, next ${Ee(r.nextAt)}`:``}. Set when the plans are synced`,children:(0,Z.jsx)(ce,{"aria-hidden":`true`})}),(0,Z.jsx)(Wt,{open:t,onClose:()=>n(!1),now:r,onSaved:i})]})}var Ht=(e,t)=>!!e&&!!t&&e===t.digest&&t.steps.length>0,Ut=(e,t,n)=>e!==`off`&&t&&n&&n.steps.length>0?n.digest:void 0;function Wt({open:e,onClose:t,now:n,onSaved:r}){let[i,a]=(0,J.useState)(`off`),[o,s]=(0,J.useState)(`06:00`),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,h]=(0,J.useState)(null),[g,_]=(0,J.useState)(`loading`),[v,y]=(0,J.useState)(!1),b=n&&n.every!==`off`&&n.every!==`custom`?n.discover:void 0;(0,J.useEffect)(()=>{e&&(u(``),y(!1),h(null),_(`loading`),Y.discoveryPlan().then(e=>{h(e),_(`ready`),y(Ht(b,e))},()=>_(`failed`)),a(n&&n.every!==`custom`?n.every:`off`),n?.every===`daily`&&s(n.at))},[e,n]);let x=async()=>{f(!0);try{let e=Ut(i,v,p),n=e?{discover:e}:{};r((await Y.setSchedule(i===`daily`?{every:i,at:o,...n}:i===`hourly`?{every:i,...n}:{every:i})).schedule),t()}catch(e){u(e.message)}finally{f(!1)}};return(0,Z.jsx)(U,{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)(c,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{variant:`primary`,disabled:d||g===`loading`||i===`daily`&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(o),onClick:()=>void x(),children:[(0,Z.jsx)(m,{"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)(pe,{items:zt.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`&&p&&p.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)(G,{checked:v,onCheckedChange:e=>y(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.`})]}),!!b&&b!==p.digest&&!v&&(0,Z.jsx)(`p`,{className:`m-0 text-warn`,children:`The test projects changed since discovery was agreed to: tick the box to agree to these commands, or the schedule only syncs.`}),v&&(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:p.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))})]}),i!==`off`&&g===`loading`&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Reading what discovery would run…`}),i!==`off`&&g===`failed`&&!!b&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 text-warn`,children:`What discovery would run could not be read, so saving here turns scheduled discovery off. Close and open this again to try once more.`}),n?.every===`custom`&&(0,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 `,Ee(n.last.at),`: `,n.last.status.replace(`_`,` `),`.`]}),l&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:l})]})})}var Gt={forgeqe:{label:`ForgeQE`,icon:O},script:{label:`Tests`,icon:T}},Kt=e=>Gt[e]??{label:e===`azure_devops`?`Azure DevOps`:e===`jira`?`Jira`:e,icon:le},qt=e=>e!==`forgeqe`&&e!==`script`,Jt=[];function Yt({tags:e,cases:t=[],onChanged:n}){let[r,i]=(0,J.useState)(`all`),[a,o]=(0,J.useState)(null),s=e=>e.system===`azure_devops`||e.system===`jira`,c=e=>t.filter(t=>t.ownTags.includes(e)&&!t.trackerTags.includes(e)&&s(t)).map(e=>e.key),l=e=>t.filter(t=>t.ownTags.includes(e)&&t.trackerTags.includes(e)&&s(t)).map(e=>e.key),u=e.tags.filter(e=>r===`all`||(r===`out`?e.outOfStep>0:r===`tracker`?e.from.some(qt):e.from.includes(r))),d=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(`p`,{className:`m-0 flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.tags.length}),` tag`,e.tags.length===1?``:`s`,` in use`]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`b`,{className:`text-ink tabular-nums`,children:d(e.casesTagged,e.cases)}),` of test cases tagged (`,e.casesTagged,` of `,e.cases,`)`]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`b`,{className:`text-ink tabular-nums`,children:d(e.testsTagged,e.tests)}),` of tests tagged (`,e.testsTagged,` of `,e.tests,`)`]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`b`,{className:A(`tabular-nums`,e.tags.some(e=>e.outOfStep)?`text-warn`:`text-ink`),children:e.tags.filter(e=>e.outOfStep).length}),` out of step (a case's tag its test lacks)`]})]}),(0,Z.jsx)(H,{label:`Tags`,placeholder:`Find a tag`,resetKey:r,empty:e.tags.length?`Nothing matches.`:`No tags yet: tag cases in Test cases, or in their system.`,tools:(0,Z.jsx)(Ye,{label:`Tags to show`,items:[{id:`all`,label:`All tags`,n:e.tags.length},{id:`tracker`,label:`From their systems`,n:e.tags.filter(e=>e.from.some(qt)).length},{id:`script`,label:`From tests`,n:e.tags.filter(e=>e.from.includes(`script`)).length},{id:`forgeqe`,label:`ForgeQE's`,n:e.tags.filter(e=>e.from.includes(`forgeqe`)).length},{id:`out`,label:`Out of step`,n:e.tags.filter(e=>e.outOfStep).length,alert:!0}],value:r,onChange:i}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`w-[28%]`),children:`Tag`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:`Comes from`}),(0,Z.jsx)(`th`,{scope:`col`,className:V,children:`Test cases`}),(0,Z.jsx)(`th`,{scope:`col`,className:V,children:`Tests`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @xl:table-cell`),children:`Out of step`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @2xl:table-cell`),children:`Used by suites`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:u.map(e=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:q,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)(se,{size:12,"aria-hidden":`true`}),e.name]})}),(0,Z.jsx)(`td`,{className:q,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:R,children:e.cases}),(0,Z.jsx)(`td`,{className:R,children:e.tests}),(0,Z.jsx)(`td`,{className:A(q,`hidden @xl:table-cell`),children:e.outOfStep?(0,Z.jsx)(I,{tone:`warn`,children:e.outOfStep}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})}),(0,Z.jsx)(`td`,{className:A(q,`hidden text-[13px] text-ink-2 @2xl:table-cell`),children:e.suites.join(`, `)||`–`}),(0,Z.jsxs)(`td`,{className:A(q,`text-right`),children:[c(e.name).length>0&&(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,"aria-label":`Write the tag ${e.name} to the trackers of ${c(e.name).length} cases`,"data-tip":`Write to the trackers of ${c(e.name).length} cases`,onClick:()=>o({kind:`tags`,keys:c(e.name)}),children:(0,Z.jsx)(h,{"aria-hidden":`true`})}),l(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 ${l(e.name).length} cases`,"data-tip":`Take off in the trackers of ${l(e.name).length} cases`,onClick:()=>o({kind:`untag`,keys:l(e.name),tags:[e.name]}),children:(0,Z.jsx)(x,{"aria-hidden":`true`})})]})]},e.name))}),(0,Z.jsx)(Ve,{kind:a?.kind??null,keys:a?.keys??Jt,tags:a?.tags,onClose:()=>o(null),onDone:e=>n?.(e)})]})}function Xt({uid:e,cases:t,onChanged:n}){let[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(``),[s,l]=(0,J.useState)(!1),[d,f]=(0,J.useState)(``),[p,m]=(0,J.useState)(``),h=(0,J.useCallback)(()=>Y.test(e).then(e=>{i(e),o(``)},e=>o(e.message)),[e]);(0,J.useEffect)(()=>{i(null),h()},[h]);let g=(0,Z.jsx)(ge,{href:E(`test-management`,`tests`),label:`Automated tests`});if(a)return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[g,(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:a})]});if(!r)return(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let _=r.test,v=_.framework&&_.framework!==`code`?st[_.framework]:`Not known yet`,b=e=>{m(``),f(e),n(e),h()},x=async(t,n)=>{try{await Y.link([{case:t,test:e,action:`unlink`}]),b(`Unlinked ${e} from ${n}. It is not linked again by itself.`)}catch(e){m(e.message)}};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[g,(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:_.uid}),` · `,v]}),(0,Z.jsx)(Ce,{icon:u,title:_.name}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[_.last&&(0,Z.jsx)(Zt,{status:_.last.status}),_.flaky&&(0,Z.jsx)(I,{tone:`warn`,children:`Flaky`}),_.quarantined&&(0,Z.jsx)(I,{tone:`neutral`,children:`Quarantined`})]})]}),(0,Z.jsx)(`span`,{className:`flex flex-wrap gap-2`,children:(0,Z.jsxs)(F,{onClick:()=>l(!0),disabled:!t.length,"data-tip":`Link to a test case`,children:[(0,Z.jsx)(w,{"aria-hidden":`true`}),`Link`]})})]}),d&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:d}),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}),(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.jsxs)(L,{level:3,icon:u,title:`Code`,className:`card rounded-[14px] border p-6 text-[13px]`,children:[_.file&&(0,Z.jsxs)(`span`,{className:`font-mono text-muted [overflow-wrap:anywhere]`,children:[_.file,_.line?`:${_.line}`:``]}),r.source?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`pre`,{tabIndex:0,role:`region`,"aria-label":`Code of ${_.name}`,className:`m-0 focus-visible:outline-offset-[-2px] max-h-[560px] overflow-auto rounded-[10px] bg-surface-strong py-2 font-mono text-[13px] leading-[1.5]`,children:r.source.lines.map((e,t)=>{let n=r.source.from+t;return(0,Z.jsxs)(`span`,{className:A(`flex`,n===_.line&&`bg-accent-soft`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`w-12 flex-none pr-4 text-right text-muted tabular-nums select-none`,children:n}),(0,Z.jsx)(`span`,{className:`pr-4 whitespace-pre`,children:e})]},n)})}),r.source.more&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[`Lines `,r.source.from,`–`,r.source.from+r.source.lines.length-1,` of `,r.source.total,`.`]})]}):(0,Z.jsx)(`p`,{className:`m-0 text-muted`,children:_.file?`Its file could not be read from the repository.`:`Known from runs only: no file is known for it.`})]}),(0,Z.jsx)(H,{label:`Linked test cases`,search:!1,empty:`Linked to no test case yet. Link it to the case it checks.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:K,children:`Test case`}),(0,Z.jsx)(`th`,{scope:`col`,className:A(K,`hidden @2xl:table-cell`),children:`Automation`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:`Last run`}),(0,Z.jsx)(`th`,{scope:`col`,className:K,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:r.cases.map(e=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsxs)(`a`,{href:tt(e.key),className:`flex flex-col gap-1 text-ink no-underline`,children:[(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Z.jsx)(`span`,{className:`font-mono text-[13px] text-accent-fg`,children:e.id})]})}),(0,Z.jsx)(`td`,{className:A(q,`hidden @2xl:table-cell`),children:(0,Z.jsx)(Ke,{a:e.automation})}),(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsx)(Q,{o:e.lastRun.outcome})}),(0,Z.jsx)(`td`,{className:A(q,`text-right`),children:e.how!==`mapping`&&(0,Z.jsx)(F,{size:`icon-sm`,variant:`icon`,onClick:()=>void x(e.key,e.id),"aria-label":`Unlink ${e.id}`,"data-tip":`Unlink`,children:(0,Z.jsx)(c,{"aria-hidden":`true`})})})]},e.key))})]}),(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:(0,Z.jsx)(L,{level:3,icon:y,title:`Details`,className:`card rounded-[14px] border p-6 text-[13px]`,children:(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:`Framework`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[v,_.framework===`gherkin`?`, ${_.runner??`no runner found`}`:``]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Found`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:ke[_.via??`runs`]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Its own id`}),(0,Z.jsx)(`dd`,{className:`m-0 font-mono [overflow-wrap:anywhere]`,children:_.nativeId??`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Last run`}),(0,Z.jsx)(`dd`,{className:`m-0 flex flex-wrap items-center gap-2`,children:_.last?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Zt,{status:_.last.status}),(0,Z.jsx)(`span`,{className:`text-muted`,children:W(_.last.at)})]}):(0,Z.jsx)(Q,{o:`not_run`})}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Last runs`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:(0,Z.jsx)(qe,{runs:_.runs})}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Tags`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:_.tags.length?(0,Z.jsx)(Je,{tags:_.tags,max:10}):`–`})]})})})]}),(0,Z.jsx)(dt,{open:s,title:`Link to a test case`,description:`Pick the test case ${_.name} checks. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`,items:t.filter(e=>!_.cases.includes(e.key)).map(e=>({id:e.key,label:e.title,sub:e.id})),onClose:()=>l(!1),onPick:async n=>{await Y.link([{case:n,test:e,action:`link`}]),l(!1),b(`Linked ${e} to ${t.find(e=>e.key===n)?.id??n}.`)}})]})}function Zt({status:e}){return e===`skipped`?(0,Z.jsx)(I,{tone:`neutral`,children:`Skipped`}):(0,Z.jsx)(Q,{o:e})}var Qt=[`dashboard`,`cases`,`tests`,`gaps`,`suites`,`tags`];function $t({sub:e}){let t=(e??``).split(`/`).filter(Boolean),n=Qt.includes(t[0])?t[0]:`dashboard`,r=n===`cases`&&t[1]?re(t[1]):void 0,i=n===`tests`&&t[1]?re(t[1]):void 0,a=n===`suites`&&t[1]?re(t[1]):void 0,[c,l]=(0,J.useState)(null),[d,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(null),[v,y]=(0,J.useState)([]),[b,x]=(0,J.useState)(null),[te,ne]=(0,J.useState)(null),[C,w]=(0,J.useState)(null),[ie,D]=(0,J.useState)(``),[oe,k]=(0,J.useState)(``),[ce,le]=(0,J.useState)(!1),[ue,j]=(0,J.useState)([]),[de,M]=(0,J.useState)(null),[N,fe]=(0,J.useState)(!0),P=(0,J.useCallback)(async()=>{try{let[e,t]=await Promise.all([Y.view(),Y.cases()]);l(e),m(t),ne(e.suites),w(e.job),D(``)}catch(e){D(e.message)}},[]);(0,J.useEffect)(()=>{P()},[P]),(0,J.useEffect)(()=>{n===`gaps`&&Y.gaps().then(g,e=>D(e.message)),n===`tags`&&Y.tags().then(x,e=>D(e.message)),n===`suites`&&Y.suites().then(e=>ne(e.suites),e=>D(e.message))},[n,c]),(0,J.useEffect)(()=>{if(!C?.running)return;let e=xe(()=>{Y.job().then(e=>{w(e.job),e.job?.running||P()},()=>{})},2e3);return()=>ye(e)},[C?.running,P]);let pe=async()=>{le(!0),k(``);try{let e=await Y.sync(),t=e.plans.filter(e=>e.error),n=t.length?t.map(e=>`${e.label}: ${e.error}`).join(` · `):`Synced ${e.plans.map(e=>`${e.label} (${e.cases} cases)`).join(`, `)}.`;k(e.storiesError?`${n} The release's stories were not read again: ${e.storiesError}`:n),await P()}catch(e){D(e.message)}finally{le(!1)}},me=e=>M({title:`Run ${e.length} test case${e.length===1?``:`s`}`,go:(t,n)=>Y.run(e,t,n)}),ge=(e,t)=>{let n=te?.find(t=>t.id===e)??c?.suites.find(t=>t.id===e);M({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)})},L=()=>{k(`The run started: it shows here while it runs, and in Runs.`),Y.job().then(e=>w(e.job),()=>{})},R=e=>{k(e),j([]),P()},z=new Map((d?.cases??[]).map(e=>[e.key,e])),B=ue.filter(e=>z.has(e)),V=e=>e.map(e=>z.get(e).id),H=B.filter(e=>[`failed`,`blocked`].includes(z.get(e).lastRun.outcome)),be=B.filter(e=>z.get(e).automation!==`automated`),U=[{intent:`automate`,label:be.length?`Automate ${be.length}`:`Automate`,icon:T,keys:be.slice(0,50),...be.length?{}:{disabled:`Pick test cases that are not automated`}},{intent:`investigate`,label:H.length?`Why ${H.length} fail`:`Why they fail`,icon:o,keys:H.slice(0,50),...H.length?{}:{disabled:`Pick failing test cases`}},{intent:`tag`,label:`Suggest tags`,icon:se,keys:B.slice(0,50),...B.length?{}:{disabled:`Pick test cases in the list first`}},{intent:`tag_tests`,label:`Write tags into tests`,icon:T,keys:B.filter(e=>z.get(e).tests.length>0&&z.get(e).tags.length>0).slice(0,50),...B.filter(e=>z.get(e).tests.length>0&&z.get(e).tags.length>0).length?{}:{disabled:`Pick tagged cases that have a linked test`}}],G=(h?.ranked??[]).slice(0,20).map(e=>e.key),Ce=[{intent:`automate`,label:B.length?`Automate ${B.length}`:`Automate the top ${G.length}`,icon:T,keys:(B.length?B:G).slice(0,50),...B.length||G.length?{}:{disabled:`Nothing left to automate`}},{intent:`investigate`,label:`Why the failing fail`,icon:o,keys:(h?.lists.failing??[]).slice(0,50),...h?.lists.failing.length?{}:{disabled:`Nothing is failing`}},{intent:`cases_for_stories`,label:v.length?`Cases for ${v.length} stor${v.length===1?`y`:`ies`}`:`Cases for stories with none`,icon:O,keys:[],stories:(v.length?v:(h?.stories?.noCase??[]).map(e=>e.id)).slice(0,50),...v.length||h?.stories?.noCase.length?{}:{disabled:`Read the release's stories in Gaps, Stories with no case, first`}}],K=d?d.cases.filter(e=>e.automation===`not_automated`||e.automation===`pending`||e.lastRun.outcome===`failed`||e.lastRun.outcome===`blocked`).length:(c?.summary.notAutomated??0)+(c?.summary.pending??0),q=a?te?.find(e=>e.id===a):void 0,De=(0,Z.jsxs)(`main`,{className:A(ve,`@container flex-auto gap-4`),children:[!r&&!i&&!a&&(0,Z.jsx)(he,{}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,Z.jsx)(we,{pixel:_e[`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)(`div`,{className:`order-last flex min-w-0 basis-full @[74rem]:order-none @[74rem]:basis-auto`,children:(0,Z.jsx)(Se,{label:`Test management`,className:`mb-0 max-w-full`,current:n,hrefOf:e=>E(`test-management`,e),tabs:[{id:`dashboard`,label:`Dashboard`,icon:ae},{id:`cases`,label:`Test cases`,n:c.summary.cases,icon:_},{id:`tests`,label:`Automated`,n:c.summary.tests,icon:u},{id:`gaps`,label:`Gaps`,n:K,icon:f},{id:`suites`,label:`Suites`,n:c.suites.length,icon:S},{id:`tags`,label:`Tags`,icon:se}]})}),c&&(0,Z.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[c.plans.length>0&&(0,Z.jsx)(F,{size:`icon`,disabled:ce,onClick:()=>void pe(),"aria-label":ce?`Syncing`:`Sync`,"data-tip":ce?`Syncing…`:`Sync: read every case of the connected plans again`,children:(0,Z.jsx)(s,{"aria-hidden":`true`})}),(c.plans.length>0||c.summary.tests>0)&&(0,Z.jsx)(Vt,{disabled:ce}),(n===`cases`||n===`gaps`||n===`suites`)&&!N&&(0,Z.jsx)(F,{size:`icon`,onClick:()=>fe(!0),"aria-label":n===`suites`?`Open the Suite agent`:`Open the agent`,"data-tip":n===`suites`?`Open the Suite agent`:`Open the agent`,children:(0,Z.jsx)(O,{"aria-hidden":`true`})})]})]}),c&&!r&&!i&&!a&&(0,Z.jsxs)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:[`Every case of the connected test plans: which are automated and by what, what ran, and what is left.`,` `,c.plans.length>0?(0,Z.jsxs)(`span`,{"data-tip":c.plans.map(e=>`${e.label}: ${e.cases} cases${e.at?`, synced ${Ee(e.at)}`:``}`).join(` · `),children:[c.plans.length,` plan`,c.plans.length===1?``:`s`,c.plans[0]?.at?`, synced ${W(c.plans.map(e=>e.at??``).sort()[0])}.`:`, not synced yet.`]}):(0,Z.jsx)(`a`,{href:E(`settings`,`integrations`),children:`Connect a test plan in Settings`})]}),ie&&(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:ie}),!c&&!ie&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),oe&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:oe}),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.`]}),C&&(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)(I,{tone:C.running?`running`:C.exitCode===0?`pass`:`fail`,children:C.running?`Running`:C.exitCode===0?`Finished`:`Stopped`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink-2`,"data-tip":C.command,children:C.lines.at(-1)??C.command}),C.running?(0,Z.jsxs)(F,{size:`sm`,variant:`danger`,onClick:()=>void Y.stop().then(e=>w(e.job),e=>D(e.message)),children:[(0,Z.jsx)(ee,{"aria-hidden":`true`}),`Stop`]}):(0,Z.jsx)(`a`,{href:E(`runs`),className:`text-[13px]`,children:`Runs`})]}),c&&(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsxs)(`div`,{id:`panel-${n}`,className:`flex flex-col gap-4`,children:[n===`dashboard`&&(0,Z.jsx)(Ct,{view:c,onRunSuite:ge}),n===`cases`&&(r?(0,Z.jsx)(pt,{caseKey:r,onRun:me,onChanged:()=>void P()},r):d&&(0,Z.jsx)(_t,{cases:d.cases,tests:d.tests.length,selected:B,onSelect:j,onRun:me,onChanged:R})),n===`tests`&&d&&(i?(0,Z.jsx)(Xt,{uid:i,cases:d.cases,onChanged:()=>void P()},i):(0,Z.jsx)(rt,{cases:d.cases,onChanged:R})),n===`gaps`&&(h&&d?(0,Z.jsx)(Nt,{gaps:h,cases:d.cases,tests:d.tests,selected:B,onSelect:j,onRun:me,pickedStories:v,onPickStories:y,onStoriesRead:()=>(y([]),void P())}):(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`})),n===`suites`&&(a?(0,Z.jsx)(Lt,{id:a,onRun:ge,onDeleted:()=>(location.hash=E(`test-management`,`suites`),void P())},a):te&&(0,Z.jsx)(It,{suites:te,onRun:ge})),n===`tags`&&(b?(0,Z.jsx)(Yt,{tags:b,cases:d?.cases,onChanged:R}):(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}))]})}),(0,Z.jsx)($e,{open:!!de,onClose:()=>M(null),title:de?.title??`Run`,preview:(e,t)=>de.go(e,t),onStarted:L})]}),X=r?z.get(r):void 0;return(0,Z.jsxs)(`div`,{className:`@container flex min-h-(--screen) flex-col`,children:[(0,Z.jsx)(Te,{}),(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:De}),c&&N&&n===`cases`&&(0,Z.jsx)(Me,{title:`Test case agent`,about:`Automates, runs and tags the cases you pick.`,looking:X?`Looking at ${X.id}.`:B.length?`Looking at the ${B.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)]:B.length?V(B).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`?p:T,keys:[X.key]},{intent:`investigate`,label:`Why it fails`,icon:o,keys:[X.key],...[`failed`,`blocked`].includes(X.lastRun.outcome)?{}:{disabled:`Its last run did not fail`}},{intent:`tag`,label:`Suggest tags`,icon:se,keys:[X.key]}]:U,keys:X?[X.key]:B,placeholder:`Ask about these cases, or say what to do`,onClose:()=>fe(!1)},r??`list`),c&&N&&n===`gaps`&&(0,Z.jsx)(Me,{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:B.length?V(B).slice(0,4):[],suggestions:Ce,keys:B.length?B:G,placeholder:`What should we close first?`,onClose:()=>fe(!1)}),c&&N&&n===`suites`&&(0,Z.jsx)(Rt,{open:q,onSaved:e=>{k(`Saved the suite ${e.name}.`),P(),location.hash=E(`test-management`,`suites`,e.id)}},a??`list`)]})]})}export{$t as TestManagement};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Kr as t,M as n,T as r,u as i}from"./route-D8G-pTdk.js";import{t as a}from"./jsx-runtime-LKYXHABd.js";import{A as o,j as s}from"./input-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Kr as t,M as n,T as r,u as i}from"./route-D8G-pTdk.js";import{t as a}from"./jsx-runtime-LKYXHABd.js";import{A as o,j as s}from"./input-CK9KiscI.js";import{c,n as l}from"./pageBack-CGpBg0rz.js";import{L as u}from"./palette-sQXAx0hh.js";import{A as d,F as f,In as p,M as m,N as h,P as g,en as _,j as v,wn as y,z as b}from"./index-CeVry7Jo.js";var x=e(t(),1),S=a(),C={new:{label:`New`,tone:`running`},improved:{label:`Improved`,tone:`neutral`},fixed:{label:`Fixed`,tone:`pass`}};function w({change:e,id:t,first:r}){let[a,s]=(0,x.useState)(!1),l=m(e);return(0,S.jsxs)(`li`,{className:o(!r&&`border-t border-line-soft`),children:[(0,S.jsxs)(`button`,{type:`button`,"aria-expanded":a,"aria-controls":t,onClick:()=>s(!a),className:`flex min-h-11 w-full cursor-pointer items-center gap-4 border-0 bg-transparent px-4 py-2 text-left text-sm text-ink hover:bg-surface-muted`,children:[(0,S.jsx)(c,{tone:C[e.kind].tone,icon:!1,className:`w-[76px] justify-center`,children:C[e.kind].label}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,S.jsx)(n,{size:16,"aria-hidden":`true`,className:o(`flex-none text-muted transition-transform duration-200`,a&&`rotate-90`)})]}),(0,S.jsx)(p,{open:a,id:t,children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 pt-1 pb-4 sm:pl-26`,children:[(0,S.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:e.detail}),l&&(0,S.jsxs)(`a`,{href:l,className:`inline-flex items-center gap-1 self-start text-[13px] font-medium`,children:[`Open`,(0,S.jsx)(i,{size:13,"aria-hidden":`true`})]})]})})]})}var T=e=>`whats-new-${e.toLowerCase().replace(/[^a-z0-9]+/g,`-`)}`;function E({release:e}){let t=e===d;return(0,S.jsxs)(`li`,{className:`relative flex gap-4 pb-8`,children:[(0,S.jsx)(`span`,{"aria-hidden":`true`,className:o(`relative mt-2 size-[15px] flex-none rounded-full border-[3px] border-bg`,t?`bg-accent`:`bg-line`)}),(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,S.jsxs)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:[`ForgeQE `,e.version]}),t&&(0,S.jsx)(c,{tone:`running`,icon:!1,children:`Latest`}),(0,S.jsxs)(`span`,{className:`text-sm text-muted`,children:[(0,S.jsx)(`time`,{dateTime:e.date,children:g(e.date)}),` · `,s(e.changes.length,`change`)]})]}),(0,S.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:e.summary}),(0,S.jsx)(`ul`,{className:`m-0 flex list-none flex-col overflow-hidden rounded-[12px] card border p-0`,children:e.changes.map((t,n)=>(0,S.jsx)(w,{change:t,first:n===0,id:`change-${e.version}-${n}`},n))})]})]})}function D({embedded:e=!1}={}){(0,x.useEffect)(h,[]);let t=v(),n=(0,S.jsx)(S.Fragment,{children:(0,S.jsxs)(`div`,{className:`relative flex flex-col gap-2`,children:[(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-[60px] bottom-10 left-[7px] w-px bg-line`}),t.map(e=>(0,S.jsxs)(`section`,{"aria-labelledby":T(e.month),className:`flex flex-col gap-4`,children:[(0,S.jsx)(_,{id:T(e.month),icon:r,title:e.month,className:`pl-8`}),(0,S.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.releases.map(e=>(0,S.jsx)(E,{release:e},e.version))})]},e.month))]})});return e?(0,S.jsx)(`div`,{className:`flex flex-col gap-6`,children:n}):(0,S.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,S.jsx)(b,{}),(0,S.jsxs)(`main`,{className:o(f,`flex-auto gap-6`),children:[(0,S.jsx)(l,{}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,S.jsx)(y,{pixel:u[`whats-new`],size:`lg`}),(0,S.jsx)(`h1`,{className:`m-0 flex-1 text-[25px] font-semibold tracking-[-0.01em]`,children:`What's new`})]}),(0,S.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`What each release of ForgeQE added, improved and fixed. Pick a change to read more.`}),n]})]})}export{C as KIND,D as WhatsNew};
|