Skip to content

Commit 17a9c54

Browse files
test(trace): Scope highlight assertions to the virtualized list
assertHighlightedRowAtIndex used the full render container while row clicks used getVirtualizedRows(virtualizedContainer), so visible-row indices could disagree when other TraceRow nodes exist outside the list. Fixes BROWSE-411. Made-with: Cursor
1 parent e87f5d1 commit 17a9c54

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ describe('trace view', () => {
16251625
it.isKnownFlake(
16261626
'highlighted is persisted on node while it is part of the search results',
16271627
async () => {
1628-
const {container, virtualizedContainer} = await searchTestSetup();
1628+
const {virtualizedContainer} = await searchTestSetup();
16291629
const searchInput = await screen.findByPlaceholderText('Search in trace');
16301630
await userEvent.type(searchInput, 'trans');
16311631
await waitFor(() => expect(searchInput).toHaveValue('trans'));
@@ -1638,14 +1638,14 @@ describe('trace view', () => {
16381638
await userEvent.click(getVirtualizedRows(virtualizedContainer)[2]!);
16391639
await searchToResolve();
16401640

1641-
await assertHighlightedRowAtIndex(container, 2, {timeout: 10_000});
1641+
await assertHighlightedRowAtIndex(virtualizedContainer, 2, {timeout: 10_000});
16421642

16431643
await userEvent.type(searchInput, 'act');
16441644
await waitFor(() => expect(searchInput).toHaveValue('transact'));
16451645
await searchToResolve();
16461646

16471647
// Highlighting is persisted on the row
1648-
await assertHighlightedRowAtIndex(container, 2, {timeout: 10_000});
1648+
await assertHighlightedRowAtIndex(virtualizedContainer, 2, {timeout: 10_000});
16491649

16501650
await userEvent.clear(searchInput);
16511651
await userEvent.click(searchInput);
@@ -1655,7 +1655,9 @@ describe('trace view', () => {
16551655

16561656
// When there is no match, the highlighting is removed
16571657
await waitFor(() => {
1658-
expect(container.querySelectorAll('.TraceRow.Highlight')).toHaveLength(0);
1658+
expect(
1659+
virtualizedContainer.querySelectorAll('.TraceRow.Highlight')
1660+
).toHaveLength(0);
16591661
});
16601662
},
16611663
28_000
@@ -1679,15 +1681,15 @@ describe('trace view', () => {
16791681
it.isKnownFlake(
16801682
'clicking a row that is also a search result updates the result index',
16811683
async () => {
1682-
const {container, virtualizedContainer} = await searchTestSetup();
1684+
const {virtualizedContainer} = await searchTestSetup();
16831685

16841686
const searchInput = await screen.findByPlaceholderText('Search in trace');
16851687
await userEvent.type(searchInput, 'transaction-op-1');
16861688
await waitFor(() => expect(searchInput).toHaveValue('transaction-op-1'));
16871689

16881690
await searchToResolve();
16891691

1690-
await assertHighlightedRowAtIndex(container, 2);
1692+
await assertHighlightedRowAtIndex(virtualizedContainer, 2);
16911693
// By default, we highlight the first result
16921694
expect(
16931695
await screen.findByTestId('trace-search-result-iterator')

0 commit comments

Comments
 (0)