Package dev.testify

Class ComposableScreenshotRule

  • All Implemented Interfaces:
    dev.testify.CompatibilityMethods , dev.testify.ScreenshotLifecycle , dev.testify.core.logic.AssertionState , dev.testify.core.logic.ScreenshotLifecycleHost , dev.testify.internal.helpers.ActivityProvider , org.junit.rules.TestRule

    
    public class ComposableScreenshotRule
    extends ScreenshotRule<ComposableTestActivity>
                        

    Helper extension of ScreenshotRule which simplifies testing Composable functions.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Function0<Unit> getComposeFunction()
      final Unit setComposeFunction(Function0<Unit> composeFunction)
      Unit onCleanUp(Activity activity)
      ComposableScreenshotRule setCaptureMethod(Function2<Activity, View, Bitmap> captureMethod)
      Unit beforeAssertSame() Set a screenshot view provider to capture only the @Composable bounds
      Unit afterScreenshot(Activity activity, Bitmap currentBitmap) Proactively dispose of any compositions after the screenshot has been taken.
      final ComposableScreenshotRule setCompose(Function0<Unit> composable) Used to provide a @Composable function to be rendered in the screenshot.
      final ComposableScreenshotRule setComposeActions(Function1<ComposeTestRule, Unit> actions) UI tests in Compose use semantics to interact with the UI hierarchy.
      Unit afterInitializeView(Activity activity) Test lifecycle method.
      Unit beforeScreenshot(Activity activity) Test lifecycle method.
      Statement apply(Statement base, Description description) Modifies the method-running Statement to implement this test-running rule.
      ComposableScreenshotRule configure(Function1<TestifyConfiguration, Unit> configureRule) Set the configuration for the ComposableScreenshotRule
      • Methods inherited from class androidx.test.rule.ActivityTestRule

        finishActivity, getActivity, getActivityResult, runOnUiThread
      • Methods inherited from class dev.testify.ScreenshotRule

        addIntentExtras, apply, assertForScreenshotInstrumentationAnnotation, assertSame, assureActivity, getActivityIntent, getAssertSameInvoked, getRootViewId, getScreenshotViewProvider, getTargetLayoutId, getThrowable, getViewModification, isDebugMode, launchActivity, setAssertSameInvoked, setDebugMode, setEspressoActions, setRootViewId, setRootViewId, setScreenshotViewProvider, setScreenshotViewProvider, setTargetLayoutId, setTargetLayoutId, setThrowable, setViewModification, setViewModifications, withExperimentalFeatureEnabled
      • Methods inherited from class dev.testify.core.logic.ScreenshotLifecycleHost

        addScreenshotObserver, notifyObservers, removeScreenshotObserver
      • Methods inherited from class dev.testify.ScreenshotLifecycle

        applyConfiguration, beforeInitializeView
      • Methods inherited from class dev.testify.CompatibilityMethods

        defineExclusionRects, setCompareMethod, setExactness, setFocusTarget, setFontScale, setHideCursor, setHidePasswords, setHideScrollbars, setHideSoftKeyboard, setHideTextSuggestions, setLayoutInspectionModeEnabled, setLocale, setOrientation, setRecordModeEnabled, setUseSoftwareRenderer, withRule
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait