-
-
Notifications
You must be signed in to change notification settings - Fork 53
chore: Add integration tests for Android #1146
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
base: main
Are you sure you want to change the base?
Conversation
3ba125b to
d62218d
Compare
a3d3766 to
35862ce
Compare
41221d6 to
3bc3f33
Compare
963fa85 to
3b14ec3
Compare
Fix artifact download Shell Fix Fix Fix Fix Set config Fix syntax Sauce skip run Update appium Test test test apk name Test Test Test Test Test Test Test Test Test Test Test tets Test Test Poll session status Test Test Test 2 runs Test Test Try fix redirect Test Test fix id Test app status poll Test Clean up
d8ab932 to
c9079bc
Compare
| const TCHAR* CommandLine = FCommandLine::Get(); | ||
| FString CommandLine = FCommandLine::Get(); | ||
|
|
||
| UE_LOG(LogSentrySample, Display, TEXT("Startin app with commandline: %s\n"), *CommandLine); |
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.
| - name: Install Pester | ||
| shell: pwsh | ||
| run: Install-Module -Name Pester -Force -SkipPublisherCheck |
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.
Pester: 5.7.1 is already installed in GH, have you had issues without this step?
| - name: Run integration tests | ||
| id: run-integration-tests | ||
| shell: pwsh | ||
| env: | ||
| SENTRY_UNREAL_TEST_DSN: ${{ secrets.SENTRY_UNREAL_TEST_DSN }} | ||
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_API_TOKEN }} | ||
| SENTRY_UNREAL_TEST_APP_PATH: ${{ github.workspace }}/sample-build/SentryPlayground-arm64.apk | ||
| UNREAL_VERSION: ${{ inputs.unreal-version }} | ||
| run: | | ||
| cd integration-test | ||
| mkdir build | ||
| cmake -B build -S . | ||
| Invoke-Pester Integration.Tests.Android.SauceLabs.ps1 -CI |
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.
maybe a bit cleaner (move working dir to param and remove unnecessary mkdir)
| - name: Run integration tests | |
| id: run-integration-tests | |
| shell: pwsh | |
| env: | |
| SENTRY_UNREAL_TEST_DSN: ${{ secrets.SENTRY_UNREAL_TEST_DSN }} | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_API_TOKEN }} | |
| SENTRY_UNREAL_TEST_APP_PATH: ${{ github.workspace }}/sample-build/SentryPlayground-arm64.apk | |
| UNREAL_VERSION: ${{ inputs.unreal-version }} | |
| run: | | |
| cd integration-test | |
| mkdir build | |
| cmake -B build -S . | |
| Invoke-Pester Integration.Tests.Android.SauceLabs.ps1 -CI | |
| - name: Run integration tests | |
| id: run-integration-tests | |
| shell: pwsh | |
| working-directory: integration-test | |
| env: | |
| SENTRY_UNREAL_TEST_DSN: ${{ secrets.SENTRY_UNREAL_TEST_DSN }} | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_API_TOKEN }} | |
| SENTRY_UNREAL_TEST_APP_PATH: ${{ github.workspace }}/sample-build/SentryPlayground-arm64.apk | |
| UNREAL_VERSION: ${{ inputs.unreal-version }} | |
| run: | | |
| cmake -B build -S . | |
| Invoke-Pester Integration.Tests.Android.SauceLabs.ps1 -CI |
| @@ -0,0 +1,418 @@ | |||
| # Integration tests for Sentry Unreal SDK on Android | |||
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 assume this would be moved to app-runner as a new provider, in which case both android integration test files would be merged to a single one, right?
| cd integration-test | ||
| mkdir build | ||
| cmake -B build -S . | ||
| Invoke-Pester Integration.Tests.Android.SauceLabs.ps1 -CI |
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.
Also, invoke-pester assumes files are named "*.Tests.ps1" so the filename should be Android.Adb.Tests.ps1 or similar. In this case it doesn't matter because you're specifying the exact path, but if you wanted to run all integration tests locally, calling invoke-pester integration-test would only pick up files ending with ".Tests.ps1"
| try { | ||
| if ($IsMultipart) { | ||
| # Use curl for multipart uploads (PowerShell's Invoke-WebRequest struggles with this) | ||
| $curlCmd = "curl -u `"$username`:$accessKey`" -X $Method `"$Uri`" -F `"payload=@$FilePath`" -F `"name=$(Split-Path $FilePath -Leaf)`"" |
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.
This should ideally use Invoke-Webrequest to be cross-platform. I've noticed the comment but have you tried the Form param? https://stackoverflow.com/a/60323436
| $params['ContentType'] = $ContentType | ||
| } | ||
|
|
||
| $response = Invoke-RestMethod @params |
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.
Invoke-Restmethod should be avoided - it will just return plain string and swallow parsing error. see app-runner which uses invoke-webrequest and convertfrom-json
| } | ||
|
|
||
| Write-Host "Uploading APK to SauceLabs Storage..." -ForegroundColor Yellow | ||
| $uploadUri = "https://api.${Region}.saucelabs.com/v1/storage/upload" |
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.
Maybe worth checking if the file exists somehow, e.g. by using a hash-based filename. But I don't really know - if it's always rebuilt then not worth the trouble.
This PR adds Android integration tests for the Sentry Unreal SDK using PowerShell's Pester framework. The tests validate end-to-end functionality by running the
SentryPlaygroundsample application on mobile devices and verifying that events are properly captured and sent to Sentry.It includes the necessary CI workflows and test scripts for both local (adb) and cloud (SauceLabs) execution.
The motivation for using SauceLabs Real Device Cloud to run tests in CI pipeline is the current limitation of Android emulators which do not support the rendering backends required by Unreal applications.
Changes
adb.SAUCE_USERNAMEandSAUCE_ACCESS_KEYsecrets to the repo.Related to:
Closes #964
#skip-changelog