From ba1633f81cbe7ee5aaf14730d48bac0071758aba Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Tue, 16 May 2023 13:39:19 -0600 Subject: [PATCH] Fix flaky filtering test (#20605) * fix failing test * more specific --- ui/tests/acceptance/secrets/backend/engines-test.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ui/tests/acceptance/secrets/backend/engines-test.js b/ui/tests/acceptance/secrets/backend/engines-test.js index 617799259fb7..db2ab3cad3f2 100644 --- a/ui/tests/acceptance/secrets/backend/engines-test.js +++ b/ui/tests/acceptance/secrets/backend/engines-test.js @@ -80,7 +80,7 @@ module('Acceptance | secret-engine list view', function (hooks) { }); test('it filters by name and engine type', async function (assert) { - assert.expect(3); + assert.expect(4); const enginePath1 = `aws-1-${this.uid}`; const enginePath2 = `aws-2-${this.uid}`; @@ -98,10 +98,11 @@ module('Acceptance | secret-engine list view', function (hooks) { assert.strictEqual(rows.length, rowsAws.length, 'all rows returned are aws'); // filter by name await clickTrigger('#filter-by-engine-name'); - await searchSelect.options.objectAt(1).click(); + const firstItemToSelect = searchSelect.options.objectAt(0).text; + await searchSelect.options.objectAt(0).click(); const singleRow = document.querySelectorAll('[data-test-auth-backend-link]'); - - assert.dom(singleRow[0]).includesText('aws-2', 'shows the filtered by name engine'); + assert.strictEqual(singleRow.length, 1, 'returns only one row'); + assert.dom(singleRow[0]).includesText(firstItemToSelect, 'shows the filtered by name engine'); // clear filter by engine name await searchSelect.deleteButtons.objectAt(1).click(); const rowsAgain = document.querySelectorAll('[data-test-auth-backend-link]');