From 4faf06b7dea1ecc84ffeb2e7becf6fc94e3ece67 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 +++- 3 files changed, 10 insertions(+), 4 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