Merge branch 'develop' of https://github.com/Safelite/DigitalConsumer.ISS into feature/digital/SSR-1043
git push git push git add . git add . git stauts git add . ls Lines starting with '#' will be ignored, and an empty message aborts
This commit is contained in:
commit
f353ca414b
4 changed files with 107 additions and 10 deletions
|
|
@ -8,6 +8,7 @@ import settleAllPromises from '@/helpers/layout-helper.js';
|
||||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '@vue/test-utils';
|
||||||
import { createTestingPinia } from '@pinia/testing';
|
import { createTestingPinia } from '@pinia/testing';
|
||||||
|
import { nextTick } from 'vue';
|
||||||
|
|
||||||
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||||
|
|
||||||
|
|
@ -67,6 +68,16 @@ const initialStore = {
|
||||||
zipCode: '12345'
|
zipCode: '12345'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
payment: {
|
||||||
|
isInsurance: true,
|
||||||
|
isPayInAdvance: false
|
||||||
|
},
|
||||||
|
contactInfo: {
|
||||||
|
firstName: 'Test',
|
||||||
|
lastName: 'Test',
|
||||||
|
phoneNumber: '111-111-1111',
|
||||||
|
emailAddress: 'test@email.com'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -167,6 +178,20 @@ describe('OrderConfirmation.vue', () => {
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
window.sessionStorage.removeItem('submittedOrder');
|
window.sessionStorage.removeItem('submittedOrder');
|
||||||
});
|
});
|
||||||
|
describe('Page pre-requisites', () => {
|
||||||
|
test('If submitted order saved to store, page pre-reqs return true', async () => {
|
||||||
|
// Arrange
|
||||||
|
window.sessionStorage.setItem('submittedOrder', JSON.stringify(sessionStorage));
|
||||||
|
const { wrapper } = getMountedComponent(initialStore);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
|
||||||
|
await nextTick();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(arePagePrerequisitesValid).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
describe('Rendering', () => {
|
describe('Rendering', () => {
|
||||||
test('Should render Site Header', () => {
|
test('Should render Site Header', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ export default {
|
||||||
},
|
},
|
||||||
mixins: [BaseFormMixin],
|
mixins: [BaseFormMixin],
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
|
console.log('beforeRouteEnter just called');
|
||||||
useMainStore().createSubmittedOrder();
|
useMainStore().createSubmittedOrder();
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||||
|
|
@ -270,6 +271,68 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
arePagePrerequisitesValid() {
|
||||||
|
const hasSubmittedOrder = useMainStore().hasSubmittedOrder();
|
||||||
|
if (hasSubmittedOrder) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Service Location
|
||||||
|
const { serviceLocation } = useMainStore().order;
|
||||||
|
const mobileReqs = !!(
|
||||||
|
serviceLocation.address
|
||||||
|
&& serviceLocation.city
|
||||||
|
&& serviceLocation.state
|
||||||
|
&& serviceLocation.zipCode
|
||||||
|
);
|
||||||
|
|
||||||
|
const providerLocation = serviceLocation.provider.address;
|
||||||
|
const dropOffInShopReqs = !!(
|
||||||
|
providerLocation.streetAddress
|
||||||
|
&& providerLocation.city
|
||||||
|
&& providerLocation.state
|
||||||
|
&& providerLocation.zipCode
|
||||||
|
);
|
||||||
|
|
||||||
|
const isMobile = serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE
|
||||||
|
|| serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP;
|
||||||
|
|
||||||
|
const serviceLocationReqs =
|
||||||
|
(isMobile && mobileReqs) || (!isMobile && dropOffInShopReqs);
|
||||||
|
|
||||||
|
// Insurance
|
||||||
|
const isInsuranceSet = useMainStore().order.payment.isInsurance !== null;
|
||||||
|
|
||||||
|
// Schedule
|
||||||
|
const { schedule } = useMainStore().order;
|
||||||
|
const scheduleReqs = !!(
|
||||||
|
schedule.date
|
||||||
|
&& schedule.startTime
|
||||||
|
&& schedule.endTime
|
||||||
|
&& schedule.jobMaxMinutes
|
||||||
|
&& schedule.jobMinMinutes
|
||||||
|
);
|
||||||
|
|
||||||
|
// Contact Info
|
||||||
|
const { contactInfo } = useMainStore().order;
|
||||||
|
const contactInfoReqs = !!(
|
||||||
|
contactInfo.firstName
|
||||||
|
&& contactInfo.lastName
|
||||||
|
&& contactInfo.phoneNumber
|
||||||
|
&& contactInfo.emailAddress
|
||||||
|
);
|
||||||
|
|
||||||
|
// Payment
|
||||||
|
const paymentMethodReqs = useMainStore().order.payment.isPayInAdvance === false;
|
||||||
|
|
||||||
|
return (
|
||||||
|
serviceLocationReqs
|
||||||
|
&& isInsuranceSet
|
||||||
|
&& scheduleReqs
|
||||||
|
&& contactInfoReqs
|
||||||
|
&& paymentMethodReqs
|
||||||
|
);
|
||||||
|
},
|
||||||
forwardButtonAction() {
|
forwardButtonAction() {
|
||||||
this.$router.navigateToExternalUrl(this.carrierUrl);
|
this.$router.navigateToExternalUrl(this.carrierUrl);
|
||||||
},
|
},
|
||||||
|
|
@ -355,5 +418,9 @@ $page-side-padding: 1.5rem;
|
||||||
font-weight: $font-weight-bold;
|
font-weight: $font-weight-bold;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
:deep(strong) {
|
||||||
|
font-weight: $font-weight-bold;
|
||||||
|
color: $black;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -664,21 +664,26 @@ export default {
|
||||||
},
|
},
|
||||||
getPayInAdvanceLineItems(cartItems) {
|
getPayInAdvanceLineItems(cartItems) {
|
||||||
const { glassParts } = useMainStore().order.lineItems;
|
const { glassParts } = useMainStore().order.lineItems;
|
||||||
const lineItems = (glassParts === null) ? ['Labor|0|1', 'Repair supplies|0|1'] : ['Parts and labor|0|1'];
|
const lineItems = (glassParts === null)
|
||||||
|
? [this.getPayInAdvanceFormattedLineItem('Labor', 0, 1), this.getPayInAdvanceFormattedLineItem('Repair supplies', 0, 1)]
|
||||||
|
: [this.getPayInAdvanceFormattedLineItem('Parts and labor', 0, 1)];
|
||||||
|
|
||||||
cartItems.forEach((item) => {
|
cartItems.forEach((item) => {
|
||||||
if (item.name !== null && item.category !== 'promos') {
|
if (item.name !== null && item.category !== 'promos') {
|
||||||
lineItems.push(`${item.name}|${(item.salesTax + item.subTotal).toFixed(2)}|1`);
|
lineItems.push(this.getPayInAdvanceFormattedLineItem(item.name, (item.salesTax + item.subTotal).toFixed(2), 1));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.payInAdvanceLineItems = lineItems.join('||');
|
this.payInAdvanceLineItems = lineItems.join('||');
|
||||||
},
|
},
|
||||||
|
getPayInAdvanceFormattedLineItem(itemName, price, quantity) {
|
||||||
|
return `${itemName}|${price}|${quantity}`;
|
||||||
|
},
|
||||||
getMockPiaLineItems() {
|
getMockPiaLineItems() {
|
||||||
let lineItems = [];
|
let lineItems = [];
|
||||||
lineItems = ['Parts and labor|0|1'];
|
lineItems = [this.getPayInAdvanceFormattedLineItem('Parts and labor', 0, 1)];
|
||||||
lineItems.push('New wiper blades|75.22|1');
|
lineItems.push(this.getPayInAdvanceFormattedLineItem('New wiper blades', 75.22, 1));
|
||||||
lineItems.push('Recycling|37.60|1');
|
lineItems.push(this.getPayInAdvanceFormattedLineItem('Recycling', 37.60, 1));
|
||||||
|
|
||||||
this.payInAdvanceLineItems = lineItems.join('||');
|
this.payInAdvanceLineItems = lineItems.join('||');
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ const routingTable = () => [
|
||||||
maps: [
|
maps: [
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
||||||
destinationIssPageValue: issPageValues.VIN_LOOKUP
|
destinationIssPageValue: issPageValues.VEHICLE_DAMAGE
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
|
|
@ -199,7 +199,7 @@ const routingTable = () => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
||||||
destinationIssPageValue: issPageValues.VIN_LOOKUP
|
destinationIssPageValue: issPageValues.VEHICLE_DAMAGE
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
|
|
@ -224,7 +224,7 @@ const routingTable = () => [
|
||||||
maps: [
|
maps: [
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
||||||
destinationIssPageValue: issPageValues.VIN_LOOKUP
|
destinationIssPageValue: issPageValues.VEHICLE_DAMAGE
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
|
|
@ -253,7 +253,7 @@ const routingTable = () => [
|
||||||
maps: [
|
maps: [
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
||||||
destinationIssPageValue: issPageValues.VIN_LOOKUP
|
destinationIssPageValue: issPageValues.VEHICLE_DAMAGE
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
|
|
@ -486,7 +486,7 @@ const routingTable = () => [
|
||||||
maps: [
|
maps: [
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
||||||
destinationIssPageValue: issPageValues.VIN_LOOKUP
|
destinationIssPageValue: issPageValues.VEHICLE_DAMAGE
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue