-
-
Notifications
You must be signed in to change notification settings - Fork 452
Add New UI Tests App for critical tests #3802
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
Changes from 14 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
a7b38d4
Add New UI Tests App for critical tests
krystofwoldrich 855903a
Format code
getsentry-bot 835d432
Return proguard rules file
krystofwoldrich 339a8d7
Add CI build and test jobs
krystofwoldrich 4dc470d
Merge remote-tracking branch 'origin/kw/test/add-critical-ui-tests' i…
krystofwoldrich 26ff65e
Fix maestro install and emulator boot
krystofwoldrich d675e3f
Fix apk install
krystofwoldrich 8049612
fix apk name when testing
krystofwoldrich 304f261
use maestro action
krystofwoldrich 069f17d
fix the action name
krystofwoldrich 7fc41c1
fix path
krystofwoldrich eab8424
Fix java and server tests
krystofwoldrich bba38d6
ref and fix server build
krystofwoldrich 32c0ab6
fix maybe
krystofwoldrich 9cbfacf
Update Makefile
stefanosiano 88c7396
Update sentry-android-integration-tests/sentry-uitest-android-critica…
krystofwoldrich 88f290b
fix maestro version
krystofwoldrich c7dc45b
Merge branch 'main' into kw/test/add-critical-ui-tests
krystofwoldrich 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: UI Tests Critical | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
BASE_PATH: "sentry-android-integration-tests/sentry-uitest-android-critical" | ||
BUILD_PATH: "build/outputs/apk/release" | ||
APK_NAME: "sentry-uitest-android-critical-release.apk" | ||
APK_ARTIFACT_NAME: "sentry-uitest-android-critical-release" | ||
MAESTRO_VERSION: "1.39.0" | ||
|
||
jobs: | ||
build: | ||
name: Build sentry-uitest-android-critical | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Java 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@bb0c460cbf5354b0cddd15bacdf0d6aaa3e5a32b # pin@v3 | ||
with: | ||
gradle-home-cache-cleanup: true | ||
|
||
- name: Build debug APK | ||
run: make assembleUiTestCriticalRelease | ||
|
||
- name: Upload APK artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{env.APK_ARTIFACT_NAME}} | ||
path: "${{env.BASE_PATH}}/${{env.BUILD_PATH}}/${{env.APK_NAME}}" | ||
retention-days: 1 | ||
|
||
run-maestro-tests: | ||
name: Run Maestro Tests | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup KVM | ||
shell: bash | ||
run: | | ||
# check if virtualization is supported... | ||
sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok | ||
# allow access to KVM to run the emulator | ||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ | ||
| sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
sudo udevadm control --reload-rules | ||
sudo udevadm trigger --name-match=kvm | ||
|
||
- name: Download APK artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{env.APK_ARTIFACT_NAME}} | ||
|
||
- name: Install Maestro | ||
uses: dniHze/maestro-test-action@bda8a93211c86d0a05b7a4597c5ad134566fbde4 # [email protected] | ||
with: | ||
maestro-version: ${{env.MAESTRO_VERSION}} | ||
|
||
- name: Run tests | ||
uses: reactivecircus/android-emulator-runner@f0d1ed2dcad93c7479e8b2f2226c83af54494915 # [email protected] | ||
with: | ||
api-level: 30 | ||
force-avd-creation: false | ||
disable-animations: true | ||
disable-spellchecker: true | ||
target: 'aosp_atd' | ||
channel: canary # Necessary for ATDs | ||
emulator-options: > | ||
-no-window | ||
-no-snapshot-save | ||
-gpu swiftshader_indirect | ||
-noaudio | ||
-no-boot-anim | ||
-camera-back none | ||
-camera-front none | ||
-timezone US/Pacific | ||
script: | | ||
adb install -r -d "${{env.APK_NAME}}" | ||
maestro test "${{env.BASE_PATH}}/maestro" --debug-output "${{env.BASE_PATH}}/maestro-logs" | ||
|
||
- name: Upload Maestro test results | ||
if: failure() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: maestro-logs | ||
path: "${{env.BASE_PATH}}/maestro-logs" | ||
retention-days: 1 |
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
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,35 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
echo "Checking if ADB is installed..." | ||
if ! command -v adb &> /dev/null; then | ||
echo "ADB is not installed or not in PATH. Please install Android SDK platform tools and ensure ADB is in your PATH." | ||
exit 1 | ||
fi | ||
|
||
echo "Checking if an Android emulator is running..." | ||
if ! adb devices | grep -q "emulator"; then | ||
echo "No Android emulator is currently running. Please start an emulator before running this script." | ||
exit 1 | ||
fi | ||
|
||
echo "Checking if Maestro is installed..." | ||
if ! command -v maestro &> /dev/null; then | ||
echo "Maestro is not installed. Please install Maestro before running this script." | ||
exit 1 | ||
fi | ||
|
||
echo "Building the UI Test Critical app..." | ||
make assembleUiTestCriticalRelease | ||
|
||
echo "Installing the UI Test Critical app on the emulator..." | ||
baseDir="sentry-android-integration-tests/sentry-uitest-android-critical" | ||
buildDir="build/outputs/apk/release" | ||
apkName="sentry-uitest-android-critical-release.apk" | ||
appPath="${baseDir}/${buildDir}/${apkName}" | ||
adb install -r -d "$appPath" | ||
|
||
echo "Running the Maestro tests..." | ||
maestro test \ | ||
"${baseDir}/maestro" \ | ||
--debug-output "${baseDir}/maestro-logs" |
2 changes: 2 additions & 0 deletions
2
sentry-android-integration-tests/sentry-uitest-android-critical/.gitignore
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,2 @@ | ||
/build | ||
/maestro-logs |
69 changes: 69 additions & 0 deletions
69
sentry-android-integration-tests/sentry-uitest-android-critical/build.gradle.kts
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,69 @@ | ||
import io.gitlab.arturbosch.detekt.Detekt | ||
|
||
plugins { | ||
id("com.android.application") | ||
kotlin("android") | ||
} | ||
|
||
android { | ||
compileSdk = Config.Android.compileSdkVersion | ||
namespace = "io.sentry.uitest.android.critical" | ||
|
||
signingConfigs { | ||
getByName("debug") { | ||
// Debug config remains unchanged | ||
} | ||
} | ||
|
||
defaultConfig { | ||
applicationId = "io.sentry.uitest.android.critical" | ||
minSdk = 21 | ||
targetSdk = Config.Android.targetSdkVersion | ||
versionCode = 1 | ||
versionName = "1.0" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
signingConfig = signingConfigs.getByName("debug") | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
) | ||
} | ||
} | ||
kotlinOptions { | ||
jvmTarget = JavaVersion.VERSION_1_8.toString() | ||
} | ||
buildFeatures { | ||
compose = true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion = Config.androidComposeCompilerVersion | ||
} | ||
variantFilter { | ||
if (Config.Android.shouldSkipDebugVariant(buildType.name)) { | ||
ignore = true | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(kotlin(Config.kotlinStdLib, org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION)) | ||
implementation(Config.Libs.androidxCore) | ||
implementation(Config.Libs.composeActivity) | ||
implementation(Config.Libs.composeFoundation) | ||
implementation(Config.Libs.composeMaterial) | ||
implementation(Config.Libs.constraintLayout) | ||
implementation(projects.sentryAndroidCore) | ||
} | ||
|
||
tasks.withType<Detekt> { | ||
// Target version of the generated JVM bytecode. It is used for type resolution. | ||
jvmTarget = JavaVersion.VERSION_1_8.toString() | ||
} | ||
|
||
kotlin { | ||
explicitApi() | ||
} |
11 changes: 11 additions & 0 deletions
11
sentry-android-integration-tests/sentry-uitest-android-critical/maestro/corruptEnvelope.yaml
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,11 @@ | ||
appId: io.sentry.uitest.android.critical | ||
--- | ||
- launchApp | ||
- tapOn: "Write Corrupted Envelope" | ||
# The close here ensures the next corrupted envelope | ||
# will be present on the next app launch | ||
- tapOn: "Close SDK" | ||
- tapOn: "Write Corrupted Envelope" | ||
- stopApp | ||
- launchApp | ||
- assertVisible: "Welcome!" |
6 changes: 6 additions & 0 deletions
6
sentry-android-integration-tests/sentry-uitest-android-critical/maestro/crash.yaml
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,6 @@ | ||
appId: io.sentry.uitest.android.critical | ||
--- | ||
- launchApp | ||
- tapOn: "Crash" | ||
- launchApp | ||
- assertVisible: "Welcome!" |
21 changes: 21 additions & 0 deletions
21
sentry-android-integration-tests/sentry-uitest-android-critical/proguard-rules.pro
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,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
21 changes: 21 additions & 0 deletions
21
sentry-android-integration-tests/sentry-uitest-android-critical/src/main/AndroidManifest.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<application | ||
android:label="Sentry UI Tests Critical" | ||
android:supportsRtl="true" | ||
tools:targetApi="31"> | ||
<meta-data android:name="io.sentry.dsn" android:value="https://[email protected]/5428559" /> | ||
<meta-data android:name="io.sentry.debug" android:value="true" /> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.