Add bailout page test for parts not found scenario
This commit is contained in:
parent
d2d40ad679
commit
7ef067f1d3
4 changed files with 114 additions and 0 deletions
|
|
@ -33,8 +33,10 @@ import { EndorsementsPage } from "../pages/EndorsementsPage"
|
|||
import { PolicyDriverPage } from "../pages/PolicyDriverPage"
|
||||
import { ServiceZipPage } from "../pages/ServiceZipPage"
|
||||
import { MobileDetailsPage } from "pages/MobileDetailsPage";
|
||||
import { BailoutPage } from '../pages/BailoutPage';
|
||||
|
||||
export interface ITestPages {
|
||||
bailoutPage: BailoutPage,
|
||||
capabilityQuestionsPage: CapabilityQuestionsPage,
|
||||
ccPolicyInfoPage: CCPolicyInfoPage,
|
||||
contactDetailsPage: ContactDetailsPage,
|
||||
|
|
@ -72,6 +74,7 @@ export interface ITestPages {
|
|||
|
||||
export const createTestPages: TestPagesFactory<ITestPages> = (page: Page) => {
|
||||
const pages: ITestPages = {
|
||||
bailoutPage: new BailoutPage(page),
|
||||
capabilityQuestionsPage: new CapabilityQuestionsPage(page),
|
||||
ccPolicyInfoPage: new CCPolicyInfoPage(page),
|
||||
contactDetailsPage: new ContactDetailsPage(page),
|
||||
|
|
|
|||
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 textOptInBox: 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.textOptInBox = 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 checkTextMeUpdates(customerDetails: ICustomerDetails) {
|
||||
await this.textOptInBox.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.checkTextMeUpdates(customerDetails!);
|
||||
}
|
||||
|
||||
await this.nextPage();
|
||||
}
|
||||
}
|
||||
|
|
@ -41,6 +41,7 @@ import { getTestObject, TestCase, prepareTest, RuleEngine, TestInfo } from 'fram
|
|||
import { createTestPages } from "framework/TestPages";
|
||||
import cashReplaceSwitchToInsuranceProgressiveNoCompTests from "./CashReplaceSwitchToInsuranceProgressiveNoComp";
|
||||
import insuranceBigTruckVerifiedTests from "./InsuranceBigTruckVerified";
|
||||
import partsNotFoundBailoutTests from "./PartsNotFoundBailout";
|
||||
import insuranceUnverifiedTests from "./InsuranceUnverified";
|
||||
import CashReplaceSplitWindshieldTests from "./CashReplaceSplitWindshield";
|
||||
import insuranceMeemicNearSchoolVerifiedTests from "./InsuranceMeemicNearSchoolVerified";
|
||||
|
|
@ -101,6 +102,7 @@ const allStandardTests = [
|
|||
// {name: "InsuranceGeico", tests: insuranceGeicoTests},
|
||||
// {name: "InsuranceITACOptimizedPriceValidationAllState", tests: insuranceITACOptimizedPriceValidationAllStateTests}
|
||||
{ name: "InsuranceMeemicNearSchoolVerified", tests: insuranceMeemicNearSchoolVerifiedTests },
|
||||
{ name: "PartsNotFoundBailout", tests: partsNotFoundBailoutTests },
|
||||
|
||||
];
|
||||
|
||||
|
|
@ -275,6 +277,12 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
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);
|
||||
}
|
||||
|
||||
// Handle part questions if applicable
|
||||
if (partQuestions && partQuestions.length > 0) {
|
||||
let partQuestionsPage = testCase.pages.partQuestionsPage;
|
||||
|
|
|
|||
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;
|
||||
Loading…
Reference in a new issue