forked from joemasilotti/UI-Testing-Cheat-Sheet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
98 additions
and
50 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// UITestCase.swift | ||
// UI Testing Cheat Sheet | ||
// | ||
// Created by Joe Masilotti on 2/18/16. | ||
// Copyright © 2016 Masilotti.com. All rights reserved. | ||
// | ||
import XCTest | ||
|
||
class UITestCase: XCTestCase { | ||
let app = XCUIApplication() | ||
|
||
override func setUp() { | ||
super.setUp() | ||
continueAfterFailure = false | ||
app.launch() | ||
} | ||
|
||
override func tearDown() { | ||
super.tearDown() | ||
app.terminate() | ||
} | ||
|
||
func waitForElementToAppear(element: XCUIElement, file: String = __FILE__, line: UInt = __LINE__) { | ||
let existsPredicate = NSPredicate(format: "exists == true") | ||
expectationForPredicate(existsPredicate, evaluatedWithObject: element, handler: nil) | ||
|
||
waitForExpectationsWithTimeout(5) { (error) -> Void in | ||
if (error != nil) { | ||
let message = "Failed to find \(element) after 5 seconds." | ||
self.recordFailureWithDescription(message, inFile: file, atLine: line, expected: true) | ||
} | ||
} | ||
} | ||
} |
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