Skip to content

Commit dd8dc2b

Browse files
committed
chore(tests): Remove snapshot testing to reduce repository size (#6631)
1 parent 6ce17f6 commit dd8dc2b

File tree

150 files changed

+17
-173
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

+17
-173
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,9 @@ current_package_diff.patch
109109

110110
uikit-check-build
111111
*.xcarchive
112+
113+
# Output of `make analyze`
114+
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
@@ -803,7 +803,6 @@
803803
D43B26D62D70964C007747FD /* SentrySpanOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = D43B26D52D709648007747FD /* SentrySpanOperation.m */; };
804804
D43B26D82D70A550007747FD /* SentryTraceOrigin.m in Sources */ = {isa = PBXBuildFile; fileRef = D43B26D72D70A54A007747FD /* SentryTraceOrigin.m */; };
805805
D43B26DA2D70A612007747FD /* SentrySpanDataKey.m in Sources */ = {isa = PBXBuildFile; fileRef = D43B26D92D70A60E007747FD /* SentrySpanDataKey.m */; };
806-
D43C1BE82E8FB85400CD5D67 /* SnapshotTesting in Frameworks */ = {isa = PBXBuildFile; productRef = D43C1BE72E8FB85400CD5D67 /* SnapshotTesting */; };
807806
D4411DD52E02B74900EA4987 /* ArrayAccessesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4411DD42E02B74100EA4987 /* ArrayAccessesTests.swift */; };
808807
D44311312EB22812006CABE4 /* SentryUIRedactBuilderTests+ReactNative.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4AF7D212E93FFCA004F0F59 /* SentryUIRedactBuilderTests+ReactNative.swift */; };
809808
D44B16722DE464AD006DBDB3 /* TestDispatchFactoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D44B16712DE464A9006DBDB3 /* TestDispatchFactoryTests.swift */; };
@@ -2538,7 +2537,6 @@
25382537
buildActionMask = 2147483647;
25392538
files = (
25402539
8431F01C29B2854200D8DC56 /* libSentryTestUtils.a in Frameworks */,
2541-
D43C1BE82E8FB85400CD5D67 /* SnapshotTesting in Frameworks */,
25422540
D84DAD592B1742C1003CF120 /* SentryTestUtilsDynamic.framework in Frameworks */,
25432541
63AA766A1EB8CB2F00D153DE /* Sentry.framework in Frameworks */,
25442542
);
@@ -5368,7 +5366,6 @@
53685366
);
53695367
name = SentryTests;
53705368
packageProductDependencies = (
5371-
D43C1BE72E8FB85400CD5D67 /* SnapshotTesting */,
53725369
);
53735370
productName = "Tests-iOS";
53745371
productReference = 63AA76651EB8CB2F00D153DE /* SentryTests.xctest */;
@@ -5539,7 +5536,6 @@
55395536
);
55405537
mainGroup = 6327C5C91EB8A783004E799B;
55415538
packageReferences = (
5542-
D43C1BE62E8FB85400CD5D67 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */,
55435539
);
55445540
productRefGroup = 6327C5D41EB8A783004E799B /* Products */;
55455541
projectDirPath = "";
@@ -8981,25 +8977,6 @@
89818977
defaultConfigurationName = Release;
89828978
};
89838979
/* End XCConfigurationList section */
8984-
8985-
/* Begin XCRemoteSwiftPackageReference section */
8986-
D43C1BE62E8FB85400CD5D67 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */ = {
8987-
isa = XCRemoteSwiftPackageReference;
8988-
repositoryURL = "https://github.com/pointfreeco/swift-snapshot-testing";
8989-
requirement = {
8990-
kind = upToNextMajorVersion;
8991-
minimumVersion = 1.18.7;
8992-
};
8993-
};
8994-
/* End XCRemoteSwiftPackageReference section */
8995-
8996-
/* Begin XCSwiftPackageProductDependency section */
8997-
D43C1BE72E8FB85400CD5D67 /* SnapshotTesting */ = {
8998-
isa = XCSwiftPackageProductDependency;
8999-
package = D43C1BE62E8FB85400CD5D67 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */;
9000-
productName = SnapshotTesting;
9001-
};
9002-
/* End XCSwiftPackageProductDependency section */
90038980
};
90048981
rootObject = 6327C5CA1EB8A783004E799B /* Project object */;
90058982
}

Tests/SentryTests/ViewCapture/SentryUIRedactBuilderTests+Common.swift

Lines changed: 11 additions & 123 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)