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 888-308-4948./ ); 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/); throw new TestSuccessAlert('Parts not found bailout validated successfully.'); } }