Skip to content

Commit 273b256

Browse files
test(trace): Fix focus and highlight-clear assertions in persistence test
Click the search field before appending act so typing applies to the input. Wait for focus before pasting the no-match query. Restore container-scoped highlight count for the no-results case to match prior behavior. Fixes BROWSE-411. Made-with: Cursor
1 parent 202a045 commit 273b256

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

static/app/views/performance/newTraceDetails/trace.spec.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,7 @@ describe('trace view', () => {
16261626
it.isKnownFlake(
16271627
'highlighted is persisted on node while it is part of the search results',
16281628
async () => {
1629-
const {virtualizedContainer} = await searchTestSetup();
1629+
const {container, virtualizedContainer} = await searchTestSetup();
16301630
const searchInput = await screen.findByPlaceholderText('Search in trace');
16311631
await userEvent.type(searchInput, 'trans');
16321632
await waitFor(() => expect(searchInput).toHaveValue('trans'));
@@ -1653,6 +1653,7 @@ describe('trace view', () => {
16531653
).textContent!.trim();
16541654
});
16551655

1656+
await userEvent.click(searchInput);
16561657
await userEvent.type(searchInput, 'act');
16571658
await waitFor(() => expect(searchInput).toHaveValue('transact'));
16581659
await searchToResolve();
@@ -1668,15 +1669,14 @@ describe('trace view', () => {
16681669

16691670
await userEvent.clear(searchInput);
16701671
await userEvent.click(searchInput);
1672+
await waitFor(() => expect(searchInput).toHaveFocus());
16711673
await userEvent.paste('this wont match anything');
16721674
await waitFor(() => expect(searchInput).toHaveValue('this wont match anything'));
16731675
await searchToResolve();
16741676

16751677
// When there is no match, the highlighting is removed
16761678
await waitFor(() => {
1677-
expect(
1678-
virtualizedContainer.querySelectorAll('.TraceRow.Highlight')
1679-
).toHaveLength(0);
1679+
expect(container.querySelectorAll('.TraceRow.Highlight')).toHaveLength(0);
16801680
});
16811681
},
16821682
28_000

0 commit comments

Comments
 (0)