diff --git a/playwright-tests/pages/SchedulePage.ts b/playwright-tests/pages/SchedulePage.ts index 1fe05bee..8c8f3f8c 100644 --- a/playwright-tests/pages/SchedulePage.ts +++ b/playwright-tests/pages/SchedulePage.ts @@ -69,10 +69,15 @@ export class SchedulePage extends BasePage { 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() + + if (await this.dropOffButton.isVisible()) { + await this.dropOffButton.waitFor({ state: 'visible', timeout: 5000 }); + await this.dropOffButton.click() } else { - 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 + await (await this.getFirstNonDropOffTimeSlot()).click(); + } + } else { + await (await this.getFirstNonDropOffTimeSlot()).click(); } } else { await this.selectFirstAvailableTime();