Skip to content

Commit b1e357f

Browse files
authored
chore(tests): Remove snapshot testing to reduce repository size (#6631)
1 parent 32f2329 commit b1e357f

File tree

150 files changed

+3
-172
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+3
-172
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,6 @@ uikit-check-build
112112

113113
# Output of `make analyze`
114114
analyzer
115+
116+
# Output of snapshot testing
117+
**/__Snapshots__

Sentry.xcodeproj/project.pbxproj

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,6 @@
768768
D43B26D62D70964C007747FD /* SentrySpanOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = D43B26D52D709648007747FD /* SentrySpanOperation.m */; };
769769
D43B26D82D70A550007747FD /* SentryTraceOrigin.m in Sources */ = {isa = PBXBuildFile; fileRef = D43B26D72D70A54A007747FD /* SentryTraceOrigin.m */; };
770770
D43B26DA2D70A612007747FD /* SentrySpanDataKey.m in Sources */ = {isa = PBXBuildFile; fileRef = D43B26D92D70A60E007747FD /* SentrySpanDataKey.m */; };
771-
D43C1BE82E8FB85400CD5D67 /* SnapshotTesting in Frameworks */ = {isa = PBXBuildFile; productRef = D43C1BE72E8FB85400CD5D67 /* SnapshotTesting */; };
772771
D4411DD52E02B74900EA4987 /* ArrayAccessesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4411DD42E02B74100EA4987 /* ArrayAccessesTests.swift */; };
773772
D44311312EB22812006CABE4 /* SentryUIRedactBuilderTests+ReactNative.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4AF7D212E93FFCA004F0F59 /* SentryUIRedactBuilderTests+ReactNative.swift */; };
774773
D44B16722DE464AD006DBDB3 /* TestDispatchFactoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D44B16712DE464A9006DBDB3 /* TestDispatchFactoryTests.swift */; };
@@ -2551,7 +2550,6 @@
25512550
buildActionMask = 2147483647;
25522551
files = (
25532552
8431F01C29B2854200D8DC56 /* libSentryTestUtils.a in Frameworks */,
2554-
D43C1BE82E8FB85400CD5D67 /* SnapshotTesting in Frameworks */,
25552553
D84DAD592B1742C1003CF120 /* SentryTestUtilsDynamic.framework in Frameworks */,
25562554
63AA766A1EB8CB2F00D153DE /* Sentry.framework in Frameworks */,
25572555
);
@@ -5392,7 +5390,6 @@
53925390
);
53935391
name = SentryTests;
53945392
packageProductDependencies = (
5395-
D43C1BE72E8FB85400CD5D67 /* SnapshotTesting */,
53965393
);
53975394
productName = "Tests-iOS";
53985395
productReference = 63AA76651EB8CB2F00D153DE /* SentryTests.xctest */;
@@ -5565,7 +5562,6 @@
55655562
);
55665563
mainGroup = 6327C5C91EB8A783004E799B;
55675564
packageReferences = (
5568-
D43C1BE62E8FB85400CD5D67 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */,
55695565
);
55705566
productRefGroup = 6327C5D41EB8A783004E799B /* Products */;
55715567
projectDirPath = "";
@@ -8385,25 +8381,6 @@
83858381
defaultConfigurationName = Release;
83868382
};
83878383
/* End XCConfigurationList section */
8388-
8389-
/* Begin XCRemoteSwiftPackageReference section */
8390-
D43C1BE62E8FB85400CD5D67 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */ = {
8391-
isa = XCRemoteSwiftPackageReference;
8392-
repositoryURL = "https://github.com/pointfreeco/swift-snapshot-testing";
8393-
requirement = {
8394-
kind = upToNextMajorVersion;
8395-
minimumVersion = 1.18.7;
8396-
};
8397-
};
8398-
/* End XCRemoteSwiftPackageReference section */
8399-
8400-
/* Begin XCSwiftPackageProductDependency section */
8401-
D43C1BE72E8FB85400CD5D67 /* SnapshotTesting */ = {
8402-
isa = XCSwiftPackageProductDependency;
8403-
package = D43C1BE62E8FB85400CD5D67 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */;
8404-
productName = SnapshotTesting;
8405-
};
8406-
/* End XCSwiftPackageProductDependency section */
84078384
};
84088385
rootObject = 6327C5CA1EB8A783004E799B /* Project object */;
84098386
}

Tests/SentryTests/ViewCapture/SentryUIRedactBuilderTests+Common.swift

Lines changed: 0 additions & 122 deletions
Large diffs are not rendered by default.

Tests/SentryTests/ViewCapture/SentryUIRedactBuilderTests+ReactNative.swift

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import PDFKit
55
import SafariServices
66
@_spi(Private) @testable import Sentry
77
import SentryTestUtils
8-
import SnapshotTesting
98
import SwiftUI
109
import UIKit
1110
import WebKit
@@ -64,11 +63,8 @@ class SentryUIRedactBuilderTests_ReactNative: SentryUIRedactBuilderTests { // sw
6463
// -- Act --
6564
let sut = getSut(maskAllText: true, maskAllImages: true)
6665
let result = sut.redactRegionsFor(view: rootView)
67-
let masked = createMaskedScreenshot(view: rootView, regions: result)
6866

6967
// -- Assert --
70-
assertSnapshot(of: masked, as: .image)
71-
7268
let region = try XCTUnwrap(result.element(at: 0))
7369
// The text color of UITextView is not used for redaction
7470
XCTAssertNil(region.color)
@@ -87,10 +83,8 @@ class SentryUIRedactBuilderTests_ReactNative: SentryUIRedactBuilderTests { // sw
8783
// -- Act --
8884
let sut = getSut(maskAllText: false, maskAllImages: true)
8985
let result = sut.redactRegionsFor(view: rootView)
90-
let masked = createMaskedScreenshot(view: rootView, regions: result)
9186

9287
// -- Assert --
93-
assertSnapshot(of: masked, as: .image)
9488
XCTAssertEqual(result.count, 0)
9589
}
9690

@@ -101,10 +95,8 @@ class SentryUIRedactBuilderTests_ReactNative: SentryUIRedactBuilderTests { // sw
10195
// -- Act --
10296
let sut = getSut(maskAllText: true, maskAllImages: false)
10397
let result = sut.redactRegionsFor(view: rootView)
104-
let masked = createMaskedScreenshot(view: rootView, regions: result)
10598

10699
// -- Assert --
107-
assertSnapshot(of: masked, as: .image)
108100
XCTAssertEqual(result.count, 1)
109101
}
110102

@@ -131,11 +123,8 @@ class SentryUIRedactBuilderTests_ReactNative: SentryUIRedactBuilderTests { // sw
131123
// -- Act --
132124
let sut = getSut(maskAllText: true, maskAllImages: true)
133125
let result = sut.redactRegionsFor(view: rootView)
134-
let masked = createMaskedScreenshot(view: rootView, regions: result)
135126

136127
// -- Assert --
137-
assertSnapshot(of: masked, as: .image)
138-
139128
let region = try XCTUnwrap(result.element(at: 0))
140129
// The text color of UITextView is not used for redaction
141130
XCTAssertNil(region.color)
@@ -154,10 +143,8 @@ class SentryUIRedactBuilderTests_ReactNative: SentryUIRedactBuilderTests { // sw
154143
// -- Act --
155144
let sut = getSut(maskAllText: false, maskAllImages: true)
156145
let result = sut.redactRegionsFor(view: rootView)
157-
let masked = createMaskedScreenshot(view: rootView, regions: result)
158146

159147
// -- Assert --
160-
assertSnapshot(of: masked, as: .image)
161148
XCTAssertEqual(result.count, 0)
162149
}
163150

@@ -168,10 +155,8 @@ class SentryUIRedactBuilderTests_ReactNative: SentryUIRedactBuilderTests { // sw
168155
// -- Act --
169156
let sut = getSut(maskAllText: true, maskAllImages: false)
170157
let result = sut.redactRegionsFor(view: rootView)
171-
let masked = createMaskedScreenshot(view: rootView, regions: result)
172158

173159
// -- Assert --
174-
assertSnapshot(of: masked, as: .image)
175160
XCTAssertEqual(result.count, 1)
176161
}
177162

@@ -196,11 +181,8 @@ class SentryUIRedactBuilderTests_ReactNative: SentryUIRedactBuilderTests { // sw
196181
// -- Act --
197182
let sut = getSut(maskAllText: true, maskAllImages: true)
198183
let result = sut.redactRegionsFor(view: rootView)
199-
let masked = createMaskedScreenshot(view: rootView, regions: result)
200184

201185
// -- Assert --
202-
assertSnapshot(of: masked, as: .image)
203-
204186
let region = try XCTUnwrap(result.element(at: 0))
205187
// The text color of UITextView is not used for redaction
206188
XCTAssertNil(region.color)
@@ -219,10 +201,8 @@ class SentryUIRedactBuilderTests_ReactNative: SentryUIRedactBuilderTests { // sw
219201
// -- Act --
220202
let sut = getSut(maskAllText: true, maskAllImages: false)
221203
let result = sut.redactRegionsFor(view: rootView)
222-
let masked = createMaskedScreenshot(view: rootView, regions: result)
223204

224205
// -- Assert --
225-
assertSnapshot(of: masked, as: .image)
226206
XCTAssertEqual(result.count, 0)
227207
}
228208

@@ -233,10 +213,8 @@ class SentryUIRedactBuilderTests_ReactNative: SentryUIRedactBuilderTests { // sw
233213
// -- Act --
234214
let sut = getSut(maskAllText: false, maskAllImages: true)
235215
let result = sut.redactRegionsFor(view: rootView)
236-
let masked = createMaskedScreenshot(view: rootView, regions: result)
237216

238217
// -- Assert --
239-
assertSnapshot(of: masked, as: .image)
240218
XCTAssertEqual(result.count, 1)
241219
}
242220
}

Tests/SentryTests/ViewCapture/SentryUIRedactBuilderTests.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ class SentryUIRedactBuilderTests: XCTestCase {
5555

5656
// MARK: - Helper Methods
5757

58-
func createMaskedScreenshot(view: UIView, regions: [SentryRedactRegion]) -> UIImage {
59-
let image = SentryViewRendererV2(enableFastViewRendering: true).render(view: view)
60-
return SentryMaskRendererV2().maskScreenshot(screenshot: image, size: view.bounds.size, masking: regions)
61-
}
62-
6358
/// Creates a fake instance of a view for tests.
6459
///
6560
/// This function is used for views that cannot be instantiated normally (e.g., unavailable initializers).

0 commit comments

Comments
 (0)