Merge branch 'develop' into feature/CASH-612
This commit is contained in:
commit
4320a5cea8
59 changed files with 1532 additions and 134 deletions
|
|
@ -9,8 +9,9 @@ SKIP_CONTENT_SITE="false"
|
||||||
|
|
||||||
# Experiments Flag
|
# Experiments Flag
|
||||||
IS_MOBILEFIRST="false"
|
IS_MOBILEFIRST="false"
|
||||||
IS_ADYENPAYMENTS="false"
|
IS_ADYENPAYMENTS="true"
|
||||||
IS_MULTILOCATIONPOPUP="false"
|
IS_MULTILOCATIONPOPUP="false"
|
||||||
|
IS_MSRSPLITPAY="false"
|
||||||
|
|
||||||
# Base URLs by environment
|
# Base URLs by environment
|
||||||
# qa
|
# qa
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,16 @@
|
||||||
# Environment configuration
|
# Environment configuration
|
||||||
|
|
||||||
# Environment type
|
# Environment type
|
||||||
PLAYWRIGHT_ENV="qa"
|
PLAYWRIGHT_ENV="QA"
|
||||||
|
|
||||||
# Skip content site
|
# Skip content site
|
||||||
SKIP_CONTENT_SITE="false"
|
SKIP_CONTENT_SITE="false"
|
||||||
|
|
||||||
# Experiments Flag
|
# Experiments Flag
|
||||||
IS_MOBILEFIRST="false"
|
IS_MOBILEFIRST="false"
|
||||||
IS_ADYENPAYMENTS="false"
|
IS_ADYENPAYMENTS="true"
|
||||||
IS_MULTILOCATIONPOPUP="false"
|
IS_MULTILOCATIONPOPUP="false"
|
||||||
|
IS_MSRSPLITPAY="false"
|
||||||
|
|
||||||
# Base URLs by environment
|
# Base URLs by environment
|
||||||
# qa
|
# qa
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@ export interface ITestData extends base {
|
||||||
mockFirstInshopCallNoSchedule?: boolean,
|
mockFirstInshopCallNoSchedule?: boolean,
|
||||||
handleMobileFirstModal?: boolean,
|
handleMobileFirstModal?: boolean,
|
||||||
experiments?: IExperiments
|
experiments?: IExperiments
|
||||||
|
isMSRGlassPart?: boolean,
|
||||||
|
isMSRZip?: boolean,
|
||||||
|
isPIAEnabled?: boolean,
|
||||||
|
isDualRecal?: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -19,5 +23,6 @@ export function getDefaultExperimentsData(): IExperiments {
|
||||||
isAdyenPayments: !!process.env.IS_ADYENPAYMENTS && process.env.IS_ADYENPAYMENTS !== "" ? process.env.IS_ADYENPAYMENTS === "true" : false,
|
isAdyenPayments: !!process.env.IS_ADYENPAYMENTS && process.env.IS_ADYENPAYMENTS !== "" ? process.env.IS_ADYENPAYMENTS === "true" : false,
|
||||||
isMobileFirst: !!process.env.IS_MOBILEFIRST && process.env.IS_MOBILEFIRST !== "" ? process.env.IS_MOBILEFIRST === "true" : false,
|
isMobileFirst: !!process.env.IS_MOBILEFIRST && process.env.IS_MOBILEFIRST !== "" ? process.env.IS_MOBILEFIRST === "true" : false,
|
||||||
isMultiLocationPopup: !!process.env.IS_MULTILOCATIONPOPUP && process.env.IS_MULTILOCATIONPOPUP !== "" ? process.env.IS_MULTILOCATIONPOPUP === "true" : false,
|
isMultiLocationPopup: !!process.env.IS_MULTILOCATIONPOPUP && process.env.IS_MULTILOCATIONPOPUP !== "" ? process.env.IS_MULTILOCATIONPOPUP === "true" : false,
|
||||||
|
isMsrSplitPay: !!process.env.IS_MSRSPLITPAY && process.env.IS_MSRSPLITPAY !== "" ? process.env.IS_MSRSPLITPAY === "true" : false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import VehiclePartQuestionsPage from "../pages/VehiclePartsPage"
|
||||||
import CapabilityQuestionsPage from "../pages/CapabilityQuestionsPage"
|
import CapabilityQuestionsPage from "../pages/CapabilityQuestionsPage"
|
||||||
import MoldingQuestionsPage from "../pages/MoldingQuestionsPage"
|
import MoldingQuestionsPage from "../pages/MoldingQuestionsPage"
|
||||||
import { InsuranceCompanyPage } from "../pages/InsuranceCompanyPage"
|
import { InsuranceCompanyPage } from "../pages/InsuranceCompanyPage"
|
||||||
|
import { InsuranceDetailsPage } from "../pages/InsuranceDetailsPage"
|
||||||
import { CCPolicyInfoPage } from "../pages/CCPolicyInfoPage"
|
import { CCPolicyInfoPage } from "../pages/CCPolicyInfoPage"
|
||||||
import { DuplicateCheckPage } from "../pages/DuplicateCheckPage"
|
import { DuplicateCheckPage } from "../pages/DuplicateCheckPage"
|
||||||
import { PolicyVehiclesPage } from "../pages/PolicyVehiclesPage"
|
import { PolicyVehiclesPage } from "../pages/PolicyVehiclesPage"
|
||||||
|
|
@ -32,8 +33,12 @@ import { EndorsementsPage } from "../pages/EndorsementsPage"
|
||||||
import { PolicyDriverPage } from "../pages/PolicyDriverPage"
|
import { PolicyDriverPage } from "../pages/PolicyDriverPage"
|
||||||
import { ServiceZipPage } from "../pages/ServiceZipPage"
|
import { ServiceZipPage } from "../pages/ServiceZipPage"
|
||||||
import { MobileDetailsPage } from "pages/MobileDetailsPage";
|
import { MobileDetailsPage } from "pages/MobileDetailsPage";
|
||||||
|
import { BailoutPage } from '../pages/BailoutPage';
|
||||||
|
import { BailoutSuccessPage } from '../pages/BailoutSuccessPage';
|
||||||
|
|
||||||
export interface ITestPages {
|
export interface ITestPages {
|
||||||
|
bailoutPage: BailoutPage,
|
||||||
|
bailoutSuccessPage: BailoutSuccessPage,
|
||||||
capabilityQuestionsPage: CapabilityQuestionsPage,
|
capabilityQuestionsPage: CapabilityQuestionsPage,
|
||||||
ccPolicyInfoPage: CCPolicyInfoPage,
|
ccPolicyInfoPage: CCPolicyInfoPage,
|
||||||
contactDetailsPage: ContactDetailsPage,
|
contactDetailsPage: ContactDetailsPage,
|
||||||
|
|
@ -42,6 +47,7 @@ export interface ITestPages {
|
||||||
estimatePage: EstimatePage,
|
estimatePage: EstimatePage,
|
||||||
homePage: HomePage,
|
homePage: HomePage,
|
||||||
insuranceCompanyPage: InsuranceCompanyPage,
|
insuranceCompanyPage: InsuranceCompanyPage,
|
||||||
|
insuranceDetailsPage: InsuranceDetailsPage,
|
||||||
leadgenHomePage: LeadgenHomePage,
|
leadgenHomePage: LeadgenHomePage,
|
||||||
moldingQuestionsPage: MoldingQuestionsPage,
|
moldingQuestionsPage: MoldingQuestionsPage,
|
||||||
orderConfirmationPage: OrderConfirmationPage,
|
orderConfirmationPage: OrderConfirmationPage,
|
||||||
|
|
@ -70,6 +76,8 @@ export interface ITestPages {
|
||||||
|
|
||||||
export const createTestPages: TestPagesFactory<ITestPages> = (page: Page) => {
|
export const createTestPages: TestPagesFactory<ITestPages> = (page: Page) => {
|
||||||
const pages: ITestPages = {
|
const pages: ITestPages = {
|
||||||
|
bailoutPage: new BailoutPage(page),
|
||||||
|
bailoutSuccessPage: new BailoutSuccessPage(page),
|
||||||
capabilityQuestionsPage: new CapabilityQuestionsPage(page),
|
capabilityQuestionsPage: new CapabilityQuestionsPage(page),
|
||||||
ccPolicyInfoPage: new CCPolicyInfoPage(page),
|
ccPolicyInfoPage: new CCPolicyInfoPage(page),
|
||||||
contactDetailsPage: new ContactDetailsPage(page),
|
contactDetailsPage: new ContactDetailsPage(page),
|
||||||
|
|
@ -78,6 +86,7 @@ export const createTestPages: TestPagesFactory<ITestPages> = (page: Page) => {
|
||||||
estimatePage: new EstimatePage(page),
|
estimatePage: new EstimatePage(page),
|
||||||
homePage: new HomePage(page),
|
homePage: new HomePage(page),
|
||||||
insuranceCompanyPage: new InsuranceCompanyPage(page),
|
insuranceCompanyPage: new InsuranceCompanyPage(page),
|
||||||
|
insuranceDetailsPage: new InsuranceDetailsPage(page),
|
||||||
leadgenHomePage: new LeadgenHomePage(page),
|
leadgenHomePage: new LeadgenHomePage(page),
|
||||||
moldingQuestionsPage: new MoldingQuestionsPage(page),
|
moldingQuestionsPage: new MoldingQuestionsPage(page),
|
||||||
orderConfirmationPage: new OrderConfirmationPage(page),
|
orderConfirmationPage: new OrderConfirmationPage(page),
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ export enum ProgressBarPercentages {
|
||||||
VehiclePartsPage = '20%',
|
VehiclePartsPage = '20%',
|
||||||
ServicePackagePage = '60%',
|
ServicePackagePage = '60%',
|
||||||
InsuranceCompanyPage = '60%',
|
InsuranceCompanyPage = '60%',
|
||||||
|
InsuranceDetailsPage = '55%',
|
||||||
ServiceLocationPage = '76%',
|
ServiceLocationPage = '76%',
|
||||||
SchedulePage = '76%',
|
SchedulePage = '76%',
|
||||||
MobileDetailsPage = '76%',
|
MobileDetailsPage = '76%',
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
export interface IExperiments {
|
export interface IExperiments {
|
||||||
isMobileFirst: boolean,
|
isMobileFirst: boolean,
|
||||||
isAdyenPayments: boolean,
|
isAdyenPayments: boolean,
|
||||||
isMultiLocationPopup: boolean
|
isMultiLocationPopup: boolean,
|
||||||
|
isMsrSplitPay: boolean
|
||||||
}
|
}
|
||||||
51
playwright-tests/pages/BailoutPage.ts
Normal file
51
playwright-tests/pages/BailoutPage.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
import { type Locator, type Page, expect } from '@playwright/test';
|
||||||
|
import { BasePage } from './BasePage';
|
||||||
|
import { step } from 'framework/localTypes/Step';
|
||||||
|
import { ICustomerDetails } from 'safelite-playwright-core';
|
||||||
|
import { ITestData } from 'framework/TestData';
|
||||||
|
|
||||||
|
export class BailoutPage extends BasePage {
|
||||||
|
readonly page: Page;
|
||||||
|
readonly firstNameTextBox: Locator;
|
||||||
|
readonly lastNameTextBox: Locator;
|
||||||
|
readonly emailAddressTextBox: Locator;
|
||||||
|
readonly phoneNumberTextBox: Locator;
|
||||||
|
readonly optInToSMSBox: Locator;
|
||||||
|
|
||||||
|
constructor(page: Page) {
|
||||||
|
super(page);
|
||||||
|
this.page = page;
|
||||||
|
|
||||||
|
this.firstNameTextBox = this.page.getByRole('textbox', { name: 'First name' });
|
||||||
|
this.lastNameTextBox = this.page.getByRole('textbox', { name: 'Last name' });
|
||||||
|
this.emailAddressTextBox = this.page.getByRole('textbox', { name: 'Email address' });
|
||||||
|
this.phoneNumberTextBox = this.page.getByRole('textbox', { name: 'Phone number' });
|
||||||
|
this.optInToSMSBox = this.page.getByRole('checkbox', { name: 'Opt in to SMS' });
|
||||||
|
}
|
||||||
|
|
||||||
|
async fillOutBailoutForm(customerDetails: ICustomerDetails) {
|
||||||
|
await this.firstNameTextBox.fill(customerDetails!.firstName!);
|
||||||
|
await this.lastNameTextBox.fill(customerDetails!.lastName!);
|
||||||
|
await this.emailAddressTextBox.fill(customerDetails!.email!);
|
||||||
|
await this.phoneNumberTextBox.fill(customerDetails!.phoneNumber!);
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkOptInToSMSBox() {
|
||||||
|
await this.optInToSMSBox.check();
|
||||||
|
}
|
||||||
|
|
||||||
|
@step("BailoutPage >> Fill out bailout form: ")
|
||||||
|
async handleBailoutPage(testData: Partial<ITestData>) {
|
||||||
|
|
||||||
|
const { customerDetails } = testData;
|
||||||
|
|
||||||
|
await expect(this.page).toHaveURL(/bailout/);
|
||||||
|
await this.fillOutBailoutForm(customerDetails!);
|
||||||
|
|
||||||
|
if (testData.isOptedInForTextMessages) {
|
||||||
|
await this.checkOptInToSMSBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.nextPage();
|
||||||
|
}
|
||||||
|
}
|
||||||
35
playwright-tests/pages/BailoutSuccessPage.ts
Normal file
35
playwright-tests/pages/BailoutSuccessPage.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { type Locator, type Page, expect } from '@playwright/test';
|
||||||
|
import { BasePage } from './BasePage';
|
||||||
|
import { TestSuccessAlert } from 'safelite-playwright-core';
|
||||||
|
import { step } from 'framework/localTypes/Step';
|
||||||
|
|
||||||
|
export class BailoutSuccessPage extends BasePage {
|
||||||
|
readonly thankYouHeading: Locator;
|
||||||
|
readonly bodyText: Locator;
|
||||||
|
readonly returnToHomepageButton: Locator;
|
||||||
|
|
||||||
|
constructor(page: Page) {
|
||||||
|
super(page);
|
||||||
|
this.thankYouHeading = page.getByText("Thanks! We'll get back to you soon");
|
||||||
|
this.bodyText = page.getByText(/We've got it from here!/);
|
||||||
|
this.returnToHomepageButton = page.locator('#btn-vehicle-not-listed');
|
||||||
|
}
|
||||||
|
|
||||||
|
async validateBailoutSuccessPage() {
|
||||||
|
await expect(this.page).toHaveURL(/bailout-success/);
|
||||||
|
await expect(this.thankYouHeading).toBeVisible();
|
||||||
|
await expect(this.bodyText).toBeVisible();
|
||||||
|
await expect(this.bodyText).toHaveText(
|
||||||
|
/We've got it from here! One of our experts will be in touch to schedule your appointment\. If you have any questions, please contact 1-888-238-4527/
|
||||||
|
);
|
||||||
|
await expect(this.returnToHomepageButton).toBeVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
@step("BailoutSuccessPage >> Validate bailout success page and return to vehicle page")
|
||||||
|
async handleBailoutSuccessPage() {
|
||||||
|
await this.validateBailoutSuccessPage();
|
||||||
|
await this.returnToHomepageButton.click();
|
||||||
|
await expect(this.page).toHaveURL(/vehicle/);
|
||||||
|
throw new TestSuccessAlert('Parts not found bailout validated successfully.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -19,6 +19,7 @@ export class BasePage {
|
||||||
readonly hamburgerMenu: Locator;
|
readonly hamburgerMenu: Locator;
|
||||||
readonly progressBar: Locator;
|
readonly progressBar: Locator;
|
||||||
readonly loaders: Locator;
|
readonly loaders: Locator;
|
||||||
|
readonly yellowAlertMessage: Locator;
|
||||||
|
|
||||||
constructor(page: Page) {
|
constructor(page: Page) {
|
||||||
this.page = page;
|
this.page = page;
|
||||||
|
|
@ -29,6 +30,7 @@ export class BasePage {
|
||||||
this.hamburgerMenu = this.page.getByRole('button', { name: 'Hamburger Menu (modal window)' });
|
this.hamburgerMenu = this.page.getByRole('button', { name: 'Hamburger Menu (modal window)' });
|
||||||
this.progressBar = this.page.locator('.progress-bar-outer .progress-bar-inner');
|
this.progressBar = this.page.locator('.progress-bar-outer .progress-bar-inner');
|
||||||
this.loaders = this.page.locator('.spinner-border, .loader');
|
this.loaders = this.page.locator('.spinner-border, .loader');
|
||||||
|
this.yellowAlertMessage = this.page.locator('.alert-warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
async nextPage() {
|
async nextPage() {
|
||||||
|
|
@ -135,42 +137,30 @@ export class BasePage {
|
||||||
|
|
||||||
|
|
||||||
async mockScheduleResponseForFirstInshopCallNoSchedule(customerDetails: ICustomerDetails) {
|
async mockScheduleResponseForFirstInshopCallNoSchedule(customerDetails: ICustomerDetails) {
|
||||||
let fistInshopScheduleCall = true;
|
// let fistInshopScheduleCall = true;
|
||||||
|
|
||||||
const apiUrl = `https://digitalapi.${process.env['PLAYWRIGHT_ENV']!.replace('sys', 'test').toLowerCase()}.safelite.io/schedule/api/v1/schedule/shop-time-slots`;
|
const apiUrl = `https://digitalapi.${process.env['PLAYWRIGHT_ENV']!.replace('sys', 'test').toLowerCase()}.safelite.io/schedule/api/v1/schedule/shop-time-slots`;
|
||||||
await this.page.route(apiUrl, async (route) => {
|
await this.page.route(apiUrl, async (route) => {
|
||||||
if (!fistInshopScheduleCall) {
|
/*if (!fistInshopScheduleCall) {
|
||||||
return route.continue();
|
return route.continue();
|
||||||
}
|
|
||||||
|
|
||||||
// const fmt = (d: Date) => `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,"0")}-${String(d.getDate()).padStart(2,"0")}`;
|
|
||||||
// const startDate = new Date();
|
|
||||||
//const beginningOfWeek = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate() - startDate.getDay());
|
|
||||||
// const endDate = new Date(beginningOfWeek.getFullYear(), beginningOfWeek.getMonth(), beginningOfWeek.getDate() + 13);
|
|
||||||
// e.g., "2025-07-23"
|
|
||||||
/*if (route.request().postDataJSON().startDate === fmt(startDate) && route.request().postDataJSON().endDate === fmt(endDate)) {
|
|
||||||
const response = await route.fetch();
|
|
||||||
const responseBody = await response.json();
|
|
||||||
|
|
||||||
responseBody.days = [];
|
|
||||||
// Mock the response
|
|
||||||
await route.fulfill({
|
|
||||||
response,
|
|
||||||
body: JSON.stringify(responseBody),
|
|
||||||
});
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
const response = await route.fetch();
|
const response = await route.fetch();
|
||||||
const responseBody = await response.json();
|
const responseBody = await response.json();
|
||||||
|
|
||||||
responseBody.days = [];
|
// Remove up to the first five items from the days array, keeping the rest; if empty, leave as is
|
||||||
|
if (Array.isArray(responseBody.days) && responseBody.days.length > 0) {
|
||||||
|
responseBody.days = responseBody.days.slice(5);
|
||||||
|
} else {
|
||||||
|
responseBody.days = [];
|
||||||
|
}
|
||||||
|
|
||||||
// Mock the response
|
// Mock the response
|
||||||
await route.fulfill({
|
await route.fulfill({
|
||||||
response,
|
response,
|
||||||
body: JSON.stringify(responseBody),
|
body: JSON.stringify(responseBody),
|
||||||
});
|
});
|
||||||
fistInshopScheduleCall = false;
|
// fistInshopScheduleCall = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -252,9 +242,9 @@ export class BasePage {
|
||||||
|
|
||||||
if (experiments !== undefined) {
|
if (experiments !== undefined) {
|
||||||
experimentsURLExtension += "?cns=all&experiments="
|
experimentsURLExtension += "?cns=all&experiments="
|
||||||
experimentsURLExtension += experiments?.isMobileFirst
|
/*experimentsURLExtension += experiments?.isMobileFirst
|
||||||
? "MobileFirstAppointment=MobileFirstAppt_V1=MobileFirstAppt_TEST=true"
|
? "MobileFirstAppointment=MobileFirstAppt_V1=MobileFirstAppt_TEST=true"
|
||||||
: "MobileFirstAppointment=MobileFirstAppt_V1=MobileFirstAppt_CONTROL=true";
|
: "MobileFirstAppointment=MobileFirstAppt_V1=MobileFirstAppt_CONTROL=true";*/
|
||||||
|
|
||||||
experimentsURLExtension += experiments?.isAdyenPayments
|
experimentsURLExtension += experiments?.isAdyenPayments
|
||||||
? ",Adyen%20Payments=Adyen%20Payment%20Test=Adyen%20Payment%20(Test)=true"
|
? ",Adyen%20Payments=Adyen%20Payment%20Test=Adyen%20Payment%20(Test)=true"
|
||||||
|
|
@ -263,11 +253,15 @@ export class BasePage {
|
||||||
experimentsURLExtension += experiments?.isMultiLocationPopup
|
experimentsURLExtension += experiments?.isMultiLocationPopup
|
||||||
? ",MultiLocationPopup=MultiLocationPopup_V1=MultiLocationPopup_TEST=true"
|
? ",MultiLocationPopup=MultiLocationPopup_V1=MultiLocationPopup_TEST=true"
|
||||||
: ",MultiLocationPopup=MultiLocationPopup_V1=MultiLocationPopup_CONTROL=true";
|
: ",MultiLocationPopup=MultiLocationPopup_V1=MultiLocationPopup_CONTROL=true";
|
||||||
|
|
||||||
|
experimentsURLExtension += experiments?.isMsrSplitPay
|
||||||
|
? ",MSR=MSR_With_Splitpay=YesShowMSR_TEST=true"
|
||||||
|
: ",MSR=MSR_With_Splitpay=NoShowMSR_CONTROL=true";
|
||||||
} else {
|
} else {
|
||||||
console.log("Url extension without query string");
|
console.log("Url extension without query string");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert to HTML encoding before returning
|
// Convert to HTML encoding before returning
|
||||||
return experimentsURLExtension;
|
return process.env.PLAYWRIGHT_ENV == 'sys' ? '' : experimentsURLExtension;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -21,7 +21,7 @@ export class HomePage extends BasePage {
|
||||||
readonly viewQuoteButton: Locator;
|
readonly viewQuoteButton: Locator;
|
||||||
|
|
||||||
//Zip Entry
|
//Zip Entry
|
||||||
readonly widgetZipEntryField: Locator;
|
readonly widgetZipEntryInputField: Locator;
|
||||||
readonly getQuoteAndScheduleButton: Locator;
|
readonly getQuoteAndScheduleButton: Locator;
|
||||||
|
|
||||||
url = process.env['BASE_URL']!;
|
url = process.env['BASE_URL']!;
|
||||||
|
|
@ -30,7 +30,7 @@ export class HomePage extends BasePage {
|
||||||
super(page);
|
super(page);
|
||||||
|
|
||||||
this.page = page;
|
this.page = page;
|
||||||
this.letsGetStartedButton = this.page.getByRole('button', { name: 'Let\'s get started' });
|
this.letsGetStartedButton = this.page.locator('a.zip-submit-button');
|
||||||
this.cusmodalPopup = this.page.locator('#Cusmodalpopup');
|
this.cusmodalPopup = this.page.locator('#Cusmodalpopup');
|
||||||
this.closePopupButton = this.page.getByRole('button', { name: '×' });
|
this.closePopupButton = this.page.getByRole('button', { name: '×' });
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ export class HomePage extends BasePage {
|
||||||
this.viewQuoteButton = this.page.locator('#ctaSubmit');
|
this.viewQuoteButton = this.page.locator('#ctaSubmit');
|
||||||
|
|
||||||
//Zip Entry
|
//Zip Entry
|
||||||
this.widgetZipEntryField = this.page.getByRole('textbox', { name: 'Enter service ZIP code' });
|
this.widgetZipEntryInputField = this.page.locator('input#zipcode');
|
||||||
this.getQuoteAndScheduleButton = this.page.getByLabel('main').getByRole('link', { name: 'Get quote + schedule' });
|
this.getQuoteAndScheduleButton = this.page.getByLabel('main').getByRole('link', { name: 'Get quote + schedule' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ export class HomePage extends BasePage {
|
||||||
|
|
||||||
async letsGetStarted(zip: string, enterFunnelWithZip: boolean) {
|
async letsGetStarted(zip: string, enterFunnelWithZip: boolean) {
|
||||||
if (enterFunnelWithZip) {
|
if (enterFunnelWithZip) {
|
||||||
await this.widgetZipEntryField.fill(zip);
|
await this.widgetZipEntryInputField.fill(zip);
|
||||||
/* await this.letsGetStartedButton.evaluate((element, zip) => {
|
/* await this.letsGetStartedButton.evaluate((element, zip) => {
|
||||||
const currentHref = element.getAttribute('href') || '';
|
const currentHref = element.getAttribute('href') || '';
|
||||||
element.setAttribute('href', `${currentHref}?zipCode=${zip}`);
|
element.setAttribute('href', `${currentHref}?zipCode=${zip}`);
|
||||||
|
|
|
||||||
61
playwright-tests/pages/InsuranceDetailsPage.ts
Normal file
61
playwright-tests/pages/InsuranceDetailsPage.ts
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
import { type Locator, type Page } from '@playwright/test';
|
||||||
|
import { BasePage } from './BasePage';
|
||||||
|
import { step } from 'framework/localTypes/Step';
|
||||||
|
import { ITestData } from 'framework/TestData';
|
||||||
|
import { ProgressBarPercentages } from 'framework/localTypes/Enums';
|
||||||
|
|
||||||
|
export class InsuranceDetailsPage extends BasePage {
|
||||||
|
|
||||||
|
readonly page: Page;
|
||||||
|
readonly insuranceCompany: Locator;
|
||||||
|
readonly policyNumber: Locator;
|
||||||
|
readonly dateOfLoss: Locator;
|
||||||
|
readonly damageCause: Locator;
|
||||||
|
readonly claimNumber: Locator; // conditional — only shown for certain insurers like Kentucky Farm Bureau
|
||||||
|
readonly streetAddress: Locator;
|
||||||
|
readonly apartment: Locator;
|
||||||
|
readonly city: Locator;
|
||||||
|
readonly policyState: Locator;
|
||||||
|
readonly policyZip: Locator;
|
||||||
|
|
||||||
|
constructor(page: Page) {
|
||||||
|
super(page);
|
||||||
|
this.page = page;
|
||||||
|
|
||||||
|
this.insuranceCompany = page.getByLabel('Insurance company');
|
||||||
|
this.policyNumber = page.getByLabel('Policy number');
|
||||||
|
this.dateOfLoss = page.getByLabel('Approximate date of loss');
|
||||||
|
this.claimNumber = page.getByLabel('Claim Number');
|
||||||
|
this.damageCause = page.getByLabel('How did the damage occur?');
|
||||||
|
this.streetAddress = page.getByLabel('Street address');
|
||||||
|
this.apartment = page.getByLabel('Apt. number (optional)');
|
||||||
|
this.city = page.getByLabel('City');
|
||||||
|
this.policyState = page.getByLabel('State');
|
||||||
|
this.policyZip = page.getByLabel('Zip');
|
||||||
|
}
|
||||||
|
|
||||||
|
private async populatePage(testData: Partial<ITestData>): Promise<void> {
|
||||||
|
const { claimDetails, customerDetails } = testData;
|
||||||
|
|
||||||
|
await this.policyNumber.fill(claimDetails!.policyNumber);
|
||||||
|
await this.dateOfLoss.fill(claimDetails!.damageDate);
|
||||||
|
await this.damageCause.selectOption(claimDetails!.damageCause);
|
||||||
|
await this.streetAddress.fill(customerDetails!.address.street);
|
||||||
|
await this.apartment.fill(customerDetails!.address.aptNumber ?? '');
|
||||||
|
await this.city.fill(customerDetails!.address.city);
|
||||||
|
await this.policyState.selectOption(customerDetails!.address.state);
|
||||||
|
await this.policyZip.fill(customerDetails!.address.postalCode);
|
||||||
|
|
||||||
|
if (await this.claimNumber.isVisible()) {
|
||||||
|
await this.claimNumber.fill(claimDetails!.claimNumber ?? '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@step("InsuranceDetailsPage >> Fill out insurance details for non integrated insurance flow")
|
||||||
|
async handleInsuranceDetailsPage(testData: Partial<ITestData>): Promise<void> {
|
||||||
|
await this.validateProgressBar(ProgressBarPercentages.InsuranceDetailsPage);
|
||||||
|
await this.populatePage(testData);
|
||||||
|
await this.nextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -272,9 +272,10 @@ export class PaymentMethodPage extends BasePage {
|
||||||
if (await this.payAtServiceButton.isVisible()) {
|
if (await this.payAtServiceButton.isVisible()) {
|
||||||
await this.payAtServiceButton.click();
|
await this.payAtServiceButton.click();
|
||||||
} else if (isRecalVehicle) {
|
} else if (isRecalVehicle) {
|
||||||
await this.recalibrationCheckbox.click();
|
if (await this.recalibrationCheckbox.isVisible()) {
|
||||||
|
await this.recalibrationCheckbox.click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async verifyVAPS(): Promise<void> {
|
async verifyVAPS(): Promise<void> {
|
||||||
|
|
@ -559,7 +560,9 @@ export class PaymentMethodPage extends BasePage {
|
||||||
|
|
||||||
await this.validateProgressBar(ProgressBarPercentages.PaymentMethodPage);
|
await this.validateProgressBar(ProgressBarPercentages.PaymentMethodPage);
|
||||||
await this.validatePaymentDetailsPage(testData);
|
await this.validatePaymentDetailsPage(testData);
|
||||||
await this.ValidateAfterPayBreakOutSection();
|
if (testData.isPIAEnabled) {
|
||||||
|
await this.ValidateAfterPayBreakOutSection();
|
||||||
|
}
|
||||||
|
|
||||||
if (isForcedOEM) {
|
if (isForcedOEM) {
|
||||||
await this.validateOEMPart(isForcedOEM);
|
await this.validateOEMPart(isForcedOEM);
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,10 @@ export class PaypalPage extends BasePage {
|
||||||
await this.page.screenshot({ path: `test-results\\ortoni-data\\paypal-username-${Date.now()}.png`, fullPage: true });
|
await this.page.screenshot({ path: `test-results\\ortoni-data\\paypal-username-${Date.now()}.png`, fullPage: true });
|
||||||
await this.usernameTextBox.fill(paymentDetails!.username!);
|
await this.usernameTextBox.fill(paymentDetails!.username!);
|
||||||
await this.nextButton.click();
|
await this.nextButton.click();
|
||||||
if (!experiments!.isAdyenPayments){
|
/*if (!experiments!.isAdyenPayments){
|
||||||
await this.tryAnotherWayButton.click();
|
await this.tryAnotherWayButton.click();
|
||||||
await this.usePasswordInsteadButton.click();
|
await this.usePasswordInsteadButton.click();
|
||||||
}
|
}*/
|
||||||
await this.passwordTextBox.fill(paymentDetails!.password!);
|
await this.passwordTextBox.fill(paymentDetails!.password!);
|
||||||
await this.paypalLoginButton.click();
|
await this.paypalLoginButton.click();
|
||||||
await this.payWithRadioButton.click();
|
await this.payWithRadioButton.click();
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,15 @@ export class SchedulePage extends BasePage {
|
||||||
async selectLocation(testData: Partial<ITestData>) {
|
async selectLocation(testData: Partial<ITestData>) {
|
||||||
const { appointmentDetails, customerDetails } = testData;
|
const { appointmentDetails, customerDetails } = testData;
|
||||||
|
|
||||||
|
if (testData.isMSRGlassPart || testData.isDualRecal) {
|
||||||
|
if (testData.isMSRZip) {
|
||||||
|
expect(await this.mobileButton.isVisible()).toBe(true);
|
||||||
|
} else {
|
||||||
|
expect(await this.mobileButton.isVisible()).toBe(false);
|
||||||
|
expect(await this.yellowAlertMessage.locator('.alert-heading').filter({ hasText: ' We\'re not able to provide mobile service.' }).isVisible()).toBe(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch(appointmentDetails?.serviceLocation) {
|
switch(appointmentDetails?.serviceLocation) {
|
||||||
case ServiceLocation.Mobile:
|
case ServiceLocation.Mobile:
|
||||||
await this.scheduleMobile(testData);
|
await this.scheduleMobile(testData);
|
||||||
|
|
@ -252,6 +261,12 @@ export class SchedulePage extends BasePage {
|
||||||
await this.waitForPageOrComponentload();
|
await this.waitForPageOrComponentload();
|
||||||
await this.validateProgressBar(ProgressBarPercentages.SchedulePage);
|
await this.validateProgressBar(ProgressBarPercentages.SchedulePage);
|
||||||
|
|
||||||
|
//Looks like an issue with the insurance flow - remove comments once fixed
|
||||||
|
/*if (testData.isHeavyTruck) {
|
||||||
|
const vuexState = JSON.parse(await this.page.evaluate('localStorage.getItem(\'vuex\')'));
|
||||||
|
expect(vuexState.order.lineItems.supportingItems.find((item: any) => item && item.partNumber == "labor2")).toBeTruthy();
|
||||||
|
}*/
|
||||||
|
|
||||||
if (handleMobileFirstModal) {
|
if (handleMobileFirstModal) {
|
||||||
return await this.handleMobileFirstPopUp(testData);
|
return await this.handleMobileFirstPopUp(testData);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { ProgressBarPercentages } from 'framework/localTypes/Enums';
|
||||||
import { PaymentMethod } from "framework/localTypes/Enums";
|
import { PaymentMethod } from "framework/localTypes/Enums";
|
||||||
import { step } from 'framework/localTypes/Step';
|
import { step } from 'framework/localTypes/Step';
|
||||||
import { ITestData } from 'framework/TestData';
|
import { ITestData } from 'framework/TestData';
|
||||||
|
import { PaymentMethodPage } from './PaymentMethodPage';
|
||||||
|
|
||||||
export class ServicePackagesPage extends BasePage {
|
export class ServicePackagesPage extends BasePage {
|
||||||
readonly page: Page;
|
readonly page: Page;
|
||||||
|
|
@ -227,6 +228,32 @@ export class ServicePackagesPage extends BasePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async verifyGlassCashQuoteEvent() {
|
||||||
|
// Get displayed price text for Glass Only package (e.g. "$41.25in 4 interest-free payments\nor $164.99 in single payment")
|
||||||
|
const expectedGlassOnlyPrice = await this.glassOnlypackagePrice.innerText();
|
||||||
|
|
||||||
|
// Extract the single payment amount (e.g. 164.99) from the end of the string using regex
|
||||||
|
const singlePaymentRegex = /\$([\d,]+\.\d{2})\s*in single payment/;
|
||||||
|
const match = expectedGlassOnlyPrice.match(singlePaymentRegex);
|
||||||
|
if (!match) {
|
||||||
|
throw new Error(`Expected single payment price to be present in: ${expectedGlassOnlyPrice}`);
|
||||||
|
}
|
||||||
|
const expectedSinglePayAmount = parseFloat(match[1].replace(',', ''));
|
||||||
|
|
||||||
|
// Retrieve the dataLayer from the browser. (Assumes dataLayer is in global scope. Adjust if needed.)
|
||||||
|
const dataLayer = await this.page.evaluate(() => (window as any).dataLayer);
|
||||||
|
|
||||||
|
// Find the first object with a GlassCashQuote property and extract its value.
|
||||||
|
const glassCashQuote = dataLayer?.find((item: any) => item && item.GlassCashQuote)?.GlassCashQuote;
|
||||||
|
if (glassCashQuote === undefined || glassCashQuote === null) {
|
||||||
|
throw new Error("No GlassCashQuote found in dataLayer");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate that the GlassCashQuote value matches the extracted expectedSinglePayAmount (with currency float precision)
|
||||||
|
Soft.expect(Number.parseFloat(glassCashQuote)).toBe(expectedSinglePayAmount);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@step("ServicePackagePage >> Select Payment Method and Service Type: ")
|
@step("ServicePackagePage >> Select Payment Method and Service Type: ")
|
||||||
async handleServicePackagePage(testData: Partial<ITestData>) {
|
async handleServicePackagePage(testData: Partial<ITestData>) {
|
||||||
const { customerDetails, paymentMethod, paymentDetails, servicePackage, isCanNotRecal, isDynamicRecal, hasOemEndorsement, vehicleDamage, appointmentDetails, totalAmount } = testData;
|
const { customerDetails, paymentMethod, paymentDetails, servicePackage, isCanNotRecal, isDynamicRecal, hasOemEndorsement, vehicleDamage, appointmentDetails, totalAmount } = testData;
|
||||||
|
|
@ -289,6 +316,10 @@ export class ServicePackagesPage extends BasePage {
|
||||||
await this.verifyVehicleParts(vehicleDamage!);
|
await this.verifyVehicleParts(vehicleDamage!);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (testData.paymentMethod == PaymentMethod.SelfPay) {
|
||||||
|
await this.verifyGlassCashQuoteEvent();
|
||||||
|
}
|
||||||
|
|
||||||
// Validate backend for OEM endorsement
|
// Validate backend for OEM endorsement
|
||||||
if (hasOemEndorsement) {
|
if (hasOemEndorsement) {
|
||||||
await this.verifyOEMPart();
|
await this.verifyOEMPart();
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,8 @@ export default defineConfig({
|
||||||
headless: process.env.CI ? true : false,
|
headless: process.env.CI ? true : false,
|
||||||
screenshot: "only-on-failure",
|
screenshot: "only-on-failure",
|
||||||
actionTimeout: 60_000,
|
actionTimeout: 60_000,
|
||||||
navigationTimeout: 60_000
|
navigationTimeout: 60_000,
|
||||||
|
bypassCSP: true
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Configure projects for major browsers */
|
/* Configure projects for major browsers */
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,14 @@ import { ApiResponseInterceptUtil } from 'safelite-playwright-core';
|
||||||
import cashReplaceGlassPromoInshopTests from "./CashReplaceGlassPromoInshop";
|
import cashReplaceGlassPromoInshopTests from "./CashReplaceGlassPromoInshop";
|
||||||
import cashReplaceMultiGlassPromoInshopTests from "./CashReplaceMultiGlassPromoInshop";
|
import cashReplaceMultiGlassPromoInshopTests from "./CashReplaceMultiGlassPromoInshop";
|
||||||
import cashReplaceStaticInshopTests from "./CashReplaceStaticInshop";
|
import cashReplaceStaticInshopTests from "./CashReplaceStaticInshop";
|
||||||
|
import cashReplaceStaticMobileMSRTests from "./CashReplaceStaticMobileMSR";
|
||||||
import cashReplaceRainDefensePromoInshopTests from "./CashReplaceRainDefensePromoInshop";
|
import cashReplaceRainDefensePromoInshopTests from "./CashReplaceRainDefensePromoInshop";
|
||||||
import cashReplaceSafeliteCanNotRecalMobileTests from "./CashReplaceSafeliteCanNotRecalMobile";
|
import cashReplaceSafeliteCanNotRecalMobileTests from "./CashReplaceSafeliteCanNotRecalMobile";
|
||||||
import cashReplaceVinMobileTests from "./CashReplaceVinMobile";
|
import cashReplaceVinMobileTests from "./CashReplaceVinMobile";
|
||||||
import cashReplaceWiperDropoffTests from "./CashReplaceWiperDropoff";
|
import cashReplaceWiperDropoffTests from "./CashReplaceWiperDropoff";
|
||||||
import cashReplaceWiperPromoInShopTests from "./CashReplaceWiperPromoInshop";
|
import cashReplaceWiperPromoInShopTests from "./CashReplaceWiperPromoInshop";
|
||||||
import insuranceAcuityPaypalTests from "./InsuranceAcuityPaypal";
|
import insuranceAcuityPaypalTests from "./InsuranceAcuityPaypal";
|
||||||
|
// import insuranceUSAAMsrTests from "./InsuranceUSAAMsr";
|
||||||
import insuranceITAC21stCenturyTests from "./InsuranceITAC21stCentury";
|
import insuranceITAC21stCenturyTests from "./InsuranceITAC21stCentury";
|
||||||
import insuranceGeicoTests from "./InsuranceGeico";
|
import insuranceGeicoTests from "./InsuranceGeico";
|
||||||
import insuranceITACOptimizedPriceValidationAllStateTests from "./InsuranceITACOptimizedPriceValidationAllState";
|
import insuranceITACOptimizedPriceValidationAllStateTests from "./InsuranceITACOptimizedPriceValidationAllState";
|
||||||
|
|
@ -38,10 +40,14 @@ import cashReplaceMultiGlassMobileTests from "./CashReplaceMultiGlassMobile";
|
||||||
import { getTestObject, TestCase, prepareTest, RuleEngine, TestInfo } from 'framework/Typedefs';
|
import { getTestObject, TestCase, prepareTest, RuleEngine, TestInfo } from 'framework/Typedefs';
|
||||||
import { createTestPages } from "framework/TestPages";
|
import { createTestPages } from "framework/TestPages";
|
||||||
import cashReplaceSwitchToInsuranceProgressiveNoCompTests from "./CashReplaceSwitchToInsuranceProgressiveNoComp";
|
import cashReplaceSwitchToInsuranceProgressiveNoCompTests from "./CashReplaceSwitchToInsuranceProgressiveNoComp";
|
||||||
import insuranceBigTruckVerifiedTests from "./InsuranceBigTruckVerified";
|
import insuranceUSAABigTruckVerifiedTests from "./InsuranceUSAABigTruckVerified";
|
||||||
|
import partsNotFoundBailoutTests from "./PartsNotFoundBailout";
|
||||||
import insuranceUnverifiedTests from "./InsuranceUnverified";
|
import insuranceUnverifiedTests from "./InsuranceUnverified";
|
||||||
import CashReplaceSplitWindshieldTests from "./CashReplaceSplitWindshield";
|
import CashReplaceSplitWindshieldTests from "./CashReplaceSplitWindshield";
|
||||||
import insuranceMeemicNearSchoolVerifiedTests from "./InsuranceMeemicNearSchoolVerified";
|
import insuranceMeemicNearSchoolVerifiedTests from "./InsuranceMeemicNearSchoolVerified";
|
||||||
|
import cashReplaceDualMobileMSRTests from "./CashReplaceDualMobileMSR";
|
||||||
|
import cashReplaceDualNonMSRInshopTests from "./CashReplaceDualNonMSRInshop";
|
||||||
|
|
||||||
|
|
||||||
const test = getTestObject();
|
const test = getTestObject();
|
||||||
|
|
||||||
|
|
@ -78,21 +84,25 @@ const allStandardTests = [
|
||||||
{ name: "CashReplaceVinMobile", tests: cashReplaceVinMobileTests },
|
{ name: "CashReplaceVinMobile", tests: cashReplaceVinMobileTests },
|
||||||
{ name: "CashReplaceWiperDropoff", tests: cashReplaceWiperDropoffTests },
|
{ name: "CashReplaceWiperDropoff", tests: cashReplaceWiperDropoffTests },
|
||||||
{ name: "CashReplaceStaticInshop", tests: cashReplaceStaticInshopTests },
|
{ name: "CashReplaceStaticInshop", tests: cashReplaceStaticInshopTests },
|
||||||
|
{ name: "CashReplaceDualMobileMSR", tests: cashReplaceDualMobileMSRTests },
|
||||||
|
{ name: "CashReplaceDualNonMSRInshop", tests: cashReplaceDualNonMSRInshopTests },
|
||||||
|
{ name: "CashReplaceStaticMobileMSR", tests: cashReplaceStaticMobileMSRTests },
|
||||||
{ name: "CashReplaceWiperPromoInshop", tests: cashReplaceWiperPromoInShopTests },
|
{ name: "CashReplaceWiperPromoInshop", tests: cashReplaceWiperPromoInShopTests },
|
||||||
{ name: "CashReplaceSwitchToInsuranceProgressiveNoComp", tests: cashReplaceSwitchToInsuranceProgressiveNoCompTests },
|
{ name: "CashReplaceSwitchToInsuranceProgressiveNoComp", tests: cashReplaceSwitchToInsuranceProgressiveNoCompTests },
|
||||||
{ name: "CashReplaceMobileFirstModal", tests: cashReplaceMobileFirstModalTests },
|
// { name: "CashReplaceMobileFirstModal", tests: cashReplaceMobileFirstModalTests },
|
||||||
// TODO: Uncomment when QA is ready to run heavy truck tests
|
// TODO: Uncomment when QA is ready to run heavy truck tests
|
||||||
// {name: "CashReplaceSplitWindshield", tests: CashReplaceSplitWindshieldTests},
|
// {name: "CashReplaceSplitWindshield", tests: CashReplaceSplitWindshieldTests},
|
||||||
{ name: "InsuranceAcuityPaypal", tests: insuranceAcuityPaypalTests },
|
{ name: "InsuranceAcuityPaypal", tests: insuranceAcuityPaypalTests },
|
||||||
|
// { name: "InsuranceUSAAMsr", tests: insuranceUSAAMsrTests },
|
||||||
{ name: "InsuranceITAC21stCentury", tests: insuranceITAC21stCenturyTests },
|
{ name: "InsuranceITAC21stCentury", tests: insuranceITAC21stCenturyTests },
|
||||||
{ name: "InsuranceNoCompProgressive", tests: insuranceNoCompProgressiveTests },
|
{ name: "InsuranceNoCompProgressive", tests: insuranceNoCompProgressiveTests },
|
||||||
// {name: "InsuranceBigTruckVerified", tests: insuranceBigTruckVerifiedTests},
|
{name: "InsuranceUSAABigTruckVerified", tests: insuranceUSAABigTruckVerifiedTests},
|
||||||
{ name: "InsuranceOEMAllstate", tests: insuranceOEMAllstateTests },
|
{ name: "InsuranceOEMAllstate", tests: insuranceOEMAllstateTests },
|
||||||
{ name: "InsuranceUnverified", tests: insuranceUnverifiedTests },
|
{ name: "InsuranceUnverified", tests: insuranceUnverifiedTests },
|
||||||
// {name: "InsuranceGeico", tests: insuranceGeicoTests},
|
// {name: "InsuranceGeico", tests: insuranceGeicoTests},
|
||||||
// {name: "InsuranceITACOptimizedPriceValidationAllState", tests: insuranceITACOptimizedPriceValidationAllStateTests}
|
// {name: "InsuranceITACOptimizedPriceValidationAllState", tests: insuranceITACOptimizedPriceValidationAllStateTests}
|
||||||
{ name: "InsuranceMeemicNearSchoolVerified", tests: insuranceMeemicNearSchoolVerifiedTests },
|
{ name: "InsuranceMeemicNearSchoolVerified", tests: insuranceMeemicNearSchoolVerifiedTests },
|
||||||
|
// { name: "PartsNotFoundBailout", tests: partsNotFoundBailoutTests }, // code is not available in QA
|
||||||
];
|
];
|
||||||
|
|
||||||
// Alert validation scenarios
|
// Alert validation scenarios
|
||||||
|
|
@ -266,6 +276,14 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
||||||
await serviceZipPage.handleServiceZipPage(testCase.testData);
|
await serviceZipPage.handleServiceZipPage(testCase.testData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle bailout page if parts bailout scenario
|
||||||
|
if (testCase.testData.bailoutFlags?.isVehicleLookupBailout) {
|
||||||
|
let bailoutPage = testCase.pages.bailoutPage;
|
||||||
|
await bailoutPage.handleBailoutPage(testCase.testData);
|
||||||
|
let bailoutSuccessPage = testCase.pages.bailoutSuccessPage;
|
||||||
|
await bailoutSuccessPage.handleBailoutSuccessPage();
|
||||||
|
}
|
||||||
|
|
||||||
// Handle part questions if applicable
|
// Handle part questions if applicable
|
||||||
if (partQuestions && partQuestions.length > 0) {
|
if (partQuestions && partQuestions.length > 0) {
|
||||||
let partQuestionsPage = testCase.pages.partQuestionsPage;
|
let partQuestionsPage = testCase.pages.partQuestionsPage;
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,8 @@ const cashRepairInShopAfterPayData : Partial<ITestData> = {
|
||||||
|
|
||||||
// Experiments
|
// Experiments
|
||||||
experiments: {
|
experiments: {
|
||||||
...getDefaultExperimentsData()
|
...getDefaultExperimentsData(),
|
||||||
|
isAdyenPayments: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
99
playwright-tests/tests/CashReplaceDualMobileMSR.ts
Normal file
99
playwright-tests/tests/CashReplaceDualMobileMSR.ts
Normal file
|
|
@ -0,0 +1,99 @@
|
||||||
|
//Imports here
|
||||||
|
import { ITestData, getDefaultExperimentsData } from 'framework/TestData'
|
||||||
|
import { ServicePackage, PaymentType, PartQuestionType, ServiceLocation } from 'safelite-playwright-core';
|
||||||
|
import { ITestCase } from '../framework/Typedefs'
|
||||||
|
import { VehicleLookupType } from 'safelite-playwright-core';
|
||||||
|
import { getDefaultTestData, setFakerSeedFromTestName } from 'safelite-playwright-core';
|
||||||
|
import { PaymentMethod } from 'framework/localTypes/Enums';
|
||||||
|
|
||||||
|
// Set the seed before generating any data
|
||||||
|
setFakerSeedFromTestName("CashReplaceDualMobileMSR");
|
||||||
|
|
||||||
|
// Now get the test data with the seeded faker
|
||||||
|
const CashReplaceDualMobileMSRData: Partial<ITestData> = {
|
||||||
|
...getDefaultTestData(), // Get default data with current seed
|
||||||
|
|
||||||
|
// CASH Client
|
||||||
|
paymentMethod: PaymentMethod.SelfPay,
|
||||||
|
|
||||||
|
// Key feature: Premium package with Rain Defense
|
||||||
|
servicePackage: ServicePackage.Standard,
|
||||||
|
|
||||||
|
// Flag for recalibration vehicle
|
||||||
|
isRecalVehicle: true,
|
||||||
|
|
||||||
|
// Override customer details
|
||||||
|
customerDetails: {
|
||||||
|
...getDefaultTestData().customerDetails!,
|
||||||
|
address: {
|
||||||
|
...getDefaultTestData().customerDetails!.address,
|
||||||
|
postalCode: '43085'
|
||||||
|
// postalCode: '21237'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Override appointment details
|
||||||
|
appointmentDetails: {
|
||||||
|
serviceLocation: ServiceLocation.Mobile,
|
||||||
|
appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate,
|
||||||
|
serviceAddress: {
|
||||||
|
// Use street address from current faker seed
|
||||||
|
street: "649 High Street",
|
||||||
|
city: 'Worthington',
|
||||||
|
state: 'OH',
|
||||||
|
postalCode: '43085', //
|
||||||
|
country: 'United States'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// override part questions
|
||||||
|
partQuestions: [
|
||||||
|
{
|
||||||
|
partQuestionType: PartQuestionType.GeneralQuestion1,
|
||||||
|
isOnPage: true,
|
||||||
|
optionToSelect: 'Yes'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
// Override vehicle details
|
||||||
|
vehicleDetails: {
|
||||||
|
...getDefaultTestData().vehicleDetails!,
|
||||||
|
year: '2020',
|
||||||
|
make: 'Honda',
|
||||||
|
model: 'Pilot',
|
||||||
|
style: '4 door utility',
|
||||||
|
vehicleLookupType: VehicleLookupType.Zip
|
||||||
|
},
|
||||||
|
|
||||||
|
mockFirstInshopCallNoSchedule: true,
|
||||||
|
|
||||||
|
isMSRGlassPart: true,
|
||||||
|
isMSRZip: true,
|
||||||
|
|
||||||
|
// No need to override vehicleDamage as it already defaults to WindshieldCrack
|
||||||
|
|
||||||
|
// Payment at service
|
||||||
|
paymentDetails: {
|
||||||
|
paymentType: PaymentType.PayAtService
|
||||||
|
},
|
||||||
|
|
||||||
|
// Flag for PIA disabled
|
||||||
|
isPIAEnabled: false,
|
||||||
|
|
||||||
|
// Experiments
|
||||||
|
experiments: {
|
||||||
|
...getDefaultExperimentsData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const cashReplaceDualMobileMSRTests: ITestCase[] = [];
|
||||||
|
|
||||||
|
const tc = {
|
||||||
|
name: `CashReplaceDualMobileMSR`,
|
||||||
|
tags: ['@E2E', '@CashReplaceDualMobileMSR', '@test_report', '@CASH'],
|
||||||
|
testData: CashReplaceDualMobileMSRData
|
||||||
|
};
|
||||||
|
cashReplaceDualMobileMSRTests.push(tc);
|
||||||
|
|
||||||
|
export default cashReplaceDualMobileMSRTests;
|
||||||
82
playwright-tests/tests/CashReplaceDualNonMSRInshop.ts
Normal file
82
playwright-tests/tests/CashReplaceDualNonMSRInshop.ts
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
//Imports here
|
||||||
|
import { ITestData, getDefaultExperimentsData } from 'framework/TestData'
|
||||||
|
import { ServicePackage, PaymentType, PartQuestionType, ServiceLocation } from 'safelite-playwright-core';
|
||||||
|
import { ITestCase } from '../framework/Typedefs'
|
||||||
|
import { VehicleLookupType } from 'safelite-playwright-core';
|
||||||
|
import { getDefaultTestData, setFakerSeedFromTestName } from 'safelite-playwright-core';
|
||||||
|
import { PaymentMethod } from 'framework/localTypes/Enums';
|
||||||
|
|
||||||
|
// Set the seed before generating any data
|
||||||
|
setFakerSeedFromTestName("CashReplaceDualNonMSRInshop");
|
||||||
|
|
||||||
|
// Now get the test data with the seeded faker
|
||||||
|
const CashReplaceDualMobileMSRData: Partial<ITestData> = {
|
||||||
|
...getDefaultTestData(), // Get default data with current seed
|
||||||
|
|
||||||
|
// CASH Client
|
||||||
|
paymentMethod: PaymentMethod.SelfPay,
|
||||||
|
|
||||||
|
// Key feature: Premium package with Rain Defense
|
||||||
|
servicePackage: ServicePackage.Standard,
|
||||||
|
|
||||||
|
// Flag for recalibration vehicle
|
||||||
|
isRecalVehicle: true,
|
||||||
|
|
||||||
|
// Override customer details
|
||||||
|
customerDetails: {
|
||||||
|
...getDefaultTestData().customerDetails!,
|
||||||
|
address: {
|
||||||
|
...getDefaultTestData().customerDetails!.address,
|
||||||
|
postalCode: '43085'
|
||||||
|
// postalCode: '21237'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// override part questions
|
||||||
|
partQuestions: [
|
||||||
|
{
|
||||||
|
partQuestionType: PartQuestionType.GeneralQuestion1,
|
||||||
|
isOnPage: true,
|
||||||
|
optionToSelect: 'Yes'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
// Override vehicle details
|
||||||
|
vehicleDetails: {
|
||||||
|
...getDefaultTestData().vehicleDetails!,
|
||||||
|
year: '2024',
|
||||||
|
make: 'Subaru',
|
||||||
|
model: 'Ascent',
|
||||||
|
style: '4 door utility',
|
||||||
|
vehicleLookupType: VehicleLookupType.Zip
|
||||||
|
},
|
||||||
|
|
||||||
|
mockFirstInshopCallNoSchedule: true,
|
||||||
|
|
||||||
|
isMSRGlassPart: false,
|
||||||
|
isMSRZip: true,
|
||||||
|
|
||||||
|
// Payment at service
|
||||||
|
paymentDetails: {
|
||||||
|
paymentType: PaymentType.PayAtService
|
||||||
|
},
|
||||||
|
|
||||||
|
// Flag for PIA disabled
|
||||||
|
isPIAEnabled: false,
|
||||||
|
|
||||||
|
// Experiments
|
||||||
|
experiments: {
|
||||||
|
...getDefaultExperimentsData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const cashReplaceDualNonMSRInshopTests: ITestCase[] = [];
|
||||||
|
|
||||||
|
const tc = {
|
||||||
|
name: `CashReplaceDualNonMSRInshop`,
|
||||||
|
tags: ['@E2E', '@CashReplaceDualNonMSRInshop', '@test_report', '@CASH'],
|
||||||
|
testData: CashReplaceDualMobileMSRData
|
||||||
|
};
|
||||||
|
cashReplaceDualNonMSRInshopTests.push(tc);
|
||||||
|
|
||||||
|
export default cashReplaceDualNonMSRInshopTests;
|
||||||
|
|
@ -35,10 +35,10 @@ const cashReplaceGlassAddressLookupInshopAfterPayData: Partial<ITestData> = {
|
||||||
// Override vehicle details
|
// Override vehicle details
|
||||||
vehicleDetails: {
|
vehicleDetails: {
|
||||||
...getDefaultTestData().vehicleDetails!,
|
...getDefaultTestData().vehicleDetails!,
|
||||||
year: '2013',
|
year: '2024',
|
||||||
make: 'Hyundai',
|
make: 'Acura',
|
||||||
model: 'Sonata',
|
model: 'MDX',
|
||||||
style: '4 door sedan',
|
style: '4 door utility',
|
||||||
vehicleLookupType: VehicleLookupType.Address
|
vehicleLookupType: VehicleLookupType.Address
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,13 @@ const cashReplaceMultiGlassPromoInshopData: Partial<ITestData> = {
|
||||||
make: 'Subaru',
|
make: 'Subaru',
|
||||||
model: 'Outback',
|
model: 'Outback',
|
||||||
style: '4 door station wagon',
|
style: '4 door station wagon',
|
||||||
vin: '4S4BSENC4K3221004',
|
// vin: '4S4BSENC4K3221004',
|
||||||
vehicleLookupType: VehicleLookupType.Vin
|
vehicleLookupType: VehicleLookupType.Zip
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Special flag to skip estimate page
|
||||||
|
isSkipEstimatePage: true,
|
||||||
|
|
||||||
// Key feature: multiple damaged glasses
|
// Key feature: multiple damaged glasses
|
||||||
vehicleDamage: [
|
vehicleDamage: [
|
||||||
VehicleDamage.WindshieldCrack,
|
VehicleDamage.WindshieldCrack,
|
||||||
|
|
@ -56,13 +59,22 @@ const cashReplaceMultiGlassPromoInshopData: Partial<ITestData> = {
|
||||||
promoCode: '20CALL',
|
promoCode: '20CALL',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// override part questions
|
||||||
|
partQuestions: [
|
||||||
|
{
|
||||||
|
partQuestionType: PartQuestionType.GeneralQuestion1,
|
||||||
|
isOnPage: true,
|
||||||
|
optionToSelect: 'Yes'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
// Vehicle part questions for multiple glass parts
|
// Vehicle part questions for multiple glass parts
|
||||||
vehiclePartQuestions: [
|
vehiclePartQuestions: [
|
||||||
{
|
{
|
||||||
partQuestionType: PartQuestionType.WindshieldColor,
|
partQuestionType: PartQuestionType.WindshieldColor,
|
||||||
isOnPage: true,
|
isOnPage: true,
|
||||||
optionToSelect: 'Green Tint, Blue Shade',
|
optionToSelect: 'Green Tint, Blue Shade',
|
||||||
secondaryQuestionOptionToSelect: 'solar, lane departure warning system, heated glass wiper park, high beam assist, soundproofing'
|
secondaryQuestionOptionToSelect: 'solar, lane departure warning system, hwp, high beam assist, soundproofing'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
partQuestionType: PartQuestionType.DriverFrontColor,
|
partQuestionType: PartQuestionType.DriverFrontColor,
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ const cashReplaceMultiSlidingGlassDropoffData: Partial<ITestData> = {
|
||||||
partQuestionType: PartQuestionType.WindshieldColor,
|
partQuestionType: PartQuestionType.WindshieldColor,
|
||||||
isOnPage: true,
|
isOnPage: true,
|
||||||
optionToSelect: 'Green Tint',
|
optionToSelect: 'Green Tint',
|
||||||
secondaryQuestionOptionToSelect: 'rain sensor, solar, soundproofing, third visor frit, lane departure warning system, heated glass wiper park, w/combination bracket'
|
secondaryQuestionOptionToSelect: 'rain sensor, solar, soundproofing, third visor frit, lane departure warning system, hwp, w/combination bracket'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
partQuestionType: PartQuestionType.PassengerFrontColor,
|
partQuestionType: PartQuestionType.PassengerFrontColor,
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,19 @@ const CashReplaceStaticInshopData: Partial<ITestData> = {
|
||||||
// Flag for recalibration vehicle
|
// Flag for recalibration vehicle
|
||||||
isRecalVehicle: true,
|
isRecalVehicle: true,
|
||||||
|
|
||||||
|
// Flag for MSR Glass Part
|
||||||
|
isMSRGlassPart: true,
|
||||||
|
|
||||||
|
// Flag for MSR Zip
|
||||||
|
isMSRZip: false,
|
||||||
|
|
||||||
// Override customer details
|
// Override customer details
|
||||||
customerDetails: {
|
customerDetails: {
|
||||||
...getDefaultTestData().customerDetails!,
|
...getDefaultTestData().customerDetails!,
|
||||||
address: {
|
address: {
|
||||||
...getDefaultTestData().customerDetails!.address,
|
...getDefaultTestData().customerDetails!.address,
|
||||||
postalCode: '43085'
|
postalCode: '55113' // Non MSR zip
|
||||||
|
// postalCode: '21237'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -37,22 +44,17 @@ const CashReplaceStaticInshopData: Partial<ITestData> = {
|
||||||
partQuestionType: PartQuestionType.GeneralQuestion1,
|
partQuestionType: PartQuestionType.GeneralQuestion1,
|
||||||
isOnPage: true,
|
isOnPage: true,
|
||||||
optionToSelect: 'Yes'
|
optionToSelect: 'Yes'
|
||||||
},
|
|
||||||
{
|
|
||||||
partQuestionType: PartQuestionType.GeneralQuestion2,
|
|
||||||
isOnPage: true,
|
|
||||||
optionToSelect: 'Yes'
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
// Override vehicle details
|
// Override vehicle details
|
||||||
vehicleDetails: {
|
vehicleDetails: {
|
||||||
...getDefaultTestData().vehicleDetails!,
|
...getDefaultTestData().vehicleDetails!,
|
||||||
year: '2022',
|
year: '2023',
|
||||||
make: 'Mazda',
|
make: 'Hyundai',
|
||||||
model: 'CX-9',
|
model: 'Elantra',
|
||||||
style: '4 door utility',
|
style: '4 door sedan',
|
||||||
vin: '3FA6P0HD8LR234510',
|
|
||||||
vehicleLookupType: VehicleLookupType.Zip
|
vehicleLookupType: VehicleLookupType.Zip
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -65,6 +67,9 @@ const CashReplaceStaticInshopData: Partial<ITestData> = {
|
||||||
paymentType: PaymentType.PayAtService
|
paymentType: PaymentType.PayAtService
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Flag for PIA disabled
|
||||||
|
isPIAEnabled: false,
|
||||||
|
|
||||||
// Experiments
|
// Experiments
|
||||||
experiments: {
|
experiments: {
|
||||||
...getDefaultExperimentsData()
|
...getDefaultExperimentsData()
|
||||||
|
|
@ -75,7 +80,7 @@ const cashReplaceStaticInshopTests: ITestCase[] = [];
|
||||||
|
|
||||||
const tc = {
|
const tc = {
|
||||||
name: `CashReplaceStaticInshop`,
|
name: `CashReplaceStaticInshop`,
|
||||||
tags: ['@E2E','@CashReplaceStaticInshop', '@test_report', '@CASH'],
|
tags: ['@E2E', '@CashReplaceStaticInshop', '@test_report', '@CASH'],
|
||||||
testData: CashReplaceStaticInshopData
|
testData: CashReplaceStaticInshopData
|
||||||
};
|
};
|
||||||
cashReplaceStaticInshopTests.push(tc);
|
cashReplaceStaticInshopTests.push(tc);
|
||||||
|
|
|
||||||
92
playwright-tests/tests/CashReplaceStaticMobileMSR.ts
Normal file
92
playwright-tests/tests/CashReplaceStaticMobileMSR.ts
Normal file
|
|
@ -0,0 +1,92 @@
|
||||||
|
//Imports here
|
||||||
|
import { ITestData, getDefaultExperimentsData } from 'framework/TestData'
|
||||||
|
import { ServicePackage, PaymentType, PartQuestionType, ServiceLocation } from 'safelite-playwright-core';
|
||||||
|
import { ITestCase } from '../framework/Typedefs'
|
||||||
|
import { VehicleLookupType } from 'safelite-playwright-core';
|
||||||
|
import { getDefaultTestData, setFakerSeedFromTestName } from 'safelite-playwright-core';
|
||||||
|
import { PaymentMethod } from 'framework/localTypes/Enums';
|
||||||
|
|
||||||
|
// Set the seed before generating any data
|
||||||
|
setFakerSeedFromTestName("CashReplaceStaticMobileMSR");
|
||||||
|
|
||||||
|
// Now get the test data with the seeded faker
|
||||||
|
const CashReplaceStaticMobileMSRData: Partial<ITestData> = {
|
||||||
|
...getDefaultTestData(), // Get default data with current seed
|
||||||
|
|
||||||
|
// CASH Client
|
||||||
|
paymentMethod: PaymentMethod.SelfPay,
|
||||||
|
|
||||||
|
// Key feature: Premium package with Rain Defense
|
||||||
|
servicePackage: ServicePackage.Standard,
|
||||||
|
|
||||||
|
// Flag for recalibration vehicle
|
||||||
|
isRecalVehicle: true,
|
||||||
|
|
||||||
|
// Override customer details
|
||||||
|
customerDetails: {
|
||||||
|
...getDefaultTestData().customerDetails!,
|
||||||
|
address: {
|
||||||
|
...getDefaultTestData().customerDetails!.address,
|
||||||
|
postalCode: '43085'
|
||||||
|
// postalCode: '21237'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// override part questions
|
||||||
|
partQuestions: [
|
||||||
|
{
|
||||||
|
partQuestionType: PartQuestionType.GeneralQuestion1,
|
||||||
|
isOnPage: true,
|
||||||
|
optionToSelect: 'Yes'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
// Override vehicle details
|
||||||
|
vehicleDetails: {
|
||||||
|
...getDefaultTestData().vehicleDetails!,
|
||||||
|
year: '2023',
|
||||||
|
make: 'Hyundai',
|
||||||
|
model: 'Elantra',
|
||||||
|
style: '4 door sedan',
|
||||||
|
vin: '3FA6P0HD8LR234510',
|
||||||
|
vehicleLookupType: VehicleLookupType.Zip
|
||||||
|
},
|
||||||
|
|
||||||
|
mockFirstInshopCallNoSchedule: true,
|
||||||
|
|
||||||
|
// No need to override vehicleDamage as it already defaults to WindshieldCrack
|
||||||
|
// Override appointment details
|
||||||
|
appointmentDetails: {
|
||||||
|
serviceLocation: ServiceLocation.Mobile,
|
||||||
|
appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate,
|
||||||
|
serviceAddress: {
|
||||||
|
// Use street address from current faker seed
|
||||||
|
street: "649 High Street",
|
||||||
|
city: 'Worthington',
|
||||||
|
state: 'OH',
|
||||||
|
postalCode: '43085', //
|
||||||
|
country: 'United States'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// Payment at service
|
||||||
|
paymentDetails: {
|
||||||
|
paymentType: PaymentType.PayAtService
|
||||||
|
},
|
||||||
|
|
||||||
|
// Experiments
|
||||||
|
experiments: {
|
||||||
|
...getDefaultExperimentsData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const cashReplaceStaticMobileMSRTests: ITestCase[] = [];
|
||||||
|
|
||||||
|
const tc = {
|
||||||
|
name: `cashReplaceStaticMobileMSR`,
|
||||||
|
tags: ['@E2E','@cashReplaceStaticMobileMSR', '@test_report', '@CASH'],
|
||||||
|
testData: CashReplaceStaticMobileMSRData
|
||||||
|
};
|
||||||
|
cashReplaceStaticMobileMSRTests.push(tc);
|
||||||
|
|
||||||
|
export default cashReplaceStaticMobileMSRTests;
|
||||||
|
|
@ -37,6 +37,8 @@ const cashReplaceSwitchToInsuranceProgressiveNoCompData: Partial<ITestData> = {
|
||||||
style: "4 door sedan"
|
style: "4 door sedan"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isSkipEstimatePage: true,
|
||||||
|
|
||||||
partQuestions: [
|
partQuestions: [
|
||||||
{
|
{
|
||||||
partQuestionType: PartQuestionType.GeneralQuestion1,
|
partQuestionType: PartQuestionType.GeneralQuestion1,
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
//Imports here
|
//Imports here
|
||||||
import { ITestData, getDefaultExperimentsData } from 'framework/TestData'
|
import { ITestData, getDefaultExperimentsData } from 'framework/TestData'
|
||||||
import { ServiceLocation, DamageType, PaymentType, PartQuestionType } from 'safelite-playwright-core';
|
import { ServiceLocation, DamageType, Flow} from 'safelite-playwright-core';
|
||||||
import { ITestCase } from '../framework/Typedefs'
|
import { ITestCase } from '../framework/Typedefs'
|
||||||
import { PaymentMethod } from "framework/localTypes/Enums";
|
import { PaymentMethod } from "framework/localTypes/Enums";
|
||||||
import { VehicleLookupType } from 'safelite-playwright-core';
|
import { VehicleLookupType } from 'safelite-playwright-core';
|
||||||
import { getDefaultTestData, setFakerSeedFromTestName } from 'safelite-playwright-core';
|
import { getDefaultTestData, setFakerSeedFromTestName } from 'safelite-playwright-core';
|
||||||
|
|
||||||
// Set the seed based on test name for consistent but unique data
|
// Set the seed based on test name for consistent but unique data
|
||||||
setFakerSeedFromTestName("InsuranceBigTruckVerified");
|
setFakerSeedFromTestName("InsuranceUSAABigTruckVerified");
|
||||||
|
|
||||||
// Now get the test data with the seeded faker
|
// Now get the test data with the seeded faker
|
||||||
const insuranceBigTruckVerifiedData: Partial<ITestData> = {
|
const insuranceUSAABigTruckVerifiedData: Partial<ITestData> = {
|
||||||
...getDefaultTestData(), // Get default data with current seed
|
...getDefaultTestData(), // Get default data with current seed
|
||||||
|
|
||||||
// Key feature: Insurance flow with GEICO
|
// Key feature: Insurance flow with GEICO
|
||||||
|
|
@ -19,6 +19,8 @@ const insuranceBigTruckVerifiedData: Partial<ITestData> = {
|
||||||
// Insurance claim flags
|
// Insurance claim flags
|
||||||
isDuplicateClaim: true,
|
isDuplicateClaim: true,
|
||||||
isPolicyFound: true,
|
isPolicyFound: true,
|
||||||
|
flow: Flow.Managed,
|
||||||
|
isCanNotRecal: true,
|
||||||
isUseVehicleOnPolicy: true,
|
isUseVehicleOnPolicy: true,
|
||||||
isHeavyTruck: true,
|
isHeavyTruck: true,
|
||||||
|
|
||||||
|
|
@ -62,7 +64,7 @@ const insuranceBigTruckVerifiedData: Partial<ITestData> = {
|
||||||
// Override for in-shop appointment
|
// Override for in-shop appointment
|
||||||
appointmentDetails: {
|
appointmentDetails: {
|
||||||
serviceLocation: ServiceLocation.InShop,
|
serviceLocation: ServiceLocation.InShop,
|
||||||
shopAddress: '5719 Brandt Pike, Dayton, OH 45424',
|
shopAddress: '3455 Centerpoint Dr, Urbancrest, OH 43123',
|
||||||
appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate
|
appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -75,13 +77,13 @@ const insuranceBigTruckVerifiedData: Partial<ITestData> = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const insuranceBigTruckVerifiedTests: ITestCase[] = [];
|
const insuranceUSAABigTruckVerifiedTests: ITestCase[] = [];
|
||||||
|
|
||||||
const tc = {
|
const tc = {
|
||||||
name: `InsuranceBigTruckVerified`,
|
name: `InsuranceUSAABigTruckVerified`,
|
||||||
tags: ['@E2E','@InsuranceBigTruckVerified', '@test_report', '@Insurance'],
|
tags: ['@E2E','@InsuranceBigTruckVerified', '@test_report', '@Insurance'],
|
||||||
testData: insuranceBigTruckVerifiedData
|
testData: insuranceUSAABigTruckVerifiedData
|
||||||
};
|
};
|
||||||
insuranceBigTruckVerifiedTests.push(tc);
|
insuranceUSAABigTruckVerifiedTests.push(tc);
|
||||||
|
|
||||||
export default insuranceBigTruckVerifiedTests;
|
export default insuranceUSAABigTruckVerifiedTests;
|
||||||
101
playwright-tests/tests/InsuranceUSAAMsr.ts
Normal file
101
playwright-tests/tests/InsuranceUSAAMsr.ts
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
//Imports here
|
||||||
|
import { ITestData, getDefaultExperimentsData } from 'framework/TestData'
|
||||||
|
import { ServiceLocation, DamageType, PartQuestionType, VehicleDamage, PaymentType, Flow } from 'safelite-playwright-core';
|
||||||
|
import { PaymentMethod } from "framework/localTypes/Enums";
|
||||||
|
import { ITestCase } from '../framework/Typedefs'
|
||||||
|
import { VehicleLookupType } from 'safelite-playwright-core';
|
||||||
|
import { getDefaultTestData, setFakerSeedFromTestName } from 'safelite-playwright-core';
|
||||||
|
|
||||||
|
// Set the seed based on test name for consistent but unique data
|
||||||
|
setFakerSeedFromTestName("InsuranceUSAAMsr");
|
||||||
|
|
||||||
|
// Now get the test data with the seeded faker
|
||||||
|
const insuranceUSAAMsrData: Partial<ITestData> = {
|
||||||
|
...getDefaultTestData(), // Get default data with current seed
|
||||||
|
|
||||||
|
// Key feature: Insurance flow with Acuity
|
||||||
|
paymentMethod: PaymentMethod.Insurance,
|
||||||
|
|
||||||
|
// Insurance claim flags
|
||||||
|
isDuplicateClaim: true,
|
||||||
|
flow: Flow.Managed,
|
||||||
|
isUseVehicleOnPolicy: true,
|
||||||
|
|
||||||
|
// Override customer details for Kentucky location
|
||||||
|
customerDetails: {
|
||||||
|
...getDefaultTestData().customerDetails!,
|
||||||
|
address: {
|
||||||
|
street: getDefaultTestData().customerDetails!.address.street,
|
||||||
|
city: 'Cleaveland',
|
||||||
|
state: 'Ohio',
|
||||||
|
postalCode: '44125',
|
||||||
|
country: 'United States'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Insurance claim details
|
||||||
|
claimDetails: {
|
||||||
|
client: 'USAA',
|
||||||
|
policyNumber: 'MOCK900040MSR',
|
||||||
|
policyDeductible: 100.00,
|
||||||
|
damageDate: new Date(new Date().setDate(new Date().getDate() - 1)).toLocaleDateString('en-US', {month: '2-digit', day: '2-digit', year: 'numeric'}),
|
||||||
|
damageCause: DamageType.Rock
|
||||||
|
},
|
||||||
|
|
||||||
|
// Heavy duty truck details with VIN lookup
|
||||||
|
vehicleDetails: {
|
||||||
|
...getDefaultTestData().vehicleDetails!,
|
||||||
|
year: '2023',
|
||||||
|
make: 'Hyundai',
|
||||||
|
model: 'Elantra',
|
||||||
|
style: '4 door sedan'
|
||||||
|
},
|
||||||
|
|
||||||
|
isRecalVehicle: true,
|
||||||
|
|
||||||
|
// No need to override vehicleDamage as it already defaults to WindshieldCrack
|
||||||
|
|
||||||
|
// Override for mobile service
|
||||||
|
appointmentDetails: {
|
||||||
|
serviceLocation: ServiceLocation.Mobile,
|
||||||
|
appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate,
|
||||||
|
serviceAddress: {
|
||||||
|
// Use street address from current faker seed
|
||||||
|
street: "13300 Carpenter Rd",
|
||||||
|
city: 'Cleveland',
|
||||||
|
state: 'OH',
|
||||||
|
postalCode: '44125',
|
||||||
|
country: 'United States'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Part questions for windshield
|
||||||
|
partQuestions: [
|
||||||
|
{
|
||||||
|
partQuestionType: PartQuestionType.GeneralQuestion1,
|
||||||
|
isOnPage: true,
|
||||||
|
optionToSelect: 'Yes'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
// Override payment details (empty because we skip payment method page in insurance flow)
|
||||||
|
paymentDetails: {
|
||||||
|
paymentType: PaymentType.PayAtService
|
||||||
|
},
|
||||||
|
|
||||||
|
// Experiments
|
||||||
|
experiments: {
|
||||||
|
...getDefaultExperimentsData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const insuranceUSAAMsrTests: ITestCase[] = [];
|
||||||
|
|
||||||
|
const tc = {
|
||||||
|
name: `InsuranceUSAAMsr`,
|
||||||
|
tags: ['@E2E','@InsuranceAcuityPaypal', '@test_report', '@Insurance', '@CASH-1187', '@CASH-848'],
|
||||||
|
testData: insuranceUSAAMsrData
|
||||||
|
};
|
||||||
|
insuranceUSAAMsrTests.push(tc);
|
||||||
|
|
||||||
|
export default insuranceUSAAMsrTests;
|
||||||
52
playwright-tests/tests/PartsNotFoundBailout.ts
Normal file
52
playwright-tests/tests/PartsNotFoundBailout.ts
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
import { ITestData, getDefaultExperimentsData } from 'framework/TestData';
|
||||||
|
import { VehicleDamage, VehicleLookupType } from 'safelite-playwright-core';
|
||||||
|
import { ITestCase } from '../framework/Typedefs';
|
||||||
|
import { getDefaultTestData, setFakerSeedFromTestName } from 'safelite-playwright-core';
|
||||||
|
|
||||||
|
setFakerSeedFromTestName("CashDiamondReoBailout");
|
||||||
|
|
||||||
|
const partsNotFoundBailoutTestData: Partial<ITestData> = {
|
||||||
|
...getDefaultTestData(),
|
||||||
|
|
||||||
|
isHeavyTruck: true,
|
||||||
|
|
||||||
|
customerDetails: {
|
||||||
|
...getDefaultTestData().customerDetails!,
|
||||||
|
address: {
|
||||||
|
...getDefaultTestData().customerDetails!.address,
|
||||||
|
postalCode: '43085'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
vehicleDetails: {
|
||||||
|
...getDefaultTestData().vehicleDetails!,
|
||||||
|
year: '1974',
|
||||||
|
make: 'Diamond Reo',
|
||||||
|
model: 'CF65',
|
||||||
|
style: 'cabover',
|
||||||
|
vehicleLookupType: VehicleLookupType.Zip,
|
||||||
|
},
|
||||||
|
|
||||||
|
vehicleDamage: [
|
||||||
|
VehicleDamage.WindshieldCrack
|
||||||
|
],
|
||||||
|
|
||||||
|
bailoutFlags: {
|
||||||
|
isVehicleLookupBailout: true
|
||||||
|
},
|
||||||
|
|
||||||
|
experiments: {
|
||||||
|
...getDefaultExperimentsData()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const partsNotFoundBailoutTests: ITestCase[] = [];
|
||||||
|
|
||||||
|
const tc = {
|
||||||
|
name: `PartsNotFoundBailout`,
|
||||||
|
tags: ['@E2E', '@PartsNotFoundBailout', '@test_report', '@Bailout'],
|
||||||
|
testData: partsNotFoundBailoutTestData
|
||||||
|
};
|
||||||
|
partsNotFoundBailoutTests.push(tc);
|
||||||
|
|
||||||
|
export default partsNotFoundBailoutTests;
|
||||||
5
src/constants/bailout-codes.js
Normal file
5
src/constants/bailout-codes.js
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
const bailoutCodes = {
|
||||||
|
PARTS_NOT_FOUND: 10,
|
||||||
|
};
|
||||||
|
|
||||||
|
export { bailoutCodes };
|
||||||
|
|
@ -25,7 +25,7 @@ const endpoints = {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
},
|
},
|
||||||
GetDamageOptions: {
|
GetDamageOptions: {
|
||||||
url: "/parts/api/v1/parts/damage-options",
|
url: "/parts/api/v2/parts/damage-options",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
},
|
},
|
||||||
LookupVehicleByYmms: {
|
LookupVehicleByYmms: {
|
||||||
|
|
|
||||||
|
|
@ -82,3 +82,6 @@ export function coverageTypeEnum(strCoverageType) {
|
||||||
export const parentAccountNumbers = {
|
export const parentAccountNumbers = {
|
||||||
CONNECT: "560636",
|
CONNECT: "560636",
|
||||||
};
|
};
|
||||||
|
export const NON_MANAGED_SHOW_CLAIM_NUMBER_PARENTS = [
|
||||||
|
{ name: "KentuckyFarmBureau", value: "223499" },
|
||||||
|
];
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,7 @@ const storeActions = {
|
||||||
|
|
||||||
CREATE_SUBMITTED_STATE: "createSubmittedState",
|
CREATE_SUBMITTED_STATE: "createSubmittedState",
|
||||||
RESET_SUBMITTED_STATE: "resetSubmittedState",
|
RESET_SUBMITTED_STATE: "resetSubmittedState",
|
||||||
|
RESET_INSURANCE_DETAILS: "resetInsuranceDetails",
|
||||||
ADD_DONATION_TO_SUBMITTED_STATE: "addDonationToSubmittedState",
|
ADD_DONATION_TO_SUBMITTED_STATE: "addDonationToSubmittedState",
|
||||||
RESET_EXTERNAL_PARAMETER_STATE: "resetExternalParameterState",
|
RESET_EXTERNAL_PARAMETER_STATE: "resetExternalParameterState",
|
||||||
UPDATE_EXTERNAL_PARAMETER_MMS: "updateExternalParameterMMS",
|
UPDATE_EXTERNAL_PARAMETER_MMS: "updateExternalParameterMMS",
|
||||||
|
|
@ -131,6 +132,8 @@ const storeActions = {
|
||||||
UPDATE_HAS_TRIGGERED_ERROR: "updateHasTriggeredError",
|
UPDATE_HAS_TRIGGERED_ERROR: "updateHasTriggeredError",
|
||||||
GET_VALID_IDEMPOTENCY_KEY: "getValidIdempotencyKey",
|
GET_VALID_IDEMPOTENCY_KEY: "getValidIdempotencyKey",
|
||||||
CORRECT_IDEMPOTENCY_KEY_EXPIRY: "correctIdempotencyKeyExpiry",
|
CORRECT_IDEMPOTENCY_KEY_EXPIRY: "correctIdempotencyKeyExpiry",
|
||||||
|
|
||||||
|
SAVE_BAILOUT_CODE: "saveBailoutCode",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { storeActions };
|
export { storeActions };
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ const storeMutations = {
|
||||||
RESET_SERVICE_LOCATION_MOBILE_ADDRESS: "resetServiceLocationMobileAddress",
|
RESET_SERVICE_LOCATION_MOBILE_ADDRESS: "resetServiceLocationMobileAddress",
|
||||||
RESET_SCHEDULE: "resetSchedule",
|
RESET_SCHEDULE: "resetSchedule",
|
||||||
RESET_PAYMENT_METHOD_CHOICE: "resetPaymentMethodChoice",
|
RESET_PAYMENT_METHOD_CHOICE: "resetPaymentMethodChoice",
|
||||||
|
RESET_INSURANCE_DETAILS: "resetInsuranceDetails",
|
||||||
|
|
||||||
// OTHER MUTATIONS
|
// OTHER MUTATIONS
|
||||||
UPDATE_PAGE_DATA: "updatePageData",
|
UPDATE_PAGE_DATA: "updatePageData",
|
||||||
|
|
@ -114,6 +115,9 @@ const storeMutations = {
|
||||||
UPDATE_EXPERIMENTS: "updateExperiments",
|
UPDATE_EXPERIMENTS: "updateExperiments",
|
||||||
UPDATE_TRIGGERED_SITE_ENTRY: "updateTriggeredSiteEntry",
|
UPDATE_TRIGGERED_SITE_ENTRY: "updateTriggeredSiteEntry",
|
||||||
|
|
||||||
|
// BAILOUT MUTATIONS
|
||||||
|
UPDATE_BAILOUT_CODE: "updateBailoutCode",
|
||||||
|
|
||||||
// EXTERNAL_PARAMETER MUTATIONS
|
// EXTERNAL_PARAMETER MUTATIONS
|
||||||
UPDATE_IS_EXTERNAL_PARAMETER: "updateIsExternalParameter",
|
UPDATE_IS_EXTERNAL_PARAMETER: "updateIsExternalParameter",
|
||||||
UPDATE_EXTERNAL_PARAMETER_YEAR: "updateExternalParameterYear",
|
UPDATE_EXTERNAL_PARAMETER_YEAR: "updateExternalParameterYear",
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
:max-date="maxDate"
|
:max-date="maxDate"
|
||||||
:auto-apply="autoApply"
|
:auto-apply="autoApply"
|
||||||
:text-input="textInput"
|
:text-input="textInput"
|
||||||
|
:prevent-min-max-navigation="preventMinMaxNavigation"
|
||||||
:teleport="true"
|
:teleport="true"
|
||||||
:aria-labels="{ input: questionText }"
|
:aria-labels="{ input: questionText }"
|
||||||
@update:model-value="onDateChange"
|
@update:model-value="onDateChange"
|
||||||
|
|
@ -106,6 +107,10 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
preventMinMaxNavigation: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
questionAlignment: String,
|
questionAlignment: String,
|
||||||
labelBold: {
|
labelBold: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|
|
||||||
|
|
@ -962,7 +962,8 @@ export default {
|
||||||
return this.supportingItems.find(
|
return this.supportingItems.find(
|
||||||
(lineItem) =>
|
(lineItem) =>
|
||||||
lineItem.partType == partTypeStrings.MOBILE_FEE &&
|
lineItem.partType == partTypeStrings.MOBILE_FEE &&
|
||||||
lineItem.partNumber == partNumberStrings.MOBILE_STATIC_RECAL_FEE
|
(lineItem.partNumber == partNumberStrings.MOBILE_STATIC_RECAL_FEE ||
|
||||||
|
lineItem.partNumber == partNumberStrings.MOBILE_DUAL_RECAL_FEE)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
msrFeeCartItem() {
|
msrFeeCartItem() {
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ export function getSideDoorGlassString(glassLocation, glassName) {
|
||||||
export function getDamageInfoWordingText(damageInfo) {
|
export function getDamageInfoWordingText(damageInfo) {
|
||||||
const glassTextArray = [];
|
const glassTextArray = [];
|
||||||
|
|
||||||
damageInfo.glassToReplace.forEach((item) => {
|
damageInfo.glassToReplace?.forEach((item) => {
|
||||||
let string = "";
|
let string = "";
|
||||||
if (item.glassLocation === glassLocations.WINDSHIELD) {
|
if (item.glassLocation === glassLocations.WINDSHIELD) {
|
||||||
string = item.glassLocation;
|
string = item.glassLocation;
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,14 @@ export async function saveQuote({ pageNameToLog }) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function submitBailout({ pageNameToLog }) {
|
||||||
|
await saveSession({
|
||||||
|
pageNameToLog: pageNameToLog,
|
||||||
|
shouldAwaitSaveSessionQueue: true,
|
||||||
|
submitAfterSave: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// PRIVATE FUNCTIONS //
|
// PRIVATE FUNCTIONS //
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,9 @@ export async function getPricingByDayPartWithPrice(pageNameToLog) {
|
||||||
export function getMSRFeePartPrice(supportingItems, includeTax) {
|
export function getMSRFeePartPrice(supportingItems, includeTax) {
|
||||||
let msrFeePrice = 0;
|
let msrFeePrice = 0;
|
||||||
const msrFeeLineItem = supportingItems?.find(
|
const msrFeeLineItem = supportingItems?.find(
|
||||||
(lineItem) => lineItem.partNumber === partNumberStrings.MOBILE_STATIC_RECAL_FEE
|
(lineItem) =>
|
||||||
|
lineItem.partNumber === partNumberStrings.MOBILE_STATIC_RECAL_FEE ||
|
||||||
|
lineItem.partNumber === partNumberStrings.MOBILE_DUAL_RECAL_FEE
|
||||||
);
|
);
|
||||||
if (msrFeeLineItem) {
|
if (msrFeeLineItem) {
|
||||||
msrFeePrice = baseMixin?.methods?.getTotalPriceOfAllLineItemsAndChildParts(
|
msrFeePrice = baseMixin?.methods?.getTotalPriceOfAllLineItemsAndChildParts(
|
||||||
|
|
|
||||||
56
src/layouts/bailout-success/bailout-success.spec.js
Normal file
56
src/layouts/bailout-success/bailout-success.spec.js
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
// Components
|
||||||
|
import bailoutSuccess from "@/layouts/bailout-success/bailout-success.vue";
|
||||||
|
|
||||||
|
// Supporting Files
|
||||||
|
import { shallowMount } from "@vue/test-utils";
|
||||||
|
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||||
|
|
||||||
|
// Mock our module for promises.
|
||||||
|
jest.mock("@/helpers/layout-helper.js", () => ({
|
||||||
|
settleAllPromises: jest.fn(),
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Mock fetchCmsContentForPage
|
||||||
|
jest.mock("@/helpers/cms-content-helper", () => ({
|
||||||
|
fetchCmsContentForPage: jest.fn(),
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe("bailout-success.vue", () => {
|
||||||
|
test("renders funnelHeader component", () => {
|
||||||
|
const { wrapper } = setupMocks();
|
||||||
|
expect(wrapper.findComponent({ name: "funnelHeader" }).exists()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("renders funnelSubHeader component", () => {
|
||||||
|
const { wrapper } = setupMocks();
|
||||||
|
expect(wrapper.findComponent({ name: "funnelSubHeader" }).exists()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("renders Form component", () => {
|
||||||
|
const { wrapper } = setupMocks();
|
||||||
|
expect(wrapper.findComponent({ name: "Form" }).exists()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("renders buttonMain component", () => {
|
||||||
|
const { wrapper } = setupMocks();
|
||||||
|
expect(wrapper.findComponent({ name: "buttonMain" }).exists()).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function setupMocks() {
|
||||||
|
const mountOptions = getMountOptions({});
|
||||||
|
|
||||||
|
//Mock props
|
||||||
|
const mockMixin = {
|
||||||
|
methods: {
|
||||||
|
getCmsContent: jest.fn(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
mountOptions.mixins = [mockMixin];
|
||||||
|
const wrapper = shallowMount(bailoutSuccess, mountOptions);
|
||||||
|
|
||||||
|
wrapper.vm.setCmsContent = jest.fn();
|
||||||
|
|
||||||
|
return { wrapper };
|
||||||
|
}
|
||||||
91
src/layouts/bailout-success/bailout-success.vue
Normal file
91
src/layouts/bailout-success/bailout-success.vue
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
<template>
|
||||||
|
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm">
|
||||||
|
<funnelHeader cmsWidgetName="FunnelHeaderWidget" ref="funnelHeader" />
|
||||||
|
<div class="container ymm-return">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-md-10 col-lg-8 col-xl-7">
|
||||||
|
<funnelSubHeader
|
||||||
|
class="mb-5"
|
||||||
|
cmsWidgetName="FunnelSubHeaderWidget"
|
||||||
|
:alignLeft="true" />
|
||||||
|
|
||||||
|
<buttonMain
|
||||||
|
id="btn-vehicle-not-listed"
|
||||||
|
:isPrimary="true"
|
||||||
|
:buttonText="ReturnToHomeButtonText"
|
||||||
|
class="mb-3"
|
||||||
|
@click-event="forwardButtonAction" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { Form } from "vee-validate";
|
||||||
|
import funnelHeader from "@/fmg-components/funnel-header/funnel-header";
|
||||||
|
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
||||||
|
import buttonMain from "@/ux-components/button-main/button-main";
|
||||||
|
import store from "@/store";
|
||||||
|
|
||||||
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "bailout-success",
|
||||||
|
mixins: [],
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
|
||||||
|
async beforeRouteEnter(to, from, next) {
|
||||||
|
// Call APIs
|
||||||
|
const cmsContentPromise = fetchCmsContentForPage(to.name);
|
||||||
|
|
||||||
|
// Settle API calls in parallel before handling results.
|
||||||
|
const promiseResultMap = [
|
||||||
|
{
|
||||||
|
resultKey: "cmsContent",
|
||||||
|
promise: cmsContentPromise,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
||||||
|
// Hydrate page with results
|
||||||
|
next(async (vm) => {
|
||||||
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
async forwardButtonAction() {
|
||||||
|
this.$router.navigateWithoutSaving(
|
||||||
|
this.navigationScenarios.CLICKED_BACK_TO_HOMEPAGE,
|
||||||
|
this.pageName
|
||||||
|
);
|
||||||
|
},
|
||||||
|
arePagePrerequisitesValid() {
|
||||||
|
return (
|
||||||
|
store.getters.order.customer.firstName &&
|
||||||
|
store.getters.order.customer.lastName &&
|
||||||
|
store.getters.order.customer.emailAddress &&
|
||||||
|
store.getters.order.customer.phoneNumber
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
ReturnToHomeButtonText() {
|
||||||
|
return this.getCmsContent("ReturnToHomeButtonText", "Text");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
components: {
|
||||||
|
Form,
|
||||||
|
funnelHeader,
|
||||||
|
funnelSubHeader,
|
||||||
|
buttonMain,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
@ -16,6 +16,26 @@ jest.mock("@/helpers/cms-content-helper", () => ({
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe("bailout.vue", () => {
|
describe("bailout.vue", () => {
|
||||||
|
test("renders funnelHeader component", () => {
|
||||||
|
const { wrapper } = setupMocks();
|
||||||
|
expect(wrapper.findComponent({ name: "funnelHeader" }).exists()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("renders funnelSubHeader component", () => {
|
||||||
|
const { wrapper } = setupMocks();
|
||||||
|
expect(wrapper.findComponent({ name: "funnelSubHeader" }).exists()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("renders Form component", () => {
|
||||||
|
const { wrapper } = setupMocks();
|
||||||
|
expect(wrapper.findComponent({ name: "Form" }).exists()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("renders navbar component", () => {
|
||||||
|
const { wrapper } = setupMocks();
|
||||||
|
expect(wrapper.findComponent({ name: "navbar" }).exists()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
test("arePagePrerequisitesValid should be true ", async () => {
|
test("arePagePrerequisitesValid should be true ", async () => {
|
||||||
//Arrange
|
//Arrange
|
||||||
const { wrapper } = setupMocks();
|
const { wrapper } = setupMocks();
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,80 @@
|
||||||
<template>
|
<template>
|
||||||
<Form>
|
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
|
||||||
<loadingModal ref="loadingModal" />
|
<funnelHeader cmsWidgetName="FunnelHeaderWidget" ref="funnelHeader" />
|
||||||
<div class="container-fluid page-container-grouped-styles">
|
<div class="container ymm-return">
|
||||||
<div class="row justify-content-center">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-12 col-md-10 col-lg-8 col-xl-7">
|
||||||
<funnelHeader cmsWidgetName="FunnelHeaderWidget" ref="funnelHeader" />
|
<funnelSubHeader
|
||||||
</div>
|
class="mb-5"
|
||||||
</div>
|
:cmsWidgetName="getSubHeaderWidget"
|
||||||
<div class="row justify-content-center">
|
:alignLeft="true" />
|
||||||
<div class="col-md-6 col-xl-4 mt-4">
|
|
||||||
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
|
<textboxQuestion
|
||||||
|
isRequired
|
||||||
|
class="mb-4"
|
||||||
|
cmsWidgetName="FirstNameQuestionWidget"
|
||||||
|
v-model="firstName"
|
||||||
|
ref="firstName"
|
||||||
|
customInputId="firstName"
|
||||||
|
validationRules="first-name-required" />
|
||||||
|
|
||||||
|
<textboxQuestion
|
||||||
|
isRequired
|
||||||
|
class="mb-4"
|
||||||
|
cmsWidgetName="LastNameQuestionWidget"
|
||||||
|
v-model="lastName"
|
||||||
|
ref="lastName"
|
||||||
|
customInputId="lastName"
|
||||||
|
validationRules="last-name-required" />
|
||||||
|
|
||||||
|
<textboxQuestion
|
||||||
|
isRequired
|
||||||
|
class="mb-4"
|
||||||
|
cmsWidgetName="EmailQuestionWidget"
|
||||||
|
v-model="emailAddress"
|
||||||
|
inputId="email"
|
||||||
|
validationRules="email-address-required|email-address-format" />
|
||||||
|
|
||||||
|
<phoneNumberQuestion
|
||||||
|
isRequired
|
||||||
|
class="mb-4"
|
||||||
|
cmsWidgetName="PhoneNumberQuestionWidget"
|
||||||
|
v-model="phoneNumber"
|
||||||
|
validationRules="phone-number-required" />
|
||||||
|
|
||||||
|
<textboxQuestion
|
||||||
|
class="mb-4"
|
||||||
|
cmsWidgetName="ServiceZipQuestionWidget"
|
||||||
|
v-model="serviceZipCode"
|
||||||
|
ref="serviceZip"
|
||||||
|
customInputId="serviceZip"
|
||||||
|
mask="#####"
|
||||||
|
validationRules="service-zip-required|service-zip-format" />
|
||||||
|
|
||||||
|
<alert
|
||||||
|
ref="alertInvalidZip"
|
||||||
|
v-if="displayInvalidZipAlert"
|
||||||
|
class="mb-4"
|
||||||
|
cmsWidgetName="AlertInvalidZipWidget"
|
||||||
|
alertClass="alert-danger"
|
||||||
|
v-bind:isDismissible="false" />
|
||||||
|
|
||||||
|
<checkboxQuestion
|
||||||
|
class="mb-5"
|
||||||
|
cmsWidgetName="TextMeQuestionWidget"
|
||||||
|
v-model="isSmsOptIn" />
|
||||||
|
|
||||||
<navbar
|
<navbar
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
isForwardActionDisabled="true"
|
ref="navbar"
|
||||||
isSubmitHidden="true"
|
:isForwardActionDisabled="!meta.valid"
|
||||||
@back-clicked="backButtonAction" />
|
@back-clicked="backButtonAction"
|
||||||
|
@ForwardClicked="forwardButtonAction" />
|
||||||
|
|
||||||
|
<textBlock
|
||||||
|
class="mb-5"
|
||||||
|
cmsWidgetName="DisclaimerCopyWidget"
|
||||||
|
typeStyle="caption" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -23,23 +82,64 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Components
|
import { Form, defineRule } from "vee-validate";
|
||||||
import funnelHeader from "@/fmg-components/funnel-header/funnel-header";
|
import funnelHeader from "@/fmg-components/funnel-header/funnel-header";
|
||||||
import navbar from "@/fmg-components/nav-bar/nav-bar";
|
import navbar from "@/fmg-components/nav-bar/nav-bar";
|
||||||
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
||||||
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
import alert from "@/ux-components/alert/alert";
|
||||||
|
import textboxQuestion from "@/digital-components/textbox-question/textbox-question";
|
||||||
|
import phoneNumberQuestion from "@/digital-components/phone-number-question/phone-number-question";
|
||||||
|
import textBlock from "@/digital-components/text-block/text-block";
|
||||||
|
import checkboxQuestion from "@/digital-components/checkbox-question/checkbox-question";
|
||||||
|
import { routeData } from "@/router/constants/routes";
|
||||||
|
import { bailoutCodes } from "@/constants/bailout-codes";
|
||||||
|
|
||||||
// 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 store from "@/store";
|
||||||
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
|
import { required, regex } from "@/helpers/validation-rules";
|
||||||
|
|
||||||
|
// DEFINE VALIDATION RULES
|
||||||
|
defineRule("first-name-required", required(errorMessages.FIRST_NAME_REQUIRED));
|
||||||
|
defineRule("last-name-required", required(errorMessages.LAST_NAME_REQUIRED));
|
||||||
|
defineRule("phone-number-required", required(errorMessages.PHONE_REQUIRED));
|
||||||
|
defineRule("email-address-required", required(errorMessages.EMAIL_ADDRESS_REQUIRED));
|
||||||
|
defineRule(
|
||||||
|
"email-address-format",
|
||||||
|
regex(
|
||||||
|
/^([a-zA-Z0-9_.+]+)@([a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*\.)+([a-zA-Z]{2,})$/,
|
||||||
|
errorMessages.EMAIL_ADDRESS_FORMAT
|
||||||
|
)
|
||||||
|
);
|
||||||
|
defineRule("service-zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
||||||
|
defineRule(
|
||||||
|
"service-zip-format",
|
||||||
|
regex(/(^\d{5}$)|(^\d{5}-\d{4}$)/, errorMessages.SERVICE_ZIP_FORMAT)
|
||||||
|
);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "bailout",
|
name: "bailout",
|
||||||
|
mixins: [],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
bailoutCode: this.getBailoutCodeFromStore(),
|
||||||
|
firstName: this.getFirstNameFromStore(),
|
||||||
|
lastName: this.getLastNameFromStore(),
|
||||||
|
emailAddress: this.getEmailAddressFromStore(),
|
||||||
|
phoneNumber: this.getPhoneNumberFromStore(),
|
||||||
|
serviceZipCode: this.getServiceZipFromStore(),
|
||||||
|
isSmsOptIn: this.getIsSmsOptInFromStore(),
|
||||||
|
displayInvalidZipAlert: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.name);
|
const cmsContentPromise = fetchCmsContentForPage(to.name);
|
||||||
|
|
||||||
// Settle promises and get results
|
// Settle API calls in parallel before handling results.
|
||||||
const promiseResultMap = [
|
const promiseResultMap = [
|
||||||
{
|
{
|
||||||
resultKey: "cmsContent",
|
resultKey: "cmsContent",
|
||||||
|
|
@ -49,25 +149,124 @@ export default {
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Hydrate page with results
|
||||||
next((vm) => {
|
next(async (vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
getBailoutCodeFromStore() {
|
||||||
|
return store.getters.applicationUser.bailoutCode;
|
||||||
|
},
|
||||||
|
getFirstNameFromStore() {
|
||||||
|
return store.getters.order.customer.firstName;
|
||||||
|
},
|
||||||
|
getLastNameFromStore() {
|
||||||
|
return store.getters.order.customer.lastName;
|
||||||
|
},
|
||||||
|
getEmailAddressFromStore() {
|
||||||
|
return store.getters.order.customer.emailAddress;
|
||||||
|
},
|
||||||
|
getPhoneNumberFromStore() {
|
||||||
|
return store.getters.order.customer.phoneNumber;
|
||||||
|
},
|
||||||
|
getServiceZipFromStore() {
|
||||||
|
return store.getters.order.serviceLocation.zipCode;
|
||||||
|
},
|
||||||
|
getIsSmsOptInFromStore() {
|
||||||
|
return store.getters.order.customer.isSmsOptIn;
|
||||||
|
},
|
||||||
|
async backButtonAction() {
|
||||||
|
this.$router.go(-1);
|
||||||
|
},
|
||||||
|
async forwardButtonAction() {
|
||||||
|
this.displayInvalidZipAlert = false;
|
||||||
|
|
||||||
|
const validateZipResponse = this.dispatchStoreActionWithLogging(
|
||||||
|
this.storeActions.VALIDATE_ZIP,
|
||||||
|
{
|
||||||
|
zip: this.serviceZipCode,
|
||||||
|
},
|
||||||
|
this.pageName
|
||||||
|
);
|
||||||
|
|
||||||
|
const saveCustomerDetailsResponse = this.dispatchStoreAction(
|
||||||
|
this.storeActions.SAVE_CUSTOMER_DETAILS,
|
||||||
|
{
|
||||||
|
firstName: this.firstName,
|
||||||
|
lastName: this.lastName,
|
||||||
|
emailAddress: this.emailAddress,
|
||||||
|
phoneNumber: this.phoneNumber,
|
||||||
|
isSmsOptIn: this.isSmsOptIn,
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
const promiseResultMap = [
|
||||||
|
{
|
||||||
|
resultKey: "validateZipResponse",
|
||||||
|
promise: validateZipResponse,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
resultKey: "saveCustomerDetailsResponse",
|
||||||
|
promise: saveCustomerDetailsResponse,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
const isZipValid = resultMap.validateZipResponse.isValid;
|
||||||
|
|
||||||
|
if (isZipValid) {
|
||||||
|
await this.dispatchStoreActionWithLogging(
|
||||||
|
this.storeActions.SAVE_SERVICE_ZIP_CODE_INFO,
|
||||||
|
{
|
||||||
|
zipCode: this.serviceZipCode,
|
||||||
|
state: resultMap.validateZipResponse.state,
|
||||||
|
zipCodeCtu: resultMap.validateZipResponse.zipCodeCtu,
|
||||||
|
},
|
||||||
|
false
|
||||||
|
).then(() => {
|
||||||
|
this.$router.navigateWithPageData(
|
||||||
|
this.navigationScenarios.CLICKED_FORWARD,
|
||||||
|
this.pageName,
|
||||||
|
{
|
||||||
|
bailoutCode: this.bailoutCode,
|
||||||
|
submit: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.displayInvalidZipAlert = true;
|
||||||
|
return this.$refs.navbar.removeLoader();
|
||||||
|
}
|
||||||
|
},
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
backButtonAction() {
|
},
|
||||||
this.$router.go(-1);
|
|
||||||
|
computed: {
|
||||||
|
getSubHeaderWidget() {
|
||||||
|
switch (this.bailoutCode) {
|
||||||
|
case bailoutCodes.PARTS_NOT_FOUND:
|
||||||
|
return "PartsNotFoundSubHeaderWidget";
|
||||||
|
default:
|
||||||
|
return "FunnelSubHeaderWidget";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
|
Form,
|
||||||
funnelHeader,
|
funnelHeader,
|
||||||
navbar,
|
|
||||||
funnelSubHeader,
|
funnelSubHeader,
|
||||||
loadingModal,
|
alert,
|
||||||
|
navbar,
|
||||||
|
textBlock,
|
||||||
|
phoneNumberQuestion,
|
||||||
|
checkboxQuestion,
|
||||||
|
textboxQuestion,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,18 @@
|
||||||
format="MM/dd/yyyy"
|
format="MM/dd/yyyy"
|
||||||
modelType="MM/dd/yyyy"
|
modelType="MM/dd/yyyy"
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
:clearable="false" />
|
:clearable="false"
|
||||||
|
:textInput="true"
|
||||||
|
:maxDate="today"
|
||||||
|
:preventMinMaxNavigation="true" />
|
||||||
|
|
||||||
|
<textboxQuestion
|
||||||
|
v-if="displayClaimNumber"
|
||||||
|
isRequired
|
||||||
|
class="mb-4"
|
||||||
|
cmsWidgetName="ClaimNumberWidget"
|
||||||
|
v-model="claimNumber"
|
||||||
|
inputId="claimNumber" />
|
||||||
|
|
||||||
<dropdownQuestion
|
<dropdownQuestion
|
||||||
isRequired
|
isRequired
|
||||||
|
|
@ -89,6 +100,7 @@
|
||||||
:options="stateOptions"
|
:options="stateOptions"
|
||||||
validationRules="state-required"
|
validationRules="state-required"
|
||||||
autocomplete="address-level1"
|
autocomplete="address-level1"
|
||||||
|
placeHolderText="Select State"
|
||||||
:labelBold="true" />
|
:labelBold="true" />
|
||||||
|
|
||||||
<textboxQuestion
|
<textboxQuestion
|
||||||
|
|
@ -128,6 +140,7 @@ import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import { stateOptions } from "@/constants/state-options";
|
import { stateOptions } from "@/constants/state-options";
|
||||||
import { regex } from "@/helpers/validation-rules";
|
import { regex } from "@/helpers/validation-rules";
|
||||||
|
import { NON_MANAGED_SHOW_CLAIM_NUMBER_PARENTS } from "@/constants/insurance";
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule(
|
defineRule(
|
||||||
|
|
@ -157,6 +170,7 @@ export default {
|
||||||
city: this.getCityFromStore(),
|
city: this.getCityFromStore(),
|
||||||
policyState: this.getPolicyStateFromStore(),
|
policyState: this.getPolicyStateFromStore(),
|
||||||
policyZip: this.getPolicyZipFromStore(),
|
policyZip: this.getPolicyZipFromStore(),
|
||||||
|
claimNumber: this.getClaimNumberFromStore(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -186,6 +200,17 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
today() {
|
||||||
|
return new Date();
|
||||||
|
},
|
||||||
|
displayClaimNumber() {
|
||||||
|
const order = store.getters.order;
|
||||||
|
|
||||||
|
const parent = NON_MANAGED_SHOW_CLAIM_NUMBER_PARENTS.find(
|
||||||
|
(item) => item.value === order.payment?.parentAccountNumber?.toString()
|
||||||
|
);
|
||||||
|
return !!parent;
|
||||||
|
},
|
||||||
stateOptions() {
|
stateOptions() {
|
||||||
return stateOptions;
|
return stateOptions;
|
||||||
},
|
},
|
||||||
|
|
@ -231,6 +256,9 @@ export default {
|
||||||
getPolicyZipFromStore() {
|
getPolicyZipFromStore() {
|
||||||
return store.getters.order.policy.zipCode ?? "";
|
return store.getters.order.policy.zipCode ?? "";
|
||||||
},
|
},
|
||||||
|
getClaimNumberFromStore() {
|
||||||
|
return store.getters.order.policy.claimNumber ?? "";
|
||||||
|
},
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
this.$router.navigateWithoutSaving(
|
this.$router.navigateWithoutSaving(
|
||||||
this.navigationScenarios.CLICKED_BACK,
|
this.navigationScenarios.CLICKED_BACK,
|
||||||
|
|
@ -247,6 +275,7 @@ export default {
|
||||||
city: this.city,
|
city: this.city,
|
||||||
state: this.policyState,
|
state: this.policyState,
|
||||||
zipCode: this.policyZip,
|
zipCode: this.policyZip,
|
||||||
|
claimNumber: this.claimNumber,
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
:insuranceCompanyName="insuranceCompanyName"
|
:insuranceCompanyName="insuranceCompanyName"
|
||||||
:showInsuranceCoverageAs="showInsuranceCoverageAs"
|
:showInsuranceCoverageAs="showInsuranceCoverageAs"
|
||||||
:isMSRFeeApplicable="isMSRFeeApplicable"
|
:isMSRFeeApplicable="isMSRFeeApplicable"
|
||||||
|
:IsMSRFeeCoveredByInsurance="isMSRFeeCoveredByInsurance"
|
||||||
:isItac="isItac"
|
:isItac="isItac"
|
||||||
:isNoComp="isNoComp"
|
:isNoComp="isNoComp"
|
||||||
:isCollapsible="false" />
|
:isCollapsible="false" />
|
||||||
|
|
@ -77,6 +78,7 @@ import { createAdyenCheckout } from "@/helpers/adyen-helper";
|
||||||
import { Dropin } from "@adyen/adyen-web/auto";
|
import { Dropin } from "@adyen/adyen-web/auto";
|
||||||
import { applicationConfig } from "@/constants/application-config";
|
import { applicationConfig } from "@/constants/application-config";
|
||||||
import { paymentMethods } from "@/constants/payment-method-constants";
|
import { paymentMethods } from "@/constants/payment-method-constants";
|
||||||
|
import analyticsMixin from "@/mixins/analytics-mixin";
|
||||||
|
|
||||||
import "@adyen/adyen-web/styles/adyen.css";
|
import "@adyen/adyen-web/styles/adyen.css";
|
||||||
import { mapAdyenToFmgPaymentMethod, mapFmgToAdyenPaymentMethod } from "../../helpers/adyen-helper";
|
import { mapAdyenToFmgPaymentMethod, mapFmgToAdyenPaymentMethod } from "../../helpers/adyen-helper";
|
||||||
|
|
@ -133,6 +135,25 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
async initializeAdyenWithErrorHandling() {
|
||||||
|
try {
|
||||||
|
await this.initializeAdyen();
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to initialize Adyen payment:", error);
|
||||||
|
|
||||||
|
const errorJson = JSON.stringify(error, Object.getOwnPropertyNames(Object(error)));
|
||||||
|
analyticsMixin.methods.pushFmgSessionData(errorJson);
|
||||||
|
await global.$logger.logError(errorJson);
|
||||||
|
|
||||||
|
this.$router.navigateWithoutSaving(
|
||||||
|
this.navigationScenarios.PIA_ERROR,
|
||||||
|
this.pageName
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
async backButtonAction() {
|
async backButtonAction() {
|
||||||
// Stub, for navigating back via nav-bar.
|
// Stub, for navigating back via nav-bar.
|
||||||
this.$router.navigateWithoutSaving(
|
this.$router.navigateWithoutSaving(
|
||||||
|
|
@ -203,6 +224,12 @@ export default {
|
||||||
},
|
},
|
||||||
onError: (error, component) => {
|
onError: (error, component) => {
|
||||||
console.log(`Error from Adyen`);
|
console.log(`Error from Adyen`);
|
||||||
|
const errorJson = JSON.stringify(
|
||||||
|
error,
|
||||||
|
Object.getOwnPropertyNames(Object(error))
|
||||||
|
);
|
||||||
|
analyticsMixin.methods.pushFmgSessionData(errorJson);
|
||||||
|
|
||||||
this.handleError(error);
|
this.handleError(error);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -371,7 +398,12 @@ export default {
|
||||||
|
|
||||||
await global.$logger.logError(stringToLog);
|
await global.$logger.logError(stringToLog);
|
||||||
|
|
||||||
this.hasPaymentFailureError = true;
|
this.$router.navigateWithoutSaving(
|
||||||
|
this.navigationScenarios.PIA_ERROR,
|
||||||
|
this.pageName
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dropinComponent?.update();
|
this.dropinComponent?.update();
|
||||||
|
|
@ -560,13 +592,16 @@ export default {
|
||||||
isMSRFeeApplicable() {
|
isMSRFeeApplicable() {
|
||||||
return this.$store.getters.order.isMSRFeeApplicable;
|
return this.$store.getters.order.isMSRFeeApplicable;
|
||||||
},
|
},
|
||||||
|
isMSRFeeCoveredByInsurance() {
|
||||||
|
return this.$store.getters.order.isMSRFeeCoveredByInsurance;
|
||||||
|
},
|
||||||
lineItems() {
|
lineItems() {
|
||||||
return deepClone(this.$store.getters.lineItems);
|
return deepClone(this.$store.getters.lineItems);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initializeAdyen();
|
this.initializeAdyenWithErrorHandling();
|
||||||
},
|
},
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
|
|
|
||||||
|
|
@ -834,11 +834,12 @@ export default {
|
||||||
return getBoolFromString(this.$route?.query?.piaError);
|
return getBoolFromString(this.$route?.query?.piaError);
|
||||||
},
|
},
|
||||||
shouldDisplayUnverifiedInsuranceAlert() {
|
shouldDisplayUnverifiedInsuranceAlert() {
|
||||||
const shouldDisplayUnverifiedDeduct = experimentMixin.methods.hasSettingEqualTo(
|
const hasExperimentSetting = experimentMixin.methods.hasSettingEqualTo(
|
||||||
experimentSettings.SHOW_UNVERIFIED_DEDUCT_ENTRY,
|
experimentSettings.SHOW_UNVERIFIED_DEDUCT_ENTRY,
|
||||||
"true"
|
"true"
|
||||||
);
|
);
|
||||||
return shouldDisplayUnverifiedDeduct;
|
|
||||||
|
return hasExperimentSetting && this.isInsurance;
|
||||||
},
|
},
|
||||||
// Necessary to make the watcher of lineItems work
|
// Necessary to make the watcher of lineItems work
|
||||||
// JavaScript does not keep a record of the old value, only a reference to it's location in the memory.
|
// JavaScript does not keep a record of the old value, only a reference to it's location in the memory.
|
||||||
|
|
|
||||||
|
|
@ -799,6 +799,7 @@ export default {
|
||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
this.dispatchStoreAction(this.storeActions.RESET_INSURANCE_DETAILS, false, false);
|
||||||
this.dispatchStoreAction(this.storeActions.SAVE_CAN_SCHEDULE_ONLINE, false, false);
|
this.dispatchStoreAction(this.storeActions.SAVE_CAN_SCHEDULE_ONLINE, false, false);
|
||||||
this.dispatchStoreAction(this.storeActions.SAVE_ACCOUNT_NAME, null, false);
|
this.dispatchStoreAction(this.storeActions.SAVE_ACCOUNT_NAME, null, false);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ import { Form } from "vee-validate";
|
||||||
import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
||||||
import { deleteFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
import { deleteFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
|
import baseMixin from "@/mixins/base-mixin";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "return-user",
|
name: "return-user",
|
||||||
|
|
@ -74,6 +75,13 @@ export default {
|
||||||
startOverImage: null,
|
startOverImage: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
// The global baseMixin.mounted() skips hiding the loading modal when
|
||||||
|
// external-parameter state is active, but those parameters have no
|
||||||
|
// consumer on this interstitial. Clear that state and ensure the loader
|
||||||
|
// is hidden so the user can never get stuck behind it on this page.
|
||||||
|
baseMixin.methods.ResetExternalParamsAndHideModal();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
return getFunnelCookie() !== null;
|
return getFunnelCookie() !== null;
|
||||||
|
|
|
||||||
|
|
@ -706,10 +706,16 @@ export default {
|
||||||
isMobileStaticRecalibrationApplicable() {
|
isMobileStaticRecalibrationApplicable() {
|
||||||
return (
|
return (
|
||||||
this.displayMSR &&
|
this.displayMSR &&
|
||||||
this.mobileFeePart?.partNumber == partNumberStrings.MOBILE_STATIC_RECAL_FEE &&
|
this.isMSRFeePartNumber &&
|
||||||
(this.enableMSRSplitPay || this.isCashItacNoComp || this.mobileFeePart?.isInsurable)
|
(this.enableMSRSplitPay || this.isCashItacNoComp || this.mobileFeePart?.isInsurable)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
isMSRFeePartNumber() {
|
||||||
|
return (
|
||||||
|
this.mobileFeePart?.partNumber === partNumberStrings.MOBILE_STATIC_RECAL_FEE ||
|
||||||
|
this.mobileFeePart?.partNumber === partNumberStrings.MOBILE_DUAL_RECAL_FEE
|
||||||
|
);
|
||||||
|
},
|
||||||
displayMSR() {
|
displayMSR() {
|
||||||
return (
|
return (
|
||||||
experimentMixin.methods
|
experimentMixin.methods
|
||||||
|
|
@ -1228,6 +1234,7 @@ export default {
|
||||||
supportingItems[mobileFeeIndex].laborAmount = this.mobileFeePart.laborAmount;
|
supportingItems[mobileFeeIndex].laborAmount = this.mobileFeePart.laborAmount;
|
||||||
supportingItems[mobileFeeIndex].sellingPrice = this.mobileFeePart.sellingPrice;
|
supportingItems[mobileFeeIndex].sellingPrice = this.mobileFeePart.sellingPrice;
|
||||||
supportingItems[mobileFeeIndex].kitPrice = this.mobileFeePart.kitPrice;
|
supportingItems[mobileFeeIndex].kitPrice = this.mobileFeePart.kitPrice;
|
||||||
|
supportingItems[mobileFeeIndex].isInsurable = this.mobileFeePart.isInsurable;
|
||||||
} else {
|
} else {
|
||||||
if (this.mobileFeePart !== null) supportingItems.push(this.mobileFeePart);
|
if (this.mobileFeePart !== null) supportingItems.push(this.mobileFeePart);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -160,12 +160,16 @@ export default {
|
||||||
// and aws FireHose stream, DigitalConsumer-Session-Firehose, to push data to an
|
// and aws FireHose stream, DigitalConsumer-Session-Firehose, to push data to an
|
||||||
// S3 bucket, safelite-dev-digitalconsumer-session-data-us-east-2/1.
|
// S3 bucket, safelite-dev-digitalconsumer-session-data-us-east-2/1.
|
||||||
// This bucket data is then picked up by snowflake for analytics use.
|
// This bucket data is then picked up by snowflake for analytics use.
|
||||||
async pushFmgSessionData() {
|
async pushFmgSessionData(errorJson = null) {
|
||||||
var currentPageName = getPageNameFromRouter(true);
|
var currentPageName = getPageNameFromRouter(true);
|
||||||
if (!currentPageName) {
|
if (!currentPageName) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errorJson) {
|
||||||
|
currentPageName += ` ERROR: ${errorJson}`;
|
||||||
|
}
|
||||||
|
|
||||||
const hasSubmittedOrder = baseMixin.methods.hasSubmittedOrder();
|
const hasSubmittedOrder = baseMixin.methods.hasSubmittedOrder();
|
||||||
const submittedOrder = baseMixin.methods.getSubmittedOrder();
|
const submittedOrder = baseMixin.methods.getSubmittedOrder();
|
||||||
const order = hasSubmittedOrder ? submittedOrder : store.getters.order;
|
const order = hasSubmittedOrder ? submittedOrder : store.getters.order;
|
||||||
|
|
@ -209,6 +213,7 @@ export default {
|
||||||
var appointment = `${order?.schedule?.date ?? ""} ${order?.schedule?.startTime ?? ""}`;
|
var appointment = `${order?.schedule?.date ?? ""} ${order?.schedule?.startTime ?? ""}`;
|
||||||
|
|
||||||
var sessionData = {};
|
var sessionData = {};
|
||||||
|
|
||||||
sessionData.currentPage = currentPageName;
|
sessionData.currentPage = currentPageName;
|
||||||
sessionData.sid = getSessionIdValue();
|
sessionData.sid = getSessionIdValue();
|
||||||
sessionData.deviceId = getDeviceIdValue();
|
sessionData.deviceId = getDeviceIdValue();
|
||||||
|
|
@ -931,6 +936,11 @@ function getPageNameFromRouter(useDefaultUrl = false) {
|
||||||
router.currentRoute.value &&
|
router.currentRoute.value &&
|
||||||
router.currentRoute.value.name
|
router.currentRoute.value.name
|
||||||
) {
|
) {
|
||||||
|
const query = router.currentRoute.value.query;
|
||||||
|
if (query && Object.keys(query).length > 0 && useDefaultUrl === true) {
|
||||||
|
const queryString = new URLSearchParams(query).toString();
|
||||||
|
return `${router.currentRoute.value.name}?${queryString}`;
|
||||||
|
}
|
||||||
return router.currentRoute.value.name;
|
return router.currentRoute.value.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
13
src/mixins/bailout-mixin.js
Normal file
13
src/mixins/bailout-mixin.js
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { navigationScenarios } from "@/router/constants/navigation-scenarios";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
navigateToBailoutPage(vm, bailoutCode) {
|
||||||
|
const self = vm ?? this;
|
||||||
|
|
||||||
|
self.dispatchStoreAction(self.storeActions.SAVE_BAILOUT_CODE, bailoutCode).then(() => {
|
||||||
|
self.$router.navigateWithoutSaving(navigationScenarios.BAILOUT, self.pageName);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
103
src/mixins/bailout-mixin.spec.js
Normal file
103
src/mixins/bailout-mixin.spec.js
Normal file
|
|
@ -0,0 +1,103 @@
|
||||||
|
import bailoutMixin from "@/mixins/bailout-mixin";
|
||||||
|
import { storeActions } from "@/constants/store-actions.js";
|
||||||
|
import { navigationScenarios } from "@/router/constants/navigation-scenarios";
|
||||||
|
import { bailoutCodes } from "@/constants/bailout-codes.js";
|
||||||
|
|
||||||
|
describe("bailout-mixin.js", () => {
|
||||||
|
test("navigateToBailoutPage: dispatches SAVE_BAILOUT_CODE action with bailout code", async () => {
|
||||||
|
// Arrange
|
||||||
|
const mockVm = createMockVm();
|
||||||
|
const bailoutCode = bailoutCodes.PARTS_NOT_FOUND;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await bailoutMixin.methods.navigateToBailoutPage(mockVm, bailoutCode);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(mockVm.dispatchStoreAction).toHaveBeenCalledWith(
|
||||||
|
storeActions.SAVE_BAILOUT_CODE,
|
||||||
|
bailoutCode
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("navigateToBailoutPage: navigates to bailout page after saving bailout code", async () => {
|
||||||
|
// Arrange
|
||||||
|
const mockVm = createMockVm();
|
||||||
|
const bailoutCode = bailoutCodes.PARTS_NOT_FOUND;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await bailoutMixin.methods.navigateToBailoutPage(mockVm, bailoutCode);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(mockVm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||||
|
navigationScenarios.BAILOUT,
|
||||||
|
mockVm.pageName
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("navigateToBailoutPage: uses current context (this) when vm is not provided", async () => {
|
||||||
|
// Arrange
|
||||||
|
const mockRouter = {
|
||||||
|
navigateWithoutSaving: jest.fn().mockResolvedValue(undefined),
|
||||||
|
};
|
||||||
|
const mockThis = {
|
||||||
|
dispatchStoreAction: jest.fn().mockResolvedValue(undefined),
|
||||||
|
$router: mockRouter,
|
||||||
|
storeActions: storeActions,
|
||||||
|
pageName: "test-page",
|
||||||
|
};
|
||||||
|
|
||||||
|
const bailoutCode = bailoutCodes.PARTS_NOT_FOUND;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await bailoutMixin.methods.navigateToBailoutPage.call(mockThis, undefined, bailoutCode);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(mockThis.dispatchStoreAction).toHaveBeenCalledWith(
|
||||||
|
storeActions.SAVE_BAILOUT_CODE,
|
||||||
|
bailoutCode
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("navigateToBailoutPage: passes correct bailout code to store", async () => {
|
||||||
|
// Arrange
|
||||||
|
const mockVm = createMockVm();
|
||||||
|
const customBailoutCode = 999;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await bailoutMixin.methods.navigateToBailoutPage(mockVm, customBailoutCode);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(mockVm.dispatchStoreAction).toHaveBeenCalledWith(
|
||||||
|
storeActions.SAVE_BAILOUT_CODE,
|
||||||
|
customBailoutCode
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("navigateToBailoutPage: calls navigateWithoutSaving with correct parameters", async () => {
|
||||||
|
// Arrange
|
||||||
|
const mockVm = createMockVm();
|
||||||
|
const mockPageName = "vehicle-damage";
|
||||||
|
mockVm.pageName = mockPageName;
|
||||||
|
const bailoutCode = bailoutCodes.PARTS_NOT_FOUND;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await bailoutMixin.methods.navigateToBailoutPage(mockVm, bailoutCode);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(mockVm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||||
|
navigationScenarios.BAILOUT,
|
||||||
|
mockPageName
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function createMockVm() {
|
||||||
|
return {
|
||||||
|
dispatchStoreAction: jest.fn().mockResolvedValue(undefined),
|
||||||
|
$router: {
|
||||||
|
navigateWithoutSaving: jest.fn().mockResolvedValue(undefined),
|
||||||
|
},
|
||||||
|
storeActions,
|
||||||
|
pageName: "test-page",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
import { storeActions } from "@/constants/store-actions.js";
|
import { storeActions } from "@/constants/store-actions.js";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
||||||
|
import bailoutMixin from "@/mixins/bailout-mixin";
|
||||||
import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
|
import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
|
||||||
import { experimentSettings } from "@/constants/experiments";
|
import { experimentSettings } from "@/constants/experiments";
|
||||||
import { vinLookupMethodSelections } from "@/constants/vin-lookup-method-selections.js";
|
import { vinLookupMethodSelections } from "@/constants/vin-lookup-method-selections.js";
|
||||||
|
import { bailoutCodes } from "@/constants/bailout-codes";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -34,6 +36,11 @@ export default {
|
||||||
const result = await this.dispatchStoreAction(storeActions.GET_PARTS_OR_QUESTIONS, {
|
const result = await this.dispatchStoreAction(storeActions.GET_PARTS_OR_QUESTIONS, {
|
||||||
pageNameToLog: pageName,
|
pageNameToLog: pageName,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (result.PartsNotFound) {
|
||||||
|
bailoutMixin.methods.navigateToBailoutPage(this, bailoutCodes.PARTS_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
const partsOrQuestions = result.data.partsOrQuestions;
|
const partsOrQuestions = result.data.partsOrQuestions;
|
||||||
|
|
||||||
vehicleQuestionsMixin.methods.navigateForward(partsOrQuestions, this);
|
vehicleQuestionsMixin.methods.navigateForward(partsOrQuestions, this);
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,11 @@ const navigationScenarios = {
|
||||||
CLICKED_FORWARD_WITH_INSURANCE: "CLICKED_FORWARD_WITH_INSURANCE",
|
CLICKED_FORWARD_WITH_INSURANCE: "CLICKED_FORWARD_WITH_INSURANCE",
|
||||||
CLICKED_CANCEL_VERIFICATION: "CLICKED_CANCEL_VERIFICATION",
|
CLICKED_CANCEL_VERIFICATION: "CLICKED_CANCEL_VERIFICATION",
|
||||||
|
|
||||||
|
// Bailout
|
||||||
|
BAILOUT: "BAILOUT",
|
||||||
|
BAILOUT_SUCCESS: "BAILOUT_SUCCESS",
|
||||||
|
CLICKED_BACK_TO_HOMEPAGE: "CLICKED_BACK_TO_HOMEPAGE",
|
||||||
|
|
||||||
// TODO: use virtual page?
|
// TODO: use virtual page?
|
||||||
// Vin selection
|
// Vin selection
|
||||||
CLICKED_BACK_WITH_VIN: "CLICKED_BACK_WITH_VIN",
|
CLICKED_BACK_WITH_VIN: "CLICKED_BACK_WITH_VIN",
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,14 @@ export const routeData = {
|
||||||
path: "/virtual/restart",
|
path: "/virtual/restart",
|
||||||
virtual: true,
|
virtual: true,
|
||||||
},
|
},
|
||||||
|
BAILOUT: {
|
||||||
|
name: "bailout",
|
||||||
|
path: "/bailout",
|
||||||
|
},
|
||||||
|
BAILOUT_SUCCESS: {
|
||||||
|
name: "bailout-success",
|
||||||
|
path: "/bailout-success",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const FUNNEL_START_PAGE = routeData.VEHICLE;
|
export const FUNNEL_START_PAGE = routeData.VEHICLE;
|
||||||
|
|
|
||||||
|
|
@ -274,6 +274,10 @@ const routingTable = function () {
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
||||||
destinationPageData: routeData.QUOTE,
|
destinationPageData: routeData.QUOTE,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.BAILOUT,
|
||||||
|
destinationPageData: routeData.BAILOUT,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -806,6 +810,24 @@ const routingTable = function () {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
pageName: routeData.BAILOUT.name,
|
||||||
|
maps: [
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_FORWARD,
|
||||||
|
destinationPageData: routeData.BAILOUT_SUCCESS,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pageName: routeData.BAILOUT_SUCCESS.name,
|
||||||
|
maps: [
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_TO_HOMEPAGE,
|
||||||
|
destinationPageData: routeData.RESTART,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,13 @@ export async function navigateWithSaving(scenario, currentPageName) {
|
||||||
|
|
||||||
export async function navigateWithPageData(scenario, currentPageName, pageData = {}) {
|
export async function navigateWithPageData(scenario, currentPageName, pageData = {}) {
|
||||||
const nextPage = getDestination(currentPageName, scenario);
|
const nextPage = getDestination(currentPageName, scenario);
|
||||||
await savePageData(nextPage.name, pageData);
|
|
||||||
|
if (pageData && pageData.bailoutCode) {
|
||||||
|
pageData.AppName = "FixMyGlass";
|
||||||
|
await savePageData(currentPageName, pageData);
|
||||||
|
} else {
|
||||||
|
await savePageData(nextPage.name, pageData);
|
||||||
|
}
|
||||||
|
|
||||||
return await navigate(scenario, currentPageName, true);
|
return await navigate(scenario, currentPageName, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@ export const routes = [
|
||||||
createRoute(routeData.RECALIBRATION_INFO),
|
createRoute(routeData.RECALIBRATION_INFO),
|
||||||
createRoute(routeData.COVERAGE_STATEMENT),
|
createRoute(routeData.COVERAGE_STATEMENT),
|
||||||
createRoute(routeData.VERIFY_DETAILS),
|
createRoute(routeData.VERIFY_DETAILS),
|
||||||
|
createRoute(routeData.BAILOUT),
|
||||||
|
createRoute(routeData.BAILOUT_SUCCESS),
|
||||||
// Virtual pages (resolve to a non-virtual page.)
|
// Virtual pages (resolve to a non-virtual page.)
|
||||||
createVirtualRoute(routeData.LANDING, landingBeforeEnter),
|
createVirtualRoute(routeData.LANDING, landingBeforeEnter),
|
||||||
createVirtualRoute(routeData.HERITAGE, heritageBeforeEnter),
|
createVirtualRoute(routeData.HERITAGE, heritageBeforeEnter),
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,7 @@ const getDefaultState = () => {
|
||||||
currentDeductible: 0,
|
currentDeductible: 0,
|
||||||
originalDeductible: 0,
|
originalDeductible: 0,
|
||||||
policyNumber: null,
|
policyNumber: null,
|
||||||
|
claimNumber: null,
|
||||||
isItac: false,
|
isItac: false,
|
||||||
additionalAuthFlag: null,
|
additionalAuthFlag: null,
|
||||||
isNoComp: false,
|
isNoComp: false,
|
||||||
|
|
@ -216,6 +217,7 @@ const getDefaultState = () => {
|
||||||
affiliateCookies: [],
|
affiliateCookies: [],
|
||||||
loggingOption: false,
|
loggingOption: false,
|
||||||
hasAlreadyTriggeredError: false,
|
hasAlreadyTriggeredError: false,
|
||||||
|
bailoutCode: null,
|
||||||
},
|
},
|
||||||
idempotencyKeyFields: {
|
idempotencyKeyFields: {
|
||||||
referralCorrelationId: null,
|
referralCorrelationId: null,
|
||||||
|
|
@ -355,6 +357,9 @@ export const mutations = {
|
||||||
updateZipCode(state, zipCode) {
|
updateZipCode(state, zipCode) {
|
||||||
state.order.policy.zipCode = zipCode;
|
state.order.policy.zipCode = zipCode;
|
||||||
},
|
},
|
||||||
|
updateClaimNumber(state, claimNumber) {
|
||||||
|
state.order.policy.claimNumber = claimNumber;
|
||||||
|
},
|
||||||
updateIsClaimAndCoverage(state, isClaimAndCoverage) {
|
updateIsClaimAndCoverage(state, isClaimAndCoverage) {
|
||||||
state.order.payment.isClaimAndCoverage = isClaimAndCoverage;
|
state.order.payment.isClaimAndCoverage = isClaimAndCoverage;
|
||||||
},
|
},
|
||||||
|
|
@ -370,6 +375,26 @@ export const mutations = {
|
||||||
updateIsInsurance(state, isInsurance) {
|
updateIsInsurance(state, isInsurance) {
|
||||||
state.order.payment.isInsurance = isInsurance;
|
state.order.payment.isInsurance = isInsurance;
|
||||||
},
|
},
|
||||||
|
resetInsuranceDetails(state) {
|
||||||
|
state.order.payment.insuranceCoverage = {
|
||||||
|
isVerified: null,
|
||||||
|
coverageStatus: null,
|
||||||
|
coverageSubStatus: null,
|
||||||
|
coverageType: null,
|
||||||
|
coverageVerificationType: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
state.order.policy.policyNumber = null;
|
||||||
|
state.order.policy.claimNumber = null;
|
||||||
|
state.order.policy.insuranceCompanyName = null;
|
||||||
|
state.order.policy.streetAddress = null;
|
||||||
|
state.order.policy.apartment = null;
|
||||||
|
state.order.policy.city = null;
|
||||||
|
state.order.policy.state = null;
|
||||||
|
state.order.policy.zipCode = null;
|
||||||
|
state.order.damage.dateOfLoss = null;
|
||||||
|
state.order.damage.damageCause = null;
|
||||||
|
},
|
||||||
updateIsPia(state, isPia) {
|
updateIsPia(state, isPia) {
|
||||||
state.order.payment.isPia = isPia;
|
state.order.payment.isPia = isPia;
|
||||||
},
|
},
|
||||||
|
|
@ -462,9 +487,11 @@ export const mutations = {
|
||||||
state.order.vehicle.registration.licensePlate = registrationInfo?.licensePlate;
|
state.order.vehicle.registration.licensePlate = registrationInfo?.licensePlate;
|
||||||
},
|
},
|
||||||
updateServiceZip(state, serviceZipInfo) {
|
updateServiceZip(state, serviceZipInfo) {
|
||||||
state.order.serviceLocation.state = serviceZipInfo.state;
|
state.order.serviceLocation.state = serviceZipInfo.state || serviceZipInfo.payload?.state;
|
||||||
state.order.serviceLocation.zipCode = serviceZipInfo.zipCode;
|
state.order.serviceLocation.zipCode =
|
||||||
state.order.serviceLocation.zipCodeCtu = serviceZipInfo.zipCodeCtu;
|
serviceZipInfo.zipCode || serviceZipInfo.payload?.zipCode;
|
||||||
|
state.order.serviceLocation.zipCodeCtu =
|
||||||
|
serviceZipInfo.zipCodeCtu || serviceZipInfo.payload?.zipCodeCtu;
|
||||||
},
|
},
|
||||||
updateServiceLocation(state, serviceLocationInfo) {
|
updateServiceLocation(state, serviceLocationInfo) {
|
||||||
state.order.serviceLocation.address = serviceLocationInfo.address;
|
state.order.serviceLocation.address = serviceLocationInfo.address;
|
||||||
|
|
@ -523,6 +550,7 @@ export const mutations = {
|
||||||
state.order.policy.city = insuranceDetails.city;
|
state.order.policy.city = insuranceDetails.city;
|
||||||
state.order.policy.state = insuranceDetails.state;
|
state.order.policy.state = insuranceDetails.state;
|
||||||
state.order.policy.zipCode = insuranceDetails.zipCode;
|
state.order.policy.zipCode = insuranceDetails.zipCode;
|
||||||
|
state.order.policy.claimNumber = insuranceDetails.claimNumber;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateDamageDetails(state, damageDetails) {
|
updateDamageDetails(state, damageDetails) {
|
||||||
|
|
@ -948,6 +976,9 @@ export const mutations = {
|
||||||
state.idempotencyKeyFields.totalInCents = totalInCents;
|
state.idempotencyKeyFields.totalInCents = totalInCents;
|
||||||
state.idempotencyKeyFields.expiryTime = expiryTime;
|
state.idempotencyKeyFields.expiryTime = expiryTime;
|
||||||
},
|
},
|
||||||
|
updateBailoutCode(state, bailoutCode) {
|
||||||
|
state.applicationUser.bailoutCode = bailoutCode;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Export Getters
|
// Export Getters
|
||||||
|
|
@ -1901,21 +1932,38 @@ export const actions = {
|
||||||
// create a new array to avoid mutating state
|
// create a new array to avoid mutating state
|
||||||
const glassArrayForPayload = convertGlassPieceNamingForApi(glassArray);
|
const glassArrayForPayload = convertGlassPieceNamingForApi(glassArray);
|
||||||
|
|
||||||
const response = await globalMethods.callHttpClient({
|
const response = await globalMethods
|
||||||
method: endpoints.GetPartsOrQuestions.method,
|
.callHttpClient({
|
||||||
endpoint: endpoints.GetPartsOrQuestions.url,
|
method: endpoints.GetPartsOrQuestions.method,
|
||||||
payload: {
|
endpoint: endpoints.GetPartsOrQuestions.url,
|
||||||
carId: carId,
|
payload: {
|
||||||
glassPieces: glassArrayForPayload,
|
carId: carId,
|
||||||
zip: zipCode,
|
glassPieces: glassArrayForPayload,
|
||||||
vin: vin,
|
zip: zipCode,
|
||||||
serviceType: serviceType,
|
vin: vin,
|
||||||
referralSeqNumber: referralSeqNumber,
|
serviceType: serviceType,
|
||||||
parentAccountNumber: parentAccountNumber,
|
referralSeqNumber: referralSeqNumber,
|
||||||
},
|
parentAccountNumber: parentAccountNumber,
|
||||||
logApiCall: true,
|
},
|
||||||
pageNameToLog: pageNameToLog,
|
logApiCall: true,
|
||||||
});
|
pageNameToLog: pageNameToLog,
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
if (error.status == 500) {
|
||||||
|
return { PartsNotFound: true };
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Triggers bailout
|
||||||
|
if (response.PartsNotFound) {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we only have MISC parts to trigger bailout
|
||||||
|
const miscPartsResponse = checkIfMiscParts(response.data.partsOrQuestions);
|
||||||
|
if (miscPartsResponse.PartsNotFound) {
|
||||||
|
return miscPartsResponse;
|
||||||
|
}
|
||||||
|
|
||||||
// Flatten location and name properties
|
// Flatten location and name properties
|
||||||
response.data.partsOrQuestions = convertGlassPieceNamingFromApi(
|
response.data.partsOrQuestions = convertGlassPieceNamingFromApi(
|
||||||
|
|
@ -3111,6 +3159,9 @@ export const actions = {
|
||||||
saveBillToAccountNumber(context, billToAccountNumber) {
|
saveBillToAccountNumber(context, billToAccountNumber) {
|
||||||
context.commit(storeMutations.UPDATE_BILL_TO_ACCT_NUMBER, billToAccountNumber);
|
context.commit(storeMutations.UPDATE_BILL_TO_ACCT_NUMBER, billToAccountNumber);
|
||||||
},
|
},
|
||||||
|
resetInsuranceDetails(context) {
|
||||||
|
context.commit(storeMutations.RESET_INSURANCE_DETAILS);
|
||||||
|
},
|
||||||
|
|
||||||
saveSupportingItems(context, supportingItems) {
|
saveSupportingItems(context, supportingItems) {
|
||||||
syncLineItemIds(supportingItems, context.state.order.lineItems.supportingItems);
|
syncLineItemIds(supportingItems, context.state.order.lineItems.supportingItems);
|
||||||
|
|
@ -3818,6 +3869,10 @@ export const actions = {
|
||||||
context.commit(storeMutations.UPDATE_IDEMPOTENCY_KEY, newKey);
|
context.commit(storeMutations.UPDATE_IDEMPOTENCY_KEY, newKey);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
saveBailoutCode(context, bailoutCode) {
|
||||||
|
context.commit(storeMutations.UPDATE_BAILOUT_CODE, bailoutCode);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default createStore({
|
export default createStore({
|
||||||
|
|
@ -4359,3 +4414,17 @@ const timeSlotCallFlags = {
|
||||||
shop: false,
|
shop: false,
|
||||||
mobile: false,
|
mobile: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function checkIfMiscParts(partsOrQuestions) {
|
||||||
|
if (!partsOrQuestions || partsOrQuestions.length === 0) {
|
||||||
|
return { PartsNotFound: true };
|
||||||
|
} else if (
|
||||||
|
partsOrQuestions.length === 1 &&
|
||||||
|
partsOrQuestions[0].parts &&
|
||||||
|
partsOrQuestions[0].parts.length === 1 &&
|
||||||
|
partsOrQuestions[0].parts[0].partNumber.startsWith("MISC")
|
||||||
|
) {
|
||||||
|
return { PartsNotFound: true };
|
||||||
|
}
|
||||||
|
return { PartsNotFound: false };
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue