diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index fcc8d5ccd..f5aeb6c5b 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -1405,3 +1405,31 @@ assets.ownership-in-a-business=Ownership in a business assets.real-estate=Real estate (not including your own home) assets.more-than-1-million-in-family-assets=More than $1 million in family assets assets.none-of-the-above=None of the above + +vehicle-asset-source.title = Who has a vehicle +vehicle-asset-source.who-has=Who has a vehicle? +vehicle-asset-source.choose-whoever-is-listed=Choose whoever is listed on the legal paperwork. If something is co-owned, select both people. + +stock-asset-source.title = Who has stocks, bonds, or a 401k +stock-asset-source.who-has=Who has stocks, bonds, or a 401k? +stock-asset-source.choose-whoever-is-listed=Choose whoever is listed on the legal paperwork. If something is co-owned, select both people. + +life-insurance-asset-source.title = Who has life insurance +life-insurance-asset-source.who-has=Who has life insurance? +life-insurance-asset-source.choose-whoever-is-listed=Choose whoever is listed on the legal paperwork. If something is co-owned, select both people. + +burial-account-asset-source.title = Who has a prepaid burial account +burial-account-asset-source.who-has=Who has a prepaid burial account? +burial-account-asset-source.choose-whoever-is-listed=Choose whoever is listed on the legal paperwork. If something is co-owned, select both people. + +business-ownership-asset-source.title = Who has ownership in a business +business-ownership-asset-source.who-has=Who has ownership in a business? +business-ownership-asset-source.choose-whoever-is-listed=Choose whoever is listed on the legal paperwork. If something is co-owned, select both people. + +real-estate-asset-source.title = Who has real estate (not including your own home) +real-estate-asset-source.who-has=Who has real estate (not including your own home)? +real-estate-asset-source.choose-whoever-is-listed=Choose whoever is listed on the legal paperwork. If something is co-owned, select both people. + +one-million-dollar-asset-source.title = Who has more than $1 million in family assets +one-million-dollar-asset-source.who-has=Who has more than $1 million in family assets? +one-million-dollar-asset-source.choose-whoever-is-listed=Choose whoever is listed on the legal paperwork. If something is co-owned, select both people. diff --git a/src/main/resources/pages-config.yaml b/src/main/resources/pages-config.yaml index deac05ee9..034023269 100644 --- a/src/main/resources/pages-config.yaml +++ b/src/main/resources/pages-config.yaml @@ -3223,6 +3223,118 @@ pageDefinitions: isNone: true datasources: - pageName: choosePrograms + - &vehicleAssetSource + name: vehicleAssetSource + pageTitle: vehicle-asset-source.title + headerKey: vehicle-asset-source.who-has + headerHelpMessageKey: vehicle-asset-source.choose-whoever-is-listed + inputs: + - type: CUSTOM + name: vehicleAssetSource + validators: + - validation: NOT_BLANK + errorMessageKey: general.validation.make-sure-to-select-a-person + customInputFragment: householdOptionsCheckboxes + options: + datasources: + - pageName: personalInfo + - groupName: household + - &stockAssetSource + name: stockAssetSource + pageTitle: stock-asset-source.title + headerKey: stock-asset-source.who-has + headerHelpMessageKey: stock-asset-source.choose-whoever-is-listed + inputs: + - type: CUSTOM + name: stockAssetSource + validators: + - validation: NOT_BLANK + errorMessageKey: general.validation.make-sure-to-select-a-person + customInputFragment: householdOptionsCheckboxes + options: + datasources: + - pageName: personalInfo + - groupName: household + - &lifeInsuranceAssetSource + name: lifeInsuranceAssetSource + pageTitle: life-insurance-asset-source.title + headerKey: life-insurance-asset-source.who-has + headerHelpMessageKey: life-insurance-asset-source.choose-whoever-is-listed + inputs: + - type: CUSTOM + name: lifeInsuranceAssetSource + validators: + - validation: NOT_BLANK + errorMessageKey: general.validation.make-sure-to-select-a-person + customInputFragment: householdOptionsCheckboxes + options: + datasources: + - pageName: personalInfo + - groupName: household + - &burialAccountAssetSource + name: burialAccountAssetSource + pageTitle: burial-account-asset-source.title + headerKey: burial-account-asset-source.who-has + headerHelpMessageKey: burial-account-asset-source.choose-whoever-is-listed + inputs: + - type: CUSTOM + name: burialAccountAssetSource + validators: + - validation: NOT_BLANK + errorMessageKey: general.validation.make-sure-to-select-a-person + customInputFragment: householdOptionsCheckboxes + options: + datasources: + - pageName: personalInfo + - groupName: household + - &businessOwnershipAssetSource + name: businessOwnershipAssetSource + pageTitle: business-ownership-asset-source.title + headerKey: business-ownership-asset-source.who-has + headerHelpMessageKey: business-ownership-asset-source.choose-whoever-is-listed + inputs: + - type: CUSTOM + name: businessOwnershipAssetSource + validators: + - validation: NOT_BLANK + errorMessageKey: general.validation.make-sure-to-select-a-person + customInputFragment: householdOptionsCheckboxes + options: + datasources: + - pageName: personalInfo + - groupName: household + - &realEstateAssetSource + name: realEstateAssetSource + pageTitle: real-estate-asset-source.title + headerKey: real-estate-asset-source.who-has + headerHelpMessageKey: real-estate-asset-source.choose-whoever-is-listed + inputs: + - type: CUSTOM + name: realEstateAssetSource + validators: + - validation: NOT_BLANK + errorMessageKey: general.validation.make-sure-to-select-a-person + customInputFragment: householdOptionsCheckboxes + options: + datasources: + - pageName: personalInfo + - groupName: household + - &oneMillionDollarAssetSource + name: oneMillionDollarAssetSource + pageTitle: one-million-dollar-asset-source.title + headerKey: one-million-dollar-asset-source.who-has + headerHelpMessageKey: one-million-dollar-asset-source.choose-whoever-is-listed + inputs: + - type: CUSTOM + name: oneMillionDollarAssetSource + validators: + - validation: NOT_BLANK + errorMessageKey: general.validation.make-sure-to-select-a-person + customInputFragment: householdOptionsCheckboxes + options: + datasources: + - pageName: personalInfo + - groupName: household workflow: landing: pageConfiguration: *landing @@ -4371,8 +4483,113 @@ workflow: - pageName: assets assets: pageConfiguration: *assets + nextPages: + - pageName: vehicleAssetSource + vehicleAssetSource: + pageConfiguration: *vehicleAssetSource + nextPages: + - pageName: stockAssetSource + skipCondition: + logicalOperator: OR + conditions: + - pageName: assets + input: assets + value: VEHICLE + matcher: DOES_NOT_CONTAIN + - *livesAlone? + datasources: + - pageName: addHouseholdMembers + - pageName: assets + stockAssetSource: + pageConfiguration: *stockAssetSource + nextPages: + - pageName: lifeInsuranceAssetSource + skipCondition: + logicalOperator: OR + conditions: + - pageName: assets + input: assets + value: STOCK_BOND + matcher: DOES_NOT_CONTAIN + - *livesAlone? + datasources: + - pageName: addHouseholdMembers + - pageName: assets + lifeInsuranceAssetSource: + pageConfiguration: *lifeInsuranceAssetSource + nextPages: + - pageName: burialAccountAssetSource + skipCondition: + logicalOperator: OR + conditions: + - pageName: assets + input: assets + value: LIFE_INSURANCE + matcher: DOES_NOT_CONTAIN + - *livesAlone? + datasources: + - pageName: addHouseholdMembers + - pageName: assets + burialAccountAssetSource: + pageConfiguration: *burialAccountAssetSource + nextPages: + - pageName: businessOwnershipAssetSource + skipCondition: + logicalOperator: OR + conditions: + - pageName: assets + input: assets + value: BURIAL_ACCOUNT + matcher: DOES_NOT_CONTAIN + - *livesAlone? + datasources: + - pageName: addHouseholdMembers + - pageName: assets + businessOwnershipAssetSource: + pageConfiguration: *businessOwnershipAssetSource + nextPages: + - pageName: realEstateAssetSource + skipCondition: + logicalOperator: OR + conditions: + - pageName: assets + input: assets + value: OWNERSHIP_BUSINESS + matcher: DOES_NOT_CONTAIN + - *livesAlone? + datasources: + - pageName: addHouseholdMembers + - pageName: assets + realEstateAssetSource: + pageConfiguration: *realEstateAssetSource + nextPages: + - pageName: oneMillionDollarAssetSource + skipCondition: + logicalOperator: OR + conditions: + - pageName: assets + input: assets + value: REAL_ESTATE + matcher: DOES_NOT_CONTAIN + - *livesAlone? + datasources: + - pageName: addHouseholdMembers + - pageName: assets + oneMillionDollarAssetSource: + pageConfiguration: *oneMillionDollarAssetSource nextPages: - pageName: savings + skipCondition: + logicalOperator: OR + conditions: + - pageName: assets + input: assets + value: ONE_MILLION_ASSETS + matcher: DOES_NOT_CONTAIN + - *livesAlone? + datasources: + - pageName: addHouseholdMembers + - pageName: assets savings: pageConfiguration: *savings nextPages: diff --git a/src/main/resources/templates/fragments/inputs/householdOptionsCheckboxes.html b/src/main/resources/templates/fragments/inputs/householdOptionsCheckboxes.html index dc4e0be72..7bfc3d45a 100644 --- a/src/main/resources/templates/fragments/inputs/householdOptionsCheckboxes.html +++ b/src/main/resources/templates/fragments/inputs/householdOptionsCheckboxes.html @@ -2,32 +2,35 @@ -
-
-
- - - - -
-
+
+
+
+
+ + + + +
+
+
+
\ No newline at end of file diff --git a/src/test/java/org/codeforamerica/shiba/CCAPMockMvcTest.java b/src/test/java/org/codeforamerica/shiba/CCAPMockMvcTest.java index d29197fc7..0240cc4f8 100644 --- a/src/test/java/org/codeforamerica/shiba/CCAPMockMvcTest.java +++ b/src/test/java/org/codeforamerica/shiba/CCAPMockMvcTest.java @@ -41,7 +41,9 @@ void verifyFlowWhenNoOneHasSelectedCCAPInHousehold() throws Exception { fillAdditionalIncomeInfo(); postExpectingRedirect("supportAndCare", "supportAndCare", "false", "assets"); postExpectingSuccess("assets", "assets", "VEHICLE"); - assertNavigationRedirectsToCorrectNextPage("assets", "savings"); + assertNavigationRedirectsToCorrectNextPage("assets", "vehicleAssetSource"); + postExpectingRedirect("realEstateAssetSource", "realEstateAssetSource", "Dwight Schrute applicant", + "savings"); postExpectingRedirect("savings", "haveSavings", "true", "savingsAmount"); postExpectingNextPageTitle("savingsAmount", "liquidAssets", "1234", "Sold assets"); assertPageDoesNotHaveElementWithId("legalStuff", "ccap-legal"); diff --git a/src/test/java/org/codeforamerica/shiba/journeys/AccessibilityJourneyTest.java b/src/test/java/org/codeforamerica/shiba/journeys/AccessibilityJourneyTest.java index d15cb0ac1..42c77c70f 100644 --- a/src/test/java/org/codeforamerica/shiba/journeys/AccessibilityJourneyTest.java +++ b/src/test/java/org/codeforamerica/shiba/journeys/AccessibilityJourneyTest.java @@ -327,6 +327,10 @@ void userCanCompleteTheNonExpeditedHouseholdFlow() { testPage.enter("assets", "A vehicle"); testPage.enter("assets", "Real estate (not including your own home)"); testPage.clickContinue(); + driver.findElement(By.id("householdMember-me")).click(); + testPage.clickContinue(); + driver.findElement(By.id("householdMember-me")).click(); + testPage.clickContinue(); testPage.enter("haveSavings", YES.getDisplayValue()); testPage.enter("liquidAssets", "1234"); testPage.clickContinue(); diff --git a/src/test/java/org/codeforamerica/shiba/journeys/FullFlowJourneyTest.java b/src/test/java/org/codeforamerica/shiba/journeys/FullFlowJourneyTest.java index a06d4c80e..459518f08 100644 --- a/src/test/java/org/codeforamerica/shiba/journeys/FullFlowJourneyTest.java +++ b/src/test/java/org/codeforamerica/shiba/journeys/FullFlowJourneyTest.java @@ -344,6 +344,16 @@ void fullApplicationWithDocumentUploads() { testPage.enter("assets", "Real estate (not including your own home)"); testPage.clickContinue(); + // Who has a vehicle? + assertThat(testPage.getTitle()).isEqualTo("Who has a vehicle"); + driver.findElement(By.id("householdMember-me")).click(); + testPage.clickContinue(); + + //Who has real estate (not including your own home) + assertThat(testPage.getTitle()).isEqualTo("Who has real estate (not including your own home)"); + driver.findElement(By.id("householdMember-me")).click(); + testPage.clickContinue(); + // Does anyone in the household have money in a bank account or debit card? testPage.enter("haveSavings", YES.getDisplayValue()); diff --git a/src/test/java/org/codeforamerica/shiba/pages/AssetsTypeTest.java b/src/test/java/org/codeforamerica/shiba/pages/AssetsTypeTest.java index 65d44500e..64e66dfdf 100644 --- a/src/test/java/org/codeforamerica/shiba/pages/AssetsTypeTest.java +++ b/src/test/java/org/codeforamerica/shiba/pages/AssetsTypeTest.java @@ -39,16 +39,39 @@ void verifyAssetTypesForCCAP() throws Exception { void verifyAssetTypesForCERTAINPOPS() throws Exception { completeFlowAssetsTypeAsPerProgram("CERTAIN_POPS"); var page = new FormPage(getPage("assets")); - assertThat(page.getOptionValues("assets")).contains("VEHICLE","STOCK_BOND","LIFE_INSURANCE","BURIAL_ACCOUNT","OWNERSHIP_BUSINESS","REAL_ESTATE","NONE"); + assertThat(page.getOptionValues("assets")).containsOnly("VEHICLE","STOCK_BOND","LIFE_INSURANCE","BURIAL_ACCOUNT","OWNERSHIP_BUSINESS","REAL_ESTATE","NONE"); } @Test void verifyAssetTypesForCERTAINPOPSANDCCAP() throws Exception { completeFlowAssetsTypeAsPerProgram("CERTAIN_POPS","CCAP"); var page = new FormPage(getPage("assets")); - assertThat(page.getOptionValues("assets")).contains("VEHICLE","STOCK_BOND","REAL_ESTATE","LIFE_INSURANCE","BURIAL_ACCOUNT","OWNERSHIP_BUSINESS","NONE"); + assertThat(page.getOptionValues("assets")).containsOnly("VEHICLE","STOCK_BOND","REAL_ESTATE","LIFE_INSURANCE","BURIAL_ACCOUNT","OWNERSHIP_BUSINESS","ONE_MILLION_ASSETS","NONE"); } + @Test + void verifyAssetSourcePagesForAll() throws Exception { + completeFlowAssetsTypeAsPerProgram("CERTAIN_POPS","CCAP"); + var page = new FormPage(getPage("assets")); + assertThat(page.getOptionValues("assets")).containsOnly("VEHICLE","STOCK_BOND","REAL_ESTATE","LIFE_INSURANCE","BURIAL_ACCOUNT","OWNERSHIP_BUSINESS","ONE_MILLION_ASSETS","NONE"); + postExpectingRedirect("assets", "assets", List.of("VEHICLE","STOCK_BOND","REAL_ESTATE","LIFE_INSURANCE","BURIAL_ACCOUNT","OWNERSHIP_BUSINESS","ONE_MILLION_ASSETS"), "vehicleAssetSource"); + assertNavigationRedirectsToCorrectNextPage("vehicleAssetSource", "stockAssetSource"); + assertNavigationRedirectsToCorrectNextPage("stockAssetSource", "lifeInsuranceAssetSource"); + assertNavigationRedirectsToCorrectNextPage("lifeInsuranceAssetSource", "burialAccountAssetSource"); + assertNavigationRedirectsToCorrectNextPage("burialAccountAssetSource", "businessOwnershipAssetSource"); + assertNavigationRedirectsToCorrectNextPage("businessOwnershipAssetSource", "realEstateAssetSource"); + assertNavigationRedirectsToCorrectNextPage("realEstateAssetSource", "oneMillionDollarAssetSource"); + + } + + @Test + void verifySavingsIfNoneForAssetsChose() throws Exception { + completeFlowAssetsTypeAsPerProgram("CERTAIN_POPS", "CCAP"); + var page = new FormPage(getPage("assets")); + assertThat(page.getOptionValues("assets")).containsOnly("VEHICLE", "STOCK_BOND", "REAL_ESTATE", + "LIFE_INSURANCE", "BURIAL_ACCOUNT", "OWNERSHIP_BUSINESS", "ONE_MILLION_ASSETS", "NONE"); + postExpectingRedirect("assets", "assets", List.of("None"), "savings"); + } private void completeFlowAssetsTypeAsPerProgram(String... programs) throws Exception { diff --git a/src/test/java/org/codeforamerica/shiba/testutilities/AbstractShibaMockMvcTest.java b/src/test/java/org/codeforamerica/shiba/testutilities/AbstractShibaMockMvcTest.java index 4410f2c59..0b35eaefe 100644 --- a/src/test/java/org/codeforamerica/shiba/testutilities/AbstractShibaMockMvcTest.java +++ b/src/test/java/org/codeforamerica/shiba/testutilities/AbstractShibaMockMvcTest.java @@ -961,9 +961,13 @@ protected FormPage nonExpeditedFlowToSuccessPage(boolean hasHousehold, boolean i "supportAndCare"); postExpectingRedirect("supportAndCare", "supportAndCare", "false", "assets"); postExpectingSuccess("assets", "assets", "REAL_ESTATE"); - assertNavigationRedirectsToCorrectNextPage("assets", "savings"); - - + if (hasHousehold) { + assertNavigationRedirectsToCorrectNextPage("assets", "realEstateAssetSource"); + postExpectingRedirect("realEstateAssetSource", "realEstateAssetSource", me, + "savings"); + } else { + assertNavigationRedirectsToCorrectNextPage("assets", "savings"); + } postExpectingRedirect("savings", "haveSavings", "true", "savingsAmount"); postExpectingRedirect("savingsAmount", "liquidAssets", "1234", "soldAssets"); postExpectingRedirect("soldAssets", "haveSoldAssets", "false", "submittingApplication");