Skip to content

Commit c384089

Browse files
authored
Merge pull request #64 from danielCarlosCE/feature/uitests
Add first UI tests
2 parents 35325d4 + 5a7668a commit c384089

File tree

4 files changed

+149
-38
lines changed

4 files changed

+149
-38
lines changed

Podfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ target 'SwiftWeather' do
55
pod 'SwiftyJSON'
66
end
77

8-
target 'SwiftWeatherTests' do
8+
abstract_target 'Tests' do
99
pod 'Quick'
1010
pod 'Nimble'
11+
12+
target 'SwiftWeatherTests'
13+
target 'SwiftWeatherUITests'
1114
end
1215

16+

SwiftWeather.xcodeproj/project.pbxproj

Lines changed: 80 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
2243FE9A2727187E86FF04FC /* Pods_SwiftWeatherTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4717075E21C23E8584AC2FB9 /* Pods_SwiftWeatherTests.framework */; };
10+
1E8FF8444E2C29BD30B867EF /* Pods_Tests_SwiftWeatherUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 418594A8DD8093A647A30E12 /* Pods_Tests_SwiftWeatherUITests.framework */; };
1111
5120F2EFC3DE077315306794 /* Pods_SwiftWeather.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF971A1BA4A6D64984CB0A75 /* Pods_SwiftWeather.framework */; };
12+
655E8966C3E09626A8221261 /* Pods_Tests_SwiftWeatherTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 342A91306F3CF92DD999C97D /* Pods_Tests_SwiftWeatherTests.framework */; };
1213
AE09C4301B9723DE00C7CCED /* LocationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE09C42F1B9723DE00C7CCED /* LocationService.swift */; };
1314
AE0DC2CD1B8E7B3900E67147 /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE0DC2CC1B8E7B3900E67147 /* Observable.swift */; };
1415
AE26CCAB1B875C2400D518CB /* ForecastView.xib in Resources */ = {isa = PBXBuildFile; fileRef = AE26CCAA1B875C2400D518CB /* ForecastView.xib */; };
@@ -58,10 +59,11 @@
5859
/* End PBXContainerItemProxy section */
5960

6061
/* Begin PBXFileReference section */
61-
2B08B7D462F3A98915CC2445 /* Pods-SwiftWeatherTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWeatherTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftWeatherTests/Pods-SwiftWeatherTests.release.xcconfig"; sourceTree = "<group>"; };
62-
4717075E21C23E8584AC2FB9 /* Pods_SwiftWeatherTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftWeatherTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
63-
5F7BA3CA9A631826379B2C68 /* Pods-SwiftWeatherTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWeatherTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftWeatherTests/Pods-SwiftWeatherTests.debug.xcconfig"; sourceTree = "<group>"; };
62+
342A91306F3CF92DD999C97D /* Pods_Tests_SwiftWeatherTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Tests_SwiftWeatherTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
63+
418594A8DD8093A647A30E12 /* Pods_Tests_SwiftWeatherUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Tests_SwiftWeatherUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
64+
53EEE101C82E858E57980710 /* Pods-Tests-SwiftWeatherUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests-SwiftWeatherUITests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Tests-SwiftWeatherUITests/Pods-Tests-SwiftWeatherUITests.release.xcconfig"; sourceTree = "<group>"; };
6465
900AFFBB41C69FC277CB0A33 /* Pods-SwiftWeather.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWeather.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftWeather/Pods-SwiftWeather.debug.xcconfig"; sourceTree = "<group>"; };
66+
919B9EF9E5898277AD9C772A /* Pods-Tests-SwiftWeatherUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests-SwiftWeatherUITests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Tests-SwiftWeatherUITests/Pods-Tests-SwiftWeatherUITests.debug.xcconfig"; sourceTree = "<group>"; };
6567
AE09C42F1B9723DE00C7CCED /* LocationService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocationService.swift; sourceTree = "<group>"; };
6668
AE0DC2CC1B8E7B3900E67147 /* Observable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Observable.swift; sourceTree = "<group>"; };
6769
AE26CCAA1B875C2400D518CB /* ForecastView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ForecastView.xib; sourceTree = "<group>"; };
@@ -89,6 +91,7 @@
8991
AEEDF68C1B9F9B2900C6067B /* Temperature.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Temperature.swift; sourceTree = "<group>"; };
9092
AEF61B271BA23B1200E8F259 /* ForecastDateTime.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ForecastDateTime.swift; sourceTree = "<group>"; };
9193
BF971A1BA4A6D64984CB0A75 /* Pods_SwiftWeather.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftWeather.framework; sourceTree = BUILT_PRODUCTS_DIR; };
94+
BFCBC7111E6F5822A73508A5 /* Pods-Tests-SwiftWeatherTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests-SwiftWeatherTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Tests-SwiftWeatherTests/Pods-Tests-SwiftWeatherTests.debug.xcconfig"; sourceTree = "<group>"; };
9295
CAB56A3D23F4A93BB599E4BA /* WeatherServiceProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WeatherServiceProtocol.swift; sourceTree = "<group>"; };
9396
CAB56D46471CA243B1FD646F /* OpenWeatherMapService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenWeatherMapService.swift; sourceTree = "<group>"; };
9497
E835C39D4B929F35B6A57B12 /* Pods-SwiftWeather.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWeather.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftWeather/Pods-SwiftWeather.release.xcconfig"; sourceTree = "<group>"; };
@@ -99,6 +102,7 @@
99102
F3897F811C118F0A001609E2 /* TemperatureSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TemperatureSpec.swift; sourceTree = "<group>"; };
100103
F3897F831C11911B001609E2 /* WeatherIconSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WeatherIconSpec.swift; sourceTree = "<group>"; };
101104
F3FADA1A1C1327CB006D8551 /* WeatherBuilderSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WeatherBuilderSpec.swift; sourceTree = "<group>"; };
105+
F4007F80070D3AAE1C564D8D /* Pods-Tests-SwiftWeatherTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests-SwiftWeatherTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Tests-SwiftWeatherTests/Pods-Tests-SwiftWeatherTests.release.xcconfig"; sourceTree = "<group>"; };
102106
/* End PBXFileReference section */
103107

104108
/* Begin PBXFrameworksBuildPhase section */
@@ -114,14 +118,15 @@
114118
isa = PBXFrameworksBuildPhase;
115119
buildActionMask = 2147483647;
116120
files = (
117-
2243FE9A2727187E86FF04FC /* Pods_SwiftWeatherTests.framework in Frameworks */,
121+
655E8966C3E09626A8221261 /* Pods_Tests_SwiftWeatherTests.framework in Frameworks */,
118122
);
119123
runOnlyForDeploymentPostprocessing = 0;
120124
};
121125
AECBA5FE1B836BF20004A536 /* Frameworks */ = {
122126
isa = PBXFrameworksBuildPhase;
123127
buildActionMask = 2147483647;
124128
files = (
129+
1E8FF8444E2C29BD30B867EF /* Pods_Tests_SwiftWeatherUITests.framework in Frameworks */,
125130
);
126131
runOnlyForDeploymentPostprocessing = 0;
127132
};
@@ -132,7 +137,8 @@
132137
isa = PBXGroup;
133138
children = (
134139
BF971A1BA4A6D64984CB0A75 /* Pods_SwiftWeather.framework */,
135-
4717075E21C23E8584AC2FB9 /* Pods_SwiftWeatherTests.framework */,
140+
342A91306F3CF92DD999C97D /* Pods_Tests_SwiftWeatherTests.framework */,
141+
418594A8DD8093A647A30E12 /* Pods_Tests_SwiftWeatherUITests.framework */,
136142
);
137143
name = Frameworks;
138144
sourceTree = "<group>";
@@ -276,8 +282,10 @@
276282
children = (
277283
900AFFBB41C69FC277CB0A33 /* Pods-SwiftWeather.debug.xcconfig */,
278284
E835C39D4B929F35B6A57B12 /* Pods-SwiftWeather.release.xcconfig */,
279-
5F7BA3CA9A631826379B2C68 /* Pods-SwiftWeatherTests.debug.xcconfig */,
280-
2B08B7D462F3A98915CC2445 /* Pods-SwiftWeatherTests.release.xcconfig */,
285+
BFCBC7111E6F5822A73508A5 /* Pods-Tests-SwiftWeatherTests.debug.xcconfig */,
286+
F4007F80070D3AAE1C564D8D /* Pods-Tests-SwiftWeatherTests.release.xcconfig */,
287+
919B9EF9E5898277AD9C772A /* Pods-Tests-SwiftWeatherUITests.debug.xcconfig */,
288+
53EEE101C82E858E57980710 /* Pods-Tests-SwiftWeatherUITests.release.xcconfig */,
281289
);
282290
name = Pods;
283291
sourceTree = "<group>";
@@ -344,9 +352,12 @@
344352
isa = PBXNativeTarget;
345353
buildConfigurationList = AECBA6101B836BF20004A536 /* Build configuration list for PBXNativeTarget "SwiftWeatherUITests" */;
346354
buildPhases = (
355+
7E7F83383B6114FE2CC03BD6 /* [CP] Check Pods Manifest.lock */,
347356
AECBA5FD1B836BF20004A536 /* Sources */,
348357
AECBA5FE1B836BF20004A536 /* Frameworks */,
349358
AECBA5FF1B836BF20004A536 /* Resources */,
359+
EC9ED72913B1DE182823A53C /* [CP] Embed Pods Frameworks */,
360+
1B9DE6A0CE065E744D7CB96E /* [CP] Copy Pods Resources */,
350361
);
351362
buildRules = (
352363
);
@@ -434,6 +445,21 @@
434445
/* End PBXResourcesBuildPhase section */
435446

436447
/* Begin PBXShellScriptBuildPhase section */
448+
1B9DE6A0CE065E744D7CB96E /* [CP] Copy Pods Resources */ = {
449+
isa = PBXShellScriptBuildPhase;
450+
buildActionMask = 2147483647;
451+
files = (
452+
);
453+
inputPaths = (
454+
);
455+
name = "[CP] Copy Pods Resources";
456+
outputPaths = (
457+
);
458+
runOnlyForDeploymentPostprocessing = 0;
459+
shellPath = /bin/sh;
460+
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests-SwiftWeatherUITests/Pods-Tests-SwiftWeatherUITests-resources.sh\"\n";
461+
showEnvVarsInLog = 0;
462+
};
437463
2A25B97139655BE3B502C748 /* [CP] Check Pods Manifest.lock */ = {
438464
isa = PBXShellScriptBuildPhase;
439465
buildActionMask = 2147483647;
@@ -445,7 +471,7 @@
445471
);
446472
name = "[CP] Check Pods Manifest.lock";
447473
outputPaths = (
448-
"$(DERIVED_FILE_DIR)/Pods-SwiftWeatherTests-checkManifestLockResult.txt",
474+
"$(DERIVED_FILE_DIR)/Pods-Tests-SwiftWeatherTests-checkManifestLockResult.txt",
449475
);
450476
runOnlyForDeploymentPostprocessing = 0;
451477
shellPath = /bin/sh;
@@ -458,7 +484,7 @@
458484
files = (
459485
);
460486
inputPaths = (
461-
"${SRCROOT}/Pods/Target Support Files/Pods-SwiftWeatherTests/Pods-SwiftWeatherTests-frameworks.sh",
487+
"${SRCROOT}/Pods/Target Support Files/Pods-Tests-SwiftWeatherTests/Pods-Tests-SwiftWeatherTests-frameworks.sh",
462488
"${BUILT_PRODUCTS_DIR}/Nimble/Nimble.framework",
463489
"${BUILT_PRODUCTS_DIR}/Quick/Quick.framework",
464490
);
@@ -469,7 +495,7 @@
469495
);
470496
runOnlyForDeploymentPostprocessing = 0;
471497
shellPath = /bin/sh;
472-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftWeatherTests/Pods-SwiftWeatherTests-frameworks.sh\"\n";
498+
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests-SwiftWeatherTests/Pods-Tests-SwiftWeatherTests-frameworks.sh\"\n";
473499
showEnvVarsInLog = 0;
474500
};
475501
32518075271F3E332F6C65A9 /* [CP] Copy Pods Resources */ = {
@@ -505,6 +531,24 @@
505531
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftWeather/Pods-SwiftWeather-frameworks.sh\"\n";
506532
showEnvVarsInLog = 0;
507533
};
534+
7E7F83383B6114FE2CC03BD6 /* [CP] Check Pods Manifest.lock */ = {
535+
isa = PBXShellScriptBuildPhase;
536+
buildActionMask = 2147483647;
537+
files = (
538+
);
539+
inputPaths = (
540+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
541+
"${PODS_ROOT}/Manifest.lock",
542+
);
543+
name = "[CP] Check Pods Manifest.lock";
544+
outputPaths = (
545+
"$(DERIVED_FILE_DIR)/Pods-Tests-SwiftWeatherUITests-checkManifestLockResult.txt",
546+
);
547+
runOnlyForDeploymentPostprocessing = 0;
548+
shellPath = /bin/sh;
549+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
550+
showEnvVarsInLog = 0;
551+
};
508552
875372B40EF6130AA88D65AB /* [CP] Check Pods Manifest.lock */ = {
509553
isa = PBXShellScriptBuildPhase;
510554
buildActionMask = 2147483647;
@@ -548,7 +592,27 @@
548592
);
549593
runOnlyForDeploymentPostprocessing = 0;
550594
shellPath = /bin/sh;
551-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftWeatherTests/Pods-SwiftWeatherTests-resources.sh\"\n";
595+
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests-SwiftWeatherTests/Pods-Tests-SwiftWeatherTests-resources.sh\"\n";
596+
showEnvVarsInLog = 0;
597+
};
598+
EC9ED72913B1DE182823A53C /* [CP] Embed Pods Frameworks */ = {
599+
isa = PBXShellScriptBuildPhase;
600+
buildActionMask = 2147483647;
601+
files = (
602+
);
603+
inputPaths = (
604+
"${SRCROOT}/Pods/Target Support Files/Pods-Tests-SwiftWeatherUITests/Pods-Tests-SwiftWeatherUITests-frameworks.sh",
605+
"${BUILT_PRODUCTS_DIR}/Nimble/Nimble.framework",
606+
"${BUILT_PRODUCTS_DIR}/Quick/Quick.framework",
607+
);
608+
name = "[CP] Embed Pods Frameworks";
609+
outputPaths = (
610+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Nimble.framework",
611+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Quick.framework",
612+
);
613+
runOnlyForDeploymentPostprocessing = 0;
614+
shellPath = /bin/sh;
615+
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests-SwiftWeatherUITests/Pods-Tests-SwiftWeatherUITests-frameworks.sh\"\n";
552616
showEnvVarsInLog = 0;
553617
};
554618
/* End PBXShellScriptBuildPhase section */
@@ -768,7 +832,7 @@
768832
};
769833
AECBA60E1B836BF20004A536 /* Debug */ = {
770834
isa = XCBuildConfiguration;
771-
baseConfigurationReference = 5F7BA3CA9A631826379B2C68 /* Pods-SwiftWeatherTests.debug.xcconfig */;
835+
baseConfigurationReference = BFCBC7111E6F5822A73508A5 /* Pods-Tests-SwiftWeatherTests.debug.xcconfig */;
772836
buildSettings = {
773837
BUNDLE_LOADER = "$(TEST_HOST)";
774838
CLANG_ENABLE_MODULES = YES;
@@ -786,7 +850,7 @@
786850
};
787851
AECBA60F1B836BF20004A536 /* Release */ = {
788852
isa = XCBuildConfiguration;
789-
baseConfigurationReference = 2B08B7D462F3A98915CC2445 /* Pods-SwiftWeatherTests.release.xcconfig */;
853+
baseConfigurationReference = F4007F80070D3AAE1C564D8D /* Pods-Tests-SwiftWeatherTests.release.xcconfig */;
790854
buildSettings = {
791855
BUNDLE_LOADER = "$(TEST_HOST)";
792856
CLANG_ENABLE_MODULES = YES;
@@ -803,6 +867,7 @@
803867
};
804868
AECBA6111B836BF20004A536 /* Debug */ = {
805869
isa = XCBuildConfiguration;
870+
baseConfigurationReference = 919B9EF9E5898277AD9C772A /* Pods-Tests-SwiftWeatherUITests.debug.xcconfig */;
806871
buildSettings = {
807872
DEVELOPMENT_TEAM = "";
808873
INFOPLIST_FILE = SwiftWeatherUITests/Info.plist;
@@ -818,6 +883,7 @@
818883
};
819884
AECBA6121B836BF20004A536 /* Release */ = {
820885
isa = XCBuildConfiguration;
886+
baseConfigurationReference = 53EEE101C82E858E57980710 /* Pods-Tests-SwiftWeatherUITests.release.xcconfig */;
821887
buildSettings = {
822888
DEVELOPMENT_TEAM = "";
823889
INFOPLIST_FILE = SwiftWeatherUITests/Info.plist;

SwiftWeather/WeatherViewController.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class WeatherViewController: UIViewController {
2323
super.viewDidLoad()
2424
viewModel = WeatherViewModel()
2525
viewModel?.startLocationService()
26+
setA11yIdentifiers()
2627
}
2728

2829
override func viewWillAppear(_ animated: Bool) {
@@ -108,4 +109,13 @@ class WeatherViewController: UIViewController {
108109
}
109110
}
110111
}
111-
}
112+
113+
//MARK: Accessibility
114+
func setA11yIdentifiers() {
115+
locationLabel.accessibilityIdentifier = "a11y_current_city"
116+
iconLabel.accessibilityIdentifier = "a11y_wheather_icon"
117+
temperatureLabel.accessibilityIdentifier = "a11y_wheather_temperature"
118+
}
119+
120+
121+
}

SwiftWeatherUITests/SwiftWeatherUITests.swift

Lines changed: 53 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,67 @@
44
//
55

66
import XCTest
7+
import Quick
8+
import Nimble
79

8-
class SwiftWeatherUITests: XCTestCase {
10+
class SwiftWeatherUITests: QuickSpec {
911

10-
override func setUp() {
11-
super.setUp()
12+
override func spec() {
13+
let app = XCUIApplication()
1214

13-
// Put setup code here. This method is called before the invocation of each test method in
14-
// the class.
15+
beforeSuite {
16+
self.continueAfterFailure = false
1517

16-
// In UI tests it is usually best to stop immediately when a failure occurs.
17-
continueAfterFailure = false
18-
// UI tests must launch the application that they test. Doing this in setup will make sure
19-
// it happens for each test method.
20-
XCUIApplication().launch()
21-
}
18+
app.launch()
19+
}
20+
21+
describe("a wheather viewcontroller") {
22+
context("location service is enabled") {
23+
context("when in portrait") {
24+
beforeEach {
25+
XCUIDevice.shared.orientation = .portrait
26+
}
27+
itBehavesLike("a properly laidout wheather viewcontroller")
28+
}
2229

23-
override func tearDown() {
24-
// Put teardown code here. This method is called after the invocation of each test method
25-
// in the class.
26-
super.tearDown()
30+
context("when in landscape") {
31+
beforeEach {
32+
XCUIDevice.shared.orientation = .landscapeLeft
33+
}
34+
itBehavesLike("a properly laidout wheather viewcontroller")
35+
}
36+
}
37+
}
2738
}
39+
}
2840

29-
func testApp() {
41+
class RegularWheatherViewControllerConfiguration: QuickConfiguration {
42+
override class func configure(_ configuration: Configuration) {
3043
let app = XCUIApplication()
31-
testNumberOfElements(app)
32-
}
44+
let window = app.windows.element(boundBy: 0)
3345

34-
/* Actually test that images load...might want to find a more exact way of doing this... */
35-
func testNumberOfElements(_ app: XCUIApplication) {
36-
assert(app.staticTexts.count > 0)
37-
}
46+
sharedExamples("a properly laidout wheather viewcontroller") { (context: SharedExampleContext) in
47+
it("shows city") {
48+
let cityLabel = app.staticTexts["a11y_current_city"]
3849

50+
expect(cityLabel.exists).to(beTruthy())
51+
expect(window.frame.contains(cityLabel.frame)).to(beTruthy())
52+
}
53+
54+
it("shows wheather icon") {
55+
let wheatherIconLabel = app.staticTexts["a11y_wheather_icon"]
56+
57+
expect(wheatherIconLabel.exists).to(beTruthy())
58+
expect(window.frame.contains(wheatherIconLabel.frame)).to(beTruthy())
59+
}
60+
61+
it("shows wheather temperature") {
62+
let wheatherTemperatureLabel = app.staticTexts["a11y_wheather_temperature"]
63+
64+
expect(wheatherTemperatureLabel.exists).to(beTruthy())
65+
expect(window.frame.contains(wheatherTemperatureLabel.frame)).to(beTruthy())
66+
}
67+
}
68+
}
3969
}
70+

0 commit comments

Comments
 (0)