UI: fix flaky openAPI explorer filter test (#26871)

* weird attempt to fix flaky test

* remove for loop
This commit is contained in:
Chelsea Shaw 2024-05-08 06:47:48 -05:00 committed by GitHub
parent d66461ef07
commit 2d5ac4b30a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'vault/tests/helpers';
import { waitUntil, find } from '@ember/test-helpers';
import { waitFor } from '@ember/test-helpers';
import { setupEngine } from 'ember-engines/test-support';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { render, fillIn } from '@ember/test-helpers';
@ -13,7 +13,7 @@ import { hbs } from 'ember-cli-htmlbars';
const SELECTORS = {
container: '[data-test-swagger-ui]',
searchInput: '.operation-filter-input',
searchInput: 'input.operation-filter-input',
apiPathBlock: '.opblock-post',
};
@ -38,19 +38,20 @@ module('Integration | Component | open-api-explorer | swagger-ui', function (hoo
};
});
test('it renders', async function (assert) {
test(`it renders`, async function (assert) {
await this.renderComponent();
await waitUntil(() => find(SELECTORS.container));
await waitFor(SELECTORS.container);
assert.dom(SELECTORS.container).exists('renders component');
assert.dom(SELECTORS.apiPathBlock).exists({ count: this.totalApiPaths }, 'renders all api paths');
});
test('it can search', async function (assert) {
test(`it can search`, async function (assert) {
await this.renderComponent();
await waitUntil(() => find(SELECTORS.searchInput));
// in testing only the input is not filling correctly except after the second time
await fillIn(SELECTORS.searchInput, 'moot');
await fillIn(SELECTORS.searchInput, 'token');
// for some reason search results are not rendered immediately in tests,