snapshot/lib/assets/SnapshotHelper.swift in fastlane-2.120.0.beta.20190330200100 vs snapshot/lib/assets/SnapshotHelper.swift in fastlane-2.120.0.beta.20190331200023
- old
+ new
@@ -16,12 +16,12 @@
import XCTest
var deviceLanguage = ""
var locale = ""
-func setupSnapshot(_ app: XCUIApplication) {
- Snapshot.setupSnapshot(app)
+func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) {
+ Snapshot.setupSnapshot(app, waitForAnimations: waitForAnimations)
}
func snapshot(_ name: String, waitForLoadingIndicator: Bool) {
if waitForLoadingIndicator {
Snapshot.snapshot(name)
@@ -61,18 +61,20 @@
}
@objcMembers
open class Snapshot: NSObject {
static var app: XCUIApplication?
+ static var waitForAnimations = true
static var cacheDirectory: URL?
static var screenshotsDirectory: URL? {
return cacheDirectory?.appendingPathComponent("screenshots", isDirectory: true)
}
- open class func setupSnapshot(_ app: XCUIApplication) {
+ open class func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) {
Snapshot.app = app
+ Snapshot.waitForAnimations = waitForAnimations
do {
let cacheDir = try pathPrefix()
Snapshot.cacheDirectory = cacheDir
setLanguage(app)
@@ -151,11 +153,13 @@
waitForLoadingIndicatorToDisappear(within: timeout)
}
print("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work
- sleep(1) // Waiting for the animation to be finished (kind of)
+ if Snapshot.waitForAnimations {
+ sleep(1) // Waiting for the animation to be finished (kind of)
+ }
#if os(OSX)
guard let app = self.app else {
print("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().")
return
@@ -289,6 +293,6 @@
}
}
// Please don't remove the lines below
// They are used to detect outdated configuration files
-// SnapshotHelperVersion [1.14]
+// SnapshotHelperVersion [1.15]