-
Notifications
You must be signed in to change notification settings - Fork 0
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
4 changed files
with
57 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,36 +31,32 @@ jobs: | |
- name: Debug keystore | ||
run: keytool -genkey -v -keystore app/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "C=US, O=Android, CN=Android Debug" | ||
- name: Build project | ||
run: ./gradlew clean assembleDebug -Ponly_x86_64 | ||
run: ./gradlew assembleDebug -Ponly_x86_64 | ||
env: | ||
VERSION: ${{steps.tagger.outputs.tag}} | ||
- name: Run tests | ||
run: ./gradlew test -Ponly_x86_64 | ||
# - name: Run instrumentation tests | ||
# uses: malinskiy/action-android/emulator-run-cmd@release/0.1.2 | ||
# with: | ||
# cmd: ./gradlew cAT -Ponly_x86_64 --continue | ||
# api: 28 | ||
# tag: default | ||
# abi: arm64-v8a | ||
# - name: Archive Espresso results | ||
# uses: actions/[email protected] | ||
# if: ${{ always() }} | ||
# with: | ||
# name: MediaPipe-Espresso-report | ||
# path: applications/**/build/reports/androidTests/connected/ | ||
# - name: Save logcat output | ||
# uses: actions/upload-artifact@master | ||
# if: failure() | ||
# with: | ||
# name: MediaPipe-logcat | ||
# path: artifacts/logcat.log | ||
# - name: Archive screenshots | ||
# uses: actions/[email protected] | ||
# if: ${{ always() }} | ||
# with: | ||
# name: MediaPipe-Screenshots | ||
# path: applications/screenshots/adb/ | ||
- name: Run instrumentation tests | ||
uses: malinskiy/action-android/emulator-run-cmd@release/0.1.4 | ||
with: | ||
cmd: ./gradlew cAT -Ponly_x86_64 --continue | ||
api: 28 | ||
tag: default | ||
abi: x86_64 | ||
cmdOptions: -noaudio -no-boot-anim -no-window | ||
- name: Archive Espresso results | ||
uses: actions/[email protected] | ||
if: ${{ always() }} | ||
with: | ||
name: MediaPipe-Espresso-report | ||
path: applications/**/build/reports/androidTests/connected/ | ||
- name: Archive screenshots | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v3 | ||
with: MultiHand-Screenshots | ||
path: | | ||
app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected | ||
app/build/outputs/androidTest-results/connected | ||
- name: cleanup keystore | ||
run: ./signing/cleanup.sh | ||
Check: | ||
|
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
41 changes: 29 additions & 12 deletions
41
app/src/androidTest/java/info/mediapipe/multihand/app/SmokeTest.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 |
---|---|---|
@@ -1,34 +1,51 @@ | ||
package info.mediapipe.multihand.app | ||
|
||
import android.Manifest | ||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed | ||
import androidx.test.espresso.matcher.ViewMatchers.withId | ||
import androidx.test.ext.junit.rules.ActivityScenarioRule | ||
import android.util.Log | ||
import androidx.test.core.app.takeScreenshot | ||
import androidx.test.core.graphics.writeToTestStorage | ||
import androidx.test.espresso.Espresso | ||
import androidx.test.espresso.matcher.ViewMatchers | ||
import androidx.test.espresso.screenshot.captureToBitmap | ||
import androidx.test.ext.junit.rules.activityScenarioRule | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.rule.GrantPermissionRule | ||
import com.moka.utils.Screenshot | ||
import info.mediapipe.app.R | ||
import info.mediapipe.app.multihand.MultiHandActivity | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.rules.TestName | ||
import org.junit.runner.RunWith | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
class SmokeTest { | ||
|
||
@get:Rule | ||
var activityScenarioRule = ActivityScenarioRule(MultiHandActivity::class.java) | ||
val activityScenarioRule = activityScenarioRule<MultiHandActivity>() | ||
|
||
// a handy JUnit rule that stores the method name, so it can be used to generate unique screenshot files per test method | ||
@get:Rule | ||
var nameRule = TestName() | ||
|
||
@get:Rule | ||
val grantPermissionRule: GrantPermissionRule = GrantPermissionRule.grant( | ||
Manifest.permission.WRITE_EXTERNAL_STORAGE, | ||
Manifest.permission.READ_EXTERNAL_STORAGE) | ||
Manifest.permission.CAMERA, | ||
Manifest.permission.WRITE_EXTERNAL_STORAGE, | ||
Manifest.permission.READ_EXTERNAL_STORAGE | ||
) | ||
|
||
@Test | ||
fun smokeTestSimplyStart() { | ||
onView(withId(R.id.preview_display_layout)).check(matches(isDisplayed())) | ||
Screenshot.takeScreenshot("smoke") | ||
for (i in 3000L..5000L step 1000) { | ||
Thread.sleep(i) | ||
takeScreenshot() | ||
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-S$i") | ||
try { | ||
Espresso.onView(ViewMatchers.isRoot()) | ||
.captureToBitmap() | ||
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-A$i") | ||
} catch (e: Exception) { | ||
Log.e("smokeTestSimplyStart", e.message.toString()) | ||
} | ||
} | ||
} | ||
} |
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