Skip to content

Commit

Permalink
Merge pull request #249 from hannesa2/BumpEspresso
Browse files Browse the repository at this point in the history
Bump Espresso
  • Loading branch information
hannesa2 authored Nov 20, 2024
2 parents e04dfe6 + 58813b9 commit d0a3b44
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ dependencies {
implementation 'com.google.android.material:material:1.12.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

androidTestImplementation "androidx.test.ext:junit-ktx:1.1.4"
androidTestImplementation "androidx.test.ext:junit-ktx:1.2.1"
androidTestUtil "androidx.test.services:test-services:1.5.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.5.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.6.1"
}

static def getGitCommitCount() {
Expand Down
26 changes: 10 additions & 16 deletions app/src/androidTest/java/info/hannes/github/sample/SmokeTest.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package info.hannes.github.sample

import android.graphics.Bitmap
import androidx.test.core.graphics.writeToTestStorage
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.captureToBitmap
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.RootMatchers.isDialog
import androidx.test.espresso.matcher.ViewMatchers
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 org.junit.Rule
Expand All @@ -27,39 +29,31 @@ class SmokeTest {
@Test
fun smokeTestSimplyStart() {
onView(isRoot())
.captureToBitmap()
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-R")
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-R") })

onView(withId(R.id.button)).perform(click())
onView(isRoot())
.captureToBitmap()
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-2")
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-2") })

onView(withText(info.hannes.github.R.string.new_version))
.inRoot(isDialog())
.check(matches(isDisplayed()))
onView(isRoot())
.captureToBitmap()
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-3")
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-3") })
}

@Test
fun updateGithub() {
onView(isRoot())
.captureToBitmap()
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-1")
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-1") })
onView(withId(R.id.button)).perform(click())
onView(isRoot())
.captureToBitmap()
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-2")
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-2") })
onView(withText(info.hannes.github.R.string.new_version))
.inRoot(isDialog())
.check(matches(isDisplayed()))
onView(isRoot())
.captureToBitmap()
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-3")

// takeScreenshot()
// .writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-all")
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-3") })

onView(withText("SHOW"))
.inRoot(isDialog())
Expand Down

0 comments on commit d0a3b44

Please sign in to comment.