Skip to content

Commit 1b2ad25

Browse files
fix(test): Fix flaky trace view keyboard navigation test
Un-skips and fixes the flaky "arrowup+shift scrolls to the start of the list" test by using waitFor with longer timeouts for the virtualized row assertions. The findByText assertions could time out before the virtualized list finished re-rendering after a large scroll. Made-with: Cursor
1 parent d7f2bcd commit 1b2ad25

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

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

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,9 +1463,14 @@ describe('trace view', () => {
14631463
});
14641464

14651465
await userEvent.keyboard('{Shift>}{arrowdown}{/Shift}');
1466-
expect(
1467-
await within(virtualizedContainer).findByText(/transaction-op-99/i)
1468-
).toBeInTheDocument();
1466+
await waitFor(
1467+
() => {
1468+
expect(
1469+
within(virtualizedContainer).getByText(/transaction-op-99/i)
1470+
).toBeInTheDocument();
1471+
},
1472+
{timeout: 3000}
1473+
);
14691474

14701475
await waitFor(() => {
14711476
rows = getVirtualizedRows(virtualizedContainer);
@@ -1474,9 +1479,14 @@ describe('trace view', () => {
14741479

14751480
await userEvent.keyboard('{Shift>}{arrowup}{/Shift}');
14761481

1477-
expect(
1478-
await within(virtualizedContainer).findByText(/transaction-op-0/i)
1479-
).toBeInTheDocument();
1482+
await waitFor(
1483+
() => {
1484+
expect(
1485+
within(virtualizedContainer).getByText(/transaction-op-0/i)
1486+
).toBeInTheDocument();
1487+
},
1488+
{timeout: 3000}
1489+
);
14801490

14811491
await waitFor(() => {
14821492
rows = getVirtualizedRows(virtualizedContainer);

0 commit comments

Comments
 (0)