@@ -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 ( ) => {
@@ -390,7 +442,55 @@ describeControlUiE2e("Board split transcript restore", () => {
390442 }
391443 } , 120_000 ) ;
392444
393- it ( "closes and reopens sole projected Board chat from either close control" , async ( ) => {
445+ it ( "does not offer Discussion when the gateway has no discussion provider" , async ( ) => {
446+ const recordProof = process . env . OPENCLAW_UI_E2E_RECORD === "1" ;
447+ if ( recordProof ) {
448+ await mkdir ( proofDir , { recursive : true } ) ;
449+ }
450+ const context = await browser . newContext ( {
451+ viewport : { width : 1400 , height : 900 } ,
452+ ...( recordProof
453+ ? { recordVideo : { dir : proofDir , size : { width : 1400 , height : 900 } } }
454+ : { } ) ,
455+ } ) ;
456+ contexts . add ( context ) ;
457+ const page = await context . newPage ( ) ;
458+ const gateway = await installMockGateway ( page , {
459+ sessionKey,
460+ featureMethods : [ "board.get" , "chat.metadata" , "chat.startup" , "session.discussion.info" ] ,
461+ methodResponses : {
462+ "board.get" : boardSnapshot ( "right" ) ,
463+ "session.discussion.info" : { state : "none" } ,
464+ } ,
465+ } ) ;
466+
467+ try {
468+ await showDashboard ( page ) ;
469+ const sidePanel = page . locator ( ".side-panel" ) ;
470+ await sidePanel . waitFor ( ) ;
471+ await expect
472+ . poll ( ( ) =>
473+ gateway . getRequests ( "session.discussion.info" ) . then ( ( requests ) => requests . length ) ,
474+ )
475+ . toBe ( 1 ) ;
476+ await sidePanel . getByRole ( "button" , { name : "Add side panel tab" } ) . click ( ) ;
477+ await expect
478+ . poll ( ( ) => sidePanel . locator ( "wa-dropdown-item" ) . filter ( { hasText : "Discussion" } ) . count ( ) )
479+ . toBe ( 0 ) ;
480+ if ( recordProof ) {
481+ await page . screenshot ( { path : path . join ( proofDir , "03-discussion-hidden.png" ) } ) ;
482+ }
483+ } finally {
484+ const video = page . video ( ) ;
485+ await context . close ( ) ;
486+ contexts . delete ( context ) ;
487+ if ( recordProof && video ) {
488+ await video . saveAs ( path . join ( proofDir , "dashboard-discussion-unavailable.webm" ) ) ;
489+ }
490+ }
491+ } , 120_000 ) ;
492+
493+ it ( "transitions sole Board chat from either close control" , async ( ) => {
394494 const context = await browser . newContext ( { viewport : { width : 1400 , height : 900 } } ) ;
395495 contexts . add ( context ) ;
396496 const page = await context . newPage ( ) ;
@@ -399,7 +499,14 @@ describeControlUiE2e("Board split transcript restore", () => {
399499 featureMethods : [ "board.get" , "board.update" , "chat.metadata" , "chat.startup" ] ,
400500 methodResponses : {
401501 "board.get" : boardSnapshot ( "right" ) ,
402- "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+ } ,
403510 } ,
404511 } ) ;
405512 await showDashboard ( page ) ;
@@ -416,21 +523,22 @@ describeControlUiE2e("Board split transcript restore", () => {
416523 await expect . poll ( ( ) => sidePanel . count ( ) ) . toBe ( 0 ) ;
417524 expect ( await headerToggle . getAttribute ( "aria-expanded" ) ) . toBe ( "false" ) ;
418525 expect ( await headerToggle . getAttribute ( "aria-label" ) ) . toBe ( "Side panel" ) ;
419- expect ( await gateway . getRequests ( "board.update" ) ) . toEqual ( [ ] ) ;
526+ expect ( await gateway . getRequests ( "board.update" ) ) . toHaveLength ( 1 ) ;
420527
421528 await headerToggle . click ( ) ;
422529 await sidePanel . waitFor ( ) ;
423530 await expectSidePanelTabs ( page , [ "Board chat" ] ) ;
424531 expect ( await headerToggle . getAttribute ( "aria-expanded" ) ) . toBe ( "true" ) ;
425- expect ( await gateway . getRequests ( "board.update" ) ) . toEqual ( [ ] ) ;
532+ expect ( await gateway . getRequests ( "board.update" ) ) . toHaveLength ( 2 ) ;
426533
427534 await headerToggle . click ( ) ;
428535 await expect . poll ( ( ) => sidePanel . count ( ) ) . toBe ( 0 ) ;
429536 expect ( await headerToggle . getAttribute ( "aria-expanded" ) ) . toBe ( "false" ) ;
430- expect ( await gateway . getRequests ( "board.update" ) ) . toEqual ( [ ] ) ;
537+ expect ( await gateway . getRequests ( "board.update" ) ) . toHaveLength ( 3 ) ;
431538
432539 await headerToggle . click ( ) ;
433540 await sidePanel . waitFor ( ) ;
434541 await expectSidePanelTabs ( page , [ "Board chat" ] ) ;
542+ expect ( await gateway . getRequests ( "board.update" ) ) . toHaveLength ( 4 ) ;
435543 } , 120_000 ) ;
436544} ) ;
0 commit comments