{"id":13696690,"url":"https://github.com/cashapp/AccessibilitySnapshot","last_synced_at":"2025-05-03T17:32:09.617Z","repository":{"id":36981442,"uuid":"263988036","full_name":"cashapp/AccessibilitySnapshot","owner":"cashapp","description":"Easy regression testing for iOS accessibility","archived":false,"fork":false,"pushed_at":"2024-11-07T18:55:43.000Z","size":53686,"stargazers_count":553,"open_issues_count":23,"forks_count":69,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-11-07T19:23:55.188Z","etag":null,"topics":["a11y","accessibility","accessibility-testing","ios","objective-c","snapshot-testing","swift","swiftui","switch-control","testing","uikit","voice-control","voiceover"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cashapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-14T18:00:22.000Z","updated_at":"2024-11-07T18:55:48.000Z","dependencies_parsed_at":"2023-02-12T05:01:44.083Z","dependency_job_id":"791951e6-3241-4f5e-a28f-e7e6552affe1","html_url":"https://github.com/cashapp/AccessibilitySnapshot","commit_stats":{"total_commits":174,"total_committers":22,"mean_commits":7.909090909090909,"dds":"0.41954022988505746","last_synced_commit":"4ea8cbf5e18b8b53b9a3d1b7e01a5f478483a925"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cashapp%2FAccessibilitySnapshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cashapp%2FAccessibilitySnapshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cashapp%2FAccessibilitySnapshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cashapp%2FAccessibilitySnapshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cashapp","download_url":"https://codeload.github.com/cashapp/AccessibilitySnapshot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224202875,"owners_count":17272807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a11y","accessibility","accessibility-testing","ios","objective-c","snapshot-testing","swift","swiftui","switch-control","testing","uikit","voice-control","voiceover"],"created_at":"2024-08-02T18:00:45.011Z","updated_at":"2025-05-03T17:32:09.582Z","avatar_url":"https://github.com/cashapp.png","language":"Swift","funding_links":[],"categories":["iOS"],"sub_categories":[],"readme":"# AccessibilitySnapshot\n\n[![CI Status](https://img.shields.io/github/actions/workflow/status/CashApp/AccessibilitySnapshot/ci.yml?branch=master)](https://github.com/CashApp/AccessibilitySnapshot/actions?query=workflow%3ACI+branch%3Amaster)\n[![Version](https://img.shields.io/cocoapods/v/AccessibilitySnapshot.svg?style=flat)](https://cocoapods.org/pods/AccessibilitySnapshot)\n[![License](https://img.shields.io/cocoapods/l/AccessibilitySnapshot.svg?style=flat)](https://cocoapods.org/pods/AccessibilitySnapshot)\n[![Platform](https://img.shields.io/cocoapods/p/AccessibilitySnapshot.svg?style=flat)](https://cocoapods.org/pods/AccessibilitySnapshot)\n\nAccessibilitySnapshot makes it simple to add regression tests for accessibility in iOS apps. The framework builds on the idea of snapshot testing to provide snapshots of the accessibility hierarchy.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"Documentation/Assets/HeroSample.png\"\u003e\n\u003c/p\u003e\n\n## Getting Started\n\nBy default, AccessibilitySnapshot uses [SnapshotTesting](https://github.com/pointfreeco/swift-snapshot-testing) to record snapshots and perform comparisons. The framework also includes support for using [iOSSnapshotTestCase](https://github.com/uber/ios-snapshot-test-case) as the snapshotting engine instead. Before setting up accessibility snapshot tests, make sure your project is set up for standard snapshot testing. Accessibility snapshot tests require that the test target has a host application. See the [Extensions](#extensions) section below for a list of other available snapshotting options.\n\n\u003cdetails\u003e\n\u003csummary\u003eCocoaPods\u003c/summary\u003e\n\nInstall with [CocoaPods](https://cocoapods.org) by adding the following to your `Podfile`:\n\n```ruby\npod 'AccessibilitySnapshot'\n```\n\nTo use only the core accessibility parser, add a dependency on the Core subspec alone:\n\n```ruby\npod 'AccessibilitySnapshot/Core'\n```\n\nAlternatively, if you wish to use [iOSSnapshotTestCase](https://github.com/uber/ios-snapshot-test-case) to perform image comparisons, you can add a dependency on the `iOSSnapshotTestCase` subspec instead (or in addition - you can use both in the same project):\n\n```ruby\npod 'AccessibilitySnapshot/iOSSnapshotTestCase'\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eSwift Package Manager\u003c/summary\u003e\n\nInstall with [Swift Package Manager](https://swift.org/package-manager/) by adding the following to your `Package.swift`:\n\n```swift\ndependencies: [\n    .package(name: \"AccessibilitySnapshot\", url: \"https://github.com/cashapp/AccessibilitySnapshot.git\", from: \"0.4.1\"),\n]\n```\n\nNext, add AccessibilitySnapshot as a dependency to your test target:\n\n```swift\ntargets: [\n    .target(name: \"MyApp\"),\n    .testTarget(name: \"MyAppTests\", dependencies: [\"MyApp\", \"AccessibilitySnapshot\"])\n]\n```\n\nTo use only the core accessibility parser, add a dependency on the Core library alone:\n\n```swift\ntargets: [\n    .target(name: \"MyApp\"),\n    .testTarget(name: \"MyAppTests\", dependencies: [\"MyApp\", \"AccessibilitySnapshotCore\"])\n]\n```\n\nTo use [iOSSnapshotTestCase](https://github.com/uber/ios-snapshot-test-case) to perform image comparisons, add a dependency on `FBSnapshotTestCase+Accessibility` for Swift testing or `FBSnapshotTestCase+Accessibility-ObjC` for Objective-C.\n\n```swift\ntargets: [\n    .target(name: \"MyApp\"),\n    .testTarget(name: \"MyAppTests\", dependencies: [\"MyApp\", \"FBSnapshotTestCase+Accessibility\"])\n]\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eCarthage\u003c/summary\u003e\n\nOnly the core accessibility parser (not the snapshot integration layers) can be installed via Carthage. To install AccessibilitySnapshotCore via [Carthage](https://github.com/Carthage/Carthage), add the following to your `Cartfile`:\n\n```ogdl\ngithub \"cashapp/AccessibilitySnapshot\"\n```\n\u003c/details\u003e\n\n## Usage\n\nAccessibilitySnapshot builds on top of existing snapshot frameworks to add support for snapshotting your app's accessibility. By default it uses the [SnapshotTesting](https://github.com/pointfreeco/swift-snapshot-testing) framework for snapshotting, but can be switched over to [iOSSnapshotTestCase](https://github.com/uber/ios-snapshot-test-case) as well.\n\n### Getting Started with SnapshotTesting\n\nAccessibilitySnapshot provides an `.accessibilityImage` snapshotting strategy that can be used with SnapshotTesting's snapshot assertions.\n\n```swift\nfunc testAccessibility() {\n    let view = MyView()\n    // Configure the view...\n\n    assertSnapshot(matching: view, as: .accessibilityImage)\n}\n```\n\nSnapshots can also be customized in a few ways, for example controlling when to include indicators for the accessibility activation point of each element. By default, these indicators are shown when the activation point is different than the default activation point for that view. You can override this behavior for each snapshot:\n\n```swift\nfunc testAccessibility() {\n    let view = MyView()\n    // Configure the view...\n\n    // Show indicators for every element.\n    assertSnapshot(matching: view, as: .accessibilityImage(showActivationPoints: .always))\n\n    // Don't show any indicators.\n    assertSnapshot(matching: view, as: .accessibilityImage(showActivationPoints: .never))\n}\n```\n\n### Getting Started with iOSSnapshotTestCase\n\nTo run a snapshot test, simply call the `SnapshotVerifyAccessibility` method:\n\n```swift\nfunc testAccessibility() {\n    let view = MyView()\n    // Configure the view...\n\n    SnapshotVerifyAccessibility(view)\n}\n```\n\nSince AccessibilitySnapshot is built on top of iOSSnapshotTestCase, it uses the same mechanism to record snapshots (setting the `self.recordMode` property) and supports many of the same features like device agnostic file names and specifying identifiers for each snapshot:\n\n```swift\nfunc testAccessibility() {\n    let view = MyView()\n    // Configure the view...\n\n    SnapshotVerifyAccessibility(view, identifier: \"identifier\")\n}\n```\n\nSnapshots can also optionally include indicators for the accessibility activation point of each element. By default, these indicators are shown when the activation point is different than the default activation point for that view. You can override this behavior for each snapshot:\n\n```swift\nfunc testAccessibility() {\n    let view = MyView()\n    // Configure the view...\n\n    // Show indicators for every element.\n    SnapshotVerifyAccessibility(view, showActivationPoints: .always)\n\n    // Don't show any indicators.\n    SnapshotVerifyAccessibility(view, showActivationPoints: .never)\n}\n```\n\nYou can also run accessibility snapshot tests from Objective-C:\n\n```objc\n- (void)testAccessibility;\n{\n    UIView *view = [UIView new];\n    // Configure the view...\n\n    SnapshotVerifyAccessibility(view, @\"identifier\");\n}\n```\n\n## Requirements\n\n* Xcode 13.2.1 or later\n* iOS 13.0 or later\n\n## Contributing\n\nWe love our\n[contributors](https://github.com/CashApp/AccessibilitySnapshot/graphs/contributors)!\nPlease read our [contributing guidelines](CONTRIBUTING.md) prior to submitting\na pull request.\n\n## Extensions\n\nHave you written your own extension? [Add it here](https://github.com/cashapp/AccessibilitySnapshot/edit/master/README.md) and submit a pull request!\n\n* [PlaybookAccessibilitySnapshot](https://github.com/playbook-ui/accessibility-snapshot-ios) brings accessibility snapshot testing support to [Playbook](https://github.com/playbook-ui/playbook-ios).\n\n## License\n\n```\nCopyright 2020 Square Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcashapp%2FAccessibilitySnapshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcashapp%2FAccessibilitySnapshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcashapp%2FAccessibilitySnapshot/lists"}