diff --git a/playwright-tests/framework/TestPages.ts b/playwright-tests/framework/TestPages.ts index 7ec1b5da7..39c2832f9 100644 --- a/playwright-tests/framework/TestPages.ts +++ b/playwright-tests/framework/TestPages.ts @@ -34,9 +34,11 @@ import { PolicyDriverPage } from "../pages/PolicyDriverPage" import { ServiceZipPage } from "../pages/ServiceZipPage" import { MobileDetailsPage } from "pages/MobileDetailsPage"; import { BailoutPage } from '../pages/BailoutPage'; +import { BailoutSuccessPage } from '../pages/BailoutSuccessPage'; export interface ITestPages { bailoutPage: BailoutPage, + bailoutSuccessPage: BailoutSuccessPage, capabilityQuestionsPage: CapabilityQuestionsPage, ccPolicyInfoPage: CCPolicyInfoPage, contactDetailsPage: ContactDetailsPage, @@ -75,6 +77,7 @@ export interface ITestPages { export const createTestPages: TestPagesFactory = (page: Page) => { const pages: ITestPages = { bailoutPage: new BailoutPage(page), + bailoutSuccessPage: new BailoutSuccessPage(page), capabilityQuestionsPage: new CapabilityQuestionsPage(page), ccPolicyInfoPage: new CCPolicyInfoPage(page), contactDetailsPage: new ContactDetailsPage(page), diff --git a/playwright-tests/pages/BailoutSuccessPage.ts b/playwright-tests/pages/BailoutSuccessPage.ts new file mode 100644 index 000000000..6a82d9da6 --- /dev/null +++ b/playwright-tests/pages/BailoutSuccessPage.ts @@ -0,0 +1,34 @@ +import { type Locator, type Page, expect } from '@playwright/test'; +import { BasePage } from './BasePage'; +import { TestSuccessAlert } from 'safelite-playwright-core'; +import { step } from 'framework/localTypes/Step'; + +export class BailoutSuccessPage extends BasePage { + readonly thankYouHeading: Locator; + readonly bodyText: Locator; + readonly returnToHomepageButton: Locator; + + constructor(page: Page) { + super(page); + this.thankYouHeading = page.getByText("Thanks! We'll get back to you soon"); + this.bodyText = page.getByText(/We've got it from here!/); + this.returnToHomepageButton = page.locator('#btn-vehicle-not-listed'); + } + + async validateBailoutSuccessPage() { + await expect(this.page).toHaveURL(/bailout-success/); + await expect(this.thankYouHeading).toBeVisible(); + await expect(this.bodyText).toBeVisible(); + await expect(this.bodyText).toHaveText( + /We've got it from here! One of our experts will be in touch to schedule your appointment\. If you have any questions, please contact 1-888-238-4527/ + ); + await expect(this.returnToHomepageButton).toBeVisible(); + } + + @step("BailoutSuccessPage >> Validate bailout success page and return to vehicle page") + async handleBailoutSuccessPage() { + await this.validateBailoutSuccessPage(); + await this.returnToHomepageButton.click(); + await expect(this.page).toHaveURL(/vehicle/); + } +}