Stubbing out repeating animations in UI Testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import XCTest | |
| class TestCase: XCTestCase { | |
| let app = XCUIApplication() | |
| override func setUp() { | |
| super.setUp() | |
| continueAfterFailure = false | |
| app.launchArguments = ["UI-Testing"] | |
| app.launch() | |
| } | |
| func testExample() { | |
| // your tests here | |
| } | |
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| class Controller: UIViewController { | |
| override func viewDidAppear(animated: Bool) { | |
| super.viewDidAppear(animated) | |
| let options: UIViewAnimationOptions = UITesting() ? .TransitionNone : .Repeat | |
| UIView.animateWithDuration(2, delay: 0, options: options, animations: { () -> Void in | |
| // your animations here | |
| }, completion: nil) | |
| } | |
| private func UITesting() -> Bool { | |
| return NSProcessInfo.processInfo().arguments.contains("UI-TESTING") | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment