From 3e9aa3ee8011cc48c8637cb25304c180029a43d4 Mon Sep 17 00:00:00 2001 From: Uday Boppa Date: Tue, 28 Jul 2026 15:00:00 -0400 Subject: [PATCH] 10175 validations and fixes --- .../business-logic/data/ClientData.ts | 2 ++ .../business-logic/types/Client.ts | 1 + playwright-tests/pages/WelcomePage.ts | 35 +++++++++++++++++++ playwright-tests/tests/0000__M.test.ts | 27 +++++++------- .../tests/0005_EssentialReplaceDynamicAdas.ts | 2 +- ...17_EssentialTpaNotEnabledBailoutReplace.ts | 13 +++++-- .../0019_EssentialTpaEnabledReplaceAdas.ts | 2 +- 7 files changed, 64 insertions(+), 18 deletions(-) diff --git a/playwright-tests/business-logic/data/ClientData.ts b/playwright-tests/business-logic/data/ClientData.ts index e6bf31ab..1d25e824 100644 --- a/playwright-tests/business-logic/data/ClientData.ts +++ b/playwright-tests/business-logic/data/ClientData.ts @@ -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: { diff --git a/playwright-tests/business-logic/types/Client.ts b/playwright-tests/business-logic/types/Client.ts index 0b2d456c..1acc291b 100644 --- a/playwright-tests/business-logic/types/Client.ts +++ b/playwright-tests/business-logic/types/Client.ts @@ -4,6 +4,7 @@ export interface IClient { clientTag: string, accountName: string, accountNumber?: string, + parentCarrierName?: string, clientFlags: Partial, bgColor?: string, mockProfile?: IClientMockProfile diff --git a/playwright-tests/pages/WelcomePage.ts b/playwright-tests/pages/WelcomePage.ts index 42c8644e..8e09a012 100644 --- a/playwright-tests/pages/WelcomePage.ts +++ b/playwright-tests/pages/WelcomePage.ts @@ -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); diff --git a/playwright-tests/tests/0000__M.test.ts b/playwright-tests/tests/0000__M.test.ts index 8cc755c6..1808f6b0 100644 --- a/playwright-tests/tests/0000__M.test.ts +++ b/playwright-tests/tests/0000__M.test.ts @@ -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); diff --git a/playwright-tests/tests/0005_EssentialReplaceDynamicAdas.ts b/playwright-tests/tests/0005_EssentialReplaceDynamicAdas.ts index 468328c5..f54b6cf2 100644 --- a/playwright-tests/tests/0005_EssentialReplaceDynamicAdas.ts +++ b/playwright-tests/tests/0005_EssentialReplaceDynamicAdas.ts @@ -23,7 +23,7 @@ const essentialReplaceDynamicAdasData: Partial = { 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', diff --git a/playwright-tests/tests/0017_EssentialTpaNotEnabledBailoutReplace.ts b/playwright-tests/tests/0017_EssentialTpaNotEnabledBailoutReplace.ts index 0009d72f..b0bb7d28 100644 --- a/playwright-tests/tests/0017_EssentialTpaNotEnabledBailoutReplace.ts +++ b/playwright-tests/tests/0017_EssentialTpaNotEnabledBailoutReplace.ts @@ -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 = { 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 = { 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, }, diff --git a/playwright-tests/tests/0019_EssentialTpaEnabledReplaceAdas.ts b/playwright-tests/tests/0019_EssentialTpaEnabledReplaceAdas.ts index 81a6b06c..fa305acd 100644 --- a/playwright-tests/tests/0019_EssentialTpaEnabledReplaceAdas.ts +++ b/playwright-tests/tests/0019_EssentialTpaEnabledReplaceAdas.ts @@ -30,7 +30,7 @@ const essentialTpaEnabledData: Partial = { // 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',