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 = {
GOOGLE_CUSTOM_DIMENSION_INDEX: "Google Custom Dimension Index",
SUPPRESS_VIN_CAPTURE: "SuppressVinCapture",
};
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 { storeActions } from "@/constants/store-actions.js";
import { settleAllPromises } from "@/helpers/layout-helper";
import experimentMixin from "@/mixins/experiment-mixin";
import { experimentSettings } from "@/constants/experiments";
import store from "@/store";
import router from "@/router";
@ -98,12 +100,18 @@ async function getLatestPageForRedirection() {
} else if (partQuestionsComponent.methods.arePagePrerequisitesValid()) {
return fmgPageValues.PART_QUESTIONS;
} else if (
// capture vin
vinLookupComponent.methods.arePagePrerequisitesValid() &&
!store.getters.damage.isRepair &&
!isVinOptionalVehicle
!isVinOptionalVehicle &&
experimentMixin.methods.hasSettingEqualTo(
experimentSettings.SUPPRESS_VIN_CAPTURE,
false
)
) {
return fmgPageValues.VIN_LOOKUP;
} else {
// do not capture vin
return fmgPageValues.ESTIMATE;
}
}

View file

@ -221,16 +221,29 @@ describe("estimate.vue", () => {
describe("skipVinLookup", () => {
const skipOptions = [
[true, true, true],
[true, false, true],
[false, true, true],
[false, false, false],
[true, true, true, true],
[true, false, false, true],
[false, true, true, true],
[false, false, false, false],
];
test.each(skipOptions)(
"isRepair %s and isVinOptional %s should return %s",
async (isRepair, isVinOptionalVehicle, expectedVinSkip) => {
const { wrapper } = setupMocks({ isVinOptionalVehicle: isVinOptionalVehicle });
"isRepair %s, isVinOptional %s and suppressVinCapture %s should return %s",
async (isRepair, isVinOptionalVehicle, suppressVinCapture, expectedVinSkip) => {
const { wrapper } = setupMocks({});
await wrapper.setData({
isVinOptionalVehicle: isVinOptionalVehicle,
});
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);
}

View file

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