test: fix few e2e flakes (#21408)

* fix flakes

* update

* Update booking.e2e.ts

* update

* Update booking.e2e.ts

* Update booking.e2e.ts
This commit is contained in:
Anik Dhabal Babu
2025-05-23 12:40:27 +05:30
committed by GitHub
parent e21dbb704e
commit a839630ca3
3 changed files with 10 additions and 4 deletions
+5 -1
View File
@@ -461,10 +461,14 @@ test.describe("Bookings", () => {
await addFilter(page, "userId");
await openFilter(page, "userId");
const bookingsGetResponse2 = page.waitForResponse((response) =>
/\/api\/trpc\/bookings\/get.*/.test(response.url())
);
await page
.locator(`[data-testid="select-filter-options-userId"] [role="option"]:has-text("${anotherUser}")`)
.click();
await page.waitForResponse((response) => /\/api\/trpc\/bookings\/get.*/.test(response.url()));
await bookingsGetResponse2;
await expect(page.locator('[data-testid="booking-item"]')).toHaveCount(0);
});
+1 -1
View File
@@ -1044,7 +1044,7 @@ export async function login(
const signInLocator = loginLocator.locator('[type="submit"]');
//login
await page.goto("/");
await page.goto("/auth/login");
await page.waitForSelector("text=Welcome back");
await emailLocator.fill(user.email ?? `${user.username}@example.com`);
@@ -431,9 +431,11 @@ test.describe("Bookings", () => {
// Cancel the booking
await page.goto(`/booking/${bookingUid}`);
await page.waitForLoadState("networkidle");
await page.getByTestId("cancel").click();
await page.getByTestId("confirm_cancel").click();
await page.waitForResponse((response) => response.url().includes("/api/cancel"));
await submitAndWaitForResponse(page, "/api/cancel", {
action: () => page.locator('[data-testid="confirm_cancel"]').click(),
});
// Logout and go back to booking page
await page.goto("/auth/logout");