Package 

Class UiInterceptor


  • 
    public final class UiInterceptor<Interaction extends Object, Assertion extends Object, Action extends Object>
    
                        

    Base class for intercepting the call chain from Kautomator to UiAutomator.

    Interceptors can be provided through KautomatorConfigurator runtime, different com.kaspersky.components.kautomator.component.screen.UiScreen as well as UiViews.

    Interceptors are stacked during the runtime for any UiAutomator_DSL-UiAutomator check and perform operations. The stack ordering is following: UiView interceptor -> UiScreen interceptors -> UiAutomatorDsl interceptor.

    Any of the interceptors in the chain can break the chain call by setting isOverride to true in onCheck, onPerform or onAll interception functions during the configuration. Doing this will not only prevent underlying interceptors from being invoked, but prevents UiAutomator from executing the operation. In that case, responsibility for actually making UiAutomator call lies on developer.

    For each operation the interceptor invocation cycle will be as follows:

    // For check operation
    onAll?.invoke()
    onCheck?.invoke()
    
    // For perform operation
    onAll?.invoke()
    onPerform?.invoke()