@@ -51,7 +51,8 @@ test.describe('Visual Regression Tests', () => {
5151
5252 test . describe ( 'Dashboard Component' , ( ) => {
5353 test ( 'initial, empty state' , async ( ) => {
54- await takeScreenshot ( dashboardPage , 'dashboard-empty.png' , {
54+ const dashboard = dashboardPage . getByTestId ( 'dashboard' )
55+ await takeScreenshot ( dashboard , 'dashboard-empty.png' , {
5556 mask : getDynamicContentMasks ( dashboardPage ) ,
5657 maxDiffPixelRatio : 0.1 ,
5758 } )
@@ -78,10 +79,11 @@ test.describe('Visual Regression Tests', () => {
7879 // Assert timer tile height is fixed
7980 const timerCard = dashboardPage . getByTestId ( 'timer-display-container' )
8081 await assertFixedDimensions ( timerCard , {
81- maxHeight : 300 ,
82+ maxHeight : 400 ,
8283 } )
8384
84- await takeScreenshot ( dashboardPage , 'dashboard-active-timer.png' , {
85+ const dashboard = dashboardPage . getByTestId ( 'dashboard' )
86+ await takeScreenshot ( dashboard , 'dashboard-active-timer.png' , {
8587 mask : [ ...getDynamicContentMasks ( dashboardPage ) ] ,
8688 maxDiffPixelRatio : 0.1 ,
8789 } )
@@ -106,39 +108,39 @@ test.describe('Visual Regression Tests', () => {
106108 . locator ( '[data-testid="dashboard"] > div' )
107109 . first ( )
108110 await assertFixedDimensions ( topRow , {
109- maxHeight : 350 ,
111+ maxHeight : 400 ,
110112 } )
111113
112- await takeScreenshot (
113- dashboardPage ,
114- 'dashboard-active-timer-with-hr.png' ,
115- {
116- mask : [ ...getDynamicContentMasks ( dashboardPage ) ] ,
117- maxDiffPixelRatio : 0.15 , // Higher threshold for complex combined state
118- }
119- )
114+ const dashboard = dashboardPage . getByTestId ( 'dashboard' )
115+ await takeScreenshot ( dashboard , 'dashboard-active-timer-with-hr.png' , {
116+ mask : [ ...getDynamicContentMasks ( dashboardPage ) ] ,
117+ maxDiffPixelRatio : 0.15 , // Higher threshold for complex combined state
118+ } )
120119 } )
121120
122121 // NEW: Responsive breakpoint tests
123122 test ( 'mobile viewport' , async ( ) => {
124123 await dashboardPage . setViewportSize ( { width : 375 , height : 812 } )
125- await takeScreenshot ( dashboardPage , 'dashboard-mobile.png' , {
124+ const dashboard = dashboardPage . getByTestId ( 'dashboard' )
125+ await takeScreenshot ( dashboard , 'dashboard-mobile.png' , {
126126 mask : getDynamicContentMasks ( dashboardPage ) ,
127127 maxDiffPixelRatio : 0.1 ,
128128 } )
129129 } )
130130
131131 test ( 'tablet viewport' , async ( ) => {
132132 await dashboardPage . setViewportSize ( { width : 768 , height : 1024 } )
133- await takeScreenshot ( dashboardPage , 'dashboard-tablet.png' , {
133+ const dashboard = dashboardPage . getByTestId ( 'dashboard' )
134+ await takeScreenshot ( dashboard , 'dashboard-tablet.png' , {
134135 mask : getDynamicContentMasks ( dashboardPage ) ,
135136 maxDiffPixelRatio : 0.1 ,
136137 } )
137138 } )
138139
139140 test ( 'large desktop viewport' , async ( ) => {
140141 await dashboardPage . setViewportSize ( { width : 2560 , height : 1440 } )
141- await takeScreenshot ( dashboardPage , 'dashboard-large-desktop.png' , {
142+ const dashboard = dashboardPage . getByTestId ( 'dashboard' )
143+ await takeScreenshot ( dashboard , 'dashboard-large-desktop.png' , {
142144 mask : getDynamicContentMasks ( dashboardPage ) ,
143145 maxDiffPixelRatio : 0.1 ,
144146 } )
0 commit comments