Browse Source

test(ui): Fix two replay test flakes (#67490)

Scott Cooper 11 months ago
parent
commit
0b0cca925a

+ 8 - 3
static/app/components/events/eventReplay/index.spec.tsx

@@ -6,7 +6,7 @@ import {RRWebInitFrameEventsFixture} from 'sentry-fixture/replay/rrweb';
 import {ReplayErrorFixture} from 'sentry-fixture/replayError';
 import {ReplayRecordFixture} from 'sentry-fixture/replayRecord';
 
-import {render, screen} from 'sentry-test/reactTestingLibrary';
+import {render, screen, waitFor} from 'sentry-test/reactTestingLibrary';
 
 import EventReplay from 'sentry/components/events/eventReplay';
 import ConfigStore from 'sentry/stores/configStore';
@@ -251,7 +251,12 @@ describe('EventReplay', function () {
       );
 
       // Event that matches ID 1 should be shown as "This Event"
-      expect(await screen.findByText('Error: This Event')).toBeInTheDocument();
+      await waitFor(
+        () => {
+          expect(screen.getByText('Error: This Event')).toBeInTheDocument();
+        },
+        {timeout: 5000, interval: 100}
+      );
       expect(screen.getByText('JAVASCRIPT-101')).toBeInTheDocument();
 
       // Other events should link to the event and issue
@@ -263,6 +268,6 @@ describe('EventReplay', function () {
         'href',
         '/organizations/org-slug/issues/102/'
       );
-    });
+    }, 10000);
   });
 });

+ 1 - 1
static/app/views/issueDetails/groupReplays/groupReplays.spec.tsx

@@ -407,7 +407,7 @@ describe('GroupReplays', () => {
       });
 
       await waitFor(() => {
-        expect(mockReplayCountApi).toHaveBeenCalledTimes(1);
+        expect(mockReplayCountApi).toHaveBeenCalled();
         expect(mockReplayApi).toHaveBeenCalledTimes(1);
       });