@@ -27,9 +27,12 @@ import com.maxkeppeker.sheets.core.utils.TestTags
27
27
import com.maxkeppeler.sheets.clock.ClockView
28
28
import com.maxkeppeler.sheets.clock.models.ClockConfig
29
29
import com.maxkeppeler.sheets.clock.models.ClockSelection
30
+ import com.maxkeppeler.sheets.clock.utils.Constants
30
31
import com.maxkeppeler.sheets.test.utils.onNodeWithTags
31
32
import com.maxkeppeler.sheets.test.utils.onPositiveButton
32
33
import com.maxkeppeler.sheets.test.utils.setContentAndWaitForIdle
34
+ import kotlinx.coroutines.delay
35
+ import kotlinx.coroutines.runBlocking
33
36
import org.junit.Rule
34
37
import org.junit.Test
35
38
import org.junit.runner.RunWith
@@ -55,13 +58,16 @@ class ClockViewTests {
55
58
)
56
59
}
57
60
listOf (1 , 0 , 3 , 0 ).forEach {
58
- rule.onNodeWithTags(TestTags .KEYBOARD_KEY , it).performClick()
61
+ runBlocking {
62
+ rule.onNodeWithTags(TestTags .KEYBOARD_KEY , it).performClick()
63
+ delay(Constants .DEBOUNCE_KEY_CLICK_DURATION )
64
+ }
59
65
}
60
66
rule.onPositiveButton().performClick()
61
67
assert (selectedTime == testTime)
62
68
}
63
69
64
- // @Test
70
+ @Test
65
71
fun clockView12HourFormatAmSelectionSuccess () {
66
72
val testTime = LocalTime .of(10 , 30 )
67
73
var selectedTime: LocalTime ? = null
@@ -75,14 +81,20 @@ class ClockViewTests {
75
81
)
76
82
}
77
83
listOf (1 , 0 , 3 , 0 ).forEach {
78
- rule.onNodeWithTags(TestTags .KEYBOARD_KEY , it).performClick()
84
+ runBlocking {
85
+ rule.onNodeWithTags(TestTags .KEYBOARD_KEY , it).performClick()
86
+ delay(Constants .DEBOUNCE_KEY_CLICK_DURATION )
87
+ }
88
+ }
89
+ runBlocking {
90
+ rule.onNodeWithTags(TestTags .CLOCK_12_HOUR_FORMAT , 0 ).performClick()
91
+ delay(Constants .DEBOUNCE_KEY_CLICK_DURATION )
79
92
}
80
- rule.onNodeWithTags(TestTags .CLOCK_12_HOUR_FORMAT , 0 ).performClick()
81
93
rule.onPositiveButton().performClick()
82
94
assert (selectedTime == testTime)
83
95
}
84
96
85
- // @Test
97
+ @Test
86
98
fun clockView12HourFormatPmSelectionSuccess () {
87
99
val testTime = LocalTime .of(20 , 30 )
88
100
var selectedTime: LocalTime ? = null
@@ -96,9 +108,15 @@ class ClockViewTests {
96
108
)
97
109
}
98
110
listOf (0 , 8 , 3 , 0 ).forEach {
99
- rule.onNodeWithTags(TestTags .KEYBOARD_KEY , it).performClick()
111
+ runBlocking {
112
+ rule.onNodeWithTags(TestTags .KEYBOARD_KEY , it).performClick()
113
+ delay(Constants .DEBOUNCE_KEY_CLICK_DURATION )
114
+ }
115
+ }
116
+ runBlocking {
117
+ rule.onNodeWithTags(TestTags .CLOCK_12_HOUR_FORMAT , 1 ).performClick()
118
+ delay(Constants .DEBOUNCE_KEY_CLICK_DURATION )
100
119
}
101
- rule.onNodeWithTags(TestTags .CLOCK_12_HOUR_FORMAT , 1 ).performClick()
102
120
rule.onPositiveButton().performClick()
103
121
assert (selectedTime == testTime)
104
122
}
0 commit comments