CSR-748 Handle going into concept quote page

This commit is contained in:
Katie 2022-11-08 13:33:26 -05:00
parent bb64ecde29
commit 99166d2883
7 changed files with 91 additions and 44 deletions

View file

@ -39,32 +39,59 @@ describe("estimate.vue", () => {
]); ]);
}); });
test("After selecting provide my home address on ForwardButtonAction triggers a router.navigateWithSaving", async () => { describe("move forward", () => {
//Arrange test("After selecting provide my home address on ForwardButtonAction triggers a router.navigateWithSaving", async () => {
const { wrapper } = setupMocks({}); //Arrange
await wrapper.setData({ const { wrapper } = setupMocks({});
selectedVinLookupMethod: vinLookupMethodSelections.HOMEADDRESS, await wrapper.setData({
selectedVinLookupMethod: vinLookupMethodSelections.HOMEADDRESS,
});
//Act
wrapper.vm.forwardButtonAction();
//Assert
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
}); });
//Act test("After selecting provide my manual vin on ForwardButtonAction triggers a router.navigateWithSaving", async () => {
wrapper.vm.forwardButtonAction(); //Arrange
const { wrapper } = setupMocks({});
await wrapper.setData({
selectedVinLookupMethod: vinLookupMethodSelections.MANUALVIN,
});
//Assert //Act
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled(); await wrapper.vm.forwardButtonAction();
});
test("After selecting provide my manual vin on ForwardButtonAction triggers a router.navigateWithSaving", async () => { //Assert
//Arrange expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
const { wrapper } = setupMocks({});
await wrapper.setData({
selectedVinLookupMethod: vinLookupMethodSelections.MANUALVIN,
}); });
//Act test("Provide my license plate on ForwardButtonAction triggers a router.navigateWithSaving", async () => {
await wrapper.vm.forwardButtonAction(); //Arrange
const { wrapper } = setupMocks({});
await wrapper.setData({
selectedVinLookupMethod: vinLookupMethodSelections.LICENSEPLATE,
});
//Assert //Act
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled(); wrapper.vm.forwardButtonAction();
//Assert
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
});
// TODO KO
describe("isRepair", () => {
test.todo("is repair and zip codes are valid/serviceable => go to quote page");
test.todo(
"is repair and zip codes are valid but not serviceable => show correct alert, remove loader"
);
test.todo(
"is repair and zip codes are not valid/serviceable => show correct alert, remove loader"
);
});
}); });
test("BackButtonAction triggers a router.navigateWithoutSaving change", async () => { test("BackButtonAction triggers a router.navigateWithoutSaving change", async () => {
@ -85,20 +112,6 @@ describe("estimate.vue", () => {
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled(); expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled();
}); });
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();
});
describe("arePagePrerequisitesValid", () => { describe("arePagePrerequisitesValid", () => {
beforeEach(() => { beforeEach(() => {
store.commit(storeMutations.UPDATE_IS_REPAIR, false); store.commit(storeMutations.UPDATE_IS_REPAIR, false);

View file

@ -1,7 +1,6 @@
<template> <template>
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }"> <Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
<div class="page-container-grouped-styles"> <div class="page-container-grouped-styles">
<loadingModal ref="loadingModal" />
<funnelHeader cmsWidgetName="FunnelHeaderWidget" /> <funnelHeader cmsWidgetName="FunnelHeaderWidget" />
<vehicleBanner cmsWidgetName="VehicleBannerWidget" /> <vehicleBanner cmsWidgetName="VehicleBannerWidget" />
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" /> <funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
@ -91,7 +90,6 @@ import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-he
import buttonQuestion from "@/common-components/button-question/button-question"; import buttonQuestion from "@/common-components/button-question/button-question";
import alert from "@/ux-components/alert/alert"; import alert from "@/ux-components/alert/alert";
import textboxQuestion from "@/common-components/textbox-question/textbox-question"; import textboxQuestion from "@/common-components/textbox-question/textbox-question";
import loadingModal from "@/common-components/loading-modal/loading-modal.vue";
import textBlock from "@/common-components/text-block/text-block"; import textBlock from "@/common-components/text-block/text-block";
//Supporting Files //Supporting Files
@ -172,7 +170,9 @@ export default {
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
}, },
async forwardButtonAction() { async forwardButtonAction() {
console.log("forwardButtonAction")
if (this.isRepair) { if (this.isRepair) {
console.log("REPAIRRR")
const zipCodeData = await this.getZipCodeData(this.serviceZipCode); const zipCodeData = await this.getZipCodeData(this.serviceZipCode);
//todo: validation //todo: validation
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false); await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false);
@ -197,8 +197,10 @@ export default {
} }
this.displayNonServiceableZipAlert = false; this.displayNonServiceableZipAlert = false;
this.$refs.loadingModal.showModal(); return this.$router.navigateWithSaving(
navigateToHeritageFunnel(); this.navigationScenarios.HAS_NO_QUESTIONS,
this.$route
);
} }
if (this.selectedVinLookupMethod === vinLookupMethodSelections.MANUALVIN) { if (this.selectedVinLookupMethod === vinLookupMethodSelections.MANUALVIN) {
@ -256,7 +258,6 @@ export default {
Form, Form,
alert, alert,
textboxQuestion, textboxQuestion,
loadingModal,
textBlock, textBlock,
}, },
}; };

View file

@ -467,7 +467,6 @@ describe("vehicle-parts.vue", () => {
getters: store.getters, getters: store.getters,
commit: store.commit, commit: store.commit,
}, },
navigateToHeritageFunnel: jest.fn(),
}, },
}); });
@ -489,7 +488,10 @@ describe("vehicle-parts.vue", () => {
//Assert //Assert
expect(wrapper.vm.$store.commit).toHaveBeenCalled(); expect(wrapper.vm.$store.commit).toHaveBeenCalled();
expect(navigateToHeritageFunnel).toHaveBeenCalled(); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
navigationScenarios.HAS_NO_MORE_QUESTIONS,
{ query: { fmgPage: "vehicle-parts" } }
);
}); });
}); });

View file

@ -243,7 +243,7 @@ export default {
// save to store lineItems.glassParts // save to store lineItems.glassParts
self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts); self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
navigateToHeritageFunnel(); self.$router.navigateWithSaving(self.navigationScenarios.HAS_NO_MORE_QUESTIONS, self.$route);
} }
}, },
backButtonAction() { backButtonAction() {

View file

@ -1295,7 +1295,7 @@ describe("vehicle-questions-mixin", () => {
}); });
}); });
describe("should go to heritage funnel", () => { describe("should go to quote page", () => {
test("single glass location selected, has no part questions and has one part => go to heritage funnel", async () => { test("single glass location selected, has no part questions and has one part => go to heritage funnel", async () => {
// Arrange // Arrange
const partsOrQuestions = [ const partsOrQuestions = [
@ -1330,7 +1330,12 @@ describe("vehicle-questions-mixin", () => {
await wrapper.vm.navigateForward(partsOrQuestions); await wrapper.vm.navigateForward(partsOrQuestions);
// Assert // Assert
expect(navigateToHeritageFunnel).toHaveBeenCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
navigationScenarios.HAS_NO_MORE_QUESTIONS,
{ query: { fmgPage: "vin-lookup" } }
);
expect(wrapper.vm.$router.navigateWithoutSaving).not.toHaveBeenCalled();
}); });
test("multiple glass locations selected, each has one part and no part questions => go to heritage funnel", async () => { test("multiple glass locations selected, each has one part and no part questions => go to heritage funnel", async () => {
@ -1436,7 +1441,12 @@ describe("vehicle-questions-mixin", () => {
storeMutations.UPDATE_GLASS_PARTS, storeMutations.UPDATE_GLASS_PARTS,
collectedGlassParts collectedGlassParts
); );
expect(navigateToHeritageFunnel).toHaveBeenCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
navigationScenarios.HAS_NO_MORE_QUESTIONS,
{ query: { fmgPage: "vin-lookup" } }
);
expect(wrapper.vm.$router.navigateWithoutSaving).not.toHaveBeenCalled();
}); });
}); });
}); });

View file

@ -18,6 +18,7 @@ const navigationScenarios = {
SELECTED_MANUAL_VIN: "SELECTED_MANUAL_VIN", SELECTED_MANUAL_VIN: "SELECTED_MANUAL_VIN",
SELECTED_LICENSE_PLATE: "SELECTED_LICENSE_PLATE", SELECTED_LICENSE_PLATE: "SELECTED_LICENSE_PLATE",
SELECTED_HOME_ADDRESS: "SELECTED_HOME_ADDRESS", SELECTED_HOME_ADDRESS: "SELECTED_HOME_ADDRESS",
HAS_NO_QUESTIONS: "HAS_NO_QUESTIONS",
// Question pages // Question pages
HAS_PART_QUESTIONS: "HAS_PART_QUESTIONS", HAS_PART_QUESTIONS: "HAS_PART_QUESTIONS",

View file

@ -109,6 +109,10 @@ const routingTable = function (store) {
scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS, scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS,
destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS, destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS,
}, },
{
scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS,
destinationFmgPageValue: fmgPageValues.QUOTE,
},
], ],
}, },
{ {
@ -138,6 +142,10 @@ const routingTable = function (store) {
scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS, scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS,
destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS, destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS,
}, },
{
scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS,
destinationFmgPageValue: fmgPageValues.QUOTE,
},
], ],
}, },
{ {
@ -171,6 +179,10 @@ const routingTable = function (store) {
scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS, scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS,
destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS, destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS,
}, },
{
scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS,
destinationFmgPageValue: fmgPageValues.QUOTE,
},
], ],
}, },
{ {
@ -200,6 +212,10 @@ const routingTable = function (store) {
scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS, scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS,
destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS, destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS,
}, },
{
scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS,
destinationFmgPageValue: fmgPageValues.QUOTE,
},
], ],
}, },
{ {
@ -221,6 +237,10 @@ const routingTable = function (store) {
scenario: navigationScenarios.SELECTED_HOME_ADDRESS, scenario: navigationScenarios.SELECTED_HOME_ADDRESS,
destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP, destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP,
}, },
{
scenario: navigationScenarios.HAS_NO_QUESTIONS,
destinationFmgPageValue: fmgPageValues.QUOTE,
},
], ],
}, },
{ {