-
Notifications
You must be signed in to change notification settings - Fork 393
AuthFlowTester App #2821
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
Open
brandonpage
wants to merge
7
commits into
forcedotcom:dev
Choose a base branch
from
brandonpage:AuthFlowTester
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
AuthFlowTester App #2821
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3482bb8
Create AuthFlowTester app with login UI test.
brandonpage bdd346a
Add all AuthFlowTester UI elements and make functions for rest reques…
brandonpage 70ffe08
Add all UI elements.
brandonpage 1bf002d
Add JwtTokenView.
brandonpage d14e8ec
Move common composables to BaseComponents class and refine UI.
brandonpage 2d65ff5
Fix test issue.
brandonpage 8630461
Add tests.
brandonpage 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
File renamed without changes.
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 |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| is_pr: | ||
| type: boolean | ||
| default: false | ||
|
|
||
| jobs: | ||
| test-android: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| BUNDLE_GEMFILE: ${{ github.workspace }}/.github/DangerFiles/Gemfile | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| if: ${{ inputs.is_pr }} | ||
| with: | ||
| # We need a sufficient depth or Danger will occasionally run into issues checking which files were modified. | ||
| fetch-depth: 100 | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
| - uses: actions/checkout@v4 | ||
| if: ${{ ! inputs.is_pr }} | ||
| with: | ||
| ref: ${{ github.head_ref }} | ||
| - name: Install Dependencies | ||
| env: | ||
| TEST_CREDENTIALS: ${{ secrets.TEST_CREDENTIALS }} | ||
| run: | | ||
| ./install.sh | ||
| echo $TEST_CREDENTIALS > ./shared/test/test_credentials.json | ||
| - uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'zulu' | ||
| java-version: '21' | ||
| - name: Setup Android SDK | ||
| uses: android-actions/setup-android@v3 | ||
| - uses: gradle/actions/setup-gradle@v4 | ||
| with: | ||
| # This is the actual Gradle version (not AGP), which can be found in the gradle-wrapper.properties file. | ||
| gradle-version: "8.14.3" | ||
| add-job-summary: on-failure | ||
| add-job-summary-as-pr-comment: on-failure | ||
| - name: Build for Testing | ||
| if: success() || failure() | ||
| run: | | ||
| ./gradlew native:NativeSampleApps:AuthFlowTester:assembleDebug | ||
| - name: Build Tests for PR | ||
| if: ${{ inputs.is_pr }} | ||
| run: | | ||
| ./gradlew native:NativeSampleApps:AuthFlowTester:assembleAndroidTest --tests "com.salesforce.samples.authflowtester.loginTest" | ||
| - name: Build Tests for Nightly | ||
| if: ${{ !inputs.is_pr }} | ||
| run: | | ||
| ./gradlew native:NativeSampleApps:AuthFlowTester:assembleAndroidTest | ||
| - uses: 'google-github-actions/auth@v2' | ||
| if: success() || failure() | ||
| with: | ||
| credentials_json: '${{ secrets.GCLOUD_SERVICE_KEY }}' | ||
| - uses: 'google-github-actions/setup-gcloud@v2' | ||
| if: success() || failure() | ||
| - name: Run Tests | ||
| continue-on-error: true | ||
| if: success() || failure() | ||
| env: | ||
| # Most used according to https://gs.statcounter.com/android-version-market-share/mobile-tablet/worldwide | ||
| PR_API_VERSION: "35" | ||
| FULL_API_RANGE: "28 29 30 31 32 33 34 35 36" | ||
| IS_PR: ${{ inputs.is_pr }} | ||
| run: | | ||
| LEVELS_TO_TEST=$FULL_API_RANGE | ||
| RETRIES=0 | ||
|
|
||
| if $IS_PR ; then | ||
| LEVELS_TO_TEST=$PR_API_VERSION | ||
| RETRIES=1 | ||
| fi | ||
|
|
||
| mkdir firebase_results | ||
| for LEVEL in $LEVELS_TO_TEST | ||
| do | ||
| GCLOUD_RESULTS_DIR=authflowtester-api-${LEVEL}-build-${{github.run_number}} | ||
|
|
||
| eval gcloud beta firebase test android run \ | ||
| --project mobile-apps-firebase-test \ | ||
| --type instrumentation \ | ||
| --app "native/NativeSampleApps/AuthFlowTester/build/outputs/apk/debug/AuthFlowTester-debug.apk" \ | ||
| --test="native/NativeSampleApps/AuthFlowTester/build/outputs/apk/androidTest/debug/AuthFlowTester-debug-androidTest.apk" \ | ||
| --device model=MediumPhone.arm,version=${LEVEL},locale=en,orientation=portrait \ | ||
| --environment-variables \ | ||
| --directories-to-pull=/sdcard \ | ||
| --results-dir=${GCLOUD_RESULTS_DIR} \ | ||
| --results-history-name=AuthFlowTester \ | ||
| --timeout=30m --no-performance-metrics \ | ||
| --num-flaky-test-attempts=${RETRIES} || true | ||
| done | ||
| - name: Copy Test Results | ||
| continue-on-error: true | ||
| if: success() || failure() | ||
| env: | ||
| # Most used according to https://gs.statcounter.com/android-version-market-share/mobile-tablet/worldwide | ||
| PR_API_VERSION: "35" | ||
| FULL_API_RANGE: "28 29 30 31 32 33 34 35 36" | ||
| IS_PR: ${{ inputs.is_pr }} | ||
| run: | | ||
| LEVELS_TO_TEST=$FULL_API_RANGE | ||
|
|
||
| if $IS_PR ; then | ||
| LEVELS_TO_TEST=$PR_API_VERSION | ||
| fi | ||
|
|
||
| for LEVEL in $LEVELS_TO_TEST | ||
| do | ||
| GCLOUD_RESULTS_DIR=authflowtester-api-${LEVEL}-build-${{github.run_number}} | ||
| BUCKET_PATH="gs://test-lab-w87i9sz6q175u-kwp8ium6js0zw/${GCLOUD_RESULTS_DIR}" | ||
|
|
||
| gsutil ls ${BUCKET_PATH} > /dev/null 2>&1 | ||
| if [ $? == 0 ] ; then | ||
| # Copy XML file for test reporting | ||
| if gsutil ls "${BUCKET_PATH}/*test_results_merged.xml" > /dev/null 2>&1; then | ||
| # Sharded runs produce test_results_merged.xml at top level | ||
| gsutil cp "${BUCKET_PATH}/*test_results_merged.xml" firebase_results/api_${LEVEL}_test_result.xml | ||
| else | ||
| gsutil cp "${BUCKET_PATH}/*/test_result_1.xml" firebase_results/api_${LEVEL}_test_result.xml | ||
| fi | ||
| fi | ||
| done | ||
| - name: Test Report | ||
| uses: mikepenz/action-junit-report@v5 | ||
| if: success() || failure() | ||
| with: | ||
| check_name: ${{ inputs.lib }} Test Results | ||
| job_name: ${{ inputs.lib }} Test Results | ||
| require_tests: true | ||
| check_retries: true | ||
| flaky_summary: true | ||
| fail_on_failure: true | ||
| group_reports: false | ||
| include_passed: true | ||
| include_empty_in_summary: false | ||
| simplified_summary: true | ||
| report_paths: 'firebase_results/**.xml' |
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 |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| [submodule "external/shared"] | ||
| path = external/shared | ||
| url = https://github.com/forcedotcom/SalesforceMobileSDK-Shared.git | ||
| [submodule "external/SalesforceMobileSDK-UITests"] | ||
| path = external/SalesforceMobileSDK-UITests | ||
| url = https://github.com/forcedotcom/SalesforceMobileSDK-UITests | ||
Submodule SalesforceMobileSDK-UITests
added at
e805ca
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 |
|---|---|---|
|
|
@@ -48,6 +48,11 @@ class ScopeParser { | |
| return ScopeParser(scopeString) | ||
| } | ||
|
|
||
| /** | ||
| * String extension to convert to [ScopeParser]. | ||
| */ | ||
| fun String?.toScopeParser(): ScopeParser = ScopeParser(scopeString = this) | ||
|
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. One of only a few SDK changes. This (and |
||
|
|
||
| /** | ||
| * Computes the scope parameter from an array of scopes. | ||
| * | ||
|
|
@@ -74,6 +79,18 @@ class ScopeParser { | |
| scopesSet.add(REFRESH_TOKEN) | ||
| return scopesSet.joinToString(" ") | ||
| } | ||
|
|
||
| /** | ||
| * Computes the scope parameter from an array of scopes. | ||
| * | ||
| * Behavior: | ||
| * - If {@code scopes} is null or empty, returns an empty string. This indicates that all | ||
| * scopes assigned to the connected app / external client app will be requested by default | ||
| * (no explicit scope parameter is sent). | ||
| * - If {@code scopes} is non-empty, ensures {@code refresh_token} is present in the set and | ||
| * returns a space-delimited string of unique, sorted scopes. | ||
| */ | ||
| fun Array<String>?.toScopeParameter(): String = computeScopeParameter(this) | ||
| } | ||
|
|
||
| private val _scopes: MutableSet<String> | ||
|
|
||
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.
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.
I am not a big fan of having the main repo having a test repo as submodule.
Right now it's only used for tests for AuthFlowTester but still.
Could we inverse the dependency? Have shared test code live in the main repo (next to the UI code it is for) and have the UITests repo pull it from there?
Uh oh!
There was an error while loading. Please reload this page.
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.
I guess I could try it, but that does not make sense in my head. The UITests repo has a single, narrow, purpose and needing to pull in SalesforceMobileSDK-Android, SalesforceMobileSDK-iOS, SalesforceMobileSDK-iOS-Hybrid and SalesforceMobileSDK-React seems backwards. All of the shared UITest infrastructure should live in 1 place (not 4) IMO.
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.
I guess we can figure that out later.