Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 () => {
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -133,5 +155,9 @@ describe('EventsSearchBar', () => {
name: 'transaction',
})
).toBeInTheDocument();

await waitFor(() => {
expect(screen.getByRole('combobox')).toBeInTheDocument();
});
});
});
Loading