Skip to content

Simulate Welcome Discovery for UI Tests#2907

Merged
brandonpage merged 3 commits into
forcedotcom:devfrom
brandonpage:feature/welcome-discovery-ui-tests
May 28, 2026
Merged

Simulate Welcome Discovery for UI Tests#2907
brandonpage merged 3 commits into
forcedotcom:devfrom
brandonpage:feature/welcome-discovery-ui-tests

Conversation

@brandonpage
Copy link
Copy Markdown
Contributor

This work mirrors the iOS DiscoveryResultEditor + WelcomeLoginTests. Adds a debug-only Login Options toggle that injects a simulated login_hint + my_domain, letting tests drive the Welcome Discovery flow without the email round-trip and allow-listed consumer key.

Changes:

  • SDK: SalesforceSDKManager.simulatedDiscoveryResult (debug-gated setter + consumer); LoginActivity.applySimulatedDiscoveryResultIfApplicable hooks switchDefaultOrSalesforceWelcomeDiscoveryLogin to dispatch the same Intent the real sfdc://discocallback handler produces; new DiscoveryResultEditor Compose composable in Login Options.
  • Strings: 9 new debug-only sf__login_options_discovery_* (translatable="false"); sf__login_options_save_and_login replaces "Save" on the boot-config button (it closes the screen).
  • Tests: 3 SDK unit tests, 4 LoginOptions unit tests, 2 AuthFlowTester instrumented WelcomeLoginTests (regular_auth, advanced_auth).

…oid into feature/welcome-discovery-ui-tests

# Conflicts:
#	native/NativeSampleApps/AuthFlowTester/src/androidTest/java/com/salesforce/samples/authflowtester/pageObjects/LoginPageObject.kt
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

1 Warning
⚠️ libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/LoginActivity.kt#L668 - Switch statement on an int with known associated constant missing case BiometricManager.BIOMETRIC_ERROR_IDENTITY_CHECK_NOT_ACTIVE

Generated by 🚫 Danger

@github-actions
Copy link
Copy Markdown

Job Summary for Gradle

Pull Request :: test-android
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
SalesforceMobileSDK-Android native:NativeSampleApps:AuthFlowTester:assembleDebug 9.4.1 Build Scan not published
SalesforceMobileSDK-Android native:NativeSampleApps:AuthFlowTester:assembleAndroidTest 9.4.1 Build Scan not published

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

❌ Patch coverage is 89.71963% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.52%. Comparing base (0ec99fc) to head (b9aca47).
⚠️ Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
...m/salesforce/androidsdk/ui/LoginOptionsActivity.kt 89.87% 1 Missing and 7 partials ⚠️
.../salesforce/androidsdk/app/SalesforceSDKManager.kt 50.00% 0 Missing and 2 partials ⚠️
.../src/com/salesforce/androidsdk/ui/LoginActivity.kt 95.83% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #2907      +/-   ##
============================================
+ Coverage     66.41%   66.52%   +0.11%     
- Complexity     3099     3105       +6     
============================================
  Files           226      226              
  Lines         17774    17871      +97     
  Branches       2327     2339      +12     
============================================
+ Hits          11804    11889      +85     
- Misses         4896     4897       +1     
- Partials       1074     1085      +11     
Components Coverage Δ
Analytics 48.71% <ø> (ø)
SalesforceSDK 62.78% <89.71%> (+0.24%) ⬆️
Hybrid 59.30% <ø> (ø)
SmartStore 78.22% <ø> (ø)
MobileSync 82.12% <ø> (ø)
Files with missing lines Coverage Δ
.../src/com/salesforce/androidsdk/ui/LoginActivity.kt 45.62% <95.83%> (+1.37%) ⬆️
.../salesforce/androidsdk/app/SalesforceSDKManager.kt 61.85% <50.00%> (-0.09%) ⬇️
...m/salesforce/androidsdk/ui/LoginOptionsActivity.kt 93.99% <89.87%> (-1.62%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wmathurin
Copy link
Copy Markdown
Contributor

On iOS, if you just run the AuthFlowTester it won't show the view to simulate a domain discovery.
It's only visible when running UI tests (because the AuthFlowTester is started with IS_UI_TESTING. See https://github.com/forcedotcom/SalesforceMobileSDK-iOS/blob/dev/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Login/DevConfig/LoginOptionsViewController.swift#L72

Is it the same on Android or is it always shown?

@brandonpage
Copy link
Copy Markdown
Contributor Author

brandonpage commented May 28, 2026

On iOS, if you just run the AuthFlowTester it won't show the view to simulate a domain discovery. It's only visible when running UI tests (because the AuthFlowTester is started with IS_UI_TESTING. See https://github.com/forcedotcom/SalesforceMobileSDK-iOS/blob/dev/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Login/DevConfig/LoginOptionsViewController.swift#L72

Is it the same on Android or is it always shown?

It is always shown. I can look into changing it to only show for UI Tests.

Edit: Done.

// the process as UI-testing (and only in debug builds, enforced by the setter).
// Mirrors iOS' IS_UI_TESTING gate in LoginOptionsViewController.swift.
val sdkManager = SalesforceSDKManager.getInstance()
if (sdkManager.isDebugBuild && sdkManager.isUiTesting) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This method should only be accessed from tests or within private scope

Copy link
Copy Markdown
Contributor

@JohnsonEricAtSalesforce JohnsonEricAtSalesforce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@brandonpage brandonpage merged commit 72f6cd7 into forcedotcom:dev May 28, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants