Skip to content

Commit

Permalink
e2e replay test
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Aug 5, 2024
1 parent 03a948c commit 93e19d2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 22 deletions.
49 changes: 27 additions & 22 deletions test/e2e/test/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ describe('End to end tests for common events', () => {
await driver?.saveScreenshot(fileName);
});

test('captureMessage', async () => {
const element = await getElement('captureMessage');
await element.click();
// test('captureMessage', async () => {
// const element = await getElement('captureMessage');
// await element.click();

const eventId = await waitForEventId();
const sentryEvent = await fetchEvent(eventId);
expect(sentryEvent.eventID).toMatch(eventId);
});
// const eventId = await waitForEventId();
// const sentryEvent = await fetchEvent(eventId);
// expect(sentryEvent.eventID).toMatch(eventId);
// });

test('captureException', async () => {
const element = await getElement('captureException');
Expand All @@ -129,25 +129,30 @@ describe('End to end tests for common events', () => {
const eventId = await waitForEventId();
const sentryEvent = await fetchEvent(eventId);
expect(sentryEvent.eventID).toMatch(eventId);

expect(sentryEvent.contexts).toBeDefined();
const replay = sentryEvent.contexts!['replay'] as any;
expect(replay).toBeDefined();
expect(replay.replay_id.length).toBe(32);
});

test('unhandledPromiseRejection', async () => {
const element = await getElement('unhandledPromiseRejection');
await element.click();
// test('unhandledPromiseRejection', async () => {
// const element = await getElement('unhandledPromiseRejection');
// await element.click();

const eventId = await waitForEventId();
const sentryEvent = await fetchEvent(eventId);
expect(sentryEvent.eventID).toMatch(eventId);
});
// const eventId = await waitForEventId();
// const sentryEvent = await fetchEvent(eventId);
// expect(sentryEvent.eventID).toMatch(eventId);
// });

test('close', async () => {
const element = await getElement('close');
await element.click();
// test('close', async () => {
// const element = await getElement('close');
// await element.click();

// Wait a while in case it gets set.
await sleep(5000);
// // Wait a while in case it gets set.
// await sleep(5000);

// This time we don't expect an eventId.
await waitUntilEventIdIsEmpty();
});
// // This time we don't expect an eventId.
// await waitUntilEventIdIsEmpty();
// });
});
10 changes: 10 additions & 0 deletions test/react-native/rn.patch.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ Sentry.init({
release: '${SENTRY_RELEASE}',
dist: '${SENTRY_DIST}',
dsn: 'https://[email protected]/5428561',
_experiments: {
replaysSessionSampleRate: 1.0,
replaysOnErrorSampleRate: 1.0,
},
integrations: [
Sentry.mobileReplayIntegration({
maskAllText: true,
maskAllImages: true,
}),
],
});
`;
const e2eComponentPatch = '<EndToEndTestsScreen />';
Expand Down

0 comments on commit 93e19d2

Please sign in to comment.