fix: stabilize flaky E2E booking sheet tests by waiting for button visibility (#28631)
Both booking-sheet-keyboard.e2e.ts and bookings-list.e2e.ts intermittently
timeout in CI when clicking the booking item button before the DOM has
finished rendering. Adding explicit waitFor({ state: 'visible' }) on the
role=button element after the parent booking item is visible ensures the
click target is fully ready.
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -100,7 +100,9 @@ async function setupBookingsAndOpenSheet({
|
||||
|
||||
const firstBookingItem = page.locator(`[data-booking-uid="${fixtures[0].uid}"]`);
|
||||
await expect(firstBookingItem).toBeVisible();
|
||||
await firstBookingItem.locator('[role="button"]').first().click();
|
||||
const firstButton = firstBookingItem.locator('[role="button"]').first();
|
||||
await firstButton.waitFor({ state: "visible" });
|
||||
await firstButton.click();
|
||||
|
||||
const sheet = page.locator('[role="dialog"]');
|
||||
await expect(sheet).toBeVisible();
|
||||
|
||||
@@ -798,8 +798,9 @@ test.describe("Bookings", () => {
|
||||
|
||||
const bookingItem = page.locator(`[data-booking-uid="${bookingFixture.uid}"]`);
|
||||
await expect(bookingItem).toBeVisible();
|
||||
|
||||
await bookingItem.locator('[role="button"]').first().click();
|
||||
const bookingButton = bookingItem.locator('[role="button"]').first();
|
||||
await bookingButton.waitFor({ state: "visible" });
|
||||
await bookingButton.click();
|
||||
|
||||
await expect(page).toHaveURL(new RegExp(`[?&]uid=${bookingFixture.uid}(&|$)`));
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user