Updated locator and logic for unverified policy flow

This commit is contained in:
JennyNou 2025-06-09 15:26:20 -04:00
parent ca41375b3c
commit 514fdca340

View file

@ -9,7 +9,7 @@ export class CoverageStatementPage extends InsuranceBasePage {
readonly scheduleOnlineButton: Locator;
readonly cancelMyClaimButton: Locator;
readonly deductibleAmount: Locator;
readonly verfiyingCoverageText: Locator;
readonly verifyingCoverageText: Locator;
readonly continueButton: Locator; // For ITAC/NoComp
url = process.env['BASE_URL']! + '/FixMyGlass/CoverageStatement.aspx';
@ -19,7 +19,7 @@ export class CoverageStatementPage extends InsuranceBasePage {
this.scheduleOnlineButton = this.page.getByText('Continue to schedule online');
this.cancelMyClaimButton = this.page.getByText('Cancel my claim');
this.deductibleAmount = this.page.getByRole('heading', { name: '$' }).locator('span');
this.verfiyingCoverageText = this.page.getByRole('heading', { name: 'Were verifying your coverage' });
this.verifyingCoverageText = this.page.getByRole('heading', { name: 'We\'re verifying your coverage' });
this.continueButton = page.getByRole('button', { name: 'Continue' });
// this.validateURL(this.url);
}
@ -46,16 +46,20 @@ export class CoverageStatementPage extends InsuranceBasePage {
"span.deductible-text-black[data-bind='text: deductibleFormatted']"
);
const unverifiedDeductibleElement = this.verifyingCoverageText;
// Check if the locator is visible before running the expectation
if (await deductibleElement.isVisible()) {
// Check if the page contains the properly formatted deductible amount
await expect(deductibleElement).toContainText(`$${expectedDeductibleRegex}`);
}
}
async validateUnverifiedText(){
await expect(this.verfiyingCoverageText).toBeEnabled();
if (await unverifiedDeductibleElement.isVisible()) {
// Click on continue button if unverified header is visible
await this.continueButton.click();
}
}
@step("CoverageStatementPage >> Next page: ")
async handleCoverageStatementPage(testData: Partial<ITestData>) {