Commit 6e60f9fd authored by Paul Slaughter's avatar Paul Slaughter

Fix flaky spec in users_select/index_spec

- Looks like testing-library waitFor is a bit
  flaky :/
- Hoping `axios.waitForAll` and `waitForPromises`
  will be deterministic...
parent 3b316758
import { waitFor } from '@testing-library/dom';
import MockAdapter from 'axios-mock-adapter';
import { memoize, cloneDeep } from 'lodash';
import { getFixture, getJSONFixture } from 'helpers/fixtures';
import waitForPromises from 'helpers/wait_for_promises';
import axios from '~/lib/utils/axios_utils';
import UsersSelect from '~/users_select';
......@@ -103,8 +103,10 @@ export const setAssignees = (...users) => {
);
};
export const toggleDropdown = () => findUserSearchButton().click();
export const waitForDropdownItems = () =>
waitFor(() => expect(findDropdownItem(getUsersFixtureAt(0))).not.toBeNull());
export const waitForDropdownItems = async () => {
await axios.waitForAll();
await waitForPromises();
};
// assertion helpers ---------------------------------------------------------
export const createUnassignedExpectation = () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment