Skip to content

Commit 37d1070

Browse files
authored
Merge pull request #449 from aojea/ui-test-focus-race
tests(ui): wait for the token panel before filling the search box
2 parents 108d29e + f4bce85 commit 37d1070

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

tests/ui/console.spec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,12 @@ test('the search box filters rendered rows', async ({ page }) => {
148148
await login(page);
149149
await page.click('.nav-item[data-target="bootstrap"]');
150150

151-
// Guarantee at least one row to filter, independent of test ordering.
151+
// Guarantee at least one row to filter, independent of test ordering. Wait
152+
// for the result panel before typing anywhere else: showing it moves focus
153+
// to the token field, and a fill() that races that focus change inserts
154+
// its text there instead of into the search box.
152155
await page.click('#form-generate-token button[type="submit"]');
156+
await expect(page.locator('#token-result')).toBeVisible();
153157
await expect(page.locator('#table-bootstrap')).toContainText('root-admin');
154158

155159
await page.fill('#resource-search', 'root-admin');

0 commit comments

Comments
 (0)