@@ -171,7 +171,7 @@ describeControlUiE2e("Board split transcript restore", () => {
171171 await page . locator ( ".board-session-surface" ) . waitFor ( ) ;
172172 await page . getByText ( "Message number 39:" ) . first ( ) . waitFor ( { timeout : 15_000 } ) ;
173173
174- const mode = ( value : "split" | "dashboard" ) =>
174+ const mode = ( value : "chat" | " split" | "dashboard" ) =>
175175 page . locator ( `wa-radio.settings-segmented__btn[value="${ value } "]` ) ;
176176
177177 // Defer each dock update so the pane render that stamps the transcript into
@@ -267,8 +267,17 @@ describeControlUiE2e("Board split transcript restore", () => {
267267 }
268268 } , 120_000 ) ;
269269
270- it ( "closes and reopens the whole multi-tab dashboard side panel" , async ( ) => {
271- const context = await browser . newContext ( { viewport : { width : 1400 , height : 900 } } ) ;
270+ it ( "transitions between Dashboard and Split with the whole side panel" , async ( ) => {
271+ const recordProof = process . env . OPENCLAW_UI_E2E_RECORD === "1" ;
272+ if ( recordProof ) {
273+ await mkdir ( proofDir , { recursive : true } ) ;
274+ }
275+ const context = await browser . newContext ( {
276+ viewport : { width : 1400 , height : 900 } ,
277+ ...( recordProof
278+ ? { recordVideo : { dir : proofDir , size : { width : 1400 , height : 900 } } }
279+ : { } ) ,
280+ } ) ;
272281 contexts . add ( context ) ;
273282 const page = await context . newPage ( ) ;
274283 const gateway = await installMockGateway ( page , {
@@ -284,7 +293,13 @@ describeControlUiE2e("Board split transcript restore", () => {
284293 ] ,
285294 methodResponses : {
286295 "board.get" : boardSnapshot ( "right" ) ,
287- "board.update" : boardSnapshot ( "right" , 2 ) ,
296+ "board.update" : {
297+ sequence : [
298+ boardSnapshot ( "hidden" , 2 ) ,
299+ boardSnapshot ( "right" , 3 ) ,
300+ boardSnapshot ( "hidden" , 4 ) ,
301+ ] ,
302+ } ,
288303 "browser.request" : {
289304 cases : [
290305 { match : { method : "GET" , path : "/tabs" } , response : { running : false , tabs : [ ] } } ,
@@ -299,6 +314,17 @@ describeControlUiE2e("Board split transcript restore", () => {
299314
300315 const board = page . locator ( ".board-session-surface__board" ) ;
301316 const sidePanel = page . locator ( ".side-panel" ) ;
317+ const mode = ( value : "chat" | "split" | "dashboard" ) =>
318+ page . locator ( `wa-radio.settings-segmented__btn[value="${ value } "]` ) ;
319+ const activeMode = ( ) =>
320+ page . locator ( "wa-radio.settings-segmented__btn--active" ) . getAttribute ( "value" ) ;
321+ const recordStep = async ( name : string ) => {
322+ if ( ! recordProof ) {
323+ return ;
324+ }
325+ await page . screenshot ( { path : path . join ( proofDir , `${ name } .png` ) } ) ;
326+ await page . waitForTimeout ( 500 ) ;
327+ } ;
302328 await sidePanel . waitFor ( ) ;
303329 const expectedTabLabels = [ "Board chat" , "Browser" , "Terminal" ] ;
304330 await expectSidePanelTabs ( page , expectedTabLabels ) ;
@@ -310,19 +336,45 @@ describeControlUiE2e("Board split transcript restore", () => {
310336 ( element ) => element . getBoundingClientRect ( ) . width ,
311337 ) ;
312338
313- await sidePanel . getByRole ( "button" , { name : "Close" , exact : true } ) . click ( ) ;
339+ await mode ( "dashboard" ) . click ( ) ;
314340
315341 await expect . poll ( ( ) => sidePanel . count ( ) ) . toBe ( 0 ) ;
316342 await expect
317343 . poll ( ( ) => board . evaluate ( ( element ) => element . getBoundingClientRect ( ) . width ) )
318344 . toBeGreaterThan ( widthBeforeClose ) ;
319- expect ( await gateway . getRequests ( "board.update" ) ) . toEqual ( [ ] ) ;
345+ await expect . poll ( ( ) => activeMode ( ) ) . toBe ( "dashboard" ) ;
346+ expect ( await gateway . getRequests ( "board.update" ) ) . toHaveLength ( 1 ) ;
347+ await recordStep ( "transition-01-dashboard" ) ;
320348
321349 await page . getByRole ( "button" , { name : "Side panel" , exact : true } ) . click ( ) ;
322350 await sidePanel . waitFor ( ) ;
323351 await expectSidePanelTabs ( page , expectedTabLabels ) ;
324352 expect ( await sidePanel . locator ( '[data-panel-slot="chat"]' ) . count ( ) ) . toBe ( 1 ) ;
325- expect ( await gateway . getRequests ( "board.update" ) ) . toEqual ( [ ] ) ;
353+ await expect . poll ( ( ) => activeMode ( ) ) . toBe ( "split" ) ;
354+ expect ( await gateway . getRequests ( "board.update" ) ) . toHaveLength ( 2 ) ;
355+ await recordStep ( "transition-02-split-reopened" ) ;
356+
357+ await sidePanel . getByRole ( "button" , { name : "Close" , exact : true } ) . click ( ) ;
358+
359+ await expect . poll ( ( ) => sidePanel . count ( ) ) . toBe ( 0 ) ;
360+ await expect . poll ( ( ) => activeMode ( ) ) . toBe ( "dashboard" ) ;
361+ expect ( await gateway . getRequests ( "board.update" ) ) . toHaveLength ( 3 ) ;
362+ await recordStep ( "transition-03-panel-closed" ) ;
363+ await mode ( "chat" ) . click ( ) ;
364+ await expect . poll ( ( ) => activeMode ( ) ) . toBe ( "chat" ) ;
365+ await expect . poll ( ( ) => sidePanel . count ( ) ) . toBe ( 0 ) ;
366+ await recordStep ( "transition-04-chat" ) ;
367+ await mode ( "dashboard" ) . click ( ) ;
368+ await expect . poll ( ( ) => activeMode ( ) ) . toBe ( "dashboard" ) ;
369+ await expect . poll ( ( ) => sidePanel . count ( ) ) . toBe ( 0 ) ;
370+ expect ( await gateway . getRequests ( "board.update" ) ) . toHaveLength ( 3 ) ;
371+ await recordStep ( "transition-05-dashboard-final" ) ;
372+ if ( recordProof ) {
373+ const video = page . video ( ) ;
374+ await context . close ( ) ;
375+ contexts . delete ( context ) ;
376+ await video ?. saveAs ( path . join ( proofDir , "dashboard-side-panel-transition.webm" ) ) ;
377+ }
326378 } , 120_000 ) ;
327379
328380 it ( "activates Side chat from a split dashboard panel" , async ( ) => {
@@ -438,7 +490,7 @@ describeControlUiE2e("Board split transcript restore", () => {
438490 }
439491 } , 120_000 ) ;
440492
441- it ( "closes and reopens sole projected Board chat from either close control" , async ( ) => {
493+ it ( "transitions sole Board chat from either close control" , async ( ) => {
442494 const context = await browser . newContext ( { viewport : { width : 1400 , height : 900 } } ) ;
443495 contexts . add ( context ) ;
444496 const page = await context . newPage ( ) ;
@@ -447,7 +499,14 @@ describeControlUiE2e("Board split transcript restore", () => {
447499 featureMethods : [ "board.get" , "board.update" , "chat.metadata" , "chat.startup" ] ,
448500 methodResponses : {
449501 "board.get" : boardSnapshot ( "right" ) ,
450- "board.update" : boardSnapshot ( "right" , 2 ) ,
502+ "board.update" : {
503+ sequence : [
504+ boardSnapshot ( "hidden" , 2 ) ,
505+ boardSnapshot ( "right" , 3 ) ,
506+ boardSnapshot ( "hidden" , 4 ) ,
507+ boardSnapshot ( "right" , 5 ) ,
508+ ] ,
509+ } ,
451510 } ,
452511 } ) ;
453512 await showDashboard ( page ) ;
@@ -464,21 +523,22 @@ describeControlUiE2e("Board split transcript restore", () => {
464523 await expect . poll ( ( ) => sidePanel . count ( ) ) . toBe ( 0 ) ;
465524 expect ( await headerToggle . getAttribute ( "aria-expanded" ) ) . toBe ( "false" ) ;
466525 expect ( await headerToggle . getAttribute ( "aria-label" ) ) . toBe ( "Side panel" ) ;
467- expect ( await gateway . getRequests ( "board.update" ) ) . toEqual ( [ ] ) ;
526+ expect ( await gateway . getRequests ( "board.update" ) ) . toHaveLength ( 1 ) ;
468527
469528 await headerToggle . click ( ) ;
470529 await sidePanel . waitFor ( ) ;
471530 await expectSidePanelTabs ( page , [ "Board chat" ] ) ;
472531 expect ( await headerToggle . getAttribute ( "aria-expanded" ) ) . toBe ( "true" ) ;
473- expect ( await gateway . getRequests ( "board.update" ) ) . toEqual ( [ ] ) ;
532+ expect ( await gateway . getRequests ( "board.update" ) ) . toHaveLength ( 2 ) ;
474533
475534 await headerToggle . click ( ) ;
476535 await expect . poll ( ( ) => sidePanel . count ( ) ) . toBe ( 0 ) ;
477536 expect ( await headerToggle . getAttribute ( "aria-expanded" ) ) . toBe ( "false" ) ;
478- expect ( await gateway . getRequests ( "board.update" ) ) . toEqual ( [ ] ) ;
537+ expect ( await gateway . getRequests ( "board.update" ) ) . toHaveLength ( 3 ) ;
479538
480539 await headerToggle . click ( ) ;
481540 await sidePanel . waitFor ( ) ;
482541 await expectSidePanelTabs ( page , [ "Board chat" ] ) ;
542+ expect ( await gateway . getRequests ( "board.update" ) ) . toHaveLength ( 4 ) ;
483543 } , 120_000 ) ;
484544} ) ;
0 commit comments