@@ -38,6 +38,7 @@ export default function TestDetailClient({ testId }: TestDetailClientProps) {
3838 const [ data , setData ] = React . useState < TestDetailsData | null > ( null ) ;
3939 const [ isLoading , setIsLoading ] = React . useState ( true ) ;
4040 const [ error , setError ] = React . useState < string | null > ( null ) ;
41+ const [ expandedRun , setExpandedRun ] = React . useState < string | null > ( null ) ;
4142
4243 React . useEffect ( ( ) => {
4344 async function loadData ( ) {
@@ -135,14 +136,46 @@ export default function TestDetailClient({ testId }: TestDetailClientProps) {
135136 </ TableHeader >
136137 < TableBody >
137138 { data . history . length > 0 ? data . history . map ( ( run ) => (
138- < TableRow key = { run . runId } >
139- < TableCell className = "font-medium truncate" title = { run . runId } > { run . runId } </ TableCell >
139+ < React . Fragment key = { run . runId } >
140+ < TableRow >
141+ < TableCell className = "font-medium truncate" title = { run . runId } >
142+ < button
143+ className = "text-left w-full hover:underline focus:outline-none"
144+ onClick = { ( ) => setExpandedRun ( expandedRun === run . runId ? null : run . runId ) }
145+ aria-expanded = { expandedRun === run . runId }
146+ aria-controls = { `run-details-${ run . runId } ` }
147+ >
148+ { run . runId }
149+ { ( ( run . stdout && run . stdout . length > 0 ) || ( run . errors && run . errors . length > 0 ) ) && (
150+ < span className = "ml-2 text-xs text-blue-400" > [details]</ span >
151+ ) }
152+ </ button >
153+ </ TableCell >
140154 < TableCell > { format ( new Date ( run . startedAt ) , 'PPP p' ) } </ TableCell >
141155 < TableCell > { getStatusBadge ( run . status ) } </ TableCell >
142156 < TableCell className = "text-right" >
143157 { run . duration !== undefined ? `${ run . duration } ms` : 'N/A' }
144158 </ TableCell >
145- </ TableRow >
159+ </ TableRow >
160+ { expandedRun === run . runId && ( ( run . stdout && run . stdout . length > 0 ) || ( run . errors && run . errors . length > 0 ) ) && (
161+ < TableRow >
162+ < TableCell colSpan = { 4 } id = { `run-details-${ run . runId } ` } className = "bg-muted/40" >
163+ { run . stdout && run . stdout . length > 0 && (
164+ < div className = "mb-2" >
165+ < div className = "font-semibold mb-1" > Stdout:</ div >
166+ < pre className = "bg-black text-white rounded p-2 overflow-x-auto text-xs max-h-48" > { run . stdout . join ( '\n' ) } </ pre >
167+ </ div >
168+ ) }
169+ { run . errors && run . errors . length > 0 && (
170+ < div >
171+ < div className = "font-semibold mb-1 text-red-500" > Errors:</ div >
172+ < pre className = "bg-black text-red-200 rounded p-2 overflow-x-auto text-xs max-h-48" > { run . errors . join ( '\n' ) } </ pre >
173+ </ div >
174+ ) }
175+ </ TableCell >
176+ </ TableRow >
177+ ) }
178+ </ React . Fragment >
146179 ) ) : (
147180 < TableRow >
148181 < TableCell colSpan = { 4 } className = "h-24 text-center" >
0 commit comments