Skip to content

Commit 48ca61f

Browse files
committed
Reenable UI tests
1 parent 3811a99 commit 48ca61f

6 files changed

Lines changed: 31 additions & 33 deletions

File tree

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ cache:
77
- Pods
88
before_install:
99
- export LANG=en_US.UTF-8
10+
- xcrun instruments -s devices
11+
- xcrun instruments -w "iPhone 7 (10.3.1) [" || true
1012
install:
1113
- make install
1214
before_script:
1315
- xcodebuild -workspace ICInputAccessory.xcworkspace -list
1416
script:
15-
- bundle exec rake ci:build
17+
- bundle exec rake ci:test
1618
- make -B carthage
1719
- make -B docs
1820
after_script:

ICInputAccessory.xcodeproj/project.pbxproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
B548C5EE1C8EB9E2009D5AEE /* ICKeyboardDismissTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = B548C5ED1C8EB9E2009D5AEE /* ICKeyboardDismissTextField.swift */; };
2929
B56BC42E1C89A7EA00C20AD6 /* ICInputAccessory.h in Headers */ = {isa = PBXBuildFile; fileRef = B56BC42D1C89A7EA00C20AD6 /* ICInputAccessory.h */; settings = {ATTRIBUTES = (Public, ); }; };
3030
B56BC4361C89A8D800C20AD6 /* ICKeyboardDismissAccessoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56BC4351C89A8D800C20AD6 /* ICKeyboardDismissAccessoryView.swift */; };
31+
B5E619CB1F44A05B005200E1 /* ICInputAccessory.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B56BC42A1C89A7EA00C20AD6 /* ICInputAccessory.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3132
/* End PBXBuildFile section */
3233

3334
/* Begin PBXContainerItemProxy section */
@@ -47,6 +48,20 @@
4748
};
4849
/* End PBXContainerItemProxy section */
4950

51+
/* Begin PBXCopyFilesBuildPhase section */
52+
B5E619CA1F44A04A005200E1 /* Embed Frameworks */ = {
53+
isa = PBXCopyFilesBuildPhase;
54+
buildActionMask = 2147483647;
55+
dstPath = "";
56+
dstSubfolderSpec = 10;
57+
files = (
58+
B5E619CB1F44A05B005200E1 /* ICInputAccessory.framework in Embed Frameworks */,
59+
);
60+
name = "Embed Frameworks";
61+
runOnlyForDeploymentPostprocessing = 0;
62+
};
63+
/* End PBXCopyFilesBuildPhase section */
64+
5065
/* Begin PBXFileReference section */
5166
05C165FF29CCF16E184D992C /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = "<group>"; };
5267
2BF6D42E3926584426ECDFE2 /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -229,6 +244,7 @@
229244
B53376861F4436D000230739 /* Resources */,
230245
9192772A7DBF8B1D3D564448 /* [CP] Embed Pods Frameworks */,
231246
B00B735ECB485DFE7B769A68 /* [CP] Copy Pods Resources */,
247+
B5E619CA1F44A04A005200E1 /* Embed Frameworks */,
232248
);
233249
buildRules = (
234250
);

ICInputAccessoryUITests/ICKeyboardDismissTextFieldUITests.swift

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,24 @@ import XCTest
2828

2929
class ICKeyboardDismissTextFieldUITests: XCTestCase {
3030

31+
private lazy var app = XCUIApplication()
32+
3133
override func setUp() {
3234
super.setUp()
33-
// In UI tests it is usually best to stop immediately when a failure occurs.
3435
continueAfterFailure = false
35-
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
3636
XCUIApplication().launch()
3737
}
3838

39-
override func tearDown() {
40-
// Put teardown code here. This method is called after the invocation of each test method in the class.
41-
super.tearDown()
42-
}
43-
4439
func testKeyboardDismissing() {
45-
let app = XCUIApplication()
46-
app.tables.cells.textFields["ICKeyboardDismissTextField"].tap()
47-
48-
let keyboardWindow = app.children(matching: .window).element(boundBy: 1)
49-
let accessory = keyboardWindow.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element(boundBy: 0)
50-
accessory.children(matching: .button).element.tap()
40+
app.tables.textFields["ICKeyboardDismissTextField"].tap()
41+
app.buttons["Dismiss Keyboard"].tap()
5142
}
5243

5344
func testStoryboard() {
54-
let app = XCUIApplication()
55-
let tablesQuery = app.tables
56-
57-
tablesQuery.buttons["Storyboard"].tap()
58-
tablesQuery.textFields["Storyboard ICKeyboardDismissTextField"].tap()
59-
60-
let keyboardWindow = app.children(matching: .window).element(boundBy: 1)
61-
let accessory = keyboardWindow.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element(boundBy: 0)
62-
accessory.children(matching: .button).element.tap()
63-
64-
tablesQuery.buttons["Back to Code"].tap()
45+
app.tables.buttons["Storyboard"].tap()
46+
app.tables.textFields["Storyboard ICKeyboardDismissTextField"].tap()
47+
app.buttons["Dismiss Keyboard"].tap()
48+
app.tables.buttons["Back to Code"].tap()
6549
}
6650

6751
}

ICInputAccessoryUITests/ICTokenFieldUITests.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,10 @@ class ICTokenFieldUITests: XCTestCase {
3030

3131
override func setUp() {
3232
super.setUp()
33-
// In UI tests it is usually best to stop immediately when a failure occurs.
3433
continueAfterFailure = false
35-
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
3634
XCUIApplication().launch()
3735
}
3836

39-
override func tearDown() {
40-
// Put teardown code here. This method is called after the invocation of each test method in the class.
41-
super.tearDown()
42-
}
43-
4437
func testTokenField() {
4538
let app = XCUIApplication()
4639
let tablesQuery = app.tables

Source/KeyboardDismissTextField/ICKeyboardDismissAccessoryView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ open class ICKeyboardDismissAccessoryView: UIView {
4848
_button.layer.cornerRadius = 4
4949
_button.layer.shouldRasterize = true
5050
_button.layer.rasterizationScale = UIScreen.main.scale
51+
_button.accessibilityLabel = "Dismiss Keyboard"
5152
return _button
5253
}()
5354

Source/KeyboardDismissTextField/ICKeyboardDismissTextField.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ open class ICKeyboardDismissTextField: UITextField {
7373

7474
private func setUpAccessoryView() {
7575
if keyboardAccessoryView == nil {
76-
keyboardAccessoryView = ICKeyboardDismissAccessoryView()
76+
// Set an initial frame for the button to appear during UI testing.
77+
let frame = CGRect(x: 0, y: 0, width: 320, height: 60)
78+
keyboardAccessoryView = ICKeyboardDismissAccessoryView(frame: frame)
7779
}
7880
}
7981

0 commit comments

Comments
 (0)