Skip to content

Commit b1e5e0c

Browse files
committed
Add UITests with the host application
1 parent 7f7c589 commit b1e5e0c

File tree

16 files changed

+1078
-224
lines changed

16 files changed

+1078
-224
lines changed

Podfile.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ CHECKOUT OPTIONS:
1717
SPEC CHECKSUMS:
1818
Snap.swift: 278be4849c3829e9a2425709de7319cae01195b7
1919

20-
PODFILE CHECKSUM: 3256166e543086769525647c0538a4075e754f26
20+
PODFILE CHECKSUM: 6b691d0cb1537b3777105f356bce0b0ad13a65af
2121

22-
COCOAPODS: 1.5.2
22+
COCOAPODS: 1.5.3

Pods/Manifest.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Pods.xcodeproj/project.pbxproj

+240-217
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

StyledTextKit.xcodeproj/project.pbxproj

+290-3
Large diffs are not rendered by default.

StyledTextKit.xcodeproj/xcshareddata/xcschemes/StyledTextKit.xcscheme

+10
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@
3838
ReferencedContainer = "container:StyledTextKit.xcodeproj">
3939
</BuildableReference>
4040
</TestableReference>
41+
<TestableReference
42+
skipped = "NO">
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "D9C656BC216B05DE00B02C6D"
46+
BuildableName = "UITests.xctest"
47+
BlueprintName = "UITests"
48+
ReferencedContainer = "container:StyledTextKit.xcodeproj">
49+
</BuildableReference>
50+
</TestableReference>
4151
</Testables>
4252
<MacroExpansion>
4353
<BuildableReference
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1000"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "D9C656BC216B05DE00B02C6D"
18+
BuildableName = "UITests.xctest"
19+
BlueprintName = "UITests"
20+
ReferencedContainer = "container:StyledTextKit.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "D9C656BC216B05DE00B02C6D"
36+
BuildableName = "UITests.xctest"
37+
BlueprintName = "UITests"
38+
ReferencedContainer = "container:StyledTextKit.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
<MacroExpansion>
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "D9C656C8216B05F700B02C6D"
46+
BuildableName = "UITestsApp.app"
47+
BlueprintName = "UITestsApp"
48+
ReferencedContainer = "container:StyledTextKit.xcodeproj">
49+
</BuildableReference>
50+
</MacroExpansion>
51+
<AdditionalOptions>
52+
</AdditionalOptions>
53+
</TestAction>
54+
<LaunchAction
55+
buildConfiguration = "Debug"
56+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
57+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
58+
launchStyle = "0"
59+
useCustomWorkingDirectory = "NO"
60+
ignoresPersistentStateOnLaunch = "NO"
61+
debugDocumentVersioning = "YES"
62+
debugServiceExtension = "internal"
63+
allowLocationSimulation = "YES">
64+
<AdditionalOptions>
65+
</AdditionalOptions>
66+
</LaunchAction>
67+
<ProfileAction
68+
buildConfiguration = "Release"
69+
shouldUseLaunchSchemeArgsEnv = "YES"
70+
savedToolIdentifier = ""
71+
useCustomWorkingDirectory = "NO"
72+
debugDocumentVersioning = "YES">
73+
<MacroExpansion>
74+
<BuildableReference
75+
BuildableIdentifier = "primary"
76+
BlueprintIdentifier = "D9C656BC216B05DE00B02C6D"
77+
BuildableName = "UITests.xctest"
78+
BlueprintName = "UITests"
79+
ReferencedContainer = "container:StyledTextKit.xcodeproj">
80+
</BuildableReference>
81+
</MacroExpansion>
82+
</ProfileAction>
83+
<AnalyzeAction
84+
buildConfiguration = "Debug">
85+
</AnalyzeAction>
86+
<ArchiveAction
87+
buildConfiguration = "Release"
88+
revealArchiveInOrganizer = "YES">
89+
</ArchiveAction>
90+
</Scheme>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1000"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "D9C656C8216B05F700B02C6D"
18+
BuildableName = "UITestsApp.app"
19+
BlueprintName = "UITestsApp"
20+
ReferencedContainer = "container:StyledTextKit.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
<MacroExpansion>
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "D9C656C8216B05F700B02C6D"
36+
BuildableName = "UITestsApp.app"
37+
BlueprintName = "UITestsApp"
38+
ReferencedContainer = "container:StyledTextKit.xcodeproj">
39+
</BuildableReference>
40+
</MacroExpansion>
41+
<AdditionalOptions>
42+
</AdditionalOptions>
43+
</TestAction>
44+
<LaunchAction
45+
buildConfiguration = "Debug"
46+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
47+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
48+
launchStyle = "0"
49+
useCustomWorkingDirectory = "NO"
50+
ignoresPersistentStateOnLaunch = "NO"
51+
debugDocumentVersioning = "YES"
52+
debugServiceExtension = "internal"
53+
allowLocationSimulation = "YES">
54+
<BuildableProductRunnable
55+
runnableDebuggingMode = "0">
56+
<BuildableReference
57+
BuildableIdentifier = "primary"
58+
BlueprintIdentifier = "D9C656C8216B05F700B02C6D"
59+
BuildableName = "UITestsApp.app"
60+
BlueprintName = "UITestsApp"
61+
ReferencedContainer = "container:StyledTextKit.xcodeproj">
62+
</BuildableReference>
63+
</BuildableProductRunnable>
64+
<AdditionalOptions>
65+
</AdditionalOptions>
66+
</LaunchAction>
67+
<ProfileAction
68+
buildConfiguration = "Release"
69+
shouldUseLaunchSchemeArgsEnv = "YES"
70+
savedToolIdentifier = ""
71+
useCustomWorkingDirectory = "NO"
72+
debugDocumentVersioning = "YES">
73+
<BuildableProductRunnable
74+
runnableDebuggingMode = "0">
75+
<BuildableReference
76+
BuildableIdentifier = "primary"
77+
BlueprintIdentifier = "D9C656C8216B05F700B02C6D"
78+
BuildableName = "UITestsApp.app"
79+
BlueprintName = "UITestsApp"
80+
ReferencedContainer = "container:StyledTextKit.xcodeproj">
81+
</BuildableReference>
82+
</BuildableProductRunnable>
83+
</ProfileAction>
84+
<AnalyzeAction
85+
buildConfiguration = "Debug">
86+
</AnalyzeAction>
87+
<ArchiveAction
88+
buildConfiguration = "Release"
89+
revealArchiveInOrganizer = "YES">
90+
</ArchiveAction>
91+
</Scheme>

UITests/Info.plist

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>BNDL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>1</string>
21+
</dict>
22+
</plist>

UITests/UITests.swift

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import XCTest
2+
3+
class UITests: XCTestCase {
4+
override func setUp() {
5+
continueAfterFailure = false
6+
XCUIApplication().launch()
7+
}
8+
9+
override func tearDown() {
10+
}
11+
12+
func test_tapLink() {
13+
let app = XCUIApplication()
14+
let textviewElement = app.otherElements["textView"]
15+
let statelabelElement = app.otherElements["stateLabel"]
16+
17+
textviewElement.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.1))
18+
.tap()
19+
XCTAssertEqual(statelabelElement.label, "didTap: Link1")
20+
21+
textviewElement.coordinate(withNormalizedOffset: CGVector(dx: 0.1, dy: 0.4))
22+
.tap()
23+
XCTAssertEqual(statelabelElement.label, "didTap: Link2")
24+
}
25+
}

UITestsApp/AppDelegate.swift

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import UIKit
2+
3+
@UIApplicationMain
4+
class AppDelegate: UIResponder, UIApplicationDelegate {
5+
var window: UIWindow?
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "20x20",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "20x20",
11+
"scale" : "3x"
12+
},
13+
{
14+
"idiom" : "iphone",
15+
"size" : "29x29",
16+
"scale" : "2x"
17+
},
18+
{
19+
"idiom" : "iphone",
20+
"size" : "29x29",
21+
"scale" : "3x"
22+
},
23+
{
24+
"idiom" : "iphone",
25+
"size" : "40x40",
26+
"scale" : "2x"
27+
},
28+
{
29+
"idiom" : "iphone",
30+
"size" : "40x40",
31+
"scale" : "3x"
32+
},
33+
{
34+
"idiom" : "iphone",
35+
"size" : "60x60",
36+
"scale" : "2x"
37+
},
38+
{
39+
"idiom" : "iphone",
40+
"size" : "60x60",
41+
"scale" : "3x"
42+
},
43+
{
44+
"idiom" : "ipad",
45+
"size" : "20x20",
46+
"scale" : "1x"
47+
},
48+
{
49+
"idiom" : "ipad",
50+
"size" : "20x20",
51+
"scale" : "2x"
52+
},
53+
{
54+
"idiom" : "ipad",
55+
"size" : "29x29",
56+
"scale" : "1x"
57+
},
58+
{
59+
"idiom" : "ipad",
60+
"size" : "29x29",
61+
"scale" : "2x"
62+
},
63+
{
64+
"idiom" : "ipad",
65+
"size" : "40x40",
66+
"scale" : "1x"
67+
},
68+
{
69+
"idiom" : "ipad",
70+
"size" : "40x40",
71+
"scale" : "2x"
72+
},
73+
{
74+
"idiom" : "ipad",
75+
"size" : "76x76",
76+
"scale" : "1x"
77+
},
78+
{
79+
"idiom" : "ipad",
80+
"size" : "76x76",
81+
"scale" : "2x"
82+
},
83+
{
84+
"idiom" : "ipad",
85+
"size" : "83.5x83.5",
86+
"scale" : "2x"
87+
},
88+
{
89+
"idiom" : "ios-marketing",
90+
"size" : "1024x1024",
91+
"scale" : "1x"
92+
}
93+
],
94+
"info" : {
95+
"version" : 1,
96+
"author" : "xcode"
97+
}
98+
}
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}

0 commit comments

Comments
 (0)