@@ -134,7 +134,7 @@ export const TestResultView: React.FC<{
134134 </ div > ) }
135135 </ AutoChip > </ Anchor > }
136136
137- { ! ! otherAttachments . size && < AutoChip header = 'Attachments' revealOnAnchorId = { otherAttachmentAnchors } >
137+ { ! ! otherAttachments . size && < AutoChip header = 'Attachments' revealOnAnchorId = { otherAttachmentAnchors } dataTestId = 'attachments' >
138138 { [ ...otherAttachments ] . map ( ( a , i ) =>
139139 < Anchor key = { `attachment-link-${ i } ` } id = { `attachment-${ result . attachments . indexOf ( a ) } ` } >
140140 < AttachmentLink attachment = { a } result = { result } openInNewTab = { a . contentType . startsWith ( 'text/html' ) } />
@@ -176,15 +176,27 @@ const StepTreeItem: React.FC<{
176176} > = ( { test, step, result, depth } ) => {
177177 return < TreeItem title = { < span aria-label = { step . title } >
178178 < span style = { { float : 'right' } } > { msToString ( step . duration ) } </ span >
179- { step . attachments . length > 0 && < a style = { { float : 'right' } } title = 'link to attachment' href = { testResultHref ( { test, result, anchor : `attachment-${ step . attachments [ 0 ] } ` } ) } onClick = { evt => { evt . stopPropagation ( ) ; } } > { icons . attachment ( ) } </ a > }
180179 { statusIcon ( step . error || step . duration === - 1 ? 'failed' : 'passed' ) }
181180 < span > { step . title } </ span >
182181 { step . count > 1 && < > ✕ < span className = 'test-result-counter' > { step . count } </ span > </ > }
183182 { step . location && < span className = 'test-result-path' > — { step . location . file } :{ step . location . line } </ span > }
184183 </ span > } loadChildren = { step . steps . length + ( step . snippet ? 1 : 0 ) ? ( ) => {
185- const children = step . steps . map ( ( s , i ) => < StepTreeItem key = { i } step = { s } depth = { depth + 1 } result = { result } test = { test } /> ) ;
186- if ( step . snippet )
187- children . unshift ( < TestErrorView testId = 'test-snippet' key = 'line' error = { step . snippet } /> ) ;
188- return children ;
184+ const snippet = step . snippet ? [ < TestErrorView testId = 'test-snippet' key = 'line' error = { step . snippet } /> ] : [ ] ;
185+ const steps = step . steps . map ( ( s , i ) => < StepTreeItem key = { i } step = { s } depth = { depth + 1 } result = { result } test = { test } /> ) ;
186+ const attachments = step . attachments . map ( attachmentIndex => (
187+ < a key = { '' + attachmentIndex }
188+ href = { testResultHref ( { test, result, anchor : `attachment-${ attachmentIndex } ` } ) }
189+ style = { { paddingLeft : depth * 22 + 4 , textDecoration : 'none' } }
190+ >
191+ < span
192+ style = { { margin : '8px 0 0 8px' , padding : '2px 10px' , cursor : 'pointer' } }
193+ className = 'label label-color-gray'
194+ title = { `see "${ result . attachments [ attachmentIndex ] . name } "` }
195+ >
196+ { icons . attachment ( ) } { result . attachments [ attachmentIndex ] . name }
197+ </ span >
198+ </ a >
199+ ) ) ;
200+ return snippet . concat ( steps , attachments ) ;
189201 } : undefined } depth = { depth } /> ;
190202} ;
0 commit comments