Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capture interceptor #202

Open
1 of 5 tasks
DanielJette opened this issue Jan 15, 2024 · 0 comments
Open
1 of 5 tasks

Add capture interceptor #202

DanielJette opened this issue Jan 15, 2024 · 0 comments
Labels
Feedback Library Relates to the Testify Kotlin library: ScreenshotRule, ScreenshotInstrumentation, etc.

Comments

@DanielJette
Copy link
Contributor

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()
}
@DanielJette DanielJette added Feedback Library Relates to the Testify Kotlin library: ScreenshotRule, ScreenshotInstrumentation, etc. labels Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feedback Library Relates to the Testify Kotlin library: ScreenshotRule, ScreenshotInstrumentation, etc.
Projects
None yet
Development

No branches or pull requests

1 participant