-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSmokeTest.kt
More file actions
66 lines (55 loc) · 2.53 KB
/
SmokeTest.kt
File metadata and controls
66 lines (55 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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.Espresso.pressBack
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.ext.junit.rules.activityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
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
val activityScenarioRule = activityScenarioRule<MainActivity>()
@get:Rule
var nameRule = TestName()
@Test
fun smokeTestSimplyStart() {
// Dismiss the dialog by pressing back
pressBack()
onView(isRoot())
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-R") })
onView(withId(R.id.buttonGithub)).perform(click())
onView(isRoot())
.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())
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-3") })
}
@Test
fun updateGithub() {
onView(isRoot())
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-1") })
onView(withId(R.id.buttonGithub)).perform(click())
onView(isRoot())
.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())
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-3") })
onView(withText("SHOW"))
.inRoot(isDialog())
.check(matches(isDisplayed()))
.perform(click())
}
}