Skip to content

Commit

Permalink
CU/9822-rachael-detox-VALetters-replace-by-text (#9823)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbontrager authored Oct 8, 2024
1 parent 729e944 commit a4170ec
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 27 deletions.
44 changes: 21 additions & 23 deletions VAMobile/e2e/tests/VALetters.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
})
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? (
<LoadingComponent text={t(downloading ? 'letters.loading' : 'letters.benefitService.loading')} />
) : letterDownloadError ? (
Expand Down Expand Up @@ -285,14 +286,15 @@ function BenefitSummaryServiceVerification({ navigation }: BenefitSummaryService
text={t('letters.benefitService.sendMessage')}
a11yLabel={a11yLabelVA(t('letters.benefitService.sendMessage'))}
a11yHint={t('letters.benefitService.sendMessageA11yHint')}
testID="lettersBenefitServiceGoToAskVAID"
/>
</Box>

<Box mx={theme.dimensions.gutter}>
<Button
onPress={onViewLetter}
label={t('letters.benefitService.viewLetter')}
testID={t('letters.benefitService.viewLetter')}
testID="lettersBenefitServiceViewLetterID"
/>
</Box>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function GenericLetter({ navigation, route }: GenericLetterProps) {
<Button
onPress={onViewLetter}
label={t('letters.benefitService.viewLetter')}
testID={t('letters.benefitService.viewLetter')}
testID="lettersBenefitServiceViewLetterID"
/>
</TextArea>
</Box>
Expand All @@ -84,7 +84,8 @@ function GenericLetter({ navigation, route }: GenericLetterProps) {
<FeatureLandingTemplate
backLabel={t('letters.overview.viewLetters')}
backLabelOnPress={navigation.goBack}
title={t('letters.details.title')}>
title={t('letters.details.title')}
backLabelTestID="BenefitSummaryServiceVerificationBackID">
{downloading ? (
<LoadingComponent text={t('letters.loading')} />
) : letterDownloadError ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function LettersOverviewScreen({ navigation }: LettersOverviewProps) {
onPress={() => navigateTo('LettersList')}
label={t('letters.overview.viewLetters')}
a11yHint={t('letters.overview.viewLetters.hint')}
testID="lettersOverviewViewLettersButtonID"
/>
</Box>
</>
Expand Down

0 comments on commit a4170ec

Please sign in to comment.