test(web): wait for filter popups to restore focus

This commit is contained in:
huanghuoguoguo
2026-10-17 15:58:12 +08:00
parent f7c4194b3d
commit 753e3cf070
+13 -2
View File
@@ -445,9 +445,20 @@ test('remembers all filters on reload and persists resetting them', async ({
for (const [id, label] of selections) {
await page.locator(`#monitoring-filter-${id}`).click();
if (id === 'processor') {
await page.getByRole('checkbox', { name: label, exact: true }).check();
const checkbox = page.getByRole('dialog').getByRole('checkbox', {
name: label,
exact: true,
});
await checkbox.check();
await expect(checkbox).toBeChecked();
await page.keyboard.press('Escape');
} else await page.getByRole('option', { name: label, exact: true }).click();
await expect(page.getByRole('dialog')).toHaveCount(0);
} else {
await page.getByRole('option', { name: label, exact: true }).click();
await expect(page.getByRole('listbox')).toHaveCount(0);
}
// The previous popup must finish restoring focus before opening another.
await expect(page.locator(`#monitoring-filter-${id}`)).toBeFocused();
}
await page.reload();
for (const [id, label] of selections) {