UNPKG

pulse-dashboard

Version:

A Next.js Dashboard application for real-time monitoring and historical analysis of Playwright test executions, based on playwright-pulse-report. This component provides the UI for visualizing Playwright test results and can be run as a standalone CLI too

1 lines 48.9 kB
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18566,(e,t,s)=>{t.exports=e.r(76562)},12042,e=>{"use strict";var t=e.i(43476),s=e.i(18566),a=e.i(87596),r=e.i(95150),l=e.i(15288),n=e.i(19455),i=e.i(67489),d=e.i(77572),o=e.i(2747),c=e.i(29592),x=e.i(59684),u=e.i(75254);let m=(0,u.default)("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),h=(0,u.default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var p=e.i(95468),g=e.i(73884),f=e.i(63209),b=e.i(3116);let v=(0,u.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);var j=e.i(78583);let y=(0,u.default)("chart-line",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);var N=e.i(52571);let w=(0,u.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),k=(0,u.default)("film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]),T=(0,u.default)("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);var _=e.i(68054);let C=(0,u.default)("file-braces",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);var A=e.i(94918);let S=(0,u.default)("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]),M=(0,u.default)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]),z=(0,u.default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),L=(0,u.default)("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),D=(0,u.default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);var F=e.i(57688),H=e.i(87486),$=e.i(71645),B=e.i(73443);let R=(0,u.default)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);var I=e.i(75157);function P({status:e}){switch("string"==typeof e?e.toLowerCase():""){case"passed":return(0,t.jsx)(p.CheckCircle2,{className:"h-4 w-4 text-green-500 flex-shrink-0"});case"failed":return(0,t.jsx)(g.XCircle,{className:"h-4 w-4 text-destructive flex-shrink-0"});case"skipped":return(0,t.jsx)(f.AlertCircle,{className:"h-4 w-4 text-accent flex-shrink-0"});case"timedout":return(0,t.jsx)(b.Clock,{className:"h-4 w-4 text-destructive flex-shrink-0"});case"pending":return(0,t.jsx)(b.Clock,{className:"h-4 w-4 text-primary animate-pulse flex-shrink-0"});default:return(0,t.jsx)(N.Info,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"})}}function E({step:e,level:s=0}){var a;let r=e.steps&&e.steps.length>0,l=(0,t.jsxs)("div",{className:`flex flex-col space-y-2 ${s>0?"pl-4 border-l border-muted ml-2":""}`,children:[(0,t.jsxs)("div",{className:"flex items-center justify-between space-x-2",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 min-w-0",children:[(0,t.jsx)(P,{status:e.status}),(0,t.jsx)("span",{className:"text-sm font-medium text-foreground truncate",title:e.title,children:e.title}),e.isHook&&(0,t.jsx)(H.Badge,{variant:"outline",className:"text-xs px-1.5 py-0.5",children:e.hookType||"hook"})]}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:(a=e.duration)<1e3?`${a}ms`:`${(a/1e3).toFixed(2)}s`})]}),e.codeLocation&&(0,t.jsxs)("div",{className:"flex items-center text-xs text-muted-foreground space-x-1 pl-6",children:[(0,t.jsx)(R,{className:"h-3 w-3"}),(0,t.jsx)("span",{children:e.codeLocation})]}),e.errorMessage&&(0,t.jsxs)("div",{className:"pl-6 mt-1",children:[(0,t.jsx)("p",{className:"text-xs font-semibold text-destructive mb-0.5",children:"Error:"}),(0,t.jsx)("pre",{className:"bg-destructive/10 text-xs p-2 rounded-xl whitespace-pre-wrap break-all font-code",children:(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,I.ansiToHtml)(e.errorMessage)}})})]})]});return r?(0,t.jsx)(B.Accordion,{type:"single",collapsible:!0,className:"w-full py-1",children:(0,t.jsxs)(B.AccordionItem,{value:`step-${e.id}`,className:"border-none",children:[(0,t.jsx)(B.AccordionTrigger,{className:"p-1 hover:no-underline hover:bg-muted/50 rounded-xl text-left [&[data-state=open]>svg]:rotate-90",children:l}),(0,t.jsx)(B.AccordionContent,{className:"pt-0 pb-0",children:(0,t.jsx)("div",{className:"mt-1",children:e.steps.map(e=>(0,t.jsx)(E,{step:e,level:s+1},e.id))})})]})}):(0,t.jsx)("div",{className:"py-2 px-1 hover:bg-muted/50 rounded-xl",children:l})}var V=e.i(95187);let O=(0,V.createServerReference)("00c486baa1611458e5a49e3f6a5b624cc5a450103d",V.callServer,void 0,V.findSourceMapURL,"getRawHistoricalReports");var G=e.i(44098),W=e.i(29228),q=e.i(55706),K=e.i(85183),U=e.i(93230),J=e.i(72526),X=e.i(34239),Y=e.i(59559);let Q=e=>{let{cx:s,cy:a,payload:r}=e;if(!s||!a||!r)return null;let l="hsl(var(--muted-foreground))";return"passed"===r.status?l="hsl(var(--chart-3))":"flaky"===r.status?l="hsl(var(--flaky))":"failed"===r.status||"timedOut"===r.status?l="hsl(var(--destructive))":"skipped"===r.status&&(l="hsl(var(--accent))"),(0,t.jsx)("circle",{cx:s,cy:a,r:5,fill:l,stroke:"hsl(var(--card))",strokeWidth:1})},Z=({active:e,payload:s,label:a})=>{if(e&&s&&s.length){let e=s[0].payload;return(0,t.jsxs)("div",{className:"bg-card p-3 border border-border rounded-xl shadow-lg",children:[(0,t.jsx)("p",{className:"label text-sm font-semibold text-foreground",children:`Date: ${new Date(e.date).toLocaleString()}`}),(0,t.jsx)("p",{className:"text-xs text-foreground",children:`Duration: ${et(e.duration)}`}),(0,t.jsx)("p",{className:"text-xs capitalize font-medium",style:{color:"passed"===e.status?"hsl(var(--chart-3))":"flaky"===e.status?"hsl(var(--flaky))":"failed"===e.status||"timedOut"===e.status?"hsl(var(--destructive))":"hsl(var(--accent))"},children:`Status: ${e.status}`})]})}return null};function ee({status:e}){switch(e){case"passed":return(0,t.jsx)(p.CheckCircle2,{className:"h-6 w-6 text-[hsl(var(--chart-3))]"});case"failed":return(0,t.jsx)(g.XCircle,{className:"h-6 w-6 text-destructive"});case"skipped":return(0,t.jsx)(f.AlertCircle,{className:"h-6 w-6 text-[hsl(var(--accent))]"});case"timedOut":return(0,t.jsx)(b.Clock,{className:"h-6 w-6 text-destructive"});case"pending":return(0,t.jsx)(b.Clock,{className:"h-6 w-6 text-primary animate-pulse"});default:return(0,t.jsx)(N.Info,{className:"h-6 w-6 text-muted-foreground"})}}function et(e){if(e<1e3)return`${e}ms`;let t=parseFloat((e/1e3).toFixed(2));if(t<60)return`${t}s`;let s=Math.floor(t/60),a=parseFloat((t%60).toFixed(2));return`${s}m ${a}s`}function es({contentType:e}){let s=e.toLowerCase();return s.includes("html")?(0,t.jsx)(S,{className:"h-6 w-6 text-blue-500"}):s.includes("pdf")?(0,t.jsx)(j.FileText,{className:"h-6 w-6 text-red-500"}):s.includes("json")?(0,t.jsx)(C,{className:"h-6 w-6 text-yellow-500"}):s.includes("csv")||s.startsWith("text/plain")?(0,t.jsx)(A.FileSpreadsheet,{className:"h-6 w-6 text-green-500"}):s.startsWith("text/")?(0,t.jsx)(j.FileText,{className:"h-6 w-6 text-gray-500"}):(0,t.jsx)(M,{className:"h-6 w-6 text-gray-400"})}function ea(e,t="Attachment"){return e&&"string"==typeof e&&e.split(/[/\\]/).pop()||t}function er({test:e}){return(0,t.jsxs)("div",{className:"mt-4 p-1 md:p-4 border rounded-2xl bg-card shadow-inner",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-3 px-3 md:px-0",children:"Test Execution Steps"}),e.errorMessage&&(0,t.jsxs)("div",{className:"mb-4 p-3 md:p-0",children:[(0,t.jsx)("h4",{className:"font-semibold text-md text-destructive mb-1",children:"Overall Test Error:"}),(0,t.jsx)("pre",{className:"bg-destructive/10 text-sm p-4 rounded-2xl whitespace-pre-wrap break-all font-code overflow-x-auto",children:(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,I.ansiToHtml)(e.errorMessage)}})})]}),e.annotations&&e.annotations.length>0&&(0,t.jsx)("div",{className:"mb-4 p-3 md:p-0",children:(0,t.jsxs)("div",{style:{margin:"12px 0",padding:"12px",backgroundColor:"rgba(139, 92, 246, 0.1)",border:"1px solid rgba(139, 92, 246, 0.3)",borderLeft:"4px solid #8b5cf6",borderRadius:"4px"},children:[(0,t.jsx)("h4",{style:{marginTop:0,marginBottom:"10px",color:"#8b5cf6",fontSize:"1.1em"},children:"📌 Annotations"}),e.annotations.map((s,a)=>(0,t.jsxs)("div",{style:{marginBottom:a===e.annotations.length-1?"0":"10px"},children:[(0,t.jsx)("strong",{style:{color:"#8b5cf6"},children:"Type:"})," ",(0,t.jsx)("span",{style:{backgroundColor:"rgba(139, 92, 246, 0.2)",padding:"2px 8px",borderRadius:"4px",fontSize:"0.9em"},children:s.type}),s.description&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("br",{}),(0,t.jsx)("strong",{style:{color:"#8b5cf6"},children:"Description:"})," ",s.description]}),s.location&&(0,t.jsxs)("div",{style:{fontSize:"0.85em",color:"#6b7280",marginTop:"4px"},children:["Location: ",s.location.file,":",s.location.line,":",s.location.column]})]},a))]})}),e.steps&&e.steps.length>0?(0,t.jsx)(x.ScrollArea,{className:"h-[600px] w-full",children:(0,t.jsx)("div",{className:"pr-4",children:e.steps.map((e,s)=>(0,t.jsx)(E,{step:e},e.id||s))})}):(0,t.jsx)("p",{className:"text-muted-foreground p-3 md:p-0",children:"No detailed execution steps available for this test."})]})}function el({test:e}){return(0,t.jsxs)("div",{className:"mt-4 p-4 border rounded-2xl bg-card space-y-6 shadow-inner",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h3",{className:"text-lg font-semibold text-foreground mb-3 flex items-center",children:[(0,t.jsx)(_.Terminal,{className:"h-5 w-5 mr-2 text-primary"}),"Console Logs / Standard Output"]}),(0,t.jsx)(x.ScrollArea,{className:"h-48 w-full rounded-2xl border p-3 bg-muted/30 shadow-sm",children:(0,t.jsx)("pre",{className:"text-sm whitespace-pre-wrap break-words font-code",children:(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,I.ansiToHtml)(e.stdout&&Array.isArray(e.stdout)&&e.stdout.length>0?e.stdout.join("\n"):"No standard output logs captured for this test.")}})})})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("h3",{className:"text-lg font-semibold text-foreground mb-3 flex items-center",children:[(0,t.jsx)(f.AlertCircle,{className:"h-5 w-5 mr-2 text-destructive"}),"Error Messages / Standard Error"]}),(0,t.jsx)(x.ScrollArea,{className:"h-48 w-full rounded-2xl border bg-destructive/5 shadow-sm",children:(0,t.jsx)("pre",{className:"text-sm p-3 whitespace-pre-wrap break-all font-code",children:(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,I.ansiToHtml)(e.errorMessage||"No errors captured for this test.")}})})})]}),e.snippet&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("h3",{className:"text-lg font-semibold text-foreground mb-3 flex items-center",children:[(0,t.jsx)(S,{className:"h-5 w-5 mr-2 text-primary"}),"Test Case Snippet"]}),(0,t.jsx)(x.ScrollArea,{className:"h-48 w-full rounded-2xl border p-3 bg-muted/30 shadow-sm",children:(0,t.jsx)("pre",{className:"text-sm whitespace-pre-wrap break-words font-code",children:(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,I.ansiToHtml)(e.snippet)}})})})]})]})}function en({test:e}){let s=(0,$.useMemo)(()=>e&&Array.isArray(e.screenshots)?e.screenshots.map((e,t)=>({name:ea(e,`Screenshot ${t+1}`),path:e,contentType:"image/png","data-ai-hint":`screenshot ${t+1}`})):[],[e]),a=(0,$.useMemo)(()=>e&&Array.isArray(e.videoPath)?e.videoPath.map((e,t)=>({name:ea(e,`Video ${t+1}`),path:e,contentType:"video/mp4","data-ai-hint":`video ${t+1}`})):[],[e]),r=(0,$.useMemo)(()=>e&&"string"==typeof e.tracePath&&e.tracePath?{name:ea(e.tracePath,"trace.zip"),path:e.tracePath,contentType:"application/zip"}:null,[e]),l=(0,$.useMemo)(()=>e&&Array.isArray(e.attachments)?e.attachments.map((e,t)=>({name:e.name||ea(e.path,`Attachment ${t+1}`),path:e.path,contentType:e.contentType||"application/octet-stream","data-ai-hint":e["data-ai-hint"]})):[],[e]),i=(0,$.useMemo)(()=>l.filter(e=>e.contentType.toLowerCase().includes("html")),[l]),o=(0,$.useMemo)(()=>l.filter(e=>e.contentType.toLowerCase().includes("pdf")),[l]),u=(0,$.useMemo)(()=>l.filter(e=>e.contentType.toLowerCase().includes("json")),[l]),m=(0,$.useMemo)(()=>l.filter(e=>e.contentType.toLowerCase().startsWith("text/")||e.contentType.toLowerCase().includes("csv")),[l]),h=(0,$.useMemo)(()=>l.filter(e=>!i.includes(e)&&!o.includes(e)&&!u.includes(e)&&!m.includes(e)),[l,i,o,u,m]);return(0,t.jsx)("div",{className:"mt-4 p-1 md:p-4 border rounded-2xl bg-card shadow-inner",children:(0,t.jsxs)(d.Tabs,{defaultValue:"sub-screenshots",className:"w-full",children:[(0,t.jsx)(x.ScrollArea,{className:"w-full whitespace-nowrap rounded-2xl",children:(0,t.jsxs)(d.TabsList,{className:"inline-grid w-max grid-flow-col mb-4 rounded-2xl",children:[(0,t.jsxs)(d.TabsTrigger,{value:"sub-screenshots",disabled:0===s.length,children:[(0,t.jsx)(v,{className:"h-4 w-4 mr-2"}),"Screenshots (",s.length,")"]}),(0,t.jsxs)(d.TabsTrigger,{value:"sub-video",disabled:0===a.length,children:[(0,t.jsx)(k,{className:"h-4 w-4 mr-2"}),"Videos (",a.length,")"]}),(0,t.jsxs)(d.TabsTrigger,{value:"sub-trace",disabled:!r,children:[(0,t.jsx)(T,{className:"h-4 w-4 mr-2"}),"Trace ",r?"(1)":"(0)"]}),(0,t.jsxs)(d.TabsTrigger,{value:"sub-html",disabled:0===i.length,children:[(0,t.jsx)(S,{className:"h-4 w-4 mr-2"}),"HTML (",i.length,")"]}),(0,t.jsxs)(d.TabsTrigger,{value:"sub-pdf",disabled:0===o.length,children:[(0,t.jsx)(j.FileText,{className:"h-4 w-4 mr-2"}),"PDF (",o.length,")"]}),(0,t.jsxs)(d.TabsTrigger,{value:"sub-json",disabled:0===u.length,children:[(0,t.jsx)(C,{className:"h-4 w-4 mr-2"}),"JSON (",u.length,")"]}),(0,t.jsxs)(d.TabsTrigger,{value:"sub-text",disabled:0===m.length,children:[(0,t.jsx)(j.FileText,{className:"h-4 w-4 mr-2"}),"Text/CSV (",m.length,")"]}),(0,t.jsxs)(d.TabsTrigger,{value:"sub-other",disabled:0===h.length,children:[(0,t.jsx)(M,{className:"h-4 w-4 mr-2"}),"Others (",h.length,")"]})]})}),(0,t.jsxs)(d.TabsContent,{value:"sub-screenshots",className:"mt-4",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"Screenshots"}),s.length>0?(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:s.map((e,s)=>{let a=(0,I.getAssetPath)(e.path);return"#"===a?null:(0,t.jsxs)("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"relative aspect-video rounded-2xl overflow-hidden group border hover:border-primary transition-all shadow-md hover:shadow-lg",children:[(0,t.jsx)(F.default,{src:a,alt:e.name||`Screenshot ${s+1}`,fill:!0,style:{objectFit:"cover"},className:"group-hover:scale-105 transition-transform duration-300","data-ai-hint":e["data-ai-hint"]||"test screenshot"}),(0,t.jsx)("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex items-center justify-center p-2",children:(0,t.jsx)("p",{className:"text-white text-xs text-center break-all",children:e.name||`Screenshot ${s+1}`})})]},`img-preview-${s}`)})}):(0,t.jsx)("p",{className:"text-muted-foreground",children:"No screenshots available for this test."})]}),(0,t.jsxs)(d.TabsContent,{value:"sub-video",className:"mt-4",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"Video Recording(s)"}),(0,t.jsx)("div",{className:"space-y-4",children:a.length>0?a.map((e,s)=>(0,t.jsxs)("div",{className:"p-4 border rounded-2xl bg-muted/30 shadow-sm flex items-center justify-between",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-foreground truncate",title:e.name,children:e.name}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Button,{asChild:!0,variant:"ghost",size:"sm",children:(0,t.jsx)("a",{href:(0,I.getAssetPath)(e.path),target:"_blank",rel:"noopener noreferrer",children:"View"})}),(0,t.jsx)(n.Button,{asChild:!0,variant:"outline",size:"sm",children:(0,t.jsxs)("a",{href:(0,I.getAssetPath)(e.path),download:e.name,children:[(0,t.jsx)(w,{className:"h-4 w-4 mr-2"}),"Download"]})})]})]},`video-${s}`)):(0,t.jsxs)(c.Alert,{className:"rounded-2xl",children:[(0,t.jsx)(N.Info,{className:"h-4 w-4"}),(0,t.jsx)(c.AlertTitle,{children:"No Videos Available"}),(0,t.jsx)(c.AlertDescription,{children:"There is no video recording associated with this test run."})]})})]}),(0,t.jsxs)(d.TabsContent,{value:"sub-trace",className:"mt-4",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"Trace File"}),r?(0,t.jsxs)("div",{className:"p-4 border rounded-2xl bg-muted/30 space-y-3 shadow-sm",children:[(0,t.jsxs)("a",{href:(0,I.getAssetPath)(r.path),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-primary hover:underline text-base",download:r.name,children:[(0,t.jsx)(w,{className:"h-5 w-5 mr-2"})," Download Trace File (",r.name,")"]}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Path: ",r.path]}),(0,t.jsxs)(c.Alert,{className:"rounded-2xl",children:[(0,t.jsx)(N.Info,{className:"h-4 w-4"}),(0,t.jsx)(c.AlertTitle,{children:"Using Trace Files"}),(0,t.jsxs)(c.AlertDescription,{children:["Trace files (.zip) can be viewed using the Playwright CLI:"," ",(0,t.jsx)("code",{className:"bg-muted px-1 py-0.5 rounded-xl",children:"npx playwright show-trace /path/to/your/trace.zip"}),". Or by uploading them to"," ",(0,t.jsx)("a",{href:"https://trace.playwright.dev/",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"trace.playwright.dev"}),"."]})]})]}):(0,t.jsxs)(c.Alert,{className:"rounded-2xl",children:[(0,t.jsx)(N.Info,{className:"h-4 w-4"}),(0,t.jsx)(c.AlertTitle,{children:"No Trace File Available"}),(0,t.jsx)(c.AlertDescription,{children:"There is no Playwright trace file associated with this test run."})]})]}),[{value:"sub-html",title:"HTML Files",attachments:i},{value:"sub-pdf",title:"PDF Documents",attachments:o},{value:"sub-json",title:"JSON Files",attachments:u},{value:"sub-text",title:"Text & CSV Files",attachments:m},{value:"sub-other",title:"Other Files",attachments:h}].map(e=>(0,t.jsxs)(d.TabsContent,{value:e.value,className:"mt-4",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-4",children:e.title}),(0,t.jsx)("div",{className:"space-y-3",children:e.attachments.length>0?e.attachments.map((e,s)=>(0,t.jsxs)("div",{className:"p-3 border rounded-2xl bg-muted/30 shadow-sm flex items-center justify-between gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 truncate",children:[(0,t.jsx)(es,{contentType:e.contentType}),(0,t.jsxs)("div",{className:"truncate",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-foreground truncate",title:e.name,children:e.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e.contentType})]})]}),(0,t.jsxs)("div",{className:"flex items-center flex-shrink-0 gap-2",children:[(0,t.jsx)(n.Button,{asChild:!0,variant:"ghost",size:"sm",children:(0,t.jsx)("a",{href:(0,I.getAssetPath)(e.path),target:"_blank",rel:"noopener noreferrer",children:"View"})}),(0,t.jsx)(n.Button,{asChild:!0,variant:"outline",size:"sm",children:(0,t.jsxs)("a",{href:(0,I.getAssetPath)(e.path),download:e.name,children:[(0,t.jsx)(w,{className:"h-4 w-4 mr-2"}),"Download"]})})]})]},s)):(0,t.jsxs)(c.Alert,{className:"rounded-2xl",children:[(0,t.jsx)(N.Info,{className:"h-4 w-4"}),(0,t.jsx)(c.AlertTitle,{children:"No Files Available"}),(0,t.jsx)(c.AlertDescription,{children:"No attachments of this type were found for this test."})]})})]},e.value))]})})}function ei({test:e}){let[s,a]=(0,$.useState)(null),[r,i]=(0,$.useState)(!1),[d,o]=(0,$.useState)(null),x=async()=>{if(e){i(!0),a(null),o(null);try{let t=await fetch("/api/analyze-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testName:e.name,failureLogsAndErrors:e.errorMessage||"",codeSnippet:e.snippet||""})});if(!t.ok){let e=await t.json().catch(()=>({message:"Failed to parse error response"}));throw Error(e.message||`API request failed with status ${t.status}`)}let s=await t.json();a(s)}catch(e){console.error("Error generating AI suggestion:",e),o(e instanceof Error?e.message:"An unknown error occurred.")}finally{i(!1)}}};return(0,t.jsx)("div",{className:"mt-4 p-4 border rounded-2xl bg-card shadow-inner",children:(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center text-center p-2 md:p-6",children:[(0,t.jsxs)("h3",{className:"text-lg font-semibold text-foreground mb-3 flex items-center",children:[(0,t.jsx)(z,{className:"h-5 w-5 mr-2 text-primary"}),"AI-Powered Failure Analysis"]}),!(r||s||d)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"text-muted-foreground text-sm mb-6 max-w-md",children:"Get suggestions from AI to help diagnose the root cause of this test failure and find potential solutions."}),(0,t.jsxs)(n.Button,{onClick:x,disabled:r,children:[(0,t.jsx)(z,{className:"h-4 w-4 mr-2"}),"Generate Suggestion"]})]}),r&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-10",children:[(0,t.jsx)(z,{className:"h-8 w-8 text-primary animate-pulse mb-4"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"Generating suggestion... Please wait."})]}),d&&(0,t.jsxs)("div",{className:"w-full text-left",children:[(0,t.jsxs)(c.Alert,{variant:"destructive",children:[(0,t.jsx)(c.AlertTitle,{children:"Error Generating Suggestion"}),(0,t.jsx)(c.AlertDescription,{children:d})]}),(0,t.jsxs)(n.Button,{onClick:x,variant:"outline",size:"sm",className:"mt-4",children:[(0,t.jsx)(z,{className:"h-4 w-4 mr-2"}),"Try Again"]})]}),s&&(0,t.jsxs)("div",{className:"text-left w-full mt-6 space-y-6",children:[(0,t.jsxs)(c.Alert,{variant:"default",className:"border-primary/30 bg-primary/5",children:[(0,t.jsx)(L,{className:"h-5 w-5 text-primary"}),(0,t.jsx)(c.AlertTitle,{className:"text-primary font-semibold",children:"Root Cause Analysis"}),(0,t.jsx)(c.AlertDescription,{className:"text-primary/90",children:s.rootCause||"No root cause analysis provided."})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold text-foreground mb-2",children:"Affected Tests:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:s.affectedTests?.map(e=>(0,t.jsx)(H.Badge,{variant:"secondary",children:e},e))||(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"N/A"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("h4",{className:"font-semibold text-foreground mb-3 flex items-center",children:[(0,t.jsx)(D,{className:"h-4 w-4 mr-2"}),"Suggested Fixes"]}),(0,t.jsxs)("div",{className:"space-y-4",children:[s.suggestedFixes?.map((e,s)=>(0,t.jsxs)(l.Card,{className:"bg-card/50 shadow-md",children:[(0,t.jsx)(l.CardHeader,{children:(0,t.jsxs)(l.CardTitle,{className:"text-base",children:["Suggestion #",s+1]})}),(0,t.jsxs)(l.CardContent,{children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:e.description}),e.codeSnippet&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("h5",{className:"text-xs font-semibold text-foreground mb-1 flex items-center",children:[(0,t.jsx)(S,{className:"h-3 w-3 mr-1.5"}),"Code Snippet:"]}),(0,t.jsx)("pre",{className:"bg-muted text-sm p-3 rounded-xl whitespace-pre-wrap font-code overflow-x-auto",children:(0,t.jsx)("code",{children:e.codeSnippet})})]})]})]},s)),(!s.suggestedFixes||0===s.suggestedFixes.length)&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"No specific fixes were suggested."})]})]}),(0,t.jsxs)(n.Button,{onClick:x,variant:"outline",size:"sm",className:"mt-4",children:[(0,t.jsx)(z,{className:"h-4 w-4 mr-2"}),"Regenerate Suggestion"]})]})]})})}e.s(["TestDetailsClientPage",0,function({testId:e}){let x,u=(0,s.useRouter)(),{currentRun:p,loadingCurrent:g,errorCurrent:b}=(0,a.useTestData)(),[v,w]=(0,$.useState)(null),[k,T]=(0,$.useState)([]),[_,C]=(0,$.useState)([]),[A,S]=(0,$.useState)(!1),[M,L]=(0,$.useState)(null),D=(0,$.useRef)(null),[F,B]=(0,$.useState)(!1),[R,P]=(0,$.useState)("current"),E=(0,$.useMemo)(()=>p?.results?.find(t=>t.id===e)||null,[p,e]);(0,$.useEffect)(()=>{w(E),B(!1),C([]),L(null)},[E,e]);let V=(0,$.useCallback)(async()=>{if(e&&!F&&E?.suiteName&&p?.run?.timestamp){S(!0),L(null);try{let t=(await O()).filter(e=>e.run.timestamp!==p.run.timestamp);T(t);let s=[];t.forEach(t=>{let a=t.results.find(t=>t.id===e&&t.suiteName===E.suiteName);if(a){let e=(0,r.getEffectiveTestStatus)(a);s.push({date:t.run.timestamp,duration:a.duration,status:e})}}),E&&p?.run?.timestamp&&s.push({date:p.run.timestamp,duration:E.duration,status:(0,r.getEffectiveTestStatus)(E)}),s.sort((e,t)=>new Date(t.date).getTime()-new Date(e.date).getTime()),C(s),B(!0)}catch(e){console.error("Error fetching test history:",e),L(e instanceof Error?e.message:"Failed to load test history")}finally{S(!1)}}},[e,F,E,p]);(0,$.useEffect)(()=>{if("current"===R)w(E);else{let t=k.find(e=>e.run.timestamp===R);t?.results&&E&&w(t.results.find(t=>t.id===e&&t.suiteName===E.suiteName)||null)}},[R,E,k,e]);let es=e=>{switch(e){case"passed":return"bg-green-500";case"flaky":return"bg-sky-500";case"failed":case"timedOut":return"bg-red-500";case"skipped":return"bg-yellow-500";default:return"bg-gray-400"}},ea=v?.status==="failed"||v?.status==="timedOut",ed=v?.retryHistory?v.retryHistory.filter(e=>"passed"!==e.status&&"skipped"!==e.status).length:0;if(g&&!v)return(0,t.jsxs)("div",{className:"container mx-auto py-8 space-y-6",children:[(0,t.jsx)(o.Skeleton,{className:"h-10 w-48 mb-4 rounded-xl"}),(0,t.jsxs)(l.Card,{className:"shadow-xl rounded-2xl",children:[(0,t.jsxs)(l.CardHeader,{children:[(0,t.jsx)(o.Skeleton,{className:"h-8 w-3/4 mb-2 rounded-xl"}),(0,t.jsx)(o.Skeleton,{className:"h-4 w-1/2 rounded-xl"})]}),(0,t.jsxs)(l.CardContent,{className:"space-y-4",children:[(0,t.jsx)(o.Skeleton,{className:"h-10 w-1/3 mb-4 rounded-xl"}),(0,t.jsx)(o.Skeleton,{className:"h-40 w-full rounded-xl"})]})]})]});if(b&&!v)return(0,t.jsxs)("div",{className:"container mx-auto px-4 py-8",children:[(0,t.jsxs)(c.Alert,{variant:"destructive",className:"rounded-2xl",children:[(0,t.jsx)(c.AlertTitle,{children:"Error loading test data"}),(0,t.jsx)(c.AlertDescription,{children:b})]}),(0,t.jsxs)(n.Button,{onClick:()=>u.push("/"),variant:"outline",className:"mt-4 rounded-2xl",children:[(0,t.jsx)(h,{className:"mr-2 h-4 w-4"})," Back"]})]});if(!v)return(0,t.jsxs)("div",{className:"container mx-auto px-4 py-8 text-center",children:[(0,t.jsxs)(c.Alert,{className:"rounded-2xl",children:[(0,t.jsx)(c.AlertTitle,{children:"Test Not Found"}),(0,t.jsxs)(c.AlertDescription,{children:["The test with ID '",e,"' could not be found in the current report."]})]}),(0,t.jsxs)(n.Button,{onClick:()=>u.push("/"),className:"mt-6 inline-flex items-center justify-center rounded-xl border bg-transparent px-4 py-2 text-sm font-medium text-muted-foreground shadow-sm transition-all duration-300 ease-in-out hover:-translate-y-0.5 hover:shadow-lg hover:bg-primary hover:text-primary-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",children:[(0,t.jsx)(h,{className:"mr-2 h-4 w-4"})," Back to Dashboard"]})]});let eo=function(e){if(!e)return"";let t=e.split(" > ");return t[t.length-1]||e}(v.name);return(0,t.jsxs)("div",{className:"container mx-auto px-4 py-8 space-y-6",children:[(0,t.jsxs)(n.Button,{onClick:()=>u.push("/"),className:"mt-6 inline-flex items-center justify-center rounded-xl border bg-transparent px-4 py-2 text-sm font-medium text-muted-foreground shadow-sm transition-all duration-300 ease-in-out hover:-translate-y-0.5 hover:shadow-lg hover:bg-primary hover:text-primary-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",children:[(0,t.jsx)(h,{className:"mr-2 h-4 w-4"})," Back to Dashboard"]}),(0,t.jsxs)(l.Card,{className:"shadow-xl rounded-2xl",children:[(0,t.jsxs)(l.CardHeader,{children:[(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(l.CardTitle,{className:"text-2xl font-headline text-primary flex items-center",title:v.name,children:[(0,t.jsx)(ee,{status:v.status}),(0,t.jsx)("span",{className:"ml-3",children:eo})]}),v.suiteName&&(0,t.jsxs)(l.CardDescription,{className:"mt-1 text-md",children:["From suite: ",v.suiteName]}),(0,t.jsxs)("p",{className:"text-sm text-muted-foreground mt-2",children:["Run Date:"," ","current"===R?g?(0,t.jsx)("span",{className:"text-muted-foreground",children:"Loading..."}):p?.run?.timestamp?(0,t.jsx)("span",{className:"font-medium",children:new Date(p.run.timestamp).toLocaleString()}):b&&!p?.run?.timestamp?(0,t.jsx)("span",{className:"text-destructive font-medium",children:"Error loading date"}):(0,t.jsx)("span",{className:"font-medium",children:"Not available"}):(0,t.jsx)("span",{className:"font-medium",children:new Date(R).toLocaleString()})]}),(0,t.jsxs)("div",{className:"mt-1 text-xs text-muted-foreground",children:[(0,t.jsxs)("p",{children:["ID: ",v.id]}),v.browser&&(0,t.jsxs)("p",{children:["Browser: ",v.browser]})]})]}),(0,t.jsxs)("div",{className:"text-right flex-shrink-0",children:[(x=(0,r.getEffectiveTestStatus)(v),(0,t.jsx)(H.Badge,{variant:"outline",className:"capitalize text-sm px-3 py-1 rounded-full border",style:function(e){switch(e){case"passed":return{backgroundColor:"hsl(var(--chart-3))",color:"hsl(var(--primary-foreground))"};case"failed":case"timedOut":return{backgroundColor:"hsl(var(--destructive))",color:"hsl(var(--destructive-foreground))"};case"skipped":return{backgroundColor:"hsl(var(--accent))",color:"hsl(var(--accent-foreground))"};case"pending":return{backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))"};case"flaky":return{backgroundColor:"hsl(var(--flaky))",color:"hsl(var(--flaky-foreground))"};default:return{backgroundColor:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"}}}(x),children:x})),(0,t.jsxs)("p",{className:"text-sm text-muted-foreground mt-1",children:["Duration: ",et(v.duration)]}),ed>0&&(0,t.jsxs)(H.Badge,{variant:"secondary",className:"mt-1",children:["Retry Count: ",ed]}),ed>0&&"passed"===v.status&&(0,t.jsx)(H.Badge,{variant:"outline",className:"ml-2 mt-1 border-sky-500 text-sky-600 bg-sky-500/10",children:"Flaky"}),v.annotations?.map((e,s)=>"severity"===e.type||"priority"===e.type?(0,t.jsx)(H.Badge,{variant:"outline",className:"ml-2 mt-1 border-blue-500 text-blue-600 bg-blue-500/10 capitalize",children:e.description||e.type},s):null),v.tags&&v.tags.length>0&&(0,t.jsx)("div",{className:"mt-1 space-x-1",children:v.tags.map(e=>(0,t.jsx)(H.Badge,{variant:"secondary",className:"text-xs rounded-full",children:e},e))})]})]}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsxs)(i.Select,{value:R,onValueChange:P,onOpenChange:e=>{e&&!F&&V()},children:[(0,t.jsx)(i.SelectTrigger,{className:"w-full md:w-[350px] h-12 rounded-xl bg-card/50 border-2 border-transparent hover:border-primary/30 focus:ring-2 focus:ring-primary/50 focus:ring-offset-2 focus:ring-offset-background transition-colors duration-200 group",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(m,{className:"h-5 w-5 text-muted-foreground transition-colors group-hover:text-primary"}),(0,t.jsx)(i.SelectValue,{placeholder:"Switch to a past run"})]})}),(0,t.jsxs)(i.SelectContent,{sideOffset:8,className:"bg-card/80 backdrop-blur-lg border border-border/50 rounded-xl shadow-2xl data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",children:[(0,t.jsx)(i.SelectItem,{value:"current",className:"rounded-2xl",children:"Current Run"}),A&&(0,t.jsx)(i.SelectItem,{value:"loading",disabled:!0,className:"rounded-2xl",children:"Loading history..."}),_.filter(e=>e.date!==p?.run?.timestamp).map(e=>(0,t.jsx)(i.SelectItem,{value:e.date,className:"rounded-2xl",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:(0,I.cn)("h-2 w-2 rounded-full",es(e.status)),title:`Status: ${e.status}`}),(0,t.jsxs)("span",{className:"text-sm",children:[new Date(e.date).toLocaleString()," -"," ",(0,t.jsx)("span",{className:"font-medium capitalize",children:e.status})]})]})},e.date))]})]})})]}),(0,t.jsx)(l.CardContent,{children:(0,t.jsxs)(d.Tabs,{defaultValue:"steps",className:"w-full",onValueChange:e=>{"history"!==e||F||V()},children:[(0,t.jsxs)(d.TabsList,{className:(0,I.cn)("w-full h-auto mb-6 p-1.5 bg-muted/40 backdrop-blur-sm rounded-2xl border border-border/40 shadow-[inset_0_1px_2px_rgba(0,0,0,0.05),0_2px_5px_rgba(0,0,0,0.05)] grid gap-2",ea?"grid-cols-2 md:grid-cols-5":"grid-cols-2 md:grid-cols-4"),children:[(0,t.jsx)(d.TabsTrigger,{value:"steps",className:"group relative flex items-center justify-center gap-1.5 sm:gap-2.5 rounded-xl px-2 sm:px-4 py-2 sm:py-2.5 text-xs sm:text-sm whitespace-normal text-center h-auto font-semibold text-muted-foreground transition-all duration-300 hover:text-foreground hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-[0_2px_12px_-4px_rgba(0,0,0,0.15)] data-[state=active]:border data-[state=active]:border-border/40 border border-transparent overflow-hidden",children:(0,t.jsxs)("span",{className:"relative z-10 flex flex-col xl:flex-row items-center justify-center gap-1 xl:gap-2.5",children:["Execution Steps (",v.steps?.length||0,")"]})}),(0,t.jsx)(d.TabsTrigger,{value:"attachments",className:"group relative flex items-center justify-center gap-1.5 sm:gap-2.5 rounded-xl px-2 sm:px-4 py-2 sm:py-2.5 text-xs sm:text-sm whitespace-normal text-center h-auto font-semibold text-muted-foreground transition-all duration-300 hover:text-foreground hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-[0_2px_12px_-4px_rgba(0,0,0,0.15)] data-[state=active]:border data-[state=active]:border-border/40 border border-transparent overflow-hidden",children:(0,t.jsx)("span",{className:"relative z-10 flex flex-col xl:flex-row items-center justify-center gap-1 xl:gap-2.5",children:"Attachments"})}),(0,t.jsx)(d.TabsTrigger,{value:"logs",className:"group relative flex items-center justify-center gap-1.5 sm:gap-2.5 rounded-xl px-2 sm:px-4 py-2 sm:py-2.5 text-xs sm:text-sm whitespace-normal text-center h-auto font-semibold text-muted-foreground transition-all duration-300 hover:text-foreground hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-[0_2px_12px_-4px_rgba(0,0,0,0.15)] data-[state=active]:border data-[state=active]:border-border/40 border border-transparent overflow-hidden",children:(0,t.jsxs)("span",{className:"relative z-10 flex flex-col xl:flex-row items-center justify-center gap-1 xl:gap-2.5",children:[(0,t.jsx)(j.FileText,{className:"h-4 w-4 xl:mr-2"}),"Logs"]})}),(0,t.jsx)(d.TabsTrigger,{value:"history",className:"group relative flex items-center justify-center gap-1.5 sm:gap-2.5 rounded-xl px-2 sm:px-4 py-2 sm:py-2.5 text-xs sm:text-sm whitespace-normal text-center h-auto font-semibold text-muted-foreground transition-all duration-300 hover:text-foreground hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-[0_2px_12px_-4px_rgba(0,0,0,0.15)] data-[state=active]:border data-[state=active]:border-border/40 border border-transparent overflow-hidden",children:(0,t.jsx)("span",{className:"relative z-10 flex flex-col xl:flex-row items-center justify-center gap-1 xl:gap-2.5",children:"Test Run History"})}),ea&&(0,t.jsx)(d.TabsTrigger,{value:"ai-suggestions",className:"group relative flex items-center justify-center gap-1.5 sm:gap-2.5 rounded-xl px-2 sm:px-4 py-2 sm:py-2.5 text-xs sm:text-sm whitespace-normal text-center h-auto font-semibold text-muted-foreground transition-all duration-300 hover:text-foreground hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-[0_2px_12px_-4px_rgba(0,0,0,0.15)] data-[state=active]:border data-[state=active]:border-border/40 border border-transparent overflow-hidden",children:(0,t.jsxs)("span",{className:"relative z-10 flex flex-col xl:flex-row items-center justify-center gap-1 xl:gap-2.5 text-primary group-data-[state=active]:text-primary group-hover:text-primary transition-colors",children:[(0,t.jsx)(z,{className:"h-4 w-4 xl:mr-2"}),"AI Suggestions"]})})]}),(0,t.jsx)(d.TabsContent,{value:"steps",children:ed>0?(0,t.jsxs)(d.Tabs,{defaultValue:"base-run",className:"w-full",children:[(0,t.jsxs)(d.TabsList,{className:"mb-6 h-auto inline-flex p-1.5 bg-muted/40 backdrop-blur-sm rounded-2xl border border-border/40 shadow-[inset_0_1px_2px_rgba(0,0,0,0.05),0_2px_5px_rgba(0,0,0,0.05)] flex-wrap max-w-full gap-2",children:[(0,t.jsx)(d.TabsTrigger,{value:"base-run",className:"group relative flex items-center gap-2.5 rounded-xl px-4 py-2.5 text-sm font-semibold text-muted-foreground transition-all duration-300 hover:text-foreground hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-[0_2px_12px_-4px_rgba(0,0,0,0.15)] data-[state=active]:border data-[state=active]:border-border/40 border border-transparent overflow-hidden",children:(0,t.jsxs)("span",{className:"relative z-10 flex items-center gap-2.5",children:["Base Run",(0,t.jsx)("span",{className:(0,I.cn)("h-2.5 w-2.5 rounded-full ring-[3px] ring-background/60 shadow-sm transition-transform group-hover:scale-110 group-data-[state=active]:scale-125",es(v.status))})]})}),v.retryHistory?.map((e,s)=>(0,t.jsx)(d.TabsTrigger,{value:`retry-${s}`,className:"group relative flex items-center gap-2.5 rounded-xl px-4 py-2.5 text-sm font-semibold text-muted-foreground transition-all duration-300 hover:text-foreground hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-[0_2px_12px_-4px_rgba(0,0,0,0.15)] data-[state=active]:border data-[state=active]:border-border/40 border border-transparent overflow-hidden",children:(0,t.jsxs)("span",{className:"relative z-10 flex items-center gap-2.5",children:["Retry ",s+1,(0,t.jsx)("span",{className:(0,I.cn)("h-2.5 w-2.5 rounded-full ring-[3px] ring-background/60 shadow-sm transition-transform group-hover:scale-110 group-data-[state=active]:scale-125",es(e.status))})]})},s))]}),(0,t.jsx)(d.TabsContent,{value:"base-run",children:(0,t.jsx)(er,{test:v})}),v.retryHistory?.map((e,s)=>(0,t.jsx)(d.TabsContent,{value:`retry-${s}`,children:(0,t.jsx)(er,{test:e})},s))]}):(0,t.jsx)(er,{test:v})}),(0,t.jsx)(d.TabsContent,{value:"attachments",children:ed>0?(0,t.jsxs)(d.Tabs,{defaultValue:"base-run",className:"w-full",children:[(0,t.jsxs)(d.TabsList,{className:"mb-6 h-auto inline-flex p-1.5 bg-muted/40 backdrop-blur-sm rounded-2xl border border-border/40 shadow-[inset_0_1px_2px_rgba(0,0,0,0.05),0_2px_5px_rgba(0,0,0,0.05)] flex-wrap max-w-full gap-2",children:[(0,t.jsx)(d.TabsTrigger,{value:"base-run",className:"group relative flex items-center gap-2.5 rounded-xl px-4 py-2.5 text-sm font-semibold text-muted-foreground transition-all duration-300 hover:text-foreground hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-[0_2px_12px_-4px_rgba(0,0,0,0.15)] data-[state=active]:border data-[state=active]:border-border/40 border border-transparent overflow-hidden",children:(0,t.jsxs)("span",{className:"relative z-10 flex items-center gap-2.5",children:["Base Run",(0,t.jsx)("span",{className:(0,I.cn)("h-2.5 w-2.5 rounded-full ring-[3px] ring-background/60 shadow-sm transition-transform group-hover:scale-110 group-data-[state=active]:scale-125",es(v.status))})]})}),v.retryHistory?.map((e,s)=>(0,t.jsx)(d.TabsTrigger,{value:`retry-${s}`,className:"group relative flex items-center gap-2.5 rounded-xl px-4 py-2.5 text-sm font-semibold text-muted-foreground transition-all duration-300 hover:text-foreground hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-[0_2px_12px_-4px_rgba(0,0,0,0.15)] data-[state=active]:border data-[state=active]:border-border/40 border border-transparent overflow-hidden",children:(0,t.jsxs)("span",{className:"relative z-10 flex items-center gap-2.5",children:["Retry ",s+1,(0,t.jsx)("span",{className:(0,I.cn)("h-2.5 w-2.5 rounded-full ring-[3px] ring-background/60 shadow-sm transition-transform group-hover:scale-110 group-data-[state=active]:scale-125",es(e.status))})]})},s))]}),(0,t.jsx)(d.TabsContent,{value:"base-run",children:(0,t.jsx)(en,{test:v})}),v.retryHistory?.map((e,s)=>(0,t.jsx)(d.TabsContent,{value:`retry-${s}`,children:(0,t.jsx)(en,{test:e})},s))]}):(0,t.jsx)(en,{test:v})}),(0,t.jsx)(d.TabsContent,{value:"logs",children:ed>0?(0,t.jsxs)(d.Tabs,{defaultValue:"base-run",className:"w-full",children:[(0,t.jsxs)(d.TabsList,{className:"mb-6 h-auto inline-flex p-1.5 bg-muted/40 backdrop-blur-sm rounded-2xl border border-border/40 shadow-[inset_0_1px_2px_rgba(0,0,0,0.05),0_2px_5px_rgba(0,0,0,0.05)] flex-wrap max-w-full gap-2",children:[(0,t.jsx)(d.TabsTrigger,{value:"base-run",className:"group relative flex items-center gap-2.5 rounded-xl px-4 py-2.5 text-sm font-semibold text-muted-foreground transition-all duration-300 hover:text-foreground hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-[0_2px_12px_-4px_rgba(0,0,0,0.15)] data-[state=active]:border data-[state=active]:border-border/40 border border-transparent overflow-hidden",children:(0,t.jsxs)("span",{className:"relative z-10 flex items-center gap-2.5",children:["Base Run",(0,t.jsx)("span",{className:(0,I.cn)("h-2.5 w-2.5 rounded-full ring-[3px] ring-background/60 shadow-sm transition-transform group-hover:scale-110 group-data-[state=active]:scale-125",es(v.status))})]})}),v.retryHistory?.map((e,s)=>(0,t.jsx)(d.TabsTrigger,{value:`retry-${s}`,className:"group relative flex items-center gap-2.5 rounded-xl px-4 py-2.5 text-sm font-semibold text-muted-foreground transition-all duration-300 hover:text-foreground hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-[0_2px_12px_-4px_rgba(0,0,0,0.15)] data-[state=active]:border data-[state=active]:border-border/40 border border-transparent overflow-hidden",children:(0,t.jsxs)("span",{className:"relative z-10 flex items-center gap-2.5",children:["Retry ",s+1,(0,t.jsx)("span",{className:(0,I.cn)("h-2.5 w-2.5 rounded-full ring-[3px] ring-background/60 shadow-sm transition-transform group-hover:scale-110 group-data-[state=active]:scale-125",es(e.status))})]})},s))]}),(0,t.jsx)(d.TabsContent,{value:"base-run",children:(0,t.jsx)(el,{test:v})}),v.retryHistory?.map((e,s)=>(0,t.jsx)(d.TabsContent,{value:`retry-${s}`,children:(0,t.jsx)(el,{test:e})},s))]}):(0,t.jsx)(el,{test:v})}),(0,t.jsxs)(d.TabsContent,{value:"history",className:"mt-4 p-4 border rounded-2xl bg-card shadow-inner",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-3",children:(0,t.jsxs)("h3",{className:"text-lg font-semibold text-foreground flex items-center",children:[(0,t.jsx)(y,{className:"h-5 w-5 mr-2 text-primary"}),"Individual Test Run History"]})}),A&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(o.Skeleton,{className:"h-6 w-3/4 rounded-xl"}),(0,t.jsx)(o.Skeleton,{className:"h-64 w-full rounded-2xl"})]}),M&&!A&&(0,t.jsxs)(c.Alert,{variant:"destructive",className:"rounded-2xl",children:[(0,t.jsx)(f.AlertCircle,{className:"h-4 w-4"}),(0,t.jsx)(c.AlertTitle,{children:"Error Loading Test History"}),(0,t.jsx)(c.AlertDescription,{children:M})]}),!A&&!M&&F&&0===_.length&&(0,t.jsxs)(c.Alert,{className:"rounded-2xl",children:[(0,t.jsx)(N.Info,{className:"h-4 w-4"}),(0,t.jsx)(c.AlertTitle,{children:"No Historical Data"}),(0,t.jsxs)(c.AlertDescription,{children:["No historical run data found for this specific test (ID:"," ",e,") in this suite."]})]}),!A&&!M&&_.length>0&&(0,t.jsx)("div",{ref:D,className:"w-full h-[300px] bg-card p-4 rounded-2xl shadow-inner",children:(0,t.jsx)(G.ResponsiveContainer,{width:"100%",height:"100%",children:(0,t.jsxs)(W.LineChart,{data:[..._].reverse(),margin:{top:5,right:20,left:-20,bottom:5},children:[(0,t.jsx)(J.CartesianGrid,{strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),(0,t.jsx)(K.XAxis,{dataKey:"date",tickFormatter:e=>new Date(e).toLocaleDateString("en-CA",{month:"short",day:"numeric"}),stroke:"hsl(var(--muted-foreground))",tick:{fontSize:10},angle:-30,textAnchor:"end",height:40}),(0,t.jsx)(U.YAxis,{tickFormatter:e=>et(e),stroke:"hsl(var(--muted-foreground))",tick:{fontSize:10},width:80}),(0,t.jsx)(X.Tooltip,{content:(0,t.jsx)(Z,{})}),(0,t.jsx)(Y.Legend,{wrapperStyle:{fontSize:"12px"}}),(0,t.jsx)(q.Line,{type:"monotone",dataKey:"duration",name:"Duration",stroke:"hsl(var(--primary))",strokeWidth:2,dot:(0,t.jsx)(Q,{}),activeDot:{r:7}})]})})})]}),ea&&(0,t.jsx)(d.TabsContent,{value:"ai-suggestions",children:ed>0?(0,t.jsxs)(d.Tabs,{defaultValue:"base-run",className:"w-full",children:[(0,t.jsxs)(d.TabsList,{className:"mb-6 h-auto inline-flex p-1.5 bg-muted/40 backdrop-blur-sm rounded-2xl border border-border/40 shadow-[inset_0_1px_2px_rgba(0,0,0,0.05),0_2px_5px_rgba(0,0,0,0.05)] flex-wrap max-w-full gap-2",children:[(0,t.jsx)(d.TabsTrigger,{value:"base-run",className:"group relative flex items-center gap-2.5 rounded-xl px-4 py-2.5 text-sm font-semibold text-muted-foreground transition-all duration-300 hover:text-foreground hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-[0_2px_12px_-4px_rgba(0,0,0,0.15)] data-[state=active]:border data-[state=active]:border-border/40 border border-transparent overflow-hidden",children:(0,t.jsxs)("span",{className:"relative z-10 flex items-center gap-2.5",children:["Base Run",(0,t.jsx)("span",{className:(0,I.cn)("h-2.5 w-2.5 rounded-full ring-[3px] ring-background/60 shadow-sm transition-transform group-hover:scale-110 group-data-[state=active]:scale-125",es(v.status))})]})}),v.retryHistory?.map((e,s)=>(0,t.jsx)(d.TabsTrigger,{value:`retry-${s}`,className:"group relative flex items-center gap-2.5 rounded-xl px-4 py-2.5 text-sm font-semibold text-muted-foreground transition-all duration-300 hover:text-foreground hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-[0_2px_12px_-4px_rgba(0,0,0,0.15)] data-[state=active]:border data-[state=active]:border-border/40 border border-transparent overflow-hidden",children:(0,t.jsxs)("span",{className:"relative z-10 flex items-center gap-2.5",children:["Retry ",s+1,(0,t.jsx)("span",{className:(0,I.cn)("h-2.5 w-2.5 rounded-full ring-[3px] ring-background/60 shadow-sm transition-transform group-hover:scale-110 group-data-[state=active]:scale-125",es(e.status))})]})},s))]}),(0,t.jsx)(d.TabsContent,{value:"base-run",children:(0,t.jsx)(ei,{test:v})}),v.retryHistory?.map((e,s)=>(0,t.jsx)(d.TabsContent,{value:`retry-${s}`,children:(0,t.jsx)(ei,{test:e})},s))]}):(0,t.jsx)(ei,{test:v})})]})})]})]})}],12042)}]);