From 768191ea1abba338dd600ed92c27383d12e11fb7 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 2 May 2022 12:30:46 -0400 Subject: [PATCH 01/66] Omitting unneeded api parts call and adding unit tests --- jest.config.js | 1 - src/helpers/damage-helper.js | 19 +++++- src/helpers/damage-helper.spec.js | 59 ++++++++++--------- .../license-plate-lookup.vue | 40 +++++-------- 4 files changed, 65 insertions(+), 54 deletions(-) diff --git a/jest.config.js b/jest.config.js index d010bda25..dc59735c2 100644 --- a/jest.config.js +++ b/jest.config.js @@ -11,7 +11,6 @@ module.exports = { "!src/constants/*.js", "!src/router/**/*.js", "!src/helpers/unit-test-helper.js", - "!src/helpers/damage-helper.js", "!src/layouts/component-test/component-test.vue", "!src/layouts/form-test/form-test.vue", "!src/layouts/vin-lookup/vin-lookup.vue", diff --git a/src/helpers/damage-helper.js b/src/helpers/damage-helper.js index 453aadf69..49c7cd59c 100644 --- a/src/helpers/damage-helper.js +++ b/src/helpers/damage-helper.js @@ -3,7 +3,24 @@ import baseMixin from "@/mixins/base-mixin.js"; import { storeActions } from "@/constants/store-actions"; export function getDamageString() { - return store.getters.damage.glassToReplace.length > 1 ? "match" : store.getters.damage.glassToReplace[0].location; + const damageLocations = store.getters.damage.glassToReplace; + let returnString; + if(damageLocations.length > 1){ + returnString = "match" + } else { + switch(damageLocations[0].location) { + case "Windshield": + returnString = "windshield" + break; + case "Driver": + case "Passenger": + returnString = "side window" + break; + case "Rear": + returnString = "rear window" + } + } + return returnString; } export async function isGlassAvailableForCarId(carId){ diff --git a/src/helpers/damage-helper.spec.js b/src/helpers/damage-helper.spec.js index abc8defe2..e0a9f71cc 100644 --- a/src/helpers/damage-helper.spec.js +++ b/src/helpers/damage-helper.spec.js @@ -1,42 +1,47 @@ import {getDamageString, isGlassAvailableForCarId} from "./damage-helper"; -//import baseMixin from "@/mixins/base-mixin.js"; +import baseMixin from "@/mixins/base-mixin.js"; jest.mock("@/store", () => ({ getters: {damage: { glassToReplace: [{location: "Windshield", name: "windshield"}] } } - })); +})); describe("damage-helper.js", () => { it("Should return damage getter info", () => { const damage = getDamageString(); - expect(damage).toEqual("Windshield") + expect(damage).toEqual("windshield") }); }); - // describe("damage-helper.js", () => { - // it("Should return false if no mismatches between each array", async () => { - // const updatedOptions = { - // data: { - // windshieldOptions: {availableReplacementOptions: ["windshield"]} - // } - // } - // baseMixin.methods.dispatchNonBlockingStoreAction = jest.fn().mockImplementation(()=> { - // return updatedOptions; - // }); - // const misMatch = await isGlassAvailableForCarId(); - // expect(misMatch).toEqual(false); - // }); - // }); + describe("damage-helper.js", () => { + it("Should return true if no mismatches between each array exist", async () => { + const updatedOptions = { + data: { + windshieldOptions: {availableReplacementOptions: ["windshield"]} + } + } + baseMixin.methods.dispatchNonBlockingStoreAction = jest.fn().mockImplementation(()=> { + return updatedOptions; + }); + const misMatch = await isGlassAvailableForCarId(); + expect(misMatch).toEqual(true); + }); + }); + + describe("damage-helper.js", () => { + it("Should return false if any mismatches between each array exist", async () => { + const updatedOptions = { + data: { + windshieldOptions: {availableReplacementOptions: ["Crack"]} + } + } + baseMixin.methods.dispatchNonBlockingStoreAction = jest.fn().mockImplementation(()=> { + return updatedOptions; + }); + const misMatch = await isGlassAvailableForCarId(); + expect(misMatch).toEqual(false); + }); + }); - // describe("damage-helper.js", () => { - // it("Should return true if there are any mismatches between arrays", () => { - // const newOptions = { - // windshieldOptions: {availableReplacementOptions: ["window"]} - // } - // const currentOptions = [{location: "Windshield", name: "windshield"}]; - // const misMatch = compareGlassOptions(newOptions, currentOptions); - // expect(misMatch).toEqual(true); - // }); - // }); \ 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 f9f0cb41c..da227d794 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -128,22 +128,22 @@ export default { }; }, computed: { - MatchedDifferentVehicleAlertHeader(){ + MatchedDifferentVehicleAlertHeader() { let text = this.getCmsContent("MatchedDifferentVehicleAlertWidget", "HeadlineText").replaceAll("{custom:damage}", getDamageString()); return text; }, - MatchedDifferentVehicleAlertBody(){ + MatchedDifferentVehicleAlertBody() { let text = this.getCmsContent("MatchedDifferentVehicleAlertWidget", "BodyText").replaceAll("{custom:damage}", getDamageString()).replaceAll("{custom:plateLookupYear}", this.customAlertData?.vehicleInfo?.year).replaceAll("{custom:plateLookupMake}", this.customAlertData?.vehicleInfo?.make).replaceAll("{custom:plateLookupModel}", this.customAlertData?.vehicleInfo?.model); return text; }, - NoServiceZipHeader(){ + NoServiceZipHeader() { let text = this.getCmsContent("NoServiceZipWidget", "HeadlineText").replaceAll("{custom:zip}", this.registrationZip); return text; }, - NoServiceZipBody(){ + NoServiceZipBody() { return this.getCmsContent("NoServiceZipWidget", "BodyText"); }, }, @@ -158,16 +158,16 @@ export default { store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, null); store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); }, - getLicensePlateFromStore(){ + getLicensePlateFromStore() { return store.getters.vehicle.registration.licensePlate }, - getRegistrationZipFromStore(){ + getRegistrationZipFromStore() { return store.getters.vehicle.registration.zipCode }, - getEmailFromStore(){ + getEmailFromStore() { return store.getters.order.customer.emailAddress }, - getServiceZipFromStore(){ + getServiceZipFromStore() { return store.getters.order.serviceLocation.zip }, backButtonAction() { @@ -202,23 +202,13 @@ export default { return; } - this.updateCustomerInfo(vinLookup.data.vin, vinLookup.data.vehicle, zipValidation.data.state); + this.updateStoreInfo(vinLookup.data.vin, vinLookup.data.vehicle, zipValidation.data.state); - const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction( - this.storeActions.GET_PARTS_OR_QUESTIONS, - { - carId: vinLookup.data.vehicle.carId, - glassArray: this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle ? [] : store.getters.damage.glassToReplace, - zipCode: this.serviceZip ? this.serviceZip : this.registrationZip, - vin: vinLookup.data.vin - }, - false - ); - this.navigateForward(partsData); + this.navigateForward(); }, - navigateForward(partsData){ + navigateForward() { if(this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle){ - this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { displayVehicleChangeAlert: true }, partsData.data); + this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { displayVehicleChangeAlert: true }, {}); return; } else { navigateAfterSaveToHeritageFunnel(this.$route); @@ -237,7 +227,7 @@ export default { { licensePlate: plate, licenseState: state } ); }, - updateCustomerInfo(vin, vehicleInfo, registrationState) { + updateStoreInfo(vin, vehicleInfo, registrationState) { if(this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle){ store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); } @@ -262,10 +252,10 @@ export default { licensePlate() { this.$refs.funnelFooter.updateButtonText(this.getCmsContent("FunnelFooterWidget", "ForwardButtonText")); }, - registrationZip(){ + registrationZip() { this.$refs.funnelFooter.updateButtonText(this.getCmsContent("FunnelFooterWidget", "ForwardButtonText")); }, - serviceZip(){ + serviceZip() { this.$refs.funnelFooter.updateButtonText(this.getCmsContent("FunnelFooterWidget", "ForwardButtonText")); } }, From 219fb3a7315850b4b0ab116f9d114315a0e2584f Mon Sep 17 00:00:00 2001 From: Katie Date: Mon, 2 May 2022 17:19:22 -0400 Subject: [PATCH 02/66] CSR-416 WIP --- src/global-methods.js | 8 +++- .../heritage-integration/navigation-helper.js | 5 ++- src/layouts/vehicle-damage/vehicle-damage.vue | 10 +---- src/layouts/vehicle-year/vehicle-year.vue | 2 + src/layouts/vin-lookup/vin-lookup.vue | 14 +++++++ src/router/index.js | 3 ++ src/router/router-constants/routing-table.js | 3 +- src/store/index.js | 39 ++++++++++++++----- 8 files changed, 62 insertions(+), 22 deletions(-) diff --git a/src/global-methods.js b/src/global-methods.js index c0823f29a..1156aec20 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -5,7 +5,13 @@ import httpStatusCodes from "http-status-codes"; export default { callHttpClient({ method, endpoint, payload }) { return new Promise((resolve, reject) => { - const apiGatewayUrl = applicationConfig.CONSUMER_APIGATEWAY_URL; + let apiGatewayUrl = applicationConfig.CONSUMER_APIGATEWAY_URL; + + if (endpoint.includes("order")) { + apiGatewayUrl = "https://localhost:44346"; + } + + // const apiGatewayUrl = applicationConfig.CONSUMER_APIGATEWAY_URL; const payloadAndAnalyticsData = Object.assign({}, payload, { AppName: "FixMyGlass", diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 724b13f7d..145df2e2b 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -12,7 +12,7 @@ import router from "@/router"; the user has an existing order and they come back in from the Safelite.com CTA. */ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHeritageOrder = false) { - + console.log("B") // If the user is coming in via the Safelite.Com CTA if (toRoute.query[queryStrings.START_TYPE] === 'fmg') { // If they have an existing order, return 'heritage' for the page name. @@ -40,7 +40,7 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHerita Used to navigate to the heritage funnel with the correct query string and url. */ -export async function navigateToHeritageFunnel() { +export async function navigateToHeritageFunnel(suppressConceptFunnel = false) { // Create the order (or save existing order) when navigating to Heritage Funnel. await saveOrder(); @@ -49,6 +49,7 @@ export async function navigateToHeritageFunnel() { { corid: store.getters.order.referralCorrelationId, src: "concept-funnel", + suppressConceptFunnel: suppressConceptFunnel } ); } diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 543a02bef..73a43acb3 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -77,7 +77,7 @@ import { required } from "@/helpers/validation-rules"; import { errorMessages } from "@/constants/error-messages"; import { damageLocationsCms } from "@/constants/damage-locations-cms.js"; import { damageLocationsSelected } from "@/constants/damage-locations-selected.js"; -import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; +// import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; import store from "@/store"; import baseMixin from "@/mixins/base-mixin"; @@ -279,14 +279,6 @@ export default { }, navigateForward(partsData){ - - // Temporary easter egg to navigate to heritage funnel. - const vehicleYearsToShowHeritageFunnel = [ 2001, 2002, 2010, 2016 ]; - if (vehicleYearsToShowHeritageFunnel.includes(store.getters.vehicle.year)) { - navigateToHeritageFunnel(); - return; - } - // If vin already exists, navigate directly to vin-lookup if(this.$store.getters.vehicle.vin){ this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route); diff --git a/src/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue index 96f62409c..6986eee71 100644 --- a/src/layouts/vehicle-year/vehicle-year.vue +++ b/src/layouts/vehicle-year/vehicle-year.vue @@ -43,6 +43,8 @@ export default { const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); const yearQuestionInitialDataPromise = yearQuestion.methods.loadInitialData(); + console.log("A") + // Log experiment exposure const logExperimentExposurePromise = baseMixin.methods.dispatchNonBlockingStoreAction(storeActions.LOG_EXPERIMENT_EXPOSURE, { diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index c3a1bbc33..5defba476 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -116,6 +116,7 @@ import { storeMutations } from "@/constants/store-mutations"; import { errorMessages } from "@/constants/error-messages"; import { required, regex } from "@/helpers/validation-rules"; import { Form, defineRule } from "vee-validate"; +import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; // DEFINE VALIDATION RULES defineRule("zip-required", required(errorMessages.ZIP_REQUIRED)); @@ -127,6 +128,7 @@ defineRule("vin-format", regex(/^[A-HJ-NPR-Z0-9]{17}$/, errorMessages.VIN_FORMAT export default { name: "vin-lookup", async beforeRouteEnter(to, from, next) { + console.log("C") // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); @@ -180,19 +182,23 @@ export default { this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); }, async forwardButtonAction() { + console.log("1") const zipValidation = await this.validateZip(this.zip); if (!zipValidation.data.isServiceable) { + console.log("2") this.customAlertData.zip = this.zip; this.$refs.funnelFooter.removeLoader(); this.noServiceZip = true; return; } const vinLookup = await this.lookupVin(this.vin).catch(() => { + console.log("3") this.$refs.funnelFooter.removeLoader(); this.noMatchAlert = true; return; }); if (vinLookup.data.carId !== store.getters.vehicle.carId) { + console.log("4") this.customAlertData.vehicleInfo = vinLookup.data.vehicle; this.$refs.funnelFooter.removeLoader(); this.foundWindshieldAlert = true; @@ -213,6 +219,14 @@ export default { this.navigateForward(partsData); }, navigateForward(partsData){ + console.log("5") + // Temporary easter egg to navigate to heritage funnel. + const vehicleYearsToShowHeritageFunnel = [ 2001, 2002, 2010, 2016 ]; + if (vehicleYearsToShowHeritageFunnel.includes(store.getters.vehicle.year)) { + navigateToHeritageFunnel(); + return; + } + if(partsData.data.partsOrQuestions[0].partQuestions && partsData.data.partsOrQuestions[0].partQuestions.length > 0){ this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_PARTS_QUESTION, this.$route, {}, {}, partsData.data); return; diff --git a/src/router/index.js b/src/router/index.js index 1d46eec5f..7b03fd097 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -212,6 +212,9 @@ function navigateToUrl(url, optionalQuery = {}) { ///////////////////////////////////////////////////// if (externalUrl.search.indexOf("corid=") != -1) externalUrl.search = externalUrl.search + '&experiments=CollectEmailOnQuote=CollectEmailOnQuote_V1=YesCollectEmail_TEST1=true,RemoveServiceAreaPage=ServAreaRemoval_V7=ServAreaNoRemove_V7_TEST=true,VINeducationV2=VINeducation_V2=NoShowVINmodalV2_CONTROL=true,ServicePackages=ServicePackages_V1=NoShowPackages_CONTROL=true,PhotoUploadRedesign=PhotoUploadRedesign_V1=CurrentPhotoUpload_CONTROL=true,ScheduleDetailsServiceType=ScheduleBeforeServiceType_V1=ServTypeThenSched_CONTROL=true'; + + // TODO REMOVE + externalUrl.search += ",ConceptFunnel=ConceptFunnel_V1=ConceptFunnel_TEST=true" ///////////// END TEMP CODE ///////////////////////// window.location.assign(externalUrl); diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 999bc1184..792f2f9bd 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -59,7 +59,8 @@ const routingTable = [ }, { scenario: navigationScenarios.CLICKED_FORWARD_WITH_VIN, - destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + // destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP, }, { scenario: navigationScenarios.SELECTED_DAMAGE_WITH_SINGLE_PART, diff --git a/src/store/index.js b/src/store/index.js index 6bda6ab13..6a9db85c9 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -15,7 +15,7 @@ const getDefaultState = () => { model: null, style: null, carId: null, - category: null, + category: null, vin: null, imageUrl: null, imageVifNumber: null, @@ -200,6 +200,7 @@ export const mutations = { // Misc Mutations updateStateWithOrderInformation(state, orderInformation) { + console.log(orderInformation) state.order.referralNumber = orderInformation.referralNumber; state.order.referralDate = orderInformation.referralDate; state.order.referralCorrelationId = orderInformation.referralCorrelationId; @@ -215,6 +216,9 @@ export const mutations = { imageUrl: orderInformation.vehicle?.imageUrl, imageVifNumber: orderInformation.vehicle?.imageVifNumber, imageColor: orderInformation.vehicle?.imageVifColor, + registration: { + zipCode: orderInformation.zipCode // TODO CSR-416 make sure customer vs service is different + } }); state.order.damage.glassToReplace = orderInformation.glassToReplace; @@ -223,10 +227,12 @@ export const mutations = { state.order.lineItems.glassParts = orderInformation.parts; state.order.accountNumber = orderInformation.accountNumber; - state.order.serviceLocation.zipCode = orderInformation.zipCode; + state.order.serviceLocation.zip = orderInformation.zipCode; // TODO CSR-416 make sure customer vs service is different state.order.payment.isInsurance = orderInformation.IsInsuranceOrder; state.order.payment.insuranceCoverage.isVerified = orderInformation?.insuranceInfo.coverageVerified; + + state.order.customer.emailAddress = orderInformation.emailAddress } } @@ -463,6 +469,7 @@ export const actions = { saveOrder(context) { const vehicle = context.getters.vehicle; const damage = context.getters.damage; + const order = context.state.order; return globalMethods.callHttpClient({ method: endpoints.SaveOrder.method, @@ -474,14 +481,28 @@ export const actions = { make: vehicle.make, model: vehicle.model, style: vehicle.style, - vin: vehicle.vin + vin: vehicle.vin, + registration: { + firstName: vehicle.registration.firstName, + lastName: vehicle.registration.lastName, + licensePlate: vehicle.registration.licensePlate, + zipCode: vehicle.registration.zipCode + }, }, - numberOfChips: damage.numberOfChips, - zipCode: 43215, // TODO CSR-416, should not be hardcoded (state.order.serviceLocation.zipCode) - glassToReplace: damage.glassToReplace, - referralNumber: context.state.order.referralNumber, - referralDate: context.state.order.referralDate, - accountNumber: context.state.order.accountNumber + damage: { + numberOfChips: damage.numberOfChips, + glassToReplace: damage.glassToReplace, + isRepair: damage.isRepair + }, + customer: { + emailAddress: order.customer.emailAddress, + }, + serviceLocation: { + zipCode: order.serviceLocation.zip + }, + referralNumber: order.referralNumber, + referralDate: order.referralDate, + accountNumber: order.accountNumber }, }); }, From 358895278ce2120411999d54bc48bad37db641c6 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 3 May 2022 10:21:11 -0400 Subject: [PATCH 03/66] Changed name of naviation scenario 'CLICKED_FORWARD' to 'CONTINUING_WITH_DIFFERENT_GLASS' --- src/layouts/address-lookup/address-lookup.vue | 30 ++++++++----------- .../router-constants/navigation-scenarios.js | 1 + src/router/router-constants/routing-table.js | 2 +- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index c18ee545e..b3701944d 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -81,7 +81,7 @@ import store from "@/store"; import { storeActions } from "@/constants/store-actions"; import { storeMutations } from "@/constants/store-mutations"; import baseMixin from "@/mixins/base-mixin"; -import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; +import { navigateAfterSaveToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; import { getDamageString, isGlassAvailableForCarId } from "@/helpers/damage-helper"; defineRule("service-zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED)); @@ -203,7 +203,7 @@ export default { this.$refs.funnelFooter.removeLoader(); return; } else if (carsFound.length == 1) { - var carFound = carsFound[0].vehicle; + const carFound = carsFound[0].vehicle; if (carEntered.carId == carFound.carId || carFound.carId == this.previousCarIdFound) { // update data @@ -243,17 +243,14 @@ export default { if (carsFound.length == 1) { // get the damage options for the car that was found const carFound = carsFound[0].vehicle; - const glassOptions = await baseMixin.methods.dispatchNonBlockingStoreAction( - storeActions.GET_DAMAGE_OPTIONS, - { carId: carFound.carId } - ); - // if the car entered is the same as the car found OR the glass options for the found car match the users damage selections + // if the car entered is the same as the car found or the selected glass is available for the car that was found if (carEntered.carId == carFound.carId || isGlassAvailableForCarId(carFound.carId)) { navigateAfterSaveToHeritageFunnel(this.$route); } else { // if not then navigate to the "vehicle-damage" page - this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { displayVehicleChangeAlert: true }, {}); + store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_DIFFERENT_GLASS, this.$route, {}, { displayVehicleChangeAlert: true }, {}); } } else if (carsFound.length > 1) { // if multiple cars were found @@ -268,12 +265,12 @@ export default { }, validateZip(zip) { - return baseMixin.methods.dispatchNonBlockingStoreAction( + return baseMixin.methods.dispatchStoreAction( storeActions.VALIDATE_ZIP, { zip }); }, lookupVin(lastName, streetAddress, zip, state) { - return baseMixin.methods.dispatchNonBlockingStoreAction( + return baseMixin.methods.dispatchStoreAction( storeActions.LOOKUP_VIN_BY_ADDRESS, { licenseLastName: lastName, @@ -309,22 +306,22 @@ export default { }, computed: { AlertNonServiceableZipHeader(){ - let zip = this.serviceZip ? this.serviceZip : this.customerQuestions.addressQuestions.zip; - let text = this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", zip); + const zip = this.serviceZip ? this.serviceZip : this.customerQuestions.addressQuestions.zip; + const text = this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", zip); return text; }, AlertNonServiceableZipBody(){ return this.getCmsContent("AlertNonServiceableZipWidget", "BodyText"); }, AlertMatchedDifferentVehicleHeader(){ - let text = this.getCmsContent("AlertMatchedDifferentVehicleWidget", "HeadlineText").replaceAll("{custom:glassText}", getDamageString()); + const text = this.getCmsContent("AlertMatchedDifferentVehicleWidget", "HeadlineText").replaceAll("{custom:glassText}", getDamageString()); return text; }, AlertMatchedDifferentVehicleBody(){ let content = this.getCmsContent("AlertMatchedDifferentVehicleWidget", "BodyText"); content = content.replaceAll("{custom:glassText}", getDamageString()); - let vinYmmFound = `${this.customAlertData?.vehicleInfo?.year} ${this.customAlertData?.vehicleInfo?.make} ${this.customAlertData?.vehicleInfo?.model}`; - let vinYmmExpected = `${store.getters.vehicle.year} ${store.getters.vehicle.make} ${store.getters.vehicle.model}`; + const vinYmmFound = `${this.customAlertData?.vehicleInfo?.year} ${this.customAlertData?.vehicleInfo?.make} ${this.customAlertData?.vehicleInfo?.model}`; + const vinYmmExpected = `${store.getters.vehicle.year} ${store.getters.vehicle.make} ${store.getters.vehicle.model}`; content = content.replaceAll("{custom:vinYmmFound}", vinYmmFound); content = content.replaceAll("{custom:vinYmmExpected}", vinYmmExpected); @@ -347,8 +344,7 @@ export default { // if they modify the service zip, then hide the error messageā€ this.displayNonServiceableZipAlert = false; }, - } - + }, }, components: { funnelHeader, diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index 5380a3fa7..5e966e326 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -15,6 +15,7 @@ const navigationScenarios = { CONTINUING_WITH_MULTIPLE_PARTS: "CONTINUING_WITH_MULTIPLE_PARTS", CONTINUING_WITH_SINGLE_PART: "CONTINUING_WITH_SINGLE_PART", CONTINUING_WITH_MULTIPLE_VEHICLES: "CONTINUING_WITH_MULTIPLE_VEHICLES", + CONTINUING_WITH_DIFFERENT_GLASS: "CONTINUING_WITH_DIFFERENT_GLASS", TEMPORARY_TO_ADDRESS_LOOKUP: "TEMPORARY_TO_ADDRESS_LOOKUP", }; diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 9f412288a..f2c9aef3d 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -163,7 +163,7 @@ const routingTable = [ destinationFmgPageValue: fmgPageValues.ADDRESS_VEHICLES, }, { - scenario: navigationScenarios.CLICKED_FORWARD, + scenario: navigationScenarios.CONTINUING_WITH_DIFFERENT_GLASS, destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, }, ], From 5e0e631180f12d55ba21daee339d73e9284ffc9c Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 3 May 2022 10:49:06 -0400 Subject: [PATCH 04/66] Unit tests --- jest.config.js | 1 - src/helpers/damage-helper.spec.js | 79 +++++++++-- .../license-plate-lookup.spec.js | 129 ++++++++++++++---- 3 files changed, 169 insertions(+), 40 deletions(-) diff --git a/jest.config.js b/jest.config.js index dc59735c2..55eb5be74 100644 --- a/jest.config.js +++ b/jest.config.js @@ -14,7 +14,6 @@ module.exports = { "!src/layouts/component-test/component-test.vue", "!src/layouts/form-test/form-test.vue", "!src/layouts/vin-lookup/vin-lookup.vue", - "!src/layouts/license-plate-lookup/license-plate-lookup.vue", "!src/layouts/vehicle-damage/windshield-damage-type-question/windshield-damage-type-question.vue", "!src/layouts/vehicle-damage/windshield-options/windshield-options.vue", "!src/layouts/part-questions/**/*.vue", diff --git a/src/helpers/damage-helper.spec.js b/src/helpers/damage-helper.spec.js index e0a9f71cc..68379ae1a 100644 --- a/src/helpers/damage-helper.spec.js +++ b/src/helpers/damage-helper.spec.js @@ -1,47 +1,100 @@ import {getDamageString, isGlassAvailableForCarId} from "./damage-helper"; import baseMixin from "@/mixins/base-mixin.js"; - -jest.mock("@/store", () => ({ - getters: {damage: { - glassToReplace: [{location: "Windshield", name: "windshield"}] - } - } -})); +import store from "@/store"; describe("damage-helper.js", () => { - it("Should return damage getter info", () => { + it("Should return match when multiple selected damage options are in the store", () => { + + // Arrange / Act + store.getters.damage.glassToReplace = [{location: "Windshield", name: "windshield"}, {location: "Passenger", name: "sideWindow"}]; + const damage = getDamageString(); - expect(damage).toEqual("windshield") + + // Assert + expect(damage).toEqual("match"); + }); + }); + + describe("damage-helper.js", () => { + it("Should return windshield when Windshield is the only selected damage option in the store", () => { + + // Arrange / Act + store.getters.damage.glassToReplace = [{location: "Windshield", name: "windshield"}]; + + const damage = getDamageString(); + + // Assert + expect(damage).toEqual("windshield"); + }); + }); + + describe("damage-helper.js", () => { + it("Should return side window when Driver or Passenger is the only selected damage option in the store", () => { + + // Arrange / Act + store.getters.damage.glassToReplace = [{location: "Passenger", name: "sideWindow"}]; + + const damage = getDamageString(); + + // Assert + expect(damage).toEqual("side window"); + }); + }); + + describe("damage-helper.js", () => { + it("Should return rear window when Rear is the only selected damage option in the store", () => { + + // Arrange / Act + store.getters.damage.glassToReplace = [{location: "Rear", name: "rear"}]; + + const damage = getDamageString(); + + // Assert + expect(damage).toEqual("rear window"); }); }); describe("damage-helper.js", () => { it("Should return true if no mismatches between each array exist", async () => { + // Arrange + store.getters.damage.glassToReplace = [{location: "Windshield", name: "windshield"}]; + const updatedOptions = { data: { windshieldOptions: {availableReplacementOptions: ["windshield"]} } } + + // Act baseMixin.methods.dispatchNonBlockingStoreAction = jest.fn().mockImplementation(()=> { return updatedOptions; }); - const misMatch = await isGlassAvailableForCarId(); - expect(misMatch).toEqual(true); + const isGlassAvailable = await isGlassAvailableForCarId(); + + // Assert + expect(isGlassAvailable).toEqual(true); }); }); describe("damage-helper.js", () => { it("Should return false if any mismatches between each array exist", async () => { + // Arrange + store.getters.damage.glassToReplace = [{location: "Windshield", name: "windshield"}]; + const updatedOptions = { data: { windshieldOptions: {availableReplacementOptions: ["Crack"]} } } + + // Act baseMixin.methods.dispatchNonBlockingStoreAction = jest.fn().mockImplementation(()=> { return updatedOptions; }); - const misMatch = await isGlassAvailableForCarId(); - expect(misMatch).toEqual(false); + const isGlassAvailable = await isGlassAvailableForCarId(); + + // Assert + expect(isGlassAvailable).toEqual(false); }); }); diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js index 63459a97f..ef169c813 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -1,5 +1,5 @@ // Components -import vehicleDamage from "@/layouts/license-plate-lookup/license-plate-lookup.vue"; +import licensePlateLookup from "@/layouts/license-plate-lookup/license-plate-lookup.vue"; // Supporting Files import { settleAllPromises } from "@/helpers/layout-helper.js"; @@ -29,25 +29,15 @@ jest.mock("@/store", () => ({ dispatch: jest.fn(), getters: { order: { - customer: { - emailAddress: "test@test.com" - }, - serviceLocation: { - zip: "43443" - } + customer: { emailAddress: "test@test.com"}, + serviceLocation: {zip: "11111"}, }, vehicle: { - carId: "C00000000", - image: "test.jpg", - payment: { - insuranceCoverage: { - isVerified: false - } - }, registration: { - licensePlate: "HWV4445", - zipCode: "43224" - } + licensePlate: "TESTPLATE", + zipCode: "12345", + carId: "TESTID" + }, }, eventBusItem: jest.fn(), damage: { @@ -62,7 +52,7 @@ describe("license-plate-lookup.vue", () => { const { wrapper } = setupMocks({}); //Act - vehicleDamage.beforeRouteEnter.call( + licensePlateLookup.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "license-plate-lookup" } }, undefined, @@ -84,7 +74,7 @@ describe("license-plate-lookup.vue", () => { const { wrapper } = setupMocks({}); //Act - vehicleDamage.beforeRouteEnter.call( + licensePlateLookup.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "license-plate-lookup" } }, undefined, @@ -99,6 +89,99 @@ describe("license-plate-lookup.vue", () => { }); }); +describe("license-plate-lookup.vue", () => { + test("getLicensePlateFromStore returns store license plate", async () => { + + // Arrange + const { wrapper } = setupMocks({}); + + // ACT + const licensePlate = wrapper.vm.getLicensePlateFromStore(); + + // Assert + expect(licensePlate).toEqual("TESTPLATE"); + }); +}); + +describe("license-plate-lookup.vue", () => { + test("getRegistrationZipFromStore returns store registration zip", async () => { + + // Arrange + const { wrapper } = setupMocks({}); + + // ACT + const registrationZip = wrapper.vm.getRegistrationZipFromStore(); + + // Assert + expect(registrationZip).toEqual("12345"); + }); +}); + +describe("license-plate-lookup.vue", () => { + test("getEmailFromStore returns store customer email", async () => { + + // Arrange + const { wrapper } = setupMocks({}); + + // ACT + const customerEmail = wrapper.vm.getEmailFromStore(); + + // Assert + expect(customerEmail).toEqual("test@test.com"); + }); +}); + +describe("license-plate-lookup.vue", () => { + test("getServiceZipFromStore returns store service zip", async () => { + + // Arrange + const { wrapper } = setupMocks({}); + + // ACT + const serviceZip = wrapper.vm.getServiceZipFromStore(); + + // Assert + expect(serviceZip).toEqual("11111"); + }); +}); + +describe("license-plate-lookup.vue", () => { + test("Navigate forward should be called when data entered matches store data", async () => { + + // Arrange + const { wrapper } = setupMocks({ + pageHeaderWidgetHeaderText: "", + mountOptionsMockData: { + router: { navigateAfterSave: jest.fn(), }, + }, + }); + + wrapper.vm.licensePlate = "TESTPLATE"; + wrapper.vm.registrationZip = "12345"; + wrapper.vm.validateZip = jest.fn().mockImplementation(() => { + return {data: {isServiceable: true}}; + }); + wrapper.vm.lookupVin = jest.fn().mockImplementation(() => { + return {data: {vehicle: {carId: 'TESTID'}}, catch: () => "test"}; + }); + + //Act + licensePlateLookup.beforeRouteEnter.call( + wrapper.vm, + { query: { fmgPage: "license-plate-lookup" } }, + undefined, + (c) => c(wrapper.vm) + ); + + await wrapper.vm.forwardButtonAction(); + + //Assert + expect(wrapper.vm.$router.navigateAfterSave).toHaveBeenCalled(); + expect(wrapper.vm.isCarIdDifferent).toEqual(false); + }); +}); + + function setupMocks({ pageHeaderWidgetHeaderText = {}, @@ -106,12 +189,6 @@ function setupMocks({ router: { navigate: jest.fn(), }, - store: { - getters: { - vehicle: {}, - payment: { insuranceCoverage: { isVerified: false } }, - }, - }, }, }) { //Mock api responses @@ -139,7 +216,7 @@ function setupMocks({ const mountOptions = getMountOptions(mountOptionsMockData); mountOptions['attachTo'] = document.body; // append wrapper to document.body to test DOM methods - const wrapper = shallowMount(vehicleDamage, mountOptions); + const wrapper = shallowMount(licensePlateLookup, mountOptions); wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent; From b5aa014e85ed8ae01caa0f774fcccd72b0abbb4e Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 3 May 2022 10:59:33 -0400 Subject: [PATCH 05/66] Added 'eager' validation to textbox-question component --- .../textbox-question/textbox-question.vue | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/common-components/textbox-question/textbox-question.vue b/src/common-components/textbox-question/textbox-question.vue index 00dcdfb88..40e8fb1e6 100644 --- a/src/common-components/textbox-question/textbox-question.vue +++ b/src/common-components/textbox-question/textbox-question.vue @@ -1,8 +1,11 @@ From e640ff292c8b1507a1019764a75fe059c3ee7417 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 3 May 2022 13:14:26 -0400 Subject: [PATCH 06/66] Fixing routing table and creating unit tests --- .../license-plate-lookup.spec.js | 2 +- src/router/router-constants/routing-table.js | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js index 5a8fa5fab..d7f51de66 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -33,10 +33,10 @@ jest.mock("@/store", () => ({ serviceLocation: {zip: "11111"}, }, vehicle: { + carId: "TESTID", registration: { licensePlate: "TESTPLATE", zipCode: "12345", - carId: "TESTID" }, }, eventBusItem: jest.fn(), diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 3290c43eb..83d2c57de 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -137,18 +137,6 @@ const routingTable = [ scenario: navigationScenarios.CLICKED_BACK, destinationFmgPageValue: fmgPageValues.ESTIMATE, }, - { - scenario: navigationScenarios.CONTINUING_WITH_PARTS_QUESTION, - destinationFmgPageValue: fmgPageValues.PART_QUESTIONS, - }, - { - scenario: navigationScenarios.CONTINUING_WITH_MULTIPLE_PARTS, - destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS, - }, - { - scenario: navigationScenarios.CONTINUING_WITH_SINGLE_PART, - destinationFmgPageValue: fmgPageValues.REVEAL, - }, { scenario: navigationScenarios.CLICKED_FORWARD, destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, From c3b3fda79f112d55a93a4105e61f7633407bf677 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Tue, 3 May 2022 16:04:49 -0400 Subject: [PATCH 07/66] CSR-240 | Fade between page transitions Two different approaches - PR created for review purposes --- src/App.vue | 6 +++++- .../make-question/make-question.vue | 4 +++- src/layouts/vehicle-make/vehicle-make.vue | 2 +- src/layouts/vehicle-year/vehicle-year.vue | 7 ++++++- src/styles/common-animations.scss | 18 ++++++++++++++++++ 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/App.vue b/src/App.vue index 603bd2cb3..f161d937e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,9 @@ \ No newline at end of file diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 6d0240ae0..395c519b3 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -6,6 +6,14 @@ v-slot="{ meta }" autocomplete="off" >
+ + + + @@ -68,6 +76,7 @@ import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-he import customerQuestions from "@/layouts/address-lookup/customer-questions/customer-questions"; import alert from "@/ux-components/alert/alert"; import textboxQuestion from "@/common-components/textbox-question/textbox-question"; +import loadingModal from '@/common-components/loading-modal/loading-modal.vue'; import { Form } from "vee-validate"; import { defineRule } from "vee-validate"; @@ -251,6 +260,7 @@ export default { // if the car entered is the same as the car found OR the glass options for the found car match the users damage selections if (carEntered.carId == carFound.carId || isGlassAvailableForCarId(carFound.carId)) { + this.$refs.loadingModal.showModal(); navigateAfterSaveToHeritageFunnel(this.$route); } else { // if not then navigate to the "vehicle-damage" page @@ -260,6 +270,7 @@ export default { // if multiple cars were found if (carsFound.find(car => car.carId === carEntered.carId)) { // and one of them matches the car id entered + this.$refs.loadingModal.showModal(); navigateAfterSaveToHeritageFunnel(this.$route); } else { // and there is no match, navigate to "address-vehicle" page @@ -359,6 +370,7 @@ export default { customerQuestions, textboxQuestion, alert, + loadingModal, Form }, }; diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index cce368d5c..c2409df3d 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -5,9 +5,15 @@ ref="theForm" v-slot="{ meta }" > -
+
+ + + + diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 0072708f4..f41f9a943 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -5,9 +5,15 @@ ref="theForm" v-slot="{ meta }" > -
+
+ + + + From 78f965ec4f4f35d25e406ab49929ced40c2b0abf Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 6 May 2022 10:12:04 -0400 Subject: [PATCH 22/66] CSR-520 loading modal --- .../license-plate-lookup.vue | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index d22d311e2..a1f507697 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -1,6 +1,14 @@ @@ -169,7 +170,7 @@ import baseMixin from "@/mixins/base-mixin.js"; import { storeActions } from "@/constants/store-actions"; import { storeMutations } from "@/constants/store-mutations"; import { errorMessages } from "@/constants/error-messages"; -import { getDamageString, isGlassAvailableForCarId } from "@/helpers/damage-helper"; +import { getDamageString, getIsWindshieldOnly, isGlassAvailableForCarId } from "@/helpers/damage-helper"; import { required, regex } from "@/helpers/validation-rules"; import { Form, defineRule } from "vee-validate"; import { navigateAfterSaveToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; @@ -260,6 +261,13 @@ export default { return this.getCmsContent("PerfectMatchNewVinAlert", "BodyText").replaceAll("{custom:damage}", getDamageString()) }, + PerfectMatchNewVinAlertReadOnlyHeader () { + return this.getCmsContent("PerfectMatchNewVinAlertReadOnly", "HeadlineText"); + }, + PerfectMatchNewVinAlertReadOnlyBody () { + return this.getCmsContent("PerfectMatchNewVinAlertReadOnly", "BodyText").replaceAll("{custom:damage}", + getIsWindshieldOnly()) + }, isVinFieldReadOnly(){ return this.$store.getters.payment.insuranceCoverage.isVerified; }, From e1fa0df8209fc6d9cb61d2b5aeeb3f8fd0f05f1f Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 6 May 2022 15:28:02 -0400 Subject: [PATCH 25/66] CSR-520 broken test fix --- src/layouts/license-plate-lookup/license-plate-lookup.spec.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js index 609ddcf2e..71a9e2a28 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -10,6 +10,9 @@ import { getMountOptions } from "@/helpers/unit-test-helper.js"; import { nextTick } from "vue"; import store from "@/store"; +jest.mock('@/assets/img/loader.gif', () => 'loader.gif') +jest.mock('@/assets/img/windshield.png', () => 'windshield.png') + // Mock our module for promises. jest.mock("@/helpers/layout-helper.js", () => ({ settleAllPromises: jest.fn(), @@ -378,6 +381,7 @@ describe("license-plate-lookup.vue", () => { //Act wrapper.vm.isCarIdDifferent = false; wrapper.vm.$router.navigateAfterSaveToHeritageFunnel = jest.fn(); + wrapper.vm.$refs.loadingModal.showModal = jest.fn(); wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => { return ''; }); From aab32ef7b1fcc499a72c2a48274591c18474c19d Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 6 May 2022 16:12:56 -0400 Subject: [PATCH 26/66] Bug fixes, 1) added zipToDisplay datum for cases when registration zip entered is also not valid, 2) changed navigateAfterSaveToHeritageFunnel function to exported function as it is not in global and fixed unit tests with it. 3) Fixed updateServiceLocationZipCode name in vuex. --- .../license-plate-lookup/license-plate-lookup.spec.js | 6 +++--- .../license-plate-lookup/license-plate-lookup.vue | 9 +++++++-- src/store/index.js | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js index 609ddcf2e..6e86cd9f5 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -3,6 +3,7 @@ import licensePlateLookup from "@/layouts/license-plate-lookup/license-plate-loo // Supporting Files import { settleAllPromises } from "@/helpers/layout-helper.js"; +import * as navigateToHeritage from "@/helpers/heritage-integration/navigation-helper"; import baseMixin from "@/mixins/base-mixin"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { shallowMount, flushPromises } from "@vue/test-utils"; @@ -377,15 +378,14 @@ describe("license-plate-lookup.vue", () => { //Act wrapper.vm.isCarIdDifferent = false; - wrapper.vm.$router.navigateAfterSaveToHeritageFunnel = jest.fn(); wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => { return ''; }); - + navigateToHeritage.navigateAfterSaveToHeritageFunnel = jest.fn(); await wrapper.vm.navigateForward(); //Assert - expect(wrapper.vm.$router.navigateAfterSaveToHeritageFunnel).toHaveBeenCalled(); + expect(navigateToHeritage.navigateAfterSaveToHeritageFunnel).toHaveBeenCalled(); }); }); diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 356a8ec9e..84b58e93d 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -61,6 +61,9 @@ import { import { errorMessages } from "@/constants/error-messages"; +import { + navigateAfterSaveToHeritageFunnel +} from "@/helpers/heritage-integration/navigation-helper"; import { getDamageString, isGlassAvailableForCarId, @@ -125,6 +128,7 @@ export default { previouslyEnteredCarId: "", customAlertData: {}, isSelectedGlassAvailableForVehicle: true, + zipToDisplay: this.getRegistrationZipFromStore(), }; }, mounted() { @@ -162,7 +166,7 @@ export default { let text = this.getCmsContent( "NoServiceZipWidget", "HeadlineText" - ).replaceAll("{custom:zip}", this.registrationZip); + ).replaceAll("{custom:zip}", this.zipToDisplay); return text; }, NoServiceZipBody() { @@ -214,6 +218,7 @@ export default { this.isVinValid = true; this.isRegistrationZipServicable = false; this.isCarIdDifferent = false; + this.zipToDisplay = this.serviceZip ? this.serviceZip : this.registrationZip; return; } @@ -265,7 +270,7 @@ export default { ); return; } else { - this.$router.navigateAfterSaveToHeritageFunnel(this.$route); + navigateAfterSaveToHeritageFunnel(this.$route); return; } }, diff --git a/src/store/index.js b/src/store/index.js index 75bd4807d..d570b5c4e 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -144,9 +144,9 @@ export const mutations = { updateRegistrationAddress(state, registrationAddress){ state.order.vehicle.registration.address = registrationAddress; }, - updateServiceLocationZip(state, serviceLocationZip){ + updateServiceLocationZipCode(state, serviceLocationZip){ state.order.vehicle.registration.zip = serviceLocationZip; - }, + }, updateRegistrationCity(state, serviceCity){ state.order.vehicle.registration.city = serviceCity; }, From c74ea197ace69db5b554f04dc47328e7e85b5ccb Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 9 May 2022 08:52:51 -0400 Subject: [PATCH 27/66] Reordered methods relating to vin lookups to be more cohesive --- src/store/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 88a8f3cab..b1845aa7c 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -135,20 +135,20 @@ export const mutations = { updateRegistrationLicensePlate(state, licensePlate){ state.order.vehicle.registration.licensePlate = licensePlate; }, + updateRegistrationAddress(state, registrationAddress){ + state.order.vehicle.registration.address = registrationAddress; + }, + updateRegistrationCity(state, registrationCity){ + state.order.vehicle.registration.city = registrationCity; + }, updateRegistrationState(state, registrationState){ state.order.vehicle.registration.state = registrationState; }, updateRegistrationZipCode(state, registrationZipCode){ state.order.vehicle.registration.zipCode = registrationZipCode; }, - updateRegistrationAddress(state, registrationAddress){ - state.order.vehicle.registration.address = registrationAddress; - }, updateServiceLocationZipCode(state, serviceLocationZip){ state.order.serviceLocation.zipCode = serviceLocationZip; - }, - updateRegistrationCity(state, registrationCity){ - state.order.vehicle.registration.city = registrationCity; }, updateRegistrationFirstName(state, firstName){ state.order.vehicle.registration.firstName = firstName; From 92ecdd9b20e79e1a4a174920c1c202d019ac7f24 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 9 May 2022 09:29:46 -0400 Subject: [PATCH 28/66] CSR-520 modal specs --- .../loading-modal/loading-modal.spec.js | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 src/common-components/loading-modal/loading-modal.spec.js diff --git a/src/common-components/loading-modal/loading-modal.spec.js b/src/common-components/loading-modal/loading-modal.spec.js new file mode 100644 index 000000000..ca7717cca --- /dev/null +++ b/src/common-components/loading-modal/loading-modal.spec.js @@ -0,0 +1,97 @@ +import { shallowMount } from "@vue/test-utils"; +import loadingModal from "./loading-modal"; +import { getMountOptions } from "@/helpers/unit-test-helper.js"; +import store from "@/store"; + +jest.mock( + "@/store", + () => { + return {}; + }, + { virtual: true } +); + +jest.mock('@/assets/img/loader.gif', () => 'loader.gif') +jest.mock('@/assets/img/windshield.png', () => 'windshield.png') + +describe("loadingModal", () => { + test("showModal sets modal visible", async () => { + // Arrange + const { wrapper } = setupMocks({ clickOutCloses: false }); + wrapper.vm.isModalVisible = false; + + //Act + wrapper.vm.showModal(); + + // Assert + expect(wrapper.vm.isModalVisible).toEqual(true); + wrapper.unmount(); + }); +}); + + +describe("loadingModal", () => { + test("closeModal sets modal not visible", async () => { + // Arrange + const { wrapper } = setupMocks({ clickOutCloses: false }); + wrapper.vm.isModalVisible = true; + + //Act + wrapper.vm.closeModal(); + + // Assert + expect(wrapper.vm.isModalVisible).toEqual(false); + wrapper.unmount(); + }); +}); + +describe("loadingModal", () => { + test("canClose calls closeModal", async () => { + // Arrange + const { wrapper } = setupMocks({ clickOutCloses: true }); + wrapper.vm.isModalVisible = true; + + //Act + wrapper.vm.canClose(); + + // Assert + expect(wrapper.vm.isModalVisible).toEqual(false); + wrapper.unmount(); + }); +}); + +describe("loadingModal", () => { + test("canClose does not call closeModal", async () => { + // Arrange + const { wrapper } = setupMocks({ clickOutCloses: false }); + wrapper.vm.isModalVisible = true; + + //Act + wrapper.vm.canClose(); + + // Assert + expect(wrapper.vm.isModalVisible).toEqual(true); + wrapper.unmount(); + }); +}); + +function setupMocks({ + clickOutCloses +}) { + + //Mock store + store.dispatch = jest.fn(() => {}); + store.getters = { }; + const mountOptions = getMountOptions({ + store: { + dispatch: store.dispatch, + getters: store.getters, + }, + }); + + //Mock props + mountOptions.propsData = { clickOutCloses: clickOutCloses }; + const wrapper = shallowMount(loadingModal, mountOptions); + + return { wrapper }; +} From 29aeddd189944dfa449c3ecfae4a5a4b70b15716 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Mon, 9 May 2022 10:57:25 -0400 Subject: [PATCH 29/66] CSR-240 | Group stylings into one class --- src/layouts/address-lookup/address-lookup.vue | 2 +- src/layouts/estimate/estimate.vue | 2 +- src/layouts/license-plate-lookup/license-plate-lookup.vue | 2 +- src/layouts/part-questions/part-questions.vue | 2 +- src/layouts/vehicle-damage/vehicle-damage.vue | 2 +- src/layouts/vehicle-make/vehicle-make.vue | 2 +- src/layouts/vehicle-model/vehicle-model.vue | 2 +- src/layouts/vehicle-parts/vehicle-parts.vue | 2 +- src/layouts/vehicle-style/vehicle-style.vue | 2 +- src/layouts/vehicle-year/vehicle-year.vue | 2 +- src/layouts/vin-lookup/vin-lookup.vue | 2 +- src/styles/common-styles.scss | 6 +++++- 12 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 395c519b3..9c7c56b05 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -5,7 +5,7 @@ ref="theForm" v-slot="{ meta }" autocomplete="off" > -
+