Skip to content

Commit 4495f66

Browse files
fix(test): Correct SpansSearchBar spec interaction sequence
Split click/enter/row-wait/keyboard sent keys without the filter value focused; onSearch saw span.op with empty quoted value and trailing free text. Use the same type + keyboard({delay:null}) flow as master so the value applies in one session. Made-with: Cursor
1 parent 58ff99b commit 4495f66

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

static/app/views/dashboards/widgetBuilder/buildSteps/filterResultsStep/spansSearchBar.spec.tsx

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,9 @@ describe('SpansSearchBar', () => {
134134
const searchInput = await screen.findByRole('combobox', {
135135
name: 'Add a search term',
136136
});
137-
await userEvent.click(searchInput);
138-
await userEvent.type(searchInput, 'span.op:');
139-
await userEvent.keyboard('{enter}');
140-
141-
// Wait for the filter token to be created before typing the value
142-
await screen.findByRole('row', {name: /span\.op/});
143-
144-
await userEvent.keyboard('function');
137+
// One user-event session for key + value; otherwise `function` can land as free text after the filter.
138+
await userEvent.type(searchInput, 'span.op:', {delay: null});
139+
await userEvent.keyboard('function', {delay: null});
145140
await userEvent.keyboard('{enter}');
146141

147142
await waitFor(() => {
@@ -164,14 +159,9 @@ describe('SpansSearchBar', () => {
164159
const searchInput = await screen.findByRole('combobox', {
165160
name: 'Add a search term',
166161
});
167-
await userEvent.click(searchInput);
168-
await userEvent.type(searchInput, 'span.op:');
162+
await userEvent.type(searchInput, 'span.op:', {delay: null});
163+
await userEvent.keyboard('function', {delay: null});
169164
await userEvent.keyboard('{enter}');
170-
await userEvent.keyboard('function');
171-
await userEvent.keyboard('{enter}');
172-
173-
// Wait for the filter token to be created before typing the value
174-
await screen.findByRole('row', {name: /span\.op/});
175165

176166
await waitFor(() => {
177167
expect(onClose).toHaveBeenCalled();

0 commit comments

Comments
 (0)