Skip to content

Commit

Permalink
Fix text entry tests with typing prediction taps
Browse files Browse the repository at this point in the history
  • Loading branch information
fcanas committed Feb 6, 2017
1 parent 4ad411d commit 4faf06b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 5 additions & 2 deletions ExemplaryUITests/TestFullSuite.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down Expand Up @@ -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\":\"[email protected]\",\"thoughts\":\"Some thoughts\",\"favoriteNumber\":\"12\",\"Food\":[\"Ice Cream\",\"Pizza\"],\"House\":\"Ravenclaw\",\"age\":\"28\"}"];
XCUIElement *staticTextResult = formValuesAlert.staticTexts[@"{\"name\":\"Testy \",\"likesGoats\":true,\"email\":\"[email protected]\",\"thoughts\":\"Some thoughts\",\"favoriteNumber\":\"12\",\"Food\":[\"Ice Cream\",\"Pizza\"],\"House\":\"Ravenclaw\",\"age\":\"28\"}"];
XCTAssertTrue(staticTextResult.exists);

[formValuesAlert.buttons[@"Ok"] tap];
Expand Down
4 changes: 3 additions & 1 deletion ExemplaryUITests/TextInput.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4faf06b

Please sign in to comment.