Skip to content

Commit

Permalink
Updates tests to skip on record.
Browse files Browse the repository at this point in the history
  • Loading branch information
rharter committed Apr 23, 2024
1 parent 1763424 commit c077c0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.dropbox.differ.Image
import com.dropbox.differ.ImageComparator
import com.dropbox.differ.ImageComparator.ComparisonResult
import com.dropbox.differ.Mask
import org.junit.Assume.assumeFalse
import org.junit.Before
import org.junit.Rule
import org.junit.Test
Expand All @@ -32,8 +33,7 @@ class CustomImageComparatorTest {

@Test
fun imageComparatorIsConfigurable() {
// This doesn't do anything if we're recording.
if (isRecordingScreenshots) return
assumeFalse(isRecordingScreenshots)

val calls = mutableListOf<Triple<Image, Image, Mask?>>()
comparator.compareFunc = { left, right, mask ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import android.view.ViewGroup
import android.widget.LinearLayout
import androidx.test.ext.junit.rules.ActivityScenarioRule
import com.dropbox.differ.SimpleImageComparator
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNotNull
import org.junit.Assert.fail
import org.junit.Assert.*
import org.junit.Assume.assumeFalse
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test

Expand Down Expand Up @@ -84,8 +82,7 @@ class DropshotsTest {

@Test
fun testFailsForDifferences() {
// This doesn't do anything if we're recording.
if (isRecordingScreenshots) return
assumeFalse(isRecordingScreenshots)

var failed = false
activityScenarioRule.scenario.onActivity {
Expand All @@ -112,6 +109,8 @@ class DropshotsTest {

@Test
fun testPassesWhenValidatorPasses() {
assumeFalse(isRecordingScreenshots)

fakeValidator.validator = { true }
activityScenarioRule.scenario.onActivity {
dropshots.assertSnapshot(
Expand All @@ -124,6 +123,8 @@ class DropshotsTest {

@Test
fun testFailsWhenValidatorFails() {
assumeFalse(isRecordingScreenshots)

fakeValidator.validator = { false }

var caughtError: AssertionError? = null
Expand All @@ -144,8 +145,7 @@ class DropshotsTest {

@Test
fun fastFailsForMismatchedSize() {
// This doesn't do anything if we're recording.
if (isRecordingScreenshots) return
assumeFalse(isRecordingScreenshots)

var failed = false
activityScenarioRule.scenario.onActivity {
Expand Down

0 comments on commit c077c0c

Please sign in to comment.