Merge pull request #1018 from Safelite/feature/INSR-8119

INSR-8119: Fixed issue with backward navigation from policy holder details when unverified.
This commit is contained in:
Jeremy-Z 2026-01-21 14:46:43 -05:00 committed by GitHub
commit fdc643dc57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 134 additions and 26 deletions

View file

@ -127,7 +127,7 @@ describe('navigation', () => {
expect(wrapper.vm.navigateForward).toHaveBeenCalled(); expect(wrapper.vm.navigateForward).toHaveBeenCalled();
}); });
test('if the coverage policy verified navigate forward to policy-vehicle page', async () => { test('if the coverage policy verified navigate forward to vehicle damage page', async () => {
// Arrange // Arrange
const mockRegistrationAddress = { const mockRegistrationAddress = {
streetAddress: '1234 Main St', streetAddress: '1234 Main St',
@ -135,14 +135,6 @@ describe('navigation', () => {
state: 'OH', state: 'OH',
zipCode: '43215' zipCode: '43215'
}; };
const mockvehicles = [
{
vin: 'TEST_VIN'
},
{
vin: 'TEST_VIN2'
}
];
const { wrapper } = setupMocks(); const { wrapper } = setupMocks();
@ -152,13 +144,12 @@ describe('navigation', () => {
customerQuestions: { customerQuestions: {
addressQuestions: mockRegistrationAddress addressQuestions: mockRegistrationAddress
}, },
isCoverageEnabled: true, isCoverageEnabled: true
vehiclesCount: 2,
vehiclesFound: mockvehicles
}); });
useMainStore().order.policy.policyNumber = 'p_0001'; useMainStore().order.policy.policyNumber = 'p_0001';
useMainStore().order.policy.dateOfLoss = '2022-01-28'; useMainStore().order.policy.dateOfLoss = '2022-01-28';
useMainStore().order.vehicle.policyVehicleId = 0;
// Act // Act
@ -167,10 +158,111 @@ describe('navigation', () => {
// Assert // Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith( expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED, navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED,
undefined, undefined
{}, );
{}, });
mockvehicles
test('if the coverage policy unverified navigate forward to vehicle damage page', async () => {
// Arrange
const mockRegistrationAddress = {
streetAddress: '1234 Main St',
city: 'Columbus',
state: 'OH',
zipCode: '43215'
};
const { wrapper } = setupMocks();
await wrapper.setData({
firstName: 'KK',
lastName: 'KK',
customerQuestions: {
addressQuestions: mockRegistrationAddress
},
isCoverageEnabled: true
});
useMainStore().order.policy.policyNumber = 'p_0001';
useMainStore().order.policy.dateOfLoss = '2022-01-28';
useMainStore().order.vehicle.policyVehicleId = null;
// Act
await wrapper.vm.forwardButtonAction();
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
undefined
);
});
test('if the coverage policy verified navigate back to welcome page', async () => {
// Arrange
const mockRegistrationAddress = {
streetAddress: '1234 Main St',
city: 'Columbus',
state: 'OH',
zipCode: '43215'
};
const { wrapper } = setupMocks();
await wrapper.setData({
firstName: 'KK',
lastName: 'KK',
customerQuestions: {
addressQuestions: mockRegistrationAddress
},
isCoverageEnabled: true
});
useMainStore().order.policy.policyNumber = 'p_0001';
useMainStore().order.policy.dateOfLoss = '2022-01-28';
useMainStore().order.vehicle.policyVehicleId = 0;
// Act
await wrapper.vm.backButtonAction();
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_BACK_POLICY_VERIFIED,
undefined
);
});
test('if the coverage policy unverified navigate back to vehicle-selection page', async () => {
// Arrange
const mockRegistrationAddress = {
streetAddress: '1234 Main St',
city: 'Columbus',
state: 'OH',
zipCode: '43215'
};
const { wrapper } = setupMocks();
await wrapper.setData({
firstName: 'KK',
lastName: 'KK',
customerQuestions: {
addressQuestions: mockRegistrationAddress
},
isCoverageEnabled: true
});
useMainStore().order.policy.policyNumber = 'p_0001';
useMainStore().order.policy.dateOfLoss = '2022-01-28';
useMainStore().order.vehicle.policyVehicleId = null;
// Act
await wrapper.vm.backButtonAction();
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_BACK_POLICY_UNVERIFIED,
undefined
); );
}); });
}); });

View file

@ -78,7 +78,7 @@
cmsWidgetName="SiteFooterWidget" cmsWidgetName="SiteFooterWidget"
:isForwardActionDisabled="!meta.valid" :isForwardActionDisabled="!meta.valid"
@ForwardClicked="forwardButtonAction" @ForwardClicked="forwardButtonAction"
@backClicked="navigateBack" /> @backClicked="backButtonAction" />
</div> </div>
</div> </div>
</div> </div>
@ -138,7 +138,6 @@ export default {
data() { data() {
return { return {
customerQuestions: this.getPolicyHolderDetailsFromStore(), customerQuestions: this.getPolicyHolderDetailsFromStore(),
vehiclesFound: [],
rules: { rules: {
firstName: globalRules.POLICYHOLDER_FIRST_NAME_REQUIRED, firstName: globalRules.POLICYHOLDER_FIRST_NAME_REQUIRED,
lastName: globalRules.POLICYHOLDER_LAST_NAME_REQUIRED, lastName: globalRules.POLICYHOLDER_LAST_NAME_REQUIRED,
@ -152,8 +151,8 @@ export default {
isCoverageEnabled() { isCoverageEnabled() {
return this.mainStore.issConfig.isCoverageEnabled; return this.mainStore.issConfig.isCoverageEnabled;
}, },
vehiclesCount() { isPolicyVehicleSelected() {
return this.vehiclesFound.length; return (this.mainStore.order.vehicle.policyVehicleId != null && this.mainStore.order.vehicle.policyVehicleId >= 0);
} }
}, },
methods: { methods: {
@ -163,13 +162,10 @@ export default {
}, },
navigateForward() { navigateForward() {
if (this.vehiclesCount > 0) { if (this.isPolicyVehicleSelected) {
this.$router.navigate( this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED, this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED,
this.$route, this.$route
{},
{},
this.vehiclesFound
); );
} else { } else {
this.$router.navigate( this.$router.navigate(
@ -179,6 +175,20 @@ export default {
} }
}, },
backButtonAction() {
if (this.isPolicyVehicleSelected) {
this.$router.navigate(
this.navigationScenarios.CLICKED_BACK_POLICY_VERIFIED,
this.$route
);
} else {
this.$router.navigate(
this.navigationScenarios.CLICKED_BACK_POLICY_UNVERIFIED,
this.$route
);
}
},
getPolicyHolderDetailsFromStore() { getPolicyHolderDetailsFromStore() {
return { return {
addressQuestions: { addressQuestions: {

View file

@ -27,6 +27,8 @@ const navigationScenarios = Object.freeze({
// Policy Holder Details // Policy Holder Details
CLICKED_FORWARD_POLICY_VERIFIED: 'CLICKED_FORWARD_POLICY_VERIFIED', CLICKED_FORWARD_POLICY_VERIFIED: 'CLICKED_FORWARD_POLICY_VERIFIED',
CLICKED_BACK_POLICY_UNVERIFIED: 'CLICKED_BACK_POLICY_UNVERIFIED',
CLICKED_BACK_POLICY_VERIFIED: 'CLICKED_BACK_POLICY_VERIFIED',
// Policy Vehicle // Policy Vehicle
CLICKED_FORWARD_LISTED_VEHICLE: 'CLICKED_FORWARD_LISTED_VEHICLE', CLICKED_FORWARD_LISTED_VEHICLE: 'CLICKED_FORWARD_LISTED_VEHICLE',

View file

@ -451,7 +451,11 @@ const routingTable = () => [
issPageValue: issPageValues.POLICY_HOLDER_DETAILS, issPageValue: issPageValues.POLICY_HOLDER_DETAILS,
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK, scenario: navigationScenarios.CLICKED_BACK_POLICY_UNVERIFIED,
destinationIssPageValue: issPageValues.VEHICLE_SELECTION
},
{
scenario: navigationScenarios.CLICKED_BACK_POLICY_VERIFIED,
destinationIssPageValue: issPageValues.WELCOME_PAGE destinationIssPageValue: issPageValues.WELCOME_PAGE
}, },
{ {