fix: flaky OOO tests without time dependency (#18412)
* fix flaky OOO tests without time dependency * chore
This commit is contained in:
1 parent
32ff7ffed1
commit
7584645b8c
2 files changed
+107
-38
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import type { Frame, Locator, Page, Request as PlaywrightRequest } from "@playwright/test";
|
||||
import type { Frame, Page, Request as PlaywrightRequest } from "@playwright/test";
|
||||
import { expect } from "@playwright/test";
|
||||
import { createHash } from "crypto";
|
||||
import EventEmitter from "events";
|
||||
@@ -538,20 +538,3 @@ export async function expectPageToBeNotFound({ page, url }: { page: Page; url: s
|
||||
await page.goto(`${url}`);
|
||||
await expect(page.getByTestId(`404-page`)).toBeVisible();
|
||||
}
|
||||
|
||||
export async function clickUntilDialogVisible(
|
||||
dialogOpenButton: Locator,
|
||||
visibleLocatorOnDialog: Locator,
|
||||
retries = 3,
|
||||
delay = 500
|
||||
) {
|
||||
for (let i = 0; i < retries; i++) {
|
||||
await dialogOpenButton.click();
|
||||
try {
|
||||
await visibleLocatorOnDialog.waitFor({ state: "visible", timeout: delay });
|
||||
return;
|
||||
} catch {
|
||||
if (i === retries - 1) throw new Error("Dialog did not appear after multiple attempts.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user