From 5845ef790d2abd795cf00104a9f015d7a473e836 Mon Sep 17 00:00:00 2001 From: Juan Castillo Date: Thu, 17 Oct 2024 08:43:37 -0700 Subject: [PATCH] feat: Add AppointmentMedicationWording to InPerson Phone & CC --- .../e2e/tests/AppointmentsExpanded.e2e.ts | 32 ++++++++++ VAMobile/env/constant.env | 1 + .../CommunityCareAppointment.test.tsx | 13 ++++ .../CommunityCareAppointment.tsx | 2 + .../InPersonVAAppointment.test.tsx | 13 ++++ .../InPersonVAAppointment.tsx | 2 + .../PhoneAppointment.test.tsx | 13 ++++ .../PhoneAppointment.tsx | 2 + .../AppointmentMedicationWording.tsx | 64 +++++++++++++++++++ .../SharedComponents/index.ts | 2 + .../VideoVAAppointment.test.tsx | 13 ++++ .../VideoVAAppointment.tsx | 2 + VAMobile/src/translations/en/common.json | 3 + VAMobile/src/utils/env.ts | 3 + 14 files changed, 165 insertions(+) create mode 100644 VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/SharedComponents/AppointmentMedicationWording.tsx diff --git a/VAMobile/e2e/tests/AppointmentsExpanded.e2e.ts b/VAMobile/e2e/tests/AppointmentsExpanded.e2e.ts index 46f53fa90cc..4c512d82c3b 100644 --- a/VAMobile/e2e/tests/AppointmentsExpanded.e2e.ts +++ b/VAMobile/e2e/tests/AppointmentsExpanded.e2e.ts @@ -6,6 +6,37 @@ export const Appointmentse2eConstants = { GET_DIRECTIONS_ID: 'directionsTestID', } +const checkMedicationWording = async ({ + appointmentType, + appointmentStatus, + pastAppointment, +}: { + appointmentType: string + appointmentStatus: string + pastAppointment: boolean +}) => { + if ( + appointmentType === 'Phone' || + appointmentType === 'CC' || + appointmentType === 'Onsite' || + appointmentType === 'VA' + ) { + if ( + appointmentStatus === 'Canceled' || + (!pastAppointment && (appointmentStatus === 'Upcoming' || appointmentStatus === 'Confirmed')) + ) { + await expect(element(by.text('Prepare for your appointment'))).toExist() + await expect(element(by.text('Find a full list of things to bring to your appointment'))).toExist() + } else { + await expect(element(by.text('Prepare for your appointment'))).not.toExist() + await expect(element(by.text('Find a full list of things to bring to your appointment'))).not.toExist() + } + } else { + await expect(element(by.text('Prepare for your appointment'))).not.toExist() + await expect(element(by.text('Find a full list of things to bring to your appointment'))).not.toExist() + } +} + const checkUpcomingApptDetails = async ( appointmentType: string, appointmentStatus: string, @@ -255,6 +286,7 @@ const checkUpcomingApptDetails = async ( await expect(element(by.id('CallTTYTestID')).atIndex(1)).toExist() } } + await checkMedicationWording({ appointmentType, appointmentStatus, pastAppointment }) await element(by.text('Appointments')).tap() } diff --git a/VAMobile/env/constant.env b/VAMobile/env/constant.env index 620e7e605de..d912e23ce81 100644 --- a/VAMobile/env/constant.env +++ b/VAMobile/env/constant.env @@ -1,6 +1,7 @@ WEBVIEW_URL_CHANGE_LEGAL_NAME=https://www.va.gov/resources/how-to-change-your-legal-name-on-file-with-va/ WEBVIEW_URL_CORONA_FAQ=https://www.va.gov/coronavirus-veteran-frequently-asked-questions WEBVIEW_URL_FACILITY_LOCATOR=https://www.va.gov/find-locations/ +WEBVIEW_URL_WHAT_TO_BRING_TO_APPOINTMENTS=https://www.va.gov/resources/what-should-i-bring-to-my-health-care-appointments/ LINK_URL_VA_NOTIFICATIONS=https://www.va.gov/profile/notifications/ LINK_URL_VA_SCHEDULING=https://www.va.gov/health-care/schedule-view-va-appointments/ LINK_URL_IN_APP_RECRUITMENT=https://docs.google.com/forms/d/e/1FAIpQLSfRb0OtW34qKm8tGoQwwwDFs8IqwOMCLTde3DeM-ukKOEZBnA/viewform diff --git a/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/CommunityCareAppointment.test.tsx b/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/CommunityCareAppointment.test.tsx index 68c4a4b6120..257491e069c 100644 --- a/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/CommunityCareAppointment.test.tsx +++ b/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/CommunityCareAppointment.test.tsx @@ -1,6 +1,7 @@ import React from 'react' import { screen } from '@testing-library/react-native' +import { t } from 'i18next' import { AppointmentAttributes, @@ -109,6 +110,9 @@ context('CommunityCareAppointment', () => { screen.getByText('Other details: Please arrive 20 minutes before the start of your appointment'), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('header', { name: 'Need to reschedule or cancel?' })).toBeTruthy() expect(screen.getByText('If you need to reschedule or cancel this appointment, call your provider.')).toBeTruthy() }) @@ -165,6 +169,9 @@ context('CommunityCareAppointment', () => { expect(screen.getByRole('header', { name: 'Need to reschedule or cancel?' })).toBeTruthy() expect(screen.getByText('If you need to reschedule or cancel this appointment, call your provider.')).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('link', { name: 'Find your VA location' })).toBeTruthy() expect(screen.getByLabelText('Find your V-A location')).toBeTruthy() expect( @@ -319,6 +326,9 @@ context('CommunityCareAppointment', () => { screen.getByText('Other details: Please arrive 20 minutes before the start of your appointment'), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('header', { name: 'Need to reschedule?' })).toBeTruthy() expect( screen.getByText( @@ -394,6 +404,9 @@ context('CommunityCareAppointment', () => { ), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('link', { name: 'Go to VA.gov to schedule' })).toBeTruthy() expect(screen.getByLabelText('Go to V-A .gov to schedule')).toBeTruthy() }) diff --git a/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/CommunityCareAppointment.tsx b/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/CommunityCareAppointment.tsx index cb4b90a3f25..c4760cf9011 100644 --- a/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/CommunityCareAppointment.tsx +++ b/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/CommunityCareAppointment.tsx @@ -17,6 +17,7 @@ import { AppointmentDateAndTime, AppointmentDetailsModality, AppointmentLocation, + AppointmentMedicationWording, AppointmentPersonalContactInfo, AppointmentProvider, AppointmentReasonAndComment, @@ -75,6 +76,7 @@ function CommunityCareAppointment({ )} + { screen.getByText('Other details: Please arrive 20 minutes before the start of your appointment'), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('header', { name: 'Need to reschedule or cancel?' })).toBeTruthy() expect( screen.getByText('You can cancel this appointment in the app. But if you need to reschedule, call us.'), @@ -176,6 +180,9 @@ context('InPersonVAAppointment', () => { screen.getByText('Other details: Please arrive 20 minutes before the start of your appointment'), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('header', { name: 'Need to reschedule or cancel?' })).toBeTruthy() expect(screen.getByText('If you need to reschedule or cancel this appointment, call us.')).toBeTruthy() @@ -348,6 +355,9 @@ context('InPersonVAAppointment', () => { screen.getByText('Other details: Please arrive 20 minutes before the start of your appointment'), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('header', { name: 'Need to reschedule?' })).toBeTruthy() expect( screen.getByText( @@ -414,6 +424,9 @@ context('InPersonVAAppointment', () => { screen.getByText('Other details: Please arrive 20 minutes before the start of your appointment'), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('header', { name: 'Need to reschedule?' })).toBeTruthy() expect( screen.getByText( diff --git a/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/InPersonVAAppointment.tsx b/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/InPersonVAAppointment.tsx index 3ce360e193a..ee356998769 100644 --- a/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/InPersonVAAppointment.tsx +++ b/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/InPersonVAAppointment.tsx @@ -13,6 +13,7 @@ import { AppointmentDateAndTime, AppointmentDetailsModality, AppointmentLocation, + AppointmentMedicationWording, AppointmentPersonalContactInfo, AppointmentPreferredModality, AppointmentProvider, @@ -62,6 +63,7 @@ function InPersonVAAppointment({ + { screen.getByText('Other details: Please arrive 20 minutes before the start of your appointment'), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('header', { name: 'Need to reschedule or cancel?' })).toBeTruthy() expect( screen.getByText('You can cancel this appointment in the app. But if you need to reschedule, call us.'), @@ -139,6 +143,9 @@ context('PhoneAppointment', () => { screen.getByText('Other details: Please arrive 20 minutes before the start of your appointment'), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('header', { name: 'Need to reschedule or cancel?' })).toBeTruthy() expect(screen.getByText('If you need to reschedule or cancel this appointment, call us.')).toBeTruthy() @@ -260,6 +267,9 @@ context('PhoneAppointment', () => { screen.getByText('Other details: Please arrive 20 minutes before the start of your appointment'), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('header', { name: 'Need to reschedule?' })).toBeTruthy() expect( screen.getByText( @@ -307,6 +317,9 @@ context('PhoneAppointment', () => { screen.getByText('Other details: Please arrive 20 minutes before the start of your appointment'), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('header', { name: 'Need to reschedule?' })).toBeTruthy() expect( screen.getByText( diff --git a/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/PhoneAppointment.tsx b/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/PhoneAppointment.tsx index aa9f94b0f84..cb3c0762f29 100644 --- a/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/PhoneAppointment.tsx +++ b/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/PhoneAppointment.tsx @@ -13,6 +13,7 @@ import { AppointmentDateAndTime, AppointmentDetailsModality, AppointmentLocation, + AppointmentMedicationWording, AppointmentPersonalContactInfo, AppointmentPreferredModality, AppointmentProvider, @@ -56,6 +57,7 @@ function PhoneAppointment({ appointmentID, attributes, subType, goBack, cancelAp + + + {t('appointmentsTab.medicationWording.title')} + + {body} + { + navigateTo('Webview', { + url: WEBVIEW_URL_WHAT_TO_BRING_TO_APPOINTMENTS, + displayTitle: t('webview.vagov'), + loadingMessage: t('loading'), + }) + }} + text={t('appointmentsTab.medicationWording.whatToBringLink')} + /> + + ) + default: + return <> + } + default: + return <> + } +} + +export default AppointmentMedicationWording diff --git a/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/SharedComponents/index.ts b/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/SharedComponents/index.ts index e093d40ee65..afab848232c 100644 --- a/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/SharedComponents/index.ts +++ b/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/SharedComponents/index.ts @@ -10,6 +10,8 @@ export { default as AppointmentDetailsModality } from './AppointmentDetailsModal export * from './AppointmentDetailsModality' export { default as AppointmentJoinSessionPrepareForVideo } from './AppointmentJoinSessionPrepareForVideo' export * from './AppointmentJoinSessionPrepareForVideo' +export { default as AppointmentMedicationWording } from './AppointmentMedicationWording' +export * from './AppointmentMedicationWording' export { default as AppointmentLocation } from './AppointmentLocation' export * from './AppointmentLocation' export { default as AppointmentPersonalContactInfo } from './AppointmentPersonalContactInfo' diff --git a/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/VideoVAAppointment.test.tsx b/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/VideoVAAppointment.test.tsx index be7d8f4f967..c4628597f76 100644 --- a/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/VideoVAAppointment.test.tsx +++ b/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/VideoVAAppointment.test.tsx @@ -1,6 +1,7 @@ import React from 'react' import { screen } from '@testing-library/react-native' +import { t } from 'i18next' import { AppointmentAttributes, @@ -116,6 +117,9 @@ context('VideoVAAppointment', () => { screen.getByText('Other details: Please arrive 20 minutes before the start of your appointment'), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('header', { name: 'Need to reschedule or cancel?' })).toBeTruthy() expect(screen.getByText('If you need to reschedule or cancel this appointment, call us.')).toBeTruthy() }) @@ -173,6 +177,9 @@ context('VideoVAAppointment', () => { screen.getByText('Other details: Please arrive 20 minutes before the start of your appointment'), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('header', { name: 'Need to reschedule or cancel?' })).toBeTruthy() expect(screen.getByText('If you need to reschedule or cancel this appointment, call us.')).toBeTruthy() @@ -345,6 +352,9 @@ context('VideoVAAppointment', () => { screen.getByText('Other details: Please arrive 20 minutes before the start of your appointment'), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('header', { name: 'Need to reschedule?' })).toBeTruthy() expect( screen.getByText( @@ -411,6 +421,9 @@ context('VideoVAAppointment', () => { screen.getByText('Other details: Please arrive 20 minutes before the start of your appointment'), ).toBeTruthy() + expect(screen.getByRole('header', { name: t('appointmentsTab.medicationWording.title') })).toBeTruthy() + expect(screen.getByRole('link', { name: t('appointmentsTab.medicationWording.whatToBringLink') })).toBeTruthy() + expect(screen.getByRole('header', { name: 'Need to reschedule?' })).toBeTruthy() expect( screen.getByText( diff --git a/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/VideoVAAppointment.tsx b/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/VideoVAAppointment.tsx index 270249de655..6bca9e3300f 100644 --- a/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/VideoVAAppointment.tsx +++ b/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/VideoVAAppointment.tsx @@ -13,6 +13,7 @@ import { AppointmentDateAndTime, AppointmentDetailsModality, AppointmentLocation, + AppointmentMedicationWording, AppointmentPersonalContactInfo, AppointmentPreferredModality, AppointmentProvider, @@ -62,6 +63,7 @@ function VideoVAAppointment({ + ({ WEBVIEW_URL_CORONA_FAQ, WEBVIEW_URL_FACILITY_LOCATOR, WEBVIEW_URL_CHANGE_LEGAL_NAME, + WEBVIEW_URL_WHAT_TO_BRING_TO_APPOINTMENTS, })