@@ -11,9 +11,13 @@ test.describe("006-edit-ride-history e2e", () => {
1111 const userName = uniqueUser ( "e2e-edit-history" ) ;
1212 await createAndLoginUser ( page , userName , "87654321" ) ;
1313
14- // Record a ride
14+ // Record a ride on a date that is always within the current month so the
15+ // "This Month" mileage summary card reflects the seeded ride.
16+ const now = new Date ( ) ;
17+ const rideDateTimeLocal = `${ now . getFullYear ( ) } -${ String ( now . getMonth ( ) + 1 ) . padStart ( 2 , "0" ) } -01T10:30` ;
18+
1519 await recordRide ( page , {
16- rideDateTimeLocal : "2026-03-20T10:30" ,
20+ rideDateTimeLocal,
1721 miles : "5.0" ,
1822 rideMinutes : "30" ,
1923 temperature : "70" ,
@@ -123,12 +127,19 @@ test.describe("006-edit-ride-history e2e", () => {
123127 test ( "shows summary cards with historical totals and active filter" , async ( {
124128 page,
125129 } ) => {
126- // Apply a date filter (from starting date to end of month)
130+ // Apply a date filter spanning the current month so the seeded ride is visible.
131+ const now = new Date ( ) ;
132+ const year = now . getFullYear ( ) ;
133+ const month = String ( now . getMonth ( ) + 1 ) . padStart ( 2 , "0" ) ;
134+ const lastDay = new Date ( year , now . getMonth ( ) + 1 , 0 ) . getDate ( ) ;
135+ const fromDate = `${ year } -${ month } -01` ;
136+ const toDate = `${ year } -${ month } -${ String ( lastDay ) . padStart ( 2 , "0" ) } ` ;
137+
127138 const fromInput = page . getByLabel ( / ^ F r o m $ / i) ;
128139 const toInput = page . getByLabel ( / ^ T o $ / i) ;
129140
130- await fromInput . fill ( "2026-03-15" ) ;
131- await toInput . fill ( "2026-03-31" ) ;
141+ await fromInput . fill ( fromDate ) ;
142+ await toInput . fill ( toDate ) ;
132143 await page . getByRole ( "button" , { name : / a p p l y f i l t e r / i } ) . click ( ) ;
133144
134145 // Summary cards and visible total should be visible
0 commit comments