Skip to content

Commit 2d06408

Browse files
chore(internal): Add meaning full release name and dist to e2e tests builds (#3063)
1 parent edc6a62 commit 2d06408

File tree

5 files changed

+28
-25
lines changed

5 files changed

+28
-25
lines changed

.github/workflows/e2e.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,21 @@ jobs:
265265
steps:
266266
- uses: actions/checkout@v3
267267

268+
- name: Sentry Release
269+
run: |
270+
SENTRY_RELEASE_CANDIDATE=$(echo 'e2e/${{ github.ref }}' | perl -pe 's/\//-/g')
271+
echo "SENTRY_RELEASE=$SENTRY_RELEASE_CANDIDATE" >> $GITHUB_ENV
272+
273+
- name: Sentry Dist
274+
run: |
275+
SENTRY_DIST_CANDIDATE=${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${GITHUB_SHA:0:8}
276+
echo "SENTRY_DIST=$SENTRY_DIST_CANDIDATE" >> $GITHUB_ENV
277+
278+
- name: Sentry Envs
279+
run: |
280+
echo "SENTRY_RELEASE=$SENTRY_RELEASE"
281+
echo "SENTRY_DIST=$SENTRY_DIST"
282+
268283
- uses: actions/setup-java@v3
269284
with:
270285
java-version: '11'

test/e2e/src/EndToEndTests.tsx

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as Sentry from '@sentry/react-native';
33
import * as React from 'react';
44
import { Text, View } from 'react-native';
55

6-
import { SENTRY_INTERNAL_DSN } from './dsn';
76
import { getTestProps } from './utils/getTestProps';
87

98
export { getTestProps };
@@ -14,16 +13,14 @@ export { getTestProps };
1413
const EndToEndTestsScreen = (): JSX.Element => {
1514
const [eventId, setEventId] = React.useState<string | null | undefined>();
1615

17-
// !!! WARNING: Do not put Sentry.init inside React.useEffect like we do here. This is only for testing purposes.
16+
// !!! WARNING: This is only for testing purposes.
1817
// We only do this to render the eventId onto the UI for end to end tests.
1918
React.useEffect(() => {
20-
Sentry.init({
21-
dsn: SENTRY_INTERNAL_DSN,
22-
beforeSend: (e) => {
23-
setEventId(e.event_id || null);
24-
return e;
25-
},
26-
});
19+
const client: Sentry.ReactNativeClient | undefined = Sentry.getCurrentHub().getClient();
20+
client.getOptions().beforeSend = (e: Sentry.Event) => {
21+
setEventId(e.event_id || null);
22+
return e;
23+
};
2724
}, []);
2825

2926
return (
@@ -46,13 +43,6 @@ const EndToEndTestsScreen = (): JSX.Element => {
4643
}}>
4744
captureException
4845
</Text>
49-
<Text
50-
{...getTestProps('throwNewError')}
51-
onPress={() => {
52-
throw new Error('throw new error test');
53-
}}>
54-
throw new Error
55-
</Text>
5646
<Text
5747
onPress={async () => {
5848
await Promise.reject(new Error('Unhandled Promise Rejection'));
@@ -67,12 +57,6 @@ const EndToEndTestsScreen = (): JSX.Element => {
6757
}}>
6858
close
6959
</Text>
70-
<Text
71-
onPress={() => {
72-
Sentry.nativeCrash();
73-
}}>
74-
nativeCrash
75-
</Text>
7660
</View>
7761
);
7862
};

test/e2e/src/dsn.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/react-native/rn.patch.app.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
const fs = require('fs');
44
const path = require('path');
5-
const { argv } = require('process');
5+
const { argv, env } = require('process');
66

77
const parseArgs = require('minimist');
88
const { logger } = require('@sentry/utils');
99
logger.enable();
1010

11+
const SENTRY_RELEASE = env.SENTRY_RELEASE;
12+
const SENTRY_DIST = env.SENTRY_DIST;
13+
1114
const args = parseArgs(argv.slice(2));
1215
if (!args.app) {
1316
throw new Error('Missing --app');
@@ -20,6 +23,8 @@ import * as Sentry from '@sentry/react-native';
2023
import { EndToEndTestsScreen } from 'sentry-react-native-e2e-tests';
2124
2225
Sentry.init({
26+
release: '${SENTRY_RELEASE}',
27+
dist: '${SENTRY_DIST}',
2328
dsn: 'https://[email protected]/5428561',
2429
});
2530
`;

test/react-native/rn.patch.xcode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ set -e
5555
WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
5656
REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
5757
58-
/bin/sh -c "$WITH_ENVIRONMENT \\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\""
58+
/bin/sh -c "$WITH_ENVIRONMENT \\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode --force-foreground $REACT_NATIVE_XCODE\\""
5959
6060
/bin/sh ../node_modules/@sentry/react-native/scripts/collect-modules.sh
6161
`;

0 commit comments

Comments
 (0)