diff --git a/VAMobile/e2e/tests/Messages.e2e.ts b/VAMobile/e2e/tests/Messages.e2e.ts index 41b6209dd3c..ea5110971ad 100644 --- a/VAMobile/e2e/tests/Messages.e2e.ts +++ b/VAMobile/e2e/tests/Messages.e2e.ts @@ -1,9 +1,6 @@ import { by, device, element, expect, waitFor } from 'detox' -import { DateTime } from 'luxon' import { setTimeout } from 'timers/promises' -import { isIOS } from 'utils/platform' - import { CommonE2eIdConstants, checkImages, @@ -13,16 +10,6 @@ import { toggleRemoteConfigFlag, } from './utils' -export async function getDateWithTimeZone(dateString: string) { - const date = DateTime.fromFormat(dateString, 'LLLL d, yyyy h:m a', { zone: 'America/Chicago' }) - const dateUTC = date.toLocal() - let dateTime = dateUTC.toLocaleString(Object.assign(DateTime.DATETIME_FULL)) - if (device.getPlatform() === 'android') { - dateTime = dateTime.replace(' at ', ', ') - } - return dateTime -} - export const MessagesE2eIdConstants = { MESSAGE_1_ID: 'Unread: Martha Kaplan, Md October 26, 2021 Medication: Naproxen side effects', MESSAGE_1_READ_ID: 'Martha Kaplan, Md October 26, 2021 Medication: Naproxen side effects', @@ -34,17 +21,17 @@ export const MessagesE2eIdConstants = { MESSAGE_6_ID: 'Ratana, Narin October 21, 2021 Test: Preparing for your visit', MESSAGE_7_ID: 'Ratana, Narin September 17, 2021 Education: Good morning to you', MESSAGE_10_ID: 'Ratana, Narin September 17, 2021 COVID: Test', - FOLDERS_TEXT: 'Folders', + FOLDERS_ID: 'foldersID', MESSAGES_ID: 'messagesTestID', REVIEW_MESSAGE_REPLY_ID: 'replyTestID', ONLY_USE_MESSAGES_TEXT: 'Only use messages for non-urgent needs', - ATTACHMENTS_BUTTON_TEXT: 'Add Files', + ATTACHMENTS_BUTTON_ID: 'messagesAttachmentsAddFilesID', ATTACHMENT_CAMERA_TEXT: device.getPlatform() === 'ios' ? 'Camera' : 'Camera ', ATTACHMENT_PHOTO_GALLERY_TEXT: device.getPlatform() === 'ios' ? 'Photo Gallery' : 'Photo gallery ', ATTACHMENT_FILE_FOLDER_TEXT: device.getPlatform() === 'ios' ? 'File Folder' : 'File folder ', MESSAGE_INPUT_ID: 'reply field', SEND_BUTTON_ID: 'sendButtonTestID', - SELECT_A_FILE_ID: 'Select a file', + SELECT_A_FILE_ID: 'messagesSelectAFileID', REPLY_PAGE_TEST_ID: 'replyPageTestID', START_NEW_MESSAGE_TO_ID: 'to field', START_NEW_MESSAGE_CATEGORY_ID: 'picker', @@ -64,6 +51,14 @@ export const MessagesE2eIdConstants = { EDIT_DRAFT_CANCEL_DELETE_TEXT: device.getPlatform() === 'ios' ? 'Delete Changes' : 'Delete Changes ', EDIT_DRAFT_CANCEL_SAVE_TEXT: device.getPlatform() === 'ios' ? 'Save Changes' : 'Save Changes ', EDIT_DRAFT_PAGE_TEST_ID: 'editDraftTestID', + BACK_TO_MESSAGES_ID: 'backToMessagesID', + MOVE_PICKER_ID: 'pickerMoveMessageID', + MOVE_PICKER_CANCEL_ID: 'pickerMoveMessageCancelID', + MOVE_PICKER_CONFIRM_ID: 'pickerMoveMessageConfirmID', + ATTACHMENTS_PAGE_CANCEL_ID: 'attachmentsCancelID', + MESSAGES_HELP_CLOSE_ID: 'messagesHelpCloseTestID', + MESSAGE_PICKER_CONFIRM_ID: 'messagePickerConfirmID', + FOLDERS_BACK_ID: 'foldersBackToMessagesID', } const tapItems = async (items: string, type: string) => { @@ -90,7 +85,6 @@ const tapItems = async (items: string, type: string) => { await setTimeout(3000) } -let dateWithTimeZone let messageCollapsed let messageExpanded @@ -105,7 +99,7 @@ describe('Messages Screen', () => { it('should match the messages page design', async () => { await expect(element(by.id(CommonE2eIdConstants.START_NEW_MESSAGE_BUTTON_ID))).toExist() await expect(element(by.text('Inbox (3)'))).toExist() - await expect(element(by.text(MessagesE2eIdConstants.FOLDERS_TEXT))).toExist() + await expect(element(by.id(MessagesE2eIdConstants.FOLDERS_ID))).toExist() await expect(element(by.id(MessagesE2eIdConstants.MESSAGE_1_ID))).toExist() await expect(element(by.id(MessagesE2eIdConstants.MESSAGE_2_ID))).toExist() await expect(element(by.id(MessagesE2eIdConstants.MESSAGE_3_ID))).toExist() @@ -123,24 +117,18 @@ describe('Messages Screen', () => { it('verify message OLDER than 45 days information', async () => { await element(by.id(MessagesE2eIdConstants.MESSAGES_ID)).scrollTo('top') await element(by.id(MessagesE2eIdConstants.MESSAGE_2_ID)).tap() - await expect(element(by.text('This conversation is too old for new replies'))).toExist() - await expect( - element( - by.text( - 'The last message in this conversation is more than 45 days old. To continue this conversation, start a new message.', - ), - ), - ).toExist() + await expect(element(by.id('secureMessagingOlderThan45DaysAlertID'))).toExist() await expect(element(by.text(MessagesE2eIdConstants.ONLY_USE_MESSAGES_TEXT))).toExist() await expect(element(by.id(MessagesE2eIdConstants.REVIEW_MESSAGE_REPLY_ID))).not.toExist() await expect(element(by.id(CommonE2eIdConstants.START_NEW_MESSAGE_BUTTON_ID))) }) it('verify the message just opened is displayed as read', async () => { - await element(by.text('Messages')).tap() + await element(by.id(MessagesE2eIdConstants.BACK_TO_MESSAGES_ID)).tap() await expect( element(by.id('Diana Persson, Md October 26, 2021 Has attachment COVID: Prepping for your visit')), ).toExist() + await expect(element(by.text('Inbox (2)'))).toExist() }) it('verify message NEWER than 45 days information', async () => { @@ -149,7 +137,6 @@ describe('Messages Screen', () => { await expect(element(by.id(MessagesE2eIdConstants.REVIEW_MESSAGE_REPLY_ID))).toExist() await expect(element(by.text('Medication: Naproxen side effects'))).toExist() await expect(element(by.text('RATANA, NARIN '))).toExist() - await expect(element(by.text('Only use messages for non-urgent needs'))).toExist() }) it(':android: verify phone links open', async () => { @@ -190,22 +177,22 @@ describe('Messages Screen', () => { }) it('verify medication message details', async () => { - await element(by.text('Messages')).tap() + await element(by.id(MessagesE2eIdConstants.BACK_TO_MESSAGES_ID)).tap() await element(by.id('Martha Kaplan, Md October 26, 2021 Medication: Naproxen side effects')).tap() await expect(element(by.text('Medication: Naproxen side effects'))).toExist() - await element(by.text('Messages')).tap() + await element(by.id(MessagesE2eIdConstants.BACK_TO_MESSAGES_ID)).tap() }) it('verify COVID message details', async () => { await element(by.id('Diana Persson, Md October 26, 2021 Has attachment COVID: Prepping for your visit')).tap() await expect(element(by.text('COVID: Your requested info'))).toExist() - await element(by.text('Messages')).tap() + await element(by.id(MessagesE2eIdConstants.BACK_TO_MESSAGES_ID)).tap() }) it('verify general message details', async () => { await element(by.id(MessagesE2eIdConstants.MESSAGE_3_ID)).tap() await expect(element(by.text('General: Vaccine Booster'))).toExist() - await element(by.text('Messages')).tap() + await element(by.id(MessagesE2eIdConstants.BACK_TO_MESSAGES_ID)).tap() }) it('verify appointment message details', async () => { @@ -215,7 +202,7 @@ describe('Messages Screen', () => { .scroll(100, 'down') await element(by.id(MessagesE2eIdConstants.MESSAGE_4_ID)).tap() await expect(element(by.text('Appointment: Preparing for your visit'))).toExist() - await element(by.text('Messages')).tap() + await element(by.id(MessagesE2eIdConstants.BACK_TO_MESSAGES_ID)).tap() }) it('verify other message details', async () => { @@ -225,7 +212,7 @@ describe('Messages Screen', () => { .scroll(100, 'down') await element(by.id(MessagesE2eIdConstants.MESSAGE_5_ID)).tap() await expect(element(by.text('General: COVID vaccine booster?'))).toExist() - await element(by.text('Messages')).tap() + await element(by.id(MessagesE2eIdConstants.BACK_TO_MESSAGES_ID)).tap() }) it('verify test_results message details', async () => { @@ -235,7 +222,7 @@ describe('Messages Screen', () => { .scroll(100, 'down') await element(by.id(MessagesE2eIdConstants.MESSAGE_6_ID)).tap() await expect(element(by.text('Test: Preparing for your visit'))).toExist() - await element(by.text('Messages')).tap() + await element(by.id(MessagesE2eIdConstants.BACK_TO_MESSAGES_ID)).tap() }) it('verify education message details', async () => { @@ -245,7 +232,7 @@ describe('Messages Screen', () => { .scroll(100, 'down') await element(by.id(MessagesE2eIdConstants.MESSAGE_7_ID)).tap() await expect(element(by.text('Education: Good morning to you'))).toExist() - await element(by.text('Messages')).tap() + await element(by.id(MessagesE2eIdConstants.BACK_TO_MESSAGES_ID)).tap() }) it('should tap on and then cancel the move option', async () => { @@ -254,8 +241,8 @@ describe('Messages Screen', () => { .whileElement(by.id(MessagesE2eIdConstants.MESSAGES_ID)) .scroll(400, 'up') await element(by.id(MessagesE2eIdConstants.MESSAGE_1_READ_ID)).tap() - await element(by.text('Move')).tap() - await element(by.text('Cancel')).tap() + await element(by.id(MessagesE2eIdConstants.MOVE_PICKER_ID)).tap() + await element(by.id(MessagesE2eIdConstants.MOVE_PICKER_CANCEL_ID)).tap() }) it('should tap reply and verify the correct information is displayed', async () => { @@ -263,19 +250,19 @@ describe('Messages Screen', () => { await element(by.id(MessagesE2eIdConstants.REVIEW_MESSAGE_REPLY_ID)).tap() await expect(element(by.id('To RATANA, NARIN '))).toExist() await expect(element(by.id('Subject Medication: Naproxen side effects'))).toExist() - await expect(element(by.text(MessagesE2eIdConstants.ATTACHMENTS_BUTTON_TEXT))).toExist() + await expect(element(by.id(MessagesE2eIdConstants.ATTACHMENTS_BUTTON_ID))).toExist() await expect(element(by.id(MessagesE2eIdConstants.MESSAGE_INPUT_ID))).toExist() await expect(element(by.id(MessagesE2eIdConstants.SEND_BUTTON_ID))).toExist() }) it('reply: verify talk to the veterans crisis line now is displayed', async () => { - await element(by.text(CommonE2eIdConstants.VETERAN_CRISIS_LINE_BTN_TEXT)).tap() + await element(by.id(CommonE2eIdConstants.VETERAN_CRISIS_LINE_BTN_ID)).tap() await expect(element(by.text('Veterans Crisis Line'))).toExist() - await element(by.text('Done')).tap() + await element(by.id(CommonE2eIdConstants.VETERAN_CRISIS_LINE_BACK_ID)).tap() }) it('should tap add files and verify the correct info is displayed', async () => { - await element(by.text(MessagesE2eIdConstants.ATTACHMENTS_BUTTON_TEXT)).tap() + await element(by.id(MessagesE2eIdConstants.ATTACHMENTS_BUTTON_ID)).tap() await expect(element(by.text('What to know about attaching files'))).toExist() await expect(element(by.text('You can attach up to 4 files to each message.'))).toExist() await expect( @@ -284,21 +271,21 @@ describe('Messages Screen', () => { await expect(element(by.text('The maximum size for each file is 6 MB.'))).toExist() await expect(element(by.text('The maximum total size for all files attached to 1 message is 10 MB.'))).toExist() await expect(element(by.text("We can't save attachments in a draft."))).toExist() - await expect(element(by.text(MessagesE2eIdConstants.SELECT_A_FILE_ID))).toExist() + await expect(element(by.id(MessagesE2eIdConstants.SELECT_A_FILE_ID))).toExist() }) it('should tap cancel and verify that the reply page is displayed', async () => { - await element(by.text('Cancel')).atIndex(0).tap() + await element(by.id(MessagesE2eIdConstants.ATTACHMENTS_PAGE_CANCEL_ID)).tap() await expect(element(by.id('To RATANA, NARIN '))).toExist() await expect(element(by.id('Subject Medication: Naproxen side effects'))).toExist() - await expect(element(by.text(MessagesE2eIdConstants.ATTACHMENTS_BUTTON_TEXT))).toExist() + await expect(element(by.id(MessagesE2eIdConstants.ATTACHMENTS_BUTTON_ID))).toExist() await expect(element(by.id(MessagesE2eIdConstants.MESSAGE_INPUT_ID))).toExist() await expect(element(by.id(MessagesE2eIdConstants.SEND_BUTTON_ID))).toExist() }) it('verify tap select a file action sheet options are correct', async () => { - await element(by.text(MessagesE2eIdConstants.ATTACHMENTS_BUTTON_TEXT)).tap() - await element(by.text(MessagesE2eIdConstants.SELECT_A_FILE_ID)).tap() + await element(by.id(MessagesE2eIdConstants.ATTACHMENTS_BUTTON_ID)).tap() + await element(by.id(MessagesE2eIdConstants.SELECT_A_FILE_ID)).tap() await expect(element(by.text(MessagesE2eIdConstants.ATTACHMENT_CAMERA_TEXT))).toExist() await expect(element(by.text(MessagesE2eIdConstants.ATTACHMENT_PHOTO_GALLERY_TEXT))).toExist() await expect(element(by.text(MessagesE2eIdConstants.ATTACHMENT_FILE_FOLDER_TEXT))).toExist() @@ -307,10 +294,10 @@ describe('Messages Screen', () => { it('should close the action sheet and tap cancel', async () => { if (device.getPlatform() === 'android') { await element(by.text('Cancel ')).tap() - await element(by.text('Cancel')).atIndex(1).tap() + await element(by.id(MessagesE2eIdConstants.ATTACHMENTS_PAGE_CANCEL_ID)).tap() } else { await element(by.text('Cancel')).atIndex(2).tap() - await element(by.text('Cancel')).atIndex(0).tap() + await element(by.id(MessagesE2eIdConstants.ATTACHMENTS_PAGE_CANCEL_ID)).tap() } }) @@ -337,16 +324,12 @@ describe('Messages Screen', () => { it('should tap and move a message', async () => { await element(by.id(MessagesE2eIdConstants.MESSAGE_2_READ_ID)).tap() - await element(by.text('Move')).tap() + await element(by.id(MessagesE2eIdConstants.MOVE_PICKER_ID)).tap() await element(by.text('Custom Folder 2')).tap() - if (device.getPlatform() === 'android') { - await element(by.text('Move')).tap() - } else { - await element(by.text('Move')).atIndex(1).tap() - } + await element(by.id(MessagesE2eIdConstants.MOVE_PICKER_CONFIRM_ID)).tap() await expect(element(by.text('Message moved to Custom Folder 2'))).toExist() await element(by.text('Dismiss')).tap() - await element(by.text('Messages')).tap() + await element(by.id(MessagesE2eIdConstants.BACK_TO_MESSAGES_ID)).tap() }) //running on iOS only for the next few tests due to android wonkiness due to detox @@ -361,9 +344,9 @@ describe('Messages Screen', () => { }) it(':ios: new message: verify talk to the veterans crisis line now', async () => { - await element(by.text(CommonE2eIdConstants.VETERAN_CRISIS_LINE_BTN_TEXT)).tap() + await element(by.id(CommonE2eIdConstants.VETERAN_CRISIS_LINE_BTN_ID)).tap() await expect(element(by.text('Veterans Crisis Line'))).toExist() - await element(by.text('Done')).tap() + await element(by.id(CommonE2eIdConstants.VETERAN_CRISIS_LINE_BACK_ID)).tap() }) it(':ios: verify only use messages for non-urgent needs information', async () => { @@ -374,14 +357,14 @@ describe('Messages Screen', () => { await expect(element(by.text('If you need help sooner, use one of these urgent communication options:'))).toExist() await device.disableSynchronization() if (device.getPlatform() === 'android') { - await element(by.text('Call 988 and select 1')).tap() + await element(by.id(CommonE2eIdConstants.VETERANS_CRISIS_LINE_CALL_ID)).tap() await setTimeout(5000) await device.takeScreenshot('messagesHelpCrisisLinePhone') await device.launchApp({ newInstance: false }) await element(by.id('messageHelpTestID')).scrollTo('bottom') - await element(by.text('TTY: 800-799-4889')).tap() + await element(by.id(CommonE2eIdConstants.VETERANS_CRISIS_LINE_TTY_ID)).tap() await setTimeout(5000) await device.takeScreenshot('messagesHelpCrisisLineTTY') await device.launchApp({ newInstance: false }) @@ -394,12 +377,12 @@ describe('Messages Screen', () => { await element(by.id('messageHelpTestID')).scrollTo('top') } - await element(by.text('Text 838255')).tap() + await element(by.id(CommonE2eIdConstants.VETERANS_CRISIS_LINE_TEXT_ID)).tap() await setTimeout(5000) await device.takeScreenshot('messagesHelpText') await device.launchApp({ newInstance: false }) - await element(by.text('Start a confidential chat')).tap() + await element(by.id(CommonE2eIdConstants.VETERANS_CRISIS_LINE_CHAT_ID)).tap() await element(by.text(CommonE2eIdConstants.LEAVING_APP_LEAVE_TEXT)).tap() await setTimeout(5000) await device.takeScreenshot('messagesHelpChat') @@ -408,7 +391,7 @@ describe('Messages Screen', () => { }) it(':ios: should close the messages help panel', async () => { - await element(by.id('messagesHelpCloseTestID')).tap() + await element(by.id(MessagesE2eIdConstants.MESSAGES_HELP_CLOSE_ID)).tap() }) it(':ios: verify the correct errors displayed on save', async () => { @@ -422,7 +405,7 @@ describe('Messages Screen', () => { it(':ios: should tap the to field and select a name', async () => { await element(by.id(MessagesE2eIdConstants.START_NEW_MESSAGE_TO_ID)).tap() await element(by.text('VA Flagship mobile applications interface_DAYT29')).tap() - await element(by.text('Done')).tap() + await element(by.id(MessagesE2eIdConstants.MESSAGE_PICKER_CONFIRM_ID)).tap() }) it(':ios: should tap the category field and select a category', async () => { @@ -432,7 +415,7 @@ describe('Messages Screen', () => { .scroll(50, 'down') await element(by.id(MessagesE2eIdConstants.START_NEW_MESSAGE_CATEGORY_ID)).tap() await element(by.text('Medication')).tap() - await element(by.text('Done')).tap() + await element(by.id(MessagesE2eIdConstants.MESSAGE_PICKER_CONFIRM_ID)).tap() }) it(':ios: should add and delete text in the subject field', async () => { @@ -463,7 +446,7 @@ describe('Messages Screen', () => { await element(by.id(MessagesE2eIdConstants.START_NEW_MESSAGE_CANCEL_ID)).tap() await element(by.text(MessagesE2eIdConstants.MESSAGE_CANCEL_DELETE_TEXT)).tap() await expect(element(by.id(CommonE2eIdConstants.START_NEW_MESSAGE_BUTTON_ID))).toExist() - await expect(element(by.text(MessagesE2eIdConstants.FOLDERS_TEXT))).toExist() + await expect(element(by.id(MessagesE2eIdConstants.FOLDERS_ID))).toExist() await expect( element(by.id('Diana Persson, Md October 26, 2021 Has attachment COVID: Prepping for your visit')), ).toExist() @@ -477,7 +460,7 @@ describe('Messages Screen', () => { it('navigate to the sent folder and select the first message', async () => { await openHealth() await openMessages() - await element(by.text(MessagesE2eIdConstants.FOLDERS_TEXT)).tap() + await element(by.id(MessagesE2eIdConstants.FOLDERS_ID)).tap() await element(by.text('Sent')).tap() }) @@ -577,8 +560,8 @@ describe('Messages Screen', () => { }) it('verify that the sent folder opens and is displayed', async () => { - await element(by.text('Messages')).tap() - await element(by.text('Sent')).tap() + await element(by.id(MessagesE2eIdConstants.FOLDERS_BACK_ID)).tap() + await element(by.id('Sent')).tap() await expect(element(by.id(CommonE2eIdConstants.START_NEW_MESSAGE_BUTTON_ID))).toExist() await expect( element( @@ -600,7 +583,7 @@ describe('Messages Screen', () => { it('verify that custom folders exist with messages', async () => { await element(by.text('Sent')).tap() - await element(by.text('Messages')).tap() + await element(by.id(MessagesE2eIdConstants.FOLDERS_BACK_ID)).tap() await expect(element(by.text('Custom Folder 2'))).toExist() }) }) diff --git a/VAMobile/e2e/tests/utils.ts b/VAMobile/e2e/tests/utils.ts index b183f56299f..6c1f4916a14 100644 --- a/VAMobile/e2e/tests/utils.ts +++ b/VAMobile/e2e/tests/utils.ts @@ -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', } diff --git a/VAMobile/src/components/CrisisLineButton.tsx b/VAMobile/src/components/CrisisLineButton.tsx index dffebf73954..740d98a01b6 100644 --- a/VAMobile/src/components/CrisisLineButton.tsx +++ b/VAMobile/src/components/CrisisLineButton.tsx @@ -29,6 +29,7 @@ const CrisisLineButton: FC = () => { borderRadius: 40, }, ], + testID: 'veteransCrisisLineID', } return ( diff --git a/VAMobile/src/components/FormWrapper/FormFields/FormAttachments.tsx b/VAMobile/src/components/FormWrapper/FormFields/FormAttachments.tsx index 9d6b980bbaa..8c5b11652d4 100644 --- a/VAMobile/src/components/FormWrapper/FormFields/FormAttachments.tsx +++ b/VAMobile/src/components/FormWrapper/FormFields/FormAttachments.tsx @@ -18,13 +18,21 @@ export type FormAttachmentsProps = { buttonLabel?: string /**button onPress */ buttonPress?: () => void + /** optional TestID */ + testID?: string /** list of current attachments */ attachmentsList?: Array } /** 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 = ({ removeOnPress, buttonLabel, buttonPress, attachmentsList }) => { +const FormAttachments: FC = ({ + removeOnPress, + buttonLabel, + buttonPress, + testID, + attachmentsList, +}) => { const theme = useTheme() const { t } = useTranslation(NAMESPACE.COMMON) const { t: tFunction } = useTranslation() @@ -58,6 +66,7 @@ const FormAttachments: FC = ({ removeOnPress, buttonLabel, label={t('remove')} a11yHint={t('remove.a11yHint', { content: fileName })} buttonType={ButtonVariants.Destructive} + testID={testID} /> ) @@ -80,6 +89,7 @@ const FormAttachments: FC = ({ removeOnPress, buttonLabel, onPress={buttonPress} buttonType={ButtonVariants.Secondary} a11yLabel={buttonLabel} + testID={testID} /> )} diff --git a/VAMobile/src/components/Templates/FeatureLandingAndChildTemplate.tsx b/VAMobile/src/components/Templates/FeatureLandingAndChildTemplate.tsx index 9a3a0e6ac6a..7c554e21c0f 100644 --- a/VAMobile/src/components/Templates/FeatureLandingAndChildTemplate.tsx +++ b/VAMobile/src/components/Templates/FeatureLandingAndChildTemplate.tsx @@ -83,6 +83,7 @@ export const ChildTemplate: FC = ({ a11yLabel: headerButton.labelA11y, onPress: headerButton.onPress, icon: headerButton.icon, + testID: headerButton.testID, } : undefined, } diff --git a/VAMobile/src/screens/HealthScreen/SecureMessaging/EditDraft/EditDraft.tsx b/VAMobile/src/screens/HealthScreen/SecureMessaging/EditDraft/EditDraft.tsx index 7e103ad6136..03d36ee5b90 100644 --- a/VAMobile/src/screens/HealthScreen/SecureMessaging/EditDraft/EditDraft.tsx +++ b/VAMobile/src/screens/HealthScreen/SecureMessaging/EditDraft/EditDraft.tsx @@ -448,6 +448,7 @@ function EditDraft({ navigation, route }: EditDraftProps) { : undefined, buttonPress: attachmentsList.length < theme.dimensions.maxNumMessageAttachments ? onAddFiles : undefined, attachmentsList, + testID: 'messagesAttachmentsAddFilesID', }, }, { @@ -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 ? ( ) : hasError ? ( diff --git a/VAMobile/src/screens/HealthScreen/SecureMessaging/FolderMessages/FolderMessages.tsx b/VAMobile/src/screens/HealthScreen/SecureMessaging/FolderMessages/FolderMessages.tsx index 34efcc909f9..9b88877718f 100644 --- a/VAMobile/src/screens/HealthScreen/SecureMessaging/FolderMessages/FolderMessages.tsx +++ b/VAMobile/src/screens/HealthScreen/SecureMessaging/FolderMessages/FolderMessages.tsx @@ -119,7 +119,8 @@ function FolderMessages({ route }: FolderMessagesProps) { navigateTo('SecureMessaging', { activeTab: 1 }) }} title={title} - scrollViewProps={scrollViewProps}> + scrollViewProps={scrollViewProps} + backLabelTestID="foldersBackToMessagesID"> {loadingFolderMessages ? ( ) : folderMessagesError ? ( diff --git a/VAMobile/src/screens/HealthScreen/SecureMessaging/ReplyMessage/ReplyMessage.tsx b/VAMobile/src/screens/HealthScreen/SecureMessaging/ReplyMessage/ReplyMessage.tsx index edba186abb7..4ce4b02b9be 100644 --- a/VAMobile/src/screens/HealthScreen/SecureMessaging/ReplyMessage/ReplyMessage.tsx +++ b/VAMobile/src/screens/HealthScreen/SecureMessaging/ReplyMessage/ReplyMessage.tsx @@ -222,6 +222,7 @@ function ReplyMessage({ navigation, route }: ReplyMessageProps) { : undefined, buttonPress: attachmentsList.length < theme.dimensions.maxNumMessageAttachments ? onAddFiles : undefined, attachmentsList, + testID: 'messagesAttachmentsAddFilesID', }, }, { diff --git a/VAMobile/src/screens/HealthScreen/SecureMessaging/SecureMessaging.tsx b/VAMobile/src/screens/HealthScreen/SecureMessaging/SecureMessaging.tsx index 33069c94023..0fb8a036d43 100644 --- a/VAMobile/src/screens/HealthScreen/SecureMessaging/SecureMessaging.tsx +++ b/VAMobile/src/screens/HealthScreen/SecureMessaging/SecureMessaging.tsx @@ -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: @@ -175,6 +176,7 @@ function SecureMessaging({ navigation, route }: SecureMessagingScreen) { selected={secureMessagingTab} a11yHints={a11yHints} a11yLabels={[t('secureMessaging.inbox')]} + testIDs={controlIDs} /> diff --git a/VAMobile/src/screens/HealthScreen/SecureMessaging/StartNewMessage/Attachments/Attachments.tsx b/VAMobile/src/screens/HealthScreen/SecureMessaging/StartNewMessage/Attachments/Attachments.tsx index 2307727456f..c069cbdab03 100644 --- a/VAMobile/src/screens/HealthScreen/SecureMessaging/StartNewMessage/Attachments/Attachments.tsx +++ b/VAMobile/src/screens/HealthScreen/SecureMessaging/StartNewMessage/Attachments/Attachments.tsx @@ -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}> {!!error && ( diff --git a/VAMobile/src/screens/HealthScreen/SecureMessaging/StartNewMessage/StartNewMessage.tsx b/VAMobile/src/screens/HealthScreen/SecureMessaging/StartNewMessage/StartNewMessage.tsx index bc6d054d929..6e1ed383abe 100644 --- a/VAMobile/src/screens/HealthScreen/SecureMessaging/StartNewMessage/StartNewMessage.tsx +++ b/VAMobile/src/screens/HealthScreen/SecureMessaging/StartNewMessage/StartNewMessage.tsx @@ -261,6 +261,7 @@ function StartNewMessage({ navigation, route }: StartNewMessageProps) { includeBlankPlaceholder: true, isRequiredField: true, testID: 'to field', + confirmTestID: 'messagePickerConfirmID', }, fieldErrorMessage: t('secureMessaging.startNewMessage.to.fieldError'), }, @@ -274,6 +275,7 @@ function StartNewMessage({ navigation, route }: StartNewMessageProps) { includeBlankPlaceholder: true, isRequiredField: true, testID: 'picker', + confirmTestID: 'messagePickerConfirmID', }, fieldErrorMessage: t('secureMessaging.startNewMessage.category.fieldError'), }, @@ -306,6 +308,7 @@ function StartNewMessage({ navigation, route }: StartNewMessageProps) { : undefined, buttonPress: attachmentsList.length < theme.dimensions.maxNumMessageAttachments ? onAddFiles : undefined, attachmentsList, + testID: 'messagesAttachmentsAddFilesID', }, }, { diff --git a/VAMobile/src/screens/HealthScreen/SecureMessaging/ViewMessage/ViewMessageScreen.tsx b/VAMobile/src/screens/HealthScreen/SecureMessaging/ViewMessage/ViewMessageScreen.tsx index c6989b1149e..b63010c8216 100644 --- a/VAMobile/src/screens/HealthScreen/SecureMessaging/ViewMessage/ViewMessageScreen.tsx +++ b/VAMobile/src/screens/HealthScreen/SecureMessaging/ViewMessage/ViewMessageScreen.tsx @@ -367,6 +367,7 @@ function ViewMessageScreen({ route, navigation }: ViewMessageScreenProps) { logAnalyticsEvent(Events.vama_sm_move()) setShowModalPicker(true) }, + testID: 'pickerMoveMessageID', } return ( @@ -375,7 +376,8 @@ function ViewMessageScreen({ route, navigation }: ViewMessageScreenProps) { backLabelOnPress={navigation.goBack} title={t('reviewMessage')} headerButton={headerButton} - testID="viewMessageTestID"> + testID="viewMessageTestID" + backLabelTestID="backToMessagesID"> {isLoading ? ( ) : hasError ? ( @@ -403,6 +405,8 @@ function ViewMessageScreen({ route, navigation }: ViewMessageScreenProps) { confirmBtnText={'pickerLaunchBtn'} key={newCurrentFolderID} showModalByDefault={true} + cancelTestID="pickerMoveMessageCancelID" + confirmTestID="pickerMoveMessageConfirmID" /> )} {replyExpired && ( @@ -411,6 +415,7 @@ function ViewMessageScreen({ route, navigation }: ViewMessageScreenProps) { variant="warning" header={t('secureMessaging.reply.youCanNoLonger')} description={t('secureMessaging.reply.olderThan45Days')} + testID="secureMessagingOlderThan45DaysAlertID" /> )}