CSR-963 Skip Vin Experiment Setting

This commit is contained in:
CarlNation 2022-12-05 10:08:54 -05:00
parent 30deb2cf5b
commit 60e41adf3d
4 changed files with 46 additions and 10 deletions

View file

@ -4,6 +4,7 @@ const experimentUniverses = {
const experimentSettings = { const experimentSettings = {
GOOGLE_CUSTOM_DIMENSION_INDEX: "Google Custom Dimension Index", GOOGLE_CUSTOM_DIMENSION_INDEX: "Google Custom Dimension Index",
SUPPRESS_VIN_CAPTURE: "SuppressVinCapture",
}; };
const experimentTriggers = { const experimentTriggers = {

View file

@ -5,6 +5,8 @@ import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
import { fmgPageValues } from "@/router/router-constants/fmgPage-values"; import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
import { storeActions } from "@/constants/store-actions.js"; import { storeActions } from "@/constants/store-actions.js";
import { settleAllPromises } from "@/helpers/layout-helper"; import { settleAllPromises } from "@/helpers/layout-helper";
import experimentMixin from "@/mixins/experiment-mixin";
import { experimentSettings } from "@/constants/experiments";
import store from "@/store"; import store from "@/store";
import router from "@/router"; import router from "@/router";
@ -98,12 +100,18 @@ async function getLatestPageForRedirection() {
} else if (partQuestionsComponent.methods.arePagePrerequisitesValid()) { } else if (partQuestionsComponent.methods.arePagePrerequisitesValid()) {
return fmgPageValues.PART_QUESTIONS; return fmgPageValues.PART_QUESTIONS;
} else if ( } else if (
// capture vin
vinLookupComponent.methods.arePagePrerequisitesValid() && vinLookupComponent.methods.arePagePrerequisitesValid() &&
!store.getters.damage.isRepair && !store.getters.damage.isRepair &&
!isVinOptionalVehicle !isVinOptionalVehicle &&
experimentMixin.methods.hasSettingEqualTo(
experimentSettings.SUPPRESS_VIN_CAPTURE,
false
)
) { ) {
return fmgPageValues.VIN_LOOKUP; return fmgPageValues.VIN_LOOKUP;
} else { } else {
// do not capture vin
return fmgPageValues.ESTIMATE; return fmgPageValues.ESTIMATE;
} }
} }

View file

@ -221,16 +221,29 @@ describe("estimate.vue", () => {
describe("skipVinLookup", () => { describe("skipVinLookup", () => {
const skipOptions = [ const skipOptions = [
[true, true, true], [true, true, true, true],
[true, false, true], [true, false, false, true],
[false, true, true], [false, true, true, true],
[false, false, false], [false, false, false, false],
]; ];
test.each(skipOptions)( test.each(skipOptions)(
"isRepair %s and isVinOptional %s should return %s", "isRepair %s, isVinOptional %s and suppressVinCapture %s should return %s",
async (isRepair, isVinOptionalVehicle, expectedVinSkip) => { async (isRepair, isVinOptionalVehicle, suppressVinCapture, expectedVinSkip) => {
const { wrapper } = setupMocks({ isVinOptionalVehicle: isVinOptionalVehicle }); const { wrapper } = setupMocks({});
await wrapper.setData({
isVinOptionalVehicle: isVinOptionalVehicle,
});
store.commit(storeMutations.UPDATE_IS_REPAIR, isRepair); store.commit(storeMutations.UPDATE_IS_REPAIR, isRepair);
const mockExperimentsList = [
{
universeName: "ConceptFunne;",
settings: {
SuppressVinCapture: suppressVinCapture,
},
},
];
store.commit(storeMutations.UPDATE_EXPERIMENTS, mockExperimentsList);
expect(wrapper.vm.skipVinLookup).toEqual(expectedVinSkip); expect(wrapper.vm.skipVinLookup).toEqual(expectedVinSkip);
} }

View file

@ -102,6 +102,8 @@ import store from "@/store";
import { storeActions } from "@/constants/store-actions"; import { storeActions } from "@/constants/store-actions";
import { vinLookupMethodSelections } from "@/constants/vin-lookup-method-selections.js"; import { vinLookupMethodSelections } from "@/constants/vin-lookup-method-selections.js";
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
import experimentMixin from "@/mixins/experiment-mixin";
import { experimentSettings } from "@/constants/experiments";
// Define Validation Rules // Define Validation Rules
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED)); defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
@ -248,10 +250,22 @@ export default {
return store.getters.damage.isRepair; return store.getters.damage.isRepair;
}, },
skipVinLookup() { skipVinLookup() {
return this.isRepair || this.isVinOptionalVehicle; return (
this.isRepair ||
this.isVinOptionalVehicle ||
experimentMixin.methods.hasSettingEqualTo(
experimentSettings.SUPPRESS_VIN_CAPTURE,
true
)
);
}, },
alertInfo() { alertInfo() {
return this.isVinOptionalVehicle && !this.isRepair return (this.isVinOptionalVehicle ||
experimentMixin.methods.hasSettingEqualTo(
experimentSettings.SUPPRESS_VIN_CAPTURE,
true
)) &&
!this.isRepair
? "AlertQuoteVinOptional" ? "AlertQuoteVinOptional"
: "AlertQuoteReady"; : "AlertQuoteReady";
}, },