@@ -128,6 +128,49 @@ test('dark mode keeps rendering dark on report pages after navigation', async ({
128128 expect ( await page . evaluate ( ( ) => localStorage . getItem ( 'rf-theme' ) ) ) . toBe ( 'dark' ) ;
129129} ) ;
130130
131+ test ( 'non-red graph edges re-tint to the dark palette, cycle edges stay red' , async ( { page } ) => {
132+ test . skip ( test . info ( ) . project . name !== 'chromium' , 'wasm-heavy check runs once' ) ;
133+ // Mock GitHub raw content so the report page never hits the network.
134+ await page . route ( '**/raw.githubusercontent.com/**' , route => {
135+ if ( route . request ( ) . url ( ) . endsWith ( 'refactor-first.json' ) ) {
136+ route . fulfill ( { status : 200 , contentType : 'application/json' , body : SAMPLE_REPORT } ) ;
137+ } else {
138+ route . continue ( ) ;
139+ }
140+ } ) ;
141+ await page . goto ( '/refactorfirst/refactorfirst/master/' ) ;
142+ // vizdom parses/lays out the graph asynchronously via WASM.
143+ await page . waitForSelector ( '#classGraph svg path[stroke="black"]' , { timeout : 120000 } ) ;
144+ await page . waitForSelector ( '#classGraph svg polygon[fill="black"]' ) ;
145+ await page . waitForSelector ( '#classGraph svg path[stroke="red"]' ) ;
146+
147+ const strokeOf = selector => page . evaluate (
148+ sel => getComputedStyle ( document . querySelector ( sel ) ) . stroke , selector ) ;
149+ const fillOf = selector => page . evaluate (
150+ sel => getComputedStyle ( document . querySelector ( sel ) ) . fill , selector ) ;
151+ const REGULAR_EDGE = '#classGraph svg path[stroke="black"]' ;
152+ const REGULAR_ARROW = '#classGraph svg polygon[fill="black"]' ;
153+ const CYCLE_EDGE = '#classGraph svg path[stroke="red"]' ;
154+ const CYCLE_ARROW = '#classGraph svg polygon[fill="red"]' ;
155+
156+ // Light theme: edges keep the baked-in black.
157+ expect ( await strokeOf ( REGULAR_EDGE ) ) . toBe ( 'rgb(0, 0, 0)' ) ;
158+
159+ await page . locator ( '#rf-theme-dark' ) . check ( ) ;
160+ // Dark theme: non-red edges/arrowheads use #9fb0c0 (dark --muted-color,
161+ // the Chart.js legend text color)…
162+ expect ( await strokeOf ( REGULAR_EDGE ) ) . toBe ( 'rgb(159, 176, 192)' ) ;
163+ expect ( await strokeOf ( REGULAR_ARROW ) ) . toBe ( 'rgb(159, 176, 192)' ) ;
164+ expect ( await fillOf ( REGULAR_ARROW ) ) . toBe ( 'rgb(159, 176, 192)' ) ;
165+ // …while red (cycle) edges and arrowheads stay red.
166+ expect ( await strokeOf ( CYCLE_EDGE ) ) . toBe ( 'rgb(255, 0, 0)' ) ;
167+ expect ( await fillOf ( CYCLE_ARROW ) ) . toBe ( 'rgb(255, 0, 0)' ) ;
168+
169+ // Switching back to light restores black without a reload (pure CSS).
170+ await page . locator ( '#rf-theme-light' ) . check ( ) ;
171+ expect ( await strokeOf ( REGULAR_EDGE ) ) . toBe ( 'rgb(0, 0, 0)' ) ;
172+ } ) ;
173+
131174test ( 'breadcrumbs and the toggle share one vertically centered row on report pages' , async ( { page } ) => {
132175 test . skip ( test . info ( ) . project . name !== 'chromium' , 'geometry check runs once' ) ;
133176 // Mock GitHub raw content so the report page never hits the network.
0 commit comments