CSR-743 experiment integration testing
This commit is contained in:
parent
d861d49694
commit
65a2c3ae94
7 changed files with 169 additions and 81 deletions
|
|
@ -74,7 +74,7 @@ export function getDeviceIdValue(){
|
||||||
return cookieValueMatch[0].split('=')[1];
|
return cookieValueMatch[0].split('=')[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return '00000000-0000-0000-0000-000000000000';
|
return 'cf1ec454-36a8-4137-8842-5207e86ca0be';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
15
src/layouts/test-one.vue
Normal file
15
src/layouts/test-one.vue
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<template>
|
||||||
|
Test1
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "test1",
|
||||||
|
methods: {
|
||||||
|
arePagePrerequisitesValid() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
15
src/layouts/test-two.vue
Normal file
15
src/layouts/test-two.vue
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<template>
|
||||||
|
Test2
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "test2",
|
||||||
|
methods: {
|
||||||
|
arePagePrerequisitesValid() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -4,11 +4,14 @@
|
||||||
<div class="select-car">
|
<div class="select-car">
|
||||||
<div class="select-car-form rounded text-center">
|
<div class="select-car-form rounded text-center">
|
||||||
<vehicleBanner cmsWidgetName="VehicleBannerWidget" displayGenericVehicleImage />
|
<vehicleBanner cmsWidgetName="VehicleBannerWidget" displayGenericVehicleImage />
|
||||||
<funnelSubHeader
|
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" :hasBackButton="true"
|
||||||
cmsWidgetName="FunnelSubHeaderWidget"
|
@click-event="backButtonAction" />
|
||||||
:hasBackButton="true"
|
<div v-if="shouldShowText">
|
||||||
@click-event="backButtonAction"
|
{{ textToShow }}
|
||||||
/>
|
</div>
|
||||||
|
<button @click="logCustomExposureTest">
|
||||||
|
Click me to log exposure!
|
||||||
|
</button>
|
||||||
<div class="fade-on-route-transition">
|
<div class="fade-on-route-transition">
|
||||||
<makeQuestion v-model="selectedMake" ref="makeQuestion" cmsWidgetName="VehicleMakeQuestion" />
|
<makeQuestion v-model="selectedMake" ref="makeQuestion" cmsWidgetName="VehicleMakeQuestion" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -26,9 +29,10 @@ import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-he
|
||||||
// Supporting files
|
// Supporting files
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import { storeMutations } from "@/constants/store-mutations";
|
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
import { getDeviceIdValue, getSessionKeyValue } from "@/helpers/heritage-integration/cookie-helper";
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "vehicle-make",
|
name: "vehicle-make",
|
||||||
|
|
@ -37,7 +41,14 @@ export default {
|
||||||
selectedMake: null,
|
selectedMake: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {
|
||||||
|
shouldShowText() {
|
||||||
|
return this.hasSettingEqualTo("someKey", "true");
|
||||||
|
},
|
||||||
|
textToShow() {
|
||||||
|
return store.getters.experimentSettings.sampleSetting
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
// Call APIs
|
// Call APIs
|
||||||
|
|
@ -68,6 +79,23 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
async logCustomExposureTest() {
|
||||||
|
console.log("HITHERE")
|
||||||
|
await this.dispatchStoreAction(storeActions.RUN_EXPERIMENTS_FOR_TRIGGER, {
|
||||||
|
userId: getDeviceIdValue(),
|
||||||
|
triggerEvent: "PageEntry",
|
||||||
|
triggerValue: "vehicle-make"
|
||||||
|
})
|
||||||
|
const testExperiment = store.getters.applicationUser.experiments.find(e => e.universeName === "Concept Test Site Entry")
|
||||||
|
console.log(testExperiment)
|
||||||
|
await this.dispatchStoreAction(storeActions.LOG_EXPERIMENT_EXPOSURE,
|
||||||
|
{
|
||||||
|
userId: getDeviceIdValue(),
|
||||||
|
sessionKey: getSessionKeyValue(),
|
||||||
|
pageName: "vehicle-make",
|
||||||
|
experiment: testExperiment
|
||||||
|
}, false);
|
||||||
|
},
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
// route to move backwards
|
// route to move backwards
|
||||||
this.$router.navigateWithoutSaving(
|
this.$router.navigateWithoutSaving(
|
||||||
|
|
@ -76,7 +104,7 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
if (store.getters.vehicle.year){
|
if (store.getters.vehicle.year) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@ import store from "@/store";
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
hasSettingEqualTo(settingName, settingValue) {
|
hasSettingEqualTo(settingName, settingValue) {
|
||||||
return store.getters.experimentSettings[settingName] === settingValue;
|
console.log(store.getters.experimentSettings)
|
||||||
|
console.log(store.getters.experimentSettings[settingName])
|
||||||
|
console.log(settingValue)
|
||||||
|
return store.getters.experimentSettings[settingName] == settingValue;
|
||||||
},
|
},
|
||||||
hasSetting(settingName) {
|
hasSetting(settingName) {
|
||||||
return Object.hasOwn(store.getters.experimentSettings, settingName);
|
return Object.hasOwn(store.getters.experimentSettings, settingName);
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,23 @@ import store from "@/store";
|
||||||
import analyticsMixin from "@/mixins/analytics-mixin";
|
import analyticsMixin from "@/mixins/analytics-mixin";
|
||||||
import { experimentTriggers } from "../constants/experiments";
|
import { experimentTriggers } from "../constants/experiments";
|
||||||
import { applicationConfig } from "../constants/application-config";
|
import { applicationConfig } from "../constants/application-config";
|
||||||
|
import TestOne from "@/layouts/test-one";
|
||||||
|
import TestTwo from "@/layouts/test-two";
|
||||||
const routes = [
|
const routes = [
|
||||||
|
{
|
||||||
|
path: "/test1",
|
||||||
|
name: "test1",
|
||||||
|
components: {
|
||||||
|
default: TestOne
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/test2",
|
||||||
|
name: "test2",
|
||||||
|
components: {
|
||||||
|
default: TestTwo
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
name: "root",
|
name: "root",
|
||||||
|
|
@ -225,6 +240,8 @@ function navigateToUrl(url, optionalQuery = {}) {
|
||||||
externalUrl.searchParams.append(queryKey, optionalQuery[queryKey]);
|
externalUrl.searchParams.append(queryKey, optionalQuery[queryKey]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
externalUrl.searchParams.append("experiments", "ConceptFunnel=ConceptFunnel_V1=ConceptFunnel_TEST=true");
|
||||||
|
|
||||||
window.location.assign(externalUrl);
|
window.location.assign(externalUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,16 @@ const routingTable = function(store) {
|
||||||
{
|
{
|
||||||
fmgPageValue: fmgPageValues.VEHICLE_YEAR,
|
fmgPageValue: fmgPageValues.VEHICLE_YEAR,
|
||||||
maps: [
|
maps: [
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.SELECTED_YEAR,
|
||||||
|
destinationFmgPageValue: "test1",
|
||||||
|
filter: store.getters.vehicle.year === 2010
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.SELECTED_YEAR,
|
||||||
|
destinationFmgPageValue: "test2",
|
||||||
|
filter: store.getters.vehicle.year < 1954
|
||||||
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.SELECTED_YEAR,
|
scenario: navigationScenarios.SELECTED_YEAR,
|
||||||
destinationFmgPageValue: fmgPageValues.VEHICLE_MAKE,
|
destinationFmgPageValue: fmgPageValues.VEHICLE_MAKE,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue