Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 08e963c

Browse files
committedJun 2, 2019
Added Fastlane default config with new UI Test target
1 parent 816b6a9 commit 08e963c

File tree

9 files changed

+731
-1
lines changed

9 files changed

+731
-1
lines changed
 

‎Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source "https://rubygems.org"
2+
3+
gem "fastlane"

‎SmartWallet.xcodeproj/project.pbxproj

+131-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
CD397BD0207AC3B400103E5C /* ChooseCurrencyTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD397BCF207AC3B400103E5C /* ChooseCurrencyTableViewController.swift */; };
2828
CD397BD4207D79CF00103E5C /* PickerBasedTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD397BD3207D79CF00103E5C /* PickerBasedTextField.swift */; };
2929
CD43CD502288D66A0020EEC0 /* StoreReviewHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD43CD4F2288D66A0020EEC0 /* StoreReviewHelper.swift */; };
30+
CD49222622A47B72003DB2EE /* SmartWalletUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD49222522A47B72003DB2EE /* SmartWalletUITests.swift */; };
31+
CD49222E22A47CF0003DB2EE /* SnapshotHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD49222D22A47CF0003DB2EE /* SnapshotHelper.swift */; };
3032
CD51D99520A7A618003791E1 /* AddModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD51D99420A7A618003791E1 /* AddModel.swift */; };
3133
CD86E77A2041A62D0007F817 /* CategoriesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD86E7792041A62D0007F817 /* CategoriesViewController.swift */; };
3234
CDAF4ECD207846EA00392459 /* GeneralHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDAF4ECC207846EA00392459 /* GeneralHelper.swift */; };
@@ -45,6 +47,16 @@
4547
CDEBB2AD2017E350009ED68F /* Records+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDEBB2A72017E350009ED68F /* Records+CoreDataProperties.swift */; };
4648
/* End PBXBuildFile section */
4749

50+
/* Begin PBXContainerItemProxy section */
51+
CD49222822A47B72003DB2EE /* PBXContainerItemProxy */ = {
52+
isa = PBXContainerItemProxy;
53+
containerPortal = CD0F710E2014D378000B2BCD /* Project object */;
54+
proxyType = 1;
55+
remoteGlobalIDString = CD0F71152014D379000B2BCD;
56+
remoteInfo = SmartWallet;
57+
};
58+
/* End PBXContainerItemProxy section */
59+
4860
/* Begin PBXFileReference section */
4961
8989CB5E46A29FD42343368F /* Pods_SmartWallet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SmartWallet.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5062
9FE1EC0EBB3B261BDFCA12B7 /* Pods-SmartWallet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SmartWallet.release.xcconfig"; path = "Pods/Target Support Files/Pods-SmartWallet/Pods-SmartWallet.release.xcconfig"; sourceTree = "<group>"; };
@@ -70,6 +82,10 @@
7082
CD397BCF207AC3B400103E5C /* ChooseCurrencyTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseCurrencyTableViewController.swift; sourceTree = "<group>"; };
7183
CD397BD3207D79CF00103E5C /* PickerBasedTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PickerBasedTextField.swift; sourceTree = "<group>"; };
7284
CD43CD4F2288D66A0020EEC0 /* StoreReviewHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreReviewHelper.swift; sourceTree = "<group>"; };
85+
CD49222322A47B72003DB2EE /* SmartWalletUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SmartWalletUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
86+
CD49222522A47B72003DB2EE /* SmartWalletUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmartWalletUITests.swift; sourceTree = "<group>"; };
87+
CD49222722A47B72003DB2EE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
88+
CD49222D22A47CF0003DB2EE /* SnapshotHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SnapshotHelper.swift; path = fastlane/SnapshotHelper.swift; sourceTree = SOURCE_ROOT; };
7389
CD51D99420A7A618003791E1 /* AddModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddModel.swift; sourceTree = "<group>"; };
7490
CD86E7792041A62D0007F817 /* CategoriesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoriesViewController.swift; sourceTree = "<group>"; };
7591
CDAF4ECC207846EA00392459 /* GeneralHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralHelper.swift; sourceTree = "<group>"; };
@@ -97,6 +113,13 @@
97113
);
98114
runOnlyForDeploymentPostprocessing = 0;
99115
};
116+
CD49222022A47B72003DB2EE /* Frameworks */ = {
117+
isa = PBXFrameworksBuildPhase;
118+
buildActionMask = 2147483647;
119+
files = (
120+
);
121+
runOnlyForDeploymentPostprocessing = 0;
122+
};
100123
/* End PBXFrameworksBuildPhase section */
101124

102125
/* Begin PBXGroup section */
@@ -131,6 +154,7 @@
131154
isa = PBXGroup;
132155
children = (
133156
CD0F71182014D379000B2BCD /* SmartWallet */,
157+
CD49222422A47B72003DB2EE /* SmartWalletUITests */,
134158
CD0F71172014D379000B2BCD /* Products */,
135159
7EC3A255DBEA693AB71050F0 /* Pods */,
136160
AE14384B79712DF0803CF419 /* Frameworks */,
@@ -141,6 +165,7 @@
141165
isa = PBXGroup;
142166
children = (
143167
CD0F71162014D379000B2BCD /* SmartWallet.app */,
168+
CD49222322A47B72003DB2EE /* SmartWalletUITests.xctest */,
144169
);
145170
name = Products;
146171
sourceTree = "<group>";
@@ -187,6 +212,16 @@
187212
path = General;
188213
sourceTree = "<group>";
189214
};
215+
CD49222422A47B72003DB2EE /* SmartWalletUITests */ = {
216+
isa = PBXGroup;
217+
children = (
218+
CD49222D22A47CF0003DB2EE /* SnapshotHelper.swift */,
219+
CD49222522A47B72003DB2EE /* SmartWalletUITests.swift */,
220+
CD49222722A47B72003DB2EE /* Info.plist */,
221+
);
222+
path = SmartWalletUITests;
223+
sourceTree = "<group>";
224+
};
190225
CDD864312093F03200E65E64 /* videos */ = {
191226
isa = PBXGroup;
192227
children = (
@@ -233,13 +268,31 @@
233268
productReference = CD0F71162014D379000B2BCD /* SmartWallet.app */;
234269
productType = "com.apple.product-type.application";
235270
};
271+
CD49222222A47B72003DB2EE /* SmartWalletUITests */ = {
272+
isa = PBXNativeTarget;
273+
buildConfigurationList = CD49222C22A47B72003DB2EE /* Build configuration list for PBXNativeTarget "SmartWalletUITests" */;
274+
buildPhases = (
275+
CD49221F22A47B72003DB2EE /* Sources */,
276+
CD49222022A47B72003DB2EE /* Frameworks */,
277+
CD49222122A47B72003DB2EE /* Resources */,
278+
);
279+
buildRules = (
280+
);
281+
dependencies = (
282+
CD49222922A47B72003DB2EE /* PBXTargetDependency */,
283+
);
284+
name = SmartWalletUITests;
285+
productName = SmartWalletUITests;
286+
productReference = CD49222322A47B72003DB2EE /* SmartWalletUITests.xctest */;
287+
productType = "com.apple.product-type.bundle.ui-testing";
288+
};
236289
/* End PBXNativeTarget section */
237290

238291
/* Begin PBXProject section */
239292
CD0F710E2014D378000B2BCD /* Project object */ = {
240293
isa = PBXProject;
241294
attributes = {
242-
LastSwiftUpdateCheck = 0920;
295+
LastSwiftUpdateCheck = 1010;
243296
LastUpgradeCheck = 0930;
244297
ORGANIZATIONNAME = "Soheil Novinfard";
245298
TargetAttributes = {
@@ -248,6 +301,11 @@
248301
LastSwiftMigration = 1010;
249302
ProvisioningStyle = Automatic;
250303
};
304+
CD49222222A47B72003DB2EE = {
305+
CreatedOnToolsVersion = 10.1;
306+
ProvisioningStyle = Automatic;
307+
TestTargetID = CD0F71152014D379000B2BCD;
308+
};
251309
};
252310
};
253311
buildConfigurationList = CD0F71112014D378000B2BCD /* Build configuration list for PBXProject "SmartWallet" */;
@@ -264,6 +322,7 @@
264322
projectRoot = "";
265323
targets = (
266324
CD0F71152014D379000B2BCD /* SmartWallet */,
325+
CD49222222A47B72003DB2EE /* SmartWalletUITests */,
267326
);
268327
};
269328
/* End PBXProject section */
@@ -280,6 +339,13 @@
280339
);
281340
runOnlyForDeploymentPostprocessing = 0;
282341
};
342+
CD49222122A47B72003DB2EE /* Resources */ = {
343+
isa = PBXResourcesBuildPhase;
344+
buildActionMask = 2147483647;
345+
files = (
346+
);
347+
runOnlyForDeploymentPostprocessing = 0;
348+
};
283349
/* End PBXResourcesBuildPhase section */
284350

285351
/* Begin PBXShellScriptBuildPhase section */
@@ -378,8 +444,25 @@
378444
);
379445
runOnlyForDeploymentPostprocessing = 0;
380446
};
447+
CD49221F22A47B72003DB2EE /* Sources */ = {
448+
isa = PBXSourcesBuildPhase;
449+
buildActionMask = 2147483647;
450+
files = (
451+
CD49222622A47B72003DB2EE /* SmartWalletUITests.swift in Sources */,
452+
CD49222E22A47CF0003DB2EE /* SnapshotHelper.swift in Sources */,
453+
);
454+
runOnlyForDeploymentPostprocessing = 0;
455+
};
381456
/* End PBXSourcesBuildPhase section */
382457

458+
/* Begin PBXTargetDependency section */
459+
CD49222922A47B72003DB2EE /* PBXTargetDependency */ = {
460+
isa = PBXTargetDependency;
461+
target = CD0F71152014D379000B2BCD /* SmartWallet */;
462+
targetProxy = CD49222822A47B72003DB2EE /* PBXContainerItemProxy */;
463+
};
464+
/* End PBXTargetDependency section */
465+
383466
/* Begin PBXVariantGroup section */
384467
CD0F711D2014D379000B2BCD /* Main.storyboard */ = {
385468
isa = PBXVariantGroup;
@@ -545,6 +628,44 @@
545628
};
546629
name = Release;
547630
};
631+
CD49222A22A47B72003DB2EE /* Debug */ = {
632+
isa = XCBuildConfiguration;
633+
buildSettings = {
634+
CLANG_ENABLE_OBJC_WEAK = YES;
635+
CODE_SIGN_STYLE = Automatic;
636+
DEBUG_INFORMATION_FORMAT = dwarf;
637+
DEVELOPMENT_TEAM = VQ3DDEUQ7K;
638+
INFOPLIST_FILE = SmartWalletUITests/Info.plist;
639+
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
640+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
641+
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
642+
MTL_FAST_MATH = YES;
643+
PRODUCT_BUNDLE_IDENTIFIER = com.novinfard.SmartWalletUITests;
644+
PRODUCT_NAME = "$(TARGET_NAME)";
645+
SWIFT_VERSION = 4.2;
646+
TARGETED_DEVICE_FAMILY = "1,2";
647+
TEST_TARGET_NAME = SmartWallet;
648+
};
649+
name = Debug;
650+
};
651+
CD49222B22A47B72003DB2EE /* Release */ = {
652+
isa = XCBuildConfiguration;
653+
buildSettings = {
654+
CLANG_ENABLE_OBJC_WEAK = YES;
655+
CODE_SIGN_STYLE = Automatic;
656+
DEVELOPMENT_TEAM = VQ3DDEUQ7K;
657+
INFOPLIST_FILE = SmartWalletUITests/Info.plist;
658+
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
659+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
660+
MTL_FAST_MATH = YES;
661+
PRODUCT_BUNDLE_IDENTIFIER = com.novinfard.SmartWalletUITests;
662+
PRODUCT_NAME = "$(TARGET_NAME)";
663+
SWIFT_VERSION = 4.2;
664+
TARGETED_DEVICE_FAMILY = "1,2";
665+
TEST_TARGET_NAME = SmartWallet;
666+
};
667+
name = Release;
668+
};
548669
/* End XCBuildConfiguration section */
549670

550671
/* Begin XCConfigurationList section */
@@ -566,6 +687,15 @@
566687
defaultConfigurationIsVisible = 0;
567688
defaultConfigurationName = Release;
568689
};
690+
CD49222C22A47B72003DB2EE /* Build configuration list for PBXNativeTarget "SmartWalletUITests" */ = {
691+
isa = XCConfigurationList;
692+
buildConfigurations = (
693+
CD49222A22A47B72003DB2EE /* Debug */,
694+
CD49222B22A47B72003DB2EE /* Release */,
695+
);
696+
defaultConfigurationIsVisible = 0;
697+
defaultConfigurationName = Release;
698+
};
569699
/* End XCConfigurationList section */
570700

571701
/* Begin XCVersionGroup section */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1010"
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 = "CD0F71152014D379000B2BCD"
18+
BuildableName = "SmartWallet.app"
19+
BlueprintName = "SmartWallet"
20+
ReferencedContainer = "container:SmartWallet.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 = "CD49222222A47B72003DB2EE"
36+
BuildableName = "SmartWalletUITests.xctest"
37+
BlueprintName = "SmartWalletUITests"
38+
ReferencedContainer = "container:SmartWallet.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
<MacroExpansion>
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "CD0F71152014D379000B2BCD"
46+
BuildableName = "SmartWallet.app"
47+
BlueprintName = "SmartWallet"
48+
ReferencedContainer = "container:SmartWallet.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+
<BuildableProductRunnable
65+
runnableDebuggingMode = "0">
66+
<BuildableReference
67+
BuildableIdentifier = "primary"
68+
BlueprintIdentifier = "CD0F71152014D379000B2BCD"
69+
BuildableName = "SmartWallet.app"
70+
BlueprintName = "SmartWallet"
71+
ReferencedContainer = "container:SmartWallet.xcodeproj">
72+
</BuildableReference>
73+
</BuildableProductRunnable>
74+
<AdditionalOptions>
75+
</AdditionalOptions>
76+
</LaunchAction>
77+
<ProfileAction
78+
buildConfiguration = "Release"
79+
shouldUseLaunchSchemeArgsEnv = "YES"
80+
savedToolIdentifier = ""
81+
useCustomWorkingDirectory = "NO"
82+
debugDocumentVersioning = "YES">
83+
<BuildableProductRunnable
84+
runnableDebuggingMode = "0">
85+
<BuildableReference
86+
BuildableIdentifier = "primary"
87+
BlueprintIdentifier = "CD0F71152014D379000B2BCD"
88+
BuildableName = "SmartWallet.app"
89+
BlueprintName = "SmartWallet"
90+
ReferencedContainer = "container:SmartWallet.xcodeproj">
91+
</BuildableReference>
92+
</BuildableProductRunnable>
93+
</ProfileAction>
94+
<AnalyzeAction
95+
buildConfiguration = "Debug">
96+
</AnalyzeAction>
97+
<ArchiveAction
98+
buildConfiguration = "Release"
99+
revealArchiveInOrganizer = "YES">
100+
</ArchiveAction>
101+
</Scheme>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1010"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "NO"
13+
buildForArchiving = "NO"
14+
buildForAnalyzing = "NO">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "CD49222222A47B72003DB2EE"
18+
BuildableName = "SmartWalletUITests.xctest"
19+
BlueprintName = "SmartWalletUITests"
20+
ReferencedContainer = "container:SmartWallet.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 = "CD49222222A47B72003DB2EE"
36+
BuildableName = "SmartWalletUITests.xctest"
37+
BlueprintName = "SmartWalletUITests"
38+
ReferencedContainer = "container:SmartWallet.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
<AdditionalOptions>
43+
</AdditionalOptions>
44+
</TestAction>
45+
<LaunchAction
46+
buildConfiguration = "Debug"
47+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
48+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
49+
launchStyle = "0"
50+
useCustomWorkingDirectory = "NO"
51+
ignoresPersistentStateOnLaunch = "NO"
52+
debugDocumentVersioning = "YES"
53+
debugServiceExtension = "internal"
54+
allowLocationSimulation = "YES">
55+
<MacroExpansion>
56+
<BuildableReference
57+
BuildableIdentifier = "primary"
58+
BlueprintIdentifier = "CD49222222A47B72003DB2EE"
59+
BuildableName = "SmartWalletUITests.xctest"
60+
BlueprintName = "SmartWalletUITests"
61+
ReferencedContainer = "container:SmartWallet.xcodeproj">
62+
</BuildableReference>
63+
</MacroExpansion>
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 = "CD49222222A47B72003DB2EE"
77+
BuildableName = "SmartWalletUITests.xctest"
78+
BlueprintName = "SmartWalletUITests"
79+
ReferencedContainer = "container:SmartWallet.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>

‎SmartWalletUITests/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>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
// SmartWalletUITests.swift
3+
// SmartWalletUITests
4+
//
5+
// Created by Soheil on 02/06/2019.
6+
// Copyright © 2019 Soheil Novinfard. All rights reserved.
7+
//
8+
9+
import XCTest
10+
11+
class SmartWalletUITests: XCTestCase {
12+
13+
override func setUp() {
14+
let app = XCUIApplication()
15+
setupSnapshot(app)
16+
app.launch()
17+
}
18+
19+
override func tearDown() {
20+
// Put teardown code here. This method is called after the invocation of each test method in the class.
21+
}
22+
23+
func testExample() {
24+
// Use recording to get started writing UI tests.
25+
// Use XCTAssert and related functions to verify your tests produce the correct results.
26+
}
27+
28+
}

‎fastlane/Fastfile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This file contains the fastlane.tools configuration
2+
# You can find the documentation at https://docs.fastlane.tools
3+
#
4+
# For a list of all available actions, check out
5+
#
6+
# https://docs.fastlane.tools/actions
7+
#
8+
# For a list of all available plugins, check out
9+
#
10+
# https://docs.fastlane.tools/plugins/available-plugins
11+
#
12+
13+
# Uncomment the line if you want fastlane to automatically update itself
14+
# update_fastlane
15+
16+
default_platform(:ios)
17+
18+
platform :ios do
19+
desc "Generate screenshots"
20+
lane :screenshots do
21+
capture_screenshots
22+
upload_to_app_store
23+
end
24+
end

‎fastlane/Snapfile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Uncomment the lines below you want to change by removing the # in the beginning
2+
3+
# A list of devices you want to take the screenshots from
4+
# devices([
5+
# "iPhone 8",
6+
# "iPhone 8 Plus",
7+
# "iPhone SE",
8+
# "iPhone X",
9+
# "iPad Pro (12.9-inch)",
10+
# "iPad Pro (9.7-inch)",
11+
# "Apple TV 1080p"
12+
# ])
13+
14+
# languages([
15+
# "en-US",
16+
# "de-DE",
17+
# "it-IT",
18+
# ["pt", "pt_BR"] # Portuguese with Brazilian locale
19+
# ])
20+
21+
# The name of the scheme which contains the UI Tests
22+
# scheme("SchemeName")
23+
24+
# Where should the resulting screenshots be stored?
25+
# output_directory("./screenshots")
26+
27+
# remove the '#' to clear all previously generated screenshots before creating new ones
28+
# clear_previous_screenshots(true)
29+
30+
# Arguments to pass to the app on launch. See https://docs.fastlane.tools/actions/snapshot/#launch-arguments
31+
# launch_arguments(["-favColor red"])
32+
33+
# For more information about all available options run
34+
# fastlane action snapshot

‎fastlane/SnapshotHelper.swift

+298
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,298 @@
1+
//
2+
// SnapshotHelper.swift
3+
// Example
4+
//
5+
// Created by Felix Krause on 10/8/15.
6+
//
7+
8+
// -----------------------------------------------------
9+
// IMPORTANT: When modifying this file, make sure to
10+
// increment the version number at the very
11+
// bottom of the file to notify users about
12+
// the new SnapshotHelper.swift
13+
// -----------------------------------------------------
14+
15+
import Foundation
16+
import XCTest
17+
18+
var deviceLanguage = ""
19+
var locale = ""
20+
21+
func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) {
22+
Snapshot.setupSnapshot(app, waitForAnimations: waitForAnimations)
23+
}
24+
25+
func snapshot(_ name: String, waitForLoadingIndicator: Bool) {
26+
if waitForLoadingIndicator {
27+
Snapshot.snapshot(name)
28+
} else {
29+
Snapshot.snapshot(name, timeWaitingForIdle: 0)
30+
}
31+
}
32+
33+
/// - Parameters:
34+
/// - name: The name of the snapshot
35+
/// - timeout: Amount of seconds to wait until the network loading indicator disappears. Pass `0` if you don't want to wait.
36+
func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) {
37+
Snapshot.snapshot(name, timeWaitingForIdle: timeout)
38+
}
39+
40+
enum SnapshotError: Error, CustomDebugStringConvertible {
41+
case cannotDetectUser
42+
case cannotFindHomeDirectory
43+
case cannotFindSimulatorHomeDirectory
44+
case cannotAccessSimulatorHomeDirectory(String)
45+
case cannotRunOnPhysicalDevice
46+
47+
var debugDescription: String {
48+
switch self {
49+
case .cannotDetectUser:
50+
return "Couldn't find Snapshot configuration files - can't detect current user "
51+
case .cannotFindHomeDirectory:
52+
return "Couldn't find Snapshot configuration files - can't detect `Users` dir"
53+
case .cannotFindSimulatorHomeDirectory:
54+
return "Couldn't find simulator home location. Please, check SIMULATOR_HOST_HOME env variable."
55+
case .cannotAccessSimulatorHomeDirectory(let simulatorHostHome):
56+
return "Can't prepare environment. Simulator home location is inaccessible. Does \(simulatorHostHome) exist?"
57+
case .cannotRunOnPhysicalDevice:
58+
return "Can't use Snapshot on a physical device."
59+
}
60+
}
61+
}
62+
63+
@objcMembers
64+
open class Snapshot: NSObject {
65+
static var app: XCUIApplication?
66+
static var waitForAnimations = true
67+
static var cacheDirectory: URL?
68+
static var screenshotsDirectory: URL? {
69+
return cacheDirectory?.appendingPathComponent("screenshots", isDirectory: true)
70+
}
71+
72+
open class func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) {
73+
74+
Snapshot.app = app
75+
Snapshot.waitForAnimations = waitForAnimations
76+
77+
do {
78+
let cacheDir = try pathPrefix()
79+
Snapshot.cacheDirectory = cacheDir
80+
setLanguage(app)
81+
setLocale(app)
82+
setLaunchArguments(app)
83+
} catch let error {
84+
NSLog(error.localizedDescription)
85+
}
86+
}
87+
88+
class func setLanguage(_ app: XCUIApplication) {
89+
guard let cacheDirectory = self.cacheDirectory else {
90+
NSLog("CacheDirectory is not set - probably running on a physical device?")
91+
return
92+
}
93+
94+
let path = cacheDirectory.appendingPathComponent("language.txt")
95+
96+
do {
97+
let trimCharacterSet = CharacterSet.whitespacesAndNewlines
98+
deviceLanguage = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet)
99+
app.launchArguments += ["-AppleLanguages", "(\(deviceLanguage))"]
100+
} catch {
101+
NSLog("Couldn't detect/set language...")
102+
}
103+
}
104+
105+
class func setLocale(_ app: XCUIApplication) {
106+
guard let cacheDirectory = self.cacheDirectory else {
107+
NSLog("CacheDirectory is not set - probably running on a physical device?")
108+
return
109+
}
110+
111+
let path = cacheDirectory.appendingPathComponent("locale.txt")
112+
113+
do {
114+
let trimCharacterSet = CharacterSet.whitespacesAndNewlines
115+
locale = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet)
116+
} catch {
117+
NSLog("Couldn't detect/set locale...")
118+
}
119+
120+
if locale.isEmpty && !deviceLanguage.isEmpty {
121+
locale = Locale(identifier: deviceLanguage).identifier
122+
}
123+
124+
if !locale.isEmpty {
125+
app.launchArguments += ["-AppleLocale", "\"\(locale)\""]
126+
}
127+
}
128+
129+
class func setLaunchArguments(_ app: XCUIApplication) {
130+
guard let cacheDirectory = self.cacheDirectory else {
131+
NSLog("CacheDirectory is not set - probably running on a physical device?")
132+
return
133+
}
134+
135+
let path = cacheDirectory.appendingPathComponent("snapshot-launch_arguments.txt")
136+
app.launchArguments += ["-FASTLANE_SNAPSHOT", "YES", "-ui_testing"]
137+
138+
do {
139+
let launchArguments = try String(contentsOf: path, encoding: String.Encoding.utf8)
140+
let regex = try NSRegularExpression(pattern: "(\\\".+?\\\"|\\S+)", options: [])
141+
let matches = regex.matches(in: launchArguments, options: [], range: NSRange(location: 0, length: launchArguments.count))
142+
let results = matches.map { result -> String in
143+
(launchArguments as NSString).substring(with: result.range)
144+
}
145+
app.launchArguments += results
146+
} catch {
147+
NSLog("Couldn't detect/set launch_arguments...")
148+
}
149+
}
150+
151+
open class func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) {
152+
if timeout > 0 {
153+
waitForLoadingIndicatorToDisappear(within: timeout)
154+
}
155+
156+
NSLog("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work
157+
158+
if Snapshot.waitForAnimations {
159+
sleep(1) // Waiting for the animation to be finished (kind of)
160+
}
161+
162+
#if os(OSX)
163+
guard let app = self.app else {
164+
NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().")
165+
return
166+
}
167+
168+
app.typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: [])
169+
#else
170+
171+
guard let app = self.app else {
172+
NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().")
173+
return
174+
}
175+
176+
let window = app.windows.firstMatch
177+
let screenshot = window.screenshot()
178+
guard let simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return }
179+
let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png")
180+
do {
181+
try screenshot.pngRepresentation.write(to: path)
182+
} catch let error {
183+
NSLog("Problem writing screenshot: \(name) to \(path)")
184+
NSLog(error.localizedDescription)
185+
}
186+
#endif
187+
}
188+
189+
class func waitForLoadingIndicatorToDisappear(within timeout: TimeInterval) {
190+
#if os(tvOS)
191+
return
192+
#endif
193+
194+
guard let app = self.app else {
195+
NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().")
196+
return
197+
}
198+
199+
let networkLoadingIndicator = app.otherElements.deviceStatusBars.networkLoadingIndicators.element
200+
let networkLoadingIndicatorDisappeared = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists == false"), object: networkLoadingIndicator)
201+
_ = XCTWaiter.wait(for: [networkLoadingIndicatorDisappeared], timeout: timeout)
202+
}
203+
204+
class func pathPrefix() throws -> URL? {
205+
let homeDir: URL
206+
// on OSX config is stored in /Users/<username>/Library
207+
// and on iOS/tvOS/WatchOS it's in simulator's home dir
208+
#if os(OSX)
209+
guard let user = ProcessInfo().environment["USER"] else {
210+
throw SnapshotError.cannotDetectUser
211+
}
212+
213+
guard let usersDir = FileManager.default.urls(for: .userDirectory, in: .localDomainMask).first else {
214+
throw SnapshotError.cannotFindHomeDirectory
215+
}
216+
217+
homeDir = usersDir.appendingPathComponent(user)
218+
#else
219+
#if arch(i386) || arch(x86_64)
220+
guard let simulatorHostHome = ProcessInfo().environment["SIMULATOR_HOST_HOME"] else {
221+
throw SnapshotError.cannotFindSimulatorHomeDirectory
222+
}
223+
guard let homeDirUrl = URL(string: simulatorHostHome) else {
224+
throw SnapshotError.cannotAccessSimulatorHomeDirectory(simulatorHostHome)
225+
}
226+
homeDir = URL(fileURLWithPath: homeDirUrl.path)
227+
#else
228+
throw SnapshotError.cannotRunOnPhysicalDevice
229+
#endif
230+
#endif
231+
return homeDir.appendingPathComponent("Library/Caches/tools.fastlane")
232+
}
233+
}
234+
235+
private extension XCUIElementAttributes {
236+
var isNetworkLoadingIndicator: Bool {
237+
if hasWhiteListedIdentifier { return false }
238+
239+
let hasOldLoadingIndicatorSize = frame.size == CGSize(width: 10, height: 20)
240+
let hasNewLoadingIndicatorSize = frame.size.width.isBetween(46, and: 47) && frame.size.height.isBetween(2, and: 3)
241+
242+
return hasOldLoadingIndicatorSize || hasNewLoadingIndicatorSize
243+
}
244+
245+
var hasWhiteListedIdentifier: Bool {
246+
let whiteListedIdentifiers = ["GeofenceLocationTrackingOn", "StandardLocationTrackingOn"]
247+
248+
return whiteListedIdentifiers.contains(identifier)
249+
}
250+
251+
func isStatusBar(_ deviceWidth: CGFloat) -> Bool {
252+
if elementType == .statusBar { return true }
253+
guard frame.origin == .zero else { return false }
254+
255+
let oldStatusBarSize = CGSize(width: deviceWidth, height: 20)
256+
let newStatusBarSize = CGSize(width: deviceWidth, height: 44)
257+
258+
return [oldStatusBarSize, newStatusBarSize].contains(frame.size)
259+
}
260+
}
261+
262+
private extension XCUIElementQuery {
263+
var networkLoadingIndicators: XCUIElementQuery {
264+
let isNetworkLoadingIndicator = NSPredicate { (evaluatedObject, _) in
265+
guard let element = evaluatedObject as? XCUIElementAttributes else { return false }
266+
267+
return element.isNetworkLoadingIndicator
268+
}
269+
270+
return self.containing(isNetworkLoadingIndicator)
271+
}
272+
273+
var deviceStatusBars: XCUIElementQuery {
274+
guard let app = Snapshot.app else {
275+
fatalError("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().")
276+
}
277+
278+
let deviceWidth = app.windows.firstMatch.frame.width
279+
280+
let isStatusBar = NSPredicate { (evaluatedObject, _) in
281+
guard let element = evaluatedObject as? XCUIElementAttributes else { return false }
282+
283+
return element.isStatusBar(deviceWidth)
284+
}
285+
286+
return self.containing(isStatusBar)
287+
}
288+
}
289+
290+
private extension CGFloat {
291+
func isBetween(_ numberA: CGFloat, and numberB: CGFloat) -> Bool {
292+
return numberA...numberB ~= self
293+
}
294+
}
295+
296+
// Please don't remove the lines below
297+
// They are used to detect outdated configuration files
298+
// SnapshotHelperVersion [1.16]

0 commit comments

Comments
 (0)
Please sign in to comment.