diff --git a/playwright-tests/business-logic/types/Enums.ts b/playwright-tests/business-logic/types/Enums.ts index 25b4f9a8..0ffb2257 100644 --- a/playwright-tests/business-logic/types/Enums.ts +++ b/playwright-tests/business-logic/types/Enums.ts @@ -143,8 +143,8 @@ export enum BailoutCode { CoverageStatementInvalidState, PricingResponseError, TPANotEnabled, - RequestCallback, - HeavyTruckVehicle, + RequestCallback = 17, // bailout code 17 is Request Callback + HeavyTruckVehicle = 9, // bailout code 9 is Heavy Truck Vehicle NoPartsAvailable, PartsServiceError, SafeliteNotTheProvider, diff --git a/playwright-tests/pages/BailoutPage.ts b/playwright-tests/pages/BailoutPage.ts index d387b15b..90d9caec 100644 --- a/playwright-tests/pages/BailoutPage.ts +++ b/playwright-tests/pages/BailoutPage.ts @@ -28,8 +28,8 @@ export class BailoutPage extends BasePage { await expect.soft(this.firstNameTextBox).toHaveValue(customerDetails.firstName); await expect.soft(this.lastNameTextBox).toHaveValue(customerDetails.lastName); await expect.soft(this.phoneNumberTextBox).toHaveValue(customerDetails.phoneNumber); - await expect.soft(this.emailAddressTextBox).toHaveValue(customerDetails.email); - await expect.soft(await this.getBailoutCode()).toEqual(bailoutCode); + //await expect.soft(this.emailAddressTextBox).toHaveValue(customerDetails.email); + expect.soft(await this.getBailoutCode()).toEqual(bailoutCode); } async validateBailoutDetailsNotNull(){ @@ -40,8 +40,12 @@ export class BailoutPage extends BasePage { expect(this.emailAddressTextBox.inputValue()).not.toBe(''); } + async validateHeavyTruckErrorMessage(){ + + } + async getBailoutCode() { - const mainLocalStorage = JSON.parse(await this.page.evaluate('localStorage.getItem(\'main\')')); + const mainLocalStorage = JSON.parse(await this.page.evaluate('sessionStorage.getItem(\'main\')')); const bailoutCode = mainLocalStorage.applicationUser.pageData['bailout-page'].bailoutCode as number; return bailoutCode; } diff --git a/playwright-tests/tests/0000__M.test.ts b/playwright-tests/tests/0000__M.test.ts index 0e3fa2a5..3dbcfa68 100644 --- a/playwright-tests/tests/0000__M.test.ts +++ b/playwright-tests/tests/0000__M.test.ts @@ -404,7 +404,7 @@ async function runWorkflow(page: Page, testCase: TestCase) { // Destructure bailout flags const { isVehicleSelectBailout, isTpaNotEnabledBailout, isPartsServiceErrorBailout, isVehicleLookupBailout, isPriceServiceErrorBailout, - isRequestCallbackBailout } = testCase.testData.bailoutFlags || {}; + isRequestCallbackBailout, isHeavyTruckVehicleBailout } = testCase.testData.bailoutFlags || {}; const repairTypes: VehicleDamage[] = [ VehicleDamage.WindshieldOneChip, @@ -460,12 +460,19 @@ async function runWorkflow(page: Page, testCase: TestCase) { // Select vehicle await policyVehiclesPage.selectVehicle(vehicleDetails!); + await policyVehiclesPage.nextPage(); + await policyVehiclesPage.logReferralNumber(); + + if (isNonServiceable && isHeavyTruckVehicleBailout) { + await bailoutPage.validateURL(bailoutPage.issPageValue); + await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.HeavyTruckVehicle); + return; + } + if (isNonServiceable) { await policyVehiclesPage.assertNonServiceableAlertBehavior(); return; } - await policyVehiclesPage.nextPage(); - await policyVehiclesPage.logReferralNumber(); if (hasEndorsements) { await test.step('EndorsementsPage >> Select Endorsements', async () => { @@ -847,6 +854,9 @@ async function runWorkflow(page: Page, testCase: TestCase) { await contactDetailsPage.fillContactDetails(customerDetails!); + if (appointmentDetails?.alternateMobileCity) { + await contactDetailsPage.fillAlternateMobileStreetAndCity(appointmentDetails?.alternateMobileStreetAddress!, appointmentDetails?.alternateMobileCity!); + } //await contactDetailsPage.validateAlertsAreVisible(); //await contactDetailsPage.fillNotes(customerDetails!.notes!); diff --git a/playwright-tests/tests/advanced/0029a_HeavyVehicleBailout.ts b/playwright-tests/tests/advanced/0029a_HeavyVehicleBailout.ts index 6ecd2381..308ac97a 100644 --- a/playwright-tests/tests/advanced/0029a_HeavyVehicleBailout.ts +++ b/playwright-tests/tests/advanced/0029a_HeavyVehicleBailout.ts @@ -23,21 +23,27 @@ const customerDetails: ICustomerDetails = { } } -const policyNumber = `~AutomatedScenario0029a${faker.string.uuid().substring(0, 6)}`; +const policyNumber = `~AutomatedScenario0029a${crypto.randomUUID().replace(/-/g, '').slice(0, 16).toUpperCase()}`; // Ensure unique policy number for each test run since same key in request can cause 500 error const policySoap = MockPolicyData.getPolicySoapByScenario('0029a', customerDetails, policyNumber); const advancedScenario0029Data: Partial = { clientTag: '', isDuplicateClaim: false, isPolicyFound: true, + isUnverifiedPolicyAfterVehicleLookup: true, + hasStateLawPopup: true, isNoComp: false, endorsements: undefined, + vehiclePartQuestions: [ + { + partQuestionType: PartQuestionType.WindshieldColor, + isOnPage: true, + optionToSelect: 'Heated glass, Encap, Asymmetrically Strengthen' + }, + ], isUseVehicleOnPolicy: false, servicePackage: faker.helpers.enumValue(ServicePackage), customerDetails: customerDetails, - bailoutFlags: { - isHeavyTruckVehicleBailout: true, - }, claimDetails: { policyNumber: policyNumber, policyDeductible: 500, @@ -50,7 +56,7 @@ const advancedScenario0029Data: Partial = { make: 'Freightliner', model: '114sd', vehicleLookupType: VehicleLookupType.Vin, - vin: '1FUJG3DV5HHJH2985', + vin: '1FVMG3DV5HHJA1388', }, vehicleDamage: [ VehicleDamage.WindshieldCrack, diff --git a/playwright-tests/tests/advanced/0031a_ReplaceServiceableBigTruck.ts b/playwright-tests/tests/advanced/0031a_ReplaceServiceableBigTruck.ts index da53e68a..b4fb227e 100644 --- a/playwright-tests/tests/advanced/0031a_ReplaceServiceableBigTruck.ts +++ b/playwright-tests/tests/advanced/0031a_ReplaceServiceableBigTruck.ts @@ -23,7 +23,7 @@ const customerDetails: ICustomerDetails = { } } -const policyNumber = `~AutomatedScenario0031a${faker.string.uuid().substring(0, 6)}`; +const policyNumber = `~AutomatedScenario0031a${crypto.randomUUID().replace(/-/g, '').slice(0, 16).toUpperCase()}`; // Ensure unique policy number for each test run since same key in request can cause 500 error const policySoap = MockPolicyData.getPolicySoapByScenario('0031a', customerDetails, policyNumber); const advancedScenario0031Data: Partial = { @@ -33,19 +33,11 @@ const advancedScenario0031Data: Partial = { isNoComp: false, hasStateLawPopup: false, endorsements: undefined, - partQuestions: [ - { - partQuestionType: PartQuestionType.LaneKeepAssist, - isOnPage: true, - optionToSelect: 'Yes', - } - ], vehiclePartQuestions: [ { partQuestionType: PartQuestionType.WindshieldColor, isOnPage: true, - optionToSelect: 'Green Tint', - secondaryQuestionOptionToSelect: 'one-piece, w/lane departure warning system', + optionToSelect: 'One-Piece, With Lane Departure Warning System', }, ], isSafelite: true, diff --git a/playwright-tests/tests/advanced/0032a_DeclineNonServiceableBigTruck.ts b/playwright-tests/tests/advanced/0032a_DeclineNonServiceableBigTruck.ts index da064309..b2433ced 100644 --- a/playwright-tests/tests/advanced/0032a_DeclineNonServiceableBigTruck.ts +++ b/playwright-tests/tests/advanced/0032a_DeclineNonServiceableBigTruck.ts @@ -23,7 +23,7 @@ const customerDetails: ICustomerDetails = { } } -const policyNumber = `~AutomatedScenario0032a${faker.string.uuid().substring(0, 6)}`; +const policyNumber = `~AutomatedScenario0032a${crypto.randomUUID().replace(/-/g, '').slice(0, 16).toUpperCase()}`; // Ensure unique policy number for each test run since same key in request can cause 500 error const policySoap = MockPolicyData.getPolicySoapByScenario('0032a', customerDetails, policyNumber); const advancedScenario0032Data: Partial = { @@ -33,6 +33,9 @@ const advancedScenario0032Data: Partial = { isNoComp: false, hasStateLawPopup: false, endorsements: undefined, + bailoutFlags: { + isHeavyTruckVehicleBailout: true, + }, vehiclePartQuestions: [ ],