Skip to content

Commit

Permalink
CU/9656-detox-rachael-appointments-replace-by-text (#9659)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbontrager authored Sep 30, 2024
1 parent fbe11aa commit 9514ee3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
26 changes: 13 additions & 13 deletions VAMobile/e2e/tests/Appointments.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand All @@ -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 {
Expand All @@ -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()
}
})

Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -111,7 +112,8 @@ function Appointments({ navigation }: AppointmentsScreenProps) {
backLabelOnPress={navigation.goBack}
title={t('appointments')}
scrollViewProps={scrollViewProps}
testID="appointmentsTestID">
testID="appointmentsTestID"
backLabelTestID="appointmentsBackTestID">
{!apptsNotInDowntime ? (
<ErrorComponent screenID={ScreenIDTypesConstants.APPOINTMENTS_SCREEN_ID} />
) : getUserAuthorizedServicesError && !fetchingAuthServices ? (
Expand All @@ -136,6 +138,7 @@ function Appointments({ navigation }: AppointmentsScreenProps) {
onChange={onTabChange}
selected={selectedTab}
a11yHints={a11yHints}
testIDs={controlIDs}
/>
</Box>
{serviceErrorAlert()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ function PastAppointments({
pickerOptions={pickerOptions}
labelKey={'pastAppointments.selectADateRange'}
testID="getDateRangeTestID"
confirmTestID="pastApptsDateRangeConfirmID"
cancelTestID="pastApptsDateRangeCancelID"
/>
</Box>
{getGroupedAppointments(appointmentsToShow, theme, { t }, onPastAppointmentPress, true, pagination)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? (
<LoadingComponent
text={
Expand Down

0 comments on commit 9514ee3

Please sign in to comment.