Skip to content

Commit f4f2900

Browse files
committed
Add UI tests for option selection
1 parent 9d333c9 commit f4f2900

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

ICInputAccessory.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
B52ADB1920132F0C00D96B87 /* Option.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52ADB1720132F0C00D96B87 /* Option.swift */; };
1616
B52ADB1A20132F0C00D96B87 /* OptionPickerControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52ADB1820132F0C00D96B87 /* OptionPickerControl.swift */; };
1717
B52ADB1C201332E400D96B87 /* Language.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52ADB1B201332E400D96B87 /* Language.swift */; };
18+
B52ADB1F201485B800D96B87 /* OptionPickerControlUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52ADB1D201485A700D96B87 /* OptionPickerControlUITests.swift */; };
1819
B533768B1F4436D000230739 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B533768A1F4436D000230739 /* AppDelegate.swift */; };
1920
B53376921F4436D000230739 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B53376911F4436D000230739 /* Assets.xcassets */; };
2021
B53376951F4436D000230739 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B53376931F4436D000230739 /* LaunchScreen.storyboard */; };
@@ -76,6 +77,7 @@
7677
B52ADB1720132F0C00D96B87 /* Option.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Option.swift; path = Source/OptionPickerControl/Option.swift; sourceTree = SOURCE_ROOT; };
7778
B52ADB1820132F0C00D96B87 /* OptionPickerControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OptionPickerControl.swift; path = Source/OptionPickerControl/OptionPickerControl.swift; sourceTree = SOURCE_ROOT; };
7879
B52ADB1B201332E400D96B87 /* Language.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Language.swift; sourceTree = "<group>"; };
80+
B52ADB1D201485A700D96B87 /* OptionPickerControlUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = OptionPickerControlUITests.swift; path = ICInputAccessoryUITests/OptionPickerControlUITests.swift; sourceTree = SOURCE_ROOT; };
7981
B53376881F4436D000230739 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
8082
B533768A1F4436D000230739 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
8183
B53376911F4436D000230739 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -186,6 +188,7 @@
186188
children = (
187189
B53376A11F4436D000230739 /* Info.plist */,
188190
B53376A91F4437D900230739 /* KeyboardDismissTextFieldUITests.swift */,
191+
B52ADB1D201485A700D96B87 /* OptionPickerControlUITests.swift */,
189192
B53376AA1F4437D900230739 /* TokenFieldUITests.swift */,
190193
);
191194
name = ICInputAccessoryUITests;
@@ -437,6 +440,7 @@
437440
buildActionMask = 2147483647;
438441
files = (
439442
B53376AB1F4437D900230739 /* KeyboardDismissTextFieldUITests.swift in Sources */,
443+
B52ADB1F201485B800D96B87 /* OptionPickerControlUITests.swift in Sources */,
440444
B53376AC1F4437D900230739 /* TokenFieldUITests.swift in Sources */,
441445
);
442446
runOnlyForDeploymentPostprocessing = 0;
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//
2+
// OptionPickerControlUITests.swift
3+
// ICInputAccessoryUITests
4+
//
5+
// Created by Ben on 21/01/2018.
6+
// Copyright © 2018 bcylin.
7+
//
8+
// Permission is hereby granted, free of charge, to any person obtaining a copy
9+
// of this software and associated documentation files (the "Software"), to deal
10+
// in the Software without restriction, including without limitation the rights
11+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
// copies of the Software, and to permit persons to whom the Software is
13+
// furnished to do so, subject to the following conditions:
14+
//
15+
// The above copyright notice and this permission notice shall be included in all
16+
// copies or substantial portions of the Software.
17+
//
18+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
// SOFTWARE.
25+
//
26+
27+
import XCTest
28+
29+
final class OptionPickerControlUITests: XCTestCase {
30+
31+
private lazy var app = XCUIApplication()
32+
33+
override func setUp() {
34+
super.setUp()
35+
continueAfterFailure = false
36+
XCUIApplication().launch()
37+
}
38+
39+
func testOptionSelection() {
40+
app.tables.staticTexts["(Optional)"].tap()
41+
let picker = app.pickerWheels.element
42+
43+
picker.adjust(toPickerWheelValue: "English")
44+
XCTAssert(app.tables.staticTexts["English"].exists)
45+
46+
picker.adjust(toPickerWheelValue: "French")
47+
XCTAssert(app.tables.staticTexts["French"].exists)
48+
49+
picker.adjust(toPickerWheelValue: "German")
50+
XCTAssert(app.tables.staticTexts["German"].exists)
51+
52+
picker.adjust(toPickerWheelValue: "Japanese")
53+
XCTAssert(app.tables.staticTexts["Japanese"].exists)
54+
55+
picker.adjust(toPickerWheelValue: "Mandarin")
56+
XCTAssert(app.tables.staticTexts["Mandarin"].exists)
57+
58+
picker.adjust(toPickerWheelValue: "Spanish")
59+
XCTAssert(app.tables.staticTexts["Spanish"].exists)
60+
61+
app.toolbars.buttons["Done"].tap()
62+
}
63+
64+
}

0 commit comments

Comments
 (0)