test(alerts/e2e): adapt smoke suite to DS ConfirmDialog

The Rules list Delete and Silences End-early flows now use DS
ConfirmDialog instead of native confirm(). Update selectors to
target the dialog's role=dialog + confirm button instead of
listening for the native `dialog` event.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-21 10:19:14 +02:00
parent e861e0199c
commit 35f17a7eeb

View File

@@ -62,12 +62,14 @@ test.describe('alerting UI smoke', () => {
const main = page.locator('main'); const main = page.locator('main');
await expect(main.getByRole('link', { name: ruleName })).toBeVisible({ timeout: 10_000 }); await expect(main.getByRole('link', { name: ruleName })).toBeVisible({ timeout: 10_000 });
// Cleanup: delete. // Cleanup: open ConfirmDialog via row Delete button, confirm in dialog.
page.once('dialog', (d) => d.accept());
await page await page
.getByRole('row', { name: new RegExp(ruleName) }) .getByRole('row', { name: new RegExp(ruleName) })
.getByRole('button', { name: /^delete$/i }) .getByRole('button', { name: /^delete$/i })
.click(); .click();
const confirmDelete = page.getByRole('dialog');
await expect(confirmDelete.getByText(/delete alert rule/i)).toBeVisible();
await confirmDelete.getByRole('button', { name: /^delete$/i }).click();
await expect(main.getByRole('link', { name: ruleName })).toHaveCount(0); await expect(main.getByRole('link', { name: ruleName })).toHaveCount(0);
}); });
@@ -97,11 +99,13 @@ test.describe('alerting UI smoke', () => {
await expect(page.getByText(unique).first()).toBeVisible({ timeout: 10_000 }); await expect(page.getByText(unique).first()).toBeVisible({ timeout: 10_000 });
page.once('dialog', (d) => d.accept());
await page await page
.getByRole('row', { name: new RegExp(unique) }) .getByRole('row', { name: new RegExp(unique) })
.getByRole('button', { name: /^end$/i }) .getByRole('button', { name: /^end$/i })
.click(); .click();
const confirmEnd = page.getByRole('dialog');
await expect(confirmEnd.getByText(/end silence/i)).toBeVisible();
await confirmEnd.getByRole('button', { name: /end silence/i }).click();
await expect(page.getByText(unique)).toHaveCount(0); await expect(page.getByText(unique)).toHaveCount(0);
}); });
}); });