From ebcc98d21f0c84c875db6ef912efe81348d0e12d Mon Sep 17 00:00:00 2001 From: Fabian Canas Date: Mon, 30 Jan 2017 20:35:37 -0500 Subject: [PATCH] Fix text entry tests with typing prediction taps --- .travis.yml | 3 ++- ExemplaryUITests/TestFullSuite.m | 7 +++++-- ExemplaryUITests/TextInput.m | 4 +++- README.md | 8 ++++---- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5c57ab4..8bf6076 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ osx_image: xcode8.2 language: objective-c -script: xcodebuild -project Formulary.xcodeproj/ -scheme Formulary -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=10.2' test +script: + - xcodebuild -project Formulary.xcodeproj/ -scheme Formulary -sdk iphonesimulator -destination 'platform=iOS Simulator,id=DB794781-65A7-4884-8D00-AAC3CBD39A44,OS=10.2' test diff --git a/ExemplaryUITests/TestFullSuite.m b/ExemplaryUITests/TestFullSuite.m index d9715ba..3e8d01e 100644 --- a/ExemplaryUITests/TestFullSuite.m +++ b/ExemplaryUITests/TestFullSuite.m @@ -27,7 +27,10 @@ - (void)testFullExampleForm XCUIElementQuery *tablesQuery = app.tables; [tablesQuery.textFields[@"Name"] tap]; [tablesQuery.textFields[@"Name"] typeText:@"Testy"]; - XCTAssertTrue(tablesQuery.textFields[@"Name, Testy"].exists); + + [[[XCUIApplication alloc] init].keyboards.otherElements[@"Typing Predictions"].otherElements[@"\u201cTesty\u201d"] tap]; + + XCTAssertTrue(tablesQuery.textFields[@"Name, Testy "].exists); [tablesQuery.textFields[@"Email"] tap]; @@ -65,7 +68,7 @@ - (void)testFullExampleForm [[tablesQuery.cells containingType:XCUIElementTypeButton identifier:@"Show Values"].element tap]; XCUIElement *formValuesAlert = app.alerts[@"Form Values"]; - XCUIElement *staticTextResult = formValuesAlert.staticTexts[@"{\"name\":\"Testy\",\"likesGoats\":true,\"email\":\"Test@example.com\",\"thoughts\":\"Some thoughts\",\"favoriteNumber\":\"12\",\"Food\":[\"Ice Cream\",\"Pizza\"],\"House\":\"Ravenclaw\",\"age\":\"28\"}"]; + XCUIElement *staticTextResult = formValuesAlert.staticTexts[@"{\"name\":\"Testy \",\"likesGoats\":true,\"email\":\"Test@example.com\",\"thoughts\":\"Some thoughts\",\"favoriteNumber\":\"12\",\"Food\":[\"Ice Cream\",\"Pizza\"],\"House\":\"Ravenclaw\",\"age\":\"28\"}"]; XCTAssertTrue(staticTextResult.exists); [formValuesAlert.buttons[@"Ok"] tap]; diff --git a/ExemplaryUITests/TextInput.m b/ExemplaryUITests/TextInput.m index b384f52..383b14c 100644 --- a/ExemplaryUITests/TextInput.m +++ b/ExemplaryUITests/TextInput.m @@ -39,10 +39,12 @@ - (void)testRequiredStringValidation { [textField typeText:@"Joe"]; + [[[XCUIApplication alloc] init].keyboards.otherElements[@"Typing Predictions"].otherElements[@"\u201cJoe\u201d"] tap]; + // Drag to lose focus [[[self.tablesQuery childrenMatchingType:XCUIElementTypeCell] elementBoundByIndex:0] pressForDuration:0 thenDragToElement:[[self.tablesQuery childrenMatchingType:XCUIElementTypeCell] elementBoundByIndex:1]]; - XCTAssertTrue(self.tablesQuery.textFields[@"Name, Joe"].exists); + XCTAssertTrue(self.tablesQuery.textFields[@"Name, Joe "].exists); } - (void)testMaxMinNumericValidations diff --git a/README.md b/README.md index 8ea55d8..36fa404 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Formulary +# Formulary [![Build Status](https://travis-ci.org/fcanas/Formulary.svg?branch=master)](https://travis-ci.org/fcanas/Formulary) Formulary is a Swift library for creating dynamic, declarative, table view forms for iOS. @@ -25,7 +25,7 @@ presentViewController(formViewController, animated: true, completion: nil) -#### NSFormatters in Text Entry +#### NSFormatters in Text Entry `NSFormatter`s can be injected to format text entry or enforce valid text. In this example the number formatter will prevent the user from entering more than two decimal places, more than one decimal point, or any non-numeric characters. @@ -38,9 +38,9 @@ TextEntryFormRow(name:"Age", textType: .Decimal, formatter: decimalFormatter) #### Validations -Text entry rows can have validations. Validations are assertions about the value of a row. +Text entry rows can have validations. Validations are assertions about the value of a row. Validations show users error messages. Validation results for individual rows are aggregated to validate the overall Form. -Some Validations are provided such as `MaximumNumber`, `MinimumNumber`, and `RequiredString`. +Some Validations are provided such as `MaximumNumber`, `MinimumNumber`, and `RequiredString`. ```swift TextEntryFormRow(name:"Name", validation: RequiredString("Name"))