Open mpivchev opened 1 year ago
Describe the bug This is the image that is generated from trying to snapshot a SwiftUI view:
I tested multiple views and this happens for all of them.
To Reproduce
This is the code in my test:
let contentView = NCCapabilitiesView(capabilitiesStatus: getCapabilitiesViewOOForPreview()) assertSnapshot(matching: contentView, as: .image)
The view shows just fine on Xcode preview and I call it the same way:
static var previews: some View { NCCapabilitiesView(capabilitiesStatus: getCapabilitiesViewOOForPreview()) }
The only way I can fix this is by specifying the frame size myself:
NCCapabilitiesView(capabilitiesStatus: getCapabilitiesViewOOForPreview()).frame(width: 300, height: 300)
I don't think this is how it's supposed to work however.
Expected behavior The snapshot image should generate properly from the SwiftUI view.
Environment
You could check this workaround: https://github.com/pointfreeco/swift-snapshot-testing/issues/368#issuecomment-698834243
Describe the bug This is the image that is generated from trying to snapshot a SwiftUI view:
I tested multiple views and this happens for all of them.
To Reproduce
This is the code in my test:
The view shows just fine on Xcode preview and I call it the same way:
The only way I can fix this is by specifying the frame size myself:
I don't think this is how it's supposed to work however.
Expected behavior The snapshot image should generate properly from the SwiftUI view.
Environment