@@ -152,7 +152,10 @@ test('Messagelist should scrolled to the latest messages after being rendered in
152152 } ) ;
153153} ) ;
154154
155- test ( 'Messagelist with date headers' , async ( t ) => {
155+ test . clientScripts ( [
156+ { module : 'mockdate' } ,
157+ { content : 'window.MockDate = MockDate;' } ,
158+ ] ) ( 'Messagelist with date headers' , async ( t ) => {
156159 const { takeScreenshot, compareResults } = createScreenshotsComparer ( t ) ;
157160
158161 await testScreenshot ( t , takeScreenshot , 'Messagelist with date headers.png' , { element : '#container' } ) ;
@@ -161,10 +164,14 @@ test('Messagelist with date headers', async (t) => {
161164 . expect ( compareResults . isValid ( ) )
162165 . ok ( compareResults . errorMessages ( ) ) ;
163166} ) . before ( async ( ) => {
167+ await ClientFunction ( ( ) => {
168+ ( window as any ) . MockDate . set ( '2024/10/27' ) ;
169+ } ) ( ) ;
170+
164171 const userFirst = createUser ( 1 , 'First' ) ;
165172 const userSecond = createUser ( 2 , 'Second' ) ;
166173 const msInDay = 86400000 ;
167- const today = new Date ( ) . setHours ( 7 , 22 , 0 , 0 ) ;
174+ const today = new Date ( '2024/10/27' ) . setHours ( 7 , 22 , 0 , 0 ) ;
168175 const yesterday = today - msInDay ;
169176
170177 const items = [ {
@@ -195,6 +202,10 @@ test('Messagelist with date headers', async (t) => {
195202 width : 400 ,
196203 height : 600 ,
197204 } ) ;
205+ } ) . after ( async ( ) => {
206+ await ClientFunction ( ( ) => {
207+ ( window as any ) . MockDate . reset ( ) ;
208+ } ) ( ) ;
198209} ) ;
199210
200211test ( 'Messagelist with messageTemplate' , async ( t ) => {
0 commit comments