Skip to content

[iOS] Get React Native tests passing - #499

Merged
wmathurin merged 4 commits into
forcedotcom:devfrom
wmathurin:fix/ios-react-native-tests
Sep 24, 2026
Merged

wmathurin merged 4 commits into
forcedotcom:devfrom
wmathurin:fix/ios-react-native-tests

Conversation

@wmathurin

@wmathurin wmathurin commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Get the React Native test application and test suite passing reliably on iOS, including the scene-based lifecycle required by current iOS releases.

Code highlights

  • Add a proper UISceneDelegate lifecycle to the iOS test application and create its window from the connected scene.
  • Delay Salesforce SDK initialization and React Native startup until the scene becomes active. This preserves the instant-login flow while avoiding startup re-entrancy on iOS 18 and allowing the app to launch on iOS 27.
  • Use the active scene for interactive login.
  • Replace hard-coded /Applications/Xcode.app header paths with $(TOOLCHAIN_DIR) so the project builds with both Xcode 26 and Xcode 27 beta.
  • Propagate JavaScript test errors through the test UI and have XCUITest watch pass and failure markers simultaneously. Promise rejections now fail immediately with a useful phase/status/error code instead of surfacing as long, ambiguous timeouts.
  • Expose each JavaScript error through a dedicated accessibility message node and cover exact message recovery with an expected-failure Harness regression. The diagnostic-only JS test is excluded from interactive Run All, suite Run All, and Android's headless run.
  • Grant the reusable iOS JUnit reporter checks: write in PR and nightly workflows so it can publish test checks.

Local test matrix

All passing runs used a test user on authflowtestingmsdksdb38.test1.my.pc-rnd.salesforce.com.

Platform Device / runtime Toolchain Result
Android Pixel 9 Pro XL, Android 16 / API 36 Upstream dev 35/35 passed
iOS iPhone 16 Pro simulator, iOS 18.6 (22G86) Xcode 26.6 (17F113) 35/35 passed
iOS iPhone 17 Pro simulator, iOS 26.5 (23F77) Xcode 26.6 (17F113) 35/35 passed
iOS iPhone 17 Pro simulator, iOS 27.0 (24A5408d) Xcode 27.0 beta (27A5252f) 36/36 passed

The shared product-behavior suite remains 35 tests: Harness 2, MobileSync 5, Net 16, OAuth 1, and SmartStore 11. The current iOS XCTest suite adds one green regression that deliberately triggers a stable JS failure and passes only when XCUITest recovers the exact error text. The iOS 18.6 and 26.5 runs predate that regression and passed the complete 35-test product suite; the final iOS 27.0 run passed all 36 current XCTest methods.

Credential/org diagnosis

Test1 is not a hard-coded product requirement and this PR adds no dependency on that domain. The original test user authenticated and refreshed successfully, but its org returned HTTP 403 with Salesforce error code REQUEST_LIMIT_EXCEEDED during Contact creation. That explains the earlier Net/MobileSync failures and distinguishes them from stale credentials, Contact CRUD permissions, or a React Native code defect.

CI needs credentials for a suitable test org/user with available API request capacity. The Test1 user above is the validated replacement used for this matrix; no username, token, client ID, org ID, or credential file is included in this change.

An A/B run against the current iOS SDK and the revision before forcedotcom/SalesforceMobileSDK-iOS#4174 produced the same API-limit failure with the original org, so that iOS SDK PR does not appear to be the cause.

Final validation after diagnostics cleanup

  • npm run build
  • git diff --check
  • plutil -lint for the application plist and Xcode project
  • Xcode 26.6 simulator build
  • Xcode 27.0 beta simulator build
  • iOS 27.0 focused review-regression run, 4/4 passed:
    • Harness testExpectedFailureDiagnostic recovered the exact expected JS message
    • Harness testPassing
    • Net testCollectionCreateDeleteRetrieve
    • MobileSync testCleanResyncGhosts
  • iOS 27.0 complete current XCTest suite, 36/36 passed

CI follow-up

The first PR run, using the repository's existing secret, executed all 35 iOS tests: iOS 18 reported 33/35 and iOS 26 reported 32/35, with remaining failures confined to MobileSync. The same MobileSync tests pass locally across iOS 18.6, 26.5, and 27.0 with the validated replacement user. CI should be rerun after its credential secret is updated to an org/user with available capacity.

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
TestsPassed ☑️SkippedFailed ❌️
iOS ^18 Test Results36 ran17 ✅19 ❌
TestResult
iOS ^18 Test Results
ReactHarnessTests.testExpectedFailureDiagnostic()❌ failure
ReactMobileSyncTests.testCleanResyncGhosts()❌ failure
ReactMobileSyncTests.testGetSyncStatusDeleteSync()❌ failure
ReactMobileSyncTests.testReSync()❌ failure
ReactMobileSyncTests.testSyncDown()❌ failure
ReactMobileSyncTests.testSyncUp()❌ failure
ReactNetTests.testCollectionCreateDeleteRetrieve()❌ failure
ReactNetTests.testCollectionCreateRetrieve()❌ failure
ReactNetTests.testCollectionUpsertUpdateRetrieve()❌ failure
ReactNetTests.testCreateDelRetrieve()❌ failure
ReactNetTests.testCreateRetrieve()❌ failure
ReactNetTests.testDescribe()❌ failure
ReactNetTests.testDescribeGlobal()❌ failure
ReactNetTests.testDescribeLayout()❌ failure
ReactNetTests.testMetaData()❌ failure
ReactNetTests.testQuery()❌ failure
ReactNetTests.testResources()❌ failure
ReactNetTests.testSearch()❌ failure
ReactNetTests.testUpsertUpdateRetrieve()❌ failure

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
TestsPassed ☑️SkippedFailed ❌️
iOS ^26 Test Results36 ran17 ✅19 ❌
TestResult
iOS ^26 Test Results
ReactHarnessTests.testExpectedFailureDiagnostic()❌ failure
ReactMobileSyncTests.testCleanResyncGhosts()❌ failure
ReactMobileSyncTests.testGetSyncStatusDeleteSync()❌ failure
ReactMobileSyncTests.testReSync()❌ failure
ReactMobileSyncTests.testSyncDown()❌ failure
ReactMobileSyncTests.testSyncUp()❌ failure
ReactNetTests.testCollectionCreateDeleteRetrieve()❌ failure
ReactNetTests.testCollectionCreateRetrieve()❌ failure
ReactNetTests.testCollectionUpsertUpdateRetrieve()❌ failure
ReactNetTests.testCreateDelRetrieve()❌ failure
ReactNetTests.testCreateRetrieve()❌ failure
ReactNetTests.testDescribe()❌ failure
ReactNetTests.testDescribeGlobal()❌ failure
ReactNetTests.testDescribeLayout()❌ failure
ReactNetTests.testMetaData()❌ failure
ReactNetTests.testQuery()❌ failure
ReactNetTests.testResources()❌ failure
ReactNetTests.testSearch()❌ failure
ReactNetTests.testUpsertUpdateRetrieve()❌ failure

Comment thread iosTests/ios/SalesforceReactTests/BaseReactNativeTest.swift Outdated
@wmathurin
wmathurin marked this pull request as ready for review September 24, 2026 01:14
@wmathurin
wmathurin merged commit fe5efb4 into forcedotcom:dev Sep 24, 2026
6 of 9 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.

2 participants