fix: add waitFor calls to prevent flaky time slot selection tests (#26592)
* fix: add waitFor calls to prevent flaky time slot selection tests Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * refactor: use locator variables to avoid repeating selectors Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin AI
parent
84d1ce5bff
commit
53833f15ea
@@ -106,22 +106,35 @@ export function createHttpServer(opts: { requestHandler?: RequestHandler } = {})
|
||||
}
|
||||
|
||||
export async function selectFirstAvailableTimeSlotNextMonth(page: Page | Frame) {
|
||||
// Let current month dates fully render.
|
||||
await page.getByTestId("incrementMonth").click();
|
||||
// Wait for the booker to be ready before interacting
|
||||
const incrementMonth = page.getByTestId("incrementMonth");
|
||||
await incrementMonth.waitFor();
|
||||
await incrementMonth.click();
|
||||
|
||||
// Waiting for full month increment
|
||||
await page.locator('[data-testid="day"][data-disabled="false"]').nth(0).click();
|
||||
// Wait for available day to appear after month increment
|
||||
const firstAvailableDay = page.locator('[data-testid="day"][data-disabled="false"]').nth(0);
|
||||
await firstAvailableDay.waitFor();
|
||||
await firstAvailableDay.click();
|
||||
|
||||
await page.locator('[data-testid="time"]').nth(0).click();
|
||||
const firstTimeSlot = page.locator('[data-testid="time"]').nth(0);
|
||||
await firstTimeSlot.waitFor();
|
||||
await firstTimeSlot.click();
|
||||
}
|
||||
|
||||
export async function selectSecondAvailableTimeSlotNextMonth(page: Page) {
|
||||
// Let current month dates fully render.
|
||||
await page.getByTestId("incrementMonth").click();
|
||||
// Wait for the booker to be ready before interacting
|
||||
const incrementMonth = page.getByTestId("incrementMonth");
|
||||
await incrementMonth.waitFor();
|
||||
await incrementMonth.click();
|
||||
|
||||
await page.locator('[data-testid="day"][data-disabled="false"]').nth(1).click();
|
||||
// Wait for available day to appear after month increment
|
||||
const secondAvailableDay = page.locator('[data-testid="day"][data-disabled="false"]').nth(1);
|
||||
await secondAvailableDay.waitFor();
|
||||
await secondAvailableDay.click();
|
||||
|
||||
await page.locator('[data-testid="time"]').nth(0).click();
|
||||
const firstTimeSlot = page.locator('[data-testid="time"]').nth(0);
|
||||
await firstTimeSlot.waitFor();
|
||||
await firstTimeSlot.click();
|
||||
}
|
||||
|
||||
export async function bookEventOnThisPage(page: Page) {
|
||||
|
||||
Reference in New Issue
Block a user