Skip to content

Commit

Permalink
feat: Add AppointmentMedicationWording to InPerson Phone & CC
Browse files Browse the repository at this point in the history
  • Loading branch information
juancstlm-a6 committed Oct 21, 2024
1 parent 238686a commit 5845ef7
Show file tree
Hide file tree
Showing 14 changed files with 165 additions and 0 deletions.
32 changes: 32 additions & 0 deletions VAMobile/e2e/tests/AppointmentsExpanded.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
}
Expand Down
1 change: 1 addition & 0 deletions VAMobile/env/constant.env
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'

import { screen } from '@testing-library/react-native'
import { t } from 'i18next'

import {
AppointmentAttributes,
Expand Down Expand Up @@ -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()
})
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
AppointmentDateAndTime,
AppointmentDetailsModality,
AppointmentLocation,
AppointmentMedicationWording,
AppointmentPersonalContactInfo,
AppointmentProvider,
AppointmentReasonAndComment,
Expand Down Expand Up @@ -75,6 +76,7 @@ function CommunityCareAppointment({
<AppointmentLocation attributes={attributes} subType={subType} type={type} />
)}
<AppointmentReasonAndComment attributes={attributes} subType={subType} type={type} />
<AppointmentMedicationWording subType={subType} type={type} />
<AppointmentPersonalContactInfo attributes={attributes} subType={subType} />
<AppointmentCancelReschedule
appointmentID={appointmentID}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'

import { screen } from '@testing-library/react-native'
import { t } from 'i18next'

import {
AppointmentAttributes,
Expand Down Expand Up @@ -115,6 +116,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('You can cancel this appointment in the app. But if you need to reschedule, call us.'),
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
AppointmentDateAndTime,
AppointmentDetailsModality,
AppointmentLocation,
AppointmentMedicationWording,
AppointmentPersonalContactInfo,
AppointmentPreferredModality,
AppointmentProvider,
Expand Down Expand Up @@ -62,6 +63,7 @@ function InPersonVAAppointment({
<AppointmentProvider attributes={attributes} subType={subType} type={type} />
<AppointmentLocation attributes={attributes} subType={subType} type={type} />
<AppointmentReasonAndComment attributes={attributes} subType={subType} type={type} />
<AppointmentMedicationWording subType={subType} type={type} />
<AppointmentPersonalContactInfo attributes={attributes} subType={subType} />
<AppointmentCancelReschedule
appointmentID={appointmentID}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'

import { screen } from '@testing-library/react-native'
import { t } from 'i18next'

import {
AppointmentAttributes,
Expand Down Expand Up @@ -98,6 +99,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('You can cancel this appointment in the app. But if you need to reschedule, call us.'),
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
AppointmentDateAndTime,
AppointmentDetailsModality,
AppointmentLocation,
AppointmentMedicationWording,
AppointmentPersonalContactInfo,
AppointmentPreferredModality,
AppointmentProvider,
Expand Down Expand Up @@ -56,6 +57,7 @@ function PhoneAppointment({ appointmentID, attributes, subType, goBack, cancelAp
<AppointmentProvider attributes={attributes} subType={subType} type={type} />
<AppointmentLocation attributes={attributes} subType={subType} type={type} />
<AppointmentReasonAndComment attributes={attributes} subType={subType} type={type} />
<AppointmentMedicationWording subType={subType} type={type} />
<AppointmentPersonalContactInfo attributes={attributes} subType={subType} />
<AppointmentCancelReschedule
appointmentID={appointmentID}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React from 'react'
import { useTranslation } from 'react-i18next'

import { Box, LinkWithAnalytics, TextView } from 'components'
import { NAMESPACE } from 'constants/namespaces'
import {
AppointmentDetailsScreenType,
AppointmentDetailsSubType,
AppointmentDetailsSubTypeConstants,
AppointmentDetailsTypeConstants,
} from 'utils/appointments'
import getEnv from 'utils/env'
import { useRouteNavigation, useTheme } from 'utils/hooks'

type AppointmentMedicationWordingProps = {
subType: AppointmentDetailsSubType
type: AppointmentDetailsScreenType
}

const { WEBVIEW_URL_WHAT_TO_BRING_TO_APPOINTMENTS } = getEnv()

function AppointmentMedicationWording({ subType, type }: AppointmentMedicationWordingProps) {
const theme = useTheme()
const { t } = useTranslation(NAMESPACE.COMMON)
const navigateTo = useRouteNavigation()

switch (subType) {
case AppointmentDetailsSubTypeConstants.Upcoming:
case AppointmentDetailsSubTypeConstants.Canceled:
switch (type) {
case AppointmentDetailsTypeConstants.InPersonVA:
case AppointmentDetailsTypeConstants.Phone:
case AppointmentDetailsTypeConstants.CommunityCare:
case AppointmentDetailsTypeConstants.VideoVA:
const body = t('appointmentsTab.medicationWording.default.body')
return (
<Box mb={theme.dimensions.standardMarginBetween}>
<TextView variant="MobileBodyBold" accessibilityRole="header">
{t('appointmentsTab.medicationWording.title')}
</TextView>
<TextView variant="MobileBody">{body}</TextView>
<LinkWithAnalytics
type="custom"
icon={{ name: 'Launch' }}
onPress={() => {
navigateTo('Webview', {
url: WEBVIEW_URL_WHAT_TO_BRING_TO_APPOINTMENTS,
displayTitle: t('webview.vagov'),
loadingMessage: t('loading'),
})
}}
text={t('appointmentsTab.medicationWording.whatToBringLink')}
/>
</Box>
)
default:
return <></>
}
default:
return <></>
}
}

export default AppointmentMedicationWording
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'

import { screen } from '@testing-library/react-native'
import { t } from 'i18next'

import {
AppointmentAttributes,
Expand Down Expand Up @@ -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()
})
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
AppointmentDateAndTime,
AppointmentDetailsModality,
AppointmentLocation,
AppointmentMedicationWording,
AppointmentPersonalContactInfo,
AppointmentPreferredModality,
AppointmentProvider,
Expand Down Expand Up @@ -62,6 +63,7 @@ function VideoVAAppointment({
<AppointmentProvider attributes={attributes} subType={subType} type={type} />
<AppointmentLocation attributes={attributes} subType={subType} type={type} />
<AppointmentReasonAndComment attributes={attributes} subType={subType} type={type} />
<AppointmentMedicationWording subType={subType} type={type} />
<AppointmentPersonalContactInfo attributes={attributes} subType={subType} />
<AppointmentCancelReschedule
appointmentID={appointmentID}
Expand Down
3 changes: 3 additions & 0 deletions VAMobile/src/translations/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@
"appointmentsTab.past.a11yHint": "review your past appointments",
"appointmentsTab.upcoming": "Upcoming",
"appointmentsTab.upcoming.a11yHint": "review your upcoming appointments",
"appointmentsTab.medicationWording.title": "Prepare for your appointment",
"appointmentsTab.medicationWording.default.body": "Bring your insurance cards. And bring a list of your medications and other information to share with your provider.",
"appointmentsTab.medicationWording.whatToBringLink": "Find a full list of things to bring to your appointment",
"areYouSure": "Are you sure?",
"askForClaimDecision.alertBtnTitle": "Request evaluation",
"askForClaimDecision.alertTitle": "Request claim evaluation?",
Expand Down
Loading

0 comments on commit 5845ef7

Please sign in to comment.