10175 validations and fixes
This commit is contained in:
parent
9231928212
commit
3e9aa3ee80
7 changed files with 64 additions and 18 deletions
|
|
@ -109,6 +109,7 @@ const essentialClients: IClient[] = [
|
|||
clientTag: 'A5F7D473-29C4-4E2C-AD08-A3AB13FE0314',
|
||||
accountName: 'Safeco Insurance',
|
||||
accountNumber: '408810',
|
||||
parentCarrierName: 'Liberty Mutual',
|
||||
clientFlags: { isTpaEnabled: true, isWelcomeDamageLocationRequired: true},
|
||||
bgColor: "rgb(255, 209, 0)",
|
||||
|
||||
|
|
@ -223,6 +224,7 @@ const advancedClients: IClient[] = [
|
|||
clientTag: 'A5F7D473-29C4-4E2C-AD08-A3AB13FE0314',
|
||||
accountName: 'Safeco Insurance',
|
||||
accountNumber: '408810',
|
||||
parentCarrierName: 'Liberty Mutual',
|
||||
clientFlags: { isTpaEnabled: true, isWelcomeDamageLocationRequired: true },
|
||||
bgColor: "rgb(255, 209, 0)",
|
||||
mockProfile: {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ export interface IClient {
|
|||
clientTag: string,
|
||||
accountName: string,
|
||||
accountNumber?: string,
|
||||
parentCarrierName?: string,
|
||||
clientFlags: Partial<IClientFlags>,
|
||||
bgColor?: string,
|
||||
mockProfile?: IClientMockProfile
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { buildToken, getTimestamp } from '@impl/utils/TokenUtils';
|
|||
import ClientData from "@business-logic/data/ClientData";
|
||||
|
||||
export class WelcomePage extends BasePage {
|
||||
private static readonly GENERIC_BRAND_WORDS = new Set(['insurance', 'mutual', 'group', 'company', 'private', 'client']);
|
||||
readonly page: Page;
|
||||
readonly policyNumber: Locator;
|
||||
readonly policyZip: Locator;
|
||||
|
|
@ -19,6 +20,8 @@ export class WelcomePage extends BasePage {
|
|||
readonly cookieCloseButton: Locator;
|
||||
readonly GetStartedButton: Locator;
|
||||
readonly applicationPageHeader: Locator;
|
||||
readonly applicationLogo: Locator;
|
||||
readonly applicationSubHeader: Locator;
|
||||
|
||||
url = process.env['BASE_URL']! + '/?issPage=welcome-page';
|
||||
issPageValue = 'welcome-page';
|
||||
|
|
@ -37,6 +40,8 @@ export class WelcomePage extends BasePage {
|
|||
this.cookieCloseButton = page.getByRole('button', { name: 'Close' });
|
||||
this.GetStartedButton = page.getByRole('button', { name: 'Get Started' });
|
||||
this.applicationPageHeader = page.locator('.site-header-container');
|
||||
this.applicationLogo = page.locator('#siteHeaderImage');
|
||||
this.applicationSubHeader = page.locator('xpath=//h5[contains(@class,"subheader")]//span');
|
||||
}
|
||||
|
||||
async goto(clientTag: string) {
|
||||
|
|
@ -91,6 +96,36 @@ export class WelcomePage extends BasePage {
|
|||
expect(normalize(actualBgColor)).toBe(normalize(client.bgColor));
|
||||
}
|
||||
}
|
||||
private getBrandTokens(name: string): string[] {
|
||||
return name
|
||||
.toLowerCase()
|
||||
.split(/\s+/)
|
||||
.filter(word => word.length > 2 && !WelcomePage.GENERIC_BRAND_WORDS.has(word));
|
||||
}
|
||||
|
||||
private matchesBrandText(text: string, name: string): boolean {
|
||||
return this.getBrandTokens(name).some(token => text.includes(token));
|
||||
}
|
||||
|
||||
async hasApplicationLogo(currentClientTag: string, accountNumber?: string) {
|
||||
await expect(this.applicationLogo).toBeVisible();
|
||||
const client = ClientData.resolveClientForTest(currentClientTag, accountNumber);
|
||||
const altTextString = ((await this.applicationLogo.getAttribute('alt')) ?? '').toLowerCase();
|
||||
const hasBrandMatch = this.matchesBrandText(altTextString, client?.accountName ?? '');
|
||||
await expect(hasBrandMatch).toBeTruthy();
|
||||
}
|
||||
|
||||
async hasApplicationSubHeader(currentClientTag: string, accountNumber?: string) {
|
||||
await expect(this.applicationSubHeader).toBeVisible();
|
||||
const client = ClientData.resolveClientForTest(currentClientTag, accountNumber);
|
||||
const subHeaderTextString = ((await this.applicationSubHeader.innerText()) ?? '').toLowerCase();
|
||||
|
||||
await expect(subHeaderTextString).toContain('welcome to');
|
||||
|
||||
const brandSourceName = client?.parentCarrierName ?? client?.accountName ?? '';
|
||||
const hasBrandMatch = this.matchesBrandText(subHeaderTextString, brandSourceName);
|
||||
await expect(hasBrandMatch).toBeTruthy();
|
||||
}
|
||||
|
||||
async validateDamageLocationFieldsIfRequired(clientTag: string, accountNumber?: string) {
|
||||
const client = ClientData.resolveClientForTest(clientTag, accountNumber);
|
||||
|
|
|
|||
|
|
@ -417,6 +417,14 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
testCase.testData.accountNumber
|
||||
);
|
||||
});
|
||||
|
||||
await test.step('WelcomePage >> Check Application Logo', async () => {
|
||||
await welcomePage.hasApplicationLogo(testCase.testData.clientTag!, testCase.testData.accountNumber);
|
||||
});
|
||||
|
||||
await test.step('WelcomePage >> Check Application Sub Header - Welcome Title', async () => {
|
||||
await welcomePage.hasApplicationSubHeader(testCase.testData.clientTag!, testCase.testData.accountNumber);
|
||||
});
|
||||
|
||||
await test.step('WelcomePage >> Validate damage location fields', async () => {
|
||||
await welcomePage.validateDamageLocationFieldsIfRequired(
|
||||
|
|
@ -764,25 +772,27 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
});
|
||||
}
|
||||
|
||||
if (!isPolicyFound && !(isItac || isNoComp) && !isUnverifiedPolicyAfterVehicleLookup && !isTpaNotEnabledBailout) {
|
||||
if (!isPolicyFound && !(isItac || isNoComp) && !isUnverifiedPolicyAfterVehicleLookup) {
|
||||
if (isSafelite) {
|
||||
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
|
||||
await providerPreferencePage.selectProvider(isSafelite);
|
||||
}
|
||||
|
||||
if (!isSafelite && isTpaNotEnabledBailout) {
|
||||
|
||||
await providerPreferencePage.scheduleTPAWithoutAdas();
|
||||
await test.step('ProviderPreferencePage >> Find another shop triggers TPA not enabled bailout', async () => {
|
||||
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
|
||||
await providerPreferencePage.scheduleTPAWithoutAdas();
|
||||
});
|
||||
|
||||
await test.step('validateBailoutDetails >> Bailout code : ' + BailoutCode.TPANotEnabled, async () => {
|
||||
await bailoutPage.validateURL(bailoutPage.issPageValue);
|
||||
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.TPANotEnabled);
|
||||
return;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isSafelite && !isTpaNotEnabledBailout) {
|
||||
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
|
||||
await providerPreferencePage.scheduleTPAWithoutAdas();
|
||||
}
|
||||
|
||||
|
|
@ -816,15 +826,6 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
|
||||
if (!isSafelite) {
|
||||
|
||||
if (isTpaNotEnabledBailout) {
|
||||
await test.step('validateBailoutDetails >> Bailout code : ' + BailoutCode.TPANotEnabled, async () => {
|
||||
await bailoutPage.validateURL(bailoutPage.issPageValue);
|
||||
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.TPANotEnabled);
|
||||
return;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isSafelite && !isTpaNotEnabledBailout) {
|
||||
await test.step('TpaSearchPage >> TPA Search', async () => {
|
||||
await tpaSearchPage.validateURL(tpaSearchPage.issPageValue);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ const essentialReplaceDynamicAdasData: Partial<ITestData> = {
|
|||
phoneNumber: faker.helpers.fromRegExp(/[2-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]/),
|
||||
notes: 'Automated Test',
|
||||
address: {
|
||||
street: '9039 4th Avenue South',
|
||||
street: '9039 4th Avenue South, seattle, washington, 98108',
|
||||
city: 'Seattle',
|
||||
state: 'WASHINGTON',
|
||||
postalCode: '98108',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import ClientData from "@business-logic/data/ClientData";
|
||||
import TestCase from "@business-logic/types/TestCase";
|
||||
import { DamageType, ServiceLocation, ServicePackage, VehicleDamage, VehicleLookupType } from "@business-logic/types/Enums";
|
||||
import { DamageType, PartQuestionType, ServiceLocation, ServicePackage, VehicleDamage, VehicleLookupType } from "@business-logic/types/Enums";
|
||||
import { ITestData } from "@business-logic/types/ITestData"
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { getNextWeekday } from "@impl/utils/DateUtils";
|
||||
|
|
@ -14,6 +14,13 @@ const essentialTpaNotEnabledData: Partial<ITestData> = {
|
|||
endorsements: [],
|
||||
isReplace: true,
|
||||
partQuestions: undefined,
|
||||
capabilityQuestions: [
|
||||
{
|
||||
partQuestionType: PartQuestionType.LaneKeepAssist,
|
||||
isOnPage: true,
|
||||
optionToSelect: 'No'
|
||||
}
|
||||
],
|
||||
isSafelite: false,
|
||||
bailoutFlags: {
|
||||
isTpaNotEnabledBailout: true
|
||||
|
|
@ -44,9 +51,9 @@ const essentialTpaNotEnabledData: Partial<ITestData> = {
|
|||
year: '2015',
|
||||
make: 'Ford',
|
||||
model: 'F Series F150',
|
||||
style: '2 door super cab',
|
||||
style: '4 door crew cab',
|
||||
vin: '1FTEX1C82FFB42543',
|
||||
licensePlateNumber: '15377DV',
|
||||
licensePlateNumber: 'FZL3949',
|
||||
licensePlateState: 'Texas',
|
||||
vehicleLookupType: VehicleLookupType.LicensePlateNumber,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ const essentialTpaEnabledData: Partial<ITestData> = {
|
|||
// phoneNumber: faker.phone.toString(),
|
||||
notes: 'Automated Test',
|
||||
address: {
|
||||
street: '1st St',
|
||||
street: '1st St S, Jacksonville Beach, FL, 32250',
|
||||
city: 'Jacksonville Beach',
|
||||
state: 'FLORIDA',
|
||||
postalCode: '32250',
|
||||
|
|
|
|||
Loading…
Reference in a new issue