Created
October 7, 2016 10:31
-
-
Save odlp/69e7ad5ce77210440ff5643b804e5684 to your computer and use it in GitHub Desktop.
Segue Example Tests
This file contains hidden or 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 FirstViewController: UIViewController { | |
@IBOutlet weak var nextButton: UIButton! | |
@IBAction func didTapNextButton() { | |
performSegue(withIdentifier: "moveToSecondScreen", sender: nil) | |
} | |
} |
This file contains hidden or 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 | |
import Nimble | |
@testable import ios_segue_test_example | |
class SegueExampleTests: XCTestCase { | |
var vc: FirstViewController! | |
override func setUp() { | |
super.setUp() | |
continueAfterFailure = false | |
let storyboard = UIStoryboard(name: "Main", bundle: nil) | |
vc = storyboard.instantiateInitialViewController() as! FirstViewController | |
vc.appear() | |
} | |
func testMovingToTheNextScreen() { | |
let navVC = UINavigationController(rootViewController: vc) | |
expect(navVC.visibleViewController).to(beIdenticalTo(vc)) | |
vc.nextButton.tap() | |
expect(navVC.visibleViewController).toEventually(beAnInstanceOf(SecondViewController.self)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment