Skip to content

Add capture interceptor #202

@DanielJette

Description

@DanielJette

Is your feature request related to a problem? Please describe.

It would be cool if there was an easy way to intercept the captured bitmap, for logging, modification, or debugging.

There's already afterScreenshot on the ScreenshotLifecycle but this requires you to subclass the TestRule. It would be nicer if you could register any number of interceptors and have them called by Testify automatically, without having to subclass the rule.

This feedback relates to:

  • The Kotlin library
  • The Gradle plugin
  • The IntelliJ Platform plugin
  • The sample code
  • The documentation

Describe the solution you'd like

fun addBitmapInterceptor(interceptor: (Bitmap) -> Bitmap)

@ScreenshotTest
@Test
fun default() {
    rule
        .addBitmapInterceptor { bitmap ->
            Log.d("Testify", "The bitmap was captured")
            bitmap
        }
        .addBitmapInterceptor { bitmap ->
            val newBitmap = obfuscate(bitmap)
            newBitmap
        }
        .assertSame()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeedbackLibraryRelates to the Testify Kotlin library: ScreenshotRule, ScreenshotInstrumentation, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions