Skip to content

Commit a37eb95

Browse files
committed
test(e2e): Unflake replay recording data optional e2e test
1 parent 6571e0c commit a37eb95

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

dev-packages/e2e-tests/test-applications/react-send-to-sentry/tests/send-to-sentry.test.ts

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -180,24 +180,26 @@ test('Sends a Replay recording to Sentry', async ({ browser }) => {
180180
.toBe(200);
181181

182182
// now fetch the first recording segment
183-
await expect
184-
.poll(
185-
async () => {
186-
const response = await fetch(
187-
`https://sentry.io/api/0/projects/${sentryTestOrgSlug}/${sentryTestProject}/replays/${replayId}/recording-segments/?cursor=100%3A0%3A1`,
188-
{ headers: { Authorization: `Bearer ${authToken}` } },
189-
);
190-
191-
if (response.ok) {
192-
const data = await response.json();
193-
return data[0];
194-
}
183+
const data = expect.poll(
184+
async () => {
185+
const response = await fetch(
186+
`https://sentry.io/api/0/projects/${sentryTestOrgSlug}/${sentryTestProject}/replays/${replayId}/recording-segments/?cursor=100%3A0%3A1`,
187+
{ headers: { Authorization: `Bearer ${authToken}` } },
188+
);
189+
190+
if (response.ok) {
191+
const data = await response.json();
192+
return data[0];
193+
}
194+
195+
return response.status;
196+
},
197+
{
198+
timeout: EVENT_POLLING_TIMEOUT,
199+
},
200+
);
195201

196-
return response.status;
197-
},
198-
{
199-
timeout: EVENT_POLLING_TIMEOUT,
200-
},
201-
)
202-
.toEqual(ReplayRecordingData);
202+
// Check that that all expected data is present but relax the order
203+
expect(data).toEqual(expect.arrayContaining(ReplayRecordingData));
204+
expect(data).toHaveLength(ReplayRecordingData.length);
203205
});

0 commit comments

Comments
 (0)