diff --git a/static/app/views/dashboards/widgetBuilder/buildSteps/filterResultsStep/eventsSearchBar.spec.tsx b/static/app/views/dashboards/widgetBuilder/buildSteps/filterResultsStep/eventsSearchBar.spec.tsx index 737c9bfc028625..6c4ba3f6219bfc 100644 --- a/static/app/views/dashboards/widgetBuilder/buildSteps/filterResultsStep/eventsSearchBar.spec.tsx +++ b/static/app/views/dashboards/widgetBuilder/buildSteps/filterResultsStep/eventsSearchBar.spec.tsx @@ -1,10 +1,17 @@ import {OrganizationFixture} from 'sentry-fixture/organization'; import {PageFiltersFixture} from 'sentry-fixture/pageFilters'; -import {render, screen, userEvent, within} from 'sentry-test/reactTestingLibrary'; +import { + render, + screen, + userEvent, + waitFor, + within, +} from 'sentry-test/reactTestingLibrary'; import type {Organization} from 'sentry/types/organization'; import {DiscoverDatasets} from 'sentry/utils/discover/types'; +import {FieldKind} from 'sentry/utils/fields'; import {useCustomMeasurements} from 'sentry/utils/useCustomMeasurements'; import {EventsSearchBar} from './eventsSearchBar'; @@ -25,6 +32,13 @@ describe('EventsSearchBar', () => { body: [], method: 'POST', }); + MockApiClient.addMockResponse({ + url: '/organizations/org-slug/tags/', + body: [ + {key: 'environment', name: 'environment', kind: FieldKind.FIELD}, + {key: 'transaction', name: 'transaction', kind: FieldKind.FIELD}, + ], + }); }); it.isKnownFlake('does not show function tags in has: dropdown', async () => { @@ -64,6 +78,10 @@ describe('EventsSearchBar', () => { // p50 is a function and should not be suggested as a has: tag. expect(screen.queryByRole('option', {name: 'p50'})).not.toBeInTheDocument(); + + await waitFor(() => { + expect(screen.getByRole('combobox')).toBeInTheDocument(); + }); }); it('shows the selected aggregate in the dropdown', async () => { @@ -97,6 +115,10 @@ describe('EventsSearchBar', () => { expect( await within(await screen.findByRole('listbox')).findByText('count_unique(...)') ).toBeInTheDocument(); + + await waitFor(() => { + expect(screen.getByRole('combobox')).toBeInTheDocument(); + }); }); it('shows normal tags, e.g. transaction, in the dropdown', async () => { @@ -133,5 +155,9 @@ describe('EventsSearchBar', () => { name: 'transaction', }) ).toBeInTheDocument(); + + await waitFor(() => { + expect(screen.getByRole('combobox')).toBeInTheDocument(); + }); }); });