diff --git a/playwright-tests/pages/SchedulePage.ts b/playwright-tests/pages/SchedulePage.ts index e48a3a8a..60dd87d1 100644 --- a/playwright-tests/pages/SchedulePage.ts +++ b/playwright-tests/pages/SchedulePage.ts @@ -56,16 +56,19 @@ export class SchedulePage extends BasePage { // Select in shop and schedule async scheduleInShop(appointmentDetails?: IAppointmentDetails){ - if (await this.inShopButton.isVisible()) { + if (appointmentDetails?.serviceLocation === ServiceLocation.InShop) { await this.inShopButton.waitFor({ state: 'visible', timeout: 5000 }); + await this.inShopButton.isVisible() await this.inShopButton.click(); await (await this.getFirstNonDropOffTimeSlot()).click(); - } else if (await this.inShopButton.isHidden() && appointmentDetails?.serviceLocation === ServiceLocation.InShop) { + } else if (await this.inShopButton.isHidden()) { await (await this.getFirstNonDropOffTimeSlot()).click(); } else if (appointmentDetails?.serviceLocation === ServiceLocation.DropOff) { if (await this.inShopButton.isVisible()){ await this.inShopButton.waitFor({ state: 'visible', timeout: 5000 }); await this.inShopButton.click(); + await this.dropOffButton.waitFor({ state: 'visible', timeout: 5000 }); + await this.dropOffButton.click() } else { await this.dropOffButton.waitFor({ state: 'visible', timeout: 5000 }); await this.dropOffButton.isVisible() ? await this.dropOffButton.click() : await (await this.getFirstNonDropOffTimeSlot()).click(); // drop off is available in the morning for same day so this is here to avoid flaky tests