@@ -144,48 +144,33 @@ export class BookingPage {
144144 await this . bookApptBtn . click ( ) ;
145145 }
146146
147- /**
148- * Verify the given appointment time slot text is displayed in the current page
149- * @param expSlotDateStr Expected slot date string formatted as 'Friday, January 10, 2025'
150- * @param expSlotTimeStr Expected time slot time string formatted as '14:30 PM AMERICA/TORONTO'
151- */
152- async verifyRequestedSlotTextDisplayed ( expSlotDateStr : string , expSlotTimeStr : string ) {
153- const slotDateDisplayText : Locator = this . page . getByText ( expSlotDateStr ) ;
154- await expect ( slotDateDisplayText ) . toBeVisible ( { timeout : TIMEOUT_30_SECONDS } ) ;
155- const slotTimeDisplayText : Locator = this . page . getByText ( `${ expSlotTimeStr } ` ) ;
156- await expect ( slotTimeDisplayText ) . toBeVisible ( ) ;
157- const slotTimezoneDisplayText : Locator = this . page . getByText ( APPT_TIMEZONE_SETTING_PRIMARY ) ;
158- await expect ( slotTimezoneDisplayText ) . toBeVisible ( ) ;
159- }
160-
161147 /**
162148 * Utility to return a string containing the date abstracted from a given time slot string
163149 * @param timeSlotString Slot string read from DOM (ie. 'event-2025-01-14 14:30')
164- * @returns Formatted date string (ie. 'January 14, 2025 ')
150+ * @returns Formatted date string month and day only (ie. 'Jan 14')
165151 */
166152 async getDateFromSlotString ( timeSlotString : string ) : Promise < string > {
167153 const selectedSlotDateTime = new Date ( timeSlotString . substring ( 6 ) ) ;
168154
169155 const options :Intl . DateTimeFormatOptions = {
170- year : "numeric" ,
171- month : "long" ,
156+ month : "short" ,
172157 day : "numeric" ,
173158 } ;
174159
175160 return selectedSlotDateTime . toLocaleDateString ( 'default' , options ) ;
176161 }
177162
178163 /**
179- * Utility to return a string containg the time abstracted from a given time slot string.
180- * The time in the given time slot string is in 24 hour format (i.e. 14:30), but we want
181- * it to be like '02:30 PM'
164+ * Utility to return a string containing the event start time abstracted from a
165+ * given time slot string.
182166 * @param timeSlotString Slot string read from DOM (ie. 'event-2025-01-14 14:30')
183- * @returns Formatted time string (ie. '02:30 PM ')
167+ * @returns Formatted event start time string (ie. '02:30pm ')
184168 */
185- async getTimeFromSlotString ( timeSlotString : string ) : Promise < string > {
169+ async getStartTimeFromSlotString ( timeSlotString : string ) : Promise < string > {
186170 const selectedSlotDateTime = new Date ( timeSlotString . substring ( 6 ) ) ;
187- const expTimeStr = selectedSlotDateTime . toLocaleTimeString ( 'default' , { hour12 : true , hour : '2-digit' , minute : '2-digit' } ) ;
188- // now expTimeStr looks like this, for example: '04:30 p.m.' but need it to be like '04:30 PM'
189- return expTimeStr . toUpperCase ( ) . replace ( '.' , '' ) . replace ( '.' , '' ) ;
171+ var startTimeStr = selectedSlotDateTime . toLocaleTimeString ( 'default' , { hour12 : true , hour : '2-digit' , minute : '2-digit' } ) ;
172+ // now startTimeStr looks like this, for example: '04:30 p.m.' but need it to be like '04:30pm'
173+ startTimeStr = startTimeStr . replace ( ' ' , '' ) . replace ( '.' , '' ) . replace ( '.' , '' ) ;
174+ return startTimeStr
190175 }
191176}
0 commit comments