Fix flakiness (#5454)

pull/5456/head
Hariom Balhara 2022-11-10 13:15:10 +05:30 committed by GitHub
parent c3a427346d
commit 8416b76bf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -35,16 +35,16 @@ test.describe("Wipe my Cal App Test", () => {
await bookings.create(pro.id, pro.username, eventType.id, {}); await bookings.create(pro.id, pro.username, eventType.id, {});
await pro.login(); await pro.login();
await page.goto("/bookings/upcoming"); await page.goto("/bookings/upcoming");
await expect(page.locator("data-testid=wipe-today-button")).toBeVisible(); await expect(page.locator("data-testid=wipe-today-button")).toBeVisible();
const $openBookingCount = await page.locator('[data-testid="bookings"] > *').count(); const $openBookingCount = await page.locator('[data-testid="bookings"] > *').count();
await expect($openBookingCount).toBe(3); expect($openBookingCount).toBe(3);
await page.locator("data-testid=wipe-today-button").click(); await page.locator("data-testid=wipe-today-button").click();
await page.locator("data-testid=send_request").click();
const $openBookings = await page.locator('[data-testid="bookings"]'); // Don't await send_request click, otherwise mutation can possibly occur before observer is attached
page.locator("data-testid=send_request").click();
const $openBookings = page.locator('[data-testid="bookings"]');
await $openBookings.evaluate((ul) => { await $openBookings.evaluate((ul) => {
return new Promise<void>((resolve) => return new Promise<void>((resolve) =>
new window.MutationObserver(() => { new window.MutationObserver(() => {