@@ -70,7 +70,7 @@ class NavigationProtectionIntegrationTests: XCTestCase {
70
70
let url = URL ( string: " https://privacy-test-pages.site/privacy-protections/amp/ " ) !
71
71
_= try await tab. setUrl ( url, source: . link) ? . result. get ( )
72
72
73
- let itemsCount = try await tab. webView. evaluateJavaScript ( " document.getElementsByTagName('li').length " ) as? Int ?? 0
73
+ let itemsCount = try await tab. webView. evaluateJavaScript ( " document.getElementsByTagName('li').length " ) as Int ? ?? 0
74
74
XCTAssertTrue ( itemsCount > 0 , " no items " )
75
75
76
76
// go through links on the page
@@ -82,8 +82,8 @@ class NavigationProtectionIntegrationTests: XCTestCase {
82
82
}
83
83
84
84
// extract "Expected" URL
85
- guard let name = try await tab. webView. evaluateJavaScript ( " document.getElementsByTagName('li')[ \( i) ].getElementsByTagName('a')[0].innerText " ) as? String ,
86
- let expected = try await tab. webView. evaluateJavaScript ( " document.getElementsByTagName('li')[ \( i) ].getElementsByClassName('expected')[0].innerText " ) as? String ,
85
+ guard let name: String = try await tab. webView. evaluateJavaScript ( " document.getElementsByTagName('li')[ \( i) ].getElementsByTagName('a')[0].innerText " ) ,
86
+ let expected: String = try await tab. webView. evaluateJavaScript ( " document.getElementsByTagName('li')[ \( i) ].getElementsByClassName('expected')[0].innerText " ) ,
87
87
let expectedUrl = URL ( string: expected. lowercased ( ) . dropping ( prefix: " expected: " ) )
88
88
else {
89
89
XCTFail ( " Could not parse element at \( i) " )
@@ -121,7 +121,7 @@ class NavigationProtectionIntegrationTests: XCTestCase {
121
121
} . timeout ( 10 , " # \( i + 1 ) \( name) " ) . first ( ) . promise ( )
122
122
123
123
// click
124
- _ = try await tab. webView. evaluateJavaScript ( " (function() { document.getElementsByTagName('li')[ \( i) ].getElementsByTagName('a')[0].click(); return true })() " )
124
+ try await tab. webView. evaluateJavaScript ( " (function() { document.getElementsByTagName('li')[ \( i) ].getElementsByTagName('a')[0].click(); })() " ) as Void ?
125
125
// get the NavigationAction url
126
126
let resultUrl = try await navigationWillStartPromise. value
127
127
@@ -154,7 +154,7 @@ class NavigationProtectionIntegrationTests: XCTestCase {
154
154
_= try await tab. setUrl ( url, source: . link) ? . result. get ( )
155
155
156
156
// run test
157
- _ = try await tab. webView. evaluateJavaScript ( " (function() { document.getElementById('start').click(); return true })() " )
157
+ try await tab. webView. evaluateJavaScript ( " (function() { document.getElementById('start').click(); })() " ) as Void ?
158
158
159
159
_= try await Future < Void , Never > { promise in
160
160
onDidFinish = { _ in
@@ -171,7 +171,7 @@ class NavigationProtectionIntegrationTests: XCTestCase {
171
171
let downloadTaskPromise = FileDownloadManager . shared. downloadsPublisher. timeout ( 5 ) . first ( ) . promise ( )
172
172
for i in 0 ... 4 {
173
173
do {
174
- _ = try await tab. webView. evaluateJavaScript ( " (function() { document.getElementById('download').click(); return true })() " )
174
+ try await tab. webView. evaluateJavaScript ( " (function() { document.getElementById('download').click(); })() " ) as Void ?
175
175
try await Task . sleep ( nanoseconds: 300 . asNanos)
176
176
break
177
177
} catch {
@@ -229,7 +229,7 @@ class NavigationProtectionIntegrationTests: XCTestCase {
229
229
. promise ( )
230
230
231
231
// run test
232
- _ = try await tab. webView. evaluateJavaScript ( " (function() { document.getElementById('start').click(); return true })() " )
232
+ try await tab. webView. evaluateJavaScript ( " (function() { document.getElementById('start').click(); })() " ) as Void ?
233
233
234
234
// await for popup to open and close
235
235
_= try await comingBackToFirstTabPromise. value
@@ -256,7 +256,7 @@ class NavigationProtectionIntegrationTests: XCTestCase {
256
256
let persistor = DownloadsPreferencesUserDefaultsPersistor ( )
257
257
persistor. selectedDownloadLocation = FileManager . default. temporaryDirectory. absoluteString
258
258
let downloadTaskFuture = FileDownloadManager . shared. downloadsPublisher. timeout ( 5 ) . first ( ) . promise ( )
259
- _ = try await tab. webView. evaluateJavaScript ( " (function() { document.getElementById('download').click(); return true })() " )
259
+ try await tab. webView. evaluateJavaScript ( " (function() { document.getElementById('download').click(); })() " ) as Void ?
260
260
261
261
let fileUrl = try await downloadTaskFuture. value. output
262
262
. timeout ( 1 , scheduler: DispatchQueue . main) { . init( TimeoutError ( ) as NSError ) } . first ( ) . promise ( ) . get ( )
0 commit comments