11import path from "node:path" ;
2+ import type { Locator } from "playwright" ;
23import { expect , it } from "vitest" ;
34import {
45 waitForControlUiGatewayReady ,
@@ -23,6 +24,19 @@ import {
2324
2425const suite = createSessionManagementE2eSuite ( ) ;
2526
27+ function sessionActionPresentation ( button : Locator ) {
28+ return button . evaluate ( ( element ) => {
29+ const icon = element . querySelector ( "svg" ) ;
30+ if ( ! icon ) {
31+ throw new Error ( "expected session action icon" ) ;
32+ }
33+ return {
34+ color : getComputedStyle ( element ) . color ,
35+ fill : getComputedStyle ( icon ) . fill ,
36+ } ;
37+ } ) ;
38+ }
39+
2640suite . define ( ( ) => {
2741 it ( "expands and manages child sessions inline before opening a child chat" , async ( ) => {
2842 const baseTime = Date . parse ( "2026-07-01T16:00:00.000Z" ) ;
@@ -600,8 +614,9 @@ suite.define(() => {
600614 }
601615 } ) ;
602616
603- it ( "does not duplicate the active chat when its only session is pinned " , async ( ) => {
617+ it ( "keeps the only pinned chat unique and presents its pin state " , async ( ) => {
604618 const context = await suite . browser . newContext ( {
619+ colorScheme : "dark" ,
605620 locale : "en-US" ,
606621 serviceWorkers : "block" ,
607622 viewport : { height : 900 , width : 1280 } ,
@@ -629,6 +644,26 @@ suite.define(() => {
629644 . toEqual ( [ "Pinned only" ] ) ;
630645 await expect . poll ( ( ) => chatsGroup . locator ( ".sidebar-recent-session" ) . count ( ) ) . toBe ( 0 ) ;
631646 await expect . poll ( ( ) => page . locator ( ".sidebar-recent-session--active" ) . count ( ) ) . toBe ( 1 ) ;
647+ const pin = pinnedEntry . getByRole ( "button" , { name : "Unpin session" } ) ;
648+ const menu = pinnedEntry . getByRole ( "button" , { name : "Open session menu" } ) ;
649+ await pinnedEntry . hover ( ) ;
650+ await captureUiProof ( suite , page , "pinned-session-icon.png" ) ;
651+ const revealedPin = await sessionActionPresentation ( pin ) ;
652+ const revealedMenu = await sessionActionPresentation ( menu ) ;
653+ expect ( revealedPin . color ) . toBe ( revealedMenu . color ) ;
654+ expect ( revealedPin . fill ) . toBe ( revealedPin . color ) ;
655+
656+ await pin . hover ( ) ;
657+ await expect
658+ . poll ( async ( ) => ( await sessionActionPresentation ( pin ) ) . color )
659+ . not . toBe ( revealedPin . color ) ;
660+ await expect
661+ . poll ( async ( ) => {
662+ const hoveredPin = await sessionActionPresentation ( pin ) ;
663+ return hoveredPin . fill === hoveredPin . color ;
664+ } )
665+ . toBe ( true ) ;
666+
632667 // The empty Threads section only materializes after dragstart. Move the
633668 // real pointer first so Playwright does not wait for a hidden target.
634669 const pinnedRow = pinnedEntry . locator ( ".sidebar-recent-session" ) ;
0 commit comments