@@ -28,6 +28,7 @@ const completedPlan = {
2828 priority : 'A' ,
2929 reviewStatus : 'UNREVIEWED' ,
3030 description : { goal : 'Keep every input path consistent.' } ,
31+ measurement : { weeklyRemainingCurrent : 63 } ,
3132 children : [ ] ,
3233 } ,
3334 ] ,
@@ -37,15 +38,24 @@ const completedPlan = {
3738 currentStepId : 'finish' ,
3839} ;
3940
40- const activePlan = { ...completedPlan , allDone : false , doneSteps : 0 } ;
41+ const activePlan = {
42+ ...completedPlan ,
43+ allDone : false ,
44+ doneSteps : 0 ,
45+ } ;
4146
4247async function routeSessionHistory ( page : Page , id : string ) : Promise < void > {
4348 await page . route ( `**/api/sessions/${ id } /history` , ( route ) =>
44- route . fulfill ( { contentType : 'application/json' , body : JSON . stringify ( { items : [ ] , currentSequence : 0 } ) } ) ,
49+ route . fulfill ( {
50+ contentType : 'application/json' ,
51+ body : JSON . stringify ( { items : [ ] , currentSequence : 0 } ) ,
52+ } ) ,
4553 ) ;
4654}
4755
48- test ( 'keeps the completed Plan tab reachable and overflow-free at 320px with 200% root font' , async ( { page } ) => {
56+ test ( 'keeps the completed Plan tab reachable and overflow-free at 320px with 200% root font' , async ( {
57+ page,
58+ } ) => {
4959 const selected = session ( 'session-1' , '/projects/one' ) ;
5060 let closed = false ;
5161 await page . setViewportSize ( { width : 320 , height : 568 } ) ;
@@ -66,12 +76,18 @@ test('keeps the completed Plan tab reachable and overflow-free at 320px with 200
6676 await page . route ( '**/api/sessions/recent-threads' , ( route ) =>
6777 route . fulfill ( { contentType : 'application/json' , body : '[]' } ) ,
6878 ) ;
69- await page . routeWebSocket ( / w s : \/ \/ 1 2 7 \. 0 \. 0 \. 1 : 4 1 7 3 \/ a p i \/ s e s s i o n s \/ s e s s i o n - 1 \/ e v e n t s \? a f t e r = \d + / , ( ) => { } ) ;
79+ await page . routeWebSocket (
80+ / w s : \/ \/ 1 2 7 \. 0 \. 0 \. 1 : 4 1 7 3 \/ a p i \/ s e s s i o n s \/ s e s s i o n - 1 \/ e v e n t s \? a f t e r = \d + / ,
81+ ( ) => { } ,
82+ ) ;
7083
7184 await page . goto ( '/' ) ;
7285 await page . addStyleTag ( { content : 'html { font-size: 200% !important; }' } ) ;
7386
7487 const navigation = page . getByLabel ( 'Primary' ) ;
88+ const weeklyQuota = page . getByLabel ( 'Weekly quota remaining' ) ;
89+ await expect ( weeklyQuota ) . toHaveText ( '63% left' ) ;
90+ await expect ( weeklyQuota . locator ( '+ .menu-trigger' ) ) . toHaveCount ( 1 ) ;
7591 await expect ( navigation . getByRole ( 'button' ) ) . toHaveText ( [ 'Sessions' , 'Git' , 'Chat' , 'Plan' ] ) ;
7692 const horizontalLayout = await page . evaluate ( ( ) => ( {
7793 clientWidth : document . documentElement . clientWidth ,
@@ -96,6 +112,10 @@ test('keeps the completed Plan tab reachable and overflow-free at 320px with 200
96112
97113 const chat = navigation . getByRole ( 'button' , { name : 'Chat' } ) ;
98114 const plan = navigation . getByRole ( 'button' , { name : 'Plan' } ) ;
115+ for ( const tab of [ 'Sessions' , 'Git' , 'Chat' , 'Plan' ] ) {
116+ await navigation . getByRole ( 'button' , { name : tab } ) . click ( ) ;
117+ await expect ( weeklyQuota ) . toHaveText ( '63% left' ) ;
118+ }
99119 await chat . click ( ) ;
100120 const prompt = page . getByRole ( 'textbox' , { name : 'Prompt' } ) ;
101121 await prompt . fill ( 'Keep this chat draft' ) ;
@@ -121,8 +141,18 @@ test('keeps the completed Plan tab reachable and overflow-free at 320px with 200
121141
122142 await chat . click ( ) ;
123143 const main = page . locator ( 'main' ) ;
124- await main . dispatchEvent ( 'pointerdown' , { pointerType : 'touch' , pointerId : 4 , clientX : 240 , clientY : 240 } ) ;
125- await main . dispatchEvent ( 'pointerup' , { pointerType : 'touch' , pointerId : 4 , clientX : 100 , clientY : 242 } ) ;
144+ await main . dispatchEvent ( 'pointerdown' , {
145+ pointerType : 'touch' ,
146+ pointerId : 4 ,
147+ clientX : 240 ,
148+ clientY : 240 ,
149+ } ) ;
150+ await main . dispatchEvent ( 'pointerup' , {
151+ pointerType : 'touch' ,
152+ pointerId : 4 ,
153+ clientX : 100 ,
154+ clientY : 242 ,
155+ } ) ;
126156 await expect ( plan ) . toHaveAttribute ( 'aria-pressed' , 'true' ) ;
127157
128158 await page . getByRole ( 'button' , { name : 'Close completed plan' } ) . click ( ) ;
@@ -132,7 +162,9 @@ test('keeps the completed Plan tab reachable and overflow-free at 320px with 200
132162 await expect ( plan ) . toHaveCount ( 0 ) ;
133163} ) ;
134164
135- test ( 'adds and removes Plan from live events without stealing focus, then isolates a session without a plan' , async ( { page } ) => {
165+ test ( 'adds and removes Plan from live events without stealing focus, then isolates a session without a plan' , async ( {
166+ page,
167+ } ) => {
136168 const first = session ( 'session-1' , '/projects/one' ) ;
137169 const second = session ( 'session-2' , '/projects/two' ) ;
138170 let emitPlanEvent : ( ( event : object ) => void ) | undefined ;
@@ -154,7 +186,10 @@ test('adds and removes Plan from live events without stealing focus, then isolat
154186 emitPlanEvent = ( event ) => socket . send ( JSON . stringify ( { type : 'relay.event' , event } ) ) ;
155187 } ,
156188 ) ;
157- await page . routeWebSocket ( / w s : \/ \/ 1 2 7 \. 0 \. 0 \. 1 : 4 1 7 3 \/ a p i \/ s e s s i o n s \/ s e s s i o n - 2 \/ e v e n t s \? a f t e r = \d + / , ( ) => { } ) ;
189+ await page . routeWebSocket (
190+ / w s : \/ \/ 1 2 7 \. 0 \. 0 \. 1 : 4 1 7 3 \/ a p i \/ s e s s i o n s \/ s e s s i o n - 2 \/ e v e n t s \? a f t e r = \d + / ,
191+ ( ) => { } ,
192+ ) ;
158193
159194 await page . goto ( '/' ) ;
160195 const navigation = page . getByLabel ( 'Primary' ) ;
0 commit comments