-
-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Session Replay is GA * update cocoa tests * fix changelog pr num * add js tests * Update packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryReplayOptionsTests.swift Co-authored-by: Antonis Lilis <[email protected]> * chore(deps): update Android SDK to v7.20.0 (#4411) Co-authored-by: GitHub <[email protected]> Co-authored-by: Roman Zavarnitsyn <[email protected]> * chore(deps): update Cocoa SDK to v8.43.0 (#4410) Co-authored-by: GitHub <[email protected]> Co-authored-by: Roman Zavarnitsyn <[email protected]> * Set SdkVersion to react native for replay events on Android * Use new options in samples * Fixes testMaskAllVectors failing test --------- Co-authored-by: Bruno Garcia <[email protected]> Co-authored-by: Antonis Lilis <[email protected]> Co-authored-by: Roman Zavarnitsyn <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: GitHub <[email protected]>
- Loading branch information
1 parent
8fe7c9d
commit 5dff5ee
Showing
13 changed files
with
211 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,55 +10,39 @@ final class RNSentryReplayOptions: XCTestCase { | |
XCTAssertEqual(optionsDict.count, 0) | ||
} | ||
|
||
func testExperimentalOptionsWithoutReplaySampleRatesAreRemoved() { | ||
let optionsDict = (["_experiments": [:]] as NSDictionary).mutableCopy() as! NSMutableDictionary | ||
RNSentryReplay.updateOptions(optionsDict) | ||
|
||
XCTAssertEqual(optionsDict.count, 0) | ||
} | ||
|
||
func testReplayOptionsDictContainsAllOptionsKeysWhenSessionSampleRateUsed() { | ||
let optionsDict = ([ | ||
"dsn": "https://[email protected]/1234567", | ||
"_experiments": [ | ||
"replaysSessionSampleRate": 0.75 | ||
] | ||
"replaysSessionSampleRate": 0.75 | ||
] as NSDictionary).mutableCopy() as! NSMutableDictionary | ||
RNSentryReplay.updateOptions(optionsDict) | ||
|
||
let experimental = optionsDict["experimental"] as! [String: Any] | ||
let sessionReplay = experimental["sessionReplay"] as! [String: Any] | ||
let sessionReplay = optionsDict["sessionReplay"] as! [String: Any] | ||
|
||
assertAllDefaultReplayOptionsAreNotNil(replayOptions: sessionReplay) | ||
} | ||
|
||
func testReplayOptionsDictContainsAllOptionsKeysWhenErrorSampleRateUsed() { | ||
let optionsDict = ([ | ||
"dsn": "https://[email protected]/1234567", | ||
"_experiments": [ | ||
"replaysOnErrorSampleRate": 0.75 | ||
] | ||
"replaysOnErrorSampleRate": 0.75 | ||
] as NSDictionary).mutableCopy() as! NSMutableDictionary | ||
RNSentryReplay.updateOptions(optionsDict) | ||
|
||
let experimental = optionsDict["experimental"] as! [String: Any] | ||
let sessionReplay = experimental["sessionReplay"] as! [String: Any] | ||
let sessionReplay = optionsDict["sessionReplay"] as! [String: Any] | ||
|
||
assertAllDefaultReplayOptionsAreNotNil(replayOptions: sessionReplay) | ||
} | ||
|
||
func testReplayOptionsDictContainsAllOptionsKeysWhenErrorAndSessionSampleRatesUsed() { | ||
let optionsDict = ([ | ||
"dsn": "https://[email protected]/1234567", | ||
"_experiments": [ | ||
"replaysOnErrorSampleRate": 0.75, | ||
"replaysSessionSampleRate": 0.75 | ||
] | ||
"replaysOnErrorSampleRate": 0.75, | ||
"replaysSessionSampleRate": 0.75 | ||
] as NSDictionary).mutableCopy() as! NSMutableDictionary | ||
RNSentryReplay.updateOptions(optionsDict) | ||
|
||
let experimental = optionsDict["experimental"] as! [String: Any] | ||
let sessionReplay = experimental["sessionReplay"] as! [String: Any] | ||
let sessionReplay = optionsDict["sessionReplay"] as! [String: Any] | ||
|
||
assertAllDefaultReplayOptionsAreNotNil(replayOptions: sessionReplay) | ||
} | ||
|
@@ -75,38 +59,37 @@ final class RNSentryReplayOptions: XCTestCase { | |
func testSessionSampleRate() { | ||
let optionsDict = ([ | ||
"dsn": "https://[email protected]/1234567", | ||
"_experiments": [ "replaysSessionSampleRate": 0.75 ] | ||
"replaysSessionSampleRate": 0.75 | ||
] as NSDictionary).mutableCopy() as! NSMutableDictionary | ||
RNSentryReplay.updateOptions(optionsDict) | ||
|
||
let actualOptions = try! Options(dict: optionsDict as! [String: Any]) | ||
XCTAssertEqual(actualOptions.experimental.sessionReplay.sessionSampleRate, 0.75) | ||
XCTAssertEqual(actualOptions.sessionReplay.sessionSampleRate, 0.75) | ||
} | ||
|
||
func testOnErrorSampleRate() { | ||
let optionsDict = ([ | ||
"dsn": "https://[email protected]/1234567", | ||
"_experiments": [ "replaysOnErrorSampleRate": 0.75 ] | ||
"replaysOnErrorSampleRate": 0.75 | ||
] as NSDictionary).mutableCopy() as! NSMutableDictionary | ||
RNSentryReplay.updateOptions(optionsDict) | ||
|
||
let actualOptions = try! Options(dict: optionsDict as! [String: Any]) | ||
XCTAssertEqual(actualOptions.experimental.sessionReplay.onErrorSampleRate, 0.75) | ||
XCTAssertEqual(actualOptions.sessionReplay.onErrorSampleRate, 0.75) | ||
} | ||
|
||
func testMaskAllVectors() { | ||
let optionsDict = ([ | ||
"dsn": "https://[email protected]/1234567", | ||
"_experiments": [ "replaysOnErrorSampleRate": 0.75 ], | ||
"replaysOnErrorSampleRate": 0.75, | ||
"mobileReplayOptions": [ "maskAllVectors": true ] | ||
] as NSDictionary).mutableCopy() as! NSMutableDictionary | ||
|
||
RNSentryReplay.updateOptions(optionsDict) | ||
|
||
XCTAssertEqual(optionsDict.count, 3) | ||
XCTAssertEqual(optionsDict.count, 4) | ||
|
||
let experimental = optionsDict["experimental"] as! [String: Any] | ||
let sessionReplay = experimental["sessionReplay"] as! [String: Any] | ||
let sessionReplay = optionsDict["sessionReplay"] as! [String: Any] | ||
|
||
let maskedViewClasses = sessionReplay["maskedViewClasses"] as! [String] | ||
XCTAssertTrue(maskedViewClasses.contains("RNSVGSvgView")) | ||
|
@@ -115,47 +98,47 @@ final class RNSentryReplayOptions: XCTestCase { | |
func testMaskAllImages() { | ||
let optionsDict = ([ | ||
"dsn": "https://[email protected]/1234567", | ||
"_experiments": [ "replaysOnErrorSampleRate": 0.75 ], | ||
"replaysOnErrorSampleRate": 0.75, | ||
"mobileReplayOptions": [ "maskAllImages": true ] | ||
] as NSDictionary).mutableCopy() as! NSMutableDictionary | ||
|
||
RNSentryReplay.updateOptions(optionsDict) | ||
|
||
let actualOptions = try! Options(dict: optionsDict as! [String: Any]) | ||
|
||
XCTAssertEqual(actualOptions.experimental.sessionReplay.maskAllImages, true) | ||
assertContainsClass(classArray: actualOptions.experimental.sessionReplay.maskedViewClasses, stringClass: "RCTImageView") | ||
XCTAssertEqual(actualOptions.sessionReplay.maskAllImages, true) | ||
assertContainsClass(classArray: actualOptions.sessionReplay.maskedViewClasses, stringClass: "RCTImageView") | ||
} | ||
|
||
func testMaskAllImagesFalse() { | ||
let optionsDict = ([ | ||
"dsn": "https://[email protected]/1234567", | ||
"_experiments": [ "replaysOnErrorSampleRate": 0.75 ], | ||
"replaysOnErrorSampleRate": 0.75, | ||
"mobileReplayOptions": [ "maskAllImages": false ] | ||
] as NSDictionary).mutableCopy() as! NSMutableDictionary | ||
|
||
RNSentryReplay.updateOptions(optionsDict) | ||
|
||
let actualOptions = try! Options(dict: optionsDict as! [String: Any]) | ||
|
||
XCTAssertEqual(actualOptions.experimental.sessionReplay.maskAllImages, false) | ||
XCTAssertEqual(actualOptions.experimental.sessionReplay.maskedViewClasses.count, 0) | ||
XCTAssertEqual(actualOptions.sessionReplay.maskAllImages, false) | ||
XCTAssertEqual(actualOptions.sessionReplay.maskedViewClasses.count, 0) | ||
} | ||
|
||
func testMaskAllText() { | ||
let optionsDict = ([ | ||
"dsn": "https://[email protected]/1234567", | ||
"_experiments": [ "replaysOnErrorSampleRate": 0.75 ], | ||
"replaysOnErrorSampleRate": 0.75, | ||
"mobileReplayOptions": [ "maskAllText": true ] | ||
] as NSDictionary).mutableCopy() as! NSMutableDictionary | ||
|
||
RNSentryReplay.updateOptions(optionsDict) | ||
|
||
let actualOptions = try! Options(dict: optionsDict as! [String: Any]) | ||
|
||
XCTAssertEqual(actualOptions.experimental.sessionReplay.maskAllText, true) | ||
assertContainsClass(classArray: actualOptions.experimental.sessionReplay.maskedViewClasses, stringClass: "RCTTextView") | ||
assertContainsClass(classArray: actualOptions.experimental.sessionReplay.maskedViewClasses, stringClass: "RCTParagraphComponentView") | ||
XCTAssertEqual(actualOptions.sessionReplay.maskAllText, true) | ||
assertContainsClass(classArray: actualOptions.sessionReplay.maskedViewClasses, stringClass: "RCTTextView") | ||
assertContainsClass(classArray: actualOptions.sessionReplay.maskedViewClasses, stringClass: "RCTParagraphComponentView") | ||
} | ||
|
||
func assertContainsClass(classArray: [AnyClass], stringClass: String) { | ||
|
@@ -169,16 +152,16 @@ final class RNSentryReplayOptions: XCTestCase { | |
func testMaskAllTextFalse() { | ||
let optionsDict = ([ | ||
"dsn": "https://[email protected]/1234567", | ||
"_experiments": [ "replaysOnErrorSampleRate": 0.75 ], | ||
"replaysOnErrorSampleRate": 0.75, | ||
"mobileReplayOptions": [ "maskAllText": false ] | ||
] as NSDictionary).mutableCopy() as! NSMutableDictionary | ||
|
||
RNSentryReplay.updateOptions(optionsDict) | ||
|
||
let actualOptions = try! Options(dict: optionsDict as! [String: Any]) | ||
|
||
XCTAssertEqual(actualOptions.experimental.sessionReplay.maskAllText, false) | ||
XCTAssertEqual(actualOptions.experimental.sessionReplay.maskedViewClasses.count, 0) | ||
XCTAssertEqual(actualOptions.sessionReplay.maskAllText, false) | ||
XCTAssertEqual(actualOptions.sessionReplay.maskedViewClasses.count, 0) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.