Skip to content

Commit

Permalink
fixes for redfin Pixel 5e
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-goral committed Apr 8, 2021
1 parent 43dfc01 commit a7a8673
Show file tree
Hide file tree
Showing 9 changed files with 187 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,29 @@ private const val BENCHMARK_TIMEOUT = 15 * 60 * 1000L

private const val DOWNLOAD_TIMEOUT = 5 * 60 * 1000L

private object Text {
const val search = "Search"
const val ok = "OK"
const val allow = "Allow"
const val permTitle = "Before we start…"
const val appName = "3DMark"
const val benchmarkType = "SLING SHOT"
}

private object Res {
const val centerLayout = "com.futuremark.dmandroid.application:id/flm_pager_benchmarks"
const val centerLayoutChild = "com.futuremark.dmandroid.application:id/flm_cl_root"
const val btnSkip = "com.futuremark.dmandroid.application:id/flm_bt_tutorial_skip"
const val fabBenchmark = "com.futuremark.dmandroid.application:id/flm_fab_benchmark"
const val fabSettings = "com.futuremark.dmandroid.application:id/flm_fab_settings"
const val scoreDetails =
"com.futuremark.dmandroid.application:id/flm_ll_score_details_container"
}


@RunWith(AndroidJUnit4::class)
class Run3DMark {

private object Text {
const val search = "Search"
const val ok = "OK"
const val allow = "Allow"
const val permTitle = "Before we start…"
const val appName = "3DMark"
const val benchmarkType = "SLING SHOT"
}

private object Res {
const val centerLayout = "com.futuremark.dmandroid.application:id/flm_pager_benchmarks"
const val centerLayoutChild = "com.futuremark.dmandroid.application:id/flm_cl_root"
const val btnSkip = "com.futuremark.dmandroid.application:id/flm_bt_tutorial_skip"
const val fabBenchmark = "com.futuremark.dmandroid.application:id/flm_fab_benchmark"
const val fabSettings = "com.futuremark.dmandroid.application:id/flm_fab_settings"
const val scoreDetails =
"com.futuremark.dmandroid.application:id/flm_ll_score_details_container"
}

@Test
fun run() {

Expand Down
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)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ gcloud:
locale: en
orientation: portrait
record-video: true
flank:
test-targets:
- "class com.example.test.benchmark.Run3dMark"
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ gcloud:
locale: en
orientation: portrait
record-video: true
flank:
test-targets:
- "class com.example.test.benchmark.Run3dMark"
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ gcloud:
locale: en
orientation: portrait
record-video: true
flank:
test-targets:
- "class com.example.test.benchmark.Run3dMark"
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"
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"
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"
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"

0 comments on commit a7a8673

Please sign in to comment.