region method
Configure check to match a region or element in a window, instead of the entire window.
Syntax
eyes.check(Target.region(region))
eyes.check(Target.region(matcher))
eyes.check(Target.region(view))
Note: This method is a static method.
Parameters
- region
- Type:Region
- The region to be checked.
- matcher
- Type:Matcher
- The Matcher types can be any of the following Hamcrest Matchers: ViewMatcher, RootMatcher, LayoutMatcher or PreferenceMatcher
- view
- Type:View
- An instance of the Android view class
Return value
- Type: EspressoCheckSettings
Remarks
Handling popups and dialogs
If your checkpoints includes a popup or dialog then the way you create the checkpoint depends on which layers you want to capture as illustrated in the code below:
eyes.check('viewport only', Target.window());
eyes.check('dialog only',Target.window().dialog());
eyes.check('popup only',Target.window().popup());
eyes.check('viewport and popup or dialog',Target.window().includeAllLayers());
The example illustrate the behavior with a Target.window target, but they apply to a Target.region, Target.googleMap or Target.fragment as well.