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,6 +1,12 @@
import {OrganizationFixture} from 'sentry-fixture/organization';

import {render, screen, userEvent, within} from 'sentry-test/reactTestingLibrary';
import {
render,
screen,
userEvent,
waitFor,
within,
} from 'sentry-test/reactTestingLibrary';

import {SavedSearchType} from 'sentry/types/group';
import type {Organization} from 'sentry/types/organization';
Expand Down Expand Up @@ -51,12 +57,17 @@ describe('ResultsSearchQueryBuilder', () => {

// Focus the input and type "has:p" to simulate a search for p50
const input = await screen.findByRole('combobox');
await userEvent.type(input, 'has:p');
await userEvent.click(input);
await screen.findByRole('listbox');
await userEvent.keyboard('has:p', {delay: null});

// Check that "p50" (a function tag) is NOT in the dropdown
expect(
within(await screen.findByRole('listbox')).queryByText('p50')
).not.toBeInTheDocument();
const listbox = await screen.findByRole('listbox');
expect(within(listbox).queryByText('p50')).not.toBeInTheDocument();

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

it.isKnownFlake('shows normal tags, e.g. transaction, in the dropdown', async () => {
Expand All @@ -81,14 +92,20 @@ describe('ResultsSearchQueryBuilder', () => {
}
);

// Check that a normal tag (e.g. "transaction") IS in the dropdown
// Focus the input and type "transact" to simulate a search for transaction
const input = await screen.findByRole('combobox');
await userEvent.type(input, 'transact');
await userEvent.click(input);
await screen.findByRole('listbox');
await userEvent.keyboard('transact', {delay: null});

// Check that a normal tag (e.g. "transaction") IS in the dropdown
const listbox = await screen.findByRole('listbox');
expect(
await within(screen.getByRole('listbox')).findByRole('option', {
name: 'transaction',
})
await within(listbox).findByRole('option', {name: 'transaction'})
).toBeInTheDocument();

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