From a4170ec80bc957b845400bb7c52a0d04820d1350 Mon Sep 17 00:00:00 2001 From: Rachael Bontrager Date: Tue, 8 Oct 2024 16:06:49 -0500 Subject: [PATCH] CU/9822-rachael-detox-VALetters-replace-by-text (#9823) --- VAMobile/e2e/tests/VALetters.e2e.ts | 44 +++++++++---------- .../BenefitSummaryServiceVerification.tsx | 6 ++- .../Letters/GenericLetter/GenericLetter.tsx | 5 ++- .../Letters/LettersOverviewScreen.tsx | 1 + 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/VAMobile/e2e/tests/VALetters.e2e.ts b/VAMobile/e2e/tests/VALetters.e2e.ts index 679c883c257..75b5f59b35d 100644 --- a/VAMobile/e2e/tests/VALetters.e2e.ts +++ b/VAMobile/e2e/tests/VALetters.e2e.ts @@ -16,6 +16,11 @@ export const LettersConstants = { MAILING_ADDRESS: '3101 N Fort Valley Rd', DOWNLOAD_DOCUMENTS_TEXT: 'Downloaded documents will list your address as:', LETTER_FILE_NAME: 'demo_mode_benefit_summary', + LETTER_REVIEW_LETTERS_BUTTON_ID: 'lettersOverviewViewLettersButtonID', + LETTER_BENEFIT_SUMMARY_ROW_ID: 'BenefitSummaryServiceVerificationTestID', + LETTER_BENEFIT_SUMMARY_ASK_VA_LINK_ID: 'lettersBenefitServiceGoToAskVAID', + LETTER_BENEFIT_SUMMARY_BACK_ID: 'BenefitSummaryServiceVerificationBackID', + LETTER_BENEFIT_SUMMARY_VIEW_LETTER_ID: 'lettersBenefitServiceViewLetterID', LETTER_TYPES: [ { name: 'Benefit summary and service verification letter', @@ -75,18 +80,18 @@ describe('VA Letters', () => { it('should tap address and open edit screen', async () => { await element(by.text(LettersConstants.MAILING_ADDRESS)).tap() - await element(by.id('streetAddressLine2TestID')).typeText('2') - await element(by.id('streetAddressLine2TestID')).tapReturnKey() + await element(by.id(CommonE2eIdConstants.CONTACT_INFO_STREET_ADDRESS_LINE_2_ID)).typeText('2') + await element(by.id(CommonE2eIdConstants.CONTACT_INFO_STREET_ADDRESS_LINE_2_ID)).tapReturnKey() - await element(by.text('Save')).tap() - await element(by.id('suggestedAddressTestID')).tap() - await element(by.id('Use this address')).tap() + await element(by.id(CommonE2eIdConstants.CONTACT_INFO_SAVE_ID)).tap() + await element(by.id(CommonE2eIdConstants.CONTACT_INFO_SUGGESTED_ADDRESS_ID)).tap() + await element(by.id(CommonE2eIdConstants.CONTACT_INFO_USE_THIS_ADDRESS_ID)).tap() await expect(element(by.text(LettersConstants.DOWNLOAD_DOCUMENTS_TEXT))).toExist() }) it('should verify address change is reflected in contact info', async () => { - await element(by.text('Home')).tap() + await element(by.id('Home')).tap() await openProfile() await openContactInfo() await expect(element(by.text('3101 N Fort Valley Rd, 2'))).toExist() @@ -96,15 +101,15 @@ describe('VA Letters', () => { await openBenefits() await element(by.text('3101 N Fort Valley Rd, 2')).tap() - await element(by.id('streetAddressLine2TestID')).clearText() - await element(by.text('Save')).tap() - await element(by.id('suggestedAddressTestID')).tap() - await element(by.id('Use this address')).tap() + await element(by.id(CommonE2eIdConstants.CONTACT_INFO_STREET_ADDRESS_LINE_2_ID)).clearText() + await element(by.id(CommonE2eIdConstants.CONTACT_INFO_SAVE_ID)).tap() + await element(by.id(CommonE2eIdConstants.CONTACT_INFO_SUGGESTED_ADDRESS_ID)).tap() + await element(by.id(CommonE2eIdConstants.CONTACT_INFO_USE_THIS_ADDRESS_ID)).tap() await expect(element(by.text(LettersConstants.MAILING_ADDRESS))).toExist() }) it('should view letter types', async () => { - await element(by.text('Review letters')).tap() + await element(by.id(LettersConstants.LETTER_REVIEW_LETTERS_BUTTON_ID)).tap() for (const letterType of LettersConstants.LETTER_TYPES) { await expect(element(by.text(letterType.name))).toExist() @@ -113,35 +118,28 @@ describe('VA Letters', () => { for (const letterType of LettersConstants.LETTER_TYPES) { it(`should view ${letterType.name}`, async () => { - // need in-app reset in iOS before checking proof of service card to avoid false fail - if (device.getPlatform() === 'ios' && letterType.name === 'Proof of minimum essential coverage letter') { - await openBenefits() - await openLetters() - await element(by.text('Review letters')).tap() - } - await element(by.text(letterType.name)).tap() await expect(element(by.text(letterType.name))).toExist() await expect(element(by.text(letterType.description))).toExist() if (device.getPlatform() === 'ios') { - const isBenefitSummaryLetter = await checkIfElementIsPresent('BenefitSummaryServiceVerificationTestID') + const isBenefitSummaryLetter = await checkIfElementIsPresent(LettersConstants.LETTER_BENEFIT_SUMMARY_ROW_ID) if (isBenefitSummaryLetter) { - await element(by.id('BenefitSummaryServiceVerificationTestID')).scrollTo('bottom') - await element(by.text('Go to Ask VA')).tap() + await element(by.id(LettersConstants.LETTER_BENEFIT_SUMMARY_ROW_ID)).scrollTo('bottom') + await element(by.id(LettersConstants.LETTER_BENEFIT_SUMMARY_ASK_VA_LINK_ID)).tap() await element(by.text(CommonE2eIdConstants.LEAVING_APP_LEAVE_TEXT)).tap() await setTimeout(2000) await device.takeScreenshot('benefitSummaryLetterAskVAWebpage') await device.launchApp({ newInstance: false }) } - await element(by.text('Review letter')).tap() + await element(by.id(LettersConstants.LETTER_BENEFIT_SUMMARY_VIEW_LETTER_ID)).tap() await expect(element(by.text(LettersConstants.LETTER_FILE_NAME))).toExist() await element(by.text('Done')).tap() } - await element(by.text('Review letters')).tap() + await element(by.id(LettersConstants.LETTER_BENEFIT_SUMMARY_BACK_ID)).tap() }) } }) diff --git a/VAMobile/src/screens/BenefitsScreen/Letters/BenefitSummaryServiceVerification/BenefitSummaryServiceVerification.tsx b/VAMobile/src/screens/BenefitsScreen/Letters/BenefitSummaryServiceVerification/BenefitSummaryServiceVerification.tsx index a10196748b9..73356aa6d38 100644 --- a/VAMobile/src/screens/BenefitsScreen/Letters/BenefitSummaryServiceVerification/BenefitSummaryServiceVerification.tsx +++ b/VAMobile/src/screens/BenefitsScreen/Letters/BenefitSummaryServiceVerification/BenefitSummaryServiceVerification.tsx @@ -231,7 +231,8 @@ function BenefitSummaryServiceVerification({ navigation }: BenefitSummaryService backLabel={t('letters.overview.viewLetters')} backLabelOnPress={navigation.goBack} title={t('letters.details.title')} - testID="BenefitSummaryServiceVerificationTestID"> + testID="BenefitSummaryServiceVerificationTestID" + backLabelTestID="BenefitSummaryServiceVerificationBackID"> {loadingCheck ? ( ) : letterDownloadError ? ( @@ -285,6 +286,7 @@ function BenefitSummaryServiceVerification({ navigation }: BenefitSummaryService text={t('letters.benefitService.sendMessage')} a11yLabel={a11yLabelVA(t('letters.benefitService.sendMessage'))} a11yHint={t('letters.benefitService.sendMessageA11yHint')} + testID="lettersBenefitServiceGoToAskVAID" /> @@ -292,7 +294,7 @@ function BenefitSummaryServiceVerification({ navigation }: BenefitSummaryService