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
struct SearchResultsMapViewModel { | |
init(searchLocation loc: SearchLocationDescription?, details: [GetCareProvider]) | |
func getAnnotations() -> [MKAnnotation] | |
func getProviderForAnnotation(annotation: GetCareAnnotation) -> CollectiveHealth.GetCareProvider? | |
static func configForAnnotation(annotation: GetCareAnnotation) -> CollectiveHealth.LocationDetailsTableViewModel |
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
func testAnnotationConfig() { | |
let providers = generateTestProviders() | |
let model = SearchResultsMapViewModel(searchLocation: nil, details: providers) | |
let annotation = model.getAnnotations().first as! GetCareAnnotation | |
let indexPath = NSIndexPath(forRow: 0, inSection: 0) | |
let details = SearchResultsMapViewModel.configForAnnotation(annotation) | |
XCTAssertEqual(details.title, "Bob Boberson") | |
XCTAssertEqual(details.subtitle, "Plastic Surgery") |
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
enum LaunchArguments { | |
/// Reset our defaults, deletes the persistent store, and clears | |
/// keychain on launch | |
static let ResetDefaults = "ResetDefaults" | |
/// Turn off all animations | |
static let NoAnimations = "NoAnimations" | |
/// Get Care Search Result |
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
var app: XCUIApplication! | |
override func setUp() { | |
super.setUp() | |
continueAfterFailure = false | |
app = XCUIApplication() | |
app.launchArguments = [ | |
LaunchArguments.ResetDefaults, |
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 method is called from | |
// `application(didFinishLaunchingWithOptions:)` | |
private func handleLaunchArguments() { | |
var arguments = NSProcessInfo.processInfo().arguments | |
// The first argument is the path of the executable | |
arguments.removeFirst() | |
for argument in arguments { | |
switch argument { | |
case LaunchArguments.NoAnimations: |
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
func setupSearchResults() { | |
let testBlock: OHHTTPStubsTestBlock | |
testBlock = { $0.URL?.path == "/api/v1/getcare/*" } | |
let fixture = OHPathForFile("GetCareResponse.json", self.dynamicType)! | |
successResponseBlock = { _ in | |
return OHHTTPStubsResponse( | |
fileAtPath: fixture, | |
statusCode: 200, | |
headers: ["Content-Type":"application/json"] |
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
func launchApp() { | |
app.launch() | |
// We have stubbed out the login flow to always succeed, | |
// so the password doesn't matter | |
app.secureTextFields["password_text_field"].typeText("nonsense password\n") | |
app.tabBars.buttons["get care tab button"].tap() | |
} | |
func testCurrentLocationPreSelected() { |
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
func assertExists(element: XCUIElement, timeout: NSTimeInterval = 10) { | |
expectationForPredicate(NSPredicate(format: "exists == 1"), | |
evaluatedWithObject: element, handler: nil) | |
waitForExpectationsWithTimeout(timeout, handler: nil) | |
} |
OlderNewer