๐Ÿ“ฆ weihanglo / swift-snake

๐Ÿ“„ swift_snakeUITests.swift ยท 39 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39//
//  swift_snakeUITests.swift
//  swift-snakeUITests
//
//  Created by Weihang Lo on 7/4/16.
//  Copyright ยฉ 2016 Weihang Lo. All rights reserved.
//

import XCTest

class swift_snakeUITests: XCTestCase {
        
    override func setUp() {
        super.setUp()
        
        continueAfterFailure = false
        XCUIApplication().launch()
        XCUIDevice.shared.orientation = UIDeviceOrientation.portrait
    }
    
    override func tearDown() {
        super.tearDown()
    }
    
    func testButtonTap() {
        
        let app = XCUIApplication()
        let button = app.buttons["New Game"]
        
        XCTAssertTrue(button.isEnabled)
        button.tap()
        
        expectation(for: NSPredicate(format: "enabled == true") , evaluatedWith: button, handler: nil)
        
        waitForExpectations(timeout: 5, handler: nil)
    }
    
}