-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
The swift-snapshot-testing library has a very neat function called assertInlineSnapshot. It can be used to check strings, and it automatically inserts them. I tested it with AccessibiilitySnapshotCore and I believe it would be great addition to the library.
You can use this to test not only accessibility but also just general rough check if your views even show what they are suppose to show.
Example:
func testButton() {
let view = Button("Hello") {}
assertInlineSnapshot(of: view, as: .accessibility()) {
"""
Hello. Button.
"""
}
}I could prepare PR but perhaps it would be better to discuss it first. There are other things that are not necessary but could be helpful to include:
- Filtering, I may want to only check buttons and ignore all other elements.
- Waiting. If view does some async work we may need to wait a bit until it looks like we expect.
- Interaction. Maybe I would like to tap the button and see what happens. There is
accessibilityActivate()that simulates a tap, but of course AccessibilitySnapshotCore does not support it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels