Skip to content

Commit 91dbd7f

Browse files
committed
Harden openExtractByName against toast-overlay clicks
The extract list page sometimes shows a stack of notification toasts ("Extract created successfully!", "Extract Complete", etc.) that hover over the just-created extract card and intercept the click. Playwright reports 'intercepts pointer events' / 'element is not stable' and times out. Helper now (a) clicks the close button on every visible role=alert toast before attempting the click, and (b) uses { force: true } as a belt-and-braces fallback against any remaining transient overlay. The card itself is stable; only the toast layer was flaky.
1 parent e5ea5d4 commit 91dbd7f

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

frontend/tests/e2e/helpers.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -565,12 +565,29 @@ export async function openExtractByName(
565565

566566
// Each extract renders as a CollectionCard (role="article") with
567567
// aria-label="Extract: <name>". Click it to navigate to the detail view.
568-
await page
568+
//
569+
// Toast notifications from earlier steps ("Extract Complete", etc.)
570+
// can hover over the card and intercept the click. We close any
571+
// visible close-buttons on toast alerts first, then use force-click
572+
// as a belt-and-braces fallback against any remaining transient
573+
// overlay. The card itself is stable; the surrounding toast layer is
574+
// the only flake source.
575+
for (const closeBtn of await page
576+
.locator('[role="alert"] button[aria-label="close"]')
577+
.all()) {
578+
if (await closeBtn.isVisible().catch(() => false)) {
579+
await closeBtn.click().catch(() => {});
580+
}
581+
}
582+
await page.waitForTimeout(300);
583+
584+
const card = page
569585
.locator('[role="article"]', {
570586
hasText: new RegExp(extractName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")),
571587
})
572-
.first()
573-
.click();
588+
.first();
589+
await expect(card).toBeVisible({ timeout: 15_000 });
590+
await card.click({ force: true });
574591

575592
// The detail page loads tabs; Schema tab proves we are on the right page.
576593
await expect(page.getByRole("tab", { name: /^Schema$/i })).toBeVisible({

0 commit comments

Comments
 (0)