Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion dev-packages/e2e-tests/maestro/utils/sentryApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ switch (fetch) {
}
case 'replay': {
const event = json(fetchFromSentry(`${baseUrl}/events/${eventId}/json/`));
const replayId = event._dsc.replay_id.replace(/\-/g, '');
const replayIdRaw = event._dsc?.replay_id;
if (!replayIdRaw) {
console.error('Event DSC:', JSON.stringify(event._dsc, null, 2));
throw new Error(`Event ${eventId} does not have a replay_id in DSC. Replay might not be configured properly. Check that replaysOnErrorSampleRate or replaysSessionSampleRate is set.`);
}
const replayId = replayIdRaw.replace(/\-/g, '');
const replay = json(fetchFromSentry(`${baseUrl}/replays/${replayId}/`));
const segment = fetchFromSentry(`${baseUrl}/replays/${replayId}/videos/0/`);

Expand Down
23 changes: 20 additions & 3 deletions dev-packages/e2e-tests/patch-scripts/rn.patch.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,30 @@ import * as Sentry from '@sentry/react-native';
import { EndToEndTestsScreen } from 'sentry-react-native-e2e-tests';
import { LaunchArguments } from "react-native-launch-arguments";

const launchArgs = LaunchArguments.value();

// Parse launch arguments, handling both number and string types
const parseRate = (value) => {
if (value === undefined || value === null || value === 'undefined') {
return undefined;
}
const parsed = typeof value === 'number' ? value : parseFloat(value);
return isNaN(parsed) ? undefined : parsed;
};

const replaysOnErrorSampleRate = parseRate(launchArgs.replaysOnErrorSampleRate);
const replaysSessionSampleRate = parseRate(launchArgs.replaysSessionSampleRate);

console.log('[E2E] LaunchArguments raw:', JSON.stringify(launchArgs));
console.log('[E2E] Parsed replaysOnErrorSampleRate:', replaysOnErrorSampleRate, typeof replaysOnErrorSampleRate);
console.log('[E2E] Parsed replaysSessionSampleRate:', replaysSessionSampleRate, typeof replaysSessionSampleRate);

Sentry.init({
release: '${SENTRY_RELEASE}',
dist: '${SENTRY_DIST}',
dsn: 'https://[email protected]/5428561',
_experiments: {
replaysOnErrorSampleRate: LaunchArguments.value().replaysOnErrorSampleRate,
},
replaysOnErrorSampleRate: replaysOnErrorSampleRate,
replaysSessionSampleRate: replaysSessionSampleRate,
integrations: [
Sentry.mobileReplayIntegration(),
Sentry.feedbackIntegration({
Expand Down
Loading