Stop ignoring 2 tests and fix them.

This commit is contained in:
Benoit Marty 2024-09-25 18:32:43 +02:00
parent dc2e05bafd
commit 0b326d6853

View file

@ -26,7 +26,6 @@ import io.element.android.tests.testutils.EventsRecorder
import io.element.android.tests.testutils.clickOn import io.element.android.tests.testutils.clickOn
import io.element.android.tests.testutils.ensureCalledOnce import io.element.android.tests.testutils.ensureCalledOnce
import io.element.android.tests.testutils.pressBack import io.element.android.tests.testutils.pressBack
import org.junit.Ignore
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.junit.rules.TestRule import org.junit.rules.TestRule
@ -81,7 +80,6 @@ class MediaViewerViewTest {
eventsRecorder.assertSingle(expectedEvent) eventsRecorder.assertSingle(expectedEvent)
} }
@Ignore("This test is not passing yet, maybe due to interaction with ZoomableAsyncImage?")
@Test @Test
fun `clicking on image hides the overlay`() { fun `clicking on image hides the overlay`() {
val eventsRecorder = EventsRecorder<MediaViewerEvents>(expectEvents = false) val eventsRecorder = EventsRecorder<MediaViewerEvents>(expectEvents = false)
@ -96,16 +94,17 @@ class MediaViewerViewTest {
) )
// Ensure that the action are visible // Ensure that the action are visible
val contentDescription = rule.activity.getString(CommonStrings.action_open_with) val contentDescription = rule.activity.getString(CommonStrings.action_open_with)
rule.onNodeWithContentDescription(contentDescription).assertHasClickAction() rule.onNodeWithContentDescription(contentDescription)
.assertExists()
.assertHasClickAction()
val imageContentDescription = rule.activity.getString(CommonStrings.common_image) val imageContentDescription = rule.activity.getString(CommonStrings.common_image)
rule.onNodeWithContentDescription(imageContentDescription).performClick() rule.onNodeWithContentDescription(imageContentDescription).performClick()
// assertHasNoClickAction does not work as expected (?) // Give time for the animation (? since even by removing AnimatedVisibility it still fails)
// rule.onNodeWithContentDescription(contentDescription).assertHasNoClickAction() rule.mainClock.advanceTimeBy(1_000)
rule.onNodeWithContentDescription(contentDescription).performClick() rule.onNodeWithContentDescription(contentDescription)
// No emitted event .assertDoesNotExist()
} }
@Ignore("This test is not passing yet, maybe due to interaction with ZoomableAsyncImage?")
@Test @Test
fun `clicking swipe on the image invokes the expected callback`() { fun `clicking swipe on the image invokes the expected callback`() {
val eventsRecorder = EventsRecorder<MediaViewerEvents>(expectEvents = false) val eventsRecorder = EventsRecorder<MediaViewerEvents>(expectEvents = false)
@ -121,7 +120,7 @@ class MediaViewerViewTest {
onBackClick = callback, onBackClick = callback,
) )
val imageContentDescription = rule.activity.getString(CommonStrings.common_image) val imageContentDescription = rule.activity.getString(CommonStrings.common_image)
rule.onNodeWithContentDescription(imageContentDescription).performTouchInput { swipeDown() } rule.onNodeWithContentDescription(imageContentDescription).performTouchInput { swipeDown(startY = centerY) }
rule.mainClock.advanceTimeBy(1_000) rule.mainClock.advanceTimeBy(1_000)
} }
} }