-
-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
152 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
2 changes: 2 additions & 0 deletions
2
sentry-android-integration-tests/sentry-uitest-android-critical/.gitignore
This file contains 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 |
58 changes: 58 additions & 0 deletions
58
sentry-android-integration-tests/sentry-uitest-android-critical/build.gradle.kts
This file contains 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,58 @@ | ||
import io.gitlab.arturbosch.detekt.Detekt | ||
|
||
plugins { | ||
id("com.android.application") | ||
kotlin("android") | ||
} | ||
|
||
android { | ||
compileSdk = Config.Android.compileSdkVersion | ||
namespace = "io.sentry.uitest.android.critical" | ||
|
||
defaultConfig { | ||
applicationId = "io.sentry.uitest.android.critical" | ||
minSdk = 21 | ||
targetSdk = Config.Android.targetSdkVersion | ||
versionCode = 1 | ||
versionName = "1.0" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
) | ||
} | ||
} | ||
kotlinOptions { | ||
jvmTarget = JavaVersion.VERSION_1_8.toString() | ||
} | ||
buildFeatures { | ||
compose = true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion = Config.androidComposeCompilerVersion | ||
} | ||
} | ||
|
||
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 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 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/src/main/AndroidManifest.xml
This file contains 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://5b38df1abca1468bac6d7517530f6802@o447951.ingest.us.sentry.io/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> |
51 changes: 51 additions & 0 deletions
51
...y-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt
This file contains 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,51 @@ | ||
package io.sentry.uitest.android.critical | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Surface | ||
import androidx.compose.material3.Text | ||
import io.sentry.Sentry | ||
import java.io.File | ||
|
||
class MainActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
val outboxPath = Sentry.getCurrentHub().options.outboxPath | ||
?: throw RuntimeException("Outbox path is not set.") | ||
|
||
setContent { | ||
MaterialTheme { | ||
Surface() { | ||
Column() { | ||
Text(text = "Welcome!") | ||
Button(onClick = { | ||
throw RuntimeException("Crash the test app.") | ||
}) { | ||
Text("Crash") | ||
} | ||
Button(onClick = { | ||
Sentry.close() | ||
}) { | ||
Text("Close SDK") | ||
} | ||
Button(onClick = { | ||
val file = File(outboxPath, "corrupted.envelope") | ||
val corruptedEnvelopeContent = """ | ||
{"event_id":"1990b5bc31904b7395fd07feb72daf1c","sdk":{"name":"sentry.java.android","version":"7.21.0"}} | ||
{"type":"test","length":50} | ||
""".trimIndent() | ||
file.writeText(corruptedEnvelopeContent) | ||
println("Wrote corrupted envelope to: ${file.absolutePath}") | ||
}) { | ||
Text("Write Corrupted Envelope") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains 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