A library for generating snapshot images of components managed by Playbook with accessibility labels.
PlaybookAccessibilitySnapshot
is an extension to Playbook that uses AccessibilitySnapshot to produce snapshots with accessibility information such as activation points and labels.
final class AccessibilitySnapshotTests: XCTestCase {
func testTakeAccessibilitySnapshot() throws {
let directory = ProcessInfo.processInfo.environment["SNAPSHOT_DIR"]!
try Playbook.default.run(
AccessibilitySnapshot(
directory: URL(fileURLWithPath: directory),
clean: true,
format: .png,
keyWindow: UIApplication.shared.windows.first { $0.isKeyWindow },
devices: [.iPhone11Pro(.portrait)]
)
)
}
}
Sample | Before | After |
---|---|---|
The generated snapshot images with accessibility information can be used for more advanced visual regression testing by using a variety of third party tools.
Select Xcode menu File > Swift Packages > Add Package Dependency...
and enter repository URL with GUI.
Repository: https://github.com/playbook-ui/accessibility-snapshot-ios.git
make proj
at the root of this repository.Example/Example.xcworkspace
via Xcode.Playbook is released under the Apache 2.0 License.