Latest 0.0.6
License MIT
Platforms ios
Frameworks XCTest


Snapshot 1.0 uses UITesting – so this no longer applies.

Use HSTestingBackchannel instead

Use UIAutomation without the pain of UIAutomation

Snapshot is awesome.

However it drives your app using Apple’s UIAutomation which is brittle and painful (and another thing you have to learn).

If you want to drive your app for Snapshot – and don’t care about proper UIAutomation, then this class is for you.

NB: This is not ‘real’ UIAutomation. It is not a way to test your code, just an easy way to script your app to generate screenshots.


  1. As described in the Snapshot
    documentation, make sure you have
    defined SNAPSHOT as true.

    e.g. in your Snapfile

    custom_build_args "GCC_PREPROCESSOR_DEFINITIONS='$(inherited) SNAPSHOT=1'"

    or use a prefix file and

    #define SNAPSHOT true
  2. In your App Delegate, install the

    This will install a 1 pixel text field behind your views on your main window. UIAutomation can then change the text field in order to trigger notifications.

    #import <HSUIAutomationCheat/HSUIAutomationCheat.h>
    (and then in application:didFinishLaunchingWithOptions:)
    #ifdef SNAPSHOT
        [HSUIAutomationCheat installForWindow:mainWindow];
  3. Add an extra helper function to SnapshotHelper.js

    function sendNotification(name) {



  4. Send notifications from your

    Anywhere in your snapshot.js you can send a notification to your app

  5. Respond to notifications within your

    within your app, a standard NSNotification named @"SnapDisplayMyScreen" will be broadcast.

    you can use the SNAPSHOT define to handle this with custom code

    #ifdef SNAPSHOT
        [[NSNotificationCenter defaultCenter] addObserver:self


Install with CocoaPods

pod 'HSUIAutomationCheat', '~> 0.0'

or download the class and add it to your project.

Latest podspec

    "name": "HSUIAutomationCheat",
    "version": "0.0.6",
    "deprecated": true,
    "deprecated_in_favor_of": "HSTestingBackchannel",
    "summary": "Drive your app using UIAutomation - painlessly",
    "description": "Snapshot makes it easy to automate snapshots in multiple languages, but it requires apple's painful UIAutomation.nnThis class bypasses UIAutomation to let you drive your app with notifications.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Rob": "[email protected]"
    "platforms": {
        "ios": null
    "source": {
        "git": "",
        "tag": "0.0.6"
    "source_files": [
    "exclude_files": "Classes/Exclude",
    "frameworks": "XCTest"

Pin It on Pinterest

Share This