Skip to content

Commit

Permalink
CU/9786-rachael-detox-messages-replace-by-text (#9787)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbontrager authored Oct 9, 2024
1 parent 04848cf commit 75d39ee
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 74 deletions.
123 changes: 53 additions & 70 deletions VAMobile/e2e/tests/Messages.e2e.ts

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions VAMobile/e2e/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export const CommonE2eIdConstants = {
GO_TO_VA_GOV_LINK_ID: 'goToVAGovID',
CLAIMS_HISTORY_SCROLL_ID: 'claimsHistoryID',
NEXT_PAGE_ID: 'next-page',
VETERANS_CRISIS_LINE_CALL_ID: 'veteransCrisisLineCallID',
VETERANS_CRISIS_LINE_TTY_ID: 'veteransCrisisLineHearingLossNumberTestID',
VETERANS_CRISIS_LINE_TEXT_ID: 'veteransCrisisLineTextNumberTestID',
VETERANS_CRISIS_LINE_CHAT_ID: 'veteransCrisisLineConfidentialChatTestID',
PREVIOUS_PAGE_ID: 'previous-page',
}

Expand Down
1 change: 1 addition & 0 deletions VAMobile/src/components/CrisisLineButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const CrisisLineButton: FC = () => {
borderRadius: 40,
},
],
testID: 'veteransCrisisLineID',
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,21 @@ export type FormAttachmentsProps = {
buttonLabel?: string
/**button onPress */
buttonPress?: () => void
/** optional TestID */
testID?: string
/** list of current attachments */
attachmentsList?: Array<ImagePickerResponse | DocumentPickerResponse>
}

/** A common component for form attachments, displays Attachments heading with helper link,
* already attached items with remove option, and an optional large button. */
const FormAttachments: FC<FormAttachmentsProps> = ({ removeOnPress, buttonLabel, buttonPress, attachmentsList }) => {
const FormAttachments: FC<FormAttachmentsProps> = ({
removeOnPress,
buttonLabel,
buttonPress,
testID,
attachmentsList,
}) => {
const theme = useTheme()
const { t } = useTranslation(NAMESPACE.COMMON)
const { t: tFunction } = useTranslation()
Expand Down Expand Up @@ -58,6 +66,7 @@ const FormAttachments: FC<FormAttachmentsProps> = ({ removeOnPress, buttonLabel,
label={t('remove')}
a11yHint={t('remove.a11yHint', { content: fileName })}
buttonType={ButtonVariants.Destructive}
testID={testID}
/>
</Box>
)
Expand All @@ -80,6 +89,7 @@ const FormAttachments: FC<FormAttachmentsProps> = ({ removeOnPress, buttonLabel,
onPress={buttonPress}
buttonType={ButtonVariants.Secondary}
a11yLabel={buttonLabel}
testID={testID}
/>
)}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export const ChildTemplate: FC<ChildTemplateProps> = ({
a11yLabel: headerButton.labelA11y,
onPress: headerButton.onPress,
icon: headerButton.icon,
testID: headerButton.testID,
}
: undefined,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ function EditDraft({ navigation, route }: EditDraftProps) {
: undefined,
buttonPress: attachmentsList.length < theme.dimensions.maxNumMessageAttachments ? onAddFiles : undefined,
attachmentsList,
testID: 'messagesAttachmentsAddFilesID',
},
},
{
Expand Down Expand Up @@ -666,7 +667,8 @@ function EditDraft({ navigation, route }: EditDraftProps) {
menuViewActions={isLoading ? undefined : menuViewActions}
showCrisisLineButton={!(isLoading || hasError)}
leftButtonTestID="editDraftCancelTestID"
testID="editDraftTestID">
testID="editDraftTestID"
rightButtonTestID="editDraftMoreID">
{isLoading ? (
<LoadingComponent text={loadingText} />
) : hasError ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ function FolderMessages({ route }: FolderMessagesProps) {
navigateTo('SecureMessaging', { activeTab: 1 })
}}
title={title}
scrollViewProps={scrollViewProps}>
scrollViewProps={scrollViewProps}
backLabelTestID="foldersBackToMessagesID">
{loadingFolderMessages ? (
<LoadingComponent text={t('secureMessaging.messages.loading')} />
) : folderMessagesError ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ function ReplyMessage({ navigation, route }: ReplyMessageProps) {
: undefined,
buttonPress: attachmentsList.length < theme.dimensions.maxNumMessageAttachments ? onAddFiles : undefined,
attachmentsList,
testID: 'messagesAttachmentsAddFilesID',
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ function SecureMessaging({ navigation, route }: SecureMessagingScreen) {
const inboxLabelCount = inboxUnreadCount !== 0 ? `(${inboxUnreadCount})` : ''
const inboxLabel = `${t('secureMessaging.inbox')} ${inboxLabelCount}`.trim()
const controlLabels = [inboxLabel, t('secureMessaging.folders')]
const controlIDs = ['inboxID', 'foldersID']
const [scrollPage, setScrollPage] = useState(1)

// Resets scroll position to top whenever current page appointment list changes:
Expand Down Expand Up @@ -175,6 +176,7 @@ function SecureMessaging({ navigation, route }: SecureMessagingScreen) {
selected={secureMessagingTab}
a11yHints={a11yHints}
a11yLabels={[t('secureMessaging.inbox')]}
testIDs={controlIDs}
/>
</Box>
<CernerAlertSM />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,12 @@ function Attachments({ navigation, route }: AttachmentsProps) {
scrollViewRef={scrollViewRef}
title={t('secureMessaging.startNewMessage.attachments.title')}
leftButtonText={t('cancel')}
leftButtonTestID="attachmentsCancelID"
onLeftButtonPress={navigation.goBack}
primaryContentButtonText={
displaySelectFile ? t('secureMessaging.attachments.selectAFile') : t('secureMessaging.startNewMessage.attach')
}
primaryButtonTestID="messagesSelectAFileID"
onPrimaryContentButtonPress={displaySelectFile ? onSelectAFile : onAttach}>
<Box mb={theme.dimensions.contentMarginBottom} mx={theme.dimensions.gutter}>
{!!error && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ function StartNewMessage({ navigation, route }: StartNewMessageProps) {
includeBlankPlaceholder: true,
isRequiredField: true,
testID: 'to field',
confirmTestID: 'messagePickerConfirmID',
},
fieldErrorMessage: t('secureMessaging.startNewMessage.to.fieldError'),
},
Expand All @@ -274,6 +275,7 @@ function StartNewMessage({ navigation, route }: StartNewMessageProps) {
includeBlankPlaceholder: true,
isRequiredField: true,
testID: 'picker',
confirmTestID: 'messagePickerConfirmID',
},
fieldErrorMessage: t('secureMessaging.startNewMessage.category.fieldError'),
},
Expand Down Expand Up @@ -306,6 +308,7 @@ function StartNewMessage({ navigation, route }: StartNewMessageProps) {
: undefined,
buttonPress: attachmentsList.length < theme.dimensions.maxNumMessageAttachments ? onAddFiles : undefined,
attachmentsList,
testID: 'messagesAttachmentsAddFilesID',
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ function ViewMessageScreen({ route, navigation }: ViewMessageScreenProps) {
logAnalyticsEvent(Events.vama_sm_move())
setShowModalPicker(true)
},
testID: 'pickerMoveMessageID',
}

return (
Expand All @@ -375,7 +376,8 @@ function ViewMessageScreen({ route, navigation }: ViewMessageScreenProps) {
backLabelOnPress={navigation.goBack}
title={t('reviewMessage')}
headerButton={headerButton}
testID="viewMessageTestID">
testID="viewMessageTestID"
backLabelTestID="backToMessagesID">
{isLoading ? (
<LoadingComponent text={loadingText} />
) : hasError ? (
Expand Down Expand Up @@ -403,6 +405,8 @@ function ViewMessageScreen({ route, navigation }: ViewMessageScreenProps) {
confirmBtnText={'pickerLaunchBtn'}
key={newCurrentFolderID}
showModalByDefault={true}
cancelTestID="pickerMoveMessageCancelID"
confirmTestID="pickerMoveMessageConfirmID"
/>
)}
{replyExpired && (
Expand All @@ -411,6 +415,7 @@ function ViewMessageScreen({ route, navigation }: ViewMessageScreenProps) {
variant="warning"
header={t('secureMessaging.reply.youCanNoLonger')}
description={t('secureMessaging.reply.olderThan45Days')}
testID="secureMessagingOlderThan45DaysAlertID"
/>
</Box>
)}
Expand Down

0 comments on commit 75d39ee

Please sign in to comment.