-
Notifications
You must be signed in to change notification settings - Fork 147
/
ScreenshotSampleTest.kt
60 lines (53 loc) · 1.75 KB
/
ScreenshotSampleTest.kt
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
package com.kaspersky.kaspressample.docloc_tests
import androidx.test.ext.junit.rules.activityScenarioRule
import com.kaspersky.kaspressample.screen.SimpleScreen
import com.kaspersky.kaspressample.simple.SimpleActivity
import com.kaspersky.kaspresso.annotations.ScreenShooterTest
import com.kaspersky.kaspresso.testcases.api.testcase.DocLocScreenshotTestCase
import io.github.kakaocup.kakao.screen.Screen
import org.junit.Rule
import org.junit.Test
/**
* An example of [DocLocScreenshotTestCase] usage.
* For more information see DocLoc wiki page.
*/
class ScreenshotSampleTest : DocLocScreenshotTestCase(locales = "en,ru") {
@get:Rule
val activityRule = activityScenarioRule<SimpleActivity>()
@ScreenShooterTest
@Test
fun test() = run {
step("1. Launch activity") {
activityRule.scenario.onActivity { // Test that screenshot shooter works in app's main thread
captureScreenshot("1. Simple screen")
}
}
step("2. Press Button 1") {
SimpleScreen {
button1 {
click()
}
}
captureScreenshot("2. Simple fragment - two buttons")
}
step("3. Press Button 2") {
SimpleScreen {
button2 {
click()
}
}
Screen.idle(2_500L) // Wait for timeout
captureScreenshot("3. Simple fragment - input")
}
step("4. Type text") {
SimpleScreen {
closeSoftKeyboard()
edit {
clearText()
typeText("Kaspresso")
}
}
captureScreenshot("4. Simple fragment - typed text")
}
}
}