test(e2e): wait for audit dialogs to close
This commit is contained in:
1 file changed
+6
-6
@@ -239,8 +239,8 @@ module.exports = async ({ page, go, shot, fail }) => {
|
||||
assert.match(await dialog.innerText(), /Revert this change\?/);
|
||||
assert.match(await dialog.innerText(), /previous version opens for review/i);
|
||||
await dialog.getByRole('button', { name: 'Cancel', exact: true }).click();
|
||||
await page.waitForTimeout(300);
|
||||
assert.equal(await page.getByRole('alertdialog').count(), 0, 'Cancel left the revert dialog open');
|
||||
await dialog.waitFor({ state: 'hidden', timeout: 5000 }).catch(() => {});
|
||||
assert.ok(!(await dialog.isVisible().catch(() => false)), 'Cancel left the revert dialog open');
|
||||
assert.equal(
|
||||
await page.getByRole('region', { name: 'Unsaved changes' }).count(),
|
||||
0,
|
||||
@@ -393,8 +393,8 @@ module.exports = async ({ page, go, shot, fail }) => {
|
||||
'retention dialog did not read the stored resource',
|
||||
);
|
||||
await retentionDialog.getByRole('button', { name: 'Cancel', exact: true }).click();
|
||||
await page.waitForTimeout(300);
|
||||
assert.equal(await page.getByRole('dialog').count(), 0, 'Cancel left the retention dialog open');
|
||||
await retentionDialog.waitFor({ state: 'hidden', timeout: 5000 }).catch(() => {});
|
||||
assert.ok(!(await retentionDialog.isVisible().catch(() => false)), 'Cancel left the retention dialog open');
|
||||
|
||||
// ---- live tail -----------------------------------------------------------
|
||||
await go('/settings/audit');
|
||||
@@ -488,8 +488,8 @@ module.exports = async ({ page, go, shot, fail }) => {
|
||||
const wanted = beforeHours === 2160 ? 2161 : 2160;
|
||||
await hoursField.fill(String(wanted));
|
||||
await retentionDialog.getByRole('button', { name: 'Save', exact: true }).click();
|
||||
await page.waitForTimeout(1500);
|
||||
const stillOpen = (await page.getByRole('dialog').count()) > 0;
|
||||
await retentionDialog.waitFor({ state: 'hidden', timeout: 5000 }).catch(() => {});
|
||||
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 afterHours = retentionHours(afterSave.resource.value.runtime_event_retention);
|
||||
if (stillOpen || afterHours !== wanted) {
|
||||
|
||||
Reference in new issue
Block a user