-
Notifications
You must be signed in to change notification settings - Fork 429
Auth UI tests in CI #3988
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
Auth UI tests in CI #3988
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2aec0ba
Moving ui_test_config.json to shared/test
wmathurin d825f83
Running UI tests on CI
wmathurin 6376e6b
Running on concrete simulator
wmathurin 0e85675
Commenting out jobs for testing
wmathurin df1af6f
Changing target simulator
wmathurin e91fd01
Running the test suites in parallel
wmathurin af4fea2
Running nightly tests on iOS 26 / no retry on failures
wmathurin 1922eed
Running tests in parallel via xcodebuild flag rather than using a mat…
wmathurin fe366af
Using xcrun to see available simulators
wmathurin 843926d
No need to specify destination - workflow can resolve destination usi…
wmathurin ec956ef
Changing defaults for UI tests - commenting out other jobs for testing
wmathurin 80bfbe8
Tweaking ui workflow script
wmathurin 45cbe48
Another fix
wmathurin 9ce0066
Retry on failure
wmathurin ec0223e
Bringing back commented out jobs - moving UI tests to a separate work…
wmathurin d896405
Split by test suite
wmathurin 0a14625
Merge branch 'dev' of github.com:wmathurin/SalesforceMobileSDK-iOS in…
wmathurin 2a8263d
Running more UI tests (too many??) with every PR
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 |
|---|---|---|
| @@ -0,0 +1,170 @@ | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| is_pr: | ||
| type: boolean | ||
| default: false | ||
| ios: | ||
| default: "^26" | ||
| required: false | ||
| type: string | ||
| xcode: | ||
| default: "^26" | ||
| required: false | ||
| type: string | ||
| macos: | ||
| default: macos-latest | ||
| required: false | ||
| type: string | ||
| test-retry-iterations: | ||
| description: "Max retries per test on failure (1 = no retry)." | ||
| default: 2 | ||
| required: false | ||
| type: number | ||
| test_suite: | ||
| description: "Test class to run only (e.g. ECALoginTests). Empty = run all. Ignored when is_pr (PR uses pr_tests instead)." | ||
| default: "" | ||
| required: false | ||
| type: string | ||
| pr_tests: | ||
| description: "JSON array of test identifiers to run (e.g. ['AuthFlowTesterUITests/ECALoginTests/testECA...']). Used when is_pr is true; empty = use default PR smoke test." | ||
| default: "[]" | ||
| required: false | ||
| type: string | ||
| destination: | ||
| description: "xcodebuild -destination (e.g. 'platform=iOS Simulator,name=iPhone 17,OS=26.0'). Empty = use default for iOS 26." | ||
| default: "" | ||
| required: false | ||
| type: string | ||
| parallel-testing-worker-count: | ||
| description: "xcodebuild -parallel-testing-worker-count (0 = do not set; parallel testing uses xcodebuild default)." | ||
| default: 0 | ||
| required: false | ||
| type: number | ||
|
|
||
| jobs: | ||
| test-ui: | ||
| runs-on: ${{ inputs.macos }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| if: ${{ inputs.is_pr }} | ||
| with: | ||
| 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: | ||
| UI_TEST_CONFIG: ${{ secrets.UI_TEST_CONFIG }} | ||
| run: | | ||
| ./install.sh | ||
| echo "$UI_TEST_CONFIG" > ./shared/test/ui_test_config.json | ||
| - name: Install iOS 17 runtime if needed | ||
| if: ${{ inputs.ios == '^17' }} | ||
| run: xcodes runtimes install "iOS 17.5" | ||
| # Select Xcode only (mxcl action does not support -retry-tests-on-failure) | ||
| - uses: mxcl/xcodebuild@v3 | ||
| with: | ||
| xcode: ${{ inputs.xcode }} | ||
| platform: iOS | ||
| platform-version: ${{ inputs.ios }} | ||
| action: none | ||
| - name: Resolve simulator destination | ||
| id: resolve_destination | ||
| run: | | ||
| if [ -n "${{ inputs.destination }}" ]; then | ||
| echo "destination=${{ inputs.destination }}" >> "$GITHUB_OUTPUT" | ||
| else | ||
| SIM_UDID=$(xcrun simctl list devices available -j | python3 -c ' | ||
| import sys, json | ||
| d = json.load(sys.stdin) | ||
| for devices in d.get("devices", {}).values(): | ||
| for dev in devices: | ||
| if dev.get("isAvailable", True) and "iPhone" in dev.get("name", ""): | ||
| print(dev["udid"]) | ||
| sys.exit(0) | ||
| sys.exit(1) | ||
| ') | ||
| if [ -z "$SIM_UDID" ]; then | ||
| echo "::error::No available iPhone simulator found" | ||
| exit 1 | ||
| fi | ||
| echo "destination=platform=iOS Simulator,id=$SIM_UDID" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| - name: Run UI tests | ||
| id: xcodebuild | ||
| run: | | ||
| DESTINATION="${{ steps.resolve_destination.outputs.destination }}" | ||
| RETRY_ARGS=() | ||
| if [ "${{ inputs.test-retry-iterations }}" -gt 1 ]; then | ||
| RETRY_ARGS=(-retry-tests-on-failure -test-iterations "${{ inputs.test-retry-iterations }}") | ||
| fi | ||
| ONLY_TESTING_ARGS=() | ||
| if [ "$IS_PR" = "true" ]; then | ||
| PR_TESTS='${{ inputs.pr_tests }}' | ||
| if [ -n "$PR_TESTS" ] && [ "$PR_TESTS" != "[]" ]; then | ||
| while IFS= read -r t; do | ||
| ONLY_TESTING_ARGS+=(-only-testing "$t") | ||
| done < <(echo "$PR_TESTS" | python3 -c "import sys, json; [print(t) for t in json.load(sys.stdin)]") | ||
| else | ||
| ONLY_TESTING_ARGS=(-only-testing 'AuthFlowTesterUITests/ECALoginTests/testECAAdvancedJwt_DefaultScopes') | ||
| fi | ||
| elif [ -n "${{ inputs.test_suite }}" ]; then | ||
| ONLY_TESTING_ARGS=(-only-testing "AuthFlowTesterUITests/${{ inputs.test_suite }}") | ||
| fi | ||
| PARALLEL_ARGS=() | ||
| if [ "${{ inputs.parallel-testing-worker-count }}" -gt 0 ]; then | ||
| PARALLEL_ARGS=(-parallel-testing-enabled YES -parallel-testing-worker-count "${{ inputs.parallel-testing-worker-count }}") | ||
| fi | ||
| xcodebuild test \ | ||
| -workspace SalesforceMobileSDK.xcworkspace \ | ||
| -scheme AuthFlowTester \ | ||
| -destination "$DESTINATION" \ | ||
| "${PARALLEL_ARGS[@]}" \ | ||
| "${ONLY_TESTING_ARGS[@]}" \ | ||
| "${RETRY_ARGS[@]}" \ | ||
| -resultBundlePath test \ | ||
| -enableCodeCoverage YES \ | ||
| | xcbeautify | ||
| env: | ||
| CODE_COVERAGE: YES | ||
| IS_PR: ${{ inputs.is_pr }} | ||
| - name: Parse test results | ||
| if: success() || failure() | ||
| run: | | ||
| brew install xcresultparser | ||
| mkdir -p firebase_results | ||
| SUITE="${{ inputs.test_suite }}" | ||
| [ -z "$SUITE" ] && SUITE=all | ||
| [ "$IS_PR" = "true" ] && SUITE=pr | ||
| xcresultparser -o junit test.xcresult > firebase_results/authflowtester-ui-${SUITE}-test_result.xml | ||
| - name: Test Report | ||
| uses: mikepenz/action-junit-report@v5 | ||
| if: success() || failure() | ||
| with: | ||
| check_name: AuthFlowTester UI Test Results ${{ inputs.test_suite && format('({0})', inputs.test_suite) || '' }} | ||
| job_name: AuthFlowTester UI Test Results ${{ inputs.test_suite && format('({0})', inputs.test_suite) || '' }} | ||
| 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 | ||
| job_summary: ${{ steps.xcodebuild.outcome == 'failure' }} | ||
| report_paths: 'firebase_results/**.xml' | ||
| - uses: codecov/codecov-action@v4 | ||
| if: success() || failure() | ||
| with: | ||
| flags: AuthFlowTesterUI | ||
| env: | ||
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
| - name: Upload test results artifact | ||
| if: success() || failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-results-authflowtester-ui-${{ inputs.test_suite || 'all' }}-ios${{ inputs.ios }} | ||
| path: firebase_results/ |
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,28 @@ | ||
| name: UI Nightly Tests | ||
|
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. NB: separate workflow for UI nightly tests. |
||
|
|
||
| on: | ||
| schedule: | ||
| - cron: "0 5 * * 3,5" # cron is UTC, this translates to 10 PM PST Tues and Thur. | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| ios-ui-test-nightly: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| test_suite: | ||
| - AdvancedAuthBeaconLoginTests | ||
| - BeaconLoginTests | ||
| - DefaultScopesLegacyLoginTests | ||
| - DynamicConfigLoginTests | ||
| - ECALoginTests | ||
| - LegacyLoginTests | ||
| - MigrationTests | ||
| - MultiUserLoginTests | ||
| - WelcomeLoginTests | ||
| uses: ./.github/workflows/reusable-ui-test-workflow.yaml | ||
| with: | ||
| ios: "^26" | ||
| xcode: "^26" | ||
| test_suite: ${{ matrix.test_suite }} | ||
| secrets: inherit | ||
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
File renamed without changes.
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.
Running one test of each suite with every PR - but maybe that's too many?