Skip to content

Agent Mesh

tests(ui): wait for the token panel before filling the search box

Antonio Ojeaf4bce8595f63
diff --git a/tests/ui/console.spec.js b/tests/ui/console.spec.js
index 0d44af25..41bd14a5 100644
--- a/tests/ui/console.spec.js
+++ b/tests/ui/console.spec.js
@@ -148,8 +148,12 @@ test('the search box filters rendered rows', async ({ page }) => {
await login(page);
await page.click('.nav-item[data-target="bootstrap"]');
- // Guarantee at least one row to filter, independent of test ordering.
+ // Guarantee at least one row to filter, independent of test ordering. Wait
+ // for the result panel before typing anywhere else: showing it moves focus
+ // to the token field, and a fill() that races that focus change inserts
+ // its text there instead of into the search box.
await page.click('#form-generate-token button[type="submit"]');
+ await expect(page.locator('#token-result')).toBeVisible();
await expect(page.locator('#table-bootstrap')).toContainText('root-admin');
await page.fill('#resource-search', 'root-admin');