Skip to content

Commit 9ebeaae

Browse files
Merge branch 'feat/replay' into kw/add-rn-svg-block
2 parents 409ad00 + 6d8c4dd commit 9ebeaae

29 files changed

+919
-137
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444

4545
# Initializes the CodeQL tools for scanning.
4646
- name: Initialize CodeQL
47-
uses: github/codeql-action/init@3ab4101902695724f9365a384f86c1074d94e18c # pin@v2
47+
uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # pin@v3.25.11
4848
with:
4949
languages: ${{ matrix.language }}
5050
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -55,7 +55,7 @@ jobs:
5555
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5656
# If this step fails, then you should remove it and run the build manually (see below)
5757
- name: Autobuild
58-
uses: github/codeql-action/autobuild@3ab4101902695724f9365a384f86c1074d94e18c # pin@v2
58+
uses: github/codeql-action/autobuild@b611370bb5703a7efb587f9d136a52ea24c5c38c # pin@v3.25.11
5959

6060
# ℹ️ Command-line programs to run using the OS shell.
6161
# 📚 https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
@@ -66,4 +66,4 @@ jobs:
6666
# make bootstrap
6767
# make release
6868
- name: Perform CodeQL Analysis
69-
uses: github/codeql-action/analyze@3ab4101902695724f9365a384f86c1074d94e18c # pin@v2
69+
uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # pin@v3.25.11

.github/workflows/e2e.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
2323
steps:
2424
- name: Cancel Previous Runs
25-
uses: styfle/cancel-workflow-action@01ce38bf961b4e243a6342cbade0dbc8ba3f0432 # [email protected].0
25+
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # [email protected].1
2626
with:
2727
access_token: ${{ github.token }}
2828

@@ -568,7 +568,7 @@ jobs:
568568
if: ${{ matrix.platform == 'android' }}
569569
env:
570570
APPIUM_APP: ./app-release.apk
571-
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # pin@v2
571+
uses: reactivecircus/android-emulator-runner@77986be26589807b8ebab3fde7bbf5c60dabec32 # pin@v2.31.0
572572
with:
573573
working-directory: test/e2e
574574
api-level: 30

.github/workflows/native-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
1616
steps:
1717
- name: Cancel Previous Runs
18-
uses: styfle/cancel-workflow-action@01ce38bf961b4e243a6342cbade0dbc8ba3f0432 # [email protected].0
18+
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # [email protected].1
1919
with:
2020
access_token: ${{ github.token }}
2121

@@ -97,7 +97,7 @@ jobs:
9797

9898
- name: Create AVD and generate snapshot for caching
9999
if: steps.avd-cache.outputs.cache-hit != 'true'
100-
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 #pin@v2.30.1
100+
uses: reactivecircus/android-emulator-runner@77986be26589807b8ebab3fde7bbf5c60dabec32 #pin@v2.31.0
101101
with:
102102
api-level: 30
103103
force-avd-creation: false
@@ -117,7 +117,7 @@ jobs:
117117
script: echo "Generated AVD snapshot for caching."
118118

119119
- name: Run connected tests
120-
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 #pin@v2.30.1
120+
uses: reactivecircus/android-emulator-runner@77986be26589807b8ebab3fde7bbf5c60dabec32 #pin@v2.31.0
121121
with:
122122
working-directory: RNSentryAndroidTester
123123
api-level: 30

.github/workflows/sample-application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
2424
steps:
2525
- name: Cancel Previous Runs
26-
uses: styfle/cancel-workflow-action@01ce38bf961b4e243a6342cbade0dbc8ba3f0432 # [email protected].0
26+
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # [email protected].1
2727
with:
2828
access_token: ${{ github.token }}
2929

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Features
66

77
- Redact `react-native-svg` SVGs when `maskAllVectors` ([#3930](https://github.com/getsentry/sentry-react-native/pull/3930))
8+
- Set `currentScreen` on native scope ([#3927](https://github.com/getsentry/sentry-react-native/pull/3927))
89
- Add `annotateReactComponents` option to `@sentry/react-native/metro` ([#3916](https://github.com/getsentry/sentry-react-native/pull/3916))
910

1011
```js
@@ -18,6 +19,19 @@
1819
module.exports = withSentryConfig(getDefaultConfig(__dirname), { annotateReactComponents: true });
1920
```
2021

22+
### Fixes
23+
24+
- Add `app.foreground/background` breadcrumbs to iOS Replays ([#3932](https://github.com/getsentry/sentry-react-native/pull/3932))
25+
- errors with cause are now correctly serialized on debug build ([#3920](https://github.com/getsentry/sentry-react-native/pull/3920))
26+
- Flavor aware Android builds use `SENTRY_AUTH_TOKEN` env as fallback when token not found in `sentry-flavor-type.properties`. ([#3917](https://github.com/getsentry/sentry-react-native/pull/3917))
27+
- `mechanism.handled:false` should crash current session ([#3900](https://github.com/getsentry/sentry-react-native/pull/3900))
28+
29+
### Dependencies
30+
31+
- Bump Android SDK from v7.11.0-alpha.2 to v7.12.0-alpha.3 ([#3830](https://github.com/getsentry/sentry-react-native/pull/3830))
32+
- [changelog](https://github.com/getsentry/sentry-java/blob/7.12.0-alpha.3/CHANGELOG.md#7120-alpha3)
33+
- [diff](https://github.com/getsentry/sentry-java/compare/7.11.0-alpha.2...7.12.0-alpha.3)
34+
2135
## 5.25.0-alpha.2
2236

2337
### Features
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package io.sentry.rnsentryandroidtester
2+
3+
import com.facebook.react.bridge.JavaOnlyMap
4+
import io.sentry.react.RNSentryBreadcrumb
5+
import junit.framework.TestCase.assertEquals
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
import org.junit.runners.JUnit4
9+
10+
@RunWith(JUnit4::class)
11+
class RNSentryBreadcrumbTest {
12+
13+
@Test
14+
fun nullForMissingCategory() {
15+
val map = JavaOnlyMap.of()
16+
val actual = RNSentryBreadcrumb.getCurrentScreenFrom(map)
17+
assertEquals(null, actual)
18+
}
19+
20+
21+
@Test
22+
fun nullForNonNavigationCategory() {
23+
val map = JavaOnlyMap.of(
24+
"category", "unknown"
25+
)
26+
val actual = RNSentryBreadcrumb.getCurrentScreenFrom(map)
27+
assertEquals(null, actual)
28+
}
29+
30+
31+
@Test
32+
fun nullForMissingData() {
33+
val map = JavaOnlyMap.of(
34+
"category", "navigation"
35+
)
36+
val actual = RNSentryBreadcrumb.getCurrentScreenFrom(map)
37+
assertEquals(null, actual)
38+
}
39+
40+
41+
@Test
42+
fun nullForNonStringDataToKey() {
43+
val map = JavaOnlyMap.of(
44+
"category", "unknown",
45+
"data", mapOf(
46+
"to" to 123,
47+
),
48+
)
49+
val actual = RNSentryBreadcrumb.getCurrentScreenFrom(map)
50+
assertEquals(null, actual)
51+
}
52+
53+
@Test
54+
fun screenNameForValidNavigationBreadcrumb() {
55+
val map = JavaOnlyMap.of(
56+
"category", "navigation",
57+
"data", JavaOnlyMap.of(
58+
"to", "newScreen",
59+
),
60+
)
61+
val actual = RNSentryBreadcrumb.getCurrentScreenFrom(map)
62+
assert(actual is String)
63+
assertEquals("newScreen", actual)
64+
}
65+
66+
}

RNSentryAndroidTester/app/src/test/java/io/sentry/rnsentryandroidtester/RNSentryReplayBreadcrumbConverterTest.kt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package io.sentry.rnsentryandroidtester
22

33
import io.sentry.Breadcrumb
44
import io.sentry.react.RNSentryReplayBreadcrumbConverter
5+
import io.sentry.rrweb.RRWebBreadcrumbEvent
56
import org.junit.Assert.assertEquals
67
import org.junit.Test
78
import org.junit.runner.RunWith
@@ -10,6 +11,30 @@ import org.junit.runners.JUnit4
1011
@RunWith(JUnit4::class)
1112
class RNSentryReplayBreadcrumbConverterTest {
1213

14+
@Test
15+
fun testConvertForegroundBreadcrumb() {
16+
val converter = RNSentryReplayBreadcrumbConverter()
17+
val testBreadcrumb = Breadcrumb()
18+
testBreadcrumb.type = "navigation"
19+
testBreadcrumb.category = "app.lifecycle"
20+
testBreadcrumb.setData("state", "foreground");
21+
val actual = converter.convert(testBreadcrumb) as RRWebBreadcrumbEvent
22+
23+
assertEquals("app.foreground", actual.category)
24+
}
25+
26+
@Test
27+
fun testConvertBackgroundBreadcrumb() {
28+
val converter = RNSentryReplayBreadcrumbConverter()
29+
val testBreadcrumb = Breadcrumb()
30+
testBreadcrumb.type = "navigation"
31+
testBreadcrumb.category = "app.lifecycle"
32+
testBreadcrumb.setData("state", "background");
33+
val actual = converter.convert(testBreadcrumb) as RRWebBreadcrumbEvent
34+
35+
assertEquals("app.background", actual.category)
36+
}
37+
1338
@Test
1439
fun doesNotConvertSentryEventBreadcrumb() {
1540
val converter = RNSentryReplayBreadcrumbConverter()

RNSentryCocoaTester/RNSentryCocoaTester.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818

1919
/* Begin PBXFileReference section */
2020
1482D5685A340AB93348A43D /* Pods-RNSentryCocoaTesterTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNSentryCocoaTesterTests.release.xcconfig"; path = "Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests.release.xcconfig"; sourceTree = "<group>"; };
21-
330F308B2C0F3840002A0D4E /* RNSentryBreadcrumbTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNSentryBreadcrumbTests.m; sourceTree = "<group>"; };
2221
330F308D2C0F385A002A0D4E /* RNSentryBreadcrumb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNSentryBreadcrumb.h; path = ../ios/RNSentryBreadcrumb.h; sourceTree = "<group>"; };
2322
336084372C32E382008CC412 /* RNSentryCocoaTesterTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNSentryCocoaTesterTests-Bridging-Header.h"; sourceTree = "<group>"; };
2423
336084382C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RNSentryReplayBreadcrumbConverterTests.swift; sourceTree = "<group>"; };
2524
3360843A2C32E3A8008CC412 /* RNSentryReplayBreadcrumbConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNSentryReplayBreadcrumbConverter.h; path = ../ios/RNSentryReplayBreadcrumbConverter.h; sourceTree = "<group>"; };
25+
3360843C2C340C76008CC412 /* RNSentryBreadcrumbTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNSentryBreadcrumbTests.swift; sourceTree = "<group>"; };
2626
3360898D29524164007C7730 /* RNSentryCocoaTesterTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNSentryCocoaTesterTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
2727
338739072A7D7D2800950DDD /* RNSentryTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNSentryTests.h; sourceTree = "<group>"; };
2828
33958C672BFCEF5A00AD1FB6 /* RNSentryOnDrawReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNSentryOnDrawReporter.h; path = ../ios/RNSentryOnDrawReporter.h; sourceTree = "<group>"; };
@@ -88,8 +88,8 @@
8888
33AFDFF02B8D15E500AAB120 /* RNSentryDependencyContainerTests.m */,
8989
33AFDFF22B8D15F600AAB120 /* RNSentryDependencyContainerTests.h */,
9090
33958C682BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m */,
91-
330F308B2C0F3840002A0D4E /* RNSentryBreadcrumbTests.m */,
92-
336084372C32E382008CC412 /* RNSentryCocoaTesterTests-Bridging-Header.h */,
91+
3360843C2C340C76008CC412 /* RNSentryBreadcrumbTests.swift */,
92+
3360843B2C340C75008CC412 /* RNSentryCocoaTesterTests-Bridging-Header.h */,
9393
);
9494
path = RNSentryCocoaTesterTests;
9595
sourceTree = "<group>";
@@ -219,7 +219,7 @@
219219
336084392C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift in Sources */,
220220
33F58AD02977037D008F60EA /* RNSentryTests.mm in Sources */,
221221
33958C692BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m in Sources */,
222-
330F308C2C0F3840002A0D4E /* RNSentryBreadcrumbTests.m in Sources */,
222+
3360843D2C340C76008CC412 /* RNSentryBreadcrumbTests.swift in Sources */,
223223
33AFDFED2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m in Sources */,
224224
);
225225
runOnlyForDeploymentPostprocessing = 0;

RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryBreadcrumbTests.m

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import XCTest
2+
import Sentry
3+
4+
class RNSentryBreadcrumbTests: XCTestCase {
5+
6+
func testGeneratesSentryBreadcrumbFromNSDictionary() {
7+
let actualCrumb = RNSentryBreadcrumb.from([
8+
"level": "error",
9+
"category": "testCategory",
10+
"type": "testType",
11+
"message": "testMessage",
12+
"data": [
13+
"test": "data"
14+
]
15+
])
16+
17+
XCTAssertEqual(actualCrumb!.level, SentryLevel.error)
18+
XCTAssertEqual(actualCrumb!.category, "testCategory")
19+
XCTAssertEqual(actualCrumb!.type, "testType")
20+
XCTAssertEqual(actualCrumb!.message, "testMessage")
21+
XCTAssertEqual((actualCrumb!.data)!["test"] as! String, "data")
22+
}
23+
24+
func testUsesInfoAsDefaultSentryLevel() {
25+
let actualCrumb = RNSentryBreadcrumb.from([
26+
"message": "testMessage"
27+
])
28+
29+
XCTAssertEqual(actualCrumb!.level, SentryLevel.info)
30+
}
31+
32+
func testNullForMissingCategory() {
33+
let map: [String: Any] = [:]
34+
let actual = RNSentryBreadcrumb.getCurrentScreen(from: map)
35+
XCTAssertNil(actual)
36+
}
37+
38+
func testNullForNonNavigationCategory() {
39+
let map: [String: Any] = ["category": "unknown"]
40+
let actual = RNSentryBreadcrumb.getCurrentScreen(from: map)
41+
XCTAssertNil(actual)
42+
}
43+
44+
func testNullForMissingData() {
45+
let map: [String: Any] = ["category": "navigation"]
46+
let actual = RNSentryBreadcrumb.getCurrentScreen(from: map)
47+
XCTAssertNil(actual)
48+
}
49+
50+
func testNullForNonStringDataToKey() {
51+
let map: [String: Any] = [
52+
"category": "unknown",
53+
"data": ["to": 123]
54+
]
55+
let actual = RNSentryBreadcrumb.getCurrentScreen(from: map)
56+
XCTAssertNil(actual)
57+
}
58+
59+
func testScreenNameForValidNavigationBreadcrumb() {
60+
let map: [String: Any] = [
61+
"category": "navigation",
62+
"data": ["to": "newScreen"]
63+
]
64+
let actual = RNSentryBreadcrumb.getCurrentScreen(from: map)
65+
XCTAssertEqual(actual, "newScreen")
66+
}
67+
68+
}

0 commit comments

Comments
 (0)