From e2f624b4b4fbe808532749af78cd803a1a3df221 Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Fri, 13 Feb 2026 17:12:23 -0500 Subject: [PATCH 1/4] INSR-7774: Skip vehicle-lookup if not windshield replacement --- src/layouts/vehicle-damage/vehicle-damage.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 265ad56a..5fac4f61 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -216,6 +216,13 @@ export default { === damageLocationsSelected.REPAIR ); }, + isWindshieldReplace() { + return ( + this.isWindshieldDamageLocation + && this.selectedWindshieldOptions.selectedWindshieldDamageType + === damageLocationsSelected.REPLACE + ); + }, isDriverSideReplace() { if (!this.isSideDoorDamageLocation) return false; @@ -418,7 +425,7 @@ export default { this.navigationScenarios.CLICKED_FORWARD_WITH_REPAIR, this.$route ); - } else if (this.mainStore.order.vehicle.vin) { + } else if (this.mainStore.order.vehicle.vin || !this.isWindshieldReplace) { // If vin already exists, navigate directly to vin-lookup const partsOrQuestionsResponse = await this.getPartsOrQuestions(); From 916f56a50e08b7c5e50e11c2b6044cb90129cbed Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Fri, 13 Feb 2026 17:27:28 -0500 Subject: [PATCH 2/4] INSR-8455: Skip vehicle-lookup on back navigation when appropriate --- src/helpers/damage-helper.js | 9 +++++++++ src/mixins/vehicle-questions-mixin.js | 3 +++ src/router/router-constants/navigation-scenarios.js | 1 + src/router/router-constants/routing-table.js | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/src/helpers/damage-helper.js b/src/helpers/damage-helper.js index 7083d7c0..be5d5370 100644 --- a/src/helpers/damage-helper.js +++ b/src/helpers/damage-helper.js @@ -90,6 +90,15 @@ export function getGlassList(glassPieces) { return names.toLowerCase(); } +export function includesWindshieldReplacement() { + const mainStore = useMainStore(); + const windshieldMatches = + mainStore.damage.glassToReplace?.filter( + (glassToReplace) => glassToReplace.glassLocation === damageLocationsSelected.WINDSHIELD + ) ?? []; + return windshieldMatches.length > 0; +} + /** * Commented code are copied directly from DigitalConsumer.FixMyGlass * and have not been adjusted for ISS. diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index b92bb837..d5c492d8 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -1,3 +1,4 @@ +import { includesWindshieldReplacement } from '@/helpers/damage-helper'; import issPageValues from '@/router/router-constants/issPage-values'; import navigationScenarios from '@/router/router-constants/navigation-scenarios'; import { useMainStore } from '@/store'; @@ -457,6 +458,8 @@ export default { let backNavigationScenario = ''; if (self.mainStore.order.damage.isRepair) { backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_REPAIR; + } else if (!includesWindshieldReplacement()) { + backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_SKIP_VIN_AND_NO_MORE_QUESTIONS; } else { backNavigationScenario = self.mainStore.vehicle.vin ? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index 6f17494d..d6fba845 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -61,6 +61,7 @@ const navigationScenarios = Object.freeze({ CLICKED_BACK_WITH_MOLDING_QUESTIONS: 'CLICKED_BACK_WITH_MOLDING_QUESTIONS', CLICKED_BACK_WITH_CAPABILITY_QUESTIONS: 'CLICKED_BACK_WITH_CAPABILITY_QUESTIONS', CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS: 'CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS', + CLICKED_BACK_WITH_SKIP_VIN_AND_NO_MORE_QUESTIONS: 'CLICKED_BACK_WITH_SKIP_VIN_AND_NO_MORE_QUESTIONS', CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS: 'CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS', // Schedule diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index c3075d3f..eec16cf3 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -536,6 +536,10 @@ const routingTable = () => [ scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS, destinationIssPageValue: issPageValues.VEHICLE_DAMAGE }, + { + scenario: navigationScenarios.CLICKED_BACK_WITH_SKIP_VIN_AND_NO_MORE_QUESTIONS, + destinationIssPageValue: issPageValues.VEHICLE_DAMAGE + }, { scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS, destinationIssPageValue: issPageValues.VEHICLE_LOOKUP From d3f0598bc59c73b42c88bebefa45fc727e41368e Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Mon, 16 Feb 2026 10:14:44 -0500 Subject: [PATCH 3/4] INSR-8455: Add some tests, fix others --- .../vehicle-damage/vehicle-damage.spec.js | 50 ++++++++++- .../vehicle-parts/vehicle-parts.spec.js | 2 + src/mixins/vehicle-questions-mixin.spec.js | 89 ++++++++++++++++--- 3 files changed, 128 insertions(+), 13 deletions(-) diff --git a/src/layouts/vehicle-damage/vehicle-damage.spec.js b/src/layouts/vehicle-damage/vehicle-damage.spec.js index 42c4ed6b..db8ae50d 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.spec.js +++ b/src/layouts/vehicle-damage/vehicle-damage.spec.js @@ -5,6 +5,7 @@ import routerParams from '@/router/router-constants/router-params'; import { useMainStore } from '@/store'; import vehicleCategories from '@/constants/vehicle-categories'; import VehicleDamageComponent from '@/layouts/vehicle-damage/vehicle-damage.vue'; +import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin'; const mockRoute = { params: {} @@ -12,6 +13,16 @@ const mockRoute = { const mockRouter = { navigate: jest.fn() }; +jest.mock('@/mixins/vehicle-questions-mixin', () => ({ + methods: { + navigateForward: jest.fn(), + getPartsOrQuestions: jest.fn(() => Promise.resolve({ + data: { + partsOrQuestions: [] + } + })) + } +})); const mountOptions = { global: { mixins: [ @@ -91,6 +102,43 @@ describe('vehicle-damage.vue', () => { expect(mockRouter.navigate) .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_REPAIR, mockRoute); }); + test('When damage selected is a replace but not windshield, navigate forward from vehicle-questions-mixin', async () => { + mountOptions.global.plugins = [createTestingPinia({ + initialState: { + main: { + order: { + damage: { + isRepair: false, + glassToReplace: [{ glassLocation: 'Rear', glassName: 'Stationary' }] + } + } + } + } + })]; + const wrapper = mount(VehicleDamageComponent, mountOptions); + const siteFooterWrapper = wrapper.getComponent({ ref: 'siteFooter' }); + + useMainStore().getSupportingItems = jest.fn().mockImplementation(() => Promise.resolve({ + data: { data: [ + { + description: null, + partNumber: 'SUPPLIES-REPAIR', + partType: 'REPAIR FEE' + }, + { + description: null, + partNumber: 'WSREPAIR', + partType: 'REPAIR FEE' + } + ] } + })); + + siteFooterWrapper.vm.$emit('forwardClicked'); + + await flushPromises(); + expect(vehicleQuestionsMixin.methods.getPartsOrQuestions).toHaveBeenCalledTimes(1); + expect(vehicleQuestionsMixin.methods.navigateForward).toHaveBeenCalledTimes(1); + }); test('Error in getPartsOrQuestions call => bailout true and navigate forward with CLICKED_FORWARD_WITH_BAILOUT scenario', async () => { mountOptions.global.plugins = [createTestingPinia({ initialState: { @@ -115,7 +163,7 @@ describe('vehicle-damage.vue', () => { const partsQuestionsErrorResponse = { error: 'Error getting parts' }; - useMainStore().getPartsOrQuestions = jest.fn().mockImplementation(() => ( + vehicleQuestionsMixin.methods.getPartsOrQuestions.mockImplementation(() => ( partsQuestionsErrorResponse )); siteFooterWrapper.vm.$emit('forwardClicked'); diff --git a/src/layouts/vehicle-parts/vehicle-parts.spec.js b/src/layouts/vehicle-parts/vehicle-parts.spec.js index e05f2298..909bf57c 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.spec.js +++ b/src/layouts/vehicle-parts/vehicle-parts.spec.js @@ -212,6 +212,7 @@ describe('vehicle-parts.vue', () => { test('User had part questions > navigateBack triggers a router.navigateWithoutSaving change with correct scenario', async () => { // Arrange + useMainStore().damage.glassToReplace = [{ glassLocation: 'Rear', glassName: 'Stationary' }, { glassLocation: 'Windshield', glassName: 'Single' }]; const { wrapper } = setupMocks({ mountOptionsMockData: { router: { @@ -244,6 +245,7 @@ describe('vehicle-parts.vue', () => { test('User did not have part questions > navigateBack triggers a router.navigate change with correct scenario', async () => { // Arrange + useMainStore().damage.glassToReplace = [{ glassLocation: 'Rear', glassName: 'Stationary' }, { glassLocation: 'Windshield', glassName: 'Single' }]; const { wrapper } = setupMocks({ mountOptionsMockData: { router: { diff --git a/src/mixins/vehicle-questions-mixin.spec.js b/src/mixins/vehicle-questions-mixin.spec.js index 5efde63c..a878e09f 100644 --- a/src/mixins/vehicle-questions-mixin.spec.js +++ b/src/mixins/vehicle-questions-mixin.spec.js @@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils'; import { setupMocksForJsFiles, getMountOptions } from '@/helpers/unit-test-helper.js'; import issPageValues from '@/router/router-constants/issPage-values'; import navigationScenarios from '@/router/router-constants/navigation-scenarios'; -import { useMainStore } from '@/store'; +import { useMainStore, getDefaultState } from '@/store'; /** @ignore */ function setupMocks({ issPage = issPageValues.VIN_LOOKUP }) { @@ -53,6 +53,7 @@ function setupMocks({ issPage = issPageValues.VIN_LOOKUP }) { describe('vehicle-questions-mixin', () => { afterEach(() => { jest.clearAllMocks(); + useMainStore().order = getDefaultState().order; }); describe('hasPartQuestions', () => { @@ -2181,19 +2182,83 @@ describe('vehicle-questions-mixin', () => { }); describe('navigateBackByVehicleQuestions', () => { - test('current page is coverage-statement and damage is repair => go to vehicle-damage', () => { - // Arrange - const { wrapper } = setupMocks({ issPage: issPageValues.COVERAGE_STATEMENT }); - useMainStore().order.damage.isRepair = true; + describe('current page is coverage-statement', () => { + test('damage is repair => go to vehicle-damage', () => { + // Arrange + const { wrapper } = setupMocks({ issPage: issPageValues.COVERAGE_STATEMENT }); + useMainStore().order.damage.isRepair = true; - // Act - wrapper.vm.navigateBackByVehicleQuestions(); + // Act + wrapper.vm.navigateBackByVehicleQuestions(); - // Assert - expect(wrapper.vm.$router.navigateWithSpinner).toHaveBeenCalledWith( - navigationScenarios.CLICKED_BACK_WITH_REPAIR, - { query: { issPage: issPageValues.COVERAGE_STATEMENT } } - ); + // Assert + expect(wrapper.vm.$router.navigateWithSpinner).toHaveBeenCalledWith( + navigationScenarios.CLICKED_BACK_WITH_REPAIR, + { query: { issPage: issPageValues.COVERAGE_STATEMENT } } + ); + }); + test('damage is replace but not windshield => go to vehicle-damage', () => { + // Arrange + const { wrapper } = setupMocks({ issPage: issPageValues.COVERAGE_STATEMENT }); + useMainStore().order.damage.isRepair = false; + useMainStore().order.damage.glassToReplace = [{ glassLocation: 'Rear', glassName: 'Stationary' }]; + + // Act + wrapper.vm.navigateBackByVehicleQuestions(); + + // Assert + expect(wrapper.vm.$router.navigateWithSpinner).toHaveBeenCalledWith( + navigationScenarios.CLICKED_BACK_WITH_SKIP_VIN_AND_NO_MORE_QUESTIONS, + { query: { issPage: issPageValues.COVERAGE_STATEMENT } } + ); + }); + test('damage is replace and includes windshield, we have vin => go to vehicle-damage', () => { + // Arrange + const { wrapper } = setupMocks({ issPage: issPageValues.COVERAGE_STATEMENT }); + useMainStore().order.damage.isRepair = false; + useMainStore().order.damage.glassToReplace = [{ glassLocation: 'Rear', glassName: 'Stationary' }, { glassLocation: 'Windshield', glassName: 'Single' }]; + useMainStore().order.vehicle.vin = '5NMS3CADXLH233004'; + + // Act + wrapper.vm.navigateBackByVehicleQuestions(); + + // Assert + expect(wrapper.vm.$router.navigateWithSpinner).toHaveBeenCalledWith( + navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS, + { query: { issPage: issPageValues.COVERAGE_STATEMENT } } + ); + }); + test('damage is replace and includes windshield => go to vehicle-lookup', () => { + // Arrange + const { wrapper } = setupMocks({ issPage: issPageValues.COVERAGE_STATEMENT }); + useMainStore().order.damage.isRepair = false; + useMainStore().order.damage.glassToReplace = [{ glassLocation: 'Rear', glassName: 'Stationary' }, { glassLocation: 'Windshield', glassName: 'Single' }]; + + // Act + wrapper.vm.navigateBackByVehicleQuestions(); + + // Assert + expect(wrapper.vm.$router.navigateWithSpinner).toHaveBeenCalledWith( + navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS, + { query: { issPage: issPageValues.COVERAGE_STATEMENT } } + ); + }); + test('damage is replace and includes windshield but there are parts to choose => go to vehicle-parts', () => { + // Arrange + const { wrapper } = setupMocks({ issPage: issPageValues.COVERAGE_STATEMENT }); + useMainStore().order.damage.isRepair = false; + useMainStore().order.damage.glassToReplace = [{ glassLocation: 'Rear', glassName: 'Stationary' }, { glassLocation: 'Windshield', glassName: 'Single' }]; + wrapper.vm.hasGlassLocationWithMultipleParts = jest.fn().mockReturnValue(true); + + // Act + wrapper.vm.navigateBackByVehicleQuestions(); + + // Assert + expect(wrapper.vm.$router.navigateWithSpinner).toHaveBeenCalledWith( + navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE, + { query: { issPage: issPageValues.COVERAGE_STATEMENT } } + ); + }); }); test( From b6b5212638be0a438ad58dd87f05bf5e28494931 Mon Sep 17 00:00:00 2001 From: AHumphriesSL Date: Mon, 16 Feb 2026 10:17:06 -0500 Subject: [PATCH 4/4] Update misleading comment Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/layouts/vehicle-damage/vehicle-damage.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 5fac4f61..b486f90e 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -426,7 +426,7 @@ export default { this.$route ); } else if (this.mainStore.order.vehicle.vin || !this.isWindshieldReplace) { - // If vin already exists, navigate directly to vin-lookup + // If vin already exists or not replacing windshield, get parts/questions and navigate forward const partsOrQuestionsResponse = await this.getPartsOrQuestions(); if (partsOrQuestionsResponse.error) {