Skip to content

Commit

Permalink
Merge pull request #34 from rubensousa/ui_test_update
Browse files Browse the repository at this point in the history
Simplify UI tests for slow emulators
  • Loading branch information
rubensousa authored Jan 26, 2023
2 parents e2fd9fe + 27cc3a2 commit 3218dfb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import com.rubensousa.dpadrecyclerview.test.helpers.selectPosition
import com.rubensousa.dpadrecyclerview.test.tests.DpadRecyclerViewTest
import com.rubensousa.dpadrecyclerview.testing.KeyEvents.pressDown
import com.rubensousa.dpadrecyclerview.testing.KeyEvents.pressUp
import org.junit.Ignore
import org.junit.Test

class VerticalFocusTest : DpadRecyclerViewTest() {
Expand Down Expand Up @@ -87,7 +86,7 @@ class VerticalFocusTest : DpadRecyclerViewTest() {

@Test
fun testScrollingUntilPivotIsFound() {
val increment = 15
val increment = 5
val steps = 10
launchFragment(
getDefaultAdapterConfiguration().copy(
Expand All @@ -99,10 +98,9 @@ class VerticalFocusTest : DpadRecyclerViewTest() {
assertFocusAndSelection(position = increment)
}

@Ignore("This test crashes the CI. Find out why")
@Test
fun testScrollingBackToPreviousSelectionWhenNextPivotIsNotFound() {
val increment = 15
val increment = 5
val steps = 10
launchFragment(
getDefaultAdapterConfiguration().copy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ class VerticalSingleColumnScrollTest : DpadRecyclerViewTest() {

@Test
fun testContinuousScrollDown() {
KeyEvents.pressKey(key = KeyEvent.KEYCODE_DPAD_DOWN, times = 25)
assertFocusAndSelection(position = 25)
KeyEvents.pressKey(key = KeyEvent.KEYCODE_DPAD_DOWN, times = 15, delay = 200L)
assertFocusAndSelection(position = 15)
}

@Test
Expand All @@ -85,8 +85,8 @@ class VerticalSingleColumnScrollTest : DpadRecyclerViewTest() {

@Test
fun testContinuousScrollUp() {
selectPosition(position = 25, subPosition = 0)
KeyEvents.pressKey(key = KeyEvent.KEYCODE_DPAD_UP, times = 25)
selectPosition(position = 10, subPosition = 0)
KeyEvents.pressKey(key = KeyEvent.KEYCODE_DPAD_UP, times = 10, delay = 200L)
assertFocusAndSelection(position = 0)
}

Expand Down

0 comments on commit 3218dfb

Please sign in to comment.