Skip to content

Commit

Permalink
More flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
lsolcher committed Jan 3, 2025
1 parent e55bad1 commit c669b62
Showing 1 changed file with 29 additions and 17 deletions.
46 changes: 29 additions & 17 deletions packages/dito/tests/e2e/methodPages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,35 @@ test.describe("five principles page", () => {
];

for (const [index, url] of links.entries()) {
await page.goto(ROUTE_METHODS_FIVE_PRINCIPLES.url);

await Promise.all([
page.waitForLoadState("domcontentloaded"),
page.waitForLoadState("networkidle"),
]);

const link = page
.getByRole("link", { name: "Beispiele betrachten" })
.nth(index);

await expect(link).toBeVisible();
const navigationPromise = page.waitForURL(url);
await link.click();
await navigationPromise;

await expect(page).toHaveURL(url);
let attempt = 0;

// retries to prevent flakiness for firefox
while (attempt < 3) {
try {
await page.goto(ROUTE_METHODS_FIVE_PRINCIPLES.url, {
waitUntil: "domcontentloaded",
});

const link = page
.getByRole("link", { name: "Beispiele betrachten" })
.nth(index);
await expect(link).toBeVisible({ timeout: 5000 });

const navigationPromise = page.waitForURL(url);
await link.click();
await navigationPromise;

await expect(page).toHaveURL(url);

break;
} catch (error) {
attempt++;
console.warn(`Retry ${attempt}: Error navigating to ${url}`);
if (attempt === 3) {
throw error;
}
}
}
}
});
});
Expand Down

0 comments on commit c669b62

Please sign in to comment.