diff --git a/playwright-tests/business-logic/types/ITestData.ts b/playwright-tests/business-logic/types/ITestData.ts index d3a19d34..79598973 100644 --- a/playwright-tests/business-logic/types/ITestData.ts +++ b/playwright-tests/business-logic/types/ITestData.ts @@ -39,6 +39,7 @@ export interface ITestData { isRecalNotification: boolean, isRecalWarning: boolean, isRecalVehicle: boolean, + isCanSafeliteRecalibrate: boolean, // Can Safelite recalibrate the vehicle? If no, modal displays after clicking time slot and continue isSeparateApptsWarning: boolean, // IF true, check for the separate appts warning on VehicleDamagePage isAuthenticationRequired: boolean, isMoldingQuestion: boolean, diff --git a/playwright-tests/pages/SchedulePage.ts b/playwright-tests/pages/SchedulePage.ts index ede5668b..921cddb9 100644 --- a/playwright-tests/pages/SchedulePage.ts +++ b/playwright-tests/pages/SchedulePage.ts @@ -25,6 +25,11 @@ export class SchedulePage extends BasePage { readonly dateText: Locator; readonly viewMoreDatesLink: Locator; + readonly recalAcknowledgementModal: Locator; + readonly learnMoreLinkRecalAcknowledgementModal: Locator; + readonly recalAcknowledgementCheckBox: Locator; + readonly continueButtonRecalAcknowledgementModal: Locator; + readonly continueButton: Locator; constructor(page: Page) { @@ -50,6 +55,12 @@ export class SchedulePage extends BasePage { this.dateText = this.page.locator('[class="modal-header mb-2 mt-2"]'); this.viewMoreDatesLink = this.page.getByRole('button', { name: 'More Right arrow icon' }); + // Recal acknowledgement modal when Safelite cannot recalibrate the vehicle + this.recalAcknowledgementModal = this.page.getByLabel('ModalComponentLabel'); + this.learnMoreLinkRecalAcknowledgementModal = this.page.getByRole('link', { name: 'Learn more' }); + this.recalAcknowledgementCheckBox = this.page.getByRole('checkbox', { name: /I acknowledge/i }); + this.continueButtonRecalAcknowledgementModal = this.page.locator('#RecalAckModalWidget').getByRole('button', { name: 'Continue' }); + this.continueButton = this.page.locator('#stacked').locator('button:has-text("Continue")'); } @@ -111,4 +122,10 @@ export class SchedulePage extends BasePage { const nonDropOff = timeSlots.filter({ hasNotText: /Drop & Go/i }); return nonDropOff.first(); } + + async validateRecalAcknowledgementModal() { + await this.learnMoreLinkRecalAcknowledgementModal.click(); + await this.recalAcknowledgementCheckBox.click(); + await this.continueButtonRecalAcknowledgementModal.click(); + } } \ No newline at end of file diff --git a/playwright-tests/tests/0000__M.test.ts b/playwright-tests/tests/0000__M.test.ts index 8d949baf..1d3dca5a 100644 --- a/playwright-tests/tests/0000__M.test.ts +++ b/playwright-tests/tests/0000__M.test.ts @@ -379,7 +379,7 @@ async function runWorkflow(page: Page, testCase: TestCase) { isRecalWarning, servicePackage, hasOemEndorsement, hasStateLawPopup, otherVehiclesOnPolicy, isUseVehicleFromAddressLookup, isSeparateApptsWarning, vehiclePartQuestions, editVehicleDetails, isAddressLookupValidations, hasMilitaryWarning, capabilityQuestions, isUseVehicleOnPolicy, - isVehicleLookupValidations, isMoldingQuestion, isNonServiceable, isNonServiceableVin, isRecalVehicle } = testCase.testData; + isVehicleLookupValidations, isMoldingQuestion, isNonServiceable, isNonServiceableVin, isRecalVehicle, isCanSafeliteRecalibrate } = testCase.testData; let { isPolicyFound } = testCase.testData; // Allow isPolicyFound to be re-assigned @@ -732,7 +732,7 @@ async function runWorkflow(page: Page, testCase: TestCase) { await expect(async () => { await providerPreferencePage.stateLawModalOkayButton.waitFor({ state: 'visible' }); await providerPreferencePage.stateLawModalOkayButton.click(); - }).toPass({ timeout: 30000 }); + }).toPass({ timeout: 60_000 }); }); } @@ -829,13 +829,15 @@ async function runWorkflow(page: Page, testCase: TestCase) { await test.step('SchedulePage >> Select day and time', async () => { await schedulePage.validateURL(schedulePage.issPageValue); - if (appointmentDetails?.serviceLocation === ServiceLocation.Mobile) { - await schedulePage.scheduleMobile(appointmentDetails); + if (isCanSafeliteRecalibrate === false) { + await schedulePage.validateRecalAcknowledgementModal(); + await schedulePage.scheduleInShop(appointmentDetails!); + } else if (appointmentDetails?.serviceLocation === ServiceLocation.InShop || appointmentDetails?.serviceLocation === ServiceLocation.DropOff) { + await schedulePage.scheduleInShop(appointmentDetails!); + } else { + await schedulePage.scheduleMobile(appointmentDetails!); } - if (appointmentDetails?.serviceLocation === ServiceLocation.InShop || appointmentDetails?.serviceLocation === ServiceLocation.DropOff) { - await schedulePage.scheduleInShop(appointmentDetails); - } });