11import path from "node:path" ;
22import { expect , it } from "vitest" ;
3- import type { ChatPaneElement } from "../pages/chat/route-draft-focus-handoff.ts" ;
43import {
54 waitForControlUiGatewayReady ,
65 waitForControlUiGatewayReconnecting ,
76} from "../test-helpers/control-ui-e2e-readiness.ts" ;
8- import { waitForControlUiRoute } from "../test-helpers/control-ui-e2e.ts" ;
97import { expectRequestCountStable } from "./chat-flow.test-support.ts" ;
108import {
119 actionOpacity ,
@@ -27,83 +25,6 @@ import {
2725const suite = createSessionManagementE2eSuite ( ) ;
2826
2927suite . define ( ( ) => {
30- it ( "keeps the browser-local draft pencil visible on active Home beside activity" , async ( ) => {
31- const mainKey = "agent:main:main" ;
32- const secondKey = "agent:main:draft-second" ;
33- const context = await suite . browser . newContext ( {
34- colorScheme : "dark" ,
35- locale : "en-US" ,
36- serviceWorkers : "block" ,
37- viewport : { height : 900 , width : 1280 } ,
38- } ) ;
39- const page = await context . newPage ( ) ;
40- await installMockGateway ( page , {
41- methodResponses : {
42- "sessions.list" : sessionsListResponse ( [
43- sessionRow ( mainKey , "Main" , 2 , {
44- hasActiveRun : true ,
45- startedAt : 1 ,
46- status : "running" ,
47- } ) ,
48- sessionRow ( secondKey , "Draft second" , 1 ) ,
49- ] ) ,
50- } ,
51- sessionKey : mainKey ,
52- } ) ;
53-
54- try {
55- await page . goto ( controlUiSessionUrl ( suite . server . baseUrl , mainKey ) ) ;
56- const homeRow = page . locator ( ".nav-item--home" ) ;
57- const secondRow = page . locator ( `[data-session-key="${ secondKey } "]` ) ;
58- const composer = page . locator (
59- 'openclaw-chat-pane[aria-hidden="false"] .agent-chat__composer-combobox > textarea' ,
60- ) ;
61- await homeRow . waitFor ( { state : "visible" , timeout : 10_000 } ) ;
62- await secondRow . waitFor ( { state : "visible" } ) ;
63- await composer . waitFor ( { state : "visible" } ) ;
64- await captureUiProof ( page , "draft-indicator-before.png" ) ;
65-
66- await composer . fill ( "Keep this unsent" ) ;
67- const activity = homeRow . getByRole ( "img" , { name : "Active run" } ) ;
68- const draft = homeRow . getByRole ( "img" , { name : "Unsent draft" } ) ;
69- await activity . waitFor ( ) ;
70- await draft . waitFor ( ) ;
71- const activityBox = await activity . boundingBox ( ) ;
72- const draftBox = await draft . boundingBox ( ) ;
73- if ( ! activityBox || ! draftBox ) {
74- throw new Error ( "expected activity and draft icon bounds" ) ;
75- }
76- expect ( draftBox . x ) . toBeGreaterThanOrEqual ( activityBox . x + activityBox . width ) ;
77- await captureUiProof ( page , "draft-indicator-active.png" ) ;
78-
79- await secondRow . getByRole ( "link" ) . click ( ) ;
80- await expect . poll ( ( ) => new URL ( page . url ( ) ) . pathname ) . toBe ( controlUiSessionPath ( secondKey ) ) ;
81- await draft . waitFor ( ) ;
82-
83- await homeRow . click ( ) ;
84- await waitForControlUiRoute ( page , {
85- pathname : controlUiSessionPath ( mainKey ) ,
86- routeId : "chat" ,
87- } ) ;
88- await draft . waitFor ( ) ;
89- const presentedPanes = page . locator ( 'openclaw-chat-pane[aria-hidden="false"]' ) ;
90- await expect
91- . poll ( ( ) =>
92- presentedPanes . evaluateAll ( ( panes ) =>
93- panes . map ( ( pane ) => ( pane as ChatPaneElement ) . sessionKey ) ,
94- ) ,
95- )
96- . toEqual ( [ mainKey ] ) ;
97-
98- await composer . fill ( "" ) ;
99- await secondRow . getByRole ( "link" ) . click ( ) ;
100- await expect . poll ( ( ) => new URL ( page . url ( ) ) . pathname ) . toBe ( controlUiSessionPath ( secondKey ) ) ;
101- await expect . poll ( ( ) => draft . count ( ) ) . toBe ( 0 ) ;
102- } finally {
103- await context . close ( ) ;
104- }
105- } ) ;
106-
10728 it ( "expands and manages child sessions inline before opening a child chat" , async ( ) => {
10829 const baseTime = Date . parse ( "2026-07-01T16:00:00.000Z" ) ;
10930 const parentKey = "agent:main:release-plan" ;
0 commit comments