Skip to content

Commit

Permalink
Adds full screen screenshot to readme (#60)
Browse files Browse the repository at this point in the history
* Adds full screen screenshot to readme

* πŸ€– Updates screenshots

* Adds some emulator config.

* πŸ€– Updates screenshots

* Fixes some emulator setup script commands

* πŸ€– Updates screenshots

* Updates emulator setup script to ensure that demo mode is turned on.

* Adds cleanup to emu setup script.

* πŸ€– Updates screenshots

---------

Co-authored-by: rharter <[email protected]>
  • Loading branch information
rharter and rharter authored May 2, 2024
1 parent f25d6b1 commit d144e26
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
16 changes: 16 additions & 0 deletions .github/scripts/emu_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

echo "Cleaning up old emulator data"
adb uninstall com.dropbox.dropshots.test || true
adb shell rm -rf /storage/emulated/0/Download/screenshots || true

adb wait-for-devices
adb shell settings put global sysui_demo_allowed 1
adb shell am broadcast -a com.android.systemui.demo -e command enter
adb shell am broadcast -a com.android.systemui.demo -e command clock -e hhmm 1234
adb shell am broadcast -a com.android.systemui.demo -e command battery -e plugged false
adb shell am broadcast -a com.android.systemui.demo -e command battery -e level 100
adb shell am broadcast -a com.android.systemui.demo -e command network -e wifi show -e level 4
adb shell am broadcast -a com.android.systemui.demo -e command network -e mobile show -e datatype none -e level 4
adb shell am broadcast -a com.android.systemui.demo -e command notifications -e visible false
adb shell cmd overlay enable com.android.internal.systemui.navbar.gestural
22 changes: 11 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v2

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
disable-animations: false
ram-size: 4096M
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: echo "Generated AVD snapshot for caching."
script: ./.github/scripts/emu_setup.sh && echo "Generated AVD snapshot for caching."

- name: Run instrumentation tests
id: screenshotsverify
Expand All @@ -163,7 +163,7 @@ jobs:
ram-size: 4096M
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# Workaround for https://github.com/ReactiveCircus/android-emulator-runner/issues/319
script: adb uninstall com.dropbox.dropshots.test; ./gradlew connectedCheck --stacktrace
script: ./.github/scripts/emu_setup.sh && ./gradlew connectedCheck --stacktrace

- name: Prevent pushing new screenshots if this is a fork
id: checkfork_screenshots
Expand All @@ -185,7 +185,7 @@ jobs:
ram-size: 4096M
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# Workaround for https://github.com/ReactiveCircus/android-emulator-runner/issues/319
script: adb uninstall com.dropbox.dropshots.test; ./gradlew connectedCheck -Pdropshots.record --stacktrace
script: ./.github/scripts/emu_setup.sh && ./gradlew connectedCheck -Pdropshots.record --stacktrace

- name: Pull screenshots
id: screenshotspull
Expand All @@ -203,12 +203,12 @@ jobs:
disable_globbing: true
commit_message: "πŸ€– Updates screenshots"

- name: (Fail-only) Bundle test reports
if: failure()
- name: Bundle test reports
if: always()
run: find . -type d '(' -name 'reports' -o -name 'androidTest-results' ')' | zip -@ -r instrumentation-test-build-reports.zip

- name: (Fail-only) Upload the build report
if: failure()
- name: Upload the build report
if: always()
uses: actions/upload-artifact@v2
with:
name: instrumentation-test-report
Expand All @@ -222,7 +222,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ class MyTest {
}
}

@Test
fun testMatchesFullScreenshot() {
activityScenarioRule.scenario.onActivity {
// Assert full-screen snapshots
dropshots.assertSnapshot("MatchesFullScreenshot")
}
}

@Test
fun testMatchesActivityScreenshot() {
activityScenarioRule.scenario.onActivity {
Expand Down
Binary file modified dropshots/src/androidTest/assets/MatchesActivityScreenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dropshots/src/androidTest/assets/MatchesFullScreenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dropshots/src/androidTest/assets/MatchesViewScreenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d144e26

Please sign in to comment.