-
Notifications
You must be signed in to change notification settings - Fork 429
UI Tests for auth flows #3959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
UI Tests for auth flows #3959
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
dc69440
Beginning of UI tests for AuthFlowTester
wmathurin 16e6815
Merge branch 'dev' of github.com:wmathurin/SalesforceMobileSDK-iOS in…
wmathurin 90ebe3c
Basic login / logout tests
wmathurin c0a4e06
Merge branch 'dev' of github.com:wmathurin/SalesforceMobileSDK-iOS in…
wmathurin 16df64d
Basic test brings up login options and set the static configuration i…
wmathurin 567e87e
Merge branch 'dev' of github.com:forcedotcom/SalesforceMobileSDK-iOS …
wmathurin df83b95
Login tests:
wmathurin 516afad
Speeding up tests and checking SIDs (for hybrid flows)
wmathurin be4d829
Added tests involving refresh token migration
wmathurin 5849109
More tests - refactored test support code also
wmathurin 355c074
Updated test_config.json.sample
wmathurin 8d3ab2a
Recreating the oauthRequest for the authSession when changing login o…
wmathurin 3a3c10b
Adding import button in BootConfigEditor and export buttons in UserCr…
wmathurin 1689251
More detailled assertion failures
wmathurin d8968e9
Additional comments
wmathurin b72a051
Fixing errors in testing code
wmathurin 3e32c7b
Added tests that use dynamic configuration also
wmathurin 97a5241
Multi user testing (WIP)
wmathurin d504ac5
Re-organizing login tests - removing some tests
wmathurin 2018ae3
Re-organized tests / prune some / added a few (multi user)
wmathurin 8cc0513
Overview.md for the UI tests
wmathurin 7580c21
Changes to overview
wmathurin 5602b3b
Turning on coverage in scheme
wmathurin c6f192a
Misc refactoring / fixes
wmathurin 478f325
Code coverage in SalesforceSDKCore also
wmathurin 0911cff
Fixing switch user code in UI tests
wmathurin a1f0a01
More readable helper test code
wmathurin 6ebd6de
Cleaner helper method in base class - new documentation
wmathurin fa026d7
More fixes
wmathurin cd376fe
More fixes
wmathurin b8621b3
More changes
wmathurin e98b7f6
Not hardcoding .subset definition
wmathurin 20bb5fa
Beacon login tests now all passing
wmathurin 9fe5c7a
Somehow server does not return api_instance_url for user agent flow +…
wmathurin b337f6d
Merge branch 'dev' of github.com:wmathurin/SalesforceMobileSDK-iOS in…
wmathurin efa466a
Cleaning up signatures of helper methods - nil dynamic app config <=>…
wmathurin 3d160fc
Updating overview.md for UI tests
wmathurin 086e197
Only doing validation after login in the dedicated login tests (not i…
wmathurin e6589a9
Fixing an actual SDK bug: scopes from dynamic config were NOT being u…
wmathurin 8b8749f
Turning on parallelization when running tests
wmathurin 8848eba
Merge branch 'dev' of github.com:wmathurin/SalesforceMobileSDK-iOS in…
wmathurin 7dc8c11
Scopes were not passed through during migration
wmathurin 323b5e6
During restart in some login tests
wmathurin 5d081dc
Only failures are migration from beacon app.
wmathurin 33074eb
Merge branch 'dev' of github.com:wmathurin/SalesforceMobileSDK-iOS in…
wmathurin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,13 @@ | |
|
|
||
| import SwiftUI | ||
|
|
||
| // MARK: - JSON Import Labels | ||
| public struct BootConfigJSONKeys { | ||
| public static let consumerKey = "remoteAccessConsumerKey" | ||
| public static let redirectUri = "oauthRedirectURI" | ||
| public static let scopes = "scopes" | ||
| } | ||
|
|
||
| public struct BootConfigEditor: View { | ||
| let title: String | ||
| let buttonLabel: String | ||
|
|
@@ -38,6 +45,8 @@ public struct BootConfigEditor: View { | |
| let onUseConfig: () -> Void | ||
| let initiallyExpanded: Bool | ||
| @State private var isExpanded: Bool = false | ||
| @State private var showImportAlert: Bool = false | ||
| @State private var importJSONText: String = "" | ||
|
|
||
| public init( | ||
| title: String, | ||
|
|
@@ -63,21 +72,32 @@ public struct BootConfigEditor: View { | |
|
|
||
| public var body: some View { | ||
| VStack(alignment: .leading, spacing: 12) { | ||
| Button(action: { | ||
| withAnimation { | ||
| isExpanded.toggle() | ||
| HStack { | ||
| Button(action: { | ||
| withAnimation { | ||
| isExpanded.toggle() | ||
| } | ||
| }) { | ||
| HStack { | ||
| Text(title) | ||
| .font(.headline) | ||
| .foregroundColor(.primary) | ||
| Spacer() | ||
| Image(systemName: isExpanded ? "chevron.up" : "chevron.down") | ||
| .foregroundColor(.secondary) | ||
| } | ||
| } | ||
| }) { | ||
| HStack { | ||
| Text(title) | ||
| .font(.headline) | ||
| .foregroundColor(.primary) | ||
| Spacer() | ||
| Image(systemName: isExpanded ? "chevron.up" : "chevron.down") | ||
| .foregroundColor(.secondary) | ||
| Button(action: { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding an import button:
|
||
| importJSONText = "" | ||
| showImportAlert = true | ||
| }) { | ||
| Image(systemName: "square.and.arrow.down") | ||
| .font(.subheadline) | ||
| .foregroundColor(.blue) | ||
| } | ||
| .padding(.horizontal) | ||
| .accessibilityIdentifier("importConfigButton") | ||
| } | ||
| .padding(.horizontal) | ||
|
|
||
| if isExpanded { | ||
| VStack(alignment: .leading, spacing: 8) { | ||
|
|
@@ -130,6 +150,34 @@ public struct BootConfigEditor: View { | |
| .onAppear { | ||
| isExpanded = initiallyExpanded | ||
| } | ||
| .alert("Import Configuration", isPresented: $showImportAlert) { | ||
| TextField("Paste JSON here", text: $importJSONText) | ||
| Button("Import") { | ||
| importConfigFromJSON() | ||
| } | ||
| Button("Cancel", role: .cancel) { } | ||
| } message: { | ||
| Text("Paste JSON with remoteAccessConsumerKey, oauthRedirectURI, and scopes") | ||
| } | ||
| } | ||
|
|
||
| // MARK: - Helper Methods | ||
|
|
||
| private func importConfigFromJSON() { | ||
| guard let jsonData = importJSONText.data(using: .utf8), | ||
| let json = try? JSONSerialization.jsonObject(with: jsonData, options: []) as? [String: Any] else { | ||
| return | ||
| } | ||
|
|
||
| if let key = json[BootConfigJSONKeys.consumerKey] as? String { | ||
| consumerKey = key | ||
| } | ||
| if let uri = json[BootConfigJSONKeys.redirectUri] as? String { | ||
| callbackUrl = uri | ||
| } | ||
| if let scopesValue = json[BootConfigJSONKeys.scopes] as? String { | ||
| scopes = scopesValue | ||
| } | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -317,8 +317,8 @@ - (UIBarButtonItem *)createSettingsButton { | |
| handler:^(__kindof UIAction* _Nonnull action) { | ||
| UIViewController *configPicker = [BootConfigPickerViewController makeViewControllerOnConfigurationCompleted:^{ | ||
| [self dismissViewControllerAnimated:YES completion:^{ | ||
| if ([self.delegate respondsToSelector:@selector(loginViewControllerDidReload:)]) { | ||
| [self.delegate loginViewControllerDidReload:self]; | ||
| if ([self.delegate respondsToSelector:@selector(loginViewControllerDidChangeLoginOptions:)]) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reload is not enough - we need the auth request within the auth session to be recreated (see earlier comment). |
||
| [self.delegate loginViewControllerDidChangeLoginOptions:self]; | ||
| } | ||
| }]; | ||
| }]; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Login options might change the consumer key / callback url / scopes so we need to restart the oauth request otherwise the new settings will not be used.