You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
It appears we're currently stuck between a rock and a hard place when snapshotting a WKWebView on macOS.
When using Swift-Testing, in swift 5 mode, we get the concurrency warnings, but the snapshotting appears to work.
When switching to swift 6 mode and annotating the test @MainActor, the snapshotting hangs.
To Reproduce
Create a Unit Test Bundle and add swift-snapshot-testing to the dependencies of the project. Use Swift-Testing as the test framework. Create the following swift test. Use swift 5 mode.
import Testing
import WebKit
import SnapshotTesting
structMySnaphotTests{@Testfunc example()asyncthrows{letwebView=WKWebView() // Expression is 'async' but is not marked with 'await'; this is an error in the Swift 6 language mode
webView.loadHTMLString("<html><body><h1>Hello, World!</h1></body></html>", baseURL:nil) // Expression is 'async' but is not marked with 'await'; this is an error in the Swift 6 language mode
assertSnapshot(
of: webView, as:.image(size:.init(width:800, height:600)),
timeout:10)}}
Expected behavior
No concurrency warnings. Or adding @MainActor to the test and not having it hang/timeout.
Screenshots
Warnings without @MainActor
Crash with @MainActor
If applicable, add screenshots to help explain your problem.
Environment
swift-snapshot-testing version 1.18.3
Xcode 116.3
Swift 5
OS: macOS 15.2
The text was updated successfully, but these errors were encountered:
Describe the bug
It appears we're currently stuck between a rock and a hard place when snapshotting a
WKWebView
on macOS.When using Swift-Testing, in swift 5 mode, we get the concurrency warnings, but the snapshotting appears to work.
When switching to swift 6 mode and annotating the test
@MainActor
, the snapshotting hangs.To Reproduce
Create a Unit Test Bundle and add swift-snapshot-testing to the dependencies of the project. Use Swift-Testing as the test framework. Create the following swift test. Use swift 5 mode.
Expected behavior
No concurrency warnings. Or adding
@MainActor
to the test and not having it hang/timeout.Screenshots
Warnings without

@MainActor
Crash with

@MainActor
If applicable, add screenshots to help explain your problem.
Environment
The text was updated successfully, but these errors were encountered: