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 () => {
//Arrange
const { wrapper } = setupMocks({});
await wrapper.setData({
selectedVinLookupMethod: vinLookupMethodSelections.HOMEADDRESS,
describe("move forward", () => {
test("After selecting provide my home address on ForwardButtonAction triggers a router.navigateWithSaving", async () => {
//Arrange
const { wrapper } = setupMocks({});
await wrapper.setData({
selectedVinLookupMethod: vinLookupMethodSelections.HOMEADDRESS,
});
//Act
wrapper.vm.forwardButtonAction();
//Assert
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
});
//Act
wrapper.vm.forwardButtonAction();
test("After selecting provide my manual vin on ForwardButtonAction triggers a router.navigateWithSaving", async () => {
//Arrange
const { wrapper } = setupMocks({});
await wrapper.setData({
selectedVinLookupMethod: vinLookupMethodSelections.MANUALVIN,
});
//Assert
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
});
//Act
await wrapper.vm.forwardButtonAction();
test("After selecting provide my manual vin on ForwardButtonAction triggers a router.navigateWithSaving", async () => {
//Arrange
const { wrapper } = setupMocks({});
await wrapper.setData({
selectedVinLookupMethod: vinLookupMethodSelections.MANUALVIN,
//Assert
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
});
//Act
await wrapper.vm.forwardButtonAction();
test("Provide my license plate on ForwardButtonAction triggers a router.navigateWithSaving", async () => {
//Arrange
const { wrapper } = setupMocks({});
await wrapper.setData({
selectedVinLookupMethod: vinLookupMethodSelections.LICENSEPLATE,
});
//Assert
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
//Act
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 () => {
@ -85,20 +112,6 @@ describe("estimate.vue", () => {
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", () => {
beforeEach(() => {
store.commit(storeMutations.UPDATE_IS_REPAIR, false);

View file

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

View file

@ -467,7 +467,6 @@ describe("vehicle-parts.vue", () => {
getters: store.getters,
commit: store.commit,
},
navigateToHeritageFunnel: jest.fn(),
},
});
@ -489,7 +488,10 @@ describe("vehicle-parts.vue", () => {
//Assert
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
self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
navigateToHeritageFunnel();
self.$router.navigateWithSaving(self.navigationScenarios.HAS_NO_MORE_QUESTIONS, self.$route);
}
},
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 () => {
// Arrange
const partsOrQuestions = [
@ -1330,7 +1330,12 @@ describe("vehicle-questions-mixin", () => {
await wrapper.vm.navigateForward(partsOrQuestions);
// 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 () => {
@ -1436,7 +1441,12 @@ describe("vehicle-questions-mixin", () => {
storeMutations.UPDATE_GLASS_PARTS,
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_LICENSE_PLATE: "SELECTED_LICENSE_PLATE",
SELECTED_HOME_ADDRESS: "SELECTED_HOME_ADDRESS",
HAS_NO_QUESTIONS: "HAS_NO_QUESTIONS",
// Question pages
HAS_PART_QUESTIONS: "HAS_PART_QUESTIONS",

View file

@ -109,6 +109,10 @@ const routingTable = function (store) {
scenario: navigationScenarios.HAS_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,
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,
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,
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,
destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP,
},
{
scenario: navigationScenarios.HAS_NO_QUESTIONS,
destinationFmgPageValue: fmgPageValues.QUOTE,
},
],
},
{