Skip to content

Commit c38b821

Browse files
committed
fix(e2e): improve alert modal dismissal reliability
Made dismissAlertModal() more robust: - Wait for modal animation before attempting dismissal - Try multiple selectors (button class, aria-label, overlay) - Add proper timeout handling for each selector - Wait after dismissal to ensure modal closes This should fix the remaining E2E test failures where the modal was still blocking UI interactions.
1 parent 44cf7ad commit c38b821

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

e2e/baselines/import-export.spec.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,27 @@ const waitForDownload = async (page, action) => {
3131
// Helper to dismiss alert modal if present
3232
const dismissAlertModal = async (page) => {
3333
try {
34-
const closeButton = page.locator('button:has-text("Close")').first();
35-
if (await closeButton.isVisible({ timeout: 1000 })) {
36-
await closeButton.click();
37-
await page.waitForTimeout(200);
34+
// Wait a bit for modal animation
35+
await page.waitForTimeout(300);
36+
37+
// Try multiple selectors to find and dismiss the modal
38+
const selectors = [
39+
'button.alert-modal-close',
40+
'button[aria-label="Close alert"]',
41+
'.alert-modal-overlay' // Click overlay to dismiss
42+
];
43+
44+
for (const selector of selectors) {
45+
try {
46+
const element = page.locator(selector).first();
47+
if (await element.isVisible({ timeout: 500 })) {
48+
await element.click({ timeout: 1000 });
49+
await page.waitForTimeout(300);
50+
return;
51+
}
52+
} catch {
53+
continue;
54+
}
3855
}
3956
} catch (e) {
4057
// Modal not present or already dismissed

0 commit comments

Comments
 (0)