diff --git a/VAMobile/e2e/tests/Appointments.e2e.ts b/VAMobile/e2e/tests/Appointments.e2e.ts index b682adc5825..1fac46a7d74 100644 --- a/VAMobile/e2e/tests/Appointments.e2e.ts +++ b/VAMobile/e2e/tests/Appointments.e2e.ts @@ -79,7 +79,7 @@ describe('Appointments Screen', () => { }) it('should cancel an appointment and dismiss the dialog', async () => { - await element(by.text('Appointments')).tap() + await element(by.id('apptDetailsBackID')).tap() await waitFor(element(by.text('GUARINO, ANTHONY'))) .toBeVisible() .whileElement(by.id('appointmentsTestID')) @@ -99,12 +99,12 @@ describe('Appointments Screen', () => { .scroll(200, 'down') await element(by.text('GUARINO, ANTHONY')).tap() await expect(element(by.text('Canceled request for community care'))).toExist() - await element(by.text('Appointments')).tap() + await element(by.id('apptDetailsBackID')).tap() }) it('should tap on and show past appointments', async () => { await element(by.id('appointmentsTestID')).scrollTo('top') - await element(by.text('Past')).tap() + await element(by.id('apptsPastID')).tap() if (device.getPlatform() === 'android') { await expect(element(by.text(Appointmentse2eConstants.DATE_RANGE_INITIAL_TEXT)).atIndex(0)).toExist() } else { @@ -115,12 +115,12 @@ describe('Appointments Screen', () => { it('should show the same date field after cancelling', async () => { await element(by.id('getDateRangeTestID')).tap() if (device.getPlatform() === 'android') { - await element(by.text('Past 3 months')).atIndex(0).tap() - await element(by.text('Cancel')).tap() - await expect(element(by.text('Past 3 months')).atIndex(0)).toExist() + await element(by.text(Appointmentse2eConstants.DATE_RANGE_INITIAL_TEXT)).atIndex(0).tap() + await element(by.id('pastApptsDateRangeCancelID')).tap() + await expect(element(by.text(Appointmentse2eConstants.DATE_RANGE_INITIAL_TEXT)).atIndex(0)).toExist() } else { - await element(by.text('Cancel')).tap() - await expect(element(by.text('Past 3 months'))).toExist() + await element(by.id('pastApptsDateRangeCancelID')).tap() + await expect(element(by.text(Appointmentse2eConstants.DATE_RANGE_INITIAL_TEXT))).toExist() } }) @@ -137,7 +137,7 @@ describe('Appointments Screen', () => { threeMonthsEarlier.year, ), ).tap() - await element(by.text('Done')).tap() + await element(by.id('pastApptsDateRangeConfirmID')).tap() }) it('past appts: six months - eight months earlier verification', async () => { @@ -153,7 +153,7 @@ describe('Appointments Screen', () => { sixMonthsEarlier.year, ), ).tap() - await element(by.text('Done')).tap() + await element(by.id('pastApptsDateRangeConfirmID')).tap() }) it('past appts: eleven months - nine months earlier verification', async () => { @@ -169,18 +169,18 @@ describe('Appointments Screen', () => { nineMonthsEarlier.year, ), ).tap() - await element(by.text('Done')).tap() + await element(by.id('pastApptsDateRangeConfirmID')).tap() }) it('past appts: current year verification', async () => { await element(by.id('getDateRangeTestID')).tap() await element(by.text('All of ' + currentYear)).tap() - await element(by.text('Done')).tap() + await element(by.id('pastApptsDateRangeConfirmID')).tap() }) it('past appts: previous year verification', async () => { await element(by.id('getDateRangeTestID')).tap() await element(by.text('All of ' + lastYear)).tap() - await element(by.text('Done')).tap() + await element(by.id('pastApptsDateRangeConfirmID')).tap() }) }) diff --git a/VAMobile/src/screens/HealthScreen/Appointments/Appointments.tsx b/VAMobile/src/screens/HealthScreen/Appointments/Appointments.tsx index 428e5ccc8b7..65ad4129c3d 100644 --- a/VAMobile/src/screens/HealthScreen/Appointments/Appointments.tsx +++ b/VAMobile/src/screens/HealthScreen/Appointments/Appointments.tsx @@ -34,6 +34,7 @@ function Appointments({ navigation }: AppointmentsScreenProps) { const theme = useTheme() const controlLabels = [t('appointmentsTab.upcoming'), t('appointmentsTab.past')] const a11yHints = [t('appointmentsTab.upcoming.a11yHint'), t('appointmentsTab.past.a11yHint')] + const controlIDs = ['apptsUpcomingID', 'apptsPastID'] const [selectedTab, setSelectedTab] = useState(0) const [dateRange, setDateRange] = useState(getUpcomingAppointmentDateRange()) const [timeFrame, setTimeFrame] = useState(TimeFrameTypeConstants.UPCOMING) @@ -111,7 +112,8 @@ function Appointments({ navigation }: AppointmentsScreenProps) { backLabelOnPress={navigation.goBack} title={t('appointments')} scrollViewProps={scrollViewProps} - testID="appointmentsTestID"> + testID="appointmentsTestID" + backLabelTestID="appointmentsBackTestID"> {!apptsNotInDowntime ? ( ) : getUserAuthorizedServicesError && !fetchingAuthServices ? ( @@ -136,6 +138,7 @@ function Appointments({ navigation }: AppointmentsScreenProps) { onChange={onTabChange} selected={selectedTab} a11yHints={a11yHints} + testIDs={controlIDs} /> {serviceErrorAlert()} diff --git a/VAMobile/src/screens/HealthScreen/Appointments/PastAppointments/PastAppointments.tsx b/VAMobile/src/screens/HealthScreen/Appointments/PastAppointments/PastAppointments.tsx index 7d2ea4df7b3..c3d248505fd 100644 --- a/VAMobile/src/screens/HealthScreen/Appointments/PastAppointments/PastAppointments.tsx +++ b/VAMobile/src/screens/HealthScreen/Appointments/PastAppointments/PastAppointments.tsx @@ -225,6 +225,8 @@ function PastAppointments({ pickerOptions={pickerOptions} labelKey={'pastAppointments.selectADateRange'} testID="getDateRangeTestID" + confirmTestID="pastApptsDateRangeConfirmID" + cancelTestID="pastApptsDateRangeCancelID" /> {getGroupedAppointments(appointmentsToShow, theme, { t }, onPastAppointmentPress, true, pagination)} diff --git a/VAMobile/src/screens/HealthScreen/Appointments/UpcomingAppointments/UpcomingAppointmentDetails.tsx b/VAMobile/src/screens/HealthScreen/Appointments/UpcomingAppointments/UpcomingAppointmentDetails.tsx index 193999126cc..3f3e5e7e803 100644 --- a/VAMobile/src/screens/HealthScreen/Appointments/UpcomingAppointments/UpcomingAppointmentDetails.tsx +++ b/VAMobile/src/screens/HealthScreen/Appointments/UpcomingAppointments/UpcomingAppointmentDetails.tsx @@ -108,7 +108,8 @@ function UpcomingAppointmentDetails({ route, navigation }: UpcomingAppointmentDe backLabel={t('appointments')} backLabelOnPress={navigation.goBack} title={t('details')} - testID="UpcomingApptDetailsTestID"> + testID="UpcomingApptDetailsTestID" + backLabelTestID="apptDetailsBackID"> {isLoading ? (