Giter Club home page Giter Club logo

snapfbsnapshotbase's Introduction

SnapFBSnapshotBase

SnapFBSnapshotBase is Snapsale's customization of Facebook's snapshot test framework for iOS, FBSnapshotTestCase. It features functionality to automatically perform snapshot tests on all existing layouts for iOS devices.

Features

From FBSnapshotTestCase (quoted from their README):

  • Automatically names reference images on disk according to test class and selector.
  • Prints a descriptive error message to the console on failure. (Bonus: failure message includes a one-line command to see an image diff if you have Kaleidoscope installed.)
  • Supply an optional "identifier" if you want to perform multiple snapshots in a single test method.
  • Support for CALayer via FBSnapshotVerifyLayer.
  • isDeviceAgnostic to allow appending the device model (iPhone, iPad, iPod Touch, etc), OS version and screen size to the images (allowing to have multiple tests for the same «snapshot» for different OSs and devices).

Our customizations:

  • Write one test, run it in record mode on one device, and SnapFBSnapshotBase automatically generates snapshots for the 15 different layouts available on iOS.
  • Run a test once, on one device, and SnapFBSnapshotBase automatically compares 15 new snapshots with your 15 saved snapshots.
  • Automatic support for size classes if you specify the view being tested (sut)'s backing view controller (sutBackingViewController).

Installation

Include SnapFBSnapshotBase in your CocoaPods Podfile:

source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/skylib/SnapPods'
target "Tests" do
  pod 'SnapFBSnapshotBase'
end

Please see the FBSnapshotTestCase README for instructions on setting reference image directories.

The example app in this repo provides a simple demonstration of how to write your own tests.

Notes

SnapFBSnapshotBase will generate snapshots with the scale of the simulator device that runs the test. As of now, a comparison of a @2x snapshot and an identical @3x snapshot will fail. We therefore recommend choosing one test device or scale, and sticking with it.

License

This repository contains a customized version of software released under the BSD license. A copy of the original copyright notice is provided in the file LICENSE-FBSnapshotTestCase.

SnapFBSnapshotBase is also released under the BSD license. See the LICENSE file for more info.

snapfbsnapshotbase's People

Contributors

gautesolheim avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.