@@ -64,19 +64,31 @@ test.describe('Participants Search', () => {
6464 await searchPanel . dates ( MainInfoEnum . REGISTRATION_DATE , { additionalFilters : [ AdditionalFilter . RANGE ] , from : yearAgo , to : today } ) ;
6565 await searchPanel . search ( ) ;
6666
67+ const rowsCount = await participantsTable . getRowsCount ( ) ;
6768 const numParticipants2 = await participantsTable . numOfParticipants ( ) ;
6869 logInfo ( `Search by Registration Date Range (from: ${ yearAgo } , to: ${ today } ) returns ${ numParticipants2 } participants` ) ;
6970 expect ( numParticipants2 ) . toBeGreaterThan ( 1 ) ;
7071 expect ( numParticipants2 ) . not . toBe ( numParticipants1 ) ; // Expect Participants list table has reloaded and changed
7172
72- // Use Registration Date column filter to verify date range in table
73+ // Sort Registration Date column filter to verify date range in table
7374 await participantsTable . sort ( MainInfoEnum . REGISTRATION_DATE , SortOrder . DESC ) ;
74- const date1 = await participantsTable . cell ( 0 , headerIndex ) . innerText ( ) ;
75-
75+ const descFirstRowDate = await participantsTable . cell ( 0 , headerIndex ) . innerText ( ) ;
76+ const descLastRowDate = await participantsTable . cell ( rowsCount - 1 , headerIndex ) . innerText ( ) ;
77+ // ascending
78+ expect ( new Date ( descFirstRowDate ) < new Date ( descLastRowDate ) ,
79+ `descFirstRowDate: ${ descFirstRowDate } , descLastRowDate: ${ descLastRowDate } ` )
80+ . toBeTruthy ( ) ;
81+
82+ // Sort in opposite order
7683 await participantsTable . sort ( MainInfoEnum . REGISTRATION_DATE , SortOrder . ASC ) ;
77- const date2 = await participantsTable . cell ( 0 , headerIndex ) . innerText ( ) ;
78-
79- expect ( getDate ( new Date ( date1 ) ) ) . not . toEqual ( date2 ) ;
84+ const ascFirstRowDate = await participantsTable . cell ( 0 , headerIndex ) . innerText ( ) ;
85+ const ascLastRowDate = await participantsTable . cell ( rowsCount - 1 , headerIndex ) . innerText ( ) ;
86+ // descending
87+ expect ( new Date ( ascFirstRowDate ) > new Date ( ascLastRowDate ) ,
88+ `ascFirstRowDate: ${ ascFirstRowDate } , ascLastRowDate: ${ ascLastRowDate } ` )
89+ . toBeTruthy ( ) ;
90+
91+ expect ( getDate ( new Date ( descFirstRowDate ) ) ) . not . toEqual ( ascFirstRowDate ) ;
8092 } ) ;
8193 }
8294} ) ;
0 commit comments