test(e2e): wait for audit dialogs to close

This commit is contained in:
sam committed 2026-10-25 23:04:56 +11:00
1 parent b0c3021773
commit 507bfb9c0f
1 file changed
+6 -6
+6 -6
View File
@@ -239,8 +239,8 @@ module.exports = async ({ page, go, shot, fail }) => {
assert.match(await dialog.innerText(), /Revert this change\?/); assert.match(await dialog.innerText(), /Revert this change\?/);
assert.match(await dialog.innerText(), /previous version opens for review/i); assert.match(await dialog.innerText(), /previous version opens for review/i);
await dialog.getByRole('button', { name: 'Cancel', exact: true }).click(); await dialog.getByRole('button', { name: 'Cancel', exact: true }).click();
await page.waitForTimeout(300); await dialog.waitFor({ state: 'hidden', timeout: 5000 }).catch(() => {});
assert.equal(await page.getByRole('alertdialog').count(), 0, 'Cancel left the revert dialog open'); assert.ok(!(await dialog.isVisible().catch(() => false)), 'Cancel left the revert dialog open');
assert.equal( assert.equal(
await page.getByRole('region', { name: 'Unsaved changes' }).count(), await page.getByRole('region', { name: 'Unsaved changes' }).count(),
0, 0,
@@ -393,8 +393,8 @@ module.exports = async ({ page, go, shot, fail }) => {
'retention dialog did not read the stored resource', 'retention dialog did not read the stored resource',
); );
await retentionDialog.getByRole('button', { name: 'Cancel', exact: true }).click(); await retentionDialog.getByRole('button', { name: 'Cancel', exact: true }).click();
await page.waitForTimeout(300); await retentionDialog.waitFor({ state: 'hidden', timeout: 5000 }).catch(() => {});
assert.equal(await page.getByRole('dialog').count(), 0, 'Cancel left the retention dialog open'); assert.ok(!(await retentionDialog.isVisible().catch(() => false)), 'Cancel left the retention dialog open');
// ---- live tail ----------------------------------------------------------- // ---- live tail -----------------------------------------------------------
await go('/settings/audit'); await go('/settings/audit');
@@ -488,8 +488,8 @@ module.exports = async ({ page, go, shot, fail }) => {
const wanted = beforeHours === 2160 ? 2161 : 2160; const wanted = beforeHours === 2160 ? 2161 : 2160;
await hoursField.fill(String(wanted)); await hoursField.fill(String(wanted));
await retentionDialog.getByRole('button', { name: 'Save', exact: true }).click(); await retentionDialog.getByRole('button', { name: 'Save', exact: true }).click();
await page.waitForTimeout(1500); await retentionDialog.waitFor({ state: 'hidden', timeout: 5000 }).catch(() => {});
const stillOpen = (await page.getByRole('dialog').count()) > 0; const stillOpen = await retentionDialog.isVisible().catch(() => false);
const afterSave = await (await page.request.get(`${new URL(page.url()).origin}/api/control-plane/resources/audit-retention`)).json(); const afterSave = await (await page.request.get(`${new URL(page.url()).origin}/api/control-plane/resources/audit-retention`)).json();
const afterHours = retentionHours(afterSave.resource.value.runtime_event_retention); const afterHours = retentionHours(afterSave.resource.value.runtime_event_retention);
if (stillOpen || afterHours !== wanted) { if (stillOpen || afterHours !== wanted) {