Skip to content

SDKS-4641#28

Merged
pingidentity-gaurav merged 45 commits into
mainfrom
SDKS-4641
Apr 15, 2026
Merged

SDKS-4641#28
pingidentity-gaurav merged 45 commits into
mainfrom
SDKS-4641

Conversation

@tsdamas
Copy link
Copy Markdown
Contributor

@tsdamas tsdamas commented Apr 2, 2026

PR Summary

This PR adds BrowserStack-backed end-to-end coverage for PingTestRunner across both Android and iOS. It introduces reusable GitHub Actions workflows for BrowserStack execution, updates the runner build/signing setup to support cloud execution, and adds a broad iOS XCUITest suite that mirrors the existing sample-app scenarios.

Reviewer Notes

  • Review .github/workflows first. The main behavior change is the new reusable BrowserStack automation, including a dedicated macOS artifact-prep flow for signed iOS app and XCUITest bundles.
  • In PingTestRunner, the highest-risk changes are the BrowserStack-specific build/test plumbing:
    • Android now uses the BrowserStack Detox fork and a cloud-specific Detox configuration.
    • iOS now has a shared XCUITest target/scheme plus manual signing/export support for BrowserStack uploads.
  • The new iOS UI tests mirror the existing scenario coverage for app launch, browser, device ID, device profile, logger, storage, journey, OIDC, useJourney, and useOidc.
  • Some tests are intentionally environment-gated and self-skip when live Ping/OIDC secrets are not available.

Key Changes by workspace

.github

  • Added reusable BrowserStack Android E2E workflow.
  • Added BrowserStack iOS E2E workflow plus a separate artifact-prep/signing workflow for IPA and XCUITest bundle creation.
  • Updated CI inputs so affected-package jobs work in both PR and push contexts.
  • Converted e2e-tests.yml into a reusable workflow entrypoint.
  • Improved BrowserStack iOS API error visibility during build startup.

Workspace root

  • Added root scripts for BrowserStack Android and iOS build/test flows used by CI.
  • Updated lockfile/install state to support the new tooling changes.

PingTestRunner

  • Switched Detox usage to the BrowserStack cloud fork and added Android cloud configuration.
  • Increased E2E Jest timeout for slower cloud/device execution.
  • Added Android BrowserStack build support:
    • release + androidTest build wiring
    • local :detox source module integration
    • network security config for Detox communication
    • proguard/codegen/build updates required for release cloud runs
  • Added iOS BrowserStack build support:
    • shared XCUITest target in the Xcode project/scheme
    • deployment target alignment for supported BrowserStack devices
    • app/UI test provisioning profile support for signed artifact generation
  • Added iOS XCUITest coverage for Tier 1 and Tier 2 scenarios in PingTestRunnerUITests.

Summary by CodeRabbit

  • New Features

    • BrowserStack end-to-end testing support for iOS and Android
    • New iOS UI test suites covering app launch, browser, OIDC, journey, storage, logger, and related scenarios
  • Testing

    • Improved coverage collection and Codecov uploads across packages (JS, Android, iOS)
    • Longer e2e test timeouts and additional UI test helpers
  • CI/CD

    • New reusable workflows to prepare, upload, run, and parse BrowserStack test runs
    • Local CI checks (pre-commit hooks) and README coverage badge added

@tsdamas tsdamas added the wip Working in progress, do not review. label Apr 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 2, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-04-15 13:26 UTC

@tsdamas tsdamas removed the wip Working in progress, do not review. label Apr 9, 2026
tsdamas added 25 commits April 9, 2026 15:37
…r BrowserStack e2e

Detox requires a network_security_config.xml to allow cleartext WebSocket
traffic to localhost/10.0.2.2 for its instrumentation layer. Without it,
the Detox server connection is unreliable on Android 9+, causing the React
context to not be ready when idling resources are initialized.

Also adds testBuildType dynamic property and the Detox-supplied proguard
rules for release builds.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks like a metro build artifact

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. This was a remaining when testing the Detox/BrowserStack Android setup. I'll remove it.

// The :detox source module uses @ExperimentalStdlibApi APIs without opt-in
// annotations. Kotlin 2.1 treats missing opt-in as a compile error, so we
// inject the flag globally for all subprojects.
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks pretty broad. Could we scope the flag for :detox source module instead? Something like this maybe:

project(':detox') {
    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
        kotlinOptions { freeCompilerArgs += ['-opt-in=kotlin.ExperimentalStdlibApi'] }
    }
}

Comment thread PingTestRunner/package.json Outdated
"build:e2e:ios": "detox build --configuration ios.sim",
"build:bs:ios:archive": "sh -c 'set -eu; ARCHIVE_PATH=${BS_IOS_ARCHIVE_PATH:-ios/build/browserstack/PingTestRunner.xcarchive}; EXTRA_XCODEBUILD_ARGS=${BS_IOS_ARCHIVE_XCODEBUILD_ARGS:-}; xcodebuild -workspace ios/PingTestRunner.xcworkspace -scheme PingTestRunner -configuration Release -destination generic/platform=iOS -archivePath \"$ARCHIVE_PATH\" $EXTRA_XCODEBUILD_ARGS archive'",
"build:bs:ios:ipa": "sh -c 'set -eu; ARCHIVE_PATH=${BS_IOS_ARCHIVE_PATH:-ios/build/browserstack/PingTestRunner.xcarchive}; EXPORT_PATH=${BS_IOS_EXPORT_PATH:-ios/build/browserstack/export}; EXPORT_OPTIONS_PLIST=${BS_IOS_EXPORT_OPTIONS_PLIST:?Set BS_IOS_EXPORT_OPTIONS_PLIST to an exportOptions.plist path}; xcodebuild -exportArchive -archivePath \"$ARCHIVE_PATH\" -exportPath \"$EXPORT_PATH\" -exportOptionsPlist \"$EXPORT_OPTIONS_PLIST\"'",
"build:bs:ios:test-suite": "sh -c 'set -eu; DERIVED_DATA_PATH=${BS_IOS_DERIVED_DATA_PATH:-ios/build/browserstack-derived-data}; EXTRA_XCODEBUILD_ARGS=${BS_IOS_TEST_SUITE_XCODEBUILD_ARGS:-}; SIGNING_ARGS=\"\"; if [ -n \"${BS_IOS_TEAM_ID:-}\" ]; then SIGNING_ARGS=\"$SIGNING_ARGS DEVELOPMENT_TEAM=${BS_IOS_TEAM_ID}\"; fi; if [ -n \"${BS_IOS_APP_PROFILE_UUID:-}\" ] || [ -n \"${BS_IOS_UI_TEST_PROFILE_UUID:-}\" ]; then SIGNING_ARGS=\"$SIGNING_ARGS CODE_SIGN_STYLE=Manual\"; fi; if [ -n \"${BS_IOS_APP_PROFILE_UUID:-}\" ]; then SIGNING_ARGS=\"$SIGNING_ARGS APP_PROVISIONING_PROFILE_UUID=${BS_IOS_APP_PROFILE_UUID}\"; fi; if [ -n \"${BS_IOS_UI_TEST_PROFILE_UUID:-}\" ]; then SIGNING_ARGS=\"$SIGNING_ARGS UI_TEST_PROVISIONING_PROFILE_UUID=${BS_IOS_UI_TEST_PROFILE_UUID}\"; fi; xcodebuild -workspace ios/PingTestRunner.xcworkspace -scheme PingTestRunner -configuration Debug -sdk iphoneos -destination generic/platform=iOS -derivedDataPath \"$DERIVED_DATA_PATH\" $SIGNING_ARGS $EXTRA_XCODEBUILD_ARGS build-for-testing; cd \"$DERIVED_DATA_PATH/Build/Products/Debug-iphoneos\"; rm -f PingTestRunnerUITests-Runner.zip; zip --symlinks -r PingTestRunnerUITests-Runner.zip PingTestRunnerUITests-Runner.app'",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We probably can extract this to a separate file in scripts/

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

- add browser and device-profile iOS test specs and include them in the PingTestRunner test scheme
- add Swift unit tests for browser and device-profile shared iOS bridge logic
- wire lefthook on postinstall with pre-commit formatting, lint, and copyright checks
- add the copyright validation script and update cleanup-docs-preview permissions
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 14, 2026

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: b873df39-97da-4761-9eb1-c69137af542b

📥 Commits

Reviewing files that changed from the base of the PR and between a8b0943 and d4babed.

📒 Files selected for processing (1)
  • packages/device-profile/ios/RNPingDeviceProfileCommon.swift

📝 Walkthrough

Walkthrough

Adds BrowserStack E2E pipelines for Android and iOS, broad CI workflow updates, expanded coverage reporting, Detox cloud configuration, numerous iOS UI tests and helpers, Android/Gradle Detox integration, test build scripts, and standardizes Jest/Android coverage across packages.

Changes

Cohort / File(s) Summary
BrowserStack workflows & parsers
.github/workflows/browserstack-e2e-android.yml, .github/workflows/browserstack-e2e-ios.yml, .github/workflows/browserstack-parse-results-ios.yml, .github/workflows/browserstack-prep-ios-artifacts.yml
Added callable BrowserStack E2E workflows (Android + iOS), artifact-prep workflow for iOS signing/build, and a reusable iOS results parser. Workflows upload artifacts, start BrowserStack builds, and surface build IDs/results.
CI orchestration & workflow tweaks
.github/workflows/ci.yml, .github/workflows/e2e-tests.yml, .github/workflows/build-and-test-android.yml, .github/workflows/build-and-test-ios.yml, .github/workflows/js-unit-tests.yml, .github/workflows/cleanup-docs-preview.yml, .github/workflows/preview-docs.yml
Updated CI triggers/inputs, added secrets: inherit, wired optional BrowserStack jobs (disabled by if:false), refined Turbo SHA resolution, adjusted macOS runners/iOS simulator targets, and added Codecov uploads.
Detox cloud config & scripts
PingTestRunner/.detoxrc.js, PingTestRunner/package.json, PingTestRunner/scripts/*.sh
Removed local Detox server config, added BrowserStack cloud device/app/test URLs and cloud auth settings; added BrowserStack-specific Detox/npm scripts and iOS build/test/ipa/archive helper scripts.
PingTestRunner iOS project & tests
PingTestRunner/ios/PingTestRunner.xcodeproj/..., PingTestRunner/ios/Podfile, PingTestRunner/ios/PingTestRunnerUITests/*.swift, PingTestRunner/ios/PingTestRunnerUITests/TestEnvironment.swift, PingTestRunner/ios/PingTestRunnerUITests/UIInteractionHelpers.swift, PingTestRunner/ios/PingTestRunnerUITests/BaseTestCase.swift
Added UI test target and many XCUITest suites, test environment singleton, interaction helpers, BaseTestCase utilities, and scheme/config updates plus Pod additions for test-only RN bridge pods.
Android runner & Gradle changes
PingTestRunner/android/settings.gradle, PingTestRunner/android/build.gradle, PingTestRunner/android/app/build.gradle, PingTestRunner/android/app/src/main/AndroidManifest.xml, PingTestRunner/android/app/src/main/res/xml/network_security_config.xml
Switched Detox to local Gradle subproject, added detox flavor dimension and proguard rules, set testBuildType system property, enabled cleartext for localhost/emulator, and added coverage-related Gradle Kotlin compiler opt-in for the detox project.
Package Jest coverage & Android coverage
packages/*/jest.config.js (multiple), packages/*/android/build.gradle (multiple), packages/browser/jest.config.js, packages/device-id/jest.config.js, packages/device-profile/jest.config.js, etc.
Standardized Jest coverage collection across packages and added debug build types with testCoverageEnabled for Android library modules.
Device-profile test hooks & implementations
packages/device-profile/ios/RNPingDeviceProfileCommon.swift, packages/device-profile/ios/Tests/*, packages/device-profile/RNPingDeviceProfile.podspec
Added DEBUG-only payload override hook for deterministic device-profile tests, updated tests to use it and strengthened assertions; added CocoaPods test_spec.
Browser & OIDC tests / mocks
packages/browser/RNPingBrowser.podspec, packages/browser/ios/Tests/RNPingBrowserCommonTests.swift, packages/oidc/src/__tests__/index.test.tsx
Added test_spec to browser podspec, annotated tests with @MainActor, tightened error expectations, and adjusted Jest mock invocation to include options.
Repo tooling & scripts
package.json, PingTestRunner/package.json, lefthook.yml, scripts/check-copyright.sh, README.md
Added Lefthook pre-commit config and postinstall hook, new workspace npm scripts for BrowserStack builds/tests, copyright-check script, and Codecov badge in README.
JS scenarios & UI test IDs
PingTestRunner/scenarios/UseJourneyScenario.tsx, PingTestRunner/scenarios/UseOidcScenario.tsx, PingTestRunner/scenarios/DeviceProfileScenario.tsx
Exposed refreshed tokens in UI state, added test IDs for refreshed-token results, and tightened state updates to set success flags only on success.
Misc small changes
PingTestRunner/e2e/jest.config.js, PingTestRunner/Gemfile, PingTestRunner/ios/Podfile, various package jest files
Increased e2e Jest timeout, bumped xcodeproj gem constraint, and other small config tweaks.
sequenceDiagram
  participant GH as GitHub Actions
  participant Local as Build Runner (macOS/Ubuntu)
  participant Repo as Repository (code/scripts)
  participant BrowserStack as BrowserStack API
  participant Detox as Detox Cloud Runner
  participant Results as Results Parser

  GH->>Local: checkout + setup toolchain (node/java/xcode)
  Local->>Repo: run build scripts (assemble APK/IPA, build-tests)
  Local->>BrowserStack: upload app + test artifacts (REST)
  BrowserStack-->>Local: app_url / test_url (or error)
  GH->>BrowserStack: start test build (POST payload with app/test urls & env)
  BrowserStack->>Detox: execute tests on device farm
  Detox->>BrowserStack: stream/capture logs & status
  GH->>BrowserStack: poll build status
  BrowserStack-->>GH: final status + device sessions
  GH->>Results: parse logs, write $GITHUB_STEP_SUMMARY
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 I hopped through workflows, scripts, and pods so spry,
New tests take flight on BrowserStack in the sky,
Coverage blooms, Detox now clouds our run,
UI suites sing checks till every test is done,
A tiny rabbit cheers — CI's polished and high!


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@spetrov spetrov left a comment

Choose a reason for hiding this comment

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

LGTM! 👍🏻

Comment thread .github/workflows/e2e-tests.yml Outdated
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'd suggest using macos-26-xlarge wherever possible...

Copy link
Copy Markdown
Contributor

@pingidentity-gaurav pingidentity-gaurav left a comment

Choose a reason for hiding this comment

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

LGTM

@pingidentity-gaurav pingidentity-gaurav merged commit 376b0a5 into main Apr 15, 2026
22 of 24 checks passed
@pingidentity-gaurav pingidentity-gaurav deleted the SDKS-4641 branch April 15, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants