Skip to content

Commit

Permalink
Test ‘Do Something’ button functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
graemer957 committed Nov 25, 2016
1 parent e7029db commit e2da2dc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions UI Testing-UITests/UI_Testing_UITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,21 @@ class UI_Testing_UITests: XCTestCase {
XCTAssertTrue(application.buttons["Do Something"].exists, "Could not find my button")
}

func testButtonTap() {
let application = XCUIApplication()
application.buttons["Do Something"].tap()

XCTAssert(application.activityIndicators.count == 1, "Spinner should be present")

let label = application.staticTexts["Hello World"]
self.expectation(for: NSPredicate(format: "exists == 1"),
evaluatedWith: label,
handler: nil)
self.expectation(for: NSPredicate(format: "count == 0"),
evaluatedWith: application.activityIndicators,
handler: nil)

self.waitForExpectations(timeout: 5, handler: nil)
}

}

0 comments on commit e2da2dc

Please sign in to comment.