@@ -18,6 +18,7 @@ class RUMInstrumentationTests: XCTestCase {
18
18
featureScope: NOPFeatureScope ( ) ,
19
19
uiKitRUMViewsPredicate: UIKitRUMViewsPredicateMock ( ) ,
20
20
uiKitRUMActionsPredicate: nil ,
21
+ swiftUIRUMViewsPredicate: nil ,
21
22
longTaskThreshold: nil ,
22
23
appHangThreshold: . mockAny( ) ,
23
24
mainQueue: . main,
@@ -46,6 +47,7 @@ class RUMInstrumentationTests: XCTestCase {
46
47
featureScope: NOPFeatureScope ( ) ,
47
48
uiKitRUMViewsPredicate: nil ,
48
49
uiKitRUMActionsPredicate: UIKitRUMActionsPredicateMock ( ) ,
50
+ swiftUIRUMViewsPredicate: nil ,
49
51
longTaskThreshold: nil ,
50
52
appHangThreshold: . mockAny( ) ,
51
53
mainQueue: . main,
@@ -65,12 +67,42 @@ class RUMInstrumentationTests: XCTestCase {
65
67
}
66
68
}
67
69
70
+ func testWhenOnlySwiftUIViewsPredicateIsConfigured_itInstrumentsUIViewController( ) throws {
71
+ // When
72
+ let instrumentation = RUMInstrumentation (
73
+ featureScope: NOPFeatureScope ( ) ,
74
+ uiKitRUMViewsPredicate: nil ,
75
+ uiKitRUMActionsPredicate: nil ,
76
+ swiftUIRUMViewsPredicate: SwiftUIRUMViewsPredicateMock ( ) ,
77
+ longTaskThreshold: nil ,
78
+ appHangThreshold: . mockAny( ) ,
79
+ mainQueue: . main,
80
+ dateProvider: SystemDateProvider ( ) ,
81
+ backtraceReporter: BacktraceReporterMock ( ) ,
82
+ fatalErrorContext: FatalErrorContextNotifierMock ( ) ,
83
+ processID: . mockAny( ) ,
84
+ notificationCenter: . default,
85
+ watchdogTermination: . mockRandom( ) ,
86
+ memoryWarningMonitor: . mockRandom( )
87
+ )
88
+
89
+ // Then
90
+ withExtendedLifetime ( instrumentation) {
91
+ DDAssertActiveSwizzlings ( [
92
+ " viewDidAppear: " ,
93
+ " viewDidDisappear: " ,
94
+ ] )
95
+ XCTAssertNil ( instrumentation. longTasks)
96
+ }
97
+ }
98
+
68
99
func testWhenOnlyLongTasksThresholdIsConfigured_itInstrumentsRunLoop( ) throws {
69
100
// When
70
101
let instrumentation = RUMInstrumentation (
71
102
featureScope: NOPFeatureScope ( ) ,
72
103
uiKitRUMViewsPredicate: nil ,
73
104
uiKitRUMActionsPredicate: nil ,
105
+ swiftUIRUMViewsPredicate: nil ,
74
106
longTaskThreshold: 0.5 ,
75
107
appHangThreshold: . mockAny( ) ,
76
108
mainQueue: . main,
@@ -99,6 +131,7 @@ class RUMInstrumentationTests: XCTestCase {
99
131
featureScope: NOPFeatureScope ( ) ,
100
132
uiKitRUMViewsPredicate: nil ,
101
133
uiKitRUMActionsPredicate: nil ,
134
+ swiftUIRUMViewsPredicate: nil ,
102
135
longTaskThreshold: . mockRandom( min: - 100 , max: 0 ) ,
103
136
appHangThreshold: . mockAny( ) ,
104
137
mainQueue: . main,
@@ -123,6 +156,7 @@ class RUMInstrumentationTests: XCTestCase {
123
156
featureScope: NOPFeatureScope ( ) ,
124
157
uiKitRUMViewsPredicate: nil ,
125
158
uiKitRUMActionsPredicate: nil ,
159
+ swiftUIRUMViewsPredicate: nil ,
126
160
longTaskThreshold: . mockRandom( min: - 100 , max: 0 ) ,
127
161
appHangThreshold: 2 ,
128
162
mainQueue: . main,
@@ -147,6 +181,7 @@ class RUMInstrumentationTests: XCTestCase {
147
181
featureScope: NOPFeatureScope ( ) ,
148
182
uiKitRUMViewsPredicate: nil ,
149
183
uiKitRUMActionsPredicate: nil ,
184
+ swiftUIRUMViewsPredicate: nil ,
150
185
longTaskThreshold: . mockRandom( min: - 100 , max: 0 ) ,
151
186
appHangThreshold: nil ,
152
187
mainQueue: . main,
@@ -171,6 +206,7 @@ class RUMInstrumentationTests: XCTestCase {
171
206
featureScope: NOPFeatureScope ( ) ,
172
207
uiKitRUMViewsPredicate: UIKitRUMViewsPredicateMock ( ) ,
173
208
uiKitRUMActionsPredicate: UIKitRUMActionsPredicateMock ( ) ,
209
+ swiftUIRUMViewsPredicate: nil ,
174
210
longTaskThreshold: 0.5 ,
175
211
appHangThreshold: 2 ,
176
212
mainQueue: . main,
0 commit comments