This is a project to demonstrate how screenshot testing works and how to setup and configure in your iOS project.
Take a look at the documentation at https://github.com/uber/ios-snapshot-test-case
- Create a Project with Unit Test Target
- Run
pod init
(make sure you have the latests cocoapods) - Open
Podfile
and paste the following
target 'YourProjectNameTests' do
inherit! :search_paths
pod 'iOSSnapshotTestCase'
end
-
Run
pod install
-
Add the following Environment Variables in your Project
Name | Value |
---|---|
FB_REFERENCE_IMAGE_DIR |
$(SOURCE_ROOT)/$(PROJECT_NAME)Tests/ReferenceImages |
IMAGE_DIFF_DIR |
$(SOURCE_ROOT)/$(PROJECT_NAME)Tests/FailureDiffs |
Of course you can set any folder you want inside your project, depending on where you want to save your Reference Images that will be created from Screenshot Testing.
We have created some combination functions that takes care to test multiple devices and even multiple themes. With those configurations you will make sure that you cover Minor and Edge Cases that can stretch your UI and also creating images can make a lot easier the communication with the Designer of the App to confirm the final UIViews created.
You can find the configuration files here