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',
|
clientTag: 'A5F7D473-29C4-4E2C-AD08-A3AB13FE0314',
|
||||||
accountName: 'Safeco Insurance',
|
accountName: 'Safeco Insurance',
|
||||||
accountNumber: '408810',
|
accountNumber: '408810',
|
||||||
|
parentCarrierName: 'Liberty Mutual',
|
||||||
clientFlags: { isTpaEnabled: true, isWelcomeDamageLocationRequired: true},
|
clientFlags: { isTpaEnabled: true, isWelcomeDamageLocationRequired: true},
|
||||||
bgColor: "rgb(255, 209, 0)",
|
bgColor: "rgb(255, 209, 0)",
|
||||||
|
|
||||||
|
|
@ -223,6 +224,7 @@ const advancedClients: IClient[] = [
|
||||||
clientTag: 'A5F7D473-29C4-4E2C-AD08-A3AB13FE0314',
|
clientTag: 'A5F7D473-29C4-4E2C-AD08-A3AB13FE0314',
|
||||||
accountName: 'Safeco Insurance',
|
accountName: 'Safeco Insurance',
|
||||||
accountNumber: '408810',
|
accountNumber: '408810',
|
||||||
|
parentCarrierName: 'Liberty Mutual',
|
||||||
clientFlags: { isTpaEnabled: true, isWelcomeDamageLocationRequired: true },
|
clientFlags: { isTpaEnabled: true, isWelcomeDamageLocationRequired: true },
|
||||||
bgColor: "rgb(255, 209, 0)",
|
bgColor: "rgb(255, 209, 0)",
|
||||||
mockProfile: {
|
mockProfile: {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ export interface IClient {
|
||||||
clientTag: string,
|
clientTag: string,
|
||||||
accountName: string,
|
accountName: string,
|
||||||
accountNumber?: string,
|
accountNumber?: string,
|
||||||
|
parentCarrierName?: string,
|
||||||
clientFlags: Partial<IClientFlags>,
|
clientFlags: Partial<IClientFlags>,
|
||||||
bgColor?: string,
|
bgColor?: string,
|
||||||
mockProfile?: IClientMockProfile
|
mockProfile?: IClientMockProfile
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { buildToken, getTimestamp } from '@impl/utils/TokenUtils';
|
||||||
import ClientData from "@business-logic/data/ClientData";
|
import ClientData from "@business-logic/data/ClientData";
|
||||||
|
|
||||||
export class WelcomePage extends BasePage {
|
export class WelcomePage extends BasePage {
|
||||||
|
private static readonly GENERIC_BRAND_WORDS = new Set(['insurance', 'mutual', 'group', 'company', 'private', 'client']);
|
||||||
readonly page: Page;
|
readonly page: Page;
|
||||||
readonly policyNumber: Locator;
|
readonly policyNumber: Locator;
|
||||||
readonly policyZip: Locator;
|
readonly policyZip: Locator;
|
||||||
|
|
@ -19,6 +20,8 @@ export class WelcomePage extends BasePage {
|
||||||
readonly cookieCloseButton: Locator;
|
readonly cookieCloseButton: Locator;
|
||||||
readonly GetStartedButton: Locator;
|
readonly GetStartedButton: Locator;
|
||||||
readonly applicationPageHeader: Locator;
|
readonly applicationPageHeader: Locator;
|
||||||
|
readonly applicationLogo: Locator;
|
||||||
|
readonly applicationSubHeader: Locator;
|
||||||
|
|
||||||
url = process.env['BASE_URL']! + '/?issPage=welcome-page';
|
url = process.env['BASE_URL']! + '/?issPage=welcome-page';
|
||||||
issPageValue = 'welcome-page';
|
issPageValue = 'welcome-page';
|
||||||
|
|
@ -37,6 +40,8 @@ export class WelcomePage extends BasePage {
|
||||||
this.cookieCloseButton = page.getByRole('button', { name: 'Close' });
|
this.cookieCloseButton = page.getByRole('button', { name: 'Close' });
|
||||||
this.GetStartedButton = page.getByRole('button', { name: 'Get Started' });
|
this.GetStartedButton = page.getByRole('button', { name: 'Get Started' });
|
||||||
this.applicationPageHeader = page.locator('.site-header-container');
|
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) {
|
async goto(clientTag: string) {
|
||||||
|
|
@ -91,6 +96,36 @@ export class WelcomePage extends BasePage {
|
||||||
expect(normalize(actualBgColor)).toBe(normalize(client.bgColor));
|
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) {
|
async validateDamageLocationFieldsIfRequired(clientTag: string, accountNumber?: string) {
|
||||||
const client = ClientData.resolveClientForTest(clientTag, accountNumber);
|
const client = ClientData.resolveClientForTest(clientTag, accountNumber);
|
||||||
|
|
|
||||||
|
|
@ -418,6 +418,14 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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 test.step('WelcomePage >> Validate damage location fields', async () => {
|
||||||
await welcomePage.validateDamageLocationFieldsIfRequired(
|
await welcomePage.validateDamageLocationFieldsIfRequired(
|
||||||
testCase.testData.clientTag!,
|
testCase.testData.clientTag!,
|
||||||
|
|
@ -764,25 +772,27 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isPolicyFound && !(isItac || isNoComp) && !isUnverifiedPolicyAfterVehicleLookup && !isTpaNotEnabledBailout) {
|
if (!isPolicyFound && !(isItac || isNoComp) && !isUnverifiedPolicyAfterVehicleLookup) {
|
||||||
if (isSafelite) {
|
if (isSafelite) {
|
||||||
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
|
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
|
||||||
await providerPreferencePage.selectProvider(isSafelite);
|
await providerPreferencePage.selectProvider(isSafelite);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isSafelite && isTpaNotEnabledBailout) {
|
if (!isSafelite && isTpaNotEnabledBailout) {
|
||||||
|
await test.step('ProviderPreferencePage >> Find another shop triggers TPA not enabled bailout', async () => {
|
||||||
|
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
|
||||||
await providerPreferencePage.scheduleTPAWithoutAdas();
|
await providerPreferencePage.scheduleTPAWithoutAdas();
|
||||||
|
});
|
||||||
|
|
||||||
await test.step('validateBailoutDetails >> Bailout code : ' + BailoutCode.TPANotEnabled, async () => {
|
await test.step('validateBailoutDetails >> Bailout code : ' + BailoutCode.TPANotEnabled, async () => {
|
||||||
await bailoutPage.validateURL(bailoutPage.issPageValue);
|
await bailoutPage.validateURL(bailoutPage.issPageValue);
|
||||||
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.TPANotEnabled);
|
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.TPANotEnabled);
|
||||||
return;
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isSafelite && !isTpaNotEnabledBailout) {
|
if (!isSafelite && !isTpaNotEnabledBailout) {
|
||||||
|
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
|
||||||
await providerPreferencePage.scheduleTPAWithoutAdas();
|
await providerPreferencePage.scheduleTPAWithoutAdas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -816,15 +826,6 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
||||||
|
|
||||||
if (!isSafelite) {
|
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) {
|
if (!isSafelite && !isTpaNotEnabledBailout) {
|
||||||
await test.step('TpaSearchPage >> TPA Search', async () => {
|
await test.step('TpaSearchPage >> TPA Search', async () => {
|
||||||
await tpaSearchPage.validateURL(tpaSearchPage.issPageValue);
|
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]/),
|
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',
|
notes: 'Automated Test',
|
||||||
address: {
|
address: {
|
||||||
street: '9039 4th Avenue South',
|
street: '9039 4th Avenue South, seattle, washington, 98108',
|
||||||
city: 'Seattle',
|
city: 'Seattle',
|
||||||
state: 'WASHINGTON',
|
state: 'WASHINGTON',
|
||||||
postalCode: '98108',
|
postalCode: '98108',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import ClientData from "@business-logic/data/ClientData";
|
import ClientData from "@business-logic/data/ClientData";
|
||||||
import TestCase from "@business-logic/types/TestCase";
|
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 { ITestData } from "@business-logic/types/ITestData"
|
||||||
import { faker } from "@faker-js/faker";
|
import { faker } from "@faker-js/faker";
|
||||||
import { getNextWeekday } from "@impl/utils/DateUtils";
|
import { getNextWeekday } from "@impl/utils/DateUtils";
|
||||||
|
|
@ -14,6 +14,13 @@ const essentialTpaNotEnabledData: Partial<ITestData> = {
|
||||||
endorsements: [],
|
endorsements: [],
|
||||||
isReplace: true,
|
isReplace: true,
|
||||||
partQuestions: undefined,
|
partQuestions: undefined,
|
||||||
|
capabilityQuestions: [
|
||||||
|
{
|
||||||
|
partQuestionType: PartQuestionType.LaneKeepAssist,
|
||||||
|
isOnPage: true,
|
||||||
|
optionToSelect: 'No'
|
||||||
|
}
|
||||||
|
],
|
||||||
isSafelite: false,
|
isSafelite: false,
|
||||||
bailoutFlags: {
|
bailoutFlags: {
|
||||||
isTpaNotEnabledBailout: true
|
isTpaNotEnabledBailout: true
|
||||||
|
|
@ -44,9 +51,9 @@ const essentialTpaNotEnabledData: Partial<ITestData> = {
|
||||||
year: '2015',
|
year: '2015',
|
||||||
make: 'Ford',
|
make: 'Ford',
|
||||||
model: 'F Series F150',
|
model: 'F Series F150',
|
||||||
style: '2 door super cab',
|
style: '4 door crew cab',
|
||||||
vin: '1FTEX1C82FFB42543',
|
vin: '1FTEX1C82FFB42543',
|
||||||
licensePlateNumber: '15377DV',
|
licensePlateNumber: 'FZL3949',
|
||||||
licensePlateState: 'Texas',
|
licensePlateState: 'Texas',
|
||||||
vehicleLookupType: VehicleLookupType.LicensePlateNumber,
|
vehicleLookupType: VehicleLookupType.LicensePlateNumber,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ const essentialTpaEnabledData: Partial<ITestData> = {
|
||||||
// phoneNumber: faker.phone.toString(),
|
// phoneNumber: faker.phone.toString(),
|
||||||
notes: 'Automated Test',
|
notes: 'Automated Test',
|
||||||
address: {
|
address: {
|
||||||
street: '1st St',
|
street: '1st St S, Jacksonville Beach, FL, 32250',
|
||||||
city: 'Jacksonville Beach',
|
city: 'Jacksonville Beach',
|
||||||
state: 'FLORIDA',
|
state: 'FLORIDA',
|
||||||
postalCode: '32250',
|
postalCode: '32250',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue