@@ -27,9 +27,12 @@ import com.maxkeppeker.sheets.core.utils.TestTags
2727import com.maxkeppeler.sheets.clock.ClockView
2828import com.maxkeppeler.sheets.clock.models.ClockConfig
2929import com.maxkeppeler.sheets.clock.models.ClockSelection
30+ import com.maxkeppeler.sheets.clock.utils.Constants
3031import com.maxkeppeler.sheets.test.utils.onNodeWithTags
3132import com.maxkeppeler.sheets.test.utils.onPositiveButton
3233import com.maxkeppeler.sheets.test.utils.setContentAndWaitForIdle
34+ import kotlinx.coroutines.delay
35+ import kotlinx.coroutines.runBlocking
3336import org.junit.Rule
3437import org.junit.Test
3538import org.junit.runner.RunWith
@@ -55,13 +58,16 @@ class ClockViewTests {
5558 )
5659 }
5760 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+ }
5965 }
6066 rule.onPositiveButton().performClick()
6167 assert (selectedTime == testTime)
6268 }
6369
64- // @Test
70+ @Test
6571 fun clockView12HourFormatAmSelectionSuccess () {
6672 val testTime = LocalTime .of(10 , 30 )
6773 var selectedTime: LocalTime ? = null
@@ -75,14 +81,20 @@ class ClockViewTests {
7581 )
7682 }
7783 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 )
7992 }
80- rule.onNodeWithTags(TestTags .CLOCK_12_HOUR_FORMAT , 0 ).performClick()
8193 rule.onPositiveButton().performClick()
8294 assert (selectedTime == testTime)
8395 }
8496
85- // @Test
97+ @Test
8698 fun clockView12HourFormatPmSelectionSuccess () {
8799 val testTime = LocalTime .of(20 , 30 )
88100 var selectedTime: LocalTime ? = null
@@ -96,9 +108,15 @@ class ClockViewTests {
96108 )
97109 }
98110 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 )
100119 }
101- rule.onNodeWithTags(TestTags .CLOCK_12_HOUR_FORMAT , 1 ).performClick()
102120 rule.onPositiveButton().performClick()
103121 assert (selectedTime == testTime)
104122 }
0 commit comments