-
Notifications
You must be signed in to change notification settings - Fork 9
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
2 changed files
with
73 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// | ||
// TestFullSuite.m | ||
// Formulary | ||
// | ||
// Created by Fabian Canas on 12/30/15. | ||
// Copyright © 2015 Fabian Canas. All rights reserved. | ||
// | ||
|
||
#import <XCTest/XCTest.h> | ||
|
||
@interface TestFullSuite : XCTestCase | ||
|
||
@end | ||
|
||
@implementation TestFullSuite | ||
|
||
- (void)setUp | ||
{ | ||
[super setUp]; | ||
self.continueAfterFailure = NO; | ||
[[[XCUIApplication alloc] init] launch]; | ||
} | ||
|
||
- (void)testExample | ||
{ | ||
XCUIApplication *app = [[XCUIApplication alloc] init]; | ||
XCUIElementQuery *tablesQuery = app.tables; | ||
[tablesQuery.textFields[@"Name"] tap]; | ||
[tablesQuery.textFields[@"Name"] typeText:@"Testy"]; | ||
XCTAssertTrue(tablesQuery.textFields[@"Name, Testy"].exists); | ||
|
||
[tablesQuery.textFields[@"Email"] tap]; | ||
|
||
[tablesQuery.textFields[@"Email"] typeText:@"[email protected]"]; | ||
|
||
XCTAssertTrue(tablesQuery.textFields[@"Email, [email protected]"].exists); | ||
|
||
[tablesQuery.textFields[@"Age"] tap]; | ||
[tablesQuery.textFields[@"Age"] typeText:@"28"]; | ||
XCTAssertTrue(tablesQuery.textFields[@"Age, 28"].exists); | ||
|
||
XCUIElement *favoriteNumberTextField = tablesQuery.textFields[@"Favorite Number"]; | ||
[favoriteNumberTextField tap]; | ||
[favoriteNumberTextField typeText:@"12"]; | ||
// Drag to lose focus | ||
[[[tablesQuery childrenMatchingType:XCUIElementTypeCell] elementBoundByIndex:0] pressForDuration:0 thenDragToElement:[[tablesQuery childrenMatchingType:XCUIElementTypeCell] elementBoundByIndex:1]]; | ||
XCTAssertTrue(tablesQuery.textFields[@"Favorite Number, 12, Your favorite number must be at least 47"].exists); | ||
|
||
[tablesQuery.switches[@"Do you like goats?"] tap]; | ||
|
||
XCUIElement *otherThoughtsTextField = tablesQuery.textFields[@"Other Thoughts?"]; | ||
[otherThoughtsTextField tap]; | ||
[otherThoughtsTextField typeText:@"Some thoughts"]; | ||
|
||
[tablesQuery.staticTexts[@"Pizza"] tap]; | ||
[tablesQuery.staticTexts[@"Ice Cream"] tap]; | ||
[tablesQuery.staticTexts[@"Ice Cream"] pressForDuration:0 thenDragToElement:tablesQuery.switches[@"Do you like goats?"]]; | ||
|
||
[[tablesQuery.cells containingType:XCUIElementTypeButton identifier:@"Show Values"].element tap]; | ||
|
||
XCUIElement *formValuesAlert = app.alerts[@"Form Values"]; | ||
XCUIElement *staticTextResult = formValuesAlert.staticTexts[@"{\"likesGoats\":true,\"Food\":[\"Ice Cream\",\"Pizza\"],\"age\":\"28\",\"favoriteNumber\":\"12\",\"email\":\"[email protected]\",\"thoughts\":\"Some thoughts\",\"name\":\"Testy\"}"]; | ||
XCTAssertTrue(staticTextResult.exists); | ||
|
||
[formValuesAlert.collectionViews.buttons[@"Ok"] tap]; | ||
} | ||
|
||
@end |
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