-
Notifications
You must be signed in to change notification settings - Fork 119
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
9 changed files
with
187 additions
and
19 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
82 changes: 82 additions & 0 deletions
82
...rojects/android/benchmark/src/androidTest/java/com/example/test/benchmark/RunGeekbench.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,82 @@ | ||
package com.example.test.benchmark | ||
|
||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.uiautomator.By | ||
import androidx.test.uiautomator.UiDevice | ||
import androidx.test.uiautomator.UiSelector | ||
import androidx.test.uiautomator.Until | ||
import org.junit.Assert | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
|
||
private const val TIMEOUT = 10_000L | ||
|
||
private const val BENCHMARK_TIMEOUT = 15 * 60 * 1000L | ||
|
||
|
||
@RunWith(AndroidJUnit4::class) | ||
class RunGeekbench { | ||
|
||
private object Text { | ||
const val search = "Search" | ||
const val appName = "Geek" | ||
const val accept = "ACCEPT" | ||
const val benchmarkType = "RUN CPU BENCHMARK" | ||
const val runningDialog = "Geekbench 5" | ||
const val results = "Benchmark Results" | ||
} | ||
|
||
@Test | ||
fun run() { | ||
|
||
UiDevice.getInstance( | ||
InstrumentationRegistry.getInstrumentation() | ||
).run { | ||
// Start from the home screen | ||
pressHome() | ||
|
||
// Open apps menu on pixel launcher | ||
findObject(UiSelector().descriptionContains(Text.search)).apply { | ||
swipe(0, visibleBounds.centerY(), 0, 0, 10) | ||
} | ||
|
||
// Wait for 3d mark launcher icon | ||
wait(Until.hasObject(By.textContains(Text.appName)), TIMEOUT) | ||
|
||
waitForIdle(5000) | ||
|
||
// Click 3d mark launcher icon | ||
findObject(UiSelector().textContains(Text.appName)).click() | ||
|
||
waitForIdle(5000) | ||
|
||
Thread.sleep(1000) | ||
|
||
// Check permissions dialog | ||
findObject(UiSelector().text(Text.accept)).run { | ||
if (exists()) click() | ||
} | ||
|
||
waitForIdle(5000) | ||
Thread.sleep(2000) | ||
|
||
// Choose proper benchmark screen | ||
findObject(UiSelector().text(Text.benchmarkType)).click() | ||
|
||
waitForIdle(5000) | ||
Thread.sleep(2000) | ||
|
||
// Wait until benchmark finish | ||
wait(Until.hasObject(By.text(Text.runningDialog)), TIMEOUT) | ||
wait(Until.gone(By.text(Text.runningDialog)), BENCHMARK_TIMEOUT) | ||
|
||
// Assert that benchmark results screen is visible | ||
wait(Until.hasObject(By.text(Text.results)), TIMEOUT) | ||
|
||
// Make sure that results was recorded | ||
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
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
17 changes: 17 additions & 0 deletions
17
test_runner/src/test/kotlin/ftl/fixtures/benchmark/geekbench-NexusLowRes.yml
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,17 @@ | ||
gcloud: | ||
app: "./src/test/kotlin/ftl/fixtures/tmp/apk/app-debug.apk" | ||
test: "./src/test/kotlin/ftl/fixtures/tmp/apk/benchmark/benchmark-debug-androidTest.apk" | ||
use-orchestrator: false | ||
directories-to-pull: | ||
- "/sdcard/Android/data/com.futuremark.dmandroid.application/files/3DMarkAndroid/" | ||
additional-apks: | ||
- "./src/test/kotlin/ftl/fixtures/tmp/apk/benchmark/Geekbench 5_v5.3.2.apk" | ||
device: | ||
- model: NexusLowRes | ||
version: 30 | ||
locale: en | ||
orientation: portrait | ||
record-video: true | ||
flank: | ||
test-targets: | ||
- "class com.example.test.benchmark.RunGeekbench" |
17 changes: 17 additions & 0 deletions
17
test_runner/src/test/kotlin/ftl/fixtures/benchmark/geekbench-NexusLowResEmulator.yml
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,17 @@ | ||
gcloud: | ||
app: "./src/test/kotlin/ftl/fixtures/tmp/apk/app-debug.apk" | ||
test: "./src/test/kotlin/ftl/fixtures/tmp/apk/benchmark/benchmark-debug-androidTest.apk" | ||
use-orchestrator: false | ||
directories-to-pull: | ||
- "/sdcard/Android/data/com.futuremark.dmandroid.application/files/3DMarkAndroid/" | ||
additional-apks: | ||
- "./src/test/kotlin/ftl/fixtures/tmp/apk/benchmark/Geekbench 5_v5.3.2.apk" | ||
device: | ||
- model: NexusLowResEmulator | ||
version: 30 | ||
locale: en | ||
orientation: portrait | ||
record-video: true | ||
flank: | ||
test-targets: | ||
- "class com.example.test.benchmark.RunGeekbench" |
25 changes: 25 additions & 0 deletions
25
test_runner/src/test/kotlin/ftl/fixtures/benchmark/geekbench-all.yml
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,25 @@ | ||
gcloud: | ||
app: "./src/test/kotlin/ftl/fixtures/tmp/apk/app-debug.apk" | ||
test: "./src/test/kotlin/ftl/fixtures/tmp/apk/benchmark/benchmark-debug-androidTest.apk" | ||
use-orchestrator: false | ||
directories-to-pull: | ||
- "/sdcard/Android/data/com.futuremark.dmandroid.application/files/3DMarkAndroid/" | ||
additional-apks: | ||
- "./src/test/kotlin/ftl/fixtures/tmp/apk/benchmark/Geekbench 5_v5.3.2.apk" | ||
device: | ||
- model: NexusLowRes | ||
version: 30 | ||
locale: en | ||
orientation: portrait | ||
- model: NexusLowResEmulator | ||
version: 30 | ||
locale: en | ||
orientation: portrait | ||
- model: redfin | ||
version: 30 | ||
locale: en | ||
orientation: portrait | ||
record-video: true | ||
flank: | ||
test-targets: | ||
- "class com.example.test.benchmark.RunGeekbench" |
17 changes: 17 additions & 0 deletions
17
test_runner/src/test/kotlin/ftl/fixtures/benchmark/geekbench-redfin.yml
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,17 @@ | ||
gcloud: | ||
app: "./src/test/kotlin/ftl/fixtures/tmp/apk/app-debug.apk" | ||
test: "./src/test/kotlin/ftl/fixtures/tmp/apk/benchmark/benchmark-debug-androidTest.apk" | ||
use-orchestrator: false | ||
directories-to-pull: | ||
- "/sdcard/Android/data/com.futuremark.dmandroid.application/files/3DMarkAndroid/" | ||
additional-apks: | ||
- "./src/test/kotlin/ftl/fixtures/tmp/apk/benchmark/Geekbench 5_v5.3.2.apk" | ||
device: | ||
- model: redfin | ||
version: 30 | ||
locale: en | ||
orientation: portrait | ||
record-video: true | ||
flank: | ||
test-targets: | ||
- "class com.example.test.benchmark.RunGeekbench" |