@@ -19,11 +19,17 @@ import { expect, test } from '../e2e/utils'
1919// set a fixed time to avoid diffs due to irrelevant time differences
2020test . beforeEach ( async ( { page } ) => {
2121 await page . clock . setFixedTime ( new Date ( '2025-10-23T12:34:56.000Z' ) )
22- // TODO: revert to default viewport once we've confirmed no visual regressions
23- // from the grid layout change. The tall viewport forces all content to render
24- // without scrolling, so fullPage screenshots are comparable between the old
25- // contained-scroll layout and the new document-scroll layout.
26- await page . setViewportSize ( { width : 1280 , height : 3100 } )
22+ // seed Math.random so mock data (e.g. metrics charts) is deterministic
23+ await page . addInitScript ( ( ) => {
24+ let seed = 0x12345678
25+ Math . random = ( ) => {
26+ seed |= 0
27+ seed = ( seed + 0x6d2b79f5 ) | 0
28+ let t = Math . imul ( seed ^ ( seed >>> 15 ) , 1 | seed )
29+ t = ( t + Math . imul ( t ^ ( t >>> 7 ) , 61 | t ) ) ^ t
30+ return ( ( t ^ ( t >>> 14 ) ) >>> 0 ) / 4294967296
31+ }
32+ } )
2733} )
2834
2935const fullPage = { fullPage : true }
@@ -53,7 +59,6 @@ const pages = [
5359 heading : 'Silo image' ,
5460 exact : true ,
5561 } ,
56- { name : 'silo utilization' , url : '/utilization' , heading : 'Utilization' } ,
5762 { name : 'silo access' , url : '/access' , heading : 'Silo Access' } ,
5863
5964 // Project - Instances
@@ -136,11 +141,6 @@ const pages = [
136141
137142 // System - Utilization
138143 { name : 'system utilization' , url : '/system/utilization' , heading : 'Utilization' } ,
139- {
140- name : 'system utilization metrics tab' ,
141- url : '/system/utilization?tab=metrics' ,
142- heading : 'Utilization' ,
143- } ,
144144
145145 // System - Networking
146146 { name : 'system ip pools' , url : '/system/networking/ip-pools' , heading : 'IP Pools' } ,
@@ -231,4 +231,29 @@ test.describe('Visual Regression', { tag: '@visual' }, () => {
231231 await page . waitForLoadState ( 'networkidle' )
232232 await expect ( page ) . toHaveScreenshot ( 'command-menu.png' , fullPage )
233233 } )
234+
235+ // Utilization pages render charts and include the refetch interval picker —
236+ // wait for the chart, then mask the refresh button so the spinner state
237+ // doesn't cause flaky diffs.
238+ test ( 'silo utilization' , async ( { page } ) => {
239+ await page . goto ( '/utilization' , { waitUntil : 'networkidle' } )
240+ await expect ( page . getByRole ( 'heading' , { name : 'Utilization' } ) ) . toBeVisible ( )
241+ await expect ( page . locator ( '.recharts-curve' ) . first ( ) ) . toBeVisible ( )
242+ await expect ( page ) . toHaveScreenshot ( 'silo-utilization.png' , {
243+ fullPage : true ,
244+ mask : [ page . getByTestId ( 'refetch-interval-refresh' ) ] ,
245+ maskColor : '#0b0e14' ,
246+ } )
247+ } )
248+
249+ test ( 'system utilization metrics tab' , async ( { page } ) => {
250+ await page . goto ( '/system/utilization?tab=metrics' , { waitUntil : 'networkidle' } )
251+ await expect ( page . getByRole ( 'heading' , { name : 'Utilization' } ) ) . toBeVisible ( )
252+ await expect ( page . locator ( '.recharts-curve' ) . first ( ) ) . toBeVisible ( )
253+ await expect ( page ) . toHaveScreenshot ( 'system-utilization-metrics-tab.png' , {
254+ fullPage : true ,
255+ mask : [ page . getByTestId ( 'refetch-interval-refresh' ) ] ,
256+ maskColor : '#0b0e14' ,
257+ } )
258+ } )
234259} )
0 commit comments