Skip to content

Commit 830e030

Browse files
committed
Snapshot tests added
1 parent 3b06d7a commit 830e030

File tree

5 files changed

+198
-1
lines changed

5 files changed

+198
-1
lines changed

TrackerApp.xcodeproj/project.pbxproj

+155-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
920B868B29AD404E00DAD3C2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 920B868929AD404E00DAD3C2 /* LaunchScreen.storyboard */; };
1515
9254FCE92A4CC80E0079F197 /* AnalyticsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9254FCE82A4CC80E0079F197 /* AnalyticsService.swift */; };
1616
9254FCEC2A4CCB0C0079F197 /* AnalyticsServiceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9254FCEB2A4CCB0C0079F197 /* AnalyticsServiceProtocol.swift */; };
17+
9254FCF72A54B2CA0079F197 /* TrackerAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9254FCF62A54B2CA0079F197 /* TrackerAppTests.swift */; };
18+
9254FD002A54B32A0079F197 /* SnapshotTesting in Frameworks */ = {isa = PBXBuildFile; productRef = 9254FCFF2A54B32A0079F197 /* SnapshotTesting */; };
1719
9256642429F03CAA00C12005 /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 9256642229F03CAA00C12005 /* Model.xcdatamodeld */; };
1820
9256642729F0407100C12005 /* UIColorMarshalling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9256642629F0407100C12005 /* UIColorMarshalling.swift */; };
1921
9256643129F0514900C12005 /* TrackerStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9256643029F0514900C12005 /* TrackerStore.swift */; };
@@ -71,6 +73,16 @@
7173
A1322D0B369D09856419CD1C /* Pods_TrackerApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49514D5B66287FEECF12E723 /* Pods_TrackerApp.framework */; };
7274
/* End PBXBuildFile section */
7375

76+
/* Begin PBXContainerItemProxy section */
77+
9254FCF82A54B2CA0079F197 /* PBXContainerItemProxy */ = {
78+
isa = PBXContainerItemProxy;
79+
containerPortal = 920B867329AD404E00DAD3C2 /* Project object */;
80+
proxyType = 1;
81+
remoteGlobalIDString = 920B867A29AD404E00DAD3C2;
82+
remoteInfo = TrackerApp;
83+
};
84+
/* End PBXContainerItemProxy section */
85+
7486
/* Begin PBXFileReference section */
7587
49514D5B66287FEECF12E723 /* Pods_TrackerApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_TrackerApp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7688
920B867B29AD404E00DAD3C2 /* TrackerApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TrackerApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -82,6 +94,8 @@
8294
920B868C29AD404E00DAD3C2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8395
9254FCE82A4CC80E0079F197 /* AnalyticsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsService.swift; sourceTree = "<group>"; };
8496
9254FCEB2A4CCB0C0079F197 /* AnalyticsServiceProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsServiceProtocol.swift; sourceTree = "<group>"; };
97+
9254FCF42A54B2CA0079F197 /* TrackerAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TrackerAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
98+
9254FCF62A54B2CA0079F197 /* TrackerAppTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackerAppTests.swift; sourceTree = "<group>"; };
8599
9256642329F03CAA00C12005 /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = "<group>"; };
86100
9256642629F0407100C12005 /* UIColorMarshalling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColorMarshalling.swift; sourceTree = "<group>"; };
87101
9256643029F0514900C12005 /* TrackerStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackerStore.swift; sourceTree = "<group>"; };
@@ -152,6 +166,14 @@
152166
);
153167
runOnlyForDeploymentPostprocessing = 0;
154168
};
169+
9254FCF12A54B2CA0079F197 /* Frameworks */ = {
170+
isa = PBXFrameworksBuildPhase;
171+
buildActionMask = 2147483647;
172+
files = (
173+
9254FD002A54B32A0079F197 /* SnapshotTesting in Frameworks */,
174+
);
175+
runOnlyForDeploymentPostprocessing = 0;
176+
};
155177
/* End PBXFrameworksBuildPhase section */
156178

157179
/* Begin PBXGroup section */
@@ -176,6 +198,7 @@
176198
isa = PBXGroup;
177199
children = (
178200
920B867D29AD404E00DAD3C2 /* TrackerApp */,
201+
9254FCF52A54B2CA0079F197 /* TrackerAppTests */,
179202
920B867C29AD404E00DAD3C2 /* Products */,
180203
3A00939230BF0A31BC3441A6 /* Pods */,
181204
2606E7E3B39CCC0CA27CE87B /* Frameworks */,
@@ -186,6 +209,7 @@
186209
isa = PBXGroup;
187210
children = (
188211
920B867B29AD404E00DAD3C2 /* TrackerApp.app */,
212+
9254FCF42A54B2CA0079F197 /* TrackerAppTests.xctest */,
189213
);
190214
name = Products;
191215
sourceTree = "<group>";
@@ -220,6 +244,14 @@
220244
path = AnalyticsService;
221245
sourceTree = "<group>";
222246
};
247+
9254FCF52A54B2CA0079F197 /* TrackerAppTests */ = {
248+
isa = PBXGroup;
249+
children = (
250+
9254FCF62A54B2CA0079F197 /* TrackerAppTests.swift */,
251+
);
252+
path = TrackerAppTests;
253+
sourceTree = "<group>";
254+
};
223255
9256642529F03CB500C12005 /* CoreData */ = {
224256
isa = PBXGroup;
225257
children = (
@@ -413,23 +445,50 @@
413445
dependencies = (
414446
);
415447
name = TrackerApp;
448+
packageProductDependencies = (
449+
);
416450
productName = TrackerApp;
417451
productReference = 920B867B29AD404E00DAD3C2 /* TrackerApp.app */;
418452
productType = "com.apple.product-type.application";
419453
};
454+
9254FCF32A54B2CA0079F197 /* TrackerAppTests */ = {
455+
isa = PBXNativeTarget;
456+
buildConfigurationList = 9254FCFA2A54B2CA0079F197 /* Build configuration list for PBXNativeTarget "TrackerAppTests" */;
457+
buildPhases = (
458+
9254FCF02A54B2CA0079F197 /* Sources */,
459+
9254FCF12A54B2CA0079F197 /* Frameworks */,
460+
9254FCF22A54B2CA0079F197 /* Resources */,
461+
);
462+
buildRules = (
463+
);
464+
dependencies = (
465+
9254FCF92A54B2CA0079F197 /* PBXTargetDependency */,
466+
);
467+
name = TrackerAppTests;
468+
packageProductDependencies = (
469+
9254FCFF2A54B32A0079F197 /* SnapshotTesting */,
470+
);
471+
productName = TrackerAppTests;
472+
productReference = 9254FCF42A54B2CA0079F197 /* TrackerAppTests.xctest */;
473+
productType = "com.apple.product-type.bundle.unit-test";
474+
};
420475
/* End PBXNativeTarget section */
421476

422477
/* Begin PBXProject section */
423478
920B867329AD404E00DAD3C2 /* Project object */ = {
424479
isa = PBXProject;
425480
attributes = {
426481
BuildIndependentTargetsInParallel = 1;
427-
LastSwiftUpdateCheck = 1340;
482+
LastSwiftUpdateCheck = 1420;
428483
LastUpgradeCheck = 1340;
429484
TargetAttributes = {
430485
920B867A29AD404E00DAD3C2 = {
431486
CreatedOnToolsVersion = 13.4.1;
432487
};
488+
9254FCF32A54B2CA0079F197 = {
489+
CreatedOnToolsVersion = 14.2;
490+
TestTargetID = 920B867A29AD404E00DAD3C2;
491+
};
433492
};
434493
};
435494
buildConfigurationList = 920B867629AD404E00DAD3C2 /* Build configuration list for PBXProject "TrackerApp" */;
@@ -442,11 +501,15 @@
442501
ru,
443502
);
444503
mainGroup = 920B867229AD404E00DAD3C2;
504+
packageReferences = (
505+
9254FCED2A54B29B0079F197 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */,
506+
);
445507
productRefGroup = 920B867C29AD404E00DAD3C2 /* Products */;
446508
projectDirPath = "";
447509
projectRoot = "";
448510
targets = (
449511
920B867A29AD404E00DAD3C2 /* TrackerApp */,
512+
9254FCF32A54B2CA0079F197 /* TrackerAppTests */,
450513
);
451514
};
452515
/* End PBXProject section */
@@ -467,6 +530,13 @@
467530
);
468531
runOnlyForDeploymentPostprocessing = 0;
469532
};
533+
9254FCF22A54B2CA0079F197 /* Resources */ = {
534+
isa = PBXResourcesBuildPhase;
535+
buildActionMask = 2147483647;
536+
files = (
537+
);
538+
runOnlyForDeploymentPostprocessing = 0;
539+
};
470540
/* End PBXResourcesBuildPhase section */
471541

472542
/* Begin PBXShellScriptBuildPhase section */
@@ -572,8 +642,24 @@
572642
);
573643
runOnlyForDeploymentPostprocessing = 0;
574644
};
645+
9254FCF02A54B2CA0079F197 /* Sources */ = {
646+
isa = PBXSourcesBuildPhase;
647+
buildActionMask = 2147483647;
648+
files = (
649+
9254FCF72A54B2CA0079F197 /* TrackerAppTests.swift in Sources */,
650+
);
651+
runOnlyForDeploymentPostprocessing = 0;
652+
};
575653
/* End PBXSourcesBuildPhase section */
576654

655+
/* Begin PBXTargetDependency section */
656+
9254FCF92A54B2CA0079F197 /* PBXTargetDependency */ = {
657+
isa = PBXTargetDependency;
658+
target = 920B867A29AD404E00DAD3C2 /* TrackerApp */;
659+
targetProxy = 9254FCF82A54B2CA0079F197 /* PBXContainerItemProxy */;
660+
};
661+
/* End PBXTargetDependency section */
662+
577663
/* Begin PBXVariantGroup section */
578664
920B868929AD404E00DAD3C2 /* LaunchScreen.storyboard */ = {
579665
isa = PBXVariantGroup;
@@ -797,6 +883,46 @@
797883
};
798884
name = Release;
799885
};
886+
9254FCFB2A54B2CA0079F197 /* Debug */ = {
887+
isa = XCBuildConfiguration;
888+
buildSettings = {
889+
BUNDLE_LOADER = "$(TEST_HOST)";
890+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
891+
CODE_SIGN_STYLE = Automatic;
892+
CURRENT_PROJECT_VERSION = 1;
893+
DEVELOPMENT_TEAM = JL5AZQCU9T;
894+
GENERATE_INFOPLIST_FILE = YES;
895+
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
896+
MARKETING_VERSION = 1.0;
897+
PRODUCT_BUNDLE_IDENTIFIER = dev.demidengo.TrackerAppTests;
898+
PRODUCT_NAME = "$(TARGET_NAME)";
899+
SWIFT_EMIT_LOC_STRINGS = NO;
900+
SWIFT_VERSION = 5.0;
901+
TARGETED_DEVICE_FAMILY = "1,2";
902+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TrackerApp.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/TrackerApp";
903+
};
904+
name = Debug;
905+
};
906+
9254FCFC2A54B2CA0079F197 /* Release */ = {
907+
isa = XCBuildConfiguration;
908+
buildSettings = {
909+
BUNDLE_LOADER = "$(TEST_HOST)";
910+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
911+
CODE_SIGN_STYLE = Automatic;
912+
CURRENT_PROJECT_VERSION = 1;
913+
DEVELOPMENT_TEAM = JL5AZQCU9T;
914+
GENERATE_INFOPLIST_FILE = YES;
915+
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
916+
MARKETING_VERSION = 1.0;
917+
PRODUCT_BUNDLE_IDENTIFIER = dev.demidengo.TrackerAppTests;
918+
PRODUCT_NAME = "$(TARGET_NAME)";
919+
SWIFT_EMIT_LOC_STRINGS = NO;
920+
SWIFT_VERSION = 5.0;
921+
TARGETED_DEVICE_FAMILY = "1,2";
922+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TrackerApp.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/TrackerApp";
923+
};
924+
name = Release;
925+
};
800926
/* End XCBuildConfiguration section */
801927

802928
/* Begin XCConfigurationList section */
@@ -818,8 +944,36 @@
818944
defaultConfigurationIsVisible = 0;
819945
defaultConfigurationName = Release;
820946
};
947+
9254FCFA2A54B2CA0079F197 /* Build configuration list for PBXNativeTarget "TrackerAppTests" */ = {
948+
isa = XCConfigurationList;
949+
buildConfigurations = (
950+
9254FCFB2A54B2CA0079F197 /* Debug */,
951+
9254FCFC2A54B2CA0079F197 /* Release */,
952+
);
953+
defaultConfigurationIsVisible = 0;
954+
defaultConfigurationName = Release;
955+
};
821956
/* End XCConfigurationList section */
822957

958+
/* Begin XCRemoteSwiftPackageReference section */
959+
9254FCED2A54B29B0079F197 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */ = {
960+
isa = XCRemoteSwiftPackageReference;
961+
repositoryURL = "https://github.com/pointfreeco/swift-snapshot-testing";
962+
requirement = {
963+
kind = exactVersion;
964+
version = 1.9.0;
965+
};
966+
};
967+
/* End XCRemoteSwiftPackageReference section */
968+
969+
/* Begin XCSwiftPackageProductDependency section */
970+
9254FCFF2A54B32A0079F197 /* SnapshotTesting */ = {
971+
isa = XCSwiftPackageProductDependency;
972+
package = 9254FCED2A54B29B0079F197 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */;
973+
productName = SnapshotTesting;
974+
};
975+
/* End XCSwiftPackageProductDependency section */
976+
823977
/* Begin XCVersionGroup section */
824978
9256642229F03CAA00C12005 /* Model.xcdatamodeld */ = {
825979
isa = XCVersionGroup;

TrackerApp.xcodeproj/xcshareddata/xcschemes/TrackerApp.xcscheme

+11
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
3030
<Testables>
31+
<TestableReference
32+
skipped = "NO"
33+
parallelizable = "YES">
34+
<BuildableReference
35+
BuildableIdentifier = "primary"
36+
BlueprintIdentifier = "9254FCF32A54B2CA0079F197"
37+
BuildableName = "TrackerAppTests.xctest"
38+
BlueprintName = "TrackerAppTests"
39+
ReferencedContainer = "container:TrackerApp.xcodeproj">
40+
</BuildableReference>
41+
</TestableReference>
3142
</Testables>
3243
</TestAction>
3344
<LaunchAction
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"pins" : [
3+
{
4+
"identity" : "swift-snapshot-testing",
5+
"kind" : "remoteSourceControl",
6+
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
7+
"state" : {
8+
"revision" : "f8a9c997c3c1dab4e216a8ec9014e23144cbab37",
9+
"version" : "1.9.0"
10+
}
11+
}
12+
],
13+
"version" : 2
14+
}

TrackerAppTests/TrackerAppTests.swift

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// TrackerAppTests.swift
3+
// TrackerAppTests
4+
//
5+
// Created by Юрий Демиденко on 04.07.2023.
6+
//
7+
8+
import XCTest
9+
import SnapshotTesting
10+
@testable import TrackerApp
11+
12+
final class TrackerAppTests: XCTestCase {
13+
14+
func testTrackersViewController() {
15+
let viewController = TrackersViewController()
16+
assertSnapshot(matching: viewController, as: .image)
17+
}
18+
}
Loading

0 commit comments

Comments
 (0)