Merge pull request #1269 from Safelite/feature/CSR-1370-tr
Feature/csr 1370 tr
This commit is contained in:
commit
26f887e6cc
3 changed files with 75 additions and 57 deletions
|
|
@ -77,11 +77,8 @@ const figmaScenarios = [
|
||||||
{
|
{
|
||||||
name: "05_01_CSR_Quote_Cash",
|
name: "05_01_CSR_Quote_Cash",
|
||||||
params: {
|
params: {
|
||||||
availableVaps: [
|
wiperResponse: [testConstants.parts.frontWiperPart, testConstants.parts.rearWiperPart],
|
||||||
testConstants.parts.frontWiperPart,
|
rainDefenseResponse: testConstants.parts.rainDefensePart,
|
||||||
testConstants.parts.rearWiperPart,
|
|
||||||
testConstants.parts.rainDefensePart,
|
|
||||||
],
|
|
||||||
damage: {
|
damage: {
|
||||||
isRepair: false,
|
isRepair: false,
|
||||||
glassToReplace: [testConstants.damages.frontWindshield],
|
glassToReplace: [testConstants.damages.frontWindshield],
|
||||||
|
|
@ -142,11 +139,8 @@ const figmaScenarios = [
|
||||||
{
|
{
|
||||||
name: "05_01_CSR_Quote_Standard_Repair",
|
name: "05_01_CSR_Quote_Standard_Repair",
|
||||||
params: {
|
params: {
|
||||||
availableVaps: [
|
wiperResponse: [testConstants.parts.frontWiperPart, testConstants.parts.rearWiperPart],
|
||||||
testConstants.parts.frontWiperPart,
|
rainDefenseResponse: testConstants.parts.rainDefensePart,
|
||||||
testConstants.parts.rearWiperPart,
|
|
||||||
testConstants.parts.rainDefensePart,
|
|
||||||
],
|
|
||||||
damage: {
|
damage: {
|
||||||
isRepair: true,
|
isRepair: true,
|
||||||
glassToReplace: [],
|
glassToReplace: [],
|
||||||
|
|
@ -206,11 +200,8 @@ const figmaScenarios = [
|
||||||
{
|
{
|
||||||
name: "05_01_CSR_Quote_Recal",
|
name: "05_01_CSR_Quote_Recal",
|
||||||
params: {
|
params: {
|
||||||
availableVaps: [
|
wiperResponse: [testConstants.parts.frontWiperPart, testConstants.parts.rearWiperPart],
|
||||||
testConstants.parts.frontWiperPart,
|
rainDefenseResponse: testConstants.parts.rainDefensePart,
|
||||||
testConstants.parts.rearWiperPart,
|
|
||||||
testConstants.parts.rainDefensePart,
|
|
||||||
],
|
|
||||||
damage: {
|
damage: {
|
||||||
isRepair: false,
|
isRepair: false,
|
||||||
glassToReplace: [testConstants.damages.frontWindshield],
|
glassToReplace: [testConstants.damages.frontWindshield],
|
||||||
|
|
@ -271,11 +262,8 @@ const figmaScenarios = [
|
||||||
{
|
{
|
||||||
name: "05_01_CSR_Quote_RearGlass+NonWindshield",
|
name: "05_01_CSR_Quote_RearGlass+NonWindshield",
|
||||||
params: {
|
params: {
|
||||||
availableVaps: [
|
wiperResponse: [testConstants.parts.frontWiperPart, testConstants.parts.rearWiperPart],
|
||||||
testConstants.parts.frontWiperPart,
|
rainDefenseResponse: testConstants.parts.rainDefensePart,
|
||||||
testConstants.parts.rearWiperPart,
|
|
||||||
testConstants.parts.rainDefensePart,
|
|
||||||
],
|
|
||||||
damage: {
|
damage: {
|
||||||
isRepair: false,
|
isRepair: false,
|
||||||
glassToReplace: [testConstants.damages.rearWindshield],
|
glassToReplace: [testConstants.damages.rearWindshield],
|
||||||
|
|
@ -343,11 +331,8 @@ const figmaScenarios = [
|
||||||
{
|
{
|
||||||
name: "05_01_CSR_Quote_RearGlass+Windshield",
|
name: "05_01_CSR_Quote_RearGlass+Windshield",
|
||||||
params: {
|
params: {
|
||||||
availableVaps: [
|
wiperResponse: [testConstants.parts.frontWiperPart, testConstants.parts.rearWiperPart],
|
||||||
testConstants.parts.frontWiperPart,
|
rainDefenseResponse: testConstants.parts.rainDefensePart,
|
||||||
testConstants.parts.rearWiperPart,
|
|
||||||
testConstants.parts.rainDefensePart,
|
|
||||||
],
|
|
||||||
damage: {
|
damage: {
|
||||||
isRepair: false,
|
isRepair: false,
|
||||||
glassToReplace: [
|
glassToReplace: [
|
||||||
|
|
@ -461,7 +446,8 @@ const figmaScenarios = [
|
||||||
{
|
{
|
||||||
name: "05_01_CSR_Quote_RearGlassNoFrontFit",
|
name: "05_01_CSR_Quote_RearGlassNoFrontFit",
|
||||||
params: {
|
params: {
|
||||||
availableVaps: [testConstants.parts.rearWiperPart, testConstants.parts.rainDefensePart],
|
wiperResponse: [testConstants.parts.rearWiperPart],
|
||||||
|
rainDefenseResponse: testConstants.parts.rainDefensePart,
|
||||||
damage: {
|
damage: {
|
||||||
isRepair: false,
|
isRepair: false,
|
||||||
glassToReplace: [testConstants.damages.rearWindshield],
|
glassToReplace: [testConstants.damages.rearWindshield],
|
||||||
|
|
@ -518,11 +504,8 @@ const figmaScenarios = [
|
||||||
{
|
{
|
||||||
name: "05_01_CSR_Quote_Windshield+SideGlass",
|
name: "05_01_CSR_Quote_Windshield+SideGlass",
|
||||||
params: {
|
params: {
|
||||||
availableVaps: [
|
wiperResponse: [testConstants.parts.frontWiperPart, testConstants.parts.rearWiperPart],
|
||||||
testConstants.parts.frontWiperPart,
|
rainDefenseResponse: testConstants.parts.rainDefensePart,
|
||||||
testConstants.parts.rearWiperPart,
|
|
||||||
testConstants.parts.rainDefensePart,
|
|
||||||
],
|
|
||||||
damage: {
|
damage: {
|
||||||
isRepair: false,
|
isRepair: false,
|
||||||
glassToReplace: [
|
glassToReplace: [
|
||||||
|
|
@ -586,11 +569,8 @@ const figmaScenarios = [
|
||||||
{
|
{
|
||||||
name: "05_01_CSR_Quote_SideGlass",
|
name: "05_01_CSR_Quote_SideGlass",
|
||||||
params: {
|
params: {
|
||||||
availableVaps: [
|
wiperResponse: [testConstants.parts.frontWiperPart, testConstants.parts.rearWiperPart],
|
||||||
testConstants.parts.frontWiperPart,
|
rainDefenseResponse: testConstants.parts.rainDefensePart,
|
||||||
testConstants.parts.rearWiperPart,
|
|
||||||
testConstants.parts.rainDefensePart,
|
|
||||||
],
|
|
||||||
damage: {
|
damage: {
|
||||||
isRepair: false,
|
isRepair: false,
|
||||||
glassToReplace: [testConstants.damages.sideGlass],
|
glassToReplace: [testConstants.damages.sideGlass],
|
||||||
|
|
@ -678,7 +658,8 @@ const figmaScenarios = [
|
||||||
{
|
{
|
||||||
name: "05_01_CSR_Quote_NoWiperFit",
|
name: "05_01_CSR_Quote_NoWiperFit",
|
||||||
params: {
|
params: {
|
||||||
availableVaps: [testConstants.parts.rainDefensePart],
|
wiperResponse: [],
|
||||||
|
rainDefenseResponse: testConstants.parts.rainDefensePart,
|
||||||
damage: {
|
damage: {
|
||||||
isRepair: false,
|
isRepair: false,
|
||||||
glassToReplace: [testConstants.damages.frontWindshield],
|
glassToReplace: [testConstants.damages.frontWindshield],
|
||||||
|
|
@ -821,6 +802,8 @@ describe("Service Package Review Block", () => {
|
||||||
propsData: props,
|
propsData: props,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
initializeWithDefault(wrapper);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await wrapper.vm.$nextTick();
|
await wrapper.vm.$nextTick();
|
||||||
|
|
||||||
|
|
@ -851,6 +834,8 @@ describe("Service Package Review Block", () => {
|
||||||
propsData: props,
|
propsData: props,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
initializeWithDefault(wrapper);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await wrapper.vm.$nextTick();
|
await wrapper.vm.$nextTick();
|
||||||
|
|
||||||
|
|
@ -874,6 +859,8 @@ describe("Service Package Review Block", () => {
|
||||||
// Act
|
// Act
|
||||||
await wrapper.vm.$nextTick();
|
await wrapper.vm.$nextTick();
|
||||||
|
|
||||||
|
initializeWithDefault(wrapper);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
const includesFrontWiperCopy = wrapper.vm.displayContent.includes(
|
const includesFrontWiperCopy = wrapper.vm.displayContent.includes(
|
||||||
testConstants.vapsCopy.frontWiperCopy
|
testConstants.vapsCopy.frontWiperCopy
|
||||||
|
|
@ -893,6 +880,8 @@ describe("Service Package Review Block", () => {
|
||||||
propsData: generateDefaultProps(),
|
propsData: generateDefaultProps(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
initializeWithDefault(wrapper);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await wrapper.vm.$nextTick();
|
await wrapper.vm.$nextTick();
|
||||||
|
|
||||||
|
|
@ -908,7 +897,6 @@ describe("Service Package Review Block", () => {
|
||||||
it(`Should match figma scenario "${scenario.name}", iteration "${iteration.name}"`, async () => {
|
it(`Should match figma scenario "${scenario.name}", iteration "${iteration.name}"`, async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
let props = generateDefaultProps();
|
let props = generateDefaultProps();
|
||||||
props.availableVaps = scenario.params.availableVaps;
|
|
||||||
props.damage = scenario.params.damage;
|
props.damage = scenario.params.damage;
|
||||||
props.glassParts = scenario.params.glassParts;
|
props.glassParts = scenario.params.glassParts;
|
||||||
props.lineItems.supportingItems = scenario.params.supportingItems;
|
props.lineItems.supportingItems = scenario.params.supportingItems;
|
||||||
|
|
@ -918,6 +906,11 @@ describe("Service Package Review Block", () => {
|
||||||
propsData: props,
|
propsData: props,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
wrapper.vm.initializeComponent({
|
||||||
|
wipers: scenario.params.wiperResponse,
|
||||||
|
rainDefense: scenario.params.rainDefenseResponse,
|
||||||
|
});
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await wrapper.vm.$nextTick();
|
await wrapper.vm.$nextTick();
|
||||||
|
|
||||||
|
|
@ -932,12 +925,18 @@ describe("Service Package Review Block", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function initializeWithDefault(wrapper) {
|
||||||
|
wrapper.vm.initializeComponent({
|
||||||
|
wipers: [testConstants.parts.frontWiperPart],
|
||||||
|
rainDefense: testConstants.parts.rainDefensePart,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function generateDefaultProps() {
|
function generateDefaultProps() {
|
||||||
return {
|
return {
|
||||||
servicePackageOptionsCmsName: testConstants.cmsPropValues.servicePackageOptionsCmsName,
|
servicePackageOptionsCmsName: testConstants.cmsPropValues.servicePackageOptionsCmsName,
|
||||||
defaultPackageItemsCmsName: testConstants.cmsPropValues.defaultPackageItemsCmsName,
|
defaultPackageItemsCmsName: testConstants.cmsPropValues.defaultPackageItemsCmsName,
|
||||||
vapsItemsCmsName: testConstants.cmsPropValues.vapsItemsCmsName,
|
vapsItemsCmsName: testConstants.cmsPropValues.vapsItemsCmsName,
|
||||||
availableVaps: [testConstants.parts.frontWiperPart, testConstants.parts.rainDefensePart],
|
|
||||||
lineItems: {
|
lineItems: {
|
||||||
glassParts: [],
|
glassParts: [],
|
||||||
supportingItems: [],
|
supportingItems: [],
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@ import {
|
||||||
getHighestFullySatisfiedTier,
|
getHighestFullySatisfiedTier,
|
||||||
containsLineItemWithPartType,
|
containsLineItemWithPartType,
|
||||||
} from "@/helpers/service-package-helper";
|
} from "@/helpers/service-package-helper";
|
||||||
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
import { storeActions } from "@/constants/store-actions";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "service-package-review",
|
name: "service-package-review",
|
||||||
|
|
@ -18,14 +21,39 @@ export default {
|
||||||
servicePackageOptionsCmsName: String,
|
servicePackageOptionsCmsName: String,
|
||||||
defaultPackageItemsCmsName: String,
|
defaultPackageItemsCmsName: String,
|
||||||
vapsItemsCmsName: String,
|
vapsItemsCmsName: String,
|
||||||
availableVaps: Array,
|
|
||||||
lineItems: Object,
|
lineItems: Object,
|
||||||
damage: Object,
|
damage: Object,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {
|
||||||
|
availableVaps: [],
|
||||||
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
loadInitialData() {
|
||||||
|
const wipersPromise = baseMixin.methods.dispatchStoreAction(storeActions.GET_WIPERS);
|
||||||
|
const rainDefensePromise = baseMixin.methods.dispatchStoreAction(
|
||||||
|
storeActions.GET_RAIN_DEFENSE
|
||||||
|
);
|
||||||
|
|
||||||
|
const promiseResultMap = [
|
||||||
|
{
|
||||||
|
resultKey: "wipers",
|
||||||
|
promise: wipersPromise,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
resultKey: "rainDefense",
|
||||||
|
promise: rainDefensePromise,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return settleAllPromises(promiseResultMap);
|
||||||
|
},
|
||||||
|
initializeComponent(apiResponses) {
|
||||||
|
const vapsFromApi = [...apiResponses.wipers, apiResponses.rainDefense];
|
||||||
|
|
||||||
|
this.availableVaps = vapsFromApi;
|
||||||
|
},
|
||||||
editClicked() {
|
editClicked() {
|
||||||
this.$emit("edit-clicked");
|
this.$emit("edit-clicked");
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -55,11 +55,11 @@
|
||||||
<hr class="my-0" />
|
<hr class="my-0" />
|
||||||
|
|
||||||
<servicePackageReview
|
<servicePackageReview
|
||||||
|
ref="servicePackageReview"
|
||||||
servicePackageOptionsCmsName="ServicePackageTitle"
|
servicePackageOptionsCmsName="ServicePackageTitle"
|
||||||
defaultPackageItemsCmsName="DefaultPackageItemDescriptions"
|
defaultPackageItemsCmsName="DefaultPackageItemDescriptions"
|
||||||
vapsItemsCmsName="VapsItemDescriptions"
|
vapsItemsCmsName="VapsItemDescriptions"
|
||||||
:damage="damageInfo"
|
:damage="damageInfo"
|
||||||
:availableVaps="availableVaps"
|
|
||||||
:lineItems="lineItems"
|
:lineItems="lineItems"
|
||||||
@edit-clicked="editServicePackage" />
|
@edit-clicked="editServicePackage" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -103,6 +103,8 @@ export default {
|
||||||
storeActions.GET_RAIN_DEFENSE
|
storeActions.GET_RAIN_DEFENSE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const servicePackageInitialDataPromise = servicePackageReview.methods.loadInitialData();
|
||||||
|
|
||||||
// Settle promises and get results
|
// Settle promises and get results
|
||||||
const promiseResultMap = [
|
const promiseResultMap = [
|
||||||
{
|
{
|
||||||
|
|
@ -110,12 +112,8 @@ export default {
|
||||||
promise: cmsContentPromise,
|
promise: cmsContentPromise,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
resultKey: "wipers",
|
resultKey: "servicePackageData",
|
||||||
promise: wipersPromise,
|
promise: servicePackageInitialDataPromise,
|
||||||
},
|
|
||||||
{
|
|
||||||
resultKey: "rainDefense",
|
|
||||||
promise: rainDefensePromise,
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -124,15 +122,11 @@ export default {
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
|
||||||
vm.availableWipers = resultMap.wipers;
|
vm.$refs.servicePackageReview.initializeComponent(resultMap.servicePackageData);
|
||||||
vm.availableRainDefense = [resultMap.rainDefense];
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {};
|
||||||
availableWipers: null,
|
|
||||||
availableRainDefense: null,
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
|
|
@ -175,9 +169,6 @@ export default {
|
||||||
damageInfo() {
|
damageInfo() {
|
||||||
return this.$store.getters.damage;
|
return this.$store.getters.damage;
|
||||||
},
|
},
|
||||||
availableVaps() {
|
|
||||||
return [...(this.availableWipers ?? []), ...(this.availableRainDefense ?? [])];
|
|
||||||
},
|
|
||||||
lineItems() {
|
lineItems() {
|
||||||
return this.$store.getters.lineItems;
|
return this.$store.getters.lineItems;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue