     Snapshot.snapshot(name, waitForLoadingIndicator: waitForLoadingIndicator)
 }
 
+enum SnapshotError: Error, CustomDebugStringConvertible {
+    case cannotDetectUser
+    case cannotFindHomeDirectory
+    case cannotFindSimulatorHomeDirectory
+    case cannotAccessSimulatorHomeDirectory(String)
+    
+    var debugDescription: String {
+        switch self {
+        case .cannotDetectUser:
+            return "Couldn't find Snapshot configuration files - can't detect current user "
+        case .cannotFindHomeDirectory:
+            return "Couldn't find Snapshot configuration files - can't detect `Users` dir"
+        case .cannotFindSimulatorHomeDirectory:
+            return "Couldn't find simulator home location. Please, check SIMULATOR_HOST_HOME env variable."
+        case .cannotAccessSimulatorHomeDirectory(let simulatorHostHome):
+            return "Can't prepare environment. Simulator home location is inaccessible. Does \(simulatorHostHome) exist?"
+        }
+    }
+}
+
 open class Snapshot: NSObject {
+    static var app: XCUIApplication!
+    static var cacheDirectory: URL!
+    static var screenshotsDirectory: URL? {
+        return cacheDirectory.appendingPathComponent("screenshots", isDirectory: true)
+    }
 
     open class func setupSnapshot(_ app: XCUIApplication) {
-        setLanguage(app)
-        setLocale(app)
-        setLaunchArguments(app)
+        do {
+            let cacheDir = try pathPrefix()
+            Snapshot.cacheDirectory = cacheDir
+            Snapshot.app = app
+            setLanguage(app)
+            setLocale(app)
+            setLaunchArguments(app)
+        } catch let error {
+            print(error)
+        }
     }
 
     class func setLanguage(_ app: XCUIApplication) {
-        guard let prefix = pathPrefix() else {
-            return
-        }
-
-        let path = prefix.appendingPathComponent("language.txt")
+        let path = cacheDirectory.appendingPathComponent("language.txt")
 
         do {
             let trimCharacterSet = CharacterSet.whitespacesAndNewlines


// Please don't remove the lines below
// They are used to detect outdated configuration files
// SnapshotHelperVersion [1.4]

    }

    class func setLaunchArguments(_ app: XCUIApplication) {
        let path = cacheDirectory.appendingPathComponent("snapshot-launch_arguments.txt")
        app.launchArguments += ["-FASTLANE_SNAPSHOT", "YES", "-ui_testing"]

        do {
