@capagents/forgeqe 3.4.0 → 3.4.1
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/dist/forgeqe.js +2007 -2007
- package/dist/template.html +63 -63
- package/dist/web/assets/{3d-force-graph-COJCPPtP.js → 3d-force-graph-B-g_aIro.js} +1 -1
- package/dist/web/assets/Agent-FGPuvhc5.js +10 -0
- package/dist/web/assets/{AgentWork-B28xaxOA.js → AgentWork-CFw0XcKd.js} +1 -1
- package/dist/web/assets/ApiTests-D5rqD6gA.js +17 -0
- package/dist/web/assets/{Browse-vulmdCCu.js → Browse-DLECqaFU.js} +1 -1
- package/dist/web/assets/Chat-DS4jyAH3.js +3 -0
- package/dist/web/assets/{CommandPalette-gLmXo4vu.js → CommandPalette-x_RA-vYW.js} +1 -1
- package/dist/web/assets/Compare-BFDv-NmH.js +1 -0
- package/dist/web/assets/Cost-_h1bxSj0.js +1 -0
- package/dist/web/assets/{Data-jwfy5h4u.js → Data-BuIpjLOr.js} +4 -4
- package/dist/web/assets/Desktop-F-PyYzC0.js +1 -0
- package/dist/web/assets/{DesktopReview-BNcHZZdH.js → DesktopReview-CODdFSMN.js} +2 -2
- package/dist/web/assets/Evidence-BXr78jgr.js +1 -0
- package/dist/web/assets/Explore-AAssIdGu.js +2 -0
- package/dist/web/assets/Features-Ce2hYdNS.js +1 -0
- package/dist/web/assets/Flags-DRXJnHt4.js +2 -0
- package/dist/web/assets/Flaky-BGUyv4_b.js +1 -0
- package/dist/web/assets/Impact-B6F9nuZt.js +3 -0
- package/dist/web/assets/Jobs-BsP-lQnC.js +5 -0
- package/dist/web/assets/KindPage-jQ0mJt7b.js +6 -0
- package/dist/web/assets/{LiveDevice-fsRa0HWk.js → LiveDevice-C0OpjAg0.js} +1 -1
- package/dist/web/assets/Migration-yiY2-7f3.js +8 -0
- package/dist/web/assets/Mobile-DcL2FOJg.js +1 -0
- package/dist/web/assets/Observability-BdpwjRNO.js +1 -0
- package/dist/web/assets/{OwnItems-DcfXa2ig.js → OwnItems-DRV4_VbL.js} +3 -3
- package/dist/web/assets/{PageAgent-Cf6cES5X.js → PageAgent-C_DrJ3kc.js} +1 -1
- package/dist/web/assets/Product-BoLtQxi6.js +6 -0
- package/dist/web/assets/Production-DgMWWNd_.js +1 -0
- package/dist/web/assets/Quality-Dfh-gpB-.js +1 -0
- package/dist/web/assets/Readiness-BzlzH-RQ.js +1 -0
- package/dist/web/assets/Record-BpL7Br8t.js +1 -0
- package/dist/web/assets/Regression-VL1J4PQB.js +5 -0
- package/dist/web/assets/{RelationGraph-CKUt2nN9.js → RelationGraph-CrEnF6ZB.js} +1 -1
- package/dist/web/assets/Reports-CzJULGPA.js +2 -0
- package/dist/web/assets/Requirements-CsfwSrgh.js +2 -0
- package/dist/web/assets/Responsive-GfKHZLev.js +3 -0
- package/dist/web/assets/RunDiff-DZw8Jja0.js +1 -0
- package/dist/web/assets/Settings-CiMIX_QR.js +21 -0
- package/dist/web/assets/SiteScan-Cydt89Ja.js +5 -0
- package/dist/web/assets/Steps-BoyXqIqo.js +2 -0
- package/dist/web/assets/TestData-Jwowbnv2.js +2 -0
- package/dist/web/assets/TestManagement-BPx01M_H.js +4 -0
- package/dist/web/assets/{WhatsNew-BwOrUNiN.js → WhatsNew-DAtb7FTn.js} +1 -1
- package/dist/web/assets/{agentSettingsSheet-Dti2gac2.js → agentSettingsSheet-DxBRwlvu.js} +1 -1
- package/dist/web/assets/{api-CLFzGvjv.js → api-B8AQ8-Gb.js} +1 -1
- package/dist/web/assets/{dataParts-BO1c58Zl.js → dataParts-DvgtfSmo.js} +3 -3
- package/dist/web/assets/{desktopAppPath-BQG20MeU.js → desktopAppPath-Mg0cuo3X.js} +1 -1
- package/dist/web/assets/{flowTheme-CBFdbvyc.js → flowTheme-BcMJKyow.js} +1 -1
- package/dist/web/assets/frame-Z5TaJY7O.js +23 -0
- package/dist/web/assets/index-BEY6ZWQm.css +2 -0
- package/dist/web/assets/index-nbjwmmih.js +47 -0
- package/dist/web/assets/{nav--Ztl9BFf.js → nav-DRpijFeN.js} +1 -1
- package/dist/web/assets/pageBack-CINGjBHZ.js +9 -0
- package/dist/web/assets/{palette-CX3RCtC1.js → palette-DOQemIAv.js} +1 -1
- package/dist/web/assets/{paletteCommands-DOF2o-rv.js → paletteCommands-Bx61jZay.js} +1 -1
- package/dist/web/assets/{parts-DAsJI5QF.js → parts-BNAiSyF0.js} +1 -1
- package/dist/web/assets/{productParts-DU5Mqpy8.js → productParts-tf1w_F1S.js} +1 -1
- package/dist/web/assets/qualityParts-O56nH8FQ.js +3 -0
- package/dist/web/assets/{recordTest-B5LNeQFu.js → recordTest-S5MOLSrL.js} +1 -1
- package/dist/web/assets/sectionList-BPBmSZXk.js +1 -0
- package/dist/web/assets/{stepper-DpPfKWnN.js → stepper-B7sbuU1Q.js} +1 -1
- package/dist/web/assets/{wizardParts-DfQICLTv.js → wizardParts-OhFd_xL2.js} +1 -1
- package/dist/web/index.html +8 -8
- package/package.json +1 -1
- package/py/forgeqe_engine/diagnostics.py +87 -6
- package/py/forgeqe_engine/recordsession.py +4 -1
- package/dist/web/assets/Agent-CpUTlFZ-.js +0 -10
- package/dist/web/assets/ApiTests-lM99MWdo.js +0 -17
- package/dist/web/assets/Chat-C5HT3xQ6.js +0 -3
- package/dist/web/assets/Compare-8UYX74Lj.js +0 -1
- package/dist/web/assets/Cost-AXBTBBCh.js +0 -1
- package/dist/web/assets/Desktop-Cj3xG2xu.js +0 -1
- package/dist/web/assets/Evidence-jLpLvuuq.js +0 -1
- package/dist/web/assets/Explore-CdVHaJw9.js +0 -2
- package/dist/web/assets/Features-Cklg138_.js +0 -1
- package/dist/web/assets/Flags-Db14UE8F.js +0 -2
- package/dist/web/assets/Flaky-Co8pOPGY.js +0 -1
- package/dist/web/assets/Impact-DxC0ik4k.js +0 -3
- package/dist/web/assets/Jobs-C-8bg8Pd.js +0 -5
- package/dist/web/assets/KindPage-BeFuktfD.js +0 -6
- package/dist/web/assets/Migration-CMYz77fl.js +0 -8
- package/dist/web/assets/Mobile-BmMA0xV2.js +0 -1
- package/dist/web/assets/Observability-CH1Ww9a0.js +0 -1
- package/dist/web/assets/Product-DmaqhVyO.js +0 -6
- package/dist/web/assets/Production-I-_oJxP-.js +0 -1
- package/dist/web/assets/Quality-FscfMj9c.js +0 -1
- package/dist/web/assets/Readiness-S9TLEg-y.js +0 -1
- package/dist/web/assets/Record-ChW3mCvV.js +0 -1
- package/dist/web/assets/Regression-Bu1W9YDq.js +0 -5
- package/dist/web/assets/Reports-Clwwngni.js +0 -2
- package/dist/web/assets/Requirements-DXnNmoYo.js +0 -2
- package/dist/web/assets/Responsive-CUbZeMQD.js +0 -3
- package/dist/web/assets/RunDiff-B_exyRTR.js +0 -1
- package/dist/web/assets/Settings-DwKlszsQ.js +0 -21
- package/dist/web/assets/SiteScan-CjwkNI8J.js +0 -5
- package/dist/web/assets/Steps-DbBUfJ23.js +0 -2
- package/dist/web/assets/TestData-3s9zUpzm.js +0 -2
- package/dist/web/assets/TestManagement-CVV0I41E.js +0 -4
- package/dist/web/assets/frame-BUnqEFkX.js +0 -23
- package/dist/web/assets/index-CPftbTjg.js +0 -47
- package/dist/web/assets/index-ZA7Ojgea.css +0 -2
- package/dist/web/assets/pageBack-DZTkmgGZ.js +0 -9
- package/dist/web/assets/qualityParts-CoXsldUS.js +0 -2
- package/dist/web/assets/sectionList-DMyhAqst.js +0 -1
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-9BkoTWUE.js";import{L as i,R as a,l as o}from"./preload-helper-BupTYkQW.js";import{t as s}from"./utils-DJRAScIl.js";import{t as c}from"./jsx-runtime-LKYXHABd.js";import{tt as l,v as u,y as d}from"./api-CLFzGvjv.js";import{C as f,D as p,M as m,N as h,P as g,d as _,k as v,m as y}from"./pageBack-DZTkmgGZ.js";import{E as ee,Er as b,Gr as x,N as S,Wn as C,Xn as w,ft as T,it as E,kr as D,nn as O,ur as k,xt as A,z as j}from"./line-icons-Cwj9OmCz.js";import{Ct as M,Et as N,Ht as P,bt as F,fn as te,ft as ne,mt as re,pn as ie}from"./frame-BUnqEFkX.js";import{B as I,J as ae,V as oe,Y as se,z as L}from"./index-CPftbTjg.js";import{a as ce,b as le,d as ue,f as de,m as fe,p as pe,t as me,v as R,y as z}from"./qualityParts-CoXsldUS.js";var B=e(t(),1),V=e=>`/api/scans/${encodeURIComponent(e)}`,H=(e,t)=>`?${new URLSearchParams({...e?{standard:e}:{},...t?{engine:t}:{}})}`,U={view:()=>u(`GET`,`/api/scans`),start:e=>u(`POST`,`/api/scans/start`,e),stop:()=>u(`POST`,`/api/scans/stop`,{}),answer:(e,t)=>u(`POST`,`/api/scans/answer`,{id:e,choice:t}),scan:e=>u(`GET`,V(e)),print:e=>u(`POST`,`${V(e)}/pdf`,{}),reportHtml:e=>d(`GET`,`${V(e)}/report.html`),reportPdf:e=>d(`GET`,`${V(e)}/report.pdf`),coverageCsv:e=>d(`GET`,`${V(e)}/coverage.csv`)},he={view:(e,t)=>u(`GET`,`/api/coverage${H(e,t)}`),csv:(e,t)=>d(`GET`,`/api/coverage.csv${H(e,t)}`),html:(e,t)=>d(`GET`,`/api/coverage.html${H(e,t)}`),pdf:(e,t)=>d(`POST`,`/api/coverage.pdf${H(e,t)}`),session:e=>u(`GET`,`/api/a11y/sessions/${encodeURIComponent(e)}/coverage`),sessionCsv:e=>d(`GET`,`/api/a11y/sessions/${encodeURIComponent(e)}/coverage.csv`),sessionHtml:e=>d(`GET`,`/api/a11y/sessions/${encodeURIComponent(e)}/coverage.html`)},ge={view:e=>u(`GET`,`/api/dashboard?range=${encodeURIComponent(e)}`)};function _e(e){return e.split(/\r?\n/).flatMap(e=>e.split(/[,;\t]/)).map(e=>e.trim().replace(/^"(.*)"$/,`$1`).trim()).filter(e=>/^https?:\/\/\S+$/i.test(e))}function ve(e){return[...new Set(e.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean))]}var W=e=>`/api/a11y/suites/${encodeURIComponent(e)}`,ye={view:()=>u(`GET`,`/api/a11y/suites`),create:e=>u(`POST`,`/api/a11y/suites`,e),run:(e,t)=>u(`POST`,`${W(e)}/run`,{heal:t}),stop:()=>u(`POST`,`/api/a11y/suites/stop`,{}),answer:(e,t)=>u(`POST`,`/api/a11y/suites/answer`,{id:e,choice:t}),runDetail:(e,t)=>u(`GET`,`${W(e)}/runs/${encodeURIComponent(t)}`),report:(e,t)=>d(`GET`,`${W(e)}/runs/${encodeURIComponent(t)}/report.html`),baseline:(e,t,n)=>u(`POST`,`${W(e)}/baseline`,{run:t,confirm:n}),tests:e=>u(`POST`,`${W(e)}/tests`,{})};function be(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,48).replace(/-+$/g,``)}var xe=/^[a-z0-9][a-z0-9-]{0,47}$/;function Se(e,t){let n=Object.values(e.journeys).some(e=>!e.ok&&!e.healed);return e.worse.length?`worse`:n?`broken`:t?e.better.length?`better`:`same`:`no-baseline`}function Ce(e){let t=Object.values(e.journeys);return{ok:t.filter(e=>e.ok).length,healed:t.filter(e=>!e.ok&&e.healed).length,broken:t.filter(e=>!e.ok&&!e.healed).length}}function we(e){if(!e)return{};let t=/^(scan|session):([A-Za-z0-9][\w.-]{0,120})$/.exec(e);return t?t[1]===`scan`?{scan:t[2]}:{session:t[2]}:{}}var G=c(),K={failed:{label:`Failed`,tone:`fail`,cell:`bg-fail-soft text-fail shadow-[inset_0_0_0_1px_var(--color-fail-dot)]`,dot:`fail`},review:{label:`Needs review`,tone:`warn`,cell:`bg-warn-soft text-warn`,dot:`warn`},exercised:{label:`Exercised by a persona`,tone:`running`,cell:`bg-accent-soft text-accent-fg`,dot:`running`},passed:{label:`Rules passed`,tone:`pass`,cell:`bg-pass-soft text-pass`,dot:`pass`},not_tested:{label:`Not tested`,tone:`neutral`,cell:`bg-surface-strong text-muted`,dot:`neutral`}},q={rules:{label:`Rules check part`,tone:`pass`,cell:`bg-pass-soft text-pass`,dot:`pass`},people:{label:`Personas exercise it`,tone:`running`,cell:`bg-accent-soft text-accent-fg`,dot:`running`},manual:{label:`A person must review`,tone:`neutral`,cell:`bg-nest text-muted shadow-[inset_0_0_0_1px_var(--color-line-strong)]`,dot:`neutral`}},J=[`failed`,`review`,`exercised`,`passed`,`not_tested`],Y=[`rules`,`people`,`manual`],X=(e,t)=>t?K[e.result||`not_tested`]:q[e.automation],Te=e=>e.split(`.`).slice(0,2).join(`.`),Z=(e,t)=>t?Math.round(e/t*100):0;function Ee({r:e,withResults:t,on:n,onPick:r}){let i=X(e,t);return(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":n,"aria-label":`${e.id} ${e.title}, level ${e.level}: ${i.label}`,"data-tip":`${e.id} ${e.title} (${e.level}): ${i.label}`,onClick:r,className:s(`flex w-14 cursor-pointer flex-col items-center rounded-base border-0 px-1 py-1 font-mono text-body-sm leading-tight font-medium transition-[box-shadow] duration-150 hover:shadow-md focus-visible:shadow-focus focus-visible:outline-none`,i.cell,n&&`shadow-focus`),children:[e.id,(0,G.jsx)(`span`,{className:`font-sans text-label-sm font-normal opacity-80`,children:e.level})]})}function De({r:e,withResults:t}){let n=X(e,t);return(0,G.jsxs)(`section`,{"aria-label":`${e.id} ${e.title}`,className:s(o,`flex flex-col gap-2 p-4`),children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:e.id}),(0,G.jsx)(`h3`,{className:`m-0 text-body-lg font-medium`,children:e.title}),(0,G.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`Level `,e.level,` · WCAG `,e.since,` · `,e.principle]}),(0,G.jsx)(p,{tone:n.tone,icon:n.tone!==`running`,children:n.label})]}),(0,G.jsx)(Oe,{r:e})]})}function Oe({r:e}){return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 text-body-sm text-ink-2`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-muted`,children:`Rules: `}),e.rules.length?(0,G.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:e.rules.join(`, `)}):`none`]}),e.people.length>0&&(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-muted`,children:`Exercised by: `}),e.people.join(`, `)]}),e.failed?.length?(0,G.jsxs)(`span`,{className:`text-fail`,children:[`Failed: `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.failed.map(e=>`${e.rule} (${e.count})`).join(`, `)})]}):null,e.review?.length?(0,G.jsxs)(`span`,{className:`text-warn`,children:[`Could not decide, a person looks: `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.review.join(`, `)})]}):null,e.barriers?.map((e,t)=>(0,G.jsxs)(`span`,{className:`text-fail [overflow-wrap:anywhere]`,children:[e.persona,`: `,e.title,` (`,e.severity,`)`]},t)),e.exercisedBy?.length?(0,G.jsxs)(`span`,{className:`text-accent-fg`,children:[`Reached the goal past it with no barrier: `,e.exercisedBy.join(`, `)]}):null]})}function ke({c:e,withResults:t,picked:n,onPick:r}){let i=[...new Set(e.rows.map(e=>e.principle))];return(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @2xl:grid-cols-2 @6xl:grid-cols-4`,children:i.map(i=>{let a=e.rows.filter(e=>e.principle===i),o=[...new Set(a.map(e=>Te(e.id)))];return(0,G.jsxs)(`section`,{"aria-label":i,className:`flex min-w-0 flex-col gap-2 rounded-lg bg-surface-muted p-4`,children:[(0,G.jsxs)(`h3`,{className:`m-0 flex items-baseline gap-2 text-body-sm font-medium`,children:[a[0].id[0],`. `,i,` `,(0,G.jsx)(`span`,{className:`font-normal text-muted tabular-nums`,children:a.length})]}),o.map(e=>(0,G.jsx)(`div`,{role:`group`,"aria-label":`Guideline ${e}`,className:`flex flex-wrap gap-1`,children:a.filter(t=>Te(t.id)===e).map(e=>(0,G.jsx)(Ee,{r:e,withResults:t,on:n===e.id,onPick:()=>r(n===e.id?``:e.id)},e.id))},e))]},i)})})}function Ae({c:e}){let t=e.summary;return t.results?(0,G.jsxs)(L,{label:`The criteria's results`,children:[J.map(e=>(0,G.jsx)(I,{dot:K[e].dot,value:t.results[e],label:K[e].label.toLowerCase()},e)),(0,G.jsx)(I,{dot:`neutral`,value:t.total,label:`criteria of ${e.label}`})]}):(0,G.jsxs)(L,{label:`What covers the criteria`,children:[Y.map(e=>(0,G.jsx)(I,{dot:q[e].dot,value:t[e],label:`${q[e].label.toLowerCase()} (${Z(t[e],t.total)}%)`},e)),(0,G.jsx)(I,{dot:`neutral`,value:`${t.rules+t.people} of ${t.total}`,label:`covered in some way, ${Z(t.rules+t.people,t.total)}%`})]})}function je({c:e,engineLabel:t}){let n=!!e.summary.results,[r,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(`all`),c=e.rows.find(e=>e.id===r),l=e=>n?e.result||`not_tested`:e.automation,u=n?J.map(t=>({id:t,label:K[t].label,n:e.rows.filter(e=>l(e)===t).length,...t===`failed`?{alert:!0}:{}})):Y.map(t=>({id:t,label:q[t].label,n:e.rows.filter(e=>l(e)===t).length})),d=e.rows.filter(e=>a===`all`||l(e)===a);return(0,G.jsxs)(`div`,{className:`@container flex min-w-0 flex-col gap-4`,children:[(0,G.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[e.summary.total,` success criteria of `,e.label,t?`, checked with ${t}`:``,`. Pick a criterion to see what checks it`,n?` and what was found`:``,`.`]}),(0,G.jsx)(Ae,{c:e}),(0,G.jsx)(`ul`,{"aria-label":`Legend`,className:`m-0 flex list-none flex-wrap gap-x-4 gap-y-1 p-0 text-body-sm text-ink-2`,children:(n?J.map(e=>K[e]):Y.map(e=>q[e])).map(e=>(0,G.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:s(`size-4 rounded-sm shadow-[inset_0_0_0_1px_var(--color-line-strong)]`,e.cell)}),e.label]},e.label))}),(0,G.jsx)(ke,{c:e,withResults:n,picked:r,onPick:i}),c&&(0,G.jsx)(De,{r:c,withResults:n}),(0,G.jsx)(`p`,{className:s(g.info,`m-0`),children:e.note}),(0,G.jsx)(F,{label:`Every criterion`,placeholder:`Find a criterion, rule or persona`,resetKey:a,empty:`Nothing matches.`,tools:(0,G.jsx)(f,{items:[{id:`all`,label:`All`,n:e.rows.length},...u.filter(e=>e.n>0)],value:a,onChange:o}),head:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`th`,{scope:`col`,className:s(N,`w-[88px]`),children:`Criterion`}),(0,G.jsx)(`th`,{scope:`col`,className:N,children:`Title`}),(0,G.jsx)(`th`,{scope:`col`,className:N,children:n?`Result`:`Coverage`}),(0,G.jsxs)(`th`,{scope:`col`,className:s(N,`hidden @3xl:table-cell`),children:[`What checks it`,n?`, and the evidence`:``]})]}),children:d.map(e=>{let t=X(e,n);return(0,G.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,G.jsx)(`td`,{className:s(M,`font-mono text-body-sm`),"data-sort":e.id.split(`.`).map(e=>e.padStart(2,`0`)).join(`.`),children:e.id}),(0,G.jsxs)(`td`,{className:M,children:[(0,G.jsx)(`span`,{className:`block text-ink`,children:e.title}),(0,G.jsxs)(`span`,{className:`block text-body-sm text-muted`,children:[`Level `,e.level,` · WCAG `,e.since]})]}),(0,G.jsx)(`td`,{className:M,"data-sort":n?J.indexOf(e.result||`not_tested`):Y.indexOf(e.automation),children:(0,G.jsx)(p,{tone:t.tone,icon:t.tone!==`running`,className:`min-h-5 px-2 text-body-sm`,children:t.label})}),(0,G.jsx)(`td`,{className:s(M,`hidden @3xl:table-cell`),children:(0,G.jsx)(Oe,{r:e})})]},e.id)})})]})}var Q=e=>e===`axe`?`axe-core`:e===`ibm`?`IBM Equal Access`:e===`basic`?`ForgeQE's built-in checks`:e,$=e=>[...new Set(e.map(e=>{try{return new URL(e).host}catch{return``}}).filter(Boolean))],Me={title:`Site scan`,working:e=>{let t=e.filter(e=>/^Scanned /.test(e)).length;return`Scanning${t?`, ${t} done`:``}`},done:[`Scanned, nothing failed`,`Scanned, with problems`,`Did not finish`],output:`each page as it is scanned`};function Ne({job:e,onStop:t,onAnswer:n,words:r=Me}){let i=(0,B.useRef)(null);(0,B.useEffect)(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e.lines.length]);let a=e.exitCode===0?r.done[0]:e.exitCode===1?r.done[1]:r.done[2];return(0,G.jsxs)(`section`,{"aria-label":r.title,className:s(o,`flex flex-col gap-2`),children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,children:r.title}),(0,G.jsx)(p,{orb:`working`,tone:e.running?`running`:e.exitCode===0?`pass`:e.exitCode===1?`warn`:`fail`,children:e.running?e.question?`Waiting for you`:r.working(e.lines):a}),e.running&&(0,G.jsxs)(m,{variant:`danger`,onClick:t,children:[(0,G.jsx)(k,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),e.running&&e.question&&(0,G.jsxs)(`fieldset`,{className:s(`panel rounded-md bg-(--page-surface-strong) p-6`,`m-0 flex flex-col gap-2 border-0`),children:[(0,G.jsx)(`legend`,{className:`float-left mb-1 text-body-sm font-medium`,children:e.question.title}),e.question.detail&&(0,G.jsx)(`p`,{className:`clear-left m-0 text-body-sm text-ink-2`,children:e.question.detail}),(0,G.jsx)(`div`,{className:`clear-left flex flex-wrap gap-2`,children:e.question.options.map((t,r)=>(0,G.jsx)(m,{size:`sm`,variant:r===0&&t.id!==`cancel`?`primary`:`outline`,onClick:()=>n(e.question.id,t.id),children:t.label},t.id))})]}),(0,G.jsxs)(`details`,{open:e.running,children:[(0,G.jsxs)(`summary`,{className:`cursor-pointer text-body-sm text-muted`,children:[`Output (`,e.lines.length,` lines): `,r.output]}),(0,G.jsx)(`pre`,{ref:i,className:s(_,`mt-2 max-h-[340px]`),children:(0,G.jsx)(y,{text:e.lines.join(`
|
|
2
|
-
`)||`Starting the browser…`})})]})]})}function Pe({view:e,onStarted:t}){let[n,r]=(0,B.useState)(``),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(e.standard),[f,p]=(0,B.useState)(e.engine),[_,v]=(0,B.useState)(!1),[y,ee]=(0,B.useState)(!1),[b,S]=(0,B.useState)(!1),[C,T]=(0,B.useState)(``),E=ve(n),O=E.length+(c?.urls??0),k=O>e.max,j=O>0&&!k&&!b,M=async e=>{if(T(``),!e)return l(null);if(e.size>262144)return T(`The CSV is larger than 256 KB.`);let t=await e.text(),n=_e(t).length;if(!n)return T(`${e.name} holds no http(s) address.`);l({name:e.name,text:t,urls:n})},N=async()=>{S(!0);try{t(await U.start({urls:E,...c?{csv:c.text}:{},engine:f,standard:u,best_practice:_,pdf:y})),r(``),l(null),T(``)}catch(e){T(e.message)}finally{S(!1)}};return(0,G.jsxs)(`form`,{"aria-labelledby":`scan-new`,className:s(o,`flex flex-col gap-4`),onSubmit:e=>{e.preventDefault(),j&&N()},children:[(0,G.jsx)(se,{id:`scan-new`,icon:w,title:`New scan`}),(0,G.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-sm font-medium`,children:[`Pages`,(0,G.jsx)(a,{value:n,onChange:e=>r(e.target.value),rows:4,spellCheck:!1,placeholder:`https://www.example.com/
|
|
3
|
-
https://www.example.com/pricing`,"aria-describedby":`scan-pages-help`,className:`font-mono text-body-sm`}),(0,G.jsxs)(`span`,{id:`scan-pages-help`,className:s(`font-normal`,k?`text-fail`:`text-muted`),children:[`One address a line, up to `,e.max,`. `,O?`${R(O,`page`)} to scan.`:``,` Signed-in pages use the saved logins' sessions; nothing is clicked or typed.`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`label`,{className:s(h({size:`sm`,variant:`outline`}),`cursor-pointer`),children:[(0,G.jsx)(D,{"aria-hidden":`true`}),c?`Another CSV`:`Add a CSV`,(0,G.jsx)(`input`,{type:`file`,accept:`.csv,text/csv,text/plain`,className:`sr-only`,onChange:e=>void M(e.target.files?.[0])})]}),c&&(0,G.jsxs)(`span`,{className:`flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,G.jsx)(A,{size:14,"aria-hidden":`true`}),c.name,`: `,c.urls,` `,c.urls===1?`address`:`addresses`,(0,G.jsx)(m,{size:`icon-sm`,variant:`ghost`,"aria-label":`Remove the CSV`,"data-tip":`Remove the CSV`,onClick:()=>l(null),children:(0,G.jsx)(x,{"aria-hidden":`true`})})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,G.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_200px] flex-col gap-1 text-body-sm font-medium`,children:[`Standard`,(0,G.jsx)(i,{size:`sm`,value:u,onChange:e=>d(e.target.value),children:e.standards.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,G.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-1 text-body-sm font-medium`,children:[`Rule engine`,(0,G.jsx)(i,{size:`sm`,value:f,onChange:e=>p(e.target.value),children:e.engines.map(e=>(0,G.jsx)(`option`,{value:e,children:Q(e)},e))})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(P,{checked:_,onChange:v,label:`Best-practice rules too`}),(0,G.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Best-practice rules too`})]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(P,{checked:y,onChange:ee,label:`Also make a PDF`}),(0,G.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Also make a PDF`})]})]}),C&&(0,G.jsx)(`p`,{role:`alert`,className:s(g.fail,`m-0`),children:C}),(0,G.jsx)(`div`,{children:(0,G.jsxs)(m,{size:`sm`,variant:`primary`,type:`submit`,disabled:!j,"data-tip":`Open each page and check it`,children:[(0,G.jsx)(w,{"aria-hidden":`true`}),b?`Starting…`:`Scan`]})})]})}var Fe=[`coverage`,`accessibility`,`seo`,`analytics`,`performance`];function Ie(e){return{id:e.id,goal:``,at:e.at,dir:e.dir||``,report:e.quality?{...e.quality,budgets:{accessibility:!1,performance:!1},breaches:[],performance:{pages:e.quality.performance.pages.map(e=>({...e,over:e.over??[]}))}}:null,examples:e.examples??{},visual:null,captured:0,...e.ledger?{ledger:e.ledger}:{}}}function Le({id:e,asked:t}){let[n,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(``),[c,u]=(0,B.useState)(``),[d,f]=(0,B.useState)(``);(0,B.useEffect)(()=>{let t=!1;return i(null),U.scan(e).then(e=>!t&&(i(e),o(``)),e=>!t&&o(e.message)),()=>{t=!0}},[e]);let _=(0,G.jsxs)(`a`,{href:r(`quality`,`scans`),className:s(h({variant:`link`,size:`inline`}),`gap-1 self-start`),children:[(0,G.jsx)(ee,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`Scan history`]});if(!n)return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[_,a?(0,G.jsx)(`p`,{role:`alert`,className:s(g.fail,`m-0`),children:a}):(0,G.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`})]});let y=n.quality?.accessibility,x=y?fe.reduce((e,t)=>e+y.byImpact[t],0):0,S=n.coverage.summary.results,D=n.perf.map(e=>e.lcp).filter(e=>typeof e==`number`),O=D.filter(e=>e<=2500).length,k=n.seo?.analytics.findings.filter(e=>e.status===`fail`).length??0,A=n.pages.filter(e=>e.error),j=S?.failed?`coverage`:n.seo?.pages.some(e=>e.checks.some(e=>e.status===`fail`))?`seo`:k?`analytics`:`coverage`,M=Fe.includes(t||``)?t:j,N=t=>location.hash=r(`quality`,`scans`,encodeURIComponent(e),t),P=async(e,t)=>{f(e),u(``);try{await t()}catch(e){u(e.message)}finally{f(``)}},F=()=>P(`html`,async()=>{if(n.dir){let e=await v(`${n.dir}/scan-report.html`);if(e)throw Error(e)}else l(await U.reportHtml(e),`site-scan-${e}.html`)}),te=()=>P(`pdf`,async()=>{n.pdf||i(await U.print(e)),l(await U.reportPdf(e),`site-scan-${e}.pdf`)}),re=()=>P(`csv`,async()=>l(await U.coverageCsv(e),`wcag-coverage-${e}.csv`)),ie=$(n.urls);return(0,G.jsxs)(`section`,{"aria-labelledby":`scan-h`,className:`flex min-w-0 flex-col gap-4`,children:[_,(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-1`,children:[(0,G.jsx)(se,{id:`scan-h`,icon:w,title:(0,G.jsx)(`span`,{"data-tip":n.urls.join(`
|
|
4
|
-
`),className:`block truncate`,children:ie.join(`, `)||`Site scan`})}),(0,G.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-body-sm text-muted`,children:[ue(n.at),` · `,R(n.urls.length,`page`),` · `,Q(n.checks.engine),`, `,n.checks.label]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,G.jsxs)(m,{size:`sm`,variant:`ghost`,disabled:d===`html`,"data-tip":`Open the HTML report`,onClick:()=>void F(),children:[(0,G.jsx)(T,{"aria-hidden":`true`}),`Report`]}),(0,G.jsxs)(m,{size:`sm`,variant:`ghost`,disabled:d===`pdf`,"data-tip":n.pdf?`Download the PDF`:`Print the report to PDF, then download it`,onClick:()=>void te(),children:[(0,G.jsx)(E,{"aria-hidden":`true`}),d===`pdf`&&!n.pdf?`Printing…`:`PDF`]}),(0,G.jsxs)(m,{size:`sm`,variant:`ghost`,disabled:d===`csv`,"data-tip":`Download the coverage matrix as CSV`,onClick:()=>void re(),children:[(0,G.jsx)(E,{"aria-hidden":`true`}),`CSV`]}),(0,G.jsxs)(`a`,{href:r(`accessibility`,`suites`,`new`,`scan:${encodeURIComponent(e)}`),className:h({size:`sm`,variant:`ghost`}),"data-tip":`Check these pages again later with no model, against a baseline`,children:[(0,G.jsx)(C,{"aria-hidden":`true`}),`Save as regression suite`]})]})]}),c&&(0,G.jsx)(`p`,{role:`alert`,className:`m-0 text-body-sm text-fail`,children:c}),A.length>0&&(0,G.jsxs)(`p`,{className:s(g.warn,`m-0`),children:[R(A.length,`page`),` could not be opened: `,A.map(e=>`${le(e.url)} (${e.error})`).join(`; `)]}),(0,G.jsxs)(L,{label:`What the scan found`,children:[(0,G.jsx)(I,{dot:x?`fail`:`pass`,value:x,label:y?`violations (${y.byImpact.critical} critical, ${y.byImpact.serious} serious)`:`violations`}),S&&(0,G.jsx)(I,{dot:S.failed?`fail`:`pass`,value:`${S.failed} of ${n.coverage.summary.total}`,label:`WCAG criteria failed`}),S&&(0,G.jsx)(I,{dot:S.review?`warn`:`neutral`,value:S.review,label:`need a person's review`}),n.seo&&(0,G.jsx)(I,{dot:n.seo.score>=90?`pass`:n.seo.score>=60?`warn`:`fail`,value:n.seo.score,label:`SEO score`}),n.seo&&(0,G.jsx)(I,{dot:k?`fail`:`neutral`,value:n.seo.analytics.tools.length,label:k?`analytics tools, ${R(k,`problem`)}`:`analytics tools`}),D.length>0&&(0,G.jsx)(I,{dot:O===D.length?`pass`:`warn`,value:`${O} of ${D.length}`,label:`pages with a good LCP`})]}),(0,G.jsx)(ne,{label:`Results`,className:`mb-0`,current:M,onPick:N,tabs:[{id:`coverage`,label:`Coverage`,n:S?`${S.failed} failed`:``,...S?.failed?{tone:`text-fail`}:{}},{id:`accessibility`,label:`Accessibility`,n:y?`${y.failed.length} rules failed`:`not measured`,...y?.failed.length?{tone:`text-fail`}:{}},{id:`seo`,label:`SEO`,n:n.seo?String(n.seo.score):`not collected`,...n.seo?{tone:z(n.seo.score)}:{}},{id:`analytics`,label:`Analytics`,n:n.seo?R(n.seo.analytics.tools.length,`tool`):`not collected`,...k?{tone:`text-fail`}:{}},{id:`performance`,label:`Performance`,n:D.length?`${O} of ${D.length} good`:`not measured`}]}),(0,G.jsxs)(`div`,{role:`tabpanel`,id:`panel-${M}`,"aria-labelledby":`tab-${M}`,className:`@container flex min-w-0 flex-col gap-4`,children:[M===`coverage`&&(0,G.jsx)(je,{c:n.coverage,engineLabel:Q(n.checks.engine)}),M===`accessibility`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(me,{run:Ie(n),standard:n.checks.label,disclaimer:`Automated checks find a part of the WCAG problems; they are a pre-check, not conformance. A manual review still matters.`}),n.review.length>0&&(0,G.jsx)(ae,{level:3,icon:b,title:`Needs a person's review`,n:n.review.length,description:`The engine ran these rules but could not decide: a person looks at the elements they found.`,children:(0,G.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-1 p-0`,children:n.review.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(p,{tone:`warn`,className:`font-mono`,children:[e.rule,(0,G.jsxs)(`span`,{className:`font-sans text-muted`,children:[` · `,R(e.pages,`page`)]})]})},e.rule))})})]}),M===`seo`&&(n.seo?(0,G.jsx)(pe,{seo:n.seo}):(0,G.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`This scan collected no SEO facts.`})),M===`analytics`&&(n.seo?(0,G.jsx)(de,{seo:n.seo}):(0,G.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`This scan collected no analytics tags.`})),M===`performance`&&(0,G.jsx)(ce,{run:Ie(n)})]})]})}function Re({id:e,asked:t}){let[i,a]=(0,B.useState)(null),[o,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(`all`),d=(0,B.useCallback)(()=>{U.view().then(e=>(a(e),c(``)),e=>c(e.message))},[]);(0,B.useEffect)(d,[d]);let p=!!i?.job?.running;(0,B.useEffect)(()=>{if(!p)return;let e=ie(d,2e3);return()=>te(e)},[p,d]);let m=async e=>{try{a(await e())}catch(e){c(e.message)}};if(e)return(0,G.jsx)(Le,{id:n(e),asked:t},e);let h=e=>e.failedRules>0||e.seo!==void 0&&e.seo<90,_=i?l===`attention`?i.scans.filter(h):i.scans:[],v=e=>location.hash=r(`quality`,`scans`,encodeURIComponent(e));return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(oe,{more:(0,G.jsx)(G.Fragment,{children:`Each page opens in ForgeQE's browser with no model, and nothing is clicked or typed. Accessibility uses the rule engine and standard you pick, and the rules that cannot decide are listed for a person. SEO checks the title, description, headings, canonical address, indexing, robots.txt, sitemap, structured data, social preview, mobile viewport and mixed content. Analytics lists each tag with its ids and hits, and flags tags missing on some pages, loaded twice, or sending hits before a consent banner was answered. Core Web Vitals are timed on each page's first load.`}),children:`Accessibility, WCAG coverage, SEO, analytics tags and Core Web Vitals of a list of pages, with no journey to write.`}),o&&(0,G.jsx)(`p`,{role:`alert`,className:s(g.fail,`m-0`),children:o}),!i&&!o&&(0,G.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),i?.job&&(0,G.jsx)(Ne,{job:i.job,onStop:()=>void m(U.stop),onAnswer:(e,t)=>void m(()=>U.answer(e,t))}),i&&!p&&(0,G.jsx)(Pe,{view:i,onStarted:a}),i&&(0,G.jsx)(ae,{icon:O,title:`Scan history`,n:i.scans.length,children:(0,G.jsx)(F,{label:`Scan history`,placeholder:`Find a scan by a site or page`,resetKey:l,empty:`No scans yet. Give a few addresses above and scan them: what each page shows for accessibility, SEO, analytics and timings lands here.`,tools:(0,G.jsx)(f,{items:[{id:`all`,label:`All`,n:i.scans.length},{id:`attention`,label:`Needs a look`,n:i.scans.filter(h).length,alert:!0}],value:l,onChange:u}),head:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`th`,{scope:`col`,className:s(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[38%]`),children:`Sites`}),(0,G.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Pages`}),(0,G.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Violations`}),(0,G.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`SEO`}),(0,G.jsx)(`th`,{scope:`col`,className:s(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Analytics`}),(0,G.jsx)(`th`,{scope:`col`,className:s(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`When`})]}),children:_.map(e=>{let t=e.failedRules?j:h(e)?b:S,n=$(e.urls);return(0,G.jsxs)(`tr`,{onClick:()=>v(e.id),className:`h-12 cursor-pointer border-t border-line-soft align-middle transition-colors duration-150 hover:bg-tint data-[state=selected]:bg-tint-hover`,children:[(0,G.jsx)(`td`,{className:s(`px-4 py-2`,`max-w-0`),children:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(t,{size:15,"aria-label":e.failedRules?`WCAG rules failed`:h(e)?`Needs a look`:`Nothing failed`,className:s(`flex-none`,e.failedRules?`text-fail`:h(e)?`text-warn`:`text-pass`)}),(0,G.jsx)(`a`,{href:r(`quality`,`scans`,encodeURIComponent(e.id)),onClick:e=>e.stopPropagation(),"data-tip":e.urls.join(`
|
|
5
|
-
`),className:`truncate text-ink no-underline hover:underline`,children:n.join(`, `)||e.id})]})}),(0,G.jsx)(`td`,{className:s(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`text-muted`),children:e.pages}),(0,G.jsx)(`td`,{className:s(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,e.violations?`text-fail`:`text-muted`),children:e.violations}),(0,G.jsx)(`td`,{className:s(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,e.seo===void 0?`text-muted`:z(e.seo)),"data-sort":e.seo??-1,children:e.seo??`–`}),(0,G.jsx)(`td`,{className:s(`px-4 py-2`,`hidden text-body-sm text-ink-2 @2xl:table-cell`),children:(0,G.jsx)(`span`,{className:`line-clamp-1`,"data-tip":e.tools.join(`, `),children:e.tools.join(`, `)||(0,G.jsx)(`span`,{className:`text-muted`,children:`none found`})})}),(0,G.jsx)(`td`,{className:s(`px-4 py-2`,`hidden whitespace-nowrap text-body-sm text-muted @xl:table-cell`),"data-tip":ue(e.at),"data-sort":new Date(e.at).getTime()||0,children:re(e.at)})]},e.id)})})})]})}export{Q as a,ge as c,U as d,ye as f,je as i,Ce as l,we as m,Re as n,xe as o,be as p,$ as r,he as s,Ne as t,Se as u};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{H as r,L as i,l as a}from"./preload-helper-BupTYkQW.js";import{t as o}from"./utils-DJRAScIl.js";import{t as s}from"./jsx-runtime-LKYXHABd.js";import{ft as c}from"./api-CLFzGvjv.js";import{D as l,E as u,N as d,O as f,P as p,l as m,w as h}from"./pageBack-DZTkmgGZ.js";import{B as g,Er as _,N as v,P as y,cn as b,ct as x,z as S}from"./line-icons-Cwj9OmCz.js";import{Y as C}from"./index-CPftbTjg.js";import"./step-mark-Bu6fNKW8.js";import{d as w}from"./parts-DAsJI5QF.js";var T=e(t(),1),E=s();function D({error:e}){return e?(0,E.jsx)(`p`,{role:`alert`,className:o(p.fail,`m-0`),children:e}):null}var O=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,k={ok:{label:`Ready to start`,tone:`pass`},limits:{label:`Ready, with limits`,tone:`warn`},blocked:{label:`Not possible`,tone:`fail`}},A={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`}},j={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`}},M={setup:`Set-up`,page:`Page`,test:`Test`},N=e=>e.engine?e.engine===`mobile`?`Mobile workflow`:`Desktop workflow`:M[e.kind],P={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`}},F=e=>e.route===`web`||e.route===`api`||(e.routes?.web??0)>0||(e.routes?.api??0)>0||(e.workflow?.steps??0)>0;function I(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 L={web:`Web`,api:`API`,desktop:`Desktop`,mobile:`Mobile`,data:`Data`,mixed:`Mixed`,unsupported:`Not supported`},R={prepare:`Prepare`,setup:`Set up`,pages:`Pages`,tests:`Tests`,validate:`Validate`,review:`Review`},z=[`prepare`,`setup`,`pages`,`tests`,`validate`,`review`];function B(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 V(e){let t=e?.status||`pending`,n=e?.startedAt&&e?.endedAt?w(Date.parse(e.endedAt)-Date.parse(e.startedAt)):``;return t===`running`?e?.startedAt?`Running for ${w(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 H(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(H).join(` + `):``:``}var U={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`},W=new Set([`gt`,`gte`,`lt`,`lte`]);function G(e){let t=e.expected;return t&&`literal`in t&&/^-?\d+(\.\d+)?$/.test(String(t.literal))&&(W.has(e.match||``)||e.op===`api_status`)?String(t.literal):H(t)}function K(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 q(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=>H(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 ${H(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=K(e.op,void 0,e.target),n=e.match||`exact`;return`Check ${t} of the response ${U[n]||`is`}${n===`exists`||n===`absent`?``:` ${G(e)}`}`}return e.op===`api_store`?`Read ${K(void 0,e.property,e.target)} of the response into ${e.var}`:null}function J(e){let t=q(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 ${H(e.value)}`:e.op===`close`?`Close the browser`:e.op===`fill`?`Fill ${n} with ${H(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`} ${H(e.expected)}`:`is ${e.op}`}${e.wait?`, waiting`:``}`:e.kind===`store`?`Read ${n} into ${e.var}`:e.kind===`set_var`?`Set ${e.var} to ${H(e.value)}`:e.kind===`wait`?`Wait ${e.ms} ms`:e.kind===`unsupported`?e.reason||`Cannot be converted`:e.name||e.kind}var ee={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 te(e){return z.map(t=>({id:t,name:R[t],about:ee[t],status:e?.[t]?.status||`pending`,line:V(e?.[t])}))}function ne({icon:e,title:t,aside:n,children:r}){return(0,E.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,E.jsxs)(`h4`,{className:`m-0 flex items-center gap-2 text-body-lg font-medium`,children:[(0,E.jsx)(e,{size:18,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,E.jsx)(`span`,{className:`flex-1`,children:t}),n&&(0,E.jsx)(`span`,{className:`text-body-sm font-normal text-muted tabular-nums`,children:n})]}),r]})}var Y=(e,t)=>t?n(`tosca`,e,`compare`,encodeURIComponent(t)):n(`tosca`,e,`compare`),X=50,re={before:`Before`,after:`After`,block:`Reusable block`,folder:`Folder`};function Z({nodes:e,status:t,pick:n,onPick:i,depth:a=0}){return(0,E.jsx)(`ul`,{className:o(`m-0 flex list-none flex-col p-0`,a>0&&`ml-4 border-l border-line-soft pl-4`),children:e.map((e,s)=>{if(e.kind===`group`)return(0,E.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,E.jsxs)(`span`,{className:`text-body-sm font-medium text-muted`,children:[re[e.role||`folder`]||`Folder`,`: `,(0,E.jsx)(`span`,{className:`text-ink-2`,children:e.name})]}),(0,E.jsx)(Z,{nodes:e.body||[],status:t,pick:n,onPick:i,depth:a+1})]},`g${s}`);if(e.kind===`if`||e.kind===`loop`){let r=e.condition;return(0,E.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,E.jsxs)(`span`,{className:`text-body-sm font-medium text-muted`,children:[e.kind===`if`?`If`:`Loop`,` `,e.name,`: `,(0,E.jsx)(`code`,{className:`font-mono text-body-sm text-ink-2`,children:r?.tosca}),r?.constant!==void 0&&(0,E.jsxs)(`span`,{children:[`, always `,r.constant?`true`:`false`]})]}),[`then`,`else`,`loop`].map(r=>e[r]?.length?(0,E.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,E.jsx)(`span`,{className:`ml-4 text-body-sm text-muted`,children:r===`then`?`Then`:r===`else`?`Else`:`Each time`}),(0,E.jsx)(Z,{nodes:e[r],status:t,pick:n,onPick:i,depth:a+1})]},r):null)]},`i${s}`)}let c=e.id?t.get(e.id):void 0,l=c?P[c]:void 0;return(0,E.jsx)(`li`,{children:(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":n===e.id,onClick:()=>i(e),className:o(r,`min-w-0 items-start gap-2`),children:[(0,E.jsx)(`span`,{role:`img`,"aria-label":l?.label||`Not converted yet`,"data-tip":l?.label||`Not converted yet`,className:o(`mt-2 size-2 flex-none rounded-full`,l?.dot||`bg-line`)}),(0,E.jsx)(`span`,{className:`w-9 flex-none font-mono text-body-sm text-muted`,children:e.id}),(0,E.jsxs)(`span`,{className:o(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`unsupported`?`text-warn`:`text-ink`),children:[J(e),e.tosca?.step&&(0,E.jsxs)(`span`,{className:`block text-body-sm text-muted`,children:[`Tosca step "`,e.tosca.step,`"`]})]})]})},e.id||s)})})}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||``,s=(0,T.useMemo)(()=>{if(!t||!a)return new Set;let e=RegExp(`tosca:[\\sn\\d,]*\\b${t}\\b`,`i`);return new Set(a.split(`
|
|
2
|
-
`).flatMap((t,n)=>e.test(t)?[n]:[]))},[t,a]),c=i?.path?i.path.slice(i.path.lastIndexOf(`/`)+1):n?N({kind:`test`,engine:n}):`Converted test`;return(0,E.jsx)(m,{label:`Converted test`,className:o(`pane-swap`,r),files:[{name:c,code:a,lang:i?.lang||`plaintext`,...i?.path?{title:i.path}:{},marked:s}],empty:i?`Not written yet.`:`This test case is left out of the plan.`,footer:t&&a?s.size?`${t} is done on line ${[...s].map(e=>e+1).join(`, `)}.`:`No line of the test is marked ${t}.`:void 0})}function ie({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,E.jsxs)(`section`,{"aria-label":`Locators Tosca recorded`,className:`flex flex-col gap-2 pt-4 text-body-sm`,children:[(0,E.jsxs)(`span`,{className:`font-medium`,children:[a.name,` `,(0,E.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,E.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.locators.slice(0,6).map((e,t)=>(0,E.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,E.jsx)(`span`,{className:`w-14 flex-none text-body-sm text-muted`,children:e.strategy}),(0,E.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-body-sm 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,E.jsx)(l,{tone:`warn`,children:`Fragile`})]},t))}):(0,E.jsx)(`span`,{className:`text-muted`,children:`Tosca recorded no locator for it.`})]}):null}function ae({id:e,plan:t,result:n,initial:s,full:m,onPick:w}){let D=t.cases.filter(e=>e.included),[k,A]=(0,T.useState)(``),[M,N]=(0,T.useState)(s||D[0]?.id||``),[P,F]=(0,T.useState)(null),[I,R]=(0,T.useState)(``),[z,B]=(0,T.useState)(``);(0,T.useEffect)(()=>{M&&(B(``),c.case(e,M).then(F,e=>B(e.message)))},[e,M,n?.units.length,n?.status]),(0,T.useEffect)(()=>{R(``),M&&w?.(M)},[M]);let V=new Map((P?.fidelity||[]).map(e=>[e.id,e.status])),H=D.filter(e=>!k||e.name.toLowerCase().includes(k.toLowerCase())),[U,W]=(0,T.useState)(0);(0,T.useEffect)(()=>W(0),[k]),(0,T.useEffect)(()=>{let e=H.findIndex(e=>e.id===M);e>=0&&Math.floor(e/X)!==U&&W(Math.floor(e/X))},[M]);let G=H.slice(U*X,U*X+X),K=e=>n?.units.find(t=>t.kind===`test`&&t.case===e),q=e=>D.filter(t=>e.includes(K(t.id)?.status||``)).length,J=[`${q([`converted`])} converted`,...q([`written`])?[`${q([`written`])} written`]:[],`${q([`failed`,`blocked`])} failed`,`of ${O(D.length,`test case`)}`].join(`, `);if(!D.length)return(0,E.jsx)(f,{center:!0,className:`py-6`,children:`No test case of this plan is converted.`});if(m){let e=t.cases.find(e=>e.id===M),n=K(M),i=P?.fidelity,s=i?i.filter(e=>e.status===`matched`).length:0;return(0,E.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 @5xl:flex-row`,children:[(0,E.jsxs)(`nav`,{"aria-label":`Test cases`,className:o(a,`flex max-h-[360px] min-h-0 w-full flex-none flex-col overflow-hidden p-0 @5xl:max-h-none @5xl:w-80`),children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 border-b border-line-soft px-4 py-4`,children:[(0,E.jsx)(C,{level:3,icon:g,title:`Test cases`,description:`${J}. Pick one to see its Tosca steps beside its test.`}),(0,E.jsx)(u,{id:`find-a-case`,label:`Find a test case`,value:k,onChange:A,className:`max-w-none flex-none`})]}),(0,E.jsxs)(`ul`,{className:`m-0 flex min-h-0 flex-1 list-none flex-col overflow-y-auto p-2`,children:[G.map(e=>{let t=K(e.id),n=t?.status===`converted`?{icon:v,tone:`text-pass`}:t?.status===`failed`?{icon:S,tone:`text-fail`}:t?.status===`blocked`?{icon:_,tone:`text-warn`}:t?.status===`written`?{icon:v,tone:`text-muted`}:{icon:y,tone:`text-muted`},i=M===e.id;return(0,E.jsx)(`li`,{children:(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>N(e.id),className:o(r,`relative items-start gap-2 overflow-hidden`),children:[i&&(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 left-0 w-1 bg-accent`}),(0,E.jsx)(n.icon,{size:16,"aria-label":t?j[t.status].label:`Waiting`,className:o(`translate-y-0.5 flex-none`,n.tone)}),(0,E.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,E.jsx)(`span`,{className:`font-medium text-ink [overflow-wrap:anywhere]`,children:e.name}),(0,E.jsxs)(`span`,{className:`text-muted`,children:[O(e.steps,`step`),`, `,O(e.asserts,`check`),t?.fidelity?`, ${t.fidelity.matched}/${t.fidelity.required} kept`:``]})]})]})},e.id)}),!G.length&&(0,E.jsx)(`li`,{className:`px-4 py-4 text-body-sm text-muted`,children:`No test case matches.`})]}),H.length>X&&(0,E.jsx)(h,{page:U,size:X,total:H.length,onPage:W,label:`Test case pages`})]}),(0,E.jsxs)(`section`,{"aria-label":`Comparison`,className:o(a,`flex min-h-[480px] min-w-0 flex-1 flex-col overflow-hidden p-0`),children:[(0,E.jsx)(`header`,{className:`border-b border-line-soft px-4 py-4`,children:(0,E.jsx)(C,{level:3,icon:g,title:P?.name||e?.name||`Test case`,actions:(0,E.jsxs)(E.Fragment,{children:[e&&L[e.route]&&(0,E.jsx)(l,{tone:`neutral`,icon:!1,children:L[e.route]}),i&&i.length>0&&(0,E.jsxs)(`span`,{className:`text-body-sm text-ink-2 tabular-nums`,children:[s,` of `,i.length,` Tosca steps in the test`]}),n&&(0,E.jsx)(l,{tone:j[n.status].tone,children:j[n.status].label})]})})}),z&&(0,E.jsx)(`p`,{role:`alert`,className:o(`mx-4 mt-2 mb-0`,p.fail),children:z}),(0,E.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 @5xl:grid-cols-2`,children:[(0,E.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col border-line-soft @5xl:border-r`,children:[(0,E.jsxs)(`div`,{className:`flex min-h-12 items-center gap-2 border-b border-line-soft px-4 text-body-sm`,children:[(0,E.jsx)(b,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,E.jsx)(`span`,{className:`font-medium text-ink`,children:`Tosca steps`}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted`,children:`Pick a step to find it in the test`})]}),(0,E.jsx)(`div`,{className:`pane-swap min-h-0 flex-1 overflow-y-auto px-2 py-2`,children:P?(0,E.jsx)(Z,{nodes:P.body,status:V,pick:I,onPick:e=>R(e.id||``)}):(0,E.jsx)(`p`,{role:`status`,className:`m-0 px-2 text-body-sm text-muted`,children:z?`Nothing to show.`:`Loading…`})},P?.case||``),P&&(P.env.length>0||P.warnings.length>0)&&(0,E.jsxs)(`footer`,{className:`flex flex-col gap-1 border-t border-line-soft px-4 py-2 text-body-sm text-ink-2`,children:[P.env.length>0&&(0,E.jsxs)(`span`,{children:[`Environment variables: `,P.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),`.`]}),P.warnings.slice(0,3).map(e=>(0,E.jsx)(`span`,{className:`text-warn`,children:e},e))]}),P&&Q(P.body,I)?.target&&(0,E.jsx)(`div`,{className:`px-4 pb-4`,children:(0,E.jsx)(ie,{view:P,node:Q(P.body,I)})})]}),(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-col`,children:P?(0,E.jsx)($,{view:P,pick:I,engine:t.units.find(e=>e.kind===`test`&&e.case===P.case)?.engine,className:`h-full rounded-none bg-bg`},P.case):(0,E.jsx)(`p`,{className:`m-0 flex flex-1 items-center justify-center px-4 text-center text-body-sm text-muted`,children:z?`Nothing to show.`:`Loading…`})})]})]})]})}return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,E.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-2 text-body-sm font-medium`,children:[`Test case`,(0,E.jsx)(i,{value:M,onChange:e=>N(e.target.value),children:D.map(e=>{let t=K(e.id);return(0,E.jsxs)(`option`,{value:e.id,children:[e.name,t?` (${j[t.status].label.toLowerCase()})`:``]},e.id)})})]}),(0,E.jsx)(`span`,{className:`pb-2 text-body-sm text-muted`,children:J}),(0,E.jsx)(`span`,{className:`flex-1`}),(0,E.jsxs)(`a`,{href:Y(e,M),target:`_blank`,rel:`noopener noreferrer`,"data-tip":`Tosca steps beside the converted test, in a tab of their own`,className:d({variant:`ghost`,size:`sm`}),children:[(0,E.jsx)(x,{"aria-hidden":`true`}),`Compare in a new tab`]})]}),z&&(0,E.jsx)(`p`,{role:`alert`,className:o(p.fail,`m-0`),children:z}),P?(0,E.jsx)($,{view:P,pick:``,engine:t.units.find(e=>e.kind===`test`&&e.case===P.case)?.engine,className:`max-h-[calc(var(--screen)-360px)] min-h-[320px]`},P.case):(0,E.jsx)(`p`,{role:`status`,className:`m-0 flex min-h-[260px] items-center justify-center px-4 text-center text-body-sm text-muted`,children:z?`Nothing to show.`:`Loading…`})]})}export{te as _,D as a,z as c,k as d,I as f,B as g,N as h,P as i,R as l,O as m,Y as n,A as o,F as p,ne as r,L as s,ae as t,j as u};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{F as r,L as i,l as a}from"./preload-helper-BupTYkQW.js";import{n as o,t as s}from"./utils-DJRAScIl.js";import{t as c}from"./jsx-runtime-LKYXHABd.js";import{L as l}from"./palette-CX3RCtC1.js";import{b as u,w as d}from"./api-CLFzGvjv.js";import{C as f,D as p,M as m,N as h,O as g,P as _,n as v}from"./pageBack-DZTkmgGZ.js";import{Cr as y,E as b,Gr as x,O as S,Tt as C,Un as w,it as T,lr as E,lt as D,o as O,qn as k,tt as A,vn as j,w as M,zn as N}from"./line-icons-Cwj9OmCz.js";import{Ct as P,Dt as ee,Et as F,Tt as te,bt as ne,en as re,kt as ie,mt as I,s as ae,t as oe,ut as se,xt as ce}from"./frame-BUnqEFkX.js";import{B as L,J as R,V as le,o as z,z as B}from"./index-CPftbTjg.js";import{a as V,c as H,d as U,i as ue,l as W,m as de,n as G,o as fe,s as K,t as pe}from"./dataParts-BO1c58Zl.js";var q=e(t(),1),J=c(),Y=[`requests`,`kept`,`specs`,`batches`],me={requests:N,kept:k,specs:C,batches:E},X={fetch:`kept`,request:`requests`,gen:`specs`,files:`specs`,insert:`specs`,batches:`batches`,clean:`batches`},Z=e=>Object.values(e.row_counts||{}).reduce((e,t)=>e+t,0);function he({e,kept:t,busy:n,act:r}){return(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 px-1 py-2`,children:[(0,J.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-body-sm`,children:[(0,J.jsx)(`dt`,{className:`text-muted`,children:`Asked for`}),(0,J.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:e.need}),(0,J.jsx)(`dt`,{className:`text-muted`,children:`When`}),(0,J.jsxs)(`dd`,{className:`m-0`,children:[new Date(e.at).toLocaleString(),e.ms===void 0?``:` · answered in ${(e.ms/1e3).toFixed(1)} s`]}),(0,J.jsx)(`dt`,{className:`text-muted`,children:`How`}),(0,J.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,J.jsxs)(J.Fragment,{children:[` · `,(0,J.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.name})]}):null]}),e.why&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`dt`,{className:`text-muted`,children:`The answer`}),(0,J.jsx)(`dd`,{className:`m-0`,children:e.why})]})]}),e.error&&(0,J.jsx)(W,{text:e.error}),Object.entries(e.sample||{}).map(([t,n])=>(0,J.jsx)(U,{title:t===`result`?`Rows found`:t,rows:n,total:e.row_counts?.[t]??n.length},t)),e.sql&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(`span`,{className:`text-body-sm font-medium`,children:`The query`}),(0,J.jsx)(G,{label:`SQL`,children:e.sql})]}),e.script_preview?.length?(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(`span`,{className:`text-body-sm font-medium`,children:`INSERT script`}),(0,J.jsx)(G,{label:`INSERT script`,children:e.script_preview.join(`
|
|
2
|
-
`)})]}):null,t&&e.name&&(0,J.jsx)(`div`,{children:(0,J.jsxs)(m,{size:`sm`,disabled:n,onClick:()=>r(`fetch`,{name:e.name}),"data-tip":`Fetch again`,children:[(0,J.jsx)(w,{"aria-hidden":`true`}),`Refresh`]})})]})}function Q({view:e,log:t,busy:r,act:a}){let[o,c]=(0,q.useState)(`all`),[l,u]=(0,q.useState)(``),[d,_]=(0,q.useState)(``),[v,y]=(0,q.useState)(``),x=t??[],w=(0,q.useMemo)(()=>[...new Set(x.map(e=>e.requester))].sort(),[t]),T=(0,q.useMemo)(()=>[...new Set(x.map(e=>e.database).filter(Boolean))].sort(),[t]),E=x.filter(e=>!e.ok).length,D=x.filter(e=>(o===`all`||o===`ok`===e.ok)&&(!l||e.requester===l)&&(!d||e.database===d)),O=new Set(e.requests.map(e=>e.name));return t===null?(0,J.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading the requests…`}):x.length?(0,J.jsx)(ne,{label:`Requests`,resetKey:`${o}|${l}|${d}`,minWidth:760,fixed:!0,height:ce,placeholder:`Find a request`,tools:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(f,{value:o,onChange:c,items:[{id:`all`,label:`All`,n:x.length},{id:`ok`,label:`Answered`,n:x.length-E},{id:`failed`,label:`Failed`,n:E,alert:!0}]}),w.length>1&&(0,J.jsxs)(i,{size:`sm`,"aria-label":`Who asked`,value:l,onChange:e=>u(e.target.value),className:`w-[180px]`,children:[(0,J.jsx)(`option`,{value:``,children:`Anyone`}),w.map(e=>(0,J.jsx)(`option`,{children:e},e))]}),T.length>1&&(0,J.jsxs)(i,{size:`sm`,"aria-label":`Database`,value:d,onChange:e=>_(e.target.value),className:`w-[160px]`,children:[(0,J.jsx)(`option`,{value:``,children:`Any database`}),T.map(e=>(0,J.jsx)(`option`,{children:e},e))]})]}),head:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`th`,{scope:`col`,className:s(F,`w-9`),children:(0,J.jsx)(`span`,{className:`sr-only`,children:`Open`})}),(0,J.jsx)(`th`,{scope:`col`,className:s(F,`w-[110px]`),children:`When`}),(0,J.jsx)(`th`,{scope:`col`,className:s(F,`w-[150px]`),children:`Who asked`}),(0,J.jsx)(`th`,{scope:`col`,className:F,children:`What for`}),(0,J.jsx)(`th`,{scope:`col`,className:s(F,`w-[110px]`),children:`Database`}),(0,J.jsx)(`th`,{scope:`col`,className:s(F,`w-[140px]`),children:`Answer`}),(0,J.jsx)(`th`,{scope:`col`,className:s(ee,`w-[70px]`),children:`Rows`})]}),empty:`No requests match these filters. Pick All and Anyone to see every request.`,children:D.map(e=>{let t=v===e.id;return(0,J.jsxs)(q.Fragment,{children:[(0,J.jsxs)(`tr`,{className:s(ie,t&&`bg-surface-muted`),onClick:()=>y(t?``:e.id),children:[(0,J.jsx)(`td`,{className:s(P,`pr-0`),children:(0,J.jsx)(m,{variant:`icon`,size:`icon-xs`,"aria-expanded":t,"aria-label":t?`Close the request`:`Open the request`,onClick:n=>(n.stopPropagation(),y(t?``:e.id)),children:t?(0,J.jsx)(b,{"aria-hidden":`true`}):(0,J.jsx)(S,{"aria-hidden":`true`})})}),(0,J.jsx)(`td`,{className:s(P,`whitespace-nowrap text-muted`),"data-tip":new Date(e.at).toLocaleString(),"data-sort":new Date(e.at).getTime()||0,children:I(e.at)}),(0,J.jsx)(`td`,{className:s(P,`truncate`),"data-tip":e.requester,children:e.requester}),(0,J.jsxs)(`td`,{className:s(P,`truncate`),"data-tip":e.need,children:[e.need,e.source===`fetch`?(0,J.jsx)(`span`,{className:`text-muted`,children:` · fetched again`}):null]}),(0,J.jsx)(`td`,{className:s(P,`truncate`),"data-tip":e.database,children:e.database||(0,J.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,J.jsx)(`td`,{className:s(P,`whitespace-nowrap`),children:(0,J.jsx)(p,{tone:e.ok?`pass`:`fail`,children:e.ok?K[e.kind||``]||`Answered`:`Failed`})}),(0,J.jsx)(`td`,{className:te,"data-sort":e.ok?Z(e):-1,children:e.ok?Z(e):``})]}),t&&(0,J.jsx)(`tr`,{className:`border-t border-line-soft bg-surface-muted/40`,children:(0,J.jsx)(`td`,{colSpan:7,className:s(`px-4 py-2`,`max-w-0`),children:(0,J.jsx)(he,{e,kept:!!e.name&&O.has(e.name),busy:r,act:a})})})]},e.id)})}):(0,J.jsx)(g,{page:!0,icon:C,title:`No test data asked for yet`,action:(0,J.jsxs)(`a`,{href:n(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:s(h({size:`sm`}),`no-underline`),children:[(0,J.jsx)(j,{"aria-hidden":`true`}),`Ask`]}),children:`The agents ask before a test runs, or you can ask yourself.`})}function ge({view:e,job:t,busy:r,act:i,onNote:a}){let s=t&&!t.running&&t.kind===`fetch`?t:null,c=s?.result;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:`Each request is kept in test-data/requests with its query or INSERT script. Fetch one again to get the same data with no model: a query reads the rows there now, a spec makes the same rows.`}),s&&(0,J.jsxs)(R,{level:3,icon:w,title:s.target,className:`surface rounded-lg bg-bg p-6 shadow-sm`,children:[c&&!c.ok&&(0,J.jsx)(W,{text:c.error||`It could not fetch the data.`}),c?.ok&&(0,J.jsx)(pe,{r:c,onNote:a})]}),e.requests.length===0?(0,J.jsxs)(g,{className:`py-4`,children:[`No kept requests yet. Each request Miner answers is kept here; `,(0,J.jsx)(`a`,{href:n(`data`,`ask`,`test-data`),children:`ask for test data`}),` to make the first.`]}):(0,J.jsx)(H,{items:e.requests,text:e=>`${e.need} ${e.name} ${e.database} ${e.requester||``}`,label:`Kept requests`,size:15,children:e=>(0,J.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-4 border-t border-line-soft py-2 text-body-sm first:border-t-0`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1`,children:[(0,J.jsx)(`span`,{className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:e.need}),(0,J.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` · `,e.database,` · `,K[e.kind],e.rows?` · ${o(e.rows,`row`)}`:``,e.created?` · ${I(e.created)}`:``,e.requester?` · asked by ${e.requester}`:``]})]}),(0,J.jsx)(m,{size:`icon`,variant:`icon`,disabled:r,onClick:()=>i(`fetch`,{name:e.name}),"aria-label":`Fetch ${e.name} again`,"data-tip":`Fetch ${e.name} again`,className:`size-8`,children:(0,J.jsx)(w,{"aria-hidden":`true`})})]},e.name)})]})}function $({view:e,job:t,busy:o,act:c,onNote:l}){let[d,f]=(0,q.useState)(e.specs[0]??``),[p,h]=(0,q.useState)(``),[v,y]=(0,q.useState)(``),[b,S]=(0,q.useState)(`csv`),[w,E]=(0,q.useState)(!1),O={spec:d,...p?{db:p}:{},...v?{seed:v}:{}},k=t&&!t.running?t:null,M=k&&[`gen`,`files`,`insert`].includes(k.kind)&&k.target===d?k.result:void 0,N=e.databases.find(e=>e.name===p),P=async()=>{try{let{id:e}=await u.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=n(`chats`,e)}catch(e){l(e.message)}};return(0,J.jsx)(R,{id:`spec`,icon:C,title:`Make test data from a spec`,actions:(0,J.jsxs)(m,{variant:`ghost`,onClick:()=>void P(),"data-tip":`Write a spec in a chat`,children:[(0,J.jsx)(j,{"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,J.jsx)(g,{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,J.jsxs)(`div`,{className:s(a,`flex flex-col gap-4`),children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,J.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_260px] flex-col gap-2 text-body-sm font-medium`,children:[`Spec`,(0,J.jsx)(i,{value:d,onChange:e=>f(e.target.value),children:e.specs.map(e=>(0,J.jsx)(`option`,{children:e},e))})]}),(0,J.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-2 text-body-sm font-medium`,children:[`Database`,(0,J.jsxs)(i,{value:p,onChange:e=>h(e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:`The spec's own`}),e.databases.map(e=>(0,J.jsxs)(`option`,{value:e.name,children:[e.name,e.writable?``:` (read only)`]},e.name))]})]}),(0,J.jsxs)(`label`,{className:`flex w-[120px] flex-col gap-2 text-body-sm font-medium`,children:[`Seed`,(0,J.jsx)(r,{value:v,inputMode:`numeric`,placeholder:`Random`,onChange:e=>y(e.target.value.replace(/\D/g,``).slice(0,9))})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(m,{variant:w?void 0:`primary`,disabled:o||!d,onClick:()=>c(`gen`,O),children:[(0,J.jsx)(D,{"aria-hidden":`true`}),`Preview`]}),(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,J.jsxs)(m,{disabled:o||!d,onClick:()=>c(`gen`,{...O,mode:`files`,format:b}),"data-tip":`Write files (${b})`,children:[(0,J.jsx)(T,{"aria-hidden":`true`}),`Export`]}),(0,J.jsx)(i,{"aria-label":`File format`,value:b,onChange:e=>S(e.target.value),className:`w-[88px]`,children:[`csv`,`json`,`sql`].map(e=>(0,J.jsx)(`option`,{children:e},e))})]}),(0,J.jsxs)(m,{disabled:o||!d||!N?.writable,"data-tip":N?.writable?`Insert into ${N.name}`:`Pick a writable database to insert into`,onClick:()=>E(!0),children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Insert`]})]}),w&&N&&(0,J.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Insert test data`,className:s(_.warn,`flex flex-col gap-4`),children:[(0,J.jsxs)(`span`,{className:`font-medium`,children:[`Insert the rows of `,d,` into `,N.name,`?`]}),(0,J.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:`They go in as one batch, which you can remove again under Batches. Only on a test database.`}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsxs)(m,{variant:`primary`,onClick:()=>{E(!1),c(`gen`,{...O,mode:`insert`,confirmed:!0})},children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Insert`]}),(0,J.jsxs)(m,{onClick:()=>E(!1),"data-tip":`Don't insert`,children:[(0,J.jsx)(x,{"aria-hidden":`true`}),`Cancel`]})]})]}),M&&!M.ok&&(0,J.jsx)(W,{text:M.error||`It did not make the data.`}),M?.ok&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[M.batch&&(0,J.jsxs)(`p`,{className:s(_.pass,`m-0`),children:[`Inserted as batch `,(0,J.jsx)(`span`,{className:`font-mono text-body-sm`,children:M.batch}),`.`]}),M.files?.length?(0,J.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-body-sm`,children:[`Wrote`,M.files.map(e=>(0,J.jsx)(ue,{file:e,onNote:l},e))]}):null,(0,J.jsx)(V,{r:M})]})]})})}function _e({view:e,job:t,busy:r,act:a}){let o=e.databases.filter(e=>e.writable),[c,l]=(0,q.useState)(o[0]?.name??``),[u,d]=(0,q.useState)(``),f=t&&!t.running?t:null,p=f?.kind===`batches`?(Array.isArray(f.result)?f.result.flatMap(e=>e.batches||[]):f.result?.batches)??[]:null;return(0,J.jsx)(R,{id:`batch`,icon:E,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:o.length===0?(0,J.jsx)(g,{className:`py-4`,action:(0,J.jsxs)(`a`,{href:n(`settings`,`databases`),className:h({size:`sm`}),children:[(0,J.jsx)(O,{"aria-hidden":`true`}),`Settings, Databases`]}),children:`No writable database: test data is inserted only into one marked writable in Settings.`}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(i,{"aria-label":`Database`,value:c,onChange:e=>l(e.target.value),className:`w-[220px]`,children:o.map(e=>(0,J.jsx)(`option`,{children:e.name},e.name))}),(0,J.jsxs)(m,{disabled:r||!c,onClick:()=>a(`batches`,{db:c}),"data-tip":`List batches`,children:[(0,J.jsx)(D,{"aria-hidden":`true`}),`Show`]})]}),p&&p.length===0&&(0,J.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`No batches in `,f?.target,`.`]}),p&&p.length>0&&(0,J.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:p.map(e=>(0,J.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-4 border-t border-line-soft py-2 text-body-sm first:border-t-0`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,J.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.batch}),(0,J.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[(0,J.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(`, `)]})]}),u===e.batch?(0,J.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`text-body-sm text-warn`,children:[`Remove its rows from `,f?.target,`?`]}),(0,J.jsxs)(m,{variant:`danger`,size:`sm`,onClick:()=>{d(``),a(`clean`,{db:f?.target,batch:e.batch,confirmed:!0})},children:[(0,J.jsx)(y,{"aria-hidden":`true`}),`Remove`]}),(0,J.jsxs)(m,{size:`sm`,onClick:()=>d(``),children:[(0,J.jsx)(M,{"aria-hidden":`true`}),`Keep`]})]}):(0,J.jsx)(m,{size:`icon`,variant:`icon`,disabled:r,onClick:()=>d(e.batch),"aria-label":`Remove batch ${e.batch}`,"data-tip":`Remove batch ${e.batch}`,className:`size-8`,children:(0,J.jsx)(y,{"aria-hidden":`true`})})]},e.batch))}),f?.kind===`clean`&&f.result?.ok&&(0,J.jsxs)(`p`,{className:s(_.pass,`m-0`),children:[`Removed:`,` `,Object.entries(f.result.removed||{}).map(([e,t])=>`${e} ${t}`).join(`, `)]})]})})}function ve({sub:e}){let{view:t,error:r,busy:i,act:a,stop:o,job:c}=de(),[u,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(``),g=Y.includes(e)?e:`requests`;z(`test-data`,g,Y,!e,e=>location.replace(n(`test-data`,e)));let y=c&&!c.running?c.endedAt:``;(0,q.useEffect)(()=>{d.log().then(f,e=>m(e.message))},[y]);let b=(u||[]).filter(e=>!e.ok).length,x=new Set((u||[]).map(e=>e.requester)).size,S={requests:`Requests`,kept:`Kept`,specs:`Specs`,batches:`Batches`},C={requests:u?.length,kept:t?.requests.length,specs:t?.specs.length};return(0,J.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,J.jsx)(ae,{}),(0,J.jsxs)(`main`,{className:s(oe,`@container flex-auto gap-4`),children:[(0,J.jsx)(v,{to:{href:n(`data`,`databases`),label:`All databases`}}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,J.jsx)(re,{pixel:l[`test-data`],size:`lg`,head:!0}),(0,J.jsx)(`h1`,{className:`m-0 text-headline-md`,children:`Test data`}),t&&(0,J.jsx)(se,{label:`Test data`,className:`mb-0`,current:g,hrefOf:e=>n(`test-data`,e),tabs:Y.map(e=>({id:e,label:S[e],icon:me[e],...C[e]===void 0?{}:{n:C[e]}}))}),(0,J.jsx)(`span`,{className:`flex-auto`}),(0,J.jsxs)(`a`,{href:n(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:s(h(),`no-underline`),children:[(0,J.jsx)(j,{"aria-hidden":`true`}),`Ask`]})]}),(0,J.jsx)(le,{more:(0,J.jsx)(J.Fragment,{children:`Kept requests fetch the same data again with no model; specs make data you can insert as batches and remove again.`}),children:`Every request for test data: which agent asked, what for, when, and what Miner sent back.`}),u&&u.length>0&&(0,J.jsxs)(B,{label:`Test data requests`,children:[(0,J.jsx)(L,{dot:`neutral`,value:u.length,label:u.length===1?`request`:`requests`}),(0,J.jsx)(L,{dot:`neutral`,value:x,label:x===1?`asker`:`askers`}),(0,J.jsx)(L,{dot:`fail`,value:b,label:`failed`}),t&&(0,J.jsx)(L,{dot:`pass`,value:t.requests.length,label:`kept`})]}),(r||p)&&(0,J.jsx)(`p`,{role:`alert`,className:s(_.fail,`m-0`),children:r||p}),!t&&!r&&(0,J.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),t&&(0,J.jsxs)(J.Fragment,{children:[c&&(c.running?X[c.kind]!==void 0:X[c.kind]===g)&&(0,J.jsx)(fe,{job:c,onStop:o}),(0,J.jsxs)(`div`,{id:`panel-${g}`,children:[g===`requests`&&(0,J.jsx)(Q,{view:t,log:u,busy:i,act:a}),g===`kept`&&(0,J.jsx)(ge,{view:t,job:c,busy:i,act:a,onNote:m}),g===`specs`&&(0,J.jsx)($,{view:t,job:c,busy:i,act:a,onNote:m}),g===`batches`&&(0,J.jsx)(_e,{view:t,job:c,busy:i,act:a})]})]})]})]})}export{Q as Requests,ve as TestData};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-9BkoTWUE.js";import{F as i,L as a,R as o,l as s}from"./preload-helper-BupTYkQW.js";import{t as c}from"./utils-DJRAScIl.js";import{t as l}from"./jsx-runtime-LKYXHABd.js";import{L as u,U as d,W as f}from"./palette-CX3RCtC1.js";import{b as p,f as m,ut as h,v as g}from"./api-CLFzGvjv.js";import{A as _,C as v,D as y,M as b,N as x,O as S,P as C,S as w,h as T,n as E,o as D,v as ee,x as O}from"./pageBack-DZTkmgGZ.js";import{B as k,C as A,Cr as j,Er as M,F as te,G as ne,Gr as N,Hr as re,Kn as ie,N as ae,P,Qn as oe,Rn as F,Tn as I,Un as se,W as ce,Wt as le,Z as ue,Zn as de,Zt as fe,_t as pe,b as L,cn as R,cr as z,ct as me,er as he,et as ge,hr as _e,kr as B,lt as ve,m as ye,nn as be,o as xe,pr as Se,pt as Ce,sn as V,st as we,tn as Te,ur as Ee,w as De,yr as Oe,z as H}from"./line-icons-Cwj9OmCz.js";import{Ct as U,Dt as ke,Et as W,Ot as G,Sn as Ae,Tt as je,_t as Me,bt as K,ct as Ne,en as Pe,fn as Fe,ft as Ie,kt as Le,mt as q,n as Re,pn as ze,s as Be,st as J,ut as Ve,vt as He,wt as Ue,xt as We}from"./frame-BUnqEFkX.js";import{B as Ge,J as Y,K as Ke,V as qe,Y as Je,o as Ye,z as Xe}from"./index-CPftbTjg.js";import{d as Ze}from"./qualityParts-CoXsldUS.js";import{t as Qe}from"./AgentWork-B28xaxOA.js";var X=e(t(),1),Z={view:()=>g(`GET`,`/api/testmgmt`),cases:()=>g(`GET`,`/api/testmgmt/cases`),case:e=>g(`GET`,`/api/testmgmt/case/${encodeURIComponent(e).replace(/%3A/gi,`:`)}`),sync:()=>g(`POST`,`/api/testmgmt/sync`),schedule:()=>g(`GET`,`/api/testmgmt/schedule`),setSchedule:e=>g(`POST`,`/api/testmgmt/schedule`,e),gaps:()=>g(`GET`,`/api/testmgmt/gaps`),tags:()=>g(`GET`,`/api/testmgmt/tags`),tag:(e,t=!1)=>g(`POST`,`/api/testmgmt/tags`,{...e,...t?{confirmed:!0}:{}}),suites:()=>g(`GET`,`/api/testmgmt/suites`),suite:e=>g(`GET`,`/api/testmgmt/suites/${encodeURIComponent(e)}`),buildSuite:(e,t)=>g(`POST`,`/api/testmgmt/suites/agent`,{request:e,...t?{open:t}:{}}),saveSuite:e=>g(`POST`,`/api/testmgmt/suites`,e),deleteSuite:e=>g(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/delete`,{confirmed:!0}),runSuite:(e,t,n=!1)=>g(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/run`,{...t,...n?{confirmed:!0}:{}}),run:(e,t,n=!1)=>g(`POST`,`/api/testmgmt/run`,{keys:e,...t?{env:t}:{},...n?{confirmed:!0}:{}}),job:()=>g(`GET`,`/api/testmgmt/job`),writeBack:(e,t,n,r)=>g(`POST`,`/api/testmgmt/writeback/${e}`,{keys:t,...r?{tags:r}:{},...n?{digest:n}:{}}),suiteTracker:(e,t,n)=>g(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/tracker`,{...t?{target:t}:{},...n?{digest:n}:{}}),stop:()=>g(`POST`,`/api/testmgmt/stop`),tests:()=>g(`GET`,`/api/testmgmt/tests`),test:e=>g(`GET`,`/api/testmgmt/test/${encodeURIComponent(e)}`),discoveryPlan:()=>g(`GET`,`/api/testmgmt/discover`),discover:e=>g(`POST`,`/api/testmgmt/discover`,{digest:e}),link:e=>g(`POST`,`/api/testmgmt/links`,{changes:e}),setMain:(e,t)=>g(`POST`,`/api/testmgmt/links/main`,{case:e,test:t}),proposeLinks:(e=[])=>g(`POST`,`/api/testmgmt/links/propose`,{keys:e}),ask:(e,t,n,r)=>g(`POST`,`/api/testmgmt/ask`,{intent:e,keys:t,...n?{words:n}:{},...r?.length?{stories:r}:{}}),readStories:e=>g(`POST`,`/api/testmgmt/stories`,{scope:e})},$e={automated:`Automated`,not_automated:`Not automated`,pending:`Pending`,known_defect:`Known defect`,needs_attention:`Needs attention`},et={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`},tt={framework:`Listed by its framework`,code:`Read from the code`,runs:`Known from runs`},nt={passed:`Passed`,failed:`Failed`,blocked:`Blocked`,not_run:`Not run`},Q=l();function rt({title:e,about:t,onClose:n,children:r,footer:i}){return(0,Q.jsxs)(`aside`,{"aria-label":e,className:`flex w-full flex-none flex-col border-t border-line-soft bg-surface-muted xl:sticky xl:top-0 xl:h-(--screen) xl:w-[320px] 2xl:w-[380px] xl:border-t-0 xl:border-l`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-line-soft px-6 py-4`,children:[(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:(0,Q.jsx)(Je,{icon:z,title:e,description:t})}),n&&(0,Q.jsx)(b,{size:`icon-sm`,variant:`icon`,"aria-label":`Close the ${e}`,"data-tip":`Close`,onClick:n,children:(0,Q.jsx)(N,{"aria-hidden":`true`})})]}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 py-6`,children:r}),i&&(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft px-6 py-4`,children:i})]})}function it({title:e,about:t,looking:n,context:i,suggestions:a,placeholder:s,onClose:l,keys:u}){let[d,f]=(0,X.useState)(null),[m,h]=(0,X.useState)(``),[g,v]=(0,X.useState)(!1),[x,S]=(0,X.useState)(``),[w,T]=(0,X.useState)(!1),E=async(e,t,n,r,i)=>{v(!0),S(``);try{let{request:a}=await Z.ask(e,t,r,i),{id:o}=await p.start(a,{});f({id:o,said:n}),T(!1),h(``)}catch(e){S(e.message)}finally{v(!1)}};return(0,Q.jsxs)(rt,{title:e,about:t,onClose:l,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:a.map(e=>(0,Q.jsxs)(b,{size:`sm`,disabled:g||!!e.disabled,"data-tip":e.disabled??e.label,onClick:()=>void E(e.intent,e.keys,e.label,void 0,e.stories),children:[(0,Q.jsx)(e.icon,{"aria-hidden":`true`}),e.label]},e.label))}),(0,Q.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),m.trim()&&E(`ask`,(u??a[0]?.keys??[]).slice(0,50),m.trim(),m.trim())},children:[(0,Q.jsxs)(`label`,{className:`sr-only`,htmlFor:`tm-agent-words`,children:[`Message the `,e]}),(0,Q.jsx)(o,{id:`tm-agent-words`,rows:2,maxLength:1e3,value:m,placeholder:s,onChange:e=>h(e.target.value),className:`min-h-11 flex-1 resize-none`}),(0,Q.jsx)(b,{size:`icon`,variant:`primary`,type:`submit`,disabled:g||!m.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,Q.jsx)(he,{"aria-hidden":`true`})})]})]}),children:[(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,Q.jsx)(_,{state:g||d&&!w?`thinking`:`working`,px:96,label:g?`Starting`:d&&!w?`Working`:`Ready`}),(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:d?w?`Done. Ask again, or open the chat.`:`Working on it…`:n}),i.length>0&&(0,Q.jsx)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:i.map(e=>(0,Q.jsx)(y,{tone:`neutral`,icon:!1,children:e},e))}),d&&(0,Q.jsx)(`p`,{className:`m-0 text-body-lg leading-relaxed text-ink-2`,children:d.said})]}),x&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:x}),d?(0,Q.jsx)(Qe,{id:d.id,label:`The ${e} at work`,onEnd:()=>T(!0)},d.id):(0,Q.jsxs)(`p`,{className:c(`m-0 text-center text-body-sm text-muted`),children:[`Pick what to do below, or say it in your own words. It works in a chat you can open: `,(0,Q.jsx)(`a`,{href:r(`chats`),children:`All chats`}),`.`]})]})}var at={automation:`Mark automated in their tracker`,tags:`Write ForgeQE's tags to their tracker`,untag:`Take ForgeQE's tags off in their tracker`},ot={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.`},st=e=>e.system===`azure_devops`?`Azure DevOps plan ${e.plan}`:`Xray Test Set in ${e.project}`,ct=e=>e.system===`azure_devops`?`ado:${e.plan}`:`xray:${e.project}`,lt=e=>e?.url&&/^https:\/\//i.test(e.url)?e.url:void 0,ut=e=>e.system===`azure_devops`?`Azure DevOps suite ${e.suite} in plan ${e.plan}`:`Xray Test Set ${e.key}`;function dt({plan:e,outcome:t}){let n=new Map((t?.failed??[]).map(e=>[e.key,e.error])),r=new Set((t?.done??[]).map(e=>e.key)),i=(e,t,i=!1)=>(0,Q.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 first:border-t-0`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r.has(e.key)&&(0,Q.jsx)(ae,{size:14,"aria-label":`Written`,className:`flex-none text-pass`}),n.has(e.key)&&(0,Q.jsx)(H,{size:14,"aria-label":`Refused`,className:`flex-none text-fail`}),e.key!==`suite`&&(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.key.replace(/^[a-z_]+:/,``)}),(0,Q.jsx)(`span`,{className:i?`text-muted`:`text-ink-2`,children:e.what})]}),n.has(e.key)&&(0,Q.jsx)(`span`,{className:`text-fail [overflow-wrap:anywhere]`,children:n.get(e.key)})]},`${e.key}-${t}`);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 text-body-sm`,children:[e.changes.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.changes.map((e,t)=>i(e,t))}):(0,Q.jsx)(`p`,{className:`m-0 text-ink-2`,children:`Nothing to write: the trackers already say so.`}),e.skipped.length>0&&(0,Q.jsxs)(`details`,{children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-muted`,children:[`Left out: `,e.skipped.length]}),(0,Q.jsx)(`ul`,{className:`m-0 mt-2 flex list-none flex-col p-0`,children:e.skipped.map((e,t)=>i(e,t,!0))})]})]})}function ft(e,t,n){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),d=(0,X.useRef)(!1);return(0,X.useEffect)(()=>{if(e&&d.current||(d.current=!1,i(null),o(null),c(``),!e))return;let t=!0;return e().then(e=>t&&i(e??null),e=>t&&c(e.message)),()=>{t=!1}},[e]),{plan:r,outcome:a,error:s,busy:l,go:async()=>{if(r){u(!0),c(``);try{let e=await t(r.digest);e&&(d.current=!0,o(e),n(`Wrote ${e.done.length}${e.failed.length?`; the tracker refused ${e.failed.length}`:``}.`))}catch(e){c(e.message)}finally{u(!1)}}}}}function pt({kind:e,keys:t,tags:n,onClose:r,onDone:i}){let[a,o]=(0,X.useState)(null),s=`${t.join(`
|
|
2
|
-
`)}|${(n??[]).join(`
|
|
3
|
-
`)}`;(0,X.useEffect)(()=>o(e?()=>()=>Z.writeBack(e,t,void 0,n).then(e=>e.plan):null),[e,s]);let l=ft(a,r=>Z.writeBack(e,t,r,n).then(e=>e.outcome),i);return(0,Q.jsx)(Ae,{open:!!e,onClose:r,title:e?at[e]:``,description:e?ot[e]:``,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(b,{onClick:r,children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),l.outcome?`Close`:`Cancel`]}),!l.outcome&&(0,Q.jsxs)(b,{busy:l.busy,variant:`primary`,disabled:l.busy||!l.plan?.changes.length,onClick:()=>void l.go(),"data-tip":`Write these changes`,children:[e===`untag`?(0,Q.jsx)(we,{"aria-hidden":`true`}):(0,Q.jsx)(B,{"aria-hidden":`true`}),l.busy?`Writing…`:`${e===`untag`?`Take off`:`Write`} ${l.plan?.changes.length??``}`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[!l.plan&&!l.error&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Working out what would change…`}),l.error&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:l.error}),l.plan&&(0,Q.jsx)(dt,{plan:l.plan,outcome:l.outcome})]})})}function mt({open:e,suite:t,targets:n,onClose:r,onDone:i}){let[o,s]=(0,X.useState)(``),l=t.tracker?void 0:n.find(e=>ct(e)===(o||(n[0]?ct(n[0]):``))),[u,d]=(0,X.useState)(null);(0,X.useEffect)(()=>d(e&&(t.tracker||l)?()=>()=>Z.suiteTracker(t.id,l).then(e=>e.plan):null),[e,t.id,t.tracker?ut(t.tracker):``,l&&ct(l)]);let f=ft(u,e=>Z.suiteTracker(t.id,l,e).then(e=>e.outcome),i),p=t.tracker;return(0,Q.jsx)(Ae,{open:e,onClose:r,title:p?`Keep ${t.name} in step`:`Keep ${t.name} in a tracker`,description:p?`It is ${ut(p)}. Cases the suite gained are added there, and cases it lost are taken out.`:`The suite is made in the tracker with its cases, so the team sees it there. Later, Keep in step makes it match the suite again.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(b,{onClick:r,children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),f.outcome?`Close`:`Cancel`]}),!f.outcome&&(0,Q.jsxs)(b,{busy:f.busy,variant:`primary`,disabled:f.busy||!f.plan?.changes.length,onClick:()=>void f.go(),children:[(0,Q.jsx)(De,{"aria-hidden":`true`}),f.busy?`Writing…`:p?`Keep in step`:`Make it there`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[!p&&(n.length?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Where`,(0,Q.jsx)(a,{value:l?ct(l):``,onChange:e=>s(e.target.value),children:n.map(e=>(0,Q.jsx)(`option`,{value:ct(e),children:st(e)},ct(e)))})]}):(0,Q.jsx)(`p`,{className:`m-0 text-ink-2`,children:`This suite's cases are in no connected Azure DevOps plan or Xray project. Connect one in Settings › Integrations.`})),(p||l)&&!f.plan&&!f.error&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Working out what would change…`}),f.error&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:f.error}),f.plan&&(0,Q.jsx)(dt,{plan:f.plan,outcome:f.outcome}),f.outcome&&!f.outcome.failed.length&&(0,Q.jsx)(y,{tone:`pass`,children:`Done`})]})})}var ht={automated:ae,not_automated:P,pending:te,known_defect:M,needs_attention:M},gt={passed:`pass`,failed:`fail`,blocked:`warn`,not_run:`neutral`};function _t({text:e,tip:t,className:n}){return(0,Q.jsx)(`span`,{"data-tip":t??e,className:c(`line-clamp-2 [overflow-wrap:anywhere]`,n),children:e})}function vt({a:e}){let t=ht[e];return(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body-sm whitespace-nowrap`,children:[(0,Q.jsx)(t,{size:15,"aria-hidden":`true`,className:c(`flex-none`,e===`automated`?`text-pass`:e===`known_defect`?`text-fail`:e===`not_automated`?`text-muted`:`text-warn`)}),$e[e]]})}function yt({o:e}){return(0,Q.jsx)(y,{tone:gt[e],icon:e!==`not_run`,children:nt[e]})}function bt({runs:e}){return e.length?(0,Q.jsx)(ee,{label:`Last runs: ${e.map(e=>e===`p`?`passed`:`failed`).join(`, `)}`,runs:e.map(e=>e===`p`?{tone:`pass`,title:`Passed`}:{tone:`fail`,title:`Failed`})}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`–`})}function xt({tags:e,max:t=3}){return e.length?(0,Q.jsxs)(`span`,{className:`inline-flex flex-wrap gap-1`,children:[e.slice(0,t).map(e=>(0,Q.jsxs)(y,{tone:`neutral`,icon:!1,children:[(0,Q.jsx)(Oe,{size:11,"aria-hidden":`true`}),e]},e)),e.length>t&&(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,"data-tip":e.slice(t).join(`, `),children:[`+`,e.length-t,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`: `,e.slice(t).join(`, `)]})]})]}):null}function St({label:e,items:t,value:n,onChange:r}){let i=t.find(e=>e.id===n);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{size:`sm`,"aria-label":e,value:n,onChange:e=>r(e.target.value),className:c(`w-auto`,i?.alert&&i.n?`text-fail`:void 0),children:t.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.n===void 0?e.label:`${e.label} (${e.n})`},e.id))}),i?.tip&&(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:i.tip})]})}function Ct({figures:e,label:t}){let n=e.filter(e=>e.points.length>=2);return n.length?(0,Q.jsx)(`ul`,{"aria-label":t,className:`m-0 flex list-none flex-col gap-4 p-0`,children:n.map(e=>{let t=e.format??(e=>String(e)),n=e.delta??(e=>String(e)),r=e.points.at(-1),i=e.points.at(-2),a=r.y-i.y,o=e.upIsGood===void 0||a===0?void 0:a>0===e.upIsGood,s=a>0?`up`:a<0?`down`:`no change`;return(0,Q.jsxs)(`li`,{className:`flex flex-col gap-1 border-l-2 border-line pl-4`,children:[(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.label}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-4 gap-y-1`,children:[(0,Q.jsx)(`span`,{className:`text-headline-sm text-ink tabular-nums`,children:t(r.y)}),(0,Q.jsxs)(`span`,{className:c(`text-body-sm font-medium tabular-nums`,o===void 0?`text-muted`:o?`text-pass`:`text-fail`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:a>0?`↗ `:a<0?`↘ `:`→ `}),a===0?`${s} since ${i.x}`:`${s} ${n(Math.abs(a))} since ${i.x}`]})]})]},e.label)})}):(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`The trend starts after a second day of numbers: each visit of Test management keeps the day's.`})}function wt({items:e,series:t,label:n,empty:r}){return r&&!e.some(e=>e.values.some(e=>e>0))?(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:r}):(0,Q.jsxs)(`figure`,{className:`m-0 flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-4 text-body-sm text-ink-2`,children:t.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:c(`inline-block size-[10px] rounded-sm`,e.className),"aria-hidden":`true`}),e.name]},e.name))}),(0,Q.jsx)(T,{series:t.map((t,n)=>({values:e.map(e=>e.values[n]??0),tone:t.className.includes(`accent-line`)?`soft`:`accent`,glow:!t.className.includes(`accent-line`)})),lead:Math.max(0,t.findIndex(e=>!e.className.includes(`accent-line`))),label:`${n}: ${e.map(e=>`${e.x} ${e.values.join(` and `)}`).join(`; `)}`,className:`h-[140px]`}),(0,Q.jsxs)(`span`,{className:`flex justify-between text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{children:e[0]?.x}),(0,Q.jsx)(`span`,{children:e.at(-1)?.x})]})]})}function Tt({label:e,part:t,whole:n,className:r=`bg-accent`}){let i=n?Math.round(t/n*100):0;return(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,140px)_1fr_auto] items-center gap-4 text-body-sm`,children:[(0,Q.jsx)(_t,{text:e,className:`text-ink-2`}),(0,Q.jsx)(`span`,{role:`img`,"aria-label":`${e}: ${t} of ${n}`,className:`min-w-0`,children:(0,Q.jsx)(w,{share:n?t/n:0,lead:r===`bg-accent`,tone:r.includes(`fail`)?`fail`:r.includes(`pass`)?`pass`:void 0,text:`${i}%`})}),(0,Q.jsxs)(`span`,{className:`w-[86px] text-right tabular-nums text-ink-2`,children:[t,` of `,n]})]})}function Et({open:e,onClose:t,title:n,preview:r,onStarted:i}){let[o,s]=(0,X.useState)(null),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&(f(null),m(``),Z.suites().then(e=>{s({list:e.environments,...e.active?{active:e.active}:{}}),u(e.active&&e.environments.includes(e.active)?e.active:e.environments[0]??``)},e=>m(e.message)))},[e]),(0,X.useEffect)(()=>{if(!e||o===null)return;let t=!0;return f(null),m(``),r(l||void 0,!1).then(e=>{t&&f(e.preview??null)},e=>t&&m(e.message)),()=>{t=!1}},[e,l,o]);let _=async()=>{g(!0);try{await r(l||void 0,!0),i(),t()}catch(e){m(e.message)}finally{g(!1)}};return(0,Q.jsx)(Ae,{open:e,onClose:t,title:n,description:`ForgeQE runs these with forgeqe suite, on the environment you pick here. Results go to Runs and back to each case's system, as your settings say.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(b,{onClick:t,children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(b,{variant:`primary`,disabled:h||!d,onClick:()=>void _(),"data-tip":`Start the run`,children:[(0,Q.jsx)(F,{"aria-hidden":`true`}),`Run `,d?d.cases:``]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[o&&o.list.length>0&&(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Environment`,(0,Q.jsx)(a,{value:l,onChange:e=>u(e.target.value),children:o.list.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),d&&(0,Q.jsxs)(`p`,{role:`status`,className:`m-0 text-ink-2`,children:[d.cases,` test case`,d.cases===1?``:`s`,` on `,d.env??`the active environment`,`.`]}),p&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:p})]})})}var Dt=e=>e.lastRun.outcome===`failed`||e.lastRun.outcome===`blocked`,Ot=e=>r(`test-management`,`cases`,encodeURIComponent(e)),kt=e=>r(`test-management`,`tests`,encodeURIComponent(e));function At({tests:e}){let t=(0,Q.jsxs)(`a`,{className:x({size:`sm`}),href:r(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,Q.jsx)(xe,{"aria-hidden":`true`}),`Connect a test plan`]});return e?(0,Q.jsxs)(S,{page:!0,icon:ce,title:`${e} automated test${e===1?``:`s`} found, no test case yet`,action:t,children:[`Your automation repository's code has them: see them on `,(0,Q.jsx)(`a`,{href:r(`test-management`,`tests`),children:`Automated`}),`. Connect a test plan (Azure DevOps, Xray, TestRail, Zephyr Scale or qTest) to see the test cases they cover, which are automated and which are not. It goes in Settings › Integrations.`]}):(0,Q.jsx)(S,{page:!0,icon:R,title:`No test plans connected yet`,action:t,children:`Connect a test plan from your test case system (Azure DevOps, Xray, TestRail, Zephyr Scale or qTest) and its cases show here with their automation, runs and gaps. Cases ForgeQE wrote or automated show here already. In Settings, add it under your system's Test management, Test plans.`})}function jt({cases:e,onChanged:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(`all`),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),p=()=>Z.tests().then(e=>{r(e),a(``)},e=>a(e.message));(0,X.useEffect)(()=>{p()},[]),(0,X.useEffect)(()=>{if(!n?.busy)return;let e=ze(()=>void p(),3e3);return()=>Fe(e)},[n?.busy]),It(n?.busy??null,()=>t(`Done: the tests and their links are up to date.`));let m=(0,X.useMemo)(()=>new Map(e.map(e=>[e.key,e])),[e]);if(i)return(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:i});if(!n)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});let h=n.tests,g={all:h.length,unlinked:h.filter(e=>!e.cases.length).length,linked:h.filter(e=>e.cases.length).length,code:h.filter(e=>e.via===`code`).length},_=h.filter(e=>o===`all`||(o===`unlinked`?!e.cases.length:o===`linked`?e.cases.length>0:e.via===`code`)),v=Pt(_.map(e=>e.file).filter(e=>!!e)),x=async()=>{try{t(`The mapping agent is looking at ${(await Z.proposeLinks()).cases} cases with no test.`),p()}catch(e){t(e.message)}};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(b,{variant:`primary`,onClick:()=>u(!0),disabled:!!n.busy,children:[(0,Q.jsx)(oe,{"aria-hidden":`true`}),`Discover`]}),(0,Q.jsxs)(b,{onClick:()=>void x(),disabled:!!n.busy||!h.length,"data-tip":`The mapping agent links cases that have no test to the tests that check them`,children:[(0,Q.jsx)(z,{"aria-hidden":`true`}),`Link`]}),(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[n.busy?n.busy.what===`discover`?`Discovering tests, started ${q(n.busy.started)}…`:`The mapping agent is at work, started ${q(n.busy.started)}…`:n.discovery?`Discovered ${q(n.discovery.at)}.`:`Not discovered yet: these are read from the code.`,n.proposed>0&&` ${n.proposed} link${n.proposed===1?``:`s`} proposed, waiting on the cases' pages.`]})]}),n.error&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:n.error}),n.discovery&&n.discovery.projects.length>0&&(0,Q.jsx)(Lt,{projects:n.discovery.projects}),(0,Q.jsx)(K,{label:`Automated tests`,placeholder:`Find a test by id, name, file or tag`,height:We,resetKey:o,empty:h.length?`No test matches.`:`No automated test found yet. Discover asks each test project's framework (pytest, .NET, Playwright, Vitest, Jest, Mocha, Robot Framework) for its tests; set the automation repository in Settings › Code first.`,tools:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,Q.jsx)(St,{label:`Tests to show`,items:[{id:`all`,label:`All tests`,n:g.all},{id:`unlinked`,label:`No test case`,n:g.unlinked},{id:`linked`,label:`Linked`,n:g.linked},{id:`code`,label:`Read from the code`,n:g.code,tip:`Their framework was not asked, or could not list them`}],value:o,onChange:s}),v&&(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`Files in `,(0,Q.jsx)(`span`,{className:`font-mono`,children:v})]})]}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`w-[45%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Framework`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Test cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @3xl:table-cell`),children:`Tags`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Last runs`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:_.map(t=>(0,Q.jsxs)(`tr`,{className:G,children:[(0,Q.jsx)(`td`,{className:c(U,`max-w-0`),children:(0,Q.jsxs)(Nt,{uid:t.uid,children:[(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t.name}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-x-2 text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`flex-none font-mono text-accent-fg`,children:t.uid??`No id yet`}),t.file&&(0,Q.jsx)(Mt,{path:t.file.slice(v.length),line:t.line}),t.flaky&&(0,Q.jsx)(y,{tone:`warn`,children:`Flaky`})]})]})}),(0,Q.jsx)(`td`,{className:c(U,`hidden text-body-sm @2xl:table-cell`),children:(0,Q.jsxs)(`span`,{"data-tip":tt[t.via??`runs`],children:[t.framework&&t.framework!==`code`?Ft[t.framework]:(0,Q.jsx)(`span`,{className:`text-muted`,children:`Not known yet`}),t.framework===`gherkin`?`, ${t.runner??`no runner found`}`:``,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`, `,tt[t.via??`runs`]]})]})}),(0,Q.jsx)(`td`,{className:c(U,`text-body-sm`),"data-sort":t.cases.length,children:t.cases.length?(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-x-2`,children:[t.cases.slice(0,4).map(e=>(0,Q.jsx)(`a`,{href:Ot(e),className:`font-mono`,"data-tip":m.get(e)?.title,children:m.get(e)?.id??e},e)),t.cases.length>4&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[`+`,t.cases.length-4]})]}):(0,Q.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,Q.jsx)(`td`,{className:c(U,`hidden @3xl:table-cell`),children:(0,Q.jsx)(xt,{tags:t.tags})}),(0,Q.jsx)(`td`,{className:c(U,`hidden @2xl:table-cell`),"data-sort":t.runs.length?t.runs.filter(e=>e===`p`).length/t.runs.length:-1,children:(0,Q.jsx)(bt,{runs:t.runs})}),(0,Q.jsx)(`td`,{className:c(U,`text-right`),children:(0,Q.jsx)(b,{size:`icon-sm`,variant:`icon`,onClick:()=>f(t),"aria-label":`Link ${t.name} to a test case`,disabled:!e.length||!t.uid,"data-tip":t.uid?`Link to a test case`:`Known from runs only: Discover gives it an id to link`,children:(0,Q.jsx)(V,{"aria-hidden":`true`})})})]},t.uid??t.key))}),(0,Q.jsx)(Rt,{open:l,onClose:()=>u(!1),onStarted:()=>{u(!1),t(`Discovering tests: each project's framework lists its tests.`),p()}}),(0,Q.jsx)(zt,{open:!!d,title:`Link to a test case`,description:d?`Pick the test case ${d.name} checks. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`:void 0,items:e.filter(e=>!d?.cases.includes(e.key)).map(e=>({id:e.key,label:e.title,sub:e.id})),onClose:()=>f(null),onPick:async e=>{d?.uid&&(await Z.link([{case:e,test:d.uid,action:`link`}]),f(null),t(`Linked ${d.uid} to ${m.get(e)?.id??e}.`),p())}})]})}function Mt({path:e,line:t}){let n=e.lastIndexOf(`/`)+1;return(0,Q.jsxs)(`span`,{className:`flex min-w-0 font-mono whitespace-nowrap`,children:[n>0&&(0,Q.jsx)(`span`,{className:`min-w-0 shrink-[999] truncate`,children:e.slice(0,n)}),(0,Q.jsx)(`span`,{className:`min-w-[10ch] truncate`,children:e.slice(n)}),t?`:${t}`:``]})}function Nt({uid:e,children:t}){let n=`flex min-w-0 flex-col gap-1 text-ink no-underline`;return e?(0,Q.jsx)(`a`,{href:kt(e),className:n,children:t}):(0,Q.jsx)(`span`,{className:n,children:t})}function Pt(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 Ft={pytest:`pytest`,dotnet:`.NET`,playwright:`Playwright`,jest:`Jest`,vitest:`Vitest`,mocha:`Mocha`,robot:`Robot Framework`,gherkin:`Gherkin`,code:`Code`};function It(e,t){let[n,r]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{e?r(!0):n&&(r(!1),t())},[e]),n}function Lt({projects:e}){return(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:e.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-start gap-2`,children:[e.ok?(0,Q.jsx)(ae,{size:14,"aria-label":`Listed`,className:`mt-1 flex-none text-pass`}):(0,Q.jsx)(M,{size:14,"aria-label":`Not listed`,className:`mt-1 flex-none text-warn`}),(0,Q.jsxs)(`span`,{children:[e.label,` in `,e.dir?(0,Q.jsx)(`span`,{className:`font-mono`,children:e.dir}):`the repository's root`,`: `,e.ok?`${e.tests} test${e.tests===1?``:`s`}`:`not listed by its framework, read from the code`,e.error&&(0,Q.jsx)(`span`,{className:`block text-muted [overflow-wrap:anywhere]`,children:e.error})]})]},`${e.framework}-${e.dir}-${t}`))})}function Rt({open:e,onClose:t,onStarted:n}){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(``),[s,l]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&(i(null),o(``),Z.discoveryPlan().then(i,e=>o(e.message)))},[e]);let u=async()=>{if(r){l(!0);try{await Z.discover(r.digest),n()}catch(e){o(e.message)}finally{l(!1)}}};return(0,Q.jsx)(Ae,{open:e,onClose:t,title:`Discover tests`,description:`Each test project's framework lists its tests, as a test explorer asks it. This runs the repository's code (pytest imports conftest.py, .NET builds the project) with no secret of ForgeQE's, so look at what will run first.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(b,{onClick:t,children:`Cancel`}),(0,Q.jsxs)(b,{variant:`primary`,onClick:()=>void u(),disabled:!r||s,children:[(0,Q.jsx)(F,{"aria-hidden":`true`}),`Discover`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 text-body-sm`,children:[a&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:a}),!r&&!a&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Finding the test projects…`}),r&&!r.steps.length&&(0,Q.jsx)(`p`,{className:`m-0 text-ink-2`,children:`No test project was found whose framework can be asked. Gherkin features and the code are still read.`}),r&&r.steps.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:r.steps.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{children:[Ft[e.project.framework],` in `,e.project.dir?(0,Q.jsx)(`span`,{className:`font-mono`,children:e.project.dir}):`the repository's root`]}),(0,Q.jsx)(`code`,{className:`font-mono text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.command})]},t))})]})})}function zt({open:e,title:t,description:n,items:r,onClose:i,onPick:a}){let[o,s]=(0,X.useState)(``),[l,u]=(0,X.useState)(``);(0,X.useEffect)(()=>s(``),[e]);let d=async e=>{u(e),s(``);try{await a(e)}catch(e){s(e.message)}finally{u(``)}};return(0,Q.jsx)(Ae,{open:e,onClose:i,title:t,description:n,wide:!0,footer:(0,Q.jsx)(b,{onClick:i,children:`Close`}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o&&(0,Q.jsxs)(`p`,{role:`alert`,className:c(C.fail,`m-0 flex items-center gap-2`),children:[(0,Q.jsx)(H,{size:14,"aria-hidden":`true`}),o]}),(0,Q.jsx)(K,{label:t,placeholder:`Find by id or words`,resetKey:String(e),empty:`Nothing to pick.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Name`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Pick`})})]}),children:r.map(e=>(0,Q.jsxs)(`tr`,{className:G,children:[(0,Q.jsxs)(`td`,{className:c(U,`max-w-0`),children:[(0,Q.jsx)(_t,{text:e.label}),e.sub&&(0,Q.jsx)(`span`,{className:`block truncate font-mono text-body-sm text-muted`,children:e.sub})]}),(0,Q.jsx)(`td`,{className:c(U,`w-24 text-right`),children:(0,Q.jsx)(b,{size:`icon-sm`,variant:`icon`,onClick:()=>void d(e.id),disabled:!!l,"aria-label":`Link ${e.label}`,"data-tip":`Link`,children:(0,Q.jsx)(V,{"aria-hidden":`true`})})})]},e.id))})]})})}var Bt=e=>e&&/^https:\/\//i.test(e)?e:void 0;function Vt({caseKey:e,onRun:t,onChanged:n=()=>{}}){let[i,a]=(0,X.useState)(null),[o,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(``);(0,X.useEffect)(()=>{let t=!0;return a(null),l(``),p(``),Z.case(e).then(e=>{t&&(a(e),l(``))},e=>t&&l(e.message)),()=>{t=!1}},[e]);let m=t=>{p(t),n(),Z.case(e).then(a,e=>p(`${t} Reading the case again failed: ${e.message}`))},h=(0,Q.jsx)(E,{to:{href:r(`test-management`,`cases`),label:`Test cases`}});if(o)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[h,(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:o})]});if(!i)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});let g=i.case,_=[g.key],v=Bt(g.url);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[h,(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_420px] flex-col gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:g.id}),` · `,g.plans.join(`, `)||`Not in a synced plan`]}),(0,Q.jsx)(Je,{icon:k,title:g.title}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[g.priority&&(0,Q.jsxs)(y,{tone:g.priority===1?`fail`:g.priority===2?`warn`:`neutral`,icon:!1,children:[`Priority `,g.priority]}),g.state&&(0,Q.jsx)(y,{tone:`neutral`,children:g.state}),(0,Q.jsx)(vt,{a:g.automation}),g.origin===`forgeqe`&&(0,Q.jsxs)(y,{tone:`running`,icon:!1,children:[(0,Q.jsx)(z,{size:12,"aria-hidden":`true`}),`Written by ForgeQE`,g.createdAt?` ${q(g.createdAt)}`:``]})]})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[v&&(0,Q.jsxs)(`a`,{className:x(),href:v,target:`_blank`,rel:`noreferrer noopener`,"data-tip":`Open in its system`,children:[(0,Q.jsx)(me,{"aria-hidden":`true`}),`Open`]}),g.how!==`none`&&g.how!==`tracker`&&!!g.test?.file&&g.trackerAutomated!==!0&&(0,Q.jsxs)(b,{onClick:()=>d(`automation`),"data-tip":`Mark it automated in its system`,children:[(0,Q.jsx)(B,{"aria-hidden":`true`}),`Mark automated`]}),g.ownTags.some(e=>!g.trackerTags.includes(e))&&(0,Q.jsxs)(b,{onClick:()=>d(`tags`),"data-tip":`Write ForgeQE's tags to its system`,children:[(0,Q.jsx)(B,{"aria-hidden":`true`}),`Write tags`]}),g.ownTags.some(e=>g.trackerTags.includes(e))&&(0,Q.jsxs)(b,{onClick:()=>d(`untag`),"data-tip":`Take ForgeQE's tags off in its system`,children:[(0,Q.jsx)(we,{"aria-hidden":`true`}),`Untag`]}),(0,Q.jsxs)(b,{variant:`primary`,onClick:()=>t([g.key]),children:[(0,Q.jsx)(F,{"aria-hidden":`true`}),`Run`]})]})]}),(0,Q.jsx)(pt,{kind:u,keys:_,onClose:()=>d(null),onDone:m}),f&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2`,children:f}),(g.stale||g.drift)&&(0,Q.jsxs)(`p`,{role:`status`,className:c(C.warn,`m-0 flex items-start gap-2`),children:[(0,Q.jsx)(M,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Q.jsxs)(`span`,{children:[g.stale&&`Its steps changed in its system after its test was written: the next run updates the test. `,g.drift&&(g.trackerAutomated?`Its system marks it automated, but ForgeQE knows no test for it.`:`ForgeQE has a test for it, but its system does not mark it automated.`)]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsx)(K,{label:`Steps`,search:!1,sortable:!1,empty:`Its system holds no steps for it, or it is not in a synced plan.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`w-10`),children:`#`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Action`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Expected result`})]}),children:i.steps.map((e,t)=>(0,Q.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Q.jsx)(`td`,{className:c(U,`text-body-sm text-muted tabular-nums`),children:t+1}),(0,Q.jsx)(`td`,{className:c(U,`text-body-sm [overflow-wrap:anywhere]`),children:e.action}),(0,Q.jsx)(`td`,{className:c(U,`text-body-sm text-ink-2 [overflow-wrap:anywhere]`),children:e.expected??`–`})]},t))}),(0,Q.jsx)(Ht,{detail:i,onChanged:m})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsx)(Y,{level:3,icon:fe,title:`Details`,className:c(s,`text-body-sm`),children:(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[96px_1fr] gap-x-4 gap-y-2`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Last run`}),(0,Q.jsxs)(`dd`,{className:`m-0 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(yt,{o:g.lastRun.outcome}),g.lastRun.at&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[q(g.lastRun.at),g.lastRun.by===`tracker`?`, in its system`:``]})]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Suite`}),(0,Q.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:g.suite??`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Area`}),(0,Q.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:g.group??`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Stories`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:g.stories.join(`, `)||`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Tags`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:g.tags.length?(0,Q.jsx)(xt,{tags:g.tags,max:10}):`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Steps`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:g.steps})]})}),(0,Q.jsx)(Y,{level:3,icon:Te,title:`In suites and packs`,className:c(s,`text-body-sm`),children:i.suites.length||g.packs.length?(0,Q.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[i.suites.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`a`,{href:r(`test-management`,`suites`,e.id),children:e.name})},e.id)),g.packs.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`a`,{href:r(`regression`,e),children:[`Pack `,e]})},e))]}):(0,Q.jsx)(`p`,{className:`m-0 text-muted`,children:`In no suite or regression pack.`})}),i.changes.length>0&&(0,Q.jsx)(Y,{level:3,icon:de,title:`What ForgeQE did`,className:c(`surface rounded-lg bg-bg p-6 shadow-sm`,`text-body-sm`),children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:i.changes.map((e,t)=>(0,Q.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`text-muted`,children:q(e.at)}),` `,e.action,e.story?` for ${e.story}`:``,e.reason?`: ${e.reason}`:``]},t))})})]})]})]})}function Ht({detail:e,onChanged:t}){let n=e.case,[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),[l,u]=(0,X.useState)(``);(0,X.useEffect)(()=>{(n.proposed.length||a)&&Z.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)=>{u(``);try{await Z.link([{case:n.key,test:e,action:r}]),t(i)}catch(e){u(e.message)}},p=async e=>{u(``);try{t(`${e} is the main test now${(await Z.setMain(n.key,e)).mapped?`, and ForgeQE's mapping records it`:``}. Mark automated writes it to the tracker.`)}catch(e){u(e.message)}},m=async()=>{u(``);try{await Z.proposeLinks([n.key]),t(`The mapping agent is looking for this case's tests. Open the case again in a moment.`)}catch(e){u(e.message)}};return(0,Q.jsxs)(Y,{level:3,icon:ne,title:`Automated tests`,className:s,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(b,{size:`sm`,onClick:()=>o(!0),"data-tip":`Link a test`,children:[(0,Q.jsx)(V,{"aria-hidden":`true`}),`Link`]}),(0,Q.jsxs)(b,{size:`sm`,onClick:()=>void m(),"data-tip":`The mapping agent picks the tests that check this case`,children:[(0,Q.jsx)(z,{"aria-hidden":`true`}),`Ask`]})]}),children:[l&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:l}),n.tests.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0 text-body-sm`,children:n.tests.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-start gap-2 border-t border-line-soft py-2 first:border-t-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 [overflow-wrap:anywhere]`,children:[e.name,e.main&&n.tests.length>1&&(0,Q.jsx)(`span`,{"data-tip":`What its tracker records as its automated test, and what a run reuses first`,children:(0,Q.jsx)(y,{tone:`pass`,icon:!1,children:`Main test`})})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-body-sm text-muted`,children:[e.uid&&(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.uid}),e.file&&(0,Q.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:e.file})]}),(0,Q.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[et[e.how],e.why&&e.why!==et[e.how]?`: ${e.why}`:``]})]}),e.uid&&n.tests.length>1&&!e.main&&(0,Q.jsx)(b,{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,Q.jsx)(_e,{"aria-hidden":`true`})}),e.uid&&e.how!==`mapping`&&(0,Q.jsx)(b,{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,Q.jsx)(N,{"aria-hidden":`true`})})]},e.uid??e.key))}):n.test?(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[120px_1fr] gap-x-4 gap-y-2 text-body-sm`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Test`}),(0,Q.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:n.test.name}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`File`}),(0,Q.jsx)(`dd`,{className:`m-0 font-mono [overflow-wrap:anywhere]`,children:n.test.file??`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Known from`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:n.how===`none`?`–`:et[n.how]})]}):(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No automated test is linked. Link one, ask the agent, or ask the agent on the right to automate it.`}),(n.tests.length>0||n.test)&&(0,Q.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-muted`,children:[`Last runs `,(0,Q.jsx)(bt,{runs:e.test?.runs??n.runs})]}),n.proposed.length>0&&(0,Q.jsxs)(`div`,{className:c(`rounded-base bg-surface-muted p-4`,`flex flex-col gap-2 text-body-sm`),children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Proposed by the mapping agent`}),n.proposed.map(e=>{let t=d.get(e.test);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,Q.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t?.name??e.test}),(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.test}),e.confidence?` · ${e.confidence} confidence`:``,e.why?` · ${e.why}`:``]})]}),(0,Q.jsx)(b,{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,Q.jsx)(De,{"aria-hidden":`true`})}),(0,Q.jsx)(b,{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,Q.jsx)(N,{"aria-hidden":`true`})})]},e.test)})]}),(0,Q.jsx)(zt,{open:a,title:`Link a test`,description:`Pick a test that checks ${n.id}. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`,items:(r??[]).filter(e=>e.uid&&!n.tests.some(t=>t.uid===e.uid)).map(e=>({id:e.uid,label:e.name,sub:`${e.uid}${e.file?` · ${e.file}`:``}`})),onClose:()=>o(!1),onPick:async e=>{await Z.link([{case:n.key,test:e,action:`link`}]),o(!1),t(`Linked ${e}.`)}})]})}var Ut=[{id:`all`,label:`All cases`,icon:R,test:()=>!0},{id:`not_automated`,label:`Not automated`,icon:P,test:e=>e.automation===`not_automated`},{id:`failing`,label:`Failing`,icon:H,test:Dt,alert:!0},{id:`pending`,label:`Pending`,icon:te,test:e=>e.automation===`pending`},{id:`generated`,label:`Generated by ForgeQE`,icon:z,test:e=>e.origin===`forgeqe`},{id:`stale`,label:`Steps changed`,icon:M,test:e=>e.stale},{id:`drift`,label:`Tracker disagrees`,icon:M,test:e=>e.drift}],Wt=``,Gt=e=>[...new Set(e.filter(e=>!!e))].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}));function Kt({cases:e,tests:t=0,selected:n,onSelect:r,onRun:i,onChanged:o}){let[s,l]=(0,X.useState)(`all`),[u,d]=(0,X.useState)(Wt),[f,p]=(0,X.useState)(Wt),[m,h]=(0,X.useState)(Wt),[g,_]=(0,X.useState)(Wt),[v,y]=(0,X.useState)(!1),[x,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(null),T=(0,X.useMemo)(()=>Gt(e.flatMap(e=>e.plans)),[e]),E=(0,X.useMemo)(()=>Gt(e.map(e=>e.suite)),[e]),D=(0,X.useMemo)(()=>Gt(e.flatMap(e=>e.tags)),[e]),ee=e.filter(e=>(!u||e.plans.includes(u))&&(!f||e.suite===f)&&(!m||String(e.priority??``)===m)&&(!g||e.tags.includes(g))),O=Ut.find(e=>e.id===s),k=ee.filter(O.test),A=new Set(n),j=(e,t)=>r(t?[...n,e]:n.filter(t=>t!==e)),M=k.length>0&&k.every(e=>A.has(e.key));return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(K,{label:`Test cases`,placeholder:`Find a case by id, title, tag or test`,height:We,selection:{count:n.length,onClear:()=>r([]),actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(b,{size:`sm`,onClick:()=>y(!0),children:[(0,Q.jsx)(Oe,{"aria-hidden":`true`}),`Tag`]}),(0,Q.jsxs)(b,{size:`sm`,onClick:()=>S(!0),"data-tip":`Make a suite of the picked cases`,children:[(0,Q.jsx)(Te,{"aria-hidden":`true`}),`Suite`]}),(0,Q.jsxs)(b,{size:`sm`,onClick:()=>w(`automation`),"data-tip":`Mark the picked cases automated in their tracker`,children:[(0,Q.jsx)(B,{"aria-hidden":`true`}),`Mark automated`]}),(0,Q.jsxs)(b,{size:`sm`,onClick:()=>w(`tags`),"data-tip":`Write ForgeQE's tags to their tracker`,children:[(0,Q.jsx)(B,{"aria-hidden":`true`}),`Write tags`]}),(0,Q.jsxs)(b,{size:`sm`,variant:`primary`,onClick:()=>i(n),children:[(0,Q.jsx)(F,{"aria-hidden":`true`}),`Run`]})]})},resetKey:`${s}|${u}|${f}|${m}|${g}`,empty:e.length?`Nothing matches.`:t?`No test cases yet. The repository's ${t} automated test${t===1?` is`:`s are`} on the Automated tab.`:`No test cases yet.`,tools:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsx)(St,{label:`Show`,items:Ut.map(e=>({id:e.id,label:e.label,n:ee.filter(e.test).length,...e.alert?{alert:!0}:{}})),value:s,onChange:l}),T.length>1&&(0,Q.jsxs)(a,{size:`sm`,"aria-label":`Plan`,value:u,onChange:e=>d(e.target.value),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:Wt,children:`Every plan`}),T.map(e=>(0,Q.jsx)(`option`,{children:e},e))]}),E.length>0&&(0,Q.jsxs)(a,{size:`sm`,"aria-label":`Suite`,value:f,onChange:e=>p(e.target.value),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:Wt,children:`Every suite`}),E.map(e=>(0,Q.jsx)(`option`,{children:e},e))]}),(0,Q.jsxs)(a,{size:`sm`,"aria-label":`Priority`,value:m,onChange:e=>h(e.target.value),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:Wt,children:`Any priority`}),[`1`,`2`,`3`,`4`].map(e=>(0,Q.jsxs)(`option`,{value:e,children:[`Priority `,e]},e))]}),D.length>0&&(0,Q.jsxs)(a,{size:`sm`,"aria-label":`Tag`,value:g,onChange:e=>_(e.target.value),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:Wt,children:`Any tag`}),D.map(e=>(0,Q.jsx)(`option`,{children:e},e))]})]}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`w-10`),children:(0,Q.jsx)(Ke,{"aria-label":`Select every case shown`,checked:M,onCheckedChange:e=>r(e?Gt([...n,...k.map(e=>e.key)]):n.filter(e=>!k.some(t=>t.key===e)))})}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Suite`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Priority`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @xl:table-cell`),children:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @4xl:table-cell`),children:`Last runs`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @xl:table-cell`),children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:k.map(e=>(0,Q.jsxs)(`tr`,{className:G,"data-state":A.has(e.key)?`selected`:void 0,children:[(0,Q.jsx)(`td`,{className:U,children:(0,Q.jsx)(Ke,{"aria-label":`Select ${e.id}`,checked:A.has(e.key),onCheckedChange:t=>j(e.key,t)})}),(0,Q.jsx)(`td`,{className:U,children:(0,Q.jsxs)(`a`,{href:Ot(e.key),className:`flex min-w-[160px] flex-col gap-1 text-ink no-underline @xl:min-w-[220px]`,children:[(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.id}),e.origin===`forgeqe`&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"data-tip":`ForgeQE wrote this case`,children:[(0,Q.jsx)(z,{size:12,"aria-hidden":`true`}),`ForgeQE`]}),e.stories[0]&&(0,Q.jsx)(`span`,{children:e.stories[0]}),(0,Q.jsx)(xt,{tags:e.tags,max:2})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 @xl:hidden`,children:[(0,Q.jsx)(vt,{a:e.automation}),(0,Q.jsx)(yt,{o:e.lastRun.outcome})]})]})}),(0,Q.jsx)(`td`,{className:c(U,`hidden min-w-[120px] max-w-[220px] text-body-sm text-ink-2 [overflow-wrap:anywhere] @2xl:table-cell`),children:e.suite??e.plans[0]??`–`}),(0,Q.jsx)(`td`,{className:c(U,`hidden text-body-sm @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Q.jsxs)(`td`,{className:c(U,`hidden @xl:table-cell`),children:[(0,Q.jsx)(vt,{a:e.automation}),e.stale&&(0,Q.jsx)(`span`,{className:`mt-1 block text-body-sm text-warn`,children:`Steps changed`})]}),(0,Q.jsx)(`td`,{className:c(U,`hidden @4xl:table-cell`),"data-sort":e.runs.length?e.runs.filter(e=>e===`p`).length/e.runs.length:-1,children:(0,Q.jsx)(bt,{runs:e.runs})}),(0,Q.jsx)(`td`,{className:c(U,`hidden @xl:table-cell`),"data-sort":e.lastRun.at&&Date.parse(e.lastRun.at)||0,children:(0,Q.jsxs)(`span`,{"data-tip":e.lastRun.at?`${q(e.lastRun.at)}${e.lastRun.by===`tracker`?`, in its system`:``}`:void 0,children:[(0,Q.jsx)(yt,{o:e.lastRun.outcome}),e.lastRun.at&&(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`, `,q(e.lastRun.at),e.lastRun.by===`tracker`?`, in its system`:``]})]})}),(0,Q.jsx)(`td`,{className:c(U,`text-right whitespace-nowrap`),children:(0,Q.jsx)(b,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":Dt(e)?`Run again`:`Run`,onClick:()=>i([e.key]),children:(0,Q.jsx)(F,{"aria-hidden":`true`})})})]},e.key))}),(0,Q.jsx)(pt,{kind:C,keys:n,onClose:()=>w(null),onDone:e=>o(e)}),(0,Q.jsx)(qt,{open:v,keys:n,onClose:()=>y(!1),onDone:e=>o(e)}),(0,Q.jsx)(Jt,{open:x,keys:n,onClose:()=>S(!1),onDone:e=>o(e)})]})}function qt({open:e,keys:t,onClose:n,onDone:r}){let[a,o]=(0,X.useState)(``),[s,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(null),g=`${s?`-`:`+`}${a.trim()}|${t.join(`
|
|
4
|
-
`)}`,_=m?.asked===g?m:null;(0,X.useEffect)(()=>{e||h(null)},[e]);let v=async()=>{p(!0),d(``);try{let e={[s?`remove`:`add`]:[a.trim()],cases:t};if(!_){let t=await Z.tag(e);h({asked:g,items:t.preview?.items??0});return}let i=await Z.tag(e,!0);h(null),r(`${s?`Removed`:`Added`} the tag ${a.trim()} ${s?`from`:`on`} ${i.changed??0} case${i.changed===1?``:`s`}.`),o(``),n()}catch(e){d(e.message)}finally{p(!1)}};return(0,Q.jsx)(Ae,{open:e,onClose:n,title:`Tag ${t.length} test case${t.length===1?``:`s`}`,description:`ForgeQE keeps its tags in .forgeqe/testmgmt/tags.json, shared with the team through the repository. The case's own tags in its system do not change.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(b,{onClick:n,children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(b,{variant:`primary`,disabled:f||!a.trim()||!!_&&_.items===0,onClick:()=>void v(),children:[(0,Q.jsx)(Oe,{"aria-hidden":`true`}),_?`${s?`Remove from`:`Add to`} ${_.items}`:`Preview`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Tag`,(0,Q.jsx)(i,{value:a,maxLength:40,placeholder:`smoke, release-24.11`,onChange:e=>o(e.target.value)})]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Ke,{checked:s,onCheckedChange:l}),`Remove it instead`]}),_&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-ink-2`,children:_.items===0?`No case would change.`:`${_.items} case${_.items===1?``:`s`} would change. ${s?`Remove`:`Add`} to confirm.`}),u&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:u})]})})}function Jt({open:e,keys:t,onClose:n,onDone:a}){let[o,s]=(0,X.useState)(``),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(!1),p=async()=>{f(!0),u(``);try{let{suite:e}=await Z.saveSuite({name:o.trim(),groups:[],exclude:[],picked:t});a(`Made the suite ${e.name}.`),s(``),n(),location.hash=r(`test-management`,`suites`,e.id)}catch(e){u(e.message)}finally{f(!1)}};return(0,Q.jsx)(Ae,{open:e,onClose:n,title:`A suite of ${t.length} test case${t.length===1?``:`s`}`,description:`Kept in .forgeqe/testmgmt/suites.json. For a suite that keeps up as plans change, ask the Suite agent on Suites.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(b,{onClick:n,children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(b,{variant:`primary`,disabled:d||!o.trim(),onClick:()=>void p(),children:[(0,Q.jsx)(Te,{"aria-hidden":`true`}),`Make the suite`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Name`,(0,Q.jsx)(i,{value:o,maxLength:80,placeholder:`Saved cards`,onChange:e=>s(e.target.value)})]}),l&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:l})]})})}var Yt=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 Zt(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 ${Yt(a.day)}`}}function Qt({view:e,onRunSuite:t}){let n=e.summary;if(!n.cases&&!e.plans.length)return(0,Q.jsx)(At,{tests:n.tests});let i=e.trend;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(Ne,{label:`Headline numbers`,children:[(0,Q.jsx)(J,{label:`Test cases`,icon:R,value:n.cases,change:Zt(i,e=>e.cases,void 0),note:`${e.plans.length} plan${e.plans.length===1?``:`s`}`}),(0,Q.jsx)(J,{label:`Automated`,icon:ae,value:`${n.automated} · ${Xt(n.automated,n.cases)}%`,change:Zt(i,e=>e.automated,!0),note:`${n.newlyAutomated} newly this week`}),(0,Q.jsx)(J,{label:`Not automated`,icon:P,value:n.notAutomated,change:Zt(i,e=>e.notAutomated,!1)}),(0,Q.jsx)(J,{label:`Pending`,icon:te,value:n.pending,tone:n.pending?`text-warn`:void 0,change:Zt(i,e=>e.pending,!1),note:`in Design or not ready`}),(0,Q.jsx)(J,{label:`Failing`,icon:H,value:n.failing,tone:n.failing?`text-fail`:void 0,change:Zt(i,e=>e.failing,!1),note:`their last run`}),(0,Q.jsx)(J,{label:`Generated by ForgeQE`,icon:z,value:n.generated,change:Zt(i,e=>e.generated,!0)})]}),(0,Q.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-2`,children:[(0,Q.jsx)(Y,{icon:ge,title:`Automation coverage`,divider:!1,className:s,children:(0,Q.jsx)(Ct,{label:`Automation coverage, latest and its change`,figures:[{label:`Share of test cases automated`,points:i.map(e=>({x:Yt(e.day),y:Xt(e.automated,e.cases)})),format:e=>`${e}%`,delta:e=>`${e} pt${e===1?``:`s`}`,upIsGood:!0},{label:`Automated`,points:i.map(e=>({x:Yt(e.day),y:e.automated})),upIsGood:!0},{label:`Not automated`,points:i.map(e=>({x:Yt(e.day),y:e.notAutomated})),upIsGood:!1},{label:`Failing`,points:i.map(e=>({x:Yt(e.day),y:e.failing})),upIsGood:!1}]})}),(0,Q.jsx)(Y,{icon:A,title:`Generated and automated, by week`,divider:!1,className:s,children:(0,Q.jsx)(wt,{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:Yt(e.week),values:[e.generated,e.automated]}))})}),(0,Q.jsxs)(Y,{icon:F,title:`Last run of every case`,divider:!1,className:s,children:[(0,Q.jsx)(O,{label:`Passed ${n.cases-n.failing-n.neverRun}, failing ${n.failing}, not run ${n.neverRun}`,parts:[{key:`passed`,value:n.cases-n.failing-n.neverRun,className:`bg-pass`},{key:`failing`,value:n.failing,className:`bg-fail`},{key:`not-run`,value:n.neverRun,className:`bg-muted`}]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-4 text-body-sm`,children:[(0,Q.jsx)(`a`,{href:r(`test-management`,`cases`),className:`no-underline`,children:(0,Q.jsxs)(y,{tone:`pass`,children:[`Passed `,n.cases-n.failing-n.neverRun]})}),(0,Q.jsx)(`a`,{href:r(`test-management`,`gaps`),className:`no-underline`,children:(0,Q.jsxs)(y,{tone:`fail`,children:[`Failing `,n.failing]})}),(0,Q.jsx)(`a`,{href:r(`test-management`,`gaps`),className:`no-underline`,children:(0,Q.jsxs)(y,{tone:`neutral`,children:[`Not run `,n.neverRun]})})]})]}),(0,Q.jsx)(Y,{icon:Te,title:`Automated, by suite`,divider:!1,className:s,actions:(0,Q.jsx)(`a`,{href:r(`test-management`,`gaps`),className:`text-body-sm`,children:`Find gaps`}),children:e.coverage.length?e.coverage.slice(0,8).map(e=>(0,Q.jsx)(Tt,{label:e.suite,part:e.automated,whole:e.cases},e.suite)):(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No suites yet.`})})]}),(0,Q.jsx)(K,{label:`Suites`,placeholder:`Find a suite`,empty:`No suites yet: ask the Suite agent for one on Suites.`,search:e.suites.length>8,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Suite`}),(0,Q.jsx)(`th`,{scope:`col`,className:ke,children:`Cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.suites.map(e=>(0,Q.jsxs)(`tr`,{className:Le,onClick:()=>location.hash=r(`test-management`,`suites`,e.id),children:[(0,Q.jsx)(`td`,{className:U,children:(0,Q.jsx)(`a`,{href:r(`test-management`,`suites`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium`,children:e.name})}),(0,Q.jsx)(`td`,{className:je,children:e.cases}),(0,Q.jsx)(`td`,{className:U,"data-sort":e.last&&Date.parse(e.last.at)||0,children:e.last?(0,Q.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2 text-body-sm`,children:[(0,Q.jsxs)(y,{tone:e.last.failed?`fail`:`pass`,children:[e.last.passed,` passed`,e.last.failed?`, ${e.last.failed} failed`:``]}),(0,Q.jsx)(`span`,{className:`text-muted`,children:q(e.last.at)})]}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not run`})}),(0,Q.jsxs)(`td`,{className:`${U} text-right whitespace-nowrap`,onClick:e=>e.stopPropagation(),children:[!!e.last?.failed&&(0,Q.jsx)(b,{size:`icon-sm`,variant:`icon`,"aria-label":`Rerun the failed cases of ${e.name}`,"data-tip":`Rerun failed`,onClick:()=>t(e.id,`failed`),children:(0,Q.jsx)(ie,{"aria-hidden":`true`})}),(0,Q.jsx)(b,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.name}`,"data-tip":`Run`,onClick:()=>t(e.id),children:(0,Q.jsx)(F,{"aria-hidden":`true`})})]})]},e.id))}),(0,Q.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsx)(ce,{size:14,"aria-hidden":`true`}),n.tests,` automated tests known, `,n.testsWithoutCase,` with no test case behind them.`]})]})}var $t=e=>e&&/^https:\/\//i.test(e)?e:void 0;function en({id:e,title:t,url:n}){let r=$t(n);return(0,Q.jsxs)(`span`,{className:`flex min-w-[220px] flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t}),r?(0,Q.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:`font-mono text-body-sm text-accent-fg`,children:e}):(0,Q.jsx)(`span`,{className:`font-mono text-body-sm text-accent-fg`,children:e})]})}var tn={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 nn(e,t){let n={system:e};for(let r of tn[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 rn=e=>Object.fromEntries(Object.entries(e??{}).filter(([e])=>e!==`system`).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]));function an({gaps:e,onRead:t}){let[n,r]=(0,X.useState)(e.live?.system??`azure_devops`),[o,l]=(0,X.useState)(rn(e.live)),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(``);(0,X.useEffect)(()=>{e.live&&(r(e.live.system),l(rn(e.live)))},[e.live]);let m=async()=>{d(!0),p(``);try{await Z.readStories(nn(n,o)),t()}catch(e){p(e.message)}finally{d(!1)}};return(0,Q.jsxs)(`form`,{className:c(s,`flex flex-col gap-4`),onSubmit:e=>{e.preventDefault(),m()},children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-sm`,children:[(0,Q.jsx)(`span`,{className:`text-muted`,children:`Stories in`}),(0,Q.jsxs)(a,{size:`sm`,value:n,onChange:e=>(r(e.target.value),l({})),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:`azure_devops`,children:`Azure DevOps`}),(0,Q.jsx)(`option`,{value:`jira`,children:`Jira (also Xray and Zephyr Scale)`}),(0,Q.jsx)(`option`,{value:`qtest`,children:`qTest requirements`})]})]}),tn[n].map(e=>(0,Q.jsxs)(`label`,{className:`flex min-w-[140px] flex-[1_1_140px] flex-col gap-1 text-body-sm`,children:[(0,Q.jsx)(`span`,{className:`text-muted`,children:e.label}),(0,Q.jsx)(i,{size:`sm`,value:o[e.key]??``,maxLength:e.list?2e3:200,placeholder:e.placeholder,onChange:t=>l({...o,[e.key]:t.target.value})})]},e.key)),(0,Q.jsxs)(b,{busy:u,size:`sm`,variant:`primary`,type:`submit`,disabled:u||!tn[n].some(e=>e.key!==`project`&&(o[e.key]??``).trim()),children:[(0,Q.jsx)(se,{"aria-hidden":`true`}),u?`Reading…`:`Read`]})]}),f&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:f})]})}function on({kind:e,gaps:t,picked:n=[],onPick:r=()=>{},onRead:i=()=>{}}){let a=(0,Q.jsx)(an,{gaps:t,onRead:i});if(!t.report)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a,(0,Q.jsx)(S,{icon:ye,title:`No stories read yet`,children:`Say which stories to read: a sprint, an iteration, an area, an epic or the ids. ForgeQE reads each story with its test cases and acceptance criteria from the tracker, as Release readiness does, and reads them again with every sync.`})]});let o=(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[t.report.id===`live`?`Read from the tracker${t.report.at?` ${q(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)),l=new Set(n.filter(e=>s.has(e)));return e===`stories`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o,(0,Q.jsx)(K,{label:`Stories with no test case`,placeholder:`Find a story`,empty:`Every story of the release has a test case.`,selection:{count:l.size,onClear:()=>r([])},head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`w-10`),children:(0,Q.jsx)(Ke,{"aria-label":`Pick every story shown`,checked:t.noCase.length>0&&t.noCase.every(e=>l.has(e.id)),onCheckedChange:e=>r(e?t.noCase.map(e=>e.id).slice(0,50):[])})}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`w-[55%]`),children:`Story`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Type`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`State`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Area`})]}),children:t.noCase.map(e=>(0,Q.jsxs)(`tr`,{className:G,"data-state":l.has(e.id)?`selected`:void 0,children:[(0,Q.jsx)(`td`,{className:U,children:(0,Q.jsx)(Ke,{"aria-label":`Pick ${e.id}`,checked:l.has(e.id),onCheckedChange:t=>r(t?[...l,e.id].slice(0,50):[...l].filter(t=>t!==e.id))})}),(0,Q.jsx)(`td`,{className:U,children:(0,Q.jsx)(en,{id:e.id,title:e.title,url:e.url})}),(0,Q.jsx)(`td`,{className:c(U,`hidden text-body-sm @2xl:table-cell`),children:e.type||`–`}),(0,Q.jsx)(`td`,{className:U,children:e.state?(0,Q.jsx)(y,{tone:`neutral`,icon:!1,children:e.state}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`–`})}),(0,Q.jsx)(`td`,{className:c(U,`hidden text-body-sm @2xl:table-cell [overflow-wrap:anywhere]`),children:e.area||`–`})]},e.id))})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o,(0,Q.jsx)(K,{label:`Acceptance criteria no test case covers`,placeholder:`Find a criterion`,empty:`Every traced acceptance criterion has a test case.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`w-[55%]`),children:`Criterion`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Story`})]}),children:t.criteria.map((e,t)=>(0,Q.jsxs)(`tr`,{className:G,children:[(0,Q.jsx)(`td`,{className:c(U,`[overflow-wrap:anywhere]`),children:e.text}),(0,Q.jsx)(`td`,{className:U,children:(0,Q.jsx)(en,{id:e.story,title:e.storyTitle,url:e.url})})]},`${e.story}-${t}`))})]})}var sn=[{id:`stories`,label:`Stories with no case`,icon:ye},{id:`criteria`,label:`Criteria not covered`,icon:R}],cn=[{id:`not_automated`,label:`Not automated`,icon:P},{id:`pending`,label:`Pending`,icon:te},{id:`never_run`,label:`Never run`,icon:P},{id:`failing`,label:`Failing`,icon:H,alert:!0},{id:`stale`,label:`Steps changed`,icon:M},{id:`drift`,label:`Tracker disagrees`,icon:M},{id:`no_case`,label:`Tests with no case`,icon:ce}];function ln({gaps:e,cases:t,tests:n,selected:r,onSelect:i,onRun:a,pickedStories:o=[],onPickStories:s=()=>{},onStoriesRead:l=()=>{}}){let[u,d]=(0,X.useState)(t.length||!n.length?`not_automated`:`no_case`),f=new Map(t.map(e=>[e.key,e])),p=new Map(e.ranked.map(e=>[e.key,e.why])),m=e.ranked.map(e=>e.key),h=new Set(m),g=u===`no_case`||u===`stories`||u===`criteria`?[]:u===`not_automated`?[...m,...e.lists.not_automated.filter(e=>!h.has(e))]:e.lists[u],_=e.stories??{stories:0,noCase:[],criteria:[]},v={stories:_.noCase.length,criteria:_.criteria.length},x=g.map(e=>f.get(e)).filter(e=>!!e),S=new Set(r),C=(e,t)=>i(t?[...r,e]:r.filter(t=>t!==e)),w=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsx)(St,{label:`Gaps to show`,items:[...cn.map(t=>({id:t.id,label:t.label,n:e.counts[t.id],...t.alert?{alert:!0}:{}})),...sn.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:u,onChange:e=>d(e)}),u===`not_automated`&&x.length>0&&(0,Q.jsxs)(b,{size:`sm`,onClick:()=>i(x.slice(0,20).map(e=>e.key)),"data-tip":`Pick the 20 that matter most: priority, failing when run, in a pack, tagged smoke`,children:[(0,Q.jsx)(R,{"aria-hidden":`true`}),`Top 20`]})]});return(0,Q.jsx)(`div`,{className:`flex flex-col gap-6`,children:u===`stories`||u===`criteria`?(0,Q.jsxs)(Q.Fragment,{children:[w,(0,Q.jsx)(on,{kind:u,gaps:_,picked:o,onPick:s,onRead:l})]}):u===`no_case`?(0,Q.jsx)(K,{label:`Tests with no test case`,placeholder:`Find a test`,height:We,empty:`Every test ForgeQE knows has a test case behind it.`,tools:w,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`w-[55%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Tags`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Last runs`})]}),children:e.testsWithoutCase.map(e=>{let t=n.find(t=>t.key===e);return t?(0,Q.jsxs)(`tr`,{className:G,children:[(0,Q.jsxs)(`td`,{className:U,children:[t.uid?(0,Q.jsx)(`a`,{href:kt(t.uid),className:`font-medium [overflow-wrap:anywhere]`,children:t.name}):(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t.name}),t.file&&(0,Q.jsx)(`span`,{className:`block font-mono text-body-sm text-muted [overflow-wrap:anywhere]`,children:t.file}),t.flaky&&(0,Q.jsx)(y,{tone:`warn`,className:`mt-1`,children:`Flaky`})]}),(0,Q.jsx)(`td`,{className:U,children:(0,Q.jsx)(xt,{tags:t.tags})}),(0,Q.jsx)(`td`,{className:U,"data-sort":t.runs.length?t.runs.filter(e=>e===`p`).length/t.runs.length:-1,children:(0,Q.jsx)(bt,{runs:t.runs})})]},e):null})}):(0,Q.jsx)(K,{label:cn.find(e=>e.id===u).label,placeholder:`Find a case`,resetKey:u,height:We,selection:{count:r.length,onClear:()=>i([])},empty:`No gap of this kind.`,tools:w,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`w-10`),children:(0,Q.jsx)(Ke,{"aria-label":`Select every case shown`,checked:x.length>0&&x.every(e=>S.has(e.key)),onCheckedChange:e=>i(e?[...new Set([...r,...x.map(e=>e.key)])]:r.filter(e=>!x.some(t=>t.key===e)))})}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Priority`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @xl:table-cell`),children:u===`not_automated`?`Why it matters`:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:x.map(e=>(0,Q.jsxs)(`tr`,{className:G,"data-state":S.has(e.key)?`selected`:void 0,children:[(0,Q.jsx)(`td`,{className:U,children:(0,Q.jsx)(Ke,{"aria-label":`Select ${e.id}`,checked:S.has(e.key),onCheckedChange:t=>C(e.key,t)})}),(0,Q.jsx)(`td`,{className:U,children:(0,Q.jsxs)(`a`,{href:Ot(e.key),className:`flex min-w-[160px] flex-col gap-1 text-ink no-underline @xl:min-w-[220px]`,children:[(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.id}),e.suite&&(0,Q.jsx)(`span`,{children:e.suite}),(0,Q.jsx)(xt,{tags:e.tags,max:2})]}),(0,Q.jsx)(`span`,{className:`flex flex-wrap items-center gap-1 @xl:hidden`,children:u===`not_automated`?(p.get(e.key)??[]).map(e=>(0,Q.jsx)(y,{tone:`running`,icon:!1,children:e},e)):(0,Q.jsx)(vt,{a:e.automation})})]})}),(0,Q.jsx)(`td`,{className:c(U,`hidden text-body-sm @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Q.jsx)(`td`,{className:c(U,`hidden @xl:table-cell`),children:u===`not_automated`?(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-1`,children:[(p.get(e.key)??[]).map(e=>(0,Q.jsx)(y,{tone:`running`,icon:!1,children:e},e)),!(p.get(e.key)??[]).length&&(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`–`})]}):(0,Q.jsx)(vt,{a:e.automation})}),(0,Q.jsx)(`td`,{className:c(U,`hidden @2xl:table-cell`),children:(0,Q.jsx)(yt,{o:e.lastRun.outcome})}),(0,Q.jsx)(`td`,{className:c(U,`text-right`),children:(0,Q.jsx)(b,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":`Run`,onClick:()=>a([e.key]),children:(0,Q.jsx)(F,{"aria-hidden":`true`})})})]},e.key))})})}var un=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)`,dn={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 fn({suites:e,onRun:t}){return(0,Q.jsx)(K,{label:`Suites`,placeholder:`Find a suite`,height:We,empty:e.length?`Nothing matches.`:`No suites yet. Tell the Suite agent what a suite is for, such as “regression for the payments suite, P1 and anything failing lately”: it picks the cases from your plans, tags and runs.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`w-[40%]`),children:`Suite`}),(0,Q.jsx)(`th`,{scope:`col`,className:ke,children:`Cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(ke,`hidden @xl:table-cell`),children:`Automated`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.map(e=>(0,Q.jsxs)(`tr`,{className:Le,onClick:()=>location.hash=r(`test-management`,`suites`,e.id),children:[(0,Q.jsxs)(`td`,{className:c(U,`max-w-0`),children:[(0,Q.jsxs)(`a`,{href:r(`test-management`,`suites`,e.id),onClick:e=>e.stopPropagation(),className:`flex items-center gap-2 font-medium`,children:[e.built===`agent`?(0,Q.jsx)(z,{size:14,"aria-hidden":`true`,className:`flex-none`}):(0,Q.jsx)(Te,{size:14,"aria-hidden":`true`,className:`flex-none`}),(0,Q.jsx)(_t,{text:e.name})]}),e.description&&(0,Q.jsx)(_t,{text:e.description,className:`mt-1 text-body-sm text-muted`})]}),(0,Q.jsx)(`td`,{className:je,children:e.cases}),(0,Q.jsxs)(`td`,{className:c(je,`hidden @xl:table-cell`),children:[e.cases?Math.round(e.automated/e.cases*100):0,`%`]}),(0,Q.jsx)(`td`,{className:U,"data-sort":e.last&&Date.parse(e.last.at)||0,children:e.last?(0,Q.jsxs)(`span`,{className:`flex flex-col items-start gap-1 text-body-sm`,"data-tip":un(e.last),children:[(0,Q.jsxs)(y,{tone:e.last.failed?`fail`:`pass`,children:[e.last.passed,` passed`,e.last.failed?`, ${e.last.failed} failed`:``]}),(0,Q.jsx)(`span`,{className:`text-muted`,children:q(e.last.at)})]}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not run`})}),(0,Q.jsxs)(`td`,{className:c(U,`text-right whitespace-nowrap`),onClick:e=>e.stopPropagation(),children:[!!e.last?.failed&&(0,Q.jsx)(b,{size:`icon-sm`,variant:`icon`,"aria-label":`Rerun the failed cases of ${e.name}`,"data-tip":`Rerun failed`,onClick:()=>t(e.id,`failed`),children:(0,Q.jsx)(ie,{"aria-hidden":`true`})}),(0,Q.jsx)(b,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.name}`,"data-tip":`Run`,onClick:()=>t(e.id),children:(0,Q.jsx)(F,{"aria-hidden":`true`})})]})]},e.id))})}function pn({id:e,onRun:t,onDeleted:n}){let[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1);(0,X.useEffect)(()=>{a(null),Z.suite(e).then(e=>{a(e),s(``)},e=>s(e.message))},[e]);let p=(0,Q.jsx)(E,{to:{href:r(`test-management`,`suites`),label:`All suites`}});if(o)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[p,(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:o})]});if(!i)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});let m=i.suite,h=i.members.filter(e=>e.case.lastRun.outcome===`failed`||e.case.lastRun.outcome===`blocked`).length;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[p,(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[(0,Q.jsx)(Je,{icon:Te,title:m.name}),m.description&&(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:m.description}),m.tracker&&(0,Q.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[`Kept as`,` `,lt(m.tracker)?(0,Q.jsx)(`a`,{href:lt(m.tracker),target:`_blank`,rel:`noreferrer noopener`,children:ut(m.tracker)}):ut(m.tracker)]})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(m.tracker||i.targets.length>0)&&(0,Q.jsxs)(b,{onClick:()=>f(!0),"data-tip":m.tracker?`Keep it in step with its tracker`:`Keep it in a tracker`,children:[(0,Q.jsx)(B,{"aria-hidden":`true`}),m.tracker?`Update`:`Keep`]}),(0,Q.jsxs)(b,{variant:`danger`,onClick:()=>u(!0),children:[(0,Q.jsx)(j,{"aria-hidden":`true`}),`Delete`]}),h>0&&(0,Q.jsxs)(b,{onClick:()=>t(m.id,`failed`),children:[(0,Q.jsx)(ie,{"aria-hidden":`true`}),`Rerun `,h,` failed`]}),(0,Q.jsxs)(b,{variant:`primary`,onClick:()=>t(m.id),children:[(0,Q.jsx)(F,{"aria-hidden":`true`}),`Run`]})]})]}),(0,Q.jsxs)(Ne,{label:`The suite`,children:[(0,Q.jsx)(J,{compact:!0,label:`Cases`,value:m.cases,note:`${m.automated} automated`}),(0,Q.jsx)(J,{compact:!0,label:`Last run`,value:m.last?`${m.last.passed} passed`:`Not run`,tone:m.last?.failed?`text-fail`:void 0,note:m.last?`${m.last.failed} failed · ${q(m.last.at)}${m.last.from===`report`?``:` · so far`}`:void 0}),(0,Q.jsx)(J,{compact:!0,label:`Runs on`,value:m.env??`Active`,note:m.runs.length?`${m.runs.length} run${m.runs.length===1?``:`s`}`:`never run`}),(0,Q.jsx)(J,{compact:!0,label:`Built`,value:m.built===`agent`?`Suite agent`:m.built===`rules`?`Rules`:`Picked`,note:`updated ${q(m.updatedAt)}`})]}),m.groupsCount.length>0&&(0,Q.jsx)(Y,{level:3,icon:Ce,title:`Why these cases`,className:c(`surface rounded-lg bg-bg p-6 shadow-sm`,`text-body-sm`),children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:m.groupsCount.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`text-muted`,children:m.groups[t]?.rules.map(e=>`${dn[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(` and `)}),(0,Q.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.cases})]},e.label))})}),(0,Q.jsx)(K,{label:`Cases`,placeholder:`Find a case`,empty:`No case meets the suite's rules now.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`w-[45%]`),children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @xl:table-cell`),children:`Why it is in`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Last run`})]}),children:i.members.map(e=>(0,Q.jsxs)(`tr`,{className:G,children:[(0,Q.jsx)(`td`,{className:c(U,`max-w-0`),children:(0,Q.jsxs)(`a`,{href:Ot(e.case.key),className:`flex min-w-0 flex-col gap-1 text-ink no-underline`,children:[(0,Q.jsx)(_t,{text:e.case.title,className:`font-medium`}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.case.id}),(0,Q.jsx)(xt,{tags:e.case.tags})]})]})}),(0,Q.jsx)(`td`,{className:c(U,`hidden text-body-sm text-ink-2 @xl:table-cell`),children:e.group}),(0,Q.jsx)(`td`,{className:U,children:(0,Q.jsx)(vt,{a:e.case.automation})}),(0,Q.jsx)(`td`,{className:U,children:(0,Q.jsx)(yt,{o:e.case.lastRun.outcome})})]},e.case.key))}),(0,Q.jsx)(mt,{open:d,suite:m,targets:i.targets,onClose:()=>f(!1),onDone:()=>void Z.suite(e).then(a,()=>{})}),(0,Q.jsx)(Ae,{open:l,onClose:()=>u(!1),title:`Delete ${m.name}?`,description:`The suite goes from .forgeqe/testmgmt/suites.json. Its cases and their runs stay.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(b,{onClick:()=>u(!1),children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(b,{variant:`destructive`,onClick:()=>void Z.deleteSuite(m.id).then(()=>{u(!1),n()},e=>s(e.message)),children:[(0,Q.jsx)(j,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,Q.jsx)(`p`,{className:`m-0 pt-4 text-body-sm text-ink-2`,children:`Runs already made are kept in Runs.`})})]})}function mn({open:e,onSaved:t}){let[n,r]=(0,X.useState)([]),[i,a]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(``),p=n.findLast(e=>`built`in e)?.built,m=n.filter(e=>`you`in e).map(e=>e.you).join(`. `),h=async t=>{let n=t.trim();if(n){u(!0),f(``),r(e=>[...e,{you:n}]),a(``);try{let t=await Z.buildSuite(m?`${m}. ${n}`:n,e?.id);r(e=>[...e,{built:t}])}catch(e){f(e.message)}finally{u(!1)}}},g=async n=>{if(p){u(!0);try{let{suite:i}=await Z.saveSuite({...n&&e?{id:e.id}:{},name:n&&e?e.name:p.name,description:p.summary,groups:p.groups,exclude:p.exclude,built:`agent`});r([]),t(i)}catch(e){f(e.message)}finally{u(!1)}}};return(0,Q.jsxs)(rt,{title:`Suite agent`,about:`Builds and changes suites from your plans, tags and runs.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(e?[`Leave out cases that are not automated`,`Add everything failing lately`,`Only priority 1 and 2`]:[`Smoke suite`,`P1 cases that failed lately`,`Everything not automated in one suite`]).map(e=>(0,Q.jsxs)(b,{size:`sm`,disabled:l,onClick:()=>void h(e),children:[(0,Q.jsx)(z,{"aria-hidden":`true`}),e]},e))}),(0,Q.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),h(i)},children:[(0,Q.jsx)(`label`,{className:`sr-only`,htmlFor:`tm-suite-words`,children:`Tell the Suite agent what the suite is for`}),(0,Q.jsx)(o,{id:`tm-suite-words`,rows:2,maxLength:1e3,value:i,placeholder:e?`Change ${e.name}, or ask about it`:`Describe the suite you need, e.g. regression for Payments under 30 minutes`,onChange:e=>a(e.target.value),className:`min-h-11 flex-1 resize-none`}),(0,Q.jsx)(b,{size:`icon`,variant:`primary`,type:`submit`,disabled:l||!i.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,Q.jsx)(he,{"aria-hidden":`true`})})]})]}),children:[(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,Q.jsx)(_,{state:l?`thinking`:`working`,px:96,label:l?`Building the suite`:`Ready`}),(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:l?`Building the suite…`:e?`Looking at ${e.name}.`:`Ready. Say what the suite is for.`})]}),n.map((e,t)=>`you`in e?(0,Q.jsx)(`p`,{className:`m-0 text-center text-body-lg leading-relaxed text-ink-2`,children:e.you},t):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`p`,{className:`m-0 text-center text-headline-sm`,children:[e.built.name,`: `,e.built.cases,` case`,e.built.cases===1?``:`s`,`, `,e.built.automated,` automated.`]}),e.built.summary&&(0,Q.jsx)(`p`,{className:`m-0 text-center text-body-sm text-ink-2`,children:e.built.summary}),e.built.note&&(0,Q.jsx)(`p`,{className:`m-0 text-center text-body-sm text-muted`,children:e.built.note}),(0,Q.jsxs)(`div`,{className:c(s,`flex flex-col gap-2 text-body-sm`),children:[e.built.perGroup.map(e=>(0,Q.jsxs)(`span`,{className:`flex items-baseline gap-2`,"data-tip":e.why,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.cases})]},e.label)),e.built.exclude.length>0&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[`Leaves out: `,e.built.exclude.map(e=>`${dn[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(`, `)]})]}),e.built.question&&t===n.length-1&&(0,Q.jsxs)(`div`,{className:c(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2 text-body-sm`),children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.built.question.text}),e.built.question.options.map(e=>(0,Q.jsx)(b,{size:`sm`,disabled:l,onClick:()=>void h(e),className:`justify-start`,children:e},e))]}),e.built.sample.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:e.built.sample.slice(0,5).map(e=>(0,Q.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`flex-none font-mono text-accent-fg`,children:e.case.id}),(0,Q.jsx)(_t,{text:e.case.title,className:`min-w-0 text-ink-2`})]},e.case.key))})]},t)),d&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:d}),p&&(0,Q.jsxs)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:[e&&(0,Q.jsxs)(b,{disabled:l,onClick:()=>void g(!0),children:[(0,Q.jsx)(De,{"aria-hidden":`true`}),`Update `,e.name]}),(0,Q.jsxs)(b,{variant:`primary`,disabled:l,onClick:()=>void g(!1),"data-tip":e?`Save as a new suite`:`Save the suite`,children:[(0,Q.jsx)(De,{"aria-hidden":`true`}),e?`Save new`:`Save`]})]})]})}var hn=[{id:`off`,label:`Off`,icon:P},{id:`hourly`,label:`Every hour`,icon:se},{id:`daily`,label:`Daily`,icon:L}];function gn(e){return!e||e.every===`off`?`Sync: off`:e.every===`hourly`?`Sync: hourly`:e.every===`daily`?`Sync: daily ${e.at}`:`Sync: custom`}function _n({disabled:e}){let[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(null);return(0,X.useEffect)(()=>{Z.schedule().then(e=>i(e.schedule),()=>{})},[]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(b,{size:`icon`,"aria-label":`Schedule`,disabled:e,onClick:()=>n(!0),"data-tip":`Schedule: ${gn(r)}${r?.nextAt?`, next ${Ze(r.nextAt)}`:``}. Set when the plans are synced`,children:(0,Q.jsx)(L,{"aria-hidden":`true`})}),(0,Q.jsx)(bn,{open:t,onClose:()=>n(!1),now:r,onSaved:i})]})}var vn=(e,t)=>!!e&&!!t&&e===t.digest&&t.steps.length>0,yn=(e,t,n)=>e!==`off`&&t&&n&&n.steps.length>0?n.digest:void 0;function bn({open:e,onClose:t,now:n,onSaved:r}){let[a,o]=(0,X.useState)(`off`),[s,l]=(0,X.useState)(`06:00`),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(`loading`),[y,x]=(0,X.useState)(!1),S=n&&n.every!==`off`&&n.every!==`custom`?n.discover:void 0;(0,X.useEffect)(()=>{e&&(d(``),x(!1),h(null),_(`loading`),Z.discoveryPlan().then(e=>{h(e),_(`ready`),x(vn(S,e))},()=>_(`failed`)),o(n&&n.every!==`custom`?n.every:`off`),n?.every===`daily`&&l(n.at))},[e,n]);let w=async()=>{p(!0);try{let e=yn(a,y,m),n=e?{discover:e}:{};r((await Z.setSchedule(a===`daily`?{every:a,at:s,...n}:a===`hourly`?{every:a,...n}:{every:a})).schedule),t()}catch(e){d(e.message)}finally{p(!1)}};return(0,Q.jsx)(Ae,{open:e,onClose:t,title:`Sync on a schedule`,description:`ForgeQE reads every case of the connected test plans again, as Sync does, and the stories Gaps read, in the jobs service (forgeqe testmgmt sync). It can also discover the tests first. It runs while this computer is on.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(b,{onClick:t,children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(b,{variant:`primary`,disabled:f||g===`loading`||a===`daily`&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(s),onClick:()=>void w(),children:[(0,Q.jsx)(De,{"aria-hidden":`true`}),`Save`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":`When to sync`,className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(v,{items:hn.map(e=>({id:e.id,label:e.label,icon:e.icon})),value:a,onChange:o})}),a===`daily`&&(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Time (this computer's clock)`,(0,Q.jsx)(i,{type:`time`,step:60,value:s,onChange:e=>l(e.target.value)})]}),a!==`off`&&m&&m.steps.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(Ke,{checked:y,onCheckedChange:e=>x(e===!0),"aria-label":`Also discover the tests`}),(0,Q.jsx)(`span`,{children:`Also discover the tests first. This runs the repository's code with these commands, with no secret of ForgeQE's. If the test projects change, the schedule stops discovering until you confirm again.`})]}),!!S&&S!==m.digest&&!y&&(0,Q.jsx)(`p`,{className:`m-0 text-warn`,children:`The test projects changed since discovery was agreed to: tick the box to agree to these commands, or the schedule only syncs.`}),y&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:m.steps.map((e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`font-mono text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.command})},t))})]}),a!==`off`&&g===`loading`&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Reading what discovery would run…`}),a!==`off`&&g===`failed`&&!!S&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 text-warn`,children:`What discovery would run could not be read, so saving here turns scheduled discovery off. Close and open this again to try once more.`}),n?.every===`custom`&&(0,Q.jsxs)(`p`,{className:`m-0 text-warn`,children:[`The sync job was changed outside this page (`,n.text,`). Saving here replaces it.`]}),n?.enabled===!1&&(0,Q.jsx)(`p`,{className:`m-0 text-warn`,children:`The sync job is disabled in the jobs service.`}),n?.last&&(0,Q.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`Last scheduled sync `,Ze(n.last.at),`: `,n.last.status.replace(`_`,` `),`.`]}),u&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:u})]})})}var xn={forgeqe:{label:`ForgeQE`,icon:z},script:{label:`Tests`,icon:ce}},Sn=e=>xn[e]??{label:e===`azure_devops`?`Azure DevOps`:e===`jira`?`Jira`:e,icon:re},Cn=e=>e!==`forgeqe`&&e!==`script`,wn=[];function Tn({tags:e,cases:t=[],onChanged:n}){let[r,i]=(0,X.useState)(`all`),[a,o]=(0,X.useState)(null),s=e=>e.system===`azure_devops`||e.system===`jira`,l=e=>t.filter(t=>t.ownTags.includes(e)&&!t.trackerTags.includes(e)&&s(t)).map(e=>e.key),u=e=>t.filter(t=>t.ownTags.includes(e)&&t.trackerTags.includes(e)&&s(t)).map(e=>e.key),d=e.tags.filter(e=>r===`all`||(r===`out`?e.outOfStep>0:r===`tracker`?e.from.some(Cn):e.from.includes(r))),f=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap gap-x-6 gap-y-1 text-body-sm text-muted`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.tags.length}),` tag`,e.tags.length===1?``:`s`,` in use`]}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`b`,{className:`text-ink tabular-nums`,children:f(e.casesTagged,e.cases)}),` of test cases tagged (`,e.casesTagged,` of `,e.cases,`)`]}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`b`,{className:`text-ink tabular-nums`,children:f(e.testsTagged,e.tests)}),` of tests tagged (`,e.testsTagged,` of `,e.tests,`)`]}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`b`,{className:c(`tabular-nums`,e.tags.some(e=>e.outOfStep)?`text-warn`:`text-ink`),children:e.tags.filter(e=>e.outOfStep).length}),` out of step (a case's tag its test lacks)`]})]}),(0,Q.jsx)(K,{label:`Tags`,placeholder:`Find a tag`,height:We,resetKey:r,empty:e.tags.length?`Nothing matches.`:`No tags yet: tag cases in Test cases, or in their system.`,tools:(0,Q.jsx)(St,{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(Cn)).length},{id:`script`,label:`From tests`,n:e.tags.filter(e=>e.from.includes(`script`)).length},{id:`forgeqe`,label:`ForgeQE's`,n:e.tags.filter(e=>e.from.includes(`forgeqe`)).length},{id:`out`,label:`Out of step`,n:e.tags.filter(e=>e.outOfStep).length,alert:!0}],value:r,onChange:i}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`w-[28%]`),children:`Tag`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Comes from`}),(0,Q.jsx)(`th`,{scope:`col`,className:ke,children:`Test cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:ke,children:`Tests`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @xl:table-cell`),children:`Out of step`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Used by suites`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:d.map(e=>(0,Q.jsxs)(`tr`,{className:G,children:[(0,Q.jsx)(`td`,{className:U,children:(0,Q.jsxs)(y,{tone:`neutral`,icon:!1,children:[(0,Q.jsx)(Oe,{size:12,"aria-hidden":`true`}),e.name]})}),(0,Q.jsx)(`td`,{className:U,children:(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.from.map(e=>{let t=Sn(e);return(0,Q.jsxs)(y,{tone:`neutral`,icon:!1,children:[(0,Q.jsx)(t.icon,{size:12,"aria-hidden":`true`}),t.label]},e)})})}),(0,Q.jsx)(`td`,{className:je,children:e.cases}),(0,Q.jsx)(`td`,{className:je,children:e.tests}),(0,Q.jsx)(`td`,{className:c(U,`hidden @xl:table-cell`),"data-sort":e.outOfStep||0,children:e.outOfStep?(0,Q.jsx)(y,{tone:`warn`,children:e.outOfStep}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`–`})}),(0,Q.jsx)(`td`,{className:c(U,`hidden text-body-sm text-ink-2 @2xl:table-cell`),children:e.suites.join(`, `)||`–`}),(0,Q.jsxs)(`td`,{className:c(U,`text-right`),children:[l(e.name).length>0&&(0,Q.jsx)(b,{size:`icon-sm`,variant:`icon`,"aria-label":`Write the tag ${e.name} to the trackers of ${l(e.name).length} cases`,"data-tip":`Write to the trackers of ${l(e.name).length} cases`,onClick:()=>o({kind:`tags`,keys:l(e.name)}),children:(0,Q.jsx)(B,{"aria-hidden":`true`})}),u(e.name).length>0&&(0,Q.jsx)(b,{size:`icon-sm`,variant:`icon`,"aria-label":`Take the tag ${e.name} off in the trackers of ${u(e.name).length} cases`,"data-tip":`Take off in the trackers of ${u(e.name).length} cases`,onClick:()=>o({kind:`untag`,keys:u(e.name),tags:[e.name]}),children:(0,Q.jsx)(we,{"aria-hidden":`true`})})]})]},e.name))}),(0,Q.jsx)(pt,{kind:a?.kind??null,keys:a?.keys??wn,tags:a?.tags,onClose:()=>o(null),onDone:e=>n?.(e)})]})}function En({uid:e,tab:t,cases:n,onChanged:i}){let[a,o]=(0,X.useState)(null),[s,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(``),g=(0,X.useCallback)(()=>Z.test(e).then(e=>{o(e),l(``)},e=>l(e.message)),[e]);(0,X.useEffect)(()=>{o(null),g()},[g]);let _=(0,Q.jsx)(E,{to:{href:r(`test-management`,`tests`),label:`Automated tests`}});if(s)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[_,(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:s})]});if(!a)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});let v=a.test,x=[...a.cases].sort((e,t)=>Number(t.lastRun.outcome===`failed`)-Number(e.lastRun.outcome===`failed`)),S=v.nativeId&&!(v.file&&v.nativeId.startsWith(v.file))?v.nativeId:void 0,w=!!v.framework&&v.framework!==`code`,T=w?Ft[v.framework]:``,D=e=>{h(``),p(e),i(e),g()},ee=async(t,n)=>{try{await Z.link([{case:t,test:e,action:`unlink`}]),D(`Unlinked ${e} from ${n}. It is not linked again by itself.`)}catch(e){h(e.message)}},O=[{id:`code`,label:`Code`},{id:`cases`,label:`Test cases`,n:x.length}],k=O.find(e=>e.id===t)?.id??`code`,A=encodeURIComponent(e);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[_,(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_420px] flex-col gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:v.uid}),w&&` · ${T}${v.framework===`gherkin`?`, ${v.runner??`no runner found`}`:``}`,v.file&&(0,Q.jsxs)(Q.Fragment,{children:[` · `,(0,Q.jsxs)(`span`,{className:`font-mono`,children:[v.file,v.line?`:${v.line}`:``]})]})]}),(0,Q.jsx)(Je,{icon:ne,title:v.name}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-sm`,children:[v.last?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Dn,{status:v.last.status}),(0,Q.jsx)(`span`,{className:`text-muted`,children:q(v.last.at)})]}):(0,Q.jsx)(yt,{o:`not_run`}),v.runs.length>0&&(0,Q.jsx)(bt,{runs:v.runs}),v.flaky&&(0,Q.jsx)(y,{tone:`warn`,children:`Flaky`}),v.quarantined&&(0,Q.jsx)(y,{tone:`neutral`,children:`Quarantined`}),v.tags.length>0&&(0,Q.jsx)(xt,{tags:v.tags,max:4}),(0,Q.jsxs)(`span`,{className:`text-muted [overflow-wrap:anywhere]`,children:[`· `,tt[v.via??`runs`],S&&(0,Q.jsxs)(Q.Fragment,{children:[` · Framework id `,(0,Q.jsx)(`span`,{className:`font-mono text-ink-2`,children:S})]})]})]})]}),(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsxs)(b,{onClick:()=>d(!0),disabled:!n.length,"data-tip":n.length?`Link to a test case`:`The project has no test case to link to yet`,children:[(0,Q.jsx)(V,{"aria-hidden":`true`}),`Link`]})})]}),f&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:f}),m&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:m}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Ie,{prefix:`ttab`,tabs:O,current:k,onPick:e=>location.hash=e===`code`?r(`test-management`,`tests`,A):r(`test-management`,`tests`,A,e),label:`Test`}),(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`ttab-panel-${k}`,"aria-labelledby":`ttab-${k}`,className:`flex min-w-0 flex-col gap-4 text-body-sm`,children:[k===`code`&&(a.source?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`pre`,{tabIndex:0,role:`region`,"aria-label":`Code of ${v.name}`,className:c(`overflow-auto rounded-base bg-surface-muted p-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,`m-0 max-h-[640px] whitespace-pre focus-visible:outline-offset-[-2px]`),children:a.source.lines.map((e,t)=>{let n=a.source.from+t;return(0,Q.jsxs)(`span`,{className:c(`flex`,n===v.line&&`bg-accent-soft`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`w-12 flex-none pr-4 text-right text-muted tabular-nums select-none`,children:n}),(0,Q.jsx)(`span`,{className:`pr-4 whitespace-pre`,children:e})]},n)})}),a.source.more&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[`Lines `,a.source.from,`–`,a.source.from+a.source.lines.length-1,` of `,a.source.total,`.`]})]}):(0,Q.jsx)(`p`,{className:`m-0 text-muted`,children:v.file?`Its file could not be read from the repository.`:`Known from runs only: no file is known for it.`})),k===`cases`&&(0,Q.jsx)(K,{label:`Linked test cases`,search:x.length>10,columns:!1,empty:`Linked to no test case yet. Link it to the case it checks, so its runs count for that case.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Linked`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:x.map(e=>(0,Q.jsx)(On,{c:e,onUnlink:()=>void ee(e.key,e.id)},e.key))})]})]}),(0,Q.jsx)(zt,{open:u,title:`Link to a test case`,description:`Pick the test case ${v.name} checks. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`,items:n.filter(e=>!v.cases.includes(e.key)).map(e=>({id:e.key,label:e.title,sub:e.id})),onClose:()=>d(!1),onPick:async t=>{await Z.link([{case:t,test:e,action:`link`}]),d(!1),D(`Linked ${e} to ${n.find(e=>e.key===t)?.id??t}.`)}})]})}function Dn({status:e}){return e===`skipped`?(0,Q.jsx)(y,{tone:`neutral`,children:`Skipped`}):(0,Q.jsx)(yt,{o:e})}function On({c:e,onUnlink:t}){let[n,r]=(0,X.useState)(!1),i=Ot(e.key);return(0,Q.jsxs)(`tr`,{className:Le,onClick:()=>location.href=i,children:[(0,Q.jsx)(`td`,{className:Ue,children:(0,Q.jsxs)(`a`,{href:i,className:`no-underline`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(`span`,{className:He,"data-tip":e.title,children:e.title}),(0,Q.jsx)(`span`,{className:c(Me,`font-mono`),children:e.id})]})}),(0,Q.jsx)(`td`,{className:c(U,`hidden text-body-sm whitespace-nowrap text-ink-2 @2xl:table-cell`),children:e.how===`mapping`?`By the plan's mapping`:`By hand`}),(0,Q.jsx)(`td`,{className:c(U,`whitespace-nowrap`),children:(0,Q.jsx)(yt,{o:e.lastRun.outcome})}),(0,Q.jsx)(`td`,{className:je,onClick:e=>e.stopPropagation(),children:e.how!==`mapping`&&(0,Q.jsxs)(`span`,{className:`relative inline-block`,children:[(0,Q.jsx)(b,{variant:`icon`,size:`icon-sm`,"aria-label":`More for ${e.id}`,"data-tip":`More for ${e.id}`,"aria-haspopup":`menu`,"aria-expanded":n,onClick:()=>r(!n),children:(0,Q.jsx)(I,{"aria-hidden":`true`})}),(0,Q.jsx)(d,{open:n,onClose:()=>r(!1),label:`More for ${e.id}`,align:`end`,className:`w-[200px] text-left`,children:(0,Q.jsx)(f,{onClick:()=>{r(!1),t()},children:(0,Q.jsxs)(`span`,{className:`text-fail`,children:[`Unlink `,e.id]})})})]})})]})}var kn=[{id:`azure_devops`,label:`Azure DevOps`},{id:`jira`,label:`Jira`},{id:`testrail`,label:`TestRail`},{id:`zephyr`,label:`Zephyr Scale`},{id:`qtest`,label:`qTest`}],An=e=>kn.some(t=>t.id===e),jn=e=>e&&D(e)===`web`?e:void 0,Mn=(e,t)=>`${e} ${t}${e===1?``:`s`}`,Nn=e=>`${e.kind}:${e.id}`;function Pn(e){return e.found===`reuse`||e.kind===`link`?`Link`:e.found===`extends`||e.kind===`extend`?`Add ${Mn((e.insert??[]).reduce((e,t)=>e+t.steps.length,0),`step`)}`:`Update steps`}function Fn(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 In(){let[e,t]=(0,X.useState)(kn.map(e=>e.id)),[n,r]=(0,X.useState)(``);return(0,X.useEffect)(()=>{m.settings().then(e=>{let n=e.config.sources??{},r=kn.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:kn.filter(t=>e.includes(t.id)),error:n}}function Ln({view:e,onApplied:t,onError:n}){let[r,i]=(0,X.useState)([]),[a,o]=(0,X.useState)(null),[s,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(null),f=e.story.id,p=e.proposals.filter(e=>r.includes(Nn(e))),m=async()=>{let t=p.map(e=>Fn(e,f));l(!0);try{let r=await h.preview(e.system,f,t);o({lines:r.lines,changes:t}),n(``)}catch(e){n(e.message)}finally{l(!1)}},g=async()=>{if(a){l(!0);try{let r=await h.apply(e.system,f,a.changes);d({applied:r.applied,failed:r.failed}),o(null),i([]),n(``),t()}catch(e){n(e.message)}finally{l(!1)}}},_=jn(e.story.url);return(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-headline-sm [overflow-wrap:anywhere]`,children:[_?(0,Q.jsxs)(`a`,{href:_,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[f,(0,Q.jsx)(me,{size:14,"aria-hidden":`true`})]}):(0,Q.jsx)(`span`,{children:f}),e.story.title&&(0,Q.jsx)(`span`,{className:`font-normal text-ink-2`,children:e.story.title})]}),e.changed&&(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,"data-tip":new Date(e.changed.when).toLocaleString(),children:[`The story's `,e.changed.field,` changed `,q(e.changed.when),`.`]})]}),(0,Q.jsx)(Y,{id:`cases`,icon:k,title:`Linked cases`,children:(0,Q.jsx)(K,{label:`Linked cases`,empty:`No test case is linked to this story.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Case`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Title`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`text-right`),children:`Steps`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`State`})]}),children:e.cases.map(e=>{let t=jn(e.url);return(0,Q.jsxs)(`tr`,{className:G,children:[(0,Q.jsx)(`td`,{className:c(U,`whitespace-nowrap`),children:t?(0,Q.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[e.id,(0,Q.jsx)(me,{size:12,"aria-hidden":`true`})]}):e.id}),(0,Q.jsx)(`td`,{className:c(U,`[overflow-wrap:anywhere]`),children:e.title}),(0,Q.jsx)(`td`,{className:c(U,`text-right tabular-nums`),children:e.steps}),(0,Q.jsx)(`td`,{className:c(U,e.stale?`text-warn`:`text-muted`),"data-sort":e.changed&&Date.parse(e.changed)||0,children:e.stale?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(M,{size:13,"aria-hidden":`true`,className:`flex-none`}),`older than the story's last change`]}):e.changed?(0,Q.jsxs)(`span`,{"data-tip":new Date(e.changed).toLocaleString(),children:[`changed `,q(e.changed)]}):`–`})]},e.id)})})}),(0,Q.jsx)(Y,{id:`criteria`,icon:R,title:`Acceptance criteria`,children:(0,Q.jsx)(K,{label:`Acceptance criteria`,empty:`No acceptance criteria were read for this story.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Criterion`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Cases`})]}),children:e.criteria.map((e,t)=>(0,Q.jsxs)(`tr`,{className:G,children:[(0,Q.jsx)(`td`,{className:c(U,`[overflow-wrap:anywhere]`),children:e.text}),(0,Q.jsx)(`td`,{className:c(U,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,Q.jsxs)(Y,{id:`proposals`,icon:pe,title:`Proposed changes`,children:[(0,Q.jsx)(K,{label:`Proposed changes`,empty:`No change is waiting. save_test_cases in a chat proposes them.`,selection:{count:p.length,onClear:()=>i([]),actions:(0,Q.jsxs)(b,{size:`sm`,variant:`primary`,disabled:s||!p.length||!!a,"data-tip":`Review ${Mn(p.length,`change`)}`,onClick:()=>void m(),children:[(0,Q.jsx)(ve,{"aria-hidden":`true`}),`Review`]})},head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`w-10`),children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Change`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Existing case`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`The agent wrote`})]}),children:e.proposals.map(e=>{let t=Nn(e);return(0,Q.jsxs)(`tr`,{className:G,"data-state":r.includes(t)?`selected`:void 0,children:[(0,Q.jsx)(`td`,{className:U,children:(0,Q.jsx)(Ke,{"aria-label":`${Pn(e)}: ${e.id} ${e.title}`,checked:r.includes(t),disabled:s||!!a,onCheckedChange:e=>i(e?[...r,t]:r.filter(e=>e!==t))})}),(0,Q.jsxs)(`td`,{className:c(U,`whitespace-nowrap font-medium`),children:[Pn(e),e.link&&e.kind!==`link`&&(0,Q.jsx)(`span`,{className:`block text-body-sm font-normal text-muted`,children:`and link it`})]}),(0,Q.jsxs)(`td`,{className:c(U,`[overflow-wrap:anywhere]`),children:[(0,Q.jsx)(`span`,{className:`font-mono text-body-sm text-ink-2`,children:e.id}),` `,e.title]}),(0,Q.jsx)(`td`,{className:c(U,`text-ink-2 [overflow-wrap:anywhere]`),children:e.wrote})]},t)})}),a&&(0,Q.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Apply the changes`,className:c(C.info,`flex flex-col gap-2`),children:[(0,Q.jsxs)(`span`,{className:`font-medium`,children:[`Apply `,Mn(a.changes.length,`change`),` to `,kn.find(t=>t.id===e.system)?.label,`?`]}),(0,Q.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:a.lines.map((e,t)=>(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(b,{size:`sm`,variant:`primary`,disabled:s,onClick:()=>void g(),children:[(0,Q.jsx)(De,{"aria-hidden":`true`}),`Apply`]}),(0,Q.jsxs)(b,{size:`sm`,disabled:s,onClick:()=>o(null),children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),`Cancel`]})]})]}),u&&u.applied.length>0&&(0,Q.jsxs)(`p`,{role:`status`,className:`m-0 text-body-sm text-pass`,children:[`Applied: `,u.applied.join(`, `)]}),u&&u.failed.length>0&&(0,Q.jsxs)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:[`Not applied: `,u.failed.map(e=>`${e.id||`a change`}: ${e.error}`).join(`; `)]})]}),(0,Q.jsx)(Y,{id:`changes`,icon:le,title:`Recent changes`,children:e.changes.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm text-ink-2`,children:e.changes.map((e,t)=>(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}):(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`ForgeQE has not changed this story's cases.`})}),e.notes.map((e,t)=>(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted [overflow-wrap:anywhere]`,children:e},t))]})}function Rn({sub:e}){let{systems:t,error:a}=In(),o=e?e.indexOf(`/`):-1,s=o>0?e.slice(0,o):e,l=An(s)?s:void 0,u=l&&o>0?n(e.slice(o+1)):``,[d,f]=(0,X.useState)(l??`azure_devops`),[p,m]=(0,X.useState)(u),[g,_]=(0,X.useState)(null),[y,x]=(0,X.useState)(``),[w,T]=(0,X.useState)(!1);(0,X.useEffect)(()=>{l&&f(l),m(u)},[l,u]),(0,X.useEffect)(()=>{!l&&t.length&&!t.some(e=>e.id===d)&&f(t[0].id)},[t,d,l]);let E=(0,X.useCallback)(()=>{!l||!u?_(null):(T(!0),h.view(l,u).then(e=>{_(e),x(``),T(!1)},e=>{x(e.message),T(!1)}))},[l,u]);return(0,X.useEffect)(()=>_(null),[l,u]),(0,X.useEffect)(E,[E]),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`A story's test cases in your test management system: which are older than the story's last change, which acceptance criteria no case covers, and the changes save_test_cases proposed. Tick the ones to make; nothing is written until you review and apply them. The tests that run them are on `,(0,Q.jsx)(`a`,{href:r(`regression`),children:`Regression`}),`; their results on `,(0,Q.jsx)(`a`,{href:r(`runs`),children:`Runs`}),`.`]}),(0,Q.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=p.trim();if(!t)return;let n=r(`test-management`,`stories`,d,encodeURIComponent(t));location.hash===n?E():location.hash=n},className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":`System`,className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(v,{items:t,value:d,onChange:f})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_320px] flex-col gap-1 text-body-sm font-medium`,children:[`Story`,(0,Q.jsx)(i,{value:p,maxLength:120,spellCheck:!1,placeholder:d===`azure_devops`?`1234`:d===`qtest`?`5678`:d===`testrail`?`R12`:`SHOP-12`,onChange:e=>m(e.target.value)})]}),(0,Q.jsxs)(b,{type:`submit`,variant:`primary`,disabled:!p.trim()||w,"data-tip":`Open the story's test cases`,children:[(0,Q.jsx)(xe,{"aria-hidden":`true`}),`Open`]})]})]}),[a,y].filter(Boolean).map(e=>(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:e},e)),w&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),g&&(0,Q.jsx)(Ln,{view:g,onApplied:E,onError:x},`${g.system}:${g.story.id}`),!u&&!g&&(0,Q.jsx)(S,{icon:R,title:`No story opened yet`,children:`Pick the system and type a story's id to see its linked test cases, its acceptance criteria and which cases trace to them. When save_test_cases runs in a chat for a story, the changes it proposes to existing cases show here to apply.`})]})}var zn={view:()=>g(`GET`,`/api/testdebt`),refresh:()=>g(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>g(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},Bn=[`untested`,`signal`,`duplicates`,`cases`],Vn={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},Hn={test:`Test`,recording:`Recording`,case:`Test case`},Un={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},Wn={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},Gn=e=>`${Math.round(e*100)}%`,Kn=e=>Bn.includes(e)?e:`untested`;function qn({part:e,what:t,action:n}){return(0,Q.jsxs)(S,{icon:M,title:e.state===`empty`?`No ${t} yet`:`${t[0].toUpperCase()}${t.slice(1)}: not connected`,action:(0,Q.jsxs)(`a`,{className:x({size:`sm`}),href:n.to,"data-tip":`Open ${n.label}`,children:[(0,Q.jsx)(xe,{"aria-hidden":`true`}),n.label]}),children:[`To see this list, set `,e.set,`.`]})}function $({text:e,tip:t}){return(0,Q.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function Jn({sub:e}){let[t,n]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(``),m=Kn(e),[h,g]=(0,X.useState)(`all`),[_,y]=(0,X.useState)(`manual`),[w,T]=(0,X.useState)(``),[E,D]=(0,X.useState)(``);(0,X.useEffect)(()=>{zn.view().then(e=>{n(e),s(``)},e=>s(e.message))},[]);let ee=(0,X.useCallback)(async(e,t)=>{u(!0),f(``);try{n(await e()),s(``),t&&f(t)}catch(e){s(e.message)}finally{u(!1)}},[]),O=async e=>{if(e){u(!0);try{let{id:t}=await p.start(e,{});location.hash=r(`chats`,t)}catch(e){s(e.message),u(!1)}}},k=(e,t)=>(0,Q.jsx)(b,{size:`icon`,variant:`icon`,className:`size-8`,disabled:l||!e,onClick:()=>void O(e),"aria-label":`Draft a test for this ${t} in a chat`,"data-tip":e?`Draft a test for this ${t} in a chat`:`Its id or file is not of a plain shape, so no chat request names it: open it where it lives instead.`,children:(0,Q.jsx)(Se,{"aria-hidden":`true`})}),A=t?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],j=w||A[0]?.id||``,M=t?.cases.filter(e=>!e.automated).length??0,te=t?.areas.filter(e=>h===`all`||e.kind===h)??[],ne=t?.cases.filter(e=>_===`all`||(_===`manual`?!e.automated:e.automated))??[],N={untested:(t?.areas.length??0)+(t?.rules.length??0),signal:(t?.quiet.length??0)+(t?.gone.length??0),duplicates:t?.duplicates.length??0,cases:M};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap items-center gap-4`,children:t&&(0,Q.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsxs)(`span`,{"data-tip":Ze(t.at),children:[`Worked out `,q(t.at)]}),(0,Q.jsxs)(b,{size:`sm`,disabled:l,onClick:()=>void ee(zn.refresh,`Worked out again.`),children:[(0,Q.jsx)(se,{"aria-hidden":`true`}),`Refresh`]})]})}),(0,Q.jsx)(qe,{more:(0,Q.jsxs)(Q.Fragment,{children:[`Code and business rules no test reaches in the `,(0,Q.jsx)(`a`,{href:r(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,t?.repo&&t.repo!==`.`?(0,Q.jsx)(`code`,{className:`font-mono text-body-sm`,children:t.repo}):`the test repository`,`, tests that read alike, and each test case with whether it is automated. It only reads; Draft the test asks in a chat, and nothing changes until you agree there.`]}),children:`What no test checks yet, and tests that tell you little.`}),o&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:o}),!t&&!o&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),d&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2`,children:d}),t&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Xe,{label:`Test debt`,children:[(0,Q.jsx)(Ge,{tip:t.graph.state===`ok`?`Of ${t.graph.checked} areas`:`The product graph is not built`,dot:t.graph.state===`ok`?t.areas.length?`warn`:`pass`:`neutral`,value:t.graph.state===`ok`?t.areas.length:`–`,label:`untested code areas`}),(0,Q.jsx)(Ge,{tip:`Of ${t.graph.rulesChecked} rules`,dot:t.rules.length?`warn`:`pass`,value:t.rules.length,label:`untested rules`}),(0,Q.jsx)(Ge,{tip:`30 passes in a row`,dot:`neutral`,value:t.quiet.length,label:`never fail`}),(0,Q.jsx)(Ge,{tip:`Of ${t.files.count} files listed`,dot:t.gone.length?`fail`:`pass`,value:t.gone.length,label:`with their code gone`}),(0,Q.jsx)(Ge,{tip:`From ${Gn(t.threshold)} alike`,dot:`neutral`,value:t.duplicates.length,label:`near-duplicates`}),(0,Q.jsx)(Ge,{dot:M?`warn`:`pass`,value:M,label:`of ${t.cases.length} test cases not automated`})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(v,{items:[{id:`untested`,label:`Untested code and rules`,n:N.untested},{id:`signal`,label:`Low-signal tests`,n:N.signal},{id:`duplicates`,label:`Near-duplicates`,n:N.duplicates},{id:`cases`,label:`Test cases`,n:N.cases}],value:m,onChange:e=>location.hash=r(`test-management`,`debt`,e)})}),t.notes.map(e=>(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:e},e)),m===`untested`&&(0,Q.jsxs)(Q.Fragment,{children:[t.graph.state===`ok`?(0,Q.jsx)(K,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:h,empty:t.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(v,{items:[{id:`all`,label:`All`,n:t.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${Vn[e]}s`,n:t.areas.filter(t=>t.kind===e).length}))],value:h,onChange:g})}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[34%]`),children:`Code`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Kind`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Where`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Used by`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:te.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(P,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,Q.jsx)($,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`text-body-sm whitespace-nowrap`),children:Vn[e.kind]}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden max-w-0 font-mono text-body-sm text-ink-2 @xl:table-cell`),children:(0,Q.jsx)($,{text:e.where})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:k(e.draft,Vn[e.kind].toLowerCase())})]},e.id))}):(0,Q.jsx)(qn,{part:t.graph,what:`product graph`,action:{label:`Product`,to:r(`product`)}}),(0,Q.jsx)(K,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:t.graph.rulesChecked?`Every business rule found is checked by a test.`:`No business rules found: the product graph's rules come from the code; the knowledge folder's from a business-rules.md file.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[46%]`),children:`Rule`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`From`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Where`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Closest test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.rules.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(P,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,Q.jsx)($,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`text-body-sm whitespace-nowrap`),"data-tip":e.from===`graph`?`Found in the code by forgeqe knowledge build`:`A rule of the knowledge folder, matched to tests by its words`,children:e.from===`graph`?`Code`:`Knowledge`}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden max-w-0 font-mono text-body-sm text-ink-2 @xl:table-cell`),children:(0,Q.jsx)($,{text:e.where})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden max-w-0 text-body-sm text-ink-2 @2xl:table-cell`),children:e.nearest?(0,Q.jsx)($,{text:`${e.nearest.name} (${Gn(e.nearest.score)})`,tip:`${Gn(e.nearest.score)} of the rule's words are in ${e.nearest.name}`}):`–`}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:k(e.draft,`rule`)})]},e.id))})]}),m===`signal`&&(t.history.state===`ok`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{label:`Tests that never fail`,placeholder:`Find a test`,empty:`No test has passed 30 runs in a row without a failure or a retry.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[50%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Passes`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Since`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.quiet.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(ae,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,Q.jsx)($,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`text-muted`),children:e.runs}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden text-body-sm whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.since?Ze(e.since):void 0,"data-sort":e.since&&new Date(e.since).getTime()||0,children:e.since?q(e.since):`–`}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:k(e.draft,`test`)})]},e.key))}),(0,Q.jsx)(K,{label:`Tests whose file is gone`,placeholder:`Find a test or file`,empty:`Every test file the history names is in the test repository (${t.files.count} files, listed by ${t.files.by===`git`?`git`:`walking the folder`}).`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[40%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`File`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.gone.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(H,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,Q.jsx)($,{text:e.name})]})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`max-w-0 font-mono text-body-sm text-ink-2`),children:(0,Q.jsx)($,{text:e.file})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden text-body-sm whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.last?Ze(e.last):void 0,"data-sort":e.last&&new Date(e.last).getTime()||0,children:e.last?q(e.last):`–`}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:k(e.draft,`test`)})]},e.key))})]}):(0,Q.jsx)(qn,{part:t.history,what:`test history`,action:{label:`Regression`,to:r(`regression`)}})),m===`duplicates`&&(0,Q.jsx)(K,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,height:`max(320px, calc(var(--screen) - 288px))`,empty:`No two tests, recordings or test cases share ${Gn(t.threshold)} of their words (${t.compared} pairs compared).`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Alike`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[30%]`),children:`First`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[30%]`),children:`Second`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Shared words`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.duplicates.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:c(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,e.score>=.85?`text-warn`:`text-muted`),"data-sort":e.score,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(ue,{size:14,"aria-hidden":`true`}),Gn(e.score)]})}),[e.a,e.b].map((e,t)=>(0,Q.jsxs)(`td`,{className:c(`px-4 py-2`,`max-w-0`),children:[(0,Q.jsx)($,{text:e.name,tip:`${Hn[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,Q.jsx)(`span`,{className:`block text-body-sm text-muted`,children:Hn[e.kind]})]},t)),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden max-w-0 text-body-sm text-ink-2 @2xl:table-cell`),children:(0,Q.jsx)($,{text:e.shared.join(`, `)})}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:k(e.draft,`pair`)})]},`${e.a.kind}:${e.a.key}|${e.b.kind}:${e.b.key}`))}),m===`cases`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Test management`}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:t.sources.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,Q.jsx)(ae,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,Q.jsx)(P,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`text-ink-2`,children:e.connected?e.scopes.length?e.scopes.map(e=>`${e.scope}: ${e.cases} read ${q(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))})]}),A.length>0&&(0,Q.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),j&&ee(()=>zn.readCases(j,E.trim()),`Test cases read.`)},children:[(0,Q.jsx)(a,{size:`sm`,"aria-label":`Source`,value:j,onChange:e=>T(e.target.value),children:A.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,Q.jsx)(i,{size:`sm`,"aria-label":`Scope`,placeholder:j&&j!==`jira`?Wn[j]:``,value:E,maxLength:80,onChange:e=>D(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,Q.jsxs)(b,{size:`sm`,type:`submit`,disabled:l||!E.trim(),"data-tip":`Read the test cases`,children:[(0,Q.jsx)(B,{"aria-hidden":`true`}),`Import`]})]}),t.cases.length?(0,Q.jsx)(K,{label:`Test cases`,placeholder:`Find a test case by id or title`,height:`max(320px, calc(var(--screen) - 288px))`,resetKey:_,empty:`Nothing matches.`,tools:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(v,{items:[{id:`manual`,label:`Not automated`,n:M,alert:!0},{id:`automated`,label:`Automated`,n:t.cases.length-M},{id:`all`,label:`All`,n:t.cases.length}],value:_,onChange:y})}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[36%]`),children:`Title`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Source`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Automated`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:ne.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`font-mono text-body-sm whitespace-nowrap`),children:/^https?:\/\//i.test(e.url)?(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`max-w-0`),children:(0,Q.jsx)($,{text:e.title||`–`})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden text-body-sm whitespace-nowrap @xl:table-cell`),"data-tip":`From ${e.scope}`,children:Un[e.source]}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`text-body-sm whitespace-nowrap`),children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,"data-tip":e.how===`mapping`?`Its test is in the automated tests' mapping`:e.how===`name`?`A test in the history names its id`:`No automated test names it`,children:[e.automated?(0,Q.jsx)(ae,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,Q.jsx)(P,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden max-w-0 text-body-sm text-ink-2 @2xl:table-cell`),children:e.test?(0,Q.jsx)($,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:!e.automated&&k(e.draft,`test case`)})]},`${e.source}|${e.id}`))}):(0,Q.jsx)(S,{icon:R,title:`No test cases yet`,action:(0,Q.jsxs)(`a`,{className:x({size:`sm`}),href:r(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,Q.jsx)(xe,{"aria-hidden":`true`}),`Settings`]}),children:`Test cases show here from ForgeQE's case index, the automated tests' mapping (.forgeqe/test-cases.json), and the plans, runs or cycles you read above from a connected source.`})]})]})]})}var Yn=[`dashboard`,`cases`,`tests`,`gaps`,`debt`,`stories`,`suites`,`tags`],Xn={dashboard:[`dashboard`],inventory:[`cases`,`tests`,`stories`],coverage:[`gaps`,`debt`],organise:[`suites`,`tags`]},Zn=e=>Object.keys(Xn).find(t=>Xn[t].includes(e))??`dashboard`;function Qn({sub:e}){let t=(e??``).split(`/`).filter(Boolean),i=Yn.includes(t[0])?t[0]:`dashboard`;Ye(`test-management`,i,Yn,!t[0],e=>location.replace(r(`test-management`,e)));let a=i===`cases`&&t[1]?n(t[1]):void 0,o=i===`tests`&&t[1]?n(t[1]):void 0,s=i===`suites`&&t[1]?n(t[1]):void 0,[l,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)([]),[v,x]=(0,X.useState)(null),[S,w]=(0,X.useState)(null),[T,D]=(0,X.useState)(null),[ee,O]=(0,X.useState)(``),[A,j]=(0,X.useState)(``),[M,te]=(0,X.useState)(!1),[ne,N]=(0,X.useState)([]),[re,ie]=(0,X.useState)(null),[ae,oe]=(0,X.useState)(null),I=(0,X.useCallback)(async()=>{try{let[e,t]=await Promise.all([Z.view(),Z.cases()]);d(e),p(t),w(e.suites),D(e.job),O(``)}catch(e){O(e.message)}},[]);(0,X.useEffect)(()=>{I()},[I]),(0,X.useEffect)(()=>{i===`gaps`&&Z.gaps().then(h,e=>O(e.message)),i===`tags`&&Z.tags().then(x,e=>O(e.message)),i===`suites`&&Z.suites().then(e=>w(e.suites),e=>O(e.message))},[i,l]),(0,X.useEffect)(()=>{if(!T?.running)return;let e=ze(()=>{Z.job().then(e=>{D(e.job),e.job?.running||I()},()=>{})},2e3);return()=>Fe(e)},[T?.running,I]);let le=async()=>{te(!0),j(``);try{let e=await Z.sync(),t=e.plans.filter(e=>e.error),n=t.length?t.map(e=>`${e.label}: ${e.error}`).join(` · `):`Synced ${e.plans.map(e=>`${e.label} (${e.cases} cases)`).join(`, `)}.`;j(e.storiesError?`${n} The release's stories were not read again: ${e.storiesError}`:n),await I()}catch(e){O(e.message)}finally{te(!1)}},ue=e=>ie({title:`Run ${e.length} test case${e.length===1?``:`s`}`,go:(t,n)=>Z.run(e,t,n)}),de=(e,t)=>{let n=S?.find(t=>t.id===e)??l?.suites.find(t=>t.id===e);ie({title:`${t?`Rerun the failed cases of`:`Run`} ${n?.name??`the suite`}`,go:(n,r)=>Z.runSuite(e,{...n?{env:n}:{},...t?{only:t}:{}},r)})},fe=()=>{j(`The run started: it shows here while it runs, and in Runs.`),Z.job().then(e=>D(e.job),()=>{})},pe=e=>{j(e),N([]),I()},L=new Map((f?.cases??[]).map(e=>[e.key,e])),R=ne.filter(e=>L.has(e)),me=e=>e.map(e=>L.get(e).id),he=R.filter(e=>[`failed`,`blocked`].includes(L.get(e).lastRun.outcome)),ge=R.filter(e=>L.get(e).automation!==`automated`),_e=[{intent:`automate`,label:ge.length?`Automate ${ge.length}`:`Automate`,icon:ce,keys:ge.slice(0,50),...ge.length?{}:{disabled:`Pick test cases that are not automated`}},{intent:`investigate`,label:he.length?`Why ${he.length} fail`:`Why they fail`,icon:H,keys:he.slice(0,50),...he.length?{}:{disabled:`Pick failing test cases`}},{intent:`tag`,label:`Suggest tags`,icon:Oe,keys:R.slice(0,50),...R.length?{}:{disabled:`Pick test cases in the list first`}},{intent:`tag_tests`,label:`Write tags into tests`,icon:ce,keys:R.filter(e=>L.get(e).tests.length>0&&L.get(e).tags.length>0).slice(0,50),...R.filter(e=>L.get(e).tests.length>0&&L.get(e).tags.length>0).length?{}:{disabled:`Pick tagged cases that have a linked test`}}],B=(m?.ranked??[]).slice(0,20).map(e=>e.key),ve=[{intent:`automate`,label:R.length?`Automate ${R.length}`:`Automate the top ${B.length}`,icon:ce,keys:(R.length?R:B).slice(0,50),...R.length||B.length?{}:{disabled:`Nothing left to automate`}},{intent:`investigate`,label:`Why the failing fail`,icon:H,keys:(m?.lists.failing??[]).slice(0,50),...m?.lists.failing.length?{}:{disabled:`Nothing is failing`}},{intent:`cases_for_stories`,label:g.length?`Cases for ${g.length} stor${g.length===1?`y`:`ies`}`:`Cases for stories with none`,icon:z,keys:[],stories:(g.length?g:(m?.stories?.noCase??[]).map(e=>e.id)).slice(0,50),...g.length||m?.stories?.noCase.length?{}:{disabled:`Read the release's stories in Gaps, Stories with no case, first`}}],ye=f?f.cases.filter(e=>e.automation===`not_automated`||e.automation===`pending`||e.lastRun.outcome===`failed`||e.lastRun.outcome===`blocked`).length:(l?.summary.notAutomated??0)+(l?.summary.pending??0),xe=s?S?.find(e=>e.id===s):void 0,Se=ae??(i===`suites`||(l?.summary.cases??0)>0),Ce=!!l&&!l.plans.length&&!l.summary.cases,V=Zn(i),we={dashboard:{label:`Dashboard`},cases:{label:`Test cases`,n:l?.summary.cases},tests:{label:`Automated`,n:l?.summary.tests},stories:{label:`Stories`},gaps:{label:`Gaps`,n:ye},debt:{label:`Test debt`},suites:{label:`Suites`,n:l?.suites.length},tags:{label:`Tags`}},De=(0,Q.jsxs)(`main`,{className:c(Re,`@container flex-auto gap-4`),children:[!a&&!o&&!s&&(0,Q.jsx)(E,{}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,Q.jsx)(Pe,{pixel:u[`test-management`],size:`lg`,head:!0}),(0,Q.jsx)(`h1`,{className:`m-0 text-headline-md`,children:`Test management`}),l&&(0,Q.jsx)(`div`,{className:`order-last flex min-w-0 basis-full @[74rem]:order-none @[74rem]:basis-auto`,children:(0,Q.jsx)(Ve,{label:`Test management`,className:`mb-0 max-w-full`,current:V,hrefOf:e=>r(`test-management`,Xn[e][0]),tabs:[{id:`dashboard`,label:`Dashboard`,icon:be},{id:`inventory`,label:`Cases`,n:l.summary.cases,icon:k},{id:`coverage`,label:`Coverage`,n:ye,icon:P},{id:`organise`,label:`Suites and tags`,icon:Te}]})}),l&&(0,Q.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[l.plans.length>0&&(0,Q.jsx)(b,{busy:M,size:`icon`,disabled:M,onClick:()=>void le(),"aria-label":M?`Syncing`:`Sync`,"data-tip":M?`Syncing…`:`Sync: read every case of the connected plans again`,children:(0,Q.jsx)(se,{"aria-hidden":`true`})}),(l.plans.length>0||l.summary.tests>0)&&(0,Q.jsx)(_n,{disabled:M}),(i===`cases`||i===`gaps`||i===`suites`)&&!Se&&(0,Q.jsx)(b,{size:`icon`,onClick:()=>oe(!0),"aria-label":i===`suites`?`Open the Suite agent`:`Open the agent`,"data-tip":i===`suites`?`Open the Suite agent`:`Open the agent`,children:(0,Q.jsx)(z,{"aria-hidden":`true`})})]})]}),l&&!a&&!o&&!s&&(0,Q.jsxs)(qe,{children:[`Every case of your connected test plans: which are automated and by what, what ran, and what is left.`,` `,l.plans.length>0?(0,Q.jsxs)(`span`,{"data-tip":l.plans.map(e=>`${e.label}: ${e.cases} cases${e.at?`, synced ${Ze(e.at)}`:``}`).join(` · `),children:[l.plans.length,` plan`,l.plans.length===1?``:`s`,l.plans[0]?.at?`, synced ${q(l.plans.map(e=>e.at??``).sort()[0])}.`:`, not synced yet.`]}):(!Ce||i!==`dashboard`&&i!==`cases`&&i!==`gaps`)&&(0,Q.jsx)(`a`,{href:r(`settings`,`integrations`),children:`Connect a test plan in Settings`})]}),l&&Xn[V].length>1&&!a&&!o&&!s&&(0,Q.jsx)(Ie,{label:V===`inventory`?`Cases`:V===`coverage`?`Coverage`:`Suites and tags`,className:`mb-0`,current:i,onPick:e=>location.hash=r(`test-management`,e),tabs:Xn[V].map(e=>({id:e,...we[e]}))}),ee&&(0,Q.jsx)(`p`,{role:`alert`,className:c(C.fail,`m-0`),children:ee}),!l&&!ee&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),A&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:A}),l&&l.refused.length>0&&(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm text-warn`,children:[`Not read, as their system does not write a plan that way: `,l.refused.join(` · `),`. Fix them in Settings › Integrations.`]}),T&&(0,Q.jsxs)(`div`,{role:`status`,className:c(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-wrap items-center gap-2 text-body-sm`),children:[(0,Q.jsx)(y,{tone:T.running?`running`:T.exitCode===0?`pass`:`fail`,children:T.running?`Running`:T.exitCode===0?`Finished`:`Stopped`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink-2`,"data-tip":T.command,children:T.lines.at(-1)??T.command}),T.running?(0,Q.jsxs)(b,{size:`sm`,variant:`danger`,onClick:()=>void Z.stop().then(e=>D(e.job),e=>O(e.message)),children:[(0,Q.jsx)(Ee,{"aria-hidden":`true`}),`Stop`]}):(0,Q.jsx)(`a`,{href:r(`runs`),className:`text-body-sm`,children:`Runs`})]}),l&&(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)(`div`,{id:`panel-${i}`,...Xn[V].length>1&&!a&&!o&&!s?{role:`tabpanel`,"aria-labelledby":`tab-${i}`}:{},className:`flex flex-col gap-4`,children:[i===`dashboard`&&(0,Q.jsx)(Qt,{view:l,onRunSuite:de}),Ce&&(i===`cases`||i===`gaps`)&&!a&&(0,Q.jsx)(At,{tests:l.summary.tests}),i===`cases`&&(!Ce||a)&&(a?(0,Q.jsx)(Vt,{caseKey:a,onRun:ue,onChanged:()=>void I()},a):f&&(0,Q.jsx)(Kt,{cases:f.cases,tests:f.tests.length,selected:R,onSelect:N,onRun:ue,onChanged:pe})),i===`tests`&&f&&(o?(0,Q.jsx)(En,{uid:o,tab:t[2],cases:f.cases,onChanged:()=>void I()},o):(0,Q.jsx)(jt,{cases:f.cases,onChanged:pe})),i===`gaps`&&(m&&f?(0,Q.jsx)(ln,{gaps:m,cases:f.cases,tests:f.tests,selected:R,onSelect:N,onRun:ue,pickedStories:g,onPickStories:_,onStoriesRead:()=>(_([]),void I())}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`})),i===`debt`&&(0,Q.jsx)(Jn,{sub:t[1]}),i===`stories`&&(0,Q.jsx)(Rn,{sub:t.slice(1).join(`/`)||void 0}),i===`suites`&&(s?(0,Q.jsx)(pn,{id:s,onRun:de,onDeleted:()=>(location.hash=r(`test-management`,`suites`),void I())},s):S&&(0,Q.jsx)(fn,{suites:S,onRun:de})),i===`tags`&&(v?(0,Q.jsx)(Tn,{tags:v,cases:f?.cases,onChanged:pe}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}))]})}),(0,Q.jsx)(Et,{open:!!re,onClose:()=>ie(null),title:re?.title??`Run`,preview:(e,t)=>re.go(e,t),onStarted:fe})]}),U=a?L.get(a):void 0;return(0,Q.jsxs)(`div`,{className:`@container flex min-h-(--screen) flex-col`,children:[(0,Q.jsx)(Be,{}),(0,Q.jsxs)(`div`,{className:`flex flex-auto flex-col xl:flex-row`,children:[(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-auto flex-col`,children:De}),l&&Se&&i===`cases`&&(0,Q.jsx)(it,{title:`Test case agent`,about:`Automates, runs and tags the cases you pick.`,looking:U?`Looking at ${U.id}.`:R.length?`Looking at the ${R.length} cases you picked.`:`Looking at ${l.summary.cases} test cases. Pick some in the list.`,context:U?[U.id,...U.plans.slice(0,1)]:R.length?me(R).slice(0,4):[],suggestions:U?[{intent:U.automation===`automated`?`run`:`automate`,label:U.automation===`automated`?`Run it and explain`:`Automate it`,icon:U.automation===`automated`?F:ce,keys:[U.key]},{intent:`investigate`,label:`Why it fails`,icon:H,keys:[U.key],...[`failed`,`blocked`].includes(U.lastRun.outcome)?{}:{disabled:`Its last run did not fail`}},{intent:`tag`,label:`Suggest tags`,icon:Oe,keys:[U.key]}]:_e,keys:U?[U.key]:R,placeholder:`Ask about these cases, or say what to do`,onClose:()=>oe(!1)},a??`list`),l&&Se&&i===`gaps`&&(0,Q.jsx)(it,{title:`Gap agent`,about:`Finds what to close first and closes it with you.`,looking:`Looking at ${l.summary.notAutomated} cases not automated, ${l.summary.pending} pending and ${l.summary.failing} failing.`,context:R.length?me(R).slice(0,4):[],suggestions:ve,keys:R.length?R:B,placeholder:`What should we close first?`,onClose:()=>oe(!1)}),l&&Se&&i===`suites`&&(0,Q.jsx)(mn,{open:xe,onSaved:e=>{j(`Saved the suite ${e.name}.`),I(),location.hash=r(`test-management`,`suites`,e.id)}},s??`list`)]})]})}export{Xn as GROUPS,Qn as TestManagement,Zn as groupOf};
|