@@ -8,13 +8,11 @@ import {
88 userMessage ,
99} from "../performance/timeline-stability/fixture"
1010
11- test ( "transitions shell and question through running error outcomes " , async ( { page } ) => {
11+ test ( "keeps shell and question failures in their Used group " , async ( { page } ) => {
1212 const shellID = "prt_transition_error_shell"
1313 const questionID = "prt_transition_error_question"
1414 const timeline = await setupTimeline ( page , {
15- settings : {
16- timelineDetail : { ...timelinePresets [ 2 ] . value , shell : { placement : "separate" , details : "expanded" } } ,
17- } ,
15+ settings : { timelineDetail : timelinePresets [ 2 ] . value } ,
1816 messages : [
1917 userMessage ( ) ,
2018 assistantMessage (
@@ -26,31 +24,46 @@ test("transitions shell and question through running error outcomes", async ({ p
2624 ) ,
2725 ] ,
2826 } )
27+ const group = page . locator ( '[data-component="collapsed-tool-group"]' )
28+ const used = group . locator ( ':scope > [data-component="collapsible"] > [data-slot="collapsible-trigger"]' )
29+ await used . click ( )
2930 await expect ( page . locator ( `[data-timeline-part-id="${ questionID } "]` ) ) . toHaveCount ( 0 )
3031 await timeline . send ( partUpdated ( toolPart ( shellID , "shell" , "running" , { command : "exit 1" } ) ) )
3132 await expect ( page . locator ( `[data-timeline-part-id="${ shellID } "]` ) ) . toContainText ( "exit 1" )
3233 await timeline . send ( partUpdated ( toolPart ( questionID , "question" , "running" , questionInput ( ) ) ) )
3334 await expect ( page . locator ( `[data-timeline-part-id="${ questionID } "]` ) ) . toHaveCount ( 0 )
3435 await timeline . send (
35- partUpdated ( toolPart ( shellID , "shell" , "error" , { command : "exit 1" } , { error : "Command exited 1" } ) ) ,
36+ partUpdated (
37+ toolPart (
38+ shellID ,
39+ "shell" ,
40+ "completed" ,
41+ { command : "exit 1" } ,
42+ { output : "Command exited 1" , metadata : { exit : 1 } } ,
43+ ) ,
44+ ) ,
3645 )
3746 await timeline . send (
3847 partUpdated (
3948 toolPart ( questionID , "question" , "error" , questionInput ( ) , { error : "The user dismissed this question" } ) ,
4049 ) ,
4150 )
4251
43- await expect ( page . locator ( `[data-timeline-part-id="${ shellID } "] [data-kind="tool-error-card"]` ) ) . toBeVisible ( )
44- await expect ( page . locator ( `[data-timeline-part-id="${ questionID } "]` ) ) . toContainText ( / d i s m i s s e d / i)
52+ await expect ( group ) . toHaveAttribute ( "data-timeline-part-ids" , `${ shellID } ,${ questionID } ` )
53+ await expect ( used ) . toHaveAttribute ( "aria-expanded" , "true" )
54+ const shell = group . locator ( `[data-timeline-part-id="${ shellID } "]` )
55+ await expect ( shell . locator ( '[data-slot="collapsible-trigger"]' ) ) . toHaveAttribute ( "aria-expanded" , "false" )
56+ await shell . locator ( '[data-slot="collapsible-trigger"]' ) . click ( )
57+ await expect ( shell ) . toContainText ( "Command exited 1" )
58+ const question = group . locator ( `[data-timeline-part-id="${ questionID } "]` )
59+ await expect ( question ) . toContainText ( / d i s m i s s e d / i)
4560} )
4661
47- test ( "preserves surviving grouped patch state when its first patch fails " , async ( { page } ) => {
62+ test ( "keeps a failed patch in Used without losing the surviving file choice " , async ( { page } ) => {
4863 const failed = "prt_grouped_patch_failed"
4964 const surviving = "prt_grouped_patch_surviving"
5065 const timeline = await setupTimeline ( page , {
51- settings : {
52- timelineDetail : { ...timelinePresets [ 2 ] . value , edit : { placement : "separate" , details : "collapsed" } } ,
53- } ,
66+ settings : { timelineDetail : timelinePresets [ 2 ] . value } ,
5467 messages : [
5568 userMessage ( ) ,
5669 assistantMessage (
@@ -81,7 +94,9 @@ test("preserves surviving grouped patch state when its first patch fails", async
8194 ] ,
8295 } )
8396
84- const group = page . locator ( `[data-timeline-part-ids="${ failed } ,${ surviving } "]` )
97+ const group = page . locator ( '[data-component="collapsed-tool-group"]' )
98+ const used = group . locator ( ':scope > [data-component="collapsible"] > [data-slot="collapsible-trigger"]' )
99+ await used . click ( )
85100 const file = group . locator ( '[data-scope="apply-patch"] button' )
86101 await expect ( file ) . toBeVisible ( )
87102 await expect ( file ) . toHaveAttribute ( "aria-expanded" , "false" )
@@ -104,18 +119,14 @@ test("preserves surviving grouped patch state when its first patch fails", async
104119 const survivingRow = page . locator ( "[data-timeline-key]" , {
105120 has : page . locator ( `[data-timeline-part-id="${ surviving } "]` ) ,
106121 } )
107- await expect ( failedRow ) . toHaveAttribute ( "data-timeline-key" , / ^ a s s i s t a n t - p a r t : p a r t : / )
108- await expect ( survivingRow ) . toHaveAttribute ( "data-timeline-key" , / ^ a s s i s t a n t - p a r t : f i l e : / )
122+ await expect ( group ) . toHaveAttribute ( "data-timeline-part-ids" , `${ failed } ,${ surviving } ` )
123+ await expect ( used ) . toHaveAttribute ( "aria-expanded" , "true" )
124+ await expect ( failedRow ) . toHaveAttribute ( "data-timeline-key" , / ^ a s s i s t a n t - p a r t : c o n t e x t : / )
125+ await expect ( survivingRow ) . toHaveAttribute ( "data-timeline-key" , / ^ a s s i s t a n t - p a r t : c o n t e x t : / )
126+ await group . locator ( `[data-timeline-part-id="${ failed } "] [data-slot="collapsible-trigger"]` ) . click ( )
109127 await expect ( failedRow . getByText ( "Patch failed visibly" ) ) . toBeVisible ( )
110128 await expect ( survivingRow ) . toHaveAttribute ( "data-group-identity" , "preserved" )
111129 await expect ( survivingRow . locator ( '[data-scope="apply-patch"] button' ) ) . toHaveAttribute ( "aria-expanded" , "true" )
112- await expect
113- . poll ( async ( ) => {
114- const previous = await failedRow . boundingBox ( )
115- const next = await survivingRow . boundingBox ( )
116- return previous && next ? next . y - ( previous . y + previous . height ) : Number . NEGATIVE_INFINITY
117- } )
118- . toBeGreaterThanOrEqual ( - 0.5 )
119130} )
120131
121132test ( "groups instruction files loaded by the same read" , async ( { page } ) => {
0 commit comments