From ffebba8652894128df9f0c17a761678ea4679b2b Mon Sep 17 00:00:00 2001 From: Katie Date: Wed, 7 Sep 2022 16:48:08 -0400 Subject: [PATCH 01/37] Update tests for estimate --- src/layouts/estimate/estimate.spec.js | 125 ++++++++++++++++++++------ 1 file changed, 96 insertions(+), 29 deletions(-) diff --git a/src/layouts/estimate/estimate.spec.js b/src/layouts/estimate/estimate.spec.js index a24bc22b7..271e2fda5 100644 --- a/src/layouts/estimate/estimate.spec.js +++ b/src/layouts/estimate/estimate.spec.js @@ -42,7 +42,7 @@ describe("estimate.vue", () => { const { wrapper } = setupMocks({}); //Act - store.commit( storeMutations.UPDATE_IS_REPAIR, true ); + store.commit(storeMutations.UPDATE_IS_REPAIR, true); let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); @@ -55,29 +55,13 @@ describe("estimate.vue", () => { const { wrapper } = setupMocks({}); //Act - store.commit( storeMutations.UPDATE_IS_REPAIR, true ); + store.commit(storeMutations.UPDATE_IS_REPAIR, true); let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); //Assert expect(arePagePrerequisitesValid).toBe(true); }); - test.todo("isRepair is false and there are no lineItems => should return false") - test.todo("isRepair is false and lineItems is null => should return false") - test.todo("isRepair is false are there are lineItems => should return true") - test("isRepair is set to null, arePagePrerequisitesValid should return false", async () => { - - //Arrange - const { wrapper } = setupMocks({}); - - //Act - store.commit( storeMutations.UPDATE_IS_REPAIR, null ); - - let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); - - //Assert - expect(arePagePrerequisitesValid).toBe(false); - }); test("After selecting provide my home address on ForwardButtonAction triggers a router.navigateWithSaving", async () => { @@ -132,20 +116,103 @@ describe("estimate.vue", () => { test("Provide my license plate on ForwardButtonAction triggers a router.navigateWithSaving", async () => { - //Arrange - const { wrapper } = setupMocks({}); - await wrapper.setData({ - selectedVinLookupMethod: vinLookupMethodSelections.LICENSEPLATE - }) - - //Act - wrapper.vm.forwardButtonAction(); - - //Assert - expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled(); + //Arrange + const { wrapper } = setupMocks({}); + await wrapper.setData({ + selectedVinLookupMethod: vinLookupMethodSelections.LICENSEPLATE + }) + + //Act + wrapper.vm.forwardButtonAction(); + + //Assert + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled(); }); + describe("arePagePrerequisitesValid", () => { + beforeEach(() => { + store.commit(storeMutations.UPDATE_IS_REPAIR, false); + store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, null); + }) + + test("isRepair is false and there are no glassToReplace => should return false", () => { + // Arrange + const { wrapper } = setupMocks({}); + store.commit(storeMutations.UPDATE_IS_REPAIR, false); + store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, []); + + // Act + let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); + + // Assert + expect(arePagePrerequisitesValid).toBe(false); + }) + + test("isRepair is false and glassToReplace is null => should return false", () => { + // Arrange + const { wrapper } = setupMocks({}); + store.commit(storeMutations.UPDATE_IS_REPAIR, false); + store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, null); + + // Act + let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); + + // Assert + expect(arePagePrerequisitesValid).toBe(false); + }) + + test("isRepair is false are there is one glassToReplace => should return true", () => { + // Arrange + const { wrapper } = setupMocks({}); + store.commit(storeMutations.UPDATE_IS_REPAIR, false); + store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, [{glassLocation: "TEST", glassName: "NAME"}]); + + // Act + let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); + + // Assert + expect(arePagePrerequisitesValid).toBe(true); + }) + + test("isRepair is false are there are multiple glassToReplace => should return true", () => { + // Arrange + const { wrapper } = setupMocks({}); + store.commit(storeMutations.UPDATE_IS_REPAIR, false); + store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, [{glassLocation: "TEST1", glassName: "NAME1"}, {glassLocation: "TEST2", glassName: "NAME2"}, {glassLocation: "TEST3", glassName: "NAME3"}]); + + // Act + let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); + + // Assert + expect(arePagePrerequisitesValid).toBe(true); + }) + + test("isRepair is set to null => arePagePrerequisitesValid should return false", async () => { + // Arrange + const { wrapper } = setupMocks({}); + store.commit(storeMutations.UPDATE_IS_REPAIR, null); + + // Act + console.log(store.getters.damage) + let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); + + // Assert + expect(arePagePrerequisitesValid).toBe(false); + }); + + test("isRepair is set to true => arePagePrerequisitesValid should return true", async () => { + // Arrange + const { wrapper } = setupMocks({}); + store.commit(storeMutations.UPDATE_IS_REPAIR, true); + + // Act + let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); + + // Assert + expect(arePagePrerequisitesValid).toBe(true); + }); + }) }); function setupMocks({ From 3cb31dcd5990bc79c8f5e20307bd2c3836063c3b Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Thu, 8 Sep 2022 17:34:17 -0400 Subject: [PATCH 02/37] CSR-818: fix accessibility for greyed out button --- src/common-components/funnel-footer/funnel-footer.vue | 2 +- src/ux-components/button-main/button-main.vue | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/common-components/funnel-footer/funnel-footer.vue b/src/common-components/funnel-footer/funnel-footer.vue index 2c4152cfa..ddb81b531 100644 --- a/src/common-components/funnel-footer/funnel-footer.vue +++ b/src/common-components/funnel-footer/funnel-footer.vue @@ -9,7 +9,6 @@ :buttonText="buttonText" loaderColor="white" :class="isForwardActionDisabled && 'form-test-invalid'" - :aria-disabled="isForwardActionDisabled" :isDisabled="isForwardActionDisabled" @click-event="buttonClick" data-bs-target="#footerModal" @@ -85,6 +84,7 @@ export default { }; }, buttonClick() { + if (this.isForwardActionDisabled) { return false } //prevent keyboard input after button click document.onkeydown = function (e) { return false; diff --git a/src/ux-components/button-main/button-main.vue b/src/ux-components/button-main/button-main.vue index 8396351f8..345dbbe0f 100644 --- a/src/ux-components/button-main/button-main.vue +++ b/src/ux-components/button-main/button-main.vue @@ -1,6 +1,5 @@ \ No newline at end of file diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 1b163ef30..b5e4265bc 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -46,6 +46,14 @@ /> +
+
+ +
+
+
+
+ +
+
Date: Tue, 13 Sep 2022 09:25:51 -0400 Subject: [PATCH 08/37] fixed remaining merge conflict --- .../text-block/text-block.vue.orig | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/common-components/text-block/text-block.vue.orig diff --git a/src/common-components/text-block/text-block.vue.orig b/src/common-components/text-block/text-block.vue.orig new file mode 100644 index 000000000..33d81d43c --- /dev/null +++ b/src/common-components/text-block/text-block.vue.orig @@ -0,0 +1,41 @@ + + + + + +======= + +>>>>>>> d1bf013... fixed remaining merge conflict From c0da21419e0f18d03051b5eaa893fa41451fde8c Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 13 Sep 2022 08:56:36 -0400 Subject: [PATCH 09/37] Added quote email message to estimate page and changed top / bottom margins to more accurately reflect Figma --- src/common-components/text-block/text-block.vue | 2 +- .../customer-questions/customer-questions.vue | 2 +- src/layouts/estimate/estimate.vue | 16 +++++++++++++++- .../license-plate-lookup.vue | 4 ++-- src/layouts/vin-lookup/vin-lookup.vue | 4 ++-- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/common-components/text-block/text-block.vue b/src/common-components/text-block/text-block.vue index 26f57d665..f8d14cd44 100644 --- a/src/common-components/text-block/text-block.vue +++ b/src/common-components/text-block/text-block.vue @@ -1,5 +1,5 @@ diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index b5e4265bc..90a447258 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -36,7 +36,7 @@ /> -
+
-
+
-
+
-
+
Date: Tue, 13 Sep 2022 13:13:07 -0400 Subject: [PATCH 10/37] Add more tests --- jest.config.js | 3 +- .../vehicle-style/vehicle-style.spec.js | 115 +++++++++++++----- src/layouts/vehicle-style/vehicle-style.vue | 8 +- src/layouts/vin-lookup/vin-lookup.spec.js | 46 +++++-- src/layouts/vin-lookup/vin-lookup.vue | 6 + src/router/index.js | 2 + src/store/store.spec.js | 45 +++++++ 7 files changed, 178 insertions(+), 47 deletions(-) diff --git a/jest.config.js b/jest.config.js index d9da86118..b47bb3e56 100644 --- a/jest.config.js +++ b/jest.config.js @@ -25,8 +25,7 @@ module.exports = { testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"], coverageThreshold: { global: { - // TODO after release/2022.09.15, raise this back up!! - statements: 80, + statements: 90, // Got the go ahead from Mark to temporarily lower this. Taking out initialize component made the year,make,model and style coverage drop a bit. Once unit tests for license plate lookup, vin lookup and address lookup are in the coverage should go back up to 90 }, }, diff --git a/src/layouts/vehicle-style/vehicle-style.spec.js b/src/layouts/vehicle-style/vehicle-style.spec.js index 1dd3a6774..e97b14882 100644 --- a/src/layouts/vehicle-style/vehicle-style.spec.js +++ b/src/layouts/vehicle-style/vehicle-style.spec.js @@ -10,6 +10,9 @@ import { getMountOptions } from "@/helpers/unit-test-helper.js"; import { storeActions } from "@/constants/store-actions"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import baseMixin from "@/mixins/base-mixin.js"; +import router from "@/router" +import store from "@/store" +import { storeMutations } from "@/constants/store-mutations"; // Mock our module for promises. jest.mock("@/helpers/layout-helper.js", () => ({ @@ -21,25 +24,16 @@ jest.mock("@/helpers/cms-content-helper", () => ({ fetchCmsContentForPage: jest.fn(), })); -// Mock Store -jest.mock("@/store", () => ({ - getters: { - vehicle: { - model: "TL", - }, - applicationUser:{ - pageData: { - "part-questions": null, - "vehicle-make": {}, - "vehicle-model": {}, - "vehicle-style": {}, - "vehicle-damage": {} - } - } - }, +// Mock fetchCmsContentForPage +jest.mock("@/router", () => ({ + overrideNavigation: jest.fn(), })); describe("vehicle-style.vue", () => { + beforeEach(() => { + jest.clearAllMocks(); + }) + test("Style question component is initized with api data", async (done) => { //Arrange const styleQuestionInitialData = ["2 Door", "4 Door"]; @@ -63,9 +57,7 @@ describe("vehicle-style.vue", () => { done(); }); }); -}); -describe("vehicle-style.vue", () => { test("BackButtonAction triggers a router.navigateWithoutSaving change", async (done) => { //Arrange const { wrapper, apiPromise } = setupMocks({ @@ -95,20 +87,12 @@ describe("vehicle-style.vue", () => { done(); }); }); -}); -describe("vehicle-style.vue", () => { - test("selectVehicle triggers a dispatchStoreAction commit", async (done) => { + test("setVehicle triggers a dispatchStoreAction commit", async (done) => { //Arrange const { wrapper, apiPromise } = setupMocks({ pageHeaderWidgetHeaderText: "Select a style to get started", mountOptionsMockData: { - store: { - commit: jest.fn(), - getters: { - vehicle: {}, - }, - }, actionList: [ { actionName: storeActions.SET_VEHICLE, @@ -134,9 +118,7 @@ describe("vehicle-style.vue", () => { done(); }); }); -}); -describe("vehicle-style.vue", () => { test("Model set, arePagePrerequisitesValid should be true ", async () => { //Arrange const { wrapper } = setupMocks({}); @@ -155,7 +137,61 @@ describe("vehicle-style.vue", () => { //Assert expect(arePagePrerequisitesValid).toBe(true); }); + + test("there is only one vehicle style => autoselect and move to vehicle damage", async () => { + //Arrange + const { wrapper } = setupMocks({ + styleQuestionInitialData: ["2 door sedan"], + }); + + // Act + await vehicleStyle.beforeRouteEnter.call( + wrapper.vm, + { query: { fmgPage: "vehicle-style" } }, + undefined, + (c) => c(wrapper.vm) + ); + + // Assert + expect(store.commit).toHaveBeenCalledWith(storeMutations.UPDATE_STYLE, "2 door sedan"); + expect(router.overrideNavigation).toHaveBeenCalled(); + }) + + test("there is only one vehicle style and vehicle-damage was visited => don't autoselect or move to vehicle damage", async () => { + //Arrange + const { wrapper } = setupMocks({ + styleQuestionInitialData: ["2 door sedan"], + mountOptionsMockData: { + store: { + getters: { + applicationUser: { + pageData: { + "part-questions": null, + "vehicle-make": {}, + "vehicle-model": {}, + "vehicle-style": {}, + "vehicle-damage": {} + } + } + } + } + } + }); + + // Act + await vehicleStyle.beforeRouteEnter.call( + wrapper.vm, + { query: { fmgPage: "vehicle-style" } }, + undefined, + (c) => c(wrapper.vm) + ); + + // Assert + expect(store.commit).not.toHaveBeenCalledWith(storeMutations.UPDATE_STYLE, "2 door sedan"); + expect(router.overrideNavigation).not.toHaveBeenCalled(); + }) }); + function setupMocks({ vehicleStyleQuestionCmsContent = {}, styleQuestionInitialData = {}, @@ -190,7 +226,26 @@ function setupMocks({ initializeComponent: jest.fn(), }; - const mountOptions = getMountOptions(mountOptionsMockData); + store.commit = jest.fn(); + store.dispatch = jest.fn(); + store.getters = mountOptionsMockData.store?.getters ?? { + vehicle: { + model: "TL", + }, + applicationUser: { + pageData: { + "part-questions": null, + "vehicle-make": {}, + "vehicle-model": {}, + "vehicle-style": {}, + } + } + } + + const mountOptions = getMountOptions({ + ...mountOptionsMockData, + store + }); const wrapper = shallowMount(vehicleStyle, mountOptions); wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent; diff --git a/src/layouts/vehicle-style/vehicle-style.vue b/src/layouts/vehicle-style/vehicle-style.vue index 5d700e183..4a31c06cc 100644 --- a/src/layouts/vehicle-style/vehicle-style.vue +++ b/src/layouts/vehicle-style/vehicle-style.vue @@ -26,6 +26,7 @@ - - -======= - ->>>>>>> d1bf013... fixed remaining merge conflict From ff6a45e6e420a311444f7b5a03f3b4acc3b34945 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 13 Sep 2022 17:11:52 -0400 Subject: [PATCH 15/37] CSR-835 Update list-button-horizontal, getPartsOrQuestions call --- src/store/index.js | 2 +- .../list-button-horizontal/list-button-horizontal.vue | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 0a57a82a3..dd2a59683 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -717,7 +717,7 @@ export const actions = { endpoint: endpoints.GetPartsOrQuestions.url, payload: { carId: carId, - glass: glassArray, + glass: glassArray ?? [], zip: zipCode, vin: vin }, diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue index 7011835b9..84d9c715b 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -14,7 +14,6 @@ :name="groupName" :value="value" :aria-required="isRequired" - v-model="checkValue" :checked="checkValue" @change="handleInputChange()" /> @@ -91,7 +90,7 @@ export default { if (Array.isArray(this.selectedValues)) { this.checkValue = this.isMultiSelect ? this.selectedValues.includes(this.value) - : this.selectedValues[0]; + : this.selectedValues[0] == this.value; } }, methods: { From 4c2fbba29eb6fe79803565f9d830ffb9f51fb026 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 13 Sep 2022 19:00:20 -0400 Subject: [PATCH 16/37] CSR-385 Fix list-button-horizontal --- .../list-button-horizontal/list-button-horizontal.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue index 84d9c715b..94bd59534 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -12,8 +12,8 @@ :type="isMultiSelect ? 'checkbox' : 'radio'" :id="buttonID" :name="groupName" - :value="value" :aria-required="isRequired" + v-model="checkValue" :checked="checkValue" @change="handleInputChange()" /> From d8fa80bbe1de272768692a5329c1c90198d5c0f1 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 13 Sep 2022 19:08:26 -0400 Subject: [PATCH 17/37] CSR-835 Fix broken test --- .../list-button-horizontal/list-button-horizontal.spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js b/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js index 5c288f660..08aaad712 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js @@ -211,11 +211,12 @@ describe("list-button-horizontal.vue", () => { isWide: false, modelValue: ["List Card Checkbox"], isMultiSelect: false, + value: "Car-Front", selectedValues: ["Car-Front"] }, }); // Assert - expect(wrapper.componentVM.checkValue).toEqual("Car-Front"); + expect(wrapper.vm.checkValue).toEqual(true); }); it("Should run handleCheckChange if selectingInitiatesLoad is false and handleInputChange is triggered", async () => { From 9d6b829cb174f08d6c8c62ad147404c2001a8d7e Mon Sep 17 00:00:00 2001 From: Mark Harris Date: Wed, 14 Sep 2022 08:04:21 -0400 Subject: [PATCH 18/37] trying to fix repair-chips --- src/common-components/button-question/button-question.vue | 7 ++++++- .../windshield-chip-count-question.vue | 3 ++- src/store/index.js | 8 +++++++- .../list-button-horizontal/list-button-horizontal.vue | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue index 6a235ef8a..2f7d3e0a1 100644 --- a/src/common-components/button-question/button-question.vue +++ b/src/common-components/button-question/button-question.vue @@ -173,11 +173,16 @@ export default { if(this.selectingInitiatesLoad) { this.selectedValues = val.value; } else { - if(Array.isArray(this.selectedValues)) { + if(this.isMultiSelect) { const newSelectedValues = this.selectedValues; val.checkValue ? newSelectedValues.push(val.value) : newSelectedValues.splice(newSelectedValues.indexOf(val.value), 1); this.selectedValues = newSelectedValues; } + else if (Array.isArray(this.selectedValues)) { + this.selectedValues[0] = val.value; + const temp = this.selectedValues; + this.selectedValues = temp; + } else { this.selectedValues = val.value; } diff --git a/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue b/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue index 25d273eca..31a681857 100644 --- a/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue +++ b/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue @@ -47,7 +47,8 @@ export default ({ return this.modelValue; }, set: function(newValue) { - this.$emit("update:modelValue", newValue); + const numberValue = Number(newValue); + this.$emit("update:modelValue", numberValue); } }, }, diff --git a/src/store/index.js b/src/store/index.js index dd2a59683..95dd63ef7 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -942,8 +942,14 @@ export const actions = { .slice() .sort() .every((obj, index) => obj.glassLocation === selectedGlassPassedInSorted[index].glassLocation && obj.glassName === selectedGlassPassedInSorted[index].glassName); + const isWindshieldRepairTheSame = isWindshieldRepair === context.state.order.damage.isRepair; + const isChipCountTheSame = Array.isArray(selectedWindshieldChipCount) //TODO: fix the underlying components so this is never an array + ? selectedWindshieldChipCount[0] === context.state.order.damage.numberOfChips + : selectedWindshieldChipCount === context.state.order.damage.numberOfChips; - if (!isGlassToReplaceTheSame) { + const isDamageChanging = !isGlassToReplaceTheSame || !isWindshieldRepairTheSame || (isWindshieldRepair && !isChipCountTheSame); + + if (isDamageChanging) { //Reset dependent state when changing context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue index 94bd59534..c037cb3b7 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -122,7 +122,7 @@ export default { handleCheckChange() { const emitEvent = { checkValue: this.checkValue, // only read on checkboxes, on handleCheckedChanged on button-question - value: this.value.toString(), + value: this.value, buttonId: this.buttonID && this.buttonID.toString(), }; From 9078221bb7ec56842643dcdc50ab12c356a1ead2 Mon Sep 17 00:00:00 2001 From: Katie Date: Wed, 14 Sep 2022 10:49:34 -0400 Subject: [PATCH 19/37] Change coverage threshold --- jest.config.js | 2 +- src/layouts/vin-lookup/vin-lookup.spec.js | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/jest.config.js b/jest.config.js index b47bb3e56..84fbadf00 100644 --- a/jest.config.js +++ b/jest.config.js @@ -25,7 +25,7 @@ module.exports = { testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"], coverageThreshold: { global: { - statements: 90, + statements: 85, // Got the go ahead from Mark to temporarily lower this. Taking out initialize component made the year,make,model and style coverage drop a bit. Once unit tests for license plate lookup, vin lookup and address lookup are in the coverage should go back up to 90 }, }, diff --git a/src/layouts/vin-lookup/vin-lookup.spec.js b/src/layouts/vin-lookup/vin-lookup.spec.js index 1d373b2d5..76819d4ce 100644 --- a/src/layouts/vin-lookup/vin-lookup.spec.js +++ b/src/layouts/vin-lookup/vin-lookup.spec.js @@ -218,19 +218,6 @@ describe("vin-lookup.vue", () => { expect(wrapper.vm.displayInvalidZipAlert).toEqual(true); expect(wrapper.findComponent({ref: "alertInvalidZip"}).exists()).toBe(true); }) - - test("Vin not found => show AlertVinNotFoundWidget", async () => { - // Arrange - const { wrapper } = setupMocks({}); - mockOutPromises({}); - - // Act - await wrapper.vm.forwardButtonAction(); - - // Assert - expect(wrapper.vm.displayVinNotFoundAlert).toEqual(true); - expect(wrapper.findComponent({cmsWidgetName: "AlertVinNotFoundWidget"}).exists()).toBe(true); - }) }) }); From a50c2220ed04a47e8ec3753749b48873998d6435 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 15 Sep 2022 08:30:34 -0400 Subject: [PATCH 20/37] CSR-779 remove promise settle from mixin --- src/layouts/estimate/estimate.vue | 5 ++--- src/layouts/vin-lookup/vin-lookup.vue | 13 ++++++++----- src/mixins/base-mixin.js | 19 +++++-------------- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index e003348bd..f38d6b77d 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -181,13 +181,13 @@ export default { state: zipCodeData.state, }, false); - if (!zipCodeData.isZipValid) { + if (!zipCodeData.isValid) { this.displayInvalidZipAlert = true; return this.$refs.funnelFooter.removeLoader(); } this.displayInvalidZipAlert = false; - if (!zipCodeData.isZipServiceable) { + if (!zipCodeData.isServiceable) { this.displayNonServiceableZipAlert = true; return this.$refs.funnelFooter.removeLoader(); } @@ -220,7 +220,6 @@ export default { }, computed: { AlertNonServiceableZipHeader(){ - console.log(this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText")); return this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", this.serviceZipCode); }, AlertNonServiceableZipBody(){ diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index ff0e97f66..0118d8d67 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -238,13 +238,16 @@ export default { resultKey: "vehicleLookupResponse", promise: vehicleLookupResponse, }, + { + resultKey: "zipCodeData", + promise: this.getZipCodeData(this.serviceZipCode) + } ]; const resultMap = await settleAllPromises(promiseResultMap); - const zipCodeData = await this.getZipCodeData(this.serviceZipCode); // If a Service Zip is entered and it is an invalid zip code (ex. 11111) then show an alert - const isZipValid = zipCodeData.isValid; + const isZipValid = resultMap.zipCodeData.isValid; if (this.serviceZipCode && !isZipValid) { this.displayInvalidZipAlert = true; return this.$refs.funnelFooter.removeLoader(); @@ -252,14 +255,14 @@ export default { this.displayInvalidZipAlert = false; // If either lookup fails, remove the loader and stop processing the page. - if (!resultMap.vehicleLookupResponse || !zipCodeData.isServiceable) { + if (!resultMap.vehicleLookupResponse || !resultMap.zipCodeData.isServiceable) { // If the vehicle result is undefined, the vin entered was invalid. if(!resultMap.vehicleLookupResponse) { this.displayVinNotFoundAlert = true; } // Check if Service Zip entered is serviceable, if not display an alert - if (!zipCodeData.isServiceable) { + if (!resultMap.zipCodeData.isServiceable) { this.displayNonServiceableZipAlert = true; } @@ -293,7 +296,7 @@ export default { await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false); await this.dispatchStoreAction(storeActions.SAVE_SERVICE_LOCATION, { zipCode: this.serviceZipCode, - state: zipCodeData.state, + state: resultMap.zipCodeData.state, }, false); return await this.navigateForward(); diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index b19b458da..f175c61b8 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -49,21 +49,12 @@ export default { return footerInfoBox ? footerInfoBox.offsetHeight : 0; }, async getZipCodeData(zipCode) { - const serviceZipValidationResponse = this.dispatchStoreAction(storeActions.VALIDATE_ZIP, { zip: zipCode }); - - const promiseResultMap = [ - { - resultKey: "serviceZipValidationResponse", - promise: serviceZipValidationResponse, - } - ]; - - const resultMap = await settleAllPromises(promiseResultMap); - + const serviceZipValidationResponse = await this.dispatchStoreAction(storeActions.VALIDATE_ZIP, { zip: zipCode }); + return { - isZipValid: resultMap.serviceZipValidationResponse.isValid, - isZipServiceable: resultMap.serviceZipValidationResponse.isServiceable, - state: resultMap.serviceZipValidationResponse.state + isValid: serviceZipValidationResponse.data.isValid, + isServiceable: serviceZipValidationResponse.data.isServiceable, + state: serviceZipValidationResponse.data.state }; } }, From cafb8d898d01578080930dadfcb80bb46ee33845 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 15 Sep 2022 11:40:40 -0400 Subject: [PATCH 21/37] add zipcode data to api responses to fix tests --- src/layouts/vin-lookup/vin-lookup.spec.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/layouts/vin-lookup/vin-lookup.spec.js b/src/layouts/vin-lookup/vin-lookup.spec.js index d0d20a531..4f917c47e 100644 --- a/src/layouts/vin-lookup/vin-lookup.spec.js +++ b/src/layouts/vin-lookup/vin-lookup.spec.js @@ -226,6 +226,9 @@ function mockOutPromises(carId = 'C00000') { const apiResponses = { vehicleLookupResponse: { carId: carId + }, + zipCodeData: { + isValid: true, isServiceable: true, state: "OH" } }; From e7bc1f7ecc5f44af232ae3f8c432b24da3104a5a Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 15 Sep 2022 13:37:34 -0400 Subject: [PATCH 22/37] CSR-779 - match mock data to promise data --- src/mixins/base-mixin.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mixins/base-mixin.spec.js b/src/mixins/base-mixin.spec.js index 9c7ebcd90..6009dd67c 100644 --- a/src/mixins/base-mixin.spec.js +++ b/src/mixins/base-mixin.spec.js @@ -99,7 +99,7 @@ describe("baseMixin.js", () => { test("getZipCodeData calls dispatch", () => { const mixIn = getMixInInstance({}); mixIn.methods.dispatchStoreAction = jest.fn(); - mixIn.methods.dispatchStoreAction.mockReturnValue({ isValid:true, isServiceable:true, state:"OH" }); + mixIn.methods.dispatchStoreAction.mockReturnValue({data: { isValid:true, isServiceable:true, state:"OH" }}); const type = ""; const payload = { zip: 43015 }; From 200dcd12e42eab0c642e068e54ab48e042bddefc Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 16 Sep 2022 10:38:29 -0400 Subject: [PATCH 23/37] Fixed some issues with the logic in arePagePrerequisitesValid --- src/layouts/quote/quote.vue | 6 ++---- src/router/index.js | 5 ----- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 75f4454c5..fc8abe92b 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -75,10 +75,8 @@ export default { }, methods: { arePagePrerequisitesValid() { - if (store.getters.order.damage.isRepair || store.getters.order.lineItems.glassParts.length > 0) { - return true; - } - return false; + store.getters.order.lineItems.glassParts = []; + return store.getters.order.damage.isRepair || (store.getters.order.lineItems?.glassParts != null && store.getters.order.lineItems.glassParts.length > 0); } }, computed: { diff --git a/src/router/index.js b/src/router/index.js index 7684e9f90..6983356fd 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -25,11 +25,6 @@ import { applicationConfig } from "../constants/application-config"; import quote from "@/layouts/quote/quote.vue"; const routes = [ - { - path: "/quote", // This is a temporary route for testing. - name: "quote", - component: quote, - }, { path: "/", name: "root", From 197cd207142fee8840d6c957dfe13a6ed7ba598c Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 16 Sep 2022 10:40:19 -0400 Subject: [PATCH 24/37] Fixed some issues with the logic in arePagePrerequisitesValid 2 --- src/layouts/quote/quote.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index fc8abe92b..62d2aa2f8 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -75,7 +75,6 @@ export default { }, methods: { arePagePrerequisitesValid() { - store.getters.order.lineItems.glassParts = []; return store.getters.order.damage.isRepair || (store.getters.order.lineItems?.glassParts != null && store.getters.order.lineItems.glassParts.length > 0); } }, From 8e39c6d2f1bcb075b21f79fcff239e208cbe8c26 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 16 Sep 2022 13:52:08 -0400 Subject: [PATCH 25/37] CSR-779 repair button text --- src/layouts/estimate/estimate.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index f38d6b77d..faf2c8ed6 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -151,6 +151,18 @@ export default { ]; const resultMap = await settleAllPromises(promiseResultMap); next((vm) => { + if (resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText.includes("|")) + { + const forwardTextOption = resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText.split("|"); + if (store.getters.damage.isRepair){ + resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText = forwardTextOption[1] + } + else + { + resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText = forwardTextOption[0] + } + } + vm.setCmsContent(resultMap.cmsContent); }); }, From 40d790bc7ec4d2c71517044781650f82dab5459a Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 16 Sep 2022 14:56:26 -0400 Subject: [PATCH 26/37] add footer to cmscontent --- src/layouts/estimate/estimate.spec.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/layouts/estimate/estimate.spec.js b/src/layouts/estimate/estimate.spec.js index 1843670ec..f8d962543 100644 --- a/src/layouts/estimate/estimate.spec.js +++ b/src/layouts/estimate/estimate.spec.js @@ -166,6 +166,7 @@ function setupMocks({ groupName = "estimate", cmsQuestionText = "Let's get your VIN. Or we can look it up for you!", cmsAnswers = [{ Name: "Provide my VIN manually Most specific to your vehicle" }, { Name: "Provide my license plate # Most accurate VIN match" }, { Name: "Provide my home address Most convenient VIN match" }], + funnelFooterWidget = { ForwardButtonText: "test txt" }, mountOptionsMockData = { router: { navigate: jest.fn(), @@ -179,11 +180,13 @@ function setupMocks({ const cmsContent = { groupName: groupName, QuestionText: cmsQuestionText, - Answers: cmsAnswers + Answers: cmsAnswers, + FunnelFooterWidget: funnelFooterWidget }; - const apiPromise = Promise.resolve(cmsContent); + const apiPromise = Promise.resolve({ cmsContent }); settleAllPromises.mockImplementation(() => apiPromise); + //fetchCmsContentForPage.mockImplementation(() => {reultMap: } cmsContent); fetchCmsContentForPage.mockImplementation(() => Promise.resolve()); const mountOptions = getMountOptions({ ...mountOptionsMockData, mixins: [baseMixin] }); From fa103191885ba19f0071c8f27758964eaade2ab7 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 16 Sep 2022 15:10:22 -0400 Subject: [PATCH 27/37] CSR-779 remove comment --- src/layouts/estimate/estimate.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/estimate/estimate.spec.js b/src/layouts/estimate/estimate.spec.js index f8d962543..476b8cdff 100644 --- a/src/layouts/estimate/estimate.spec.js +++ b/src/layouts/estimate/estimate.spec.js @@ -186,8 +186,8 @@ function setupMocks({ const apiPromise = Promise.resolve({ cmsContent }); settleAllPromises.mockImplementation(() => apiPromise); - //fetchCmsContentForPage.mockImplementation(() => {reultMap: } cmsContent); fetchCmsContentForPage.mockImplementation(() => Promise.resolve()); + const mountOptions = getMountOptions({ ...mountOptionsMockData, mixins: [baseMixin] }); mountOptions['attachTo'] = document.body; From dd7005d19a7357b680c06a4ba74054317e77c3cb Mon Sep 17 00:00:00 2001 From: FrankRua Date: Fri, 16 Sep 2022 15:16:09 -0400 Subject: [PATCH 28/37] remove cf distro --- azure-pipelines.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 207c013be..373fecf4e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -171,7 +171,6 @@ stages: indexDeployVariables: __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) - cfDistributionId: $(cfDistributionId) - template: templates/digital/auto-tag.yml@AzureDevOps parameters: userName: SafeliteAzureDevops From 421e94338af7a4094d89c56520ccf4d5210f835e Mon Sep 17 00:00:00 2001 From: FrankRua Date: Fri, 16 Sep 2022 15:23:40 -0400 Subject: [PATCH 29/37] removed from QA by mistake --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 373fecf4e..0ff6c34c2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -86,7 +86,6 @@ stages: indexDeployVariables: __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) - cfDistributionId: $(cfDistributionId) # QA Build/Deploy @@ -171,6 +170,7 @@ stages: indexDeployVariables: __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) + cfDistributionId: $(cfDistributionId) - template: templates/digital/auto-tag.yml@AzureDevOps parameters: userName: SafeliteAzureDevops From 0b9a1802f316db6bd9871b44b3e966c86d333665 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Fri, 16 Sep 2022 15:25:33 -0400 Subject: [PATCH 30/37] updated local variable for now --- vue.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vue.config.js b/vue.config.js index 6ddcd54de..5db4c307b 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,5 +1,5 @@ process.env.VUE_APP_CONSUMER_CF_DISTRO = - "https://consumerapidev.safelite.com"; + "https://consumerapialbdev.safelite.com"; process.env.VUE_APP_HERITAGE_FUNNEL = "http://localhost:38000/default.aspx"; process.env.VUE_APP_GOOGLE_PLACES_API_KEY = From 143a00e315a79e304e0223beaf5d224d4addfd86 Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Mon, 19 Sep 2022 13:06:10 -0400 Subject: [PATCH 31/37] CSR-848 *Put all package variation modal on test Quote page. *Fix font color. *Fix text wrap on cash/insurance button. *Re-add router info for test page. --- src/common-components/modal/modal.vue | 7 +- .../text-block/text-block.vue | 2 +- src/layouts/quote/quote.vue | 70 +++++++++++++++++++ src/router/index.js | 7 +- .../list-button-horizontal.vue | 8 ++- .../radio-service-package.vue | 14 +++- 6 files changed, 103 insertions(+), 5 deletions(-) diff --git a/src/common-components/modal/modal.vue b/src/common-components/modal/modal.vue index 1352fa2f2..8c36cc5ea 100644 --- a/src/common-components/modal/modal.vue +++ b/src/common-components/modal/modal.vue @@ -6,7 +6,7 @@ From 73b625f4dafd2dd8f6af1bf48a6d61f5593c398b Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 20 Sep 2022 06:06:26 -0400 Subject: [PATCH 32/37] Switch DNS to new Digital API DNS --- vue.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vue.config.js b/vue.config.js index 5db4c307b..1b9cf7b00 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,5 +1,5 @@ process.env.VUE_APP_CONSUMER_CF_DISTRO = - "https://consumerapialbdev.safelite.com"; + "https://digitalapi.dev.sagaws.net"; process.env.VUE_APP_HERITAGE_FUNNEL = "http://localhost:38000/default.aspx"; process.env.VUE_APP_GOOGLE_PLACES_API_KEY = From 24f5e0b8bd24e87f1202ba8170babbfd60522f66 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 20 Sep 2022 06:09:00 -0400 Subject: [PATCH 33/37] Added invalidation back --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0ff6c34c2..1ded09677 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -86,7 +86,7 @@ stages: indexDeployVariables: __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) - + cfDistributionId: $(cfDistributionId) # QA Build/Deploy - stage: Qa From 23e9e5f83827893e7bdcde0cb4d9a3d3be3e5ac9 Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Tue, 20 Sep 2022 11:25:19 -0400 Subject: [PATCH 34/37] CSR-848 Adjust padding on container and button to match Figma. --- src/common-components/modal/modal.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common-components/modal/modal.vue b/src/common-components/modal/modal.vue index 8c36cc5ea..e11424d07 100644 --- a/src/common-components/modal/modal.vue +++ b/src/common-components/modal/modal.vue @@ -3,13 +3,13 @@