Skip to content

Commit 9ec1996

Browse files
committed
(Incomplete) Tests for AuthFlowTester
NB: using "instant login" for authenticated tests
1 parent 2565980 commit 9ec1996

File tree

10 files changed

+656
-6
lines changed

10 files changed

+656
-6
lines changed

SalesforceMobileSDK.xcworkspace/xcshareddata/xcschemes/Everything.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266
buildForAnalyzing = "YES">
267267
<BuildableReference
268268
BuildableIdentifier = "primary"
269-
BlueprintIdentifier = "B716A3E3218F6EEA009D407F"
269+
BlueprintIdentifier = "F27137B928405BB8003B3D69"
270270
BuildableName = "SalesforceSDKCommonTestApp.app"
271271
BlueprintName = "SalesforceSDKCommonTestApp"
272272
ReferencedContainer = "container:libs/SalesforceSDKCommon/SalesforceSDKCommon.xcodeproj">

SalesforceMobileSDK.xcworkspace/xcshareddata/xcschemes/UnitTests.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266
buildForAnalyzing = "YES">
267267
<BuildableReference
268268
BuildableIdentifier = "primary"
269-
BlueprintIdentifier = "B716A3E3218F6EEA009D407F"
269+
BlueprintIdentifier = "F27137B928405BB8003B3D69"
270270
BuildableName = "SalesforceSDKCommonTestApp.app"
271271
BlueprintName = "SalesforceSDKCommonTestApp"
272272
ReferencedContainer = "container:libs/SalesforceSDKCommon/SalesforceSDKCommon.xcodeproj">

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Test/SFSDKTestCredentialsData.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ NS_ASSUME_NONNULL_BEGIN
3939
@property (nonatomic, readonly) NSString *redirectUri;
4040
@property (nonatomic, readonly) NSString *loginHost;
4141
@property (nonatomic, readonly) NSString *communityUrl;
42+
@property (nonatomic, readonly) NSString *username;
43+
@property (nonatomic, readonly) NSString *displayName;
4244

4345
@end
4446

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Test/SFSDKTestCredentialsData.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,14 @@ - (NSString *)communityUrl
8888
return _credentialsDict[@"community_url"];
8989
}
9090

91+
- (NSString *)username
92+
{
93+
return _credentialsDict[@"username"];
94+
}
95+
96+
- (NSString *)displayName
97+
{
98+
return _credentialsDict[@"display_name"];
99+
}
100+
91101
@end

native/SampleApps/AuthFlowTester/AuthFlowTester.xcodeproj/project.pbxproj

Lines changed: 138 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
4F1A8CCA2EAB16450037DC89 /* bootconfig.plist in Resources */ = {isa = PBXBuildFile; fileRef = AUTH010 /* bootconfig.plist */; };
11+
4F1A8CCB2EAB16490037DC89 /* bootconfig2.plist in Resources */ = {isa = PBXBuildFile; fileRef = AUTH036 /* bootconfig2.plist */; };
12+
4F95A89B2EAAD00000000001 /* test_credentials.json in Resources */ = {isa = PBXBuildFile; fileRef = 4F95A89A2EAAD00000000001 /* test_credentials.json */; };
1013
4F95A89C2EA806E700C98D18 /* SalesforceAnalytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F95A8962EA801DC00C98D18 /* SalesforceAnalytics.framework */; };
1114
4F95A89D2EA806E700C98D18 /* SalesforceAnalytics.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4F95A8962EA801DC00C98D18 /* SalesforceAnalytics.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1215
4F95A89F2EA806E900C98D18 /* SalesforceSDKCommon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F95A8982EA801DC00C98D18 /* SalesforceSDKCommon.framework */; };
@@ -32,6 +35,16 @@
3235
AUTH053 /* FlowTypesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AUTH054 /* FlowTypesView.swift */; };
3336
/* End PBXBuildFile section */
3437

38+
/* Begin PBXContainerItemProxy section */
39+
4FEBAF342EAAC98E00D4880A /* PBXContainerItemProxy */ = {
40+
isa = PBXContainerItemProxy;
41+
containerPortal = AUTH027 /* Project object */;
42+
proxyType = 1;
43+
remoteGlobalIDString = AUTH023;
44+
remoteInfo = AuthFlowTester;
45+
};
46+
/* End PBXContainerItemProxy section */
47+
3548
/* Begin PBXCopyFilesBuildPhase section */
3649
4F95A89E2EA806E700C98D18 /* Embed Frameworks */ = {
3750
isa = PBXCopyFilesBuildPhase;
@@ -50,7 +63,9 @@
5063
4F95A8962EA801DC00C98D18 /* SalesforceAnalytics.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SalesforceAnalytics.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5164
4F95A8982EA801DC00C98D18 /* SalesforceSDKCommon.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SalesforceSDKCommon.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5265
4F95A89A2EA801DC00C98D18 /* SalesforceSDKCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SalesforceSDKCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
66+
4F95A89A2EAAD00000000001 /* test_credentials.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = test_credentials.json; path = ../../../../shared/test/test_credentials.json; sourceTree = "<group>"; };
5367
4FEBAF282EA9B91500D4880A /* RevokeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RevokeView.swift; sourceTree = "<group>"; };
68+
4FEBAF2E2EAAC98E00D4880A /* AuthFlowTesterUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AuthFlowTesterUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
5469
AUTH002 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5570
AUTH004 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
5671
AUTH006 /* ConfigPickerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigPickerViewController.swift; sourceTree = "<group>"; };
@@ -72,7 +87,20 @@
7287
AUTH054 /* FlowTypesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlowTypesView.swift; sourceTree = "<group>"; };
7388
/* End PBXFileReference section */
7489

90+
/* Begin PBXFileSystemSynchronizedRootGroup section */
91+
4FEBAF2F2EAAC98E00D4880A /* AuthFlowTesterUITests */ = {
92+
isa = PBXFileSystemSynchronizedRootGroup;
93+
path = AuthFlowTesterUITests;
94+
sourceTree = "<group>";
95+
};
96+
/* End PBXFileSystemSynchronizedRootGroup section */
97+
7598
/* Begin PBXFrameworksBuildPhase section */
99+
4FEBAF2B2EAAC98E00D4880A /* Frameworks */ = {
100+
isa = PBXFrameworksBuildPhase;
101+
files = (
102+
);
103+
};
76104
AUTH018 /* Frameworks */ = {
77105
isa = PBXFrameworksBuildPhase;
78106
files = (
@@ -94,6 +122,15 @@
94122
name = Frameworks;
95123
sourceTree = "<group>";
96124
};
125+
4FEBAF2F2EAAD00000000002 /* Supporting Files */ = {
126+
isa = PBXGroup;
127+
children = (
128+
4F95A89A2EAAD00000000001 /* test_credentials.json */,
129+
);
130+
name = "Supporting Files";
131+
path = AuthFlowTesterUITests;
132+
sourceTree = "<group>";
133+
};
97134
4FF0EF9E2EA8568C005E4474 /* Supporting Files */ = {
98135
isa = PBXGroup;
99136
children = (
@@ -110,6 +147,8 @@
110147
isa = PBXGroup;
111148
children = (
112149
AUTH020 /* AuthFlowTester */,
150+
4FEBAF2F2EAAC98E00D4880A /* AuthFlowTesterUITests */,
151+
4FEBAF2F2EAAD00000000002 /* Supporting Files */,
113152
4F95A8952EA801DC00C98D18 /* Frameworks */,
114153
AUTH021 /* Products */,
115154
);
@@ -131,6 +170,7 @@
131170
isa = PBXGroup;
132171
children = (
133172
AUTH017 /* AuthFlowTester.app */,
173+
4FEBAF2E2EAAC98E00D4880A /* AuthFlowTesterUITests.xctest */,
134174
);
135175
name = Products;
136176
sourceTree = "<group>";
@@ -180,6 +220,27 @@
180220
/* End PBXGroup section */
181221

182222
/* Begin PBXNativeTarget section */
223+
4FEBAF2D2EAAC98E00D4880A /* AuthFlowTesterUITests */ = {
224+
isa = PBXNativeTarget;
225+
buildConfigurationList = 4FEBAF362EAAC98E00D4880A /* Build configuration list for PBXNativeTarget "AuthFlowTesterUITests" */;
226+
buildPhases = (
227+
4FEBAF2A2EAAC98E00D4880A /* Sources */,
228+
4FEBAF2B2EAAC98E00D4880A /* Frameworks */,
229+
4FEBAF2C2EAAC98E00D4880A /* Resources */,
230+
);
231+
buildRules = (
232+
);
233+
dependencies = (
234+
4FEBAF352EAAC98E00D4880A /* PBXTargetDependency */,
235+
);
236+
fileSystemSynchronizedGroups = (
237+
4FEBAF2F2EAAC98E00D4880A /* AuthFlowTesterUITests */,
238+
);
239+
name = AuthFlowTesterUITests;
240+
productName = AuthFlowTesterUITests;
241+
productReference = 4FEBAF2E2EAAC98E00D4880A /* AuthFlowTesterUITests.xctest */;
242+
productType = "com.apple.product-type.bundle.ui-testing";
243+
};
183244
AUTH023 /* AuthFlowTester */ = {
184245
isa = PBXNativeTarget;
185246
buildConfigurationList = AUTH024 /* Build configuration list for PBXNativeTarget "AuthFlowTester" */;
@@ -203,9 +264,13 @@
203264
isa = PBXProject;
204265
attributes = {
205266
BuildIndependentTargetsInParallel = 1;
206-
LastSwiftUpdateCheck = 1500;
267+
LastSwiftUpdateCheck = 2600;
207268
LastUpgradeCheck = 2600;
208269
TargetAttributes = {
270+
4FEBAF2D2EAAC98E00D4880A = {
271+
CreatedOnToolsVersion = 26.0.1;
272+
TestTargetID = AUTH023;
273+
};
209274
AUTH023 = {
210275
CreatedOnToolsVersion = 15.0;
211276
};
@@ -225,11 +290,20 @@
225290
projectRoot = "";
226291
targets = (
227292
AUTH023 /* AuthFlowTester */,
293+
4FEBAF2D2EAAC98E00D4880A /* AuthFlowTesterUITests */,
228294
);
229295
};
230296
/* End PBXProject section */
231297

232298
/* Begin PBXResourcesBuildPhase section */
299+
4FEBAF2C2EAAC98E00D4880A /* Resources */ = {
300+
isa = PBXResourcesBuildPhase;
301+
files = (
302+
4F95A89B2EAAD00000000001 /* test_credentials.json in Resources */,
303+
4F1A8CCA2EAB16450037DC89 /* bootconfig.plist in Resources */,
304+
4F1A8CCB2EAB16490037DC89 /* bootconfig2.plist in Resources */,
305+
);
306+
};
233307
AUTH026 /* Resources */ = {
234308
isa = PBXResourcesBuildPhase;
235309
files = (
@@ -242,6 +316,11 @@
242316
/* End PBXResourcesBuildPhase section */
243317

244318
/* Begin PBXSourcesBuildPhase section */
319+
4FEBAF2A2EAAC98E00D4880A /* Sources */ = {
320+
isa = PBXSourcesBuildPhase;
321+
files = (
322+
);
323+
};
245324
AUTH025 /* Sources */ = {
246325
isa = PBXSourcesBuildPhase;
247326
files = (
@@ -262,7 +341,57 @@
262341
};
263342
/* End PBXSourcesBuildPhase section */
264343

344+
/* Begin PBXTargetDependency section */
345+
4FEBAF352EAAC98E00D4880A /* PBXTargetDependency */ = {
346+
isa = PBXTargetDependency;
347+
target = AUTH023 /* AuthFlowTester */;
348+
targetProxy = 4FEBAF342EAAC98E00D4880A /* PBXContainerItemProxy */;
349+
};
350+
/* End PBXTargetDependency section */
351+
265352
/* Begin XCBuildConfiguration section */
353+
4FEBAF372EAAC98E00D4880A /* Debug configuration for PBXNativeTarget "AuthFlowTesterUITests" */ = {
354+
isa = XCBuildConfiguration;
355+
buildSettings = {
356+
CODE_SIGN_STYLE = Automatic;
357+
CURRENT_PROJECT_VERSION = 1;
358+
DEVELOPMENT_TEAM = XD7TD9S6ZU;
359+
GENERATE_INFOPLIST_FILE = YES;
360+
IPHONEOS_DEPLOYMENT_TARGET = 17.6;
361+
MARKETING_VERSION = 1.0;
362+
PRODUCT_BUNDLE_IDENTIFIER = com.salesforce.salesforce.AuthFlowTesterUITests;
363+
PRODUCT_NAME = "$(TARGET_NAME)";
364+
STRING_CATALOG_GENERATE_SYMBOLS = NO;
365+
SWIFT_APPROACHABLE_CONCURRENCY = YES;
366+
SWIFT_EMIT_LOC_STRINGS = NO;
367+
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
368+
SWIFT_VERSION = 5.0;
369+
TARGETED_DEVICE_FAMILY = "1,2";
370+
TEST_TARGET_NAME = AuthFlowTester;
371+
};
372+
name = Debug;
373+
};
374+
4FEBAF382EAAC98E00D4880A /* Release configuration for PBXNativeTarget "AuthFlowTesterUITests" */ = {
375+
isa = XCBuildConfiguration;
376+
buildSettings = {
377+
CODE_SIGN_STYLE = Automatic;
378+
CURRENT_PROJECT_VERSION = 1;
379+
DEVELOPMENT_TEAM = XD7TD9S6ZU;
380+
GENERATE_INFOPLIST_FILE = YES;
381+
IPHONEOS_DEPLOYMENT_TARGET = 17.6;
382+
MARKETING_VERSION = 1.0;
383+
PRODUCT_BUNDLE_IDENTIFIER = com.salesforce.salesforce.AuthFlowTesterUITests;
384+
PRODUCT_NAME = "$(TARGET_NAME)";
385+
STRING_CATALOG_GENERATE_SYMBOLS = NO;
386+
SWIFT_APPROACHABLE_CONCURRENCY = YES;
387+
SWIFT_EMIT_LOC_STRINGS = NO;
388+
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
389+
SWIFT_VERSION = 5.0;
390+
TARGETED_DEVICE_FAMILY = "1,2";
391+
TEST_TARGET_NAME = AuthFlowTester;
392+
};
393+
name = Release;
394+
};
266395
AUTH029 /* Debug configuration for PBXProject "AuthFlowTester" */ = {
267396
isa = XCBuildConfiguration;
268397
buildSettings = {
@@ -447,6 +576,14 @@
447576
/* End XCBuildConfiguration section */
448577

449578
/* Begin XCConfigurationList section */
579+
4FEBAF362EAAC98E00D4880A /* Build configuration list for PBXNativeTarget "AuthFlowTesterUITests" */ = {
580+
isa = XCConfigurationList;
581+
buildConfigurations = (
582+
4FEBAF372EAAC98E00D4880A /* Debug configuration for PBXNativeTarget "AuthFlowTesterUITests" */,
583+
4FEBAF382EAAC98E00D4880A /* Release configuration for PBXNativeTarget "AuthFlowTesterUITests" */,
584+
);
585+
defaultConfigurationName = Release;
586+
};
450587
AUTH024 /* Build configuration list for PBXNativeTarget "AuthFlowTester" */ = {
451588
isa = XCConfigurationList;
452589
buildConfigurations = (

native/SampleApps/AuthFlowTester/AuthFlowTester.xcodeproj/xcshareddata/xcschemes/AuthFlowTester.xcscheme

Lines changed: 11 additions & 0 deletions
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 = "4FEBAF2D2EAAC98E00D4880A"
37+
BuildableName = "AuthFlowTesterUITests.xctest"
38+
BlueprintName = "AuthFlowTesterUITests"
39+
ReferencedContainer = "container:AuthFlowTester.xcodeproj">
40+
</BuildableReference>
41+
</TestableReference>
3142
</Testables>
3243
</TestAction>
3344
<LaunchAction

native/SampleApps/AuthFlowTester/AuthFlowTester/Classes/SceneDelegate.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,15 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
9191
return
9292
}
9393

94+
// Check ProcessInfo arguments for CONFIG_PICKER flag
95+
let shouldShowConfigPicker = ProcessInfo.processInfo.arguments.contains("CONFIG_PICKER")
96+
9497
// Check if user is already logged in
95-
if UserAccountManager.shared.currentUserAccount != nil {
96-
// User is already logged in, go directly to session detail
98+
if UserAccountManager.shared.currentUserAccount != nil && !shouldShowConfigPicker {
99+
// User is already logged in and not in config picker mode, go directly to session detail
97100
self.setupRootViewController()
98101
} else {
99-
// User is not logged in, show config picker
102+
// User is not logged in or config picker mode is enabled, show config picker
100103
self.window?.rootViewController = UIHostingController(rootView: ConfigPickerView(onConfigurationCompleted: onConfigurationCompleted))
101104
}
102105
self.window?.makeKeyAndVisible()

0 commit comments

Comments
 (0)