-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [reaper] Add stress sample * Detekt fixes, wireup stress sample to match existing sample, leverage stress sample for device spread tests * Fix apk names * Add debug * [reaper] Add stress sample * Fixes/rollback to sample UI * Fix path * Leverage debug * Fix * Fix reaper * Run on release variant * Fix to run against release * default runner * Fix attempt * Different runner * Back to debug * Fix UI test --------- Co-authored-by: Ryan Brooks <[email protected]>
- Loading branch information
Showing
24 changed files
with
320,662 additions
and
5 deletions.
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
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
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
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,110 @@ | ||
plugins { | ||
alias(libs.plugins.android.application) | ||
alias(libs.plugins.kotlin.android) | ||
alias(libs.plugins.kotlin.serialization) | ||
alias(libs.plugins.buildconfig) | ||
id("com.emergetools.android") | ||
} | ||
|
||
emerge { | ||
apiToken.set(System.getenv("EMERGE_API_TOKEN")) | ||
|
||
vcs { | ||
gitHub { | ||
repoName.set("emerge-android") | ||
repoOwner.set("EmergeTools") | ||
} | ||
} | ||
|
||
reaper { | ||
enabledVariants.set(listOf("releaseWithReaper", "debug")) | ||
publishableApiKey.set(System.getenv("EMERGE_REAPER_API_KEY") ?: "<key>") | ||
} | ||
} | ||
|
||
android { | ||
namespace = "com.emergetools.reaper.sample.stress" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
applicationId = "com.emergetools.reaper.sample.stress" | ||
minSdk = 21 | ||
targetSdk = 33 | ||
versionCode = 1 | ||
versionName = "1.0" | ||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
vectorDrawables { | ||
useSupportLibrary = true | ||
} | ||
} | ||
|
||
buildTypes { | ||
getByName("debug") { | ||
applicationIdSuffix = ".debug" | ||
isDebuggable = true | ||
} | ||
getByName("release") { | ||
isMinifyEnabled = true | ||
} | ||
create("releaseWithReaper") { | ||
initWith(getByName("release")) | ||
// Don't minify androidTest application | ||
if (project.hasProperty("isAndroidTest")) { | ||
isMinifyEnabled = false | ||
} else { | ||
isMinifyEnabled = true | ||
} | ||
|
||
matchingFallbacks += listOf("release") | ||
signingConfig = signingConfigs.getByName("debug") | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = JavaVersion.VERSION_17.toString() | ||
} | ||
|
||
buildFeatures { | ||
compose = true | ||
} | ||
|
||
composeOptions { | ||
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.extension.get() | ||
} | ||
} | ||
|
||
buildConfig { | ||
className("ReaperConfig") | ||
packageName("com.emergetools.reaper.sample.stress") | ||
} | ||
|
||
dependencies { | ||
implementation(libs.androidx.activity) | ||
implementation(libs.androidx.activity.compose) | ||
implementation(libs.androidx.navigation.compose) | ||
implementation(libs.androidx.navigation.ui.ktx) | ||
implementation(libs.kotlinx.serialization) | ||
|
||
// Reaper SDK | ||
implementation(projects.reaper.reaper) | ||
|
||
implementation(platform(libs.compose.bom)) | ||
implementation(libs.compose.ui) | ||
implementation(libs.compose.ui.tooling) | ||
implementation(libs.compose.ui.tooling.preview) | ||
implementation(libs.compose.material) | ||
implementation(libs.androidx.test.core.ktx) | ||
|
||
androidTestImplementation(libs.compose.runtime) | ||
androidTestImplementation(libs.compose.ui) | ||
androidTestImplementation(libs.junit) | ||
androidTestImplementation(libs.androidx.test.core) | ||
androidTestImplementation(libs.androidx.test.runner) | ||
androidTestImplementation(libs.androidx.test.uiautomator) | ||
} |
58 changes: 58 additions & 0 deletions
58
...s/src/androidTest/kotlin/com/emergetools/reaper/sample/stress/ReaperStressSampleUiTest.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,58 @@ | ||
package com.emergetools.reaper.sample.stress | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import androidx.test.core.app.ApplicationProvider | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.runner.AndroidJUnit4 | ||
import androidx.test.uiautomator.By | ||
import androidx.test.uiautomator.UiDevice | ||
import androidx.test.uiautomator.Until | ||
import org.junit.Assert.assertNotNull | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
class ReaperStressSampleUiTest { | ||
@Test | ||
fun navigateToDetailScreen() { | ||
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) | ||
|
||
device.pressHome() | ||
|
||
val launcherPackage: String = device.launcherPackageName | ||
assertNotNull(launcherPackage) | ||
device.wait( | ||
Until.hasObject(By.pkg(launcherPackage).depth(0)), | ||
5000, | ||
) | ||
|
||
val context = ApplicationProvider.getApplicationContext<Context>() | ||
|
||
val intent = context.packageManager.getLaunchIntentForPackage( | ||
context.packageName | ||
)?.apply { | ||
// Clear out any previous instances | ||
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) | ||
} | ||
context.startActivity(intent) | ||
|
||
// Wait for the app to appear | ||
device.wait( | ||
Until.hasObject(By.pkg(context.packageName).depth(0)), | ||
10000 | ||
) | ||
|
||
// Click on the first item in the list | ||
device.findObject(By.text("Story 1")).click() | ||
|
||
// Give time to land on next screen | ||
Thread.sleep(1000) | ||
|
||
// Background app for reaper report to post | ||
device.pressHome() | ||
|
||
// Give reaper report time to post | ||
Thread.sleep(5000) | ||
} | ||
} |
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,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:versionCode="1" | ||
android:versionName="0.0.1"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
|
||
<application> | ||
<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> | ||
|
49 changes: 49 additions & 0 deletions
49
reaper/sample/stress/src/main/kotlin/com/emergetools/reaper/sample/stress/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,49 @@ | ||
package com.emergetools.reaper.sample.stress | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.navigation.compose.NavHost | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.compose.rememberNavController | ||
import androidx.navigation.toRoute | ||
import com.emergetools.reaper.sample.stress.numbers.Number0 | ||
import com.emergetools.reaper.sample.stress.numbers.Number19 | ||
import com.emergetools.reaper.sample.stress.numbers.Number9999 | ||
import com.emergetools.reaper.sample.stress.screen.Story | ||
import com.emergetools.reaper.sample.stress.screen.StoryDetailScreen | ||
import com.emergetools.reaper.sample.stress.screen.StoryList | ||
import com.emergetools.reaper.sample.stress.screen.StoryListScreen | ||
|
||
class MainActivity : ComponentActivity() { | ||
public override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
val a = Number19() | ||
val b = Number9999() | ||
val title = "fib(${a.value()}) = ${a.fib()}, sumTo(0, ${b.value()}) = ${Number0().sumTo(b)}" | ||
|
||
setContent { | ||
val navController = rememberNavController() | ||
|
||
NavHost( | ||
navController = navController, | ||
startDestination = StoryList, | ||
) { | ||
composable<StoryList> { | ||
StoryListScreen( | ||
title = title, | ||
navController = navController, | ||
) | ||
} | ||
composable<Story> { backStackEntry -> | ||
val story: Story = backStackEntry.toRoute() | ||
StoryDetailScreen( | ||
story = story, | ||
navController = navController, | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.