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:
@@ -62,12 +62,14 @@ test.describe('alerting UI smoke', () => {
|
||||
const main = page.locator('main');
|
||||
await expect(main.getByRole('link', { name: ruleName })).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
// Cleanup: delete.
|
||||
page.once('dialog', (d) => d.accept());
|
||||
// Cleanup: open ConfirmDialog via row Delete button, confirm in dialog.
|
||||
await page
|
||||
.getByRole('row', { name: new RegExp(ruleName) })
|
||||
.getByRole('button', { name: /^delete$/i })
|
||||
.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);
|
||||
});
|
||||
|
||||
@@ -97,11 +99,13 @@ test.describe('alerting UI smoke', () => {
|
||||
|
||||
await expect(page.getByText(unique).first()).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
page.once('dialog', (d) => d.accept());
|
||||
await page
|
||||
.getByRole('row', { name: new RegExp(unique) })
|
||||
.getByRole('button', { name: /^end$/i })
|
||||
.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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user