From 89e852f3d1795c2f56c165ae395d6e0a5dd0f806 Mon Sep 17 00:00:00 2001 From: brydon1 Date: Thu, 14 Sep 2023 16:19:56 -0400 Subject: [PATCH 01/16] Adding dupe check to iss flow --- .../site-sub-header/site-sub-header.vue | 2 +- .../contact-details/contact-details.vue | 1 - .../duplicate-check/duplicate-check.spec.js | 0 .../duplicate-check/duplicate-check.vue | 169 ++++++++++++++++++ src/layouts/welcome-page/welcome-page.vue | 1 + src/router/router-constants/issPage-values.js | 1 + src/router/router-constants/routing-table.js | 28 +++ src/store/index.js | 3 +- 8 files changed, 202 insertions(+), 3 deletions(-) create mode 100644 src/layouts/duplicate-check/duplicate-check.spec.js create mode 100644 src/layouts/duplicate-check/duplicate-check.vue diff --git a/src/iss-components/site-sub-header/site-sub-header.vue b/src/iss-components/site-sub-header/site-sub-header.vue index 4cd0af1d..5c604cae 100644 --- a/src/iss-components/site-sub-header/site-sub-header.vue +++ b/src/iss-components/site-sub-header/site-sub-header.vue @@ -16,7 +16,7 @@
+ :class="justifySubheader ">

diff --git a/src/layouts/contact-details/contact-details.vue b/src/layouts/contact-details/contact-details.vue index 6967c2db..184a0a8d 100644 --- a/src/layouts/contact-details/contact-details.vue +++ b/src/layouts/contact-details/contact-details.vue @@ -13,7 +13,6 @@ +

+
+
+ +
+ + + + + +
+
+
+
+ + + + + \ No newline at end of file diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index c1964c7f..4de1f64d 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -337,6 +337,7 @@ export default { this.mainStore.order.serviceLocation.zipCode = policy.insureds?.[0]?.zipCode; // populate vehicles + this.mainStore.order.policy.vehicles = policy.vehicles; this.vehiclesFound = policy.vehicles; } return this.navigateForward(policy); diff --git a/src/router/router-constants/issPage-values.js b/src/router/router-constants/issPage-values.js index d79f748f..7f511089 100644 --- a/src/router/router-constants/issPage-values.js +++ b/src/router/router-constants/issPage-values.js @@ -9,6 +9,7 @@ const issPageValues = Object.freeze({ CAPABILITY_QUESTIONS: 'capability-questions', CONTACT_CONFIRMATION: 'contact-confirmation', CONTACT_DETAILS: 'contact-details', + DUPLICATE_CHECK: 'duplicate-check', ESTIMATE: 'estimate', COVERAGE_STATEMENT: 'coverage-statement', LICENSE_PLATE_LOOKUP: 'license-plate-lookup', diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 0d999da5..df2b492f 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -370,6 +370,34 @@ const routingTable = () => [ } ] }, + { + issPageValue: issPageValues.DUPLICATE_CHECK, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationIssPageValue: issPageValues.WELCOME_PAGE + }, + // TODO confirm all listed scenarios work + { + scenario: navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED, + destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES, + destinationIssPageValue: issPageValues.VEHICLE_SELECTION + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES, + destinationIssPageValue: issPageValues.POLICY_VEHICLES + }, + // if previous claim selected + // unverified => policyholder details + // verified => policy-vehicle page + // new claim + // lookup fails => policyholder details + // lookup succeeds => policy-vehicle page + ] + }, { issPageValue: issPageValues.POLICY_HOLDER_DETAILS, maps: [ diff --git a/src/store/index.js b/src/store/index.js index a2bfbcd7..4c0871da 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -58,7 +58,8 @@ const getDefaultState = () => ({ deductible: { repair: null, // numerical value; how much customer owes on deductible in repair case replace: null // numerical value; how much customer owes on deductible in replace case, - } + }, + vehicles: [] }, customer: { address: { From df8778841078f5dfa517bb6316159b548d17ae8c Mon Sep 17 00:00:00 2001 From: brydon1 Date: Thu, 14 Sep 2023 16:22:15 -0400 Subject: [PATCH 02/16] Reverting space addition --- src/iss-components/site-sub-header/site-sub-header.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iss-components/site-sub-header/site-sub-header.vue b/src/iss-components/site-sub-header/site-sub-header.vue index 5c604cae..4cd0af1d 100644 --- a/src/iss-components/site-sub-header/site-sub-header.vue +++ b/src/iss-components/site-sub-header/site-sub-header.vue @@ -16,7 +16,7 @@
+ :class="justifySubheader">

From abe695952062505b0ef1117503a3587d38250d91 Mon Sep 17 00:00:00 2001 From: brydon1 Date: Thu, 14 Sep 2023 16:23:15 -0400 Subject: [PATCH 03/16] Reverting styling removal --- src/layouts/contact-details/contact-details.vue | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/layouts/contact-details/contact-details.vue b/src/layouts/contact-details/contact-details.vue index 184a0a8d..e236fa14 100644 --- a/src/layouts/contact-details/contact-details.vue +++ b/src/layouts/contact-details/contact-details.vue @@ -13,6 +13,7 @@ Date: Thu, 14 Sep 2023 16:24:02 -0400 Subject: [PATCH 04/16] Accidental removal --- src/layouts/contact-details/contact-details.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/layouts/contact-details/contact-details.vue b/src/layouts/contact-details/contact-details.vue index e236fa14..6967c2db 100644 --- a/src/layouts/contact-details/contact-details.vue +++ b/src/layouts/contact-details/contact-details.vue @@ -196,6 +196,14 @@ export default { * @summary Steps to perform when forward button clicked. */ forwardButtonAction() { + const contactInfo = { + firstName: this.firstName, + lastName: this.lastName, + emailAddress: this.emailAddress, + phoneNumber: this.phoneNumber, + requestTextUpdates: this.requestTextUpdates, + notesForTechnician: this.notesForTechnician + }; useMainStore().updateContactInfo(contactInfo); this.$router.navigate( this.navigationScenarios.CLICKED_FORWARD, From ad4d360fd3b69077a5525fc49d1f91fc6df5c566 Mon Sep 17 00:00:00 2001 From: brydon1 Date: Thu, 14 Sep 2023 16:25:37 -0400 Subject: [PATCH 05/16] Removing comments --- src/router/router-constants/routing-table.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index df2b492f..57c0d666 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -377,7 +377,6 @@ const routingTable = () => [ scenario: navigationScenarios.CLICKED_BACK, destinationIssPageValue: issPageValues.WELCOME_PAGE }, - // TODO confirm all listed scenarios work { scenario: navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED, destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS @@ -389,13 +388,7 @@ const routingTable = () => [ { scenario: navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES, destinationIssPageValue: issPageValues.POLICY_VEHICLES - }, - // if previous claim selected - // unverified => policyholder details - // verified => policy-vehicle page - // new claim - // lookup fails => policyholder details - // lookup succeeds => policy-vehicle page + } ] }, { From 509496b59a672dcfa21bac33fe012a8fe038fcd8 Mon Sep 17 00:00:00 2001 From: brydon1 Date: Fri, 15 Sep 2023 11:12:16 -0400 Subject: [PATCH 06/16] Adding some dupe check tests --- .../duplicate-check/duplicate-check.spec.js | 209 ++++++++++++++++++ .../duplicate-check/duplicate-check.vue | 3 +- .../router-constants/navigation-scenarios.js | 1 + src/router/router-constants/routing-table.js | 4 + 4 files changed, 216 insertions(+), 1 deletion(-) diff --git a/src/layouts/duplicate-check/duplicate-check.spec.js b/src/layouts/duplicate-check/duplicate-check.spec.js index e69de29b..691e9088 100644 --- a/src/layouts/duplicate-check/duplicate-check.spec.js +++ b/src/layouts/duplicate-check/duplicate-check.spec.js @@ -0,0 +1,209 @@ +// Components +import duplicateCheck from '@/layouts/duplicate-check/duplicate-check.vue'; + +// Supporting Files +import { shallowMount } from '@vue/test-utils'; +import { getMountOptions } from '@/helpers/unit-test-helper.js'; +import { getRandomString, getRandomInt, getRandomBoolean } from '@/helpers/data-generation.js'; +import { createTestingPinia } from '@pinia/testing'; +import navigationScenarios from '@/router/router-constants/navigation-scenarios.js'; +import { useMainStore } from '@/store/index.js'; + +describe('duplicateCheck.vue', () => { + describe('Rendering', () => { + test('Should render site header', () => { + // Arrange + const wrapper = shallowMount(duplicateCheck, getMountOptions()); + + // Act + const siteHeader = wrapper.findComponent({ ref: 'siteHeader' }); + + // Assert + expect(siteHeader.exists()).toBeTruthy(); + }); + test('Should render sub title', () => { + // Arrange + const wrapper = shallowMount(duplicateCheck, getMountOptions()); + + // Act + const siteSubHeader = wrapper.findComponent({ ref: 'siteSubHeader' }); + + // Assert + expect(siteSubHeader.exists()).toBeTruthy(); + }); + test('Should render question subcomponent', () => { + // Arrange + const wrapper = shallowMount(duplicateCheck, getMountOptions()); + + // Act + const question = wrapper.findComponent({ ref: 'buttonQuestion' }); + + // Assert + expect(question.exists()).toBeTruthy(); + }); + test('Should render site footer', () => { + // Arrange + const wrapper = shallowMount(duplicateCheck, getMountOptions()); + + // Act + const footer = wrapper.findComponent({ ref: 'siteFooter' }); + + // Assert + expect(footer.exists()).toBeTruthy(); + }); + + // TODO update or remove + // test('Mocked store with no contact info yields expected data', () => { + // // Arrange + // const mountOptions = getMountOptions(); + + // const firstName = getRandomString(4, 15); + // const lastName = getRandomString(4, 15); + // const emailAddress = getRandomString(10, 20); + // const phoneNumber = getRandomInt(1000000000, 9999999999); + // const mainInitialState = { + // order: { + // customer: { + // firstName, + // lastName, + // emailAddress, + // phoneNumber + // } + // } + // }; + // mountOptions.global = { + // plugins: [createTestingPinia({ + // initialState: { + // main: mainInitialState + // } + // })] + // }; + + // const wrapper = shallowMount(contactDetails, mountOptions); + + // // Assert + // expect(wrapper.vm.firstName).toBe(firstName); + // expect(wrapper.vm.lastName).toBe(lastName); + // expect(wrapper.vm.emailAddress).toBe(emailAddress); + // expect(wrapper.vm.phoneNumber).toBe(phoneNumber); + // }); + // test('Mock store with contact info yields expected data', () => { + // // Arrange + // const customer = { + // firstName: getRandomString(4, 15), + // lastName: getRandomString(4, 15), + // emailAddress: getRandomString(10, 20), + // phoneNumber: getRandomInt(1000000000, 9999999999) + // }; + // const contactInfo = { + // firstName: getRandomString(4, 15), + // lastName: getRandomString(4, 15), + // emailAddress: getRandomString(10, 20), + // phoneNumber: getRandomInt(1000000000, 9999999999), + // requestTextUpdates: getRandomBoolean(), + // notesForTechnician: getRandomString(50, 100) + // }; + // const mainInitialState = { + // order: { + // customer, + // contactInfo + // } + // }; + // const mountOptions = getMountOptions(); + // mountOptions.global = { + // plugins: [createTestingPinia({ + // initialState: { + // main: mainInitialState + // } + // })] + // }; + + // const wrapper = shallowMount(contactDetails, mountOptions); + + // // Assert + // expect(wrapper.vm.firstName).toBe(contactInfo.firstName); + // expect(wrapper.vm.lastName).toBe(contactInfo.lastName); + // expect(wrapper.vm.emailAddress).toBe(contactInfo.emailAddress); + // expect(wrapper.vm.phoneNumber).toBe(contactInfo.phoneNumber); + // expect(wrapper.vm.requestTextUpdates).toBe(contactInfo.requestTextUpdates); + // expect(wrapper.vm.notesForTechnician).toBe(contactInfo.notesForTechnician); + // }); + }); + + describe('Navigation', () => { + test('Back button clicked triggers navigation', () => { + // Arrange + const wrapper = shallowMount(duplicateCheck, getMountOptions({ + router: { + navigate: jest.fn() + } + })); + + // Act + wrapper.vm.backButtonAction(); + + // Assert + expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigate) + .toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK, undefined); + }); + + + // TODO finish forward tests + // test('Forward button clicked triggers navigation', () => { + // // Arrange + // const wrapper = shallowMount(contactDetails, getMountOptions({ + // router: { + // navigate: jest.fn() + // } + // })); + + // // Act + // wrapper.vm.forwardButtonAction(); + + // // Assert + // expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + // expect(wrapper.vm.$router.navigate) + // .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD, undefined); + // }); + // test('Forward button click updates contact info', () => { + // // Arrange + // const mountOptions = getMountOptions({ + // router: { + // navigate: jest.fn() + // }, + // global: { + // plugins: [createTestingPinia()] + // } + // }); + // const wrapper = shallowMount(contactDetails, mountOptions); + // const firstName = getRandomString(4, 15); + // const lastName = getRandomString(4, 15); + // const emailAddress = getRandomString(10, 20); + // const phoneNumber = getRandomInt(1000000000, 9999999999); + // const requestTextUpdates = getRandomBoolean(); + // const notesForTechnician = getRandomString(1, 100); + // wrapper.setData({ + // firstName, + // lastName, + // emailAddress, + // phoneNumber, + // requestTextUpdates, + // notesForTechnician + // }); + + // // Act + // wrapper.vm.forwardButtonAction(); + + // // Assert + // expect(useMainStore().updateContactInfo).toHaveBeenCalledWith({ + // firstName, + // lastName, + // emailAddress, + // phoneNumber, + // requestTextUpdates, + // notesForTechnician + // }); + // }); + }); +}); \ No newline at end of file diff --git a/src/layouts/duplicate-check/duplicate-check.vue b/src/layouts/duplicate-check/duplicate-check.vue index b9f357c3..9046d155 100644 --- a/src/layouts/duplicate-check/duplicate-check.vue +++ b/src/layouts/duplicate-check/duplicate-check.vue @@ -18,6 +18,7 @@ :cmsWidgetName="widget.siteSubHeader" /> [ scenario: navigationScenarios.CLICKED_FORWARD, destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITH_DUPLICATES, + destinationIssPageValue: issPageValues.DUPLICATE_CHECK + }, { scenario: navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED, destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS From a8ddd811e35505abb0a00797041c2f9bb96583eb Mon Sep 17 00:00:00 2001 From: brydon1 Date: Fri, 15 Sep 2023 15:59:58 -0400 Subject: [PATCH 07/16] Finalizing dupe check addition to welcome page --- .../duplicate-check/duplicate-check.vue | 44 ++++++++++--------- .../policy-vehicles/policy-vehicles.vue | 3 +- src/layouts/welcome-page/welcome-page.vue | 37 +++++++++++++--- src/store/index.js | 19 +++++++- src/styles/ux-variables.scss | 15 +++---- 5 files changed, 80 insertions(+), 38 deletions(-) diff --git a/src/layouts/duplicate-check/duplicate-check.vue b/src/layouts/duplicate-check/duplicate-check.vue index 9046d155..3ba0f5eb 100644 --- a/src/layouts/duplicate-check/duplicate-check.vue +++ b/src/layouts/duplicate-check/duplicate-check.vue @@ -90,24 +90,28 @@ export default { return this.getCmsContent(this.widget.existingOrNewQuestion, 'QuestionText'); }, answersFromCms() { - return this.getCmsContent(this.widget.existingOrNewQuestion, 'Answers'); + return this.getCmsContent(this.widget.existingOrNewQuestion, 'Answers') ?? []; }, - testAnswers() { - return [ - { - Text: 'Finish Existing Claim', - Name: "1", - SubText: "2013 Honda Civic, 09/23/2023" - }, - { - Text: 'Finish Existing Claim', - Name: "2", - SubText: "08/01/2022" - } - ]; + duplicateOrders() { + const duplicateOrderText = 'Finish Existing Claim'; + const orders = useMainStore().applicationUser.duplicateOrders; + return orders.map(o => { + const vehicle = !!o.vehicleYear && !!o.vehicleMake && !!o.vehicleModel + ? `${o.vehicleYear} ${o.vehicleMake} ${o.vehicleModel}` + : null; + const subtext = !!vehicle + ? `${vehicle}, ${o.dateOfLoss}` + : o.dateOfLoss; + + return { + Text: duplicateOrderText, + Name: o.referralNumber, + SubText: subtext + }; + }); }, - answers(){ - return [...this.testAnswers, this.answersFromCms]; + answers() { + return [...this.duplicateOrders, ...this.answersFromCms]; } }, methods: { @@ -131,7 +135,7 @@ export default { {}, policyVehicles ); - } else {policyVehicles + } else { this.$router.navigate( this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES, this.$route @@ -150,7 +154,7 @@ export default {